From b0be6a88c8fecdf15176f642c0799bff99930e0d Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 21 Jan 2011 08:10:52 +0000 Subject: xserver mesa xkbcomp libxcb git update 21 jan 2011 --- libxcb/configure.ac | 508 +- libxcb/src/Makefile.am | 461 +- mesalib/configs/autoconf.in | 403 +- mesalib/configs/default | 364 +- mesalib/configure.ac | 3684 +++--- mesalib/docs/README.WIN32 | 16 +- mesalib/src/glsl/glsl_symbol_table.cpp | 331 +- mesalib/src/mapi/glapi/Makefile | 120 +- mesalib/src/mapi/glapi/gen-es/Makefile | 183 +- .../src/mapi/glapi/gen/ARB_get_program_binary.xml | 36 + mesalib/src/mapi/glapi/gen/Makefile | 441 +- mesalib/src/mapi/glapi/gen/OES_fixed_point.xml | 259 + .../src/mapi/glapi/gen/OES_single_precision.xml | 47 + mesalib/src/mapi/glapi/gen/es_EXT.xml | 618 + mesalib/src/mapi/glapi/gen/glX_proto_send.py | 2141 +-- mesalib/src/mapi/glapi/gen/gl_and_es_API.xml | 286 + mesalib/src/mapi/glapi/gen/gl_enums.py | 43 +- mesalib/src/mapi/glapi/glapi_mapi_tmp.h | 13105 +++++++++++++++++++ mesalib/src/mapi/mapi/entry.c | 171 +- mesalib/src/mapi/mapi/entry_x86-64_tls.h | 244 +- mesalib/src/mapi/mapi/entry_x86_tls.h | 287 +- mesalib/src/mapi/mapi/entry_x86_tsd.h | 201 +- mesalib/src/mapi/mapi/mapi_abi.py | 1943 ++- mesalib/src/mapi/mapi/mapi_glapi.c | 240 + mesalib/src/mapi/mapi/mapi_tmp.h | 81 +- mesalib/src/mapi/mapi/sources.mak | 58 +- mesalib/src/mapi/mapi/u_current.h | 173 +- mesalib/src/mesa/main/context.c | 13 +- mesalib/src/mesa/main/dd.h | 2397 ++-- mesalib/src/mesa/main/debug.c | 1246 +- mesalib/src/mesa/main/enums.c | 12577 +++++++++--------- mesalib/src/mesa/main/enums.h | 124 +- mesalib/src/mesa/main/mtypes.h | 22 +- mesalib/src/mesa/main/shaderapi.c | 1 + mesalib/src/mesa/state_tracker/st_atom_texture.c | 636 +- mesalib/src/mesa/state_tracker/st_texture.h | 446 +- mesalib/src/mesa/vbo/vbo.h | 346 +- xkbcomp/Makefile.am | 165 +- xkbcomp/configure.ac | 121 +- xkbcomp/man/Makefile.am | 12 + xkbcomp/man/xkbcomp.man | 107 + xkbcomp/xkbcomp.man | 107 - xorg-server/Xi/exevents.c | 4353 +++--- xorg-server/Xi/extinit.c | 2617 ++-- xorg-server/Xi/xiwarppointer.c | 2 + xorg-server/configure.ac | 4 +- xorg-server/dix/events.c | 11632 ++++++++-------- xorg-server/dix/inpututils.c | 1108 +- xorg-server/dix/resource.c | 1938 ++- xorg-server/hw/dmx/config/xdmxconfig.c | 2 +- xorg-server/hw/dmx/dmxextension.c | 3238 ++--- xorg-server/hw/dmx/dmxgc.c | 837 +- xorg-server/hw/dmx/input/dmxinputinit.c | 2580 ++-- xorg-server/hw/xfree86/doc/man/Makefile.am | 2 +- xorg-server/hw/xfree86/doc/man/xorg.conf.d.man | 1 + xorg-server/hw/xwin/InitOutput.c | 2219 ++-- xorg-server/hw/xwin/Makefile.am | 1 + xorg-server/hw/xwin/man/XWin.man | 85 +- xorg-server/hw/xwin/win.h | 2950 ++--- xorg-server/hw/xwin/wincreatewnd.c | 48 +- xorg-server/hw/xwin/windialogs.c | 1547 ++- xorg-server/hw/xwin/winmonitors.c | 92 + xorg-server/hw/xwin/winmonitors.h | 14 + xorg-server/hw/xwin/winnativegdi.c | 1073 +- xorg-server/hw/xwin/winpfbdd.c | 1354 +- xorg-server/hw/xwin/winprocarg.c | 2473 ++-- xorg-server/hw/xwin/winrandr.c | 302 +- xorg-server/hw/xwin/winscrinit.c | 1536 +-- xorg-server/hw/xwin/winshaddd.c | 2766 ++-- xorg-server/hw/xwin/winshadddnl.c | 2808 ++-- xorg-server/hw/xwin/winshadgdi.c | 2526 ++-- xorg-server/hw/xwin/winvalargs.c | 360 +- xorg-server/hw/xwin/winwindow.c | 1273 +- xorg-server/hw/xwin/winwndproc.c | 2575 ++-- xorg-server/include/dix.h | 1211 +- xorg-server/include/input.h | 1174 +- xorg-server/include/inputstr.h | 1230 +- xorg-server/mi/miinitext.c | 2 - xorg-server/os/WaitFor.c | 1368 +- xorg-server/test/input.c | 2172 ++- xorg-server/test/xi2/protocol-eventconvert.c | 1824 +-- xorg-server/test/xi2/protocol-xiselectevents.c | 18 +- xorg-server/xkb/XKBMisc.c | 1679 +-- xorg-server/xkb/xkbUtils.c | 4247 +++--- 84 files changed, 64875 insertions(+), 49130 deletions(-) create mode 100644 mesalib/src/mapi/glapi/gen/ARB_get_program_binary.xml create mode 100644 mesalib/src/mapi/glapi/gen/OES_fixed_point.xml create mode 100644 mesalib/src/mapi/glapi/gen/OES_single_precision.xml create mode 100644 mesalib/src/mapi/glapi/gen/es_EXT.xml create mode 100644 mesalib/src/mapi/glapi/gen/gl_and_es_API.xml create mode 100644 mesalib/src/mapi/glapi/glapi_mapi_tmp.h create mode 100644 mesalib/src/mapi/mapi/mapi_glapi.c create mode 100644 xkbcomp/man/Makefile.am create mode 100644 xkbcomp/man/xkbcomp.man delete mode 100644 xkbcomp/xkbcomp.man create mode 100644 xorg-server/hw/xfree86/doc/man/xorg.conf.d.man create mode 100644 xorg-server/hw/xwin/winmonitors.c create mode 100644 xorg-server/hw/xwin/winmonitors.h diff --git a/libxcb/configure.ac b/libxcb/configure.ac index f8ff9bc57..a8e171b07 100644 --- a/libxcb/configure.ac +++ b/libxcb/configure.ac @@ -1,249 +1,259 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.57) -AC_INIT([libxcb], - 1.7, - [xcb@lists.freedesktop.org]) -AC_CONFIG_SRCDIR([xcb.pc.in]) -AM_INIT_AUTOMAKE([foreign dist-bzip2]) - -AM_PATH_PYTHON([2.5]) - -PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], [HAVE_CHECK=yes], [HAVE_CHECK=no]) -AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xyes) - -AC_CONFIG_HEADERS([src/config.h]) - -AC_PROG_LIBTOOL -AC_PROG_CC - -AC_PATH_PROG(XSLTPROC, xsltproc, no) -if test "$XSLTPROC" = "no"; then - AC_MSG_ERROR([XCB requires xsltproc.]) -fi - -HTML_CHECK_RESULT=false -if test x"$HAVE_CHECK" = xyes; then - if test x"$XSLTPROC" != xno; then - HTML_CHECK_RESULT=true - fi -fi -AC_SUBST(HTML_CHECK_RESULT) - -# Checks for pkg-config packages -PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.6) -NEEDED="pthread-stubs xau >= 0.99.2" -PKG_CHECK_MODULES(NEEDED, $NEEDED) - -have_xdmcp="no" -PKG_CHECK_MODULES(XDMCP, xdmcp, - AC_CHECK_LIB(Xdmcp, XdmcpWrap, - [ - AC_DEFINE(HASXDMAUTH,1,[Has Wraphelp.c needed for XDM AUTH protocols]) - NEEDED="$NEEDED xdmcp" - have_xdmcp="yes" - ], - [ - XDMCP_CFLAGS= - XDMCP_LIBS= - ], [$XDMCP_LIBS]), - [AC_MSG_RESULT(no)]) - -AC_SUBST(NEEDED) - -# Find the xcb-proto protocol descriptions -AC_MSG_CHECKING(XCBPROTO_XCBINCLUDEDIR) -XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto` -AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR) -AC_SUBST(XCBPROTO_XCBINCLUDEDIR) - -# Find the xcb-proto version -XCBPROTO_VERSION=`$PKG_CONFIG --modversion xcb-proto` -AC_SUBST(XCBPROTO_VERSION) - -# Find the xcbgen Python package -AC_MSG_CHECKING(XCBPROTO_XCBPYTHONDIR) -XCBPROTO_XCBPYTHONDIR=`$PKG_CONFIG --variable=pythondir xcb-proto` -AC_MSG_RESULT($XCBPROTO_XCBPYTHONDIR) -AC_SUBST(XCBPROTO_XCBPYTHONDIR) - -AC_HEADER_STDC -AC_SEARCH_LIBS(getaddrinfo, socket) -AC_SEARCH_LIBS(connect, socket) - -case $host_os in -linux*) - AC_DEFINE([HAVE_ABSTRACT_SOCKETS], 1, [Define if your platform supports abstract sockets]) - ;; -esac - -dnl define buffer queue size -AC_ARG_WITH([queue-size], - AC_HELP_STRING([--with-queue-size=SIZE], - [Set the XCB buffer queue size (default is 16384)]), - [xcb_queue_buffer_size="$withval"], - [xcb_queue_buffer_size=16384]) -AC_DEFINE_UNQUOTED(XCB_QUEUE_BUFFER_SIZE, [$xcb_queue_buffer_size], - [XCB buffer queue size]) - -dnl check for the sockaddr_un.sun_len member -AC_CHECK_MEMBER([struct sockaddr_un.sun_len], - [AC_DEFINE(HAVE_SOCKADDR_SUN_LEN,1,[Have the sockaddr_un.sun_len member.])], - [], - [ #include - #include - ]) - -xcbincludedir='${includedir}/xcb' -AC_SUBST(xcbincludedir) - -if test "x$GCC" = xyes ; then - CWARNFLAGS="-Wall -pedantic -Wpointer-arith \ - -Wstrict-prototypes -Wmissing-declarations -Wnested-externs" -else - AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) - if test "x$SUNCC" = "xyes"; then - CWARNFLAGS="-v" - fi -fi -AC_SUBST(CWARNFLAGS) - -XCB_CHECK_VISIBILITY() - -# htmldir is not defined prior to autoconf 2.59c, so on earlier versions -# set an equivalent value. -AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME], - ['${datadir}/doc/${PACKAGE_TARNAME}'], - ['${datadir}/doc/${PACKAGE}']) -])]) - -XCB_CHECK_DOXYGEN() - -case $host_os in - # darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard) - darwin*) ;; - *) - AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) - ;; -esac - -XCB_EXTENSION(Composite, "yes") -XCB_EXTENSION(Damage, "yes") -XCB_EXTENSION(DPMS, "yes") -XCB_EXTENSION(DRI2, "yes") -XCB_EXTENSION(GLX, "yes") -XCB_EXTENSION(RandR, "yes") -XCB_EXTENSION(Record, "yes") -XCB_EXTENSION(Render, "yes") -XCB_EXTENSION(Resource, "yes") -XCB_EXTENSION(Screensaver, "yes") -XCB_EXTENSION(Shape, "yes") -XCB_EXTENSION(Shm, "yes") -XCB_EXTENSION(Sync, "yes") -XCB_EXTENSION(Xevie, "yes") -XCB_EXTENSION(XFixes, "yes") -XCB_EXTENSION(XFree86-DRI, "yes") -XCB_EXTENSION(Xinerama, "yes") -XCB_EXTENSION(XInput, "no") -XCB_EXTENSION(XKB, "no") -XCB_EXTENSION(Xprint, "yes") -XCB_EXTENSION(SELinux, "no") -XCB_EXTENSION(XTest, "yes") -XCB_EXTENSION(Xv, "yes") -XCB_EXTENSION(XvMC, "yes") - -AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto]) -if test "x$LAUNCHD" = xauto; then - unset LAUNCHD - AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin]) -fi - -if test "x$LAUNCHD" = xyes ; then - AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available]) -fi - -AC_CONFIG_FILES([ -Makefile -doc/Makefile -src/Makefile -tests/Makefile -]) - -AC_CONFIG_FILES([ -xcb.pc -xcb-composite.pc -xcb-damage.pc -xcb-dpms.pc -xcb-dri2.pc -xcb-glx.pc -xcb-randr.pc -xcb-record.pc -xcb-render.pc -xcb-res.pc -xcb-screensaver.pc -xcb-shape.pc -xcb-shm.pc -xcb-sync.pc -xcb-xevie.pc -xcb-xf86dri.pc -xcb-xfixes.pc -xcb-xinerama.pc -xcb-xinput.pc -xcb-xkb.pc -xcb-xprint.pc -xcb-xselinux.pc -xcb-xtest.pc -xcb-xv.pc -xcb-xvmc.pc -]) - -AC_CONFIG_FILES([ -doc/xcb.doxygen -]) - -AC_OUTPUT - -dnl Configuration output - -echo "" -echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}" -echo "" -echo " Configuration" -echo " XDM support.........: ${have_xdmcp}" -echo " Build unit tests....: ${HAVE_CHECK}" -echo " XCB buffer size.....: ${xcb_queue_buffer_size}" -echo "" -echo " X11 extensions" -echo " Composite...........: ${BUILD_COMPOSITE}" -echo " Damage..............: ${BUILD_DAMAGE}" -echo " Dpms................: ${BUILD_DPMS}" -echo " Dri2................: ${BUILD_DRI2}" -echo " Glx.................: ${BUILD_GLX}" -echo " Randr...............: ${BUILD_RANDR}" -echo " Record..............: ${BUILD_RECORD}" -echo " Render..............: ${BUILD_RENDER}" -echo " Resource............: ${BUILD_RESOURCE}" -echo " Screensaver.........: ${BUILD_SCREENSAVER}" -echo " selinux.............: ${BUILD_SELINUX}" -echo " Shape...............: ${BUILD_SHAPE}" -echo " Shm.................: ${BUILD_SHM}" -echo " Sync................: ${BUILD_SYNC}" -echo " Xevie...............: ${BUILD_XEVIE}" -echo " Xfixes..............: ${BUILD_XFIXES}" -echo " Xfree86-dri.........: ${BUILD_XFREE86_DRI}" -echo " xinerama............: ${BUILD_XINERAMA}" -echo " xinput..............: ${BUILD_XINPUT}" -echo " xprint..............: ${BUILD_XPRINT}" -echo " xtest...............: ${BUILD_XTEST}" -echo " xv..................: ${BUILD_XV}" -echo " xvmc................: ${BUILD_XVMC}" -echo "" -echo " Used CFLAGS:" -echo " CPPFLAGS............: ${CPPFLAGS}" -echo " CFLAGS..............: ${CFLAGS}" -echo " Warning CFLAGS......: ${CWARNFLAGS}" -echo "" -echo " Installation:" -echo " Prefix..............: ${prefix}" -echo "" +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.57) +AC_INIT([libxcb], + 1.7, + [xcb@lists.freedesktop.org]) +AC_CONFIG_SRCDIR([xcb.pc.in]) +AM_INIT_AUTOMAKE([foreign dist-bzip2]) + +AM_PATH_PYTHON([2.5]) + +PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], [HAVE_CHECK=yes], [HAVE_CHECK=no]) +AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xyes) + +AC_CONFIG_HEADERS([src/config.h]) + +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL +AC_PROG_CC + +AC_PATH_PROG(XSLTPROC, xsltproc, no) +if test "$XSLTPROC" = "no"; then + AC_MSG_ERROR([XCB requires xsltproc.]) +fi + +HTML_CHECK_RESULT=false +if test x"$HAVE_CHECK" = xyes; then + if test x"$XSLTPROC" != xno; then + HTML_CHECK_RESULT=true + fi +fi +AC_SUBST(HTML_CHECK_RESULT) + +# Checks for pkg-config packages +PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.6) +NEEDED="pthread-stubs xau >= 0.99.2" +PKG_CHECK_MODULES(NEEDED, $NEEDED) + +have_xdmcp="no" +PKG_CHECK_MODULES(XDMCP, xdmcp, + AC_CHECK_LIB(Xdmcp, XdmcpWrap, + [ + AC_DEFINE(HASXDMAUTH,1,[Has Wraphelp.c needed for XDM AUTH protocols]) + NEEDED="$NEEDED xdmcp" + have_xdmcp="yes" + ], + [ + XDMCP_CFLAGS= + XDMCP_LIBS= + ], [$XDMCP_LIBS]), + [AC_MSG_RESULT(no)]) + +AC_SUBST(NEEDED) + +# Find the xcb-proto protocol descriptions +AC_MSG_CHECKING(XCBPROTO_XCBINCLUDEDIR) +XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto` +AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR) +AC_SUBST(XCBPROTO_XCBINCLUDEDIR) + +# Find the xcb-proto version +XCBPROTO_VERSION=`$PKG_CONFIG --modversion xcb-proto` +AC_SUBST(XCBPROTO_VERSION) + +# Find the xcbgen Python package +AC_MSG_CHECKING(XCBPROTO_XCBPYTHONDIR) +XCBPROTO_XCBPYTHONDIR=`$PKG_CONFIG --variable=pythondir xcb-proto` +AC_MSG_RESULT($XCBPROTO_XCBPYTHONDIR) +AC_SUBST(XCBPROTO_XCBPYTHONDIR) + +AC_HEADER_STDC +AC_SEARCH_LIBS(getaddrinfo, socket) +AC_SEARCH_LIBS(connect, socket) + +have_win32="no" +lt_enable_auto_import="" +case $host_os in +mingw*) + have_win32="yes" + lt_enable_auto_import="-Wl,--enable-auto-import" + ;; +linux*) + AC_DEFINE([HAVE_ABSTRACT_SOCKETS], 1, [Define if your platform supports abstract sockets]) + ;; +esac + +AC_SUBST(lt_enable_auto_import) +AM_CONDITIONAL([XCB_HAVE_WIN32], [test "x${have_win32}" = "xyes"]) + +dnl define buffer queue size +AC_ARG_WITH([queue-size], + AC_HELP_STRING([--with-queue-size=SIZE], + [Set the XCB buffer queue size (default is 16384)]), + [xcb_queue_buffer_size="$withval"], + [xcb_queue_buffer_size=16384]) +AC_DEFINE_UNQUOTED(XCB_QUEUE_BUFFER_SIZE, [$xcb_queue_buffer_size], + [XCB buffer queue size]) + +dnl check for the sockaddr_un.sun_len member +AC_CHECK_MEMBER([struct sockaddr_un.sun_len], + [AC_DEFINE(HAVE_SOCKADDR_SUN_LEN,1,[Have the sockaddr_un.sun_len member.])], + [], + [ #include + #include + ]) + +xcbincludedir='${includedir}/xcb' +AC_SUBST(xcbincludedir) + +if test "x$GCC" = xyes ; then + CWARNFLAGS="-Wall -pedantic -Wpointer-arith \ + -Wstrict-prototypes -Wmissing-declarations -Wnested-externs" +else + AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) + if test "x$SUNCC" = "xyes"; then + CWARNFLAGS="-v" + fi +fi +AC_SUBST(CWARNFLAGS) + +XCB_CHECK_VISIBILITY() + +# htmldir is not defined prior to autoconf 2.59c, so on earlier versions +# set an equivalent value. +AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datadir}/doc/${PACKAGE_TARNAME}'], + ['${datadir}/doc/${PACKAGE}']) +])]) + +XCB_CHECK_DOXYGEN() + +case $host_os in + # darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard) + darwin*) ;; + *) + AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) + ;; +esac + +XCB_EXTENSION(Composite, "yes") +XCB_EXTENSION(Damage, "yes") +XCB_EXTENSION(DPMS, "yes") +XCB_EXTENSION(DRI2, "yes") +XCB_EXTENSION(GLX, "yes") +XCB_EXTENSION(RandR, "yes") +XCB_EXTENSION(Record, "yes") +XCB_EXTENSION(Render, "yes") +XCB_EXTENSION(Resource, "yes") +XCB_EXTENSION(Screensaver, "yes") +XCB_EXTENSION(Shape, "yes") +XCB_EXTENSION(Shm, "yes") +XCB_EXTENSION(Sync, "yes") +XCB_EXTENSION(Xevie, "yes") +XCB_EXTENSION(XFixes, "yes") +XCB_EXTENSION(XFree86-DRI, "yes") +XCB_EXTENSION(Xinerama, "yes") +XCB_EXTENSION(XInput, "no") +XCB_EXTENSION(XKB, "no") +XCB_EXTENSION(Xprint, "yes") +XCB_EXTENSION(SELinux, "no") +XCB_EXTENSION(XTest, "yes") +XCB_EXTENSION(Xv, "yes") +XCB_EXTENSION(XvMC, "yes") + +AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto]) +if test "x$LAUNCHD" = xauto; then + unset LAUNCHD + AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin]) +fi + +if test "x$LAUNCHD" = xyes ; then + AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available]) +fi + +AC_CONFIG_FILES([ +Makefile +doc/Makefile +src/Makefile +tests/Makefile +]) + +AC_CONFIG_FILES([ +xcb.pc +xcb-composite.pc +xcb-damage.pc +xcb-dpms.pc +xcb-dri2.pc +xcb-glx.pc +xcb-randr.pc +xcb-record.pc +xcb-render.pc +xcb-res.pc +xcb-screensaver.pc +xcb-shape.pc +xcb-shm.pc +xcb-sync.pc +xcb-xevie.pc +xcb-xf86dri.pc +xcb-xfixes.pc +xcb-xinerama.pc +xcb-xinput.pc +xcb-xkb.pc +xcb-xprint.pc +xcb-xselinux.pc +xcb-xtest.pc +xcb-xv.pc +xcb-xvmc.pc +]) + +AC_CONFIG_FILES([ +doc/xcb.doxygen +]) + +AC_OUTPUT + +dnl Configuration output + +echo "" +echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}" +echo "" +echo " Configuration" +echo " XDM support.........: ${have_xdmcp}" +echo " Build unit tests....: ${HAVE_CHECK}" +echo " XCB buffer size.....: ${xcb_queue_buffer_size}" +echo "" +echo " X11 extensions" +echo " Composite...........: ${BUILD_COMPOSITE}" +echo " Damage..............: ${BUILD_DAMAGE}" +echo " Dpms................: ${BUILD_DPMS}" +echo " Dri2................: ${BUILD_DRI2}" +echo " Glx.................: ${BUILD_GLX}" +echo " Randr...............: ${BUILD_RANDR}" +echo " Record..............: ${BUILD_RECORD}" +echo " Render..............: ${BUILD_RENDER}" +echo " Resource............: ${BUILD_RESOURCE}" +echo " Screensaver.........: ${BUILD_SCREENSAVER}" +echo " selinux.............: ${BUILD_SELINUX}" +echo " Shape...............: ${BUILD_SHAPE}" +echo " Shm.................: ${BUILD_SHM}" +echo " Sync................: ${BUILD_SYNC}" +echo " Xevie...............: ${BUILD_XEVIE}" +echo " Xfixes..............: ${BUILD_XFIXES}" +echo " Xfree86-dri.........: ${BUILD_XFREE86_DRI}" +echo " xinerama............: ${BUILD_XINERAMA}" +echo " xinput..............: ${BUILD_XINPUT}" +echo " xprint..............: ${BUILD_XPRINT}" +echo " xtest...............: ${BUILD_XTEST}" +echo " xv..................: ${BUILD_XV}" +echo " xvmc................: ${BUILD_XVMC}" +echo "" +echo " Used CFLAGS:" +echo " CPPFLAGS............: ${CPPFLAGS}" +echo " CFLAGS..............: ${CFLAGS}" +echo " Warning CFLAGS......: ${CWARNFLAGS}" +echo "" +echo " Installation:" +echo " Prefix..............: ${prefix}" +echo "" diff --git a/libxcb/src/Makefile.am b/libxcb/src/Makefile.am index 207c26fdf..950de5c14 100644 --- a/libxcb/src/Makefile.am +++ b/libxcb/src/Makefile.am @@ -1,229 +1,232 @@ -lib_LTLIBRARIES = libxcb.la - -EXTSOURCES = xproto.c \ - bigreq.c \ - xc_misc.c - -AM_CFLAGS = $(CWARNFLAGS) $(NEEDED_CFLAGS) $(XDMCP_CFLAGS) -libxcb_la_LIBADD = $(NEEDED_LIBS) $(XDMCP_LIBS) -libxcb_la_SOURCES = \ - xcb_conn.c xcb_out.c xcb_in.c xcb_ext.c xcb_xid.c \ - xcb_list.c xcb_util.c xcb_auth.c c_client.py -nodist_libxcb_la_SOURCES = xproto.c bigreq.c xc_misc.c - -# Explanation for -version-info: -# -version-info current:revision:age -# The library supports interface (current-age) to interface current. -# * If you changed the source code at all, increment revision. -# * If you add an interface, increment current and age and set revision to 0. -# * If you change or remove an interface, increment current and set revision -# and age to 0. -libxcb_la_LDFLAGS = -version-info 2:0:1 -no-undefined - -XCB_LIBS = libxcb.la - -# FIXME: find a way to autogenerate this from the XML files. - -EXTSOURCES += composite.c -if BUILD_COMPOSITE -lib_LTLIBRARIES += libxcb-composite.la -libxcb_composite_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_composite_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_composite_la_SOURCES = composite.c composite.h -endif - -EXTSOURCES += damage.c -if BUILD_DAMAGE -lib_LTLIBRARIES += libxcb-damage.la -libxcb_damage_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_damage_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_damage_la_SOURCES = damage.c damage.h -endif - -EXTSOURCES += dpms.c -if BUILD_DPMS -lib_LTLIBRARIES += libxcb-dpms.la -libxcb_dpms_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_dpms_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_dpms_la_SOURCES = dpms.c dpms.h -endif - -EXTSOURCES += dri2.c -if BUILD_DRI2 -lib_LTLIBRARIES += libxcb-dri2.la -libxcb_dri2_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_dri2_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_dri2_la_SOURCES = dri2.c dri2.h -endif - -EXTSOURCES += glx.c -if BUILD_GLX -lib_LTLIBRARIES += libxcb-glx.la -libxcb_glx_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_glx_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_glx_la_SOURCES = glx.c glx.h -endif - -EXTSOURCES += randr.c -if BUILD_RANDR -lib_LTLIBRARIES += libxcb-randr.la -libxcb_randr_la_LDFLAGS = -version-info 1:0:1 -no-undefined -libxcb_randr_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_randr_la_SOURCES = randr.c randr.h -endif - -EXTSOURCES += record.c -if BUILD_RECORD -lib_LTLIBRARIES += libxcb-record.la -libxcb_record_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_record_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_record_la_SOURCES = record.c record.h -endif - -EXTSOURCES += render.c -if BUILD_RENDER -lib_LTLIBRARIES += libxcb-render.la -libxcb_render_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_render_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_render_la_SOURCES = render.c render.h -endif - -EXTSOURCES += res.c -if BUILD_RESOURCE -lib_LTLIBRARIES += libxcb-res.la -libxcb_res_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_res_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_res_la_SOURCES = res.c res.h -endif - -EXTSOURCES += screensaver.c -if BUILD_SCREENSAVER -lib_LTLIBRARIES += libxcb-screensaver.la -libxcb_screensaver_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_screensaver_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_screensaver_la_SOURCES = screensaver.c screensaver.h -endif - -EXTSOURCES += shape.c -if BUILD_SHAPE -lib_LTLIBRARIES += libxcb-shape.la -libxcb_shape_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_shape_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_shape_la_SOURCES = shape.c shape.h -endif - -EXTSOURCES += shm.c -if BUILD_SHM -lib_LTLIBRARIES += libxcb-shm.la -libxcb_shm_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_shm_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_shm_la_SOURCES = shm.c shm.h -endif - -EXTSOURCES += sync.c -if BUILD_SYNC -lib_LTLIBRARIES += libxcb-sync.la -libxcb_sync_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_sync_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_sync_la_SOURCES = sync.c sync.h -endif - -EXTSOURCES += xevie.c -if BUILD_XEVIE -lib_LTLIBRARIES += libxcb-xevie.la -libxcb_xevie_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xevie_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xevie_la_SOURCES = xevie.c xevie.h -endif - -EXTSOURCES += xf86dri.c -if BUILD_XFREE86_DRI -lib_LTLIBRARIES += libxcb-xf86dri.la -libxcb_xf86dri_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xf86dri_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xf86dri_la_SOURCES = xf86dri.c xf86dri.h -endif - -EXTSOURCES += xfixes.c -if BUILD_XFIXES -lib_LTLIBRARIES += libxcb-xfixes.la -libxcb_xfixes_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xfixes_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xfixes_la_SOURCES = xfixes.c xfixes.h -endif - -EXTSOURCES += xinerama.c -if BUILD_XINERAMA -lib_LTLIBRARIES += libxcb-xinerama.la -libxcb_xinerama_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xinerama_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xinerama_la_SOURCES = xinerama.c xinerama.h -endif - -EXTSOURCES += xinput.c -if BUILD_XINPUT -lib_LTLIBRARIES += libxcb-xinput.la -libxcb_xinput_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xinput_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xinput_la_SOURCES = xinput.c xinput.h -endif - -EXTSOURCES += xkb.c -if BUILD_XKB -lib_LTLIBRARIES += libxcb-xkb.la -libxcb_xkb_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xkb_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xkb_la_SOURCES = xkb.c xkb.h -endif - -EXTSOURCES += xprint.c -if BUILD_XPRINT -lib_LTLIBRARIES += libxcb-xprint.la -libxcb_xprint_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xprint_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xprint_la_SOURCES = xprint.c xprint.h -endif - -EXTSOURCES += xselinux.c -if BUILD_SELINUX -lib_LTLIBRARIES += libxcb-xselinux.la -libxcb_xselinux_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xselinux_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xselinux_la_SOURCES = xselinux.c xselinux.h -endif - -EXTSOURCES += xtest.c -if BUILD_XTEST -lib_LTLIBRARIES += libxcb-xtest.la -libxcb_xtest_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xtest_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xtest_la_SOURCES = xtest.c xtest.h -endif - -EXTSOURCES += xv.c -if BUILD_XV -lib_LTLIBRARIES += libxcb-xv.la -libxcb_xv_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xv_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xv_la_SOURCES = xv.c xv.h -endif - -EXTSOURCES += xvmc.c -if BUILD_XVMC -lib_LTLIBRARIES += libxcb-xvmc.la -libxcb_xvmc_la_LDFLAGS = -version-info 0:0:0 -no-undefined -libxcb_xvmc_la_LIBADD = $(XCB_LIBS) -nodist_libxcb_xvmc_la_SOURCES = xvmc.c xvmc.h -endif - - -EXTHEADERS=$(EXTSOURCES:.c=.h) -xcbinclude_HEADERS = xcb.h xcbext.h -nodist_xcbinclude_HEADERS = $(EXTHEADERS) -noinst_HEADERS = xcbint.h - -BUILT_SOURCES = $(EXTSOURCES) -CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) - -$(EXTSOURCES): c_client.py - $(PYTHON) $(srcdir)/c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml) +lib_LTLIBRARIES = libxcb.la + +EXTSOURCES = xproto.c \ + bigreq.c \ + xc_misc.c + +AM_CFLAGS = $(CWARNFLAGS) $(NEEDED_CFLAGS) $(XDMCP_CFLAGS) +libxcb_la_LIBADD = $(NEEDED_LIBS) $(XDMCP_LIBS) +libxcb_la_SOURCES = \ + xcb_conn.c xcb_out.c xcb_in.c xcb_ext.c xcb_xid.c \ + xcb_list.c xcb_util.c xcb_auth.c c_client.py +nodist_libxcb_la_SOURCES = xproto.c bigreq.c xc_misc.c + +# Explanation for -version-info: +# -version-info current:revision:age +# The library supports interface (current-age) to interface current. +# * If you changed the source code at all, increment revision. +# * If you add an interface, increment current and age and set revision to 0. +# * If you change or remove an interface, increment current and set revision +# and age to 0. +libxcb_la_LDFLAGS = -version-info 2:0:1 -no-undefined @lt_enable_auto_import@ + +XCB_LIBS = libxcb.la + +# FIXME: find a way to autogenerate this from the XML files. + +EXTSOURCES += composite.c +if BUILD_COMPOSITE +lib_LTLIBRARIES += libxcb-composite.la +libxcb_composite_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_composite_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_composite_la_SOURCES = composite.c composite.h +endif + +EXTSOURCES += damage.c +if BUILD_DAMAGE +lib_LTLIBRARIES += libxcb-damage.la +libxcb_damage_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_damage_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_damage_la_SOURCES = damage.c damage.h +endif + +EXTSOURCES += dpms.c +if BUILD_DPMS +lib_LTLIBRARIES += libxcb-dpms.la +libxcb_dpms_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_dpms_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_dpms_la_SOURCES = dpms.c dpms.h +endif + +EXTSOURCES += dri2.c +if BUILD_DRI2 +lib_LTLIBRARIES += libxcb-dri2.la +libxcb_dri2_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_dri2_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_dri2_la_SOURCES = dri2.c dri2.h +endif + +EXTSOURCES += glx.c +if BUILD_GLX +lib_LTLIBRARIES += libxcb-glx.la +libxcb_glx_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_glx_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_glx_la_SOURCES = glx.c glx.h +endif + +EXTSOURCES += randr.c +if BUILD_RANDR +lib_LTLIBRARIES += libxcb-randr.la +libxcb_randr_la_LDFLAGS = -version-info 1:0:1 -no-undefined @lt_enable_auto_import@ +libxcb_randr_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_randr_la_SOURCES = randr.c randr.h +endif + +EXTSOURCES += record.c +if BUILD_RECORD +lib_LTLIBRARIES += libxcb-record.la +libxcb_record_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_record_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_record_la_SOURCES = record.c record.h +endif + +EXTSOURCES += render.c +if BUILD_RENDER +lib_LTLIBRARIES += libxcb-render.la +libxcb_render_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_render_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_render_la_SOURCES = render.c render.h +endif + +EXTSOURCES += res.c +if BUILD_RESOURCE +lib_LTLIBRARIES += libxcb-res.la +libxcb_res_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_res_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_res_la_SOURCES = res.c res.h +endif + +EXTSOURCES += screensaver.c +if BUILD_SCREENSAVER +lib_LTLIBRARIES += libxcb-screensaver.la +libxcb_screensaver_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_screensaver_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_screensaver_la_SOURCES = screensaver.c screensaver.h +endif + +EXTSOURCES += shape.c +if BUILD_SHAPE +lib_LTLIBRARIES += libxcb-shape.la +libxcb_shape_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_shape_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_shape_la_SOURCES = shape.c shape.h +endif + +EXTSOURCES += shm.c +if BUILD_SHM +lib_LTLIBRARIES += libxcb-shm.la +libxcb_shm_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_shm_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_shm_la_SOURCES = shm.c shm.h +endif + +EXTSOURCES += sync.c +if BUILD_SYNC +lib_LTLIBRARIES += libxcb-sync.la +libxcb_sync_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_sync_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_sync_la_SOURCES = sync.c sync.h +endif + +EXTSOURCES += xevie.c +if BUILD_XEVIE +lib_LTLIBRARIES += libxcb-xevie.la +libxcb_xevie_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xevie_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xevie_la_SOURCES = xevie.c xevie.h +endif + +EXTSOURCES += xf86dri.c +if BUILD_XFREE86_DRI +lib_LTLIBRARIES += libxcb-xf86dri.la +libxcb_xf86dri_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xf86dri_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xf86dri_la_SOURCES = xf86dri.c xf86dri.h +endif + +EXTSOURCES += xfixes.c +if BUILD_XFIXES +lib_LTLIBRARIES += libxcb-xfixes.la +libxcb_xfixes_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xfixes_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xfixes_la_SOURCES = xfixes.c xfixes.h +endif + +EXTSOURCES += xinerama.c +if BUILD_XINERAMA +lib_LTLIBRARIES += libxcb-xinerama.la +libxcb_xinerama_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xinerama_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xinerama_la_SOURCES = xinerama.c xinerama.h +endif + +EXTSOURCES += xinput.c +if BUILD_XINPUT +lib_LTLIBRARIES += libxcb-xinput.la +libxcb_xinput_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xinput_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xinput_la_SOURCES = xinput.c xinput.h +endif + +EXTSOURCES += xkb.c +if BUILD_XKB +lib_LTLIBRARIES += libxcb-xkb.la +libxcb_xkb_la_LDFLAGS = -version-info 0:0:0 -no-undefined +libxcb_xkb_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xkb_la_SOURCES = xkb.c xkb.h +endif + +EXTSOURCES += xprint.c +if BUILD_XPRINT +lib_LTLIBRARIES += libxcb-xprint.la +libxcb_xprint_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xprint_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xprint_la_SOURCES = xprint.c xprint.h +endif + +EXTSOURCES += xselinux.c +if BUILD_SELINUX +lib_LTLIBRARIES += libxcb-xselinux.la +libxcb_xselinux_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xselinux_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xselinux_la_SOURCES = xselinux.c xselinux.h +endif + +EXTSOURCES += xtest.c +if BUILD_XTEST +lib_LTLIBRARIES += libxcb-xtest.la +libxcb_xtest_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xtest_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xtest_la_SOURCES = xtest.c xtest.h +endif + +EXTSOURCES += xv.c +if BUILD_XV +lib_LTLIBRARIES += libxcb-xv.la +libxcb_xv_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xv_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xv_la_SOURCES = xv.c xv.h +endif + +EXTSOURCES += xvmc.c +if BUILD_XVMC +lib_LTLIBRARIES += libxcb-xvmc.la +libxcb_xvmc_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@ +libxcb_xvmc_la_LIBADD = $(XCB_LIBS) +nodist_libxcb_xvmc_la_SOURCES = xvmc.c xvmc.h +endif + + +EXTHEADERS=$(EXTSOURCES:.c=.h) +xcbinclude_HEADERS = xcb.h xcbext.h +if XCB_HAVE_WIN32 +xcbinclude_HEADERS += xcb_windefs.h +endif +nodist_xcbinclude_HEADERS = $(EXTHEADERS) +noinst_HEADERS = xcbint.h + +BUILT_SOURCES = $(EXTSOURCES) +CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) + +$(EXTSOURCES): c_client.py + $(PYTHON) $(srcdir)/c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml) diff --git a/mesalib/configs/autoconf.in b/mesalib/configs/autoconf.in index a5bbec6de..6b703cf0a 100644 --- a/mesalib/configs/autoconf.in +++ b/mesalib/configs/autoconf.in @@ -1,199 +1,204 @@ -# Autoconf configuration - -# Pull in the defaults -include $(TOP)/configs/default - -# This is generated by configure -CONFIG_NAME = autoconf - -# Compiler and flags -CC = @CC@ -CXX = @CXX@ -OPT_FLAGS = @OPT_FLAGS@ -ARCH_FLAGS = @ARCH_FLAGS@ -ASM_FLAGS = @ASM_FLAGS@ -PIC_FLAGS = @PIC_FLAGS@ -DEFINES = @DEFINES@ -API_DEFINES = @API_DEFINES@ -CFLAGS = @CPPFLAGS@ @CFLAGS@ \ - $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) -CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \ - $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) -LDFLAGS = @LDFLAGS@ -EXTRA_LIB_PATH = @EXTRA_LIB_PATH@ -RADEON_CFLAGS = @RADEON_CFLAGS@ -RADEON_LDFLAGS = @RADEON_LDFLAGS@ -INTEL_LIBS = @INTEL_LIBS@ -INTEL_CFLAGS = @INTEL_CFLAGS@ -X11_LIBS = @X11_LIBS@ -X11_CFLAGS = @X11_CFLAGS@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ -GLW_CFLAGS = @GLW_CFLAGS@ -GLUT_CFLAGS = @GLUT_CFLAGS@ -GLX_TLS = @GLX_TLS@ - -TALLOC_LIBS = @TALLOC_LIBS@ -TALLOC_CFLAGS = @TALLOC_CFLAGS@ - -# dlopen -DLOPEN_LIBS = @DLOPEN_LIBS@ - -# Source selection -MESA_ASM_SOURCES = @MESA_ASM_SOURCES@ -GLAPI_ASM_SOURCES = @GLAPI_ASM_SOURCES@ - -# Misc tools and flags -MAKE = @MAKE@ -SHELL = @SHELL@ -MKLIB_OPTIONS = @MKLIB_OPTIONS@ -MKDEP = @MKDEP@ -MKDEP_OPTIONS = @MKDEP_OPTIONS@ -INSTALL = @INSTALL@ - -# Python and flags (generally only needed by the developers) -PYTHON2 = @PYTHON2@ -PYTHON_FLAGS = -t -O -O - -# Library names (base name) -GL_LIB = GL -GLU_LIB = GLU -GLUT_LIB = glut -GLW_LIB = GLw -OSMESA_LIB = @OSMESA_LIB@ -GLESv1_CM_LIB = GLESv1_CM -GLESv2_LIB = GLESv2 -VG_LIB = OpenVG - -# Library names (actual file names) -GL_LIB_NAME = @GL_LIB_NAME@ -GLU_LIB_NAME = @GLU_LIB_NAME@ -GLUT_LIB_NAME = @GLUT_LIB_NAME@ -GLW_LIB_NAME = @GLW_LIB_NAME@ -OSMESA_LIB_NAME = @OSMESA_LIB_NAME@ -EGL_LIB_NAME = @EGL_LIB_NAME@ -GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@ -GLESv2_LIB_NAME = @GLESv2_LIB_NAME@ -VG_LIB_NAME = @VG_LIB_NAME@ - -# Globs used to install the lib and all symlinks -GL_LIB_GLOB = @GL_LIB_GLOB@ -GLU_LIB_GLOB = @GLU_LIB_GLOB@ -GLUT_LIB_GLOB = @GLUT_LIB_GLOB@ -GLW_LIB_GLOB = @GLW_LIB_GLOB@ -OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@ -EGL_LIB_GLOB = @EGL_LIB_GLOB@ -GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@ -GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@ -VG_LIB_GLOB = @VG_LIB_GLOB@ - -# Directories to build -LIB_DIR = @LIB_DIR@ -SRC_DIRS = @SRC_DIRS@ -GLU_DIRS = @GLU_DIRS@ -DRIVER_DIRS = @DRIVER_DIRS@ -EGL_DRIVERS_DIRS = @EGL_DRIVERS_DIRS@ -GALLIUM_DIRS = @GALLIUM_DIRS@ -GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@ -GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@ -GALLIUM_TARGET_DIRS = @GALLIUM_TARGET_DIRS@ -GALLIUM_STATE_TRACKERS_DIRS = @GALLIUM_STATE_TRACKERS_DIRS@ -GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a -GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) - -# Driver specific build vars -DRI_DIRS = @DRI_DIRS@ -EGL_PLATFORMS = @EGL_PLATFORMS@ -EGL_CLIENT_APIS = @EGL_CLIENT_APIS@ - -# Dependencies -X11_INCLUDES = @X11_INCLUDES@ - -# GLw motif setup -GLW_SOURCES = @GLW_SOURCES@ -MOTIF_CFLAGS = @MOTIF_CFLAGS@ - -# Library/program dependencies -GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@ -OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \ - $(EXTRA_LIB_PATH) @OSMESA_LIB_DEPS@ -EGL_LIB_DEPS = $(EXTRA_LIB_PATH) @EGL_LIB_DEPS@ -GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \ - $(EXTRA_LIB_PATH) @GLU_LIB_DEPS@ -GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \ - $(EXTRA_LIB_PATH) @GLUT_LIB_DEPS@ -GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \ - $(EXTRA_LIB_PATH) @GLW_LIB_DEPS@ -APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@ -GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_CM_LIB_DEPS@ -GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@ -VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@ - -# DRI dependencies -DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ -LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ -LIBDRM_LIB = @LIBDRM_LIBS@ -DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ -EXPAT_INCLUDES = @EXPAT_INCLUDES@ - -# Autoconf directories -prefix = @prefix@ -exec_prefix = @exec_prefix@ -libdir = @libdir@ -includedir = @includedir@ - -# Installation directories (for make install) -INSTALL_DIR = $(prefix) -INSTALL_LIB_DIR = $(libdir) -INSTALL_INC_DIR = $(includedir) - -# DRI installation directories -DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@ - -# Where libGL will look for DRI hardware drivers -DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@ - -# EGL driver install directory -EGL_DRIVER_INSTALL_DIR = @EGL_DRIVER_INSTALL_DIR@ - -# Xorg driver install directory (for xorg state-tracker) -XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@ - -# pkg-config substitutions -GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ -GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ -GL_PC_CFLAGS = @GL_PC_CFLAGS@ -DRI_PC_REQ_PRIV = @DRI_PC_REQ_PRIV@ -GLU_PC_REQ = @GLU_PC_REQ@ -GLU_PC_REQ_PRIV = @GLU_PC_REQ_PRIV@ -GLU_PC_LIB_PRIV = @GLU_PC_LIB_PRIV@ -GLU_PC_CFLAGS = @GLU_PC_CFLAGS@ -GLUT_PC_REQ_PRIV = @GLUT_PC_REQ_PRIV@ -GLUT_PC_LIB_PRIV = @GLUT_PC_LIB_PRIV@ -GLUT_PC_CFLAGS = @GLUT_PC_CFLAGS@ -GLW_PC_REQ_PRIV = @GLW_PC_REQ_PRIV@ -GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@ -GLW_PC_CFLAGS = @GLW_PC_CFLAGS@ -OSMESA_PC_REQ = @OSMESA_PC_REQ@ -OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@ -GLESv1_CM_PC_LIB_PRIV = @GLESv1_CM_PC_LIB_PRIV@ -GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@ -EGL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ -EGL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ -EGL_PC_CFLAGS = @GL_PC_CFLAGS@ - -XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@ -XCB_DRI2_LIBS = @XCB_DRI2_LIBS@ -LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ -LIBUDEV_LIBS = @LIBUDEV_LIBS@ - -MESA_LLVM = @MESA_LLVM@ - -LLVM_VERSION = @LLVM_VERSION@ -ifneq ($(LLVM_VERSION),) - HAVE_LLVM := 0x0$(subst .,0,$(LLVM_VERSION:svn=)) - DEFINES += -DHAVE_LLVM=$(HAVE_LLVM) -endif - -HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@ +# Autoconf configuration + +# Pull in the defaults +include $(TOP)/configs/default + +# This is generated by configure +CONFIG_NAME = autoconf + +# Compiler and flags +CC = @CC@ +CXX = @CXX@ +OPT_FLAGS = @OPT_FLAGS@ +ARCH_FLAGS = @ARCH_FLAGS@ +ASM_FLAGS = @ASM_FLAGS@ +PIC_FLAGS = @PIC_FLAGS@ +DEFINES = @DEFINES@ +API_DEFINES = @API_DEFINES@ +SHARED_GLAPI = @SHARED_GLAPI@ +CFLAGS = @CPPFLAGS@ @CFLAGS@ \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) +CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +LDFLAGS = @LDFLAGS@ +EXTRA_LIB_PATH = @EXTRA_LIB_PATH@ +RADEON_CFLAGS = @RADEON_CFLAGS@ +RADEON_LDFLAGS = @RADEON_LDFLAGS@ +INTEL_LIBS = @INTEL_LIBS@ +INTEL_CFLAGS = @INTEL_CFLAGS@ +X11_LIBS = @X11_LIBS@ +X11_CFLAGS = @X11_CFLAGS@ +LLVM_CFLAGS = @LLVM_CFLAGS@ +LLVM_LDFLAGS = @LLVM_LDFLAGS@ +LLVM_LIBS = @LLVM_LIBS@ +GLW_CFLAGS = @GLW_CFLAGS@ +GLUT_CFLAGS = @GLUT_CFLAGS@ +GLX_TLS = @GLX_TLS@ + +TALLOC_LIBS = @TALLOC_LIBS@ +TALLOC_CFLAGS = @TALLOC_CFLAGS@ + +# dlopen +DLOPEN_LIBS = @DLOPEN_LIBS@ + +# Source selection +MESA_ASM_SOURCES = @MESA_ASM_SOURCES@ +GLAPI_ASM_SOURCES = @GLAPI_ASM_SOURCES@ + +# Misc tools and flags +MAKE = @MAKE@ +SHELL = @SHELL@ +MKLIB_OPTIONS = @MKLIB_OPTIONS@ +MKDEP = @MKDEP@ +MKDEP_OPTIONS = @MKDEP_OPTIONS@ +INSTALL = @INSTALL@ + +# Python and flags (generally only needed by the developers) +PYTHON2 = @PYTHON2@ +PYTHON_FLAGS = -t -O -O + +# Library names (base name) +GL_LIB = GL +GLU_LIB = GLU +GLUT_LIB = glut +GLW_LIB = GLw +OSMESA_LIB = @OSMESA_LIB@ +GLESv1_CM_LIB = GLESv1_CM +GLESv2_LIB = GLESv2 +VG_LIB = OpenVG +GLAPI_LIB = glapi + +# Library names (actual file names) +GL_LIB_NAME = @GL_LIB_NAME@ +GLU_LIB_NAME = @GLU_LIB_NAME@ +GLUT_LIB_NAME = @GLUT_LIB_NAME@ +GLW_LIB_NAME = @GLW_LIB_NAME@ +OSMESA_LIB_NAME = @OSMESA_LIB_NAME@ +EGL_LIB_NAME = @EGL_LIB_NAME@ +GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@ +GLESv2_LIB_NAME = @GLESv2_LIB_NAME@ +VG_LIB_NAME = @VG_LIB_NAME@ +GLAPI_LIB_NAME = @GLAPI_LIB_NAME@ + +# Globs used to install the lib and all symlinks +GL_LIB_GLOB = @GL_LIB_GLOB@ +GLU_LIB_GLOB = @GLU_LIB_GLOB@ +GLUT_LIB_GLOB = @GLUT_LIB_GLOB@ +GLW_LIB_GLOB = @GLW_LIB_GLOB@ +OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@ +EGL_LIB_GLOB = @EGL_LIB_GLOB@ +GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@ +GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@ +VG_LIB_GLOB = @VG_LIB_GLOB@ +GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@ + +# Directories to build +LIB_DIR = @LIB_DIR@ +SRC_DIRS = @SRC_DIRS@ +GLU_DIRS = @GLU_DIRS@ +DRIVER_DIRS = @DRIVER_DIRS@ +EGL_DRIVERS_DIRS = @EGL_DRIVERS_DIRS@ +GALLIUM_DIRS = @GALLIUM_DIRS@ +GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@ +GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@ +GALLIUM_TARGET_DIRS = @GALLIUM_TARGET_DIRS@ +GALLIUM_STATE_TRACKERS_DIRS = @GALLIUM_STATE_TRACKERS_DIRS@ +GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a +GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) + +# Driver specific build vars +DRI_DIRS = @DRI_DIRS@ +EGL_PLATFORMS = @EGL_PLATFORMS@ +EGL_CLIENT_APIS = @EGL_CLIENT_APIS@ + +# Dependencies +X11_INCLUDES = @X11_INCLUDES@ + +# GLw motif setup +GLW_SOURCES = @GLW_SOURCES@ +MOTIF_CFLAGS = @MOTIF_CFLAGS@ + +# Library/program dependencies +GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@ +OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \ + $(EXTRA_LIB_PATH) @OSMESA_LIB_DEPS@ +EGL_LIB_DEPS = $(EXTRA_LIB_PATH) @EGL_LIB_DEPS@ +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \ + $(EXTRA_LIB_PATH) @GLU_LIB_DEPS@ +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \ + $(EXTRA_LIB_PATH) @GLUT_LIB_DEPS@ +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \ + $(EXTRA_LIB_PATH) @GLW_LIB_DEPS@ +APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@ +GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_CM_LIB_DEPS@ +GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@ +VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@ +GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) @GLAPI_LIB_DEPS@ + +# DRI dependencies +DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIB = @LIBDRM_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +EXPAT_INCLUDES = @EXPAT_INCLUDES@ + +# Autoconf directories +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ + +# Installation directories (for make install) +INSTALL_DIR = $(prefix) +INSTALL_LIB_DIR = $(libdir) +INSTALL_INC_DIR = $(includedir) + +# DRI installation directories +DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@ + +# Where libGL will look for DRI hardware drivers +DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@ + +# EGL driver install directory +EGL_DRIVER_INSTALL_DIR = @EGL_DRIVER_INSTALL_DIR@ + +# Xorg driver install directory (for xorg state-tracker) +XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@ + +# pkg-config substitutions +GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ +GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ +GL_PC_CFLAGS = @GL_PC_CFLAGS@ +DRI_PC_REQ_PRIV = @DRI_PC_REQ_PRIV@ +GLU_PC_REQ = @GLU_PC_REQ@ +GLU_PC_REQ_PRIV = @GLU_PC_REQ_PRIV@ +GLU_PC_LIB_PRIV = @GLU_PC_LIB_PRIV@ +GLU_PC_CFLAGS = @GLU_PC_CFLAGS@ +GLUT_PC_REQ_PRIV = @GLUT_PC_REQ_PRIV@ +GLUT_PC_LIB_PRIV = @GLUT_PC_LIB_PRIV@ +GLUT_PC_CFLAGS = @GLUT_PC_CFLAGS@ +GLW_PC_REQ_PRIV = @GLW_PC_REQ_PRIV@ +GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@ +GLW_PC_CFLAGS = @GLW_PC_CFLAGS@ +OSMESA_PC_REQ = @OSMESA_PC_REQ@ +OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@ +GLESv1_CM_PC_LIB_PRIV = @GLESv1_CM_PC_LIB_PRIV@ +GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@ +EGL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ +EGL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ +EGL_PC_CFLAGS = @GL_PC_CFLAGS@ + +XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@ +XCB_DRI2_LIBS = @XCB_DRI2_LIBS@ +LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ +LIBUDEV_LIBS = @LIBUDEV_LIBS@ + +MESA_LLVM = @MESA_LLVM@ + +LLVM_VERSION = @LLVM_VERSION@ +ifneq ($(LLVM_VERSION),) + HAVE_LLVM := 0x0$(subst .,0,$(LLVM_VERSION:svn=)) + DEFINES += -DHAVE_LLVM=$(HAVE_LLVM) +endif + +HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@ diff --git a/mesalib/configs/default b/mesalib/configs/default index 02b66039a..9030cf5b9 100644 --- a/mesalib/configs/default +++ b/mesalib/configs/default @@ -1,180 +1,184 @@ -# Default/template configuration - -# This is included by other config files which may override some -# of these variables. -# Think of this as a base class from which configs are derived. - - -CONFIG_NAME = default - -# Version info -MESA_MAJOR=7 -MESA_MINOR=11 -MESA_TINY=0 -MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY) - -# external projects. This should be useless now that we use libdrm. -DRM_SOURCE_PATH=$(TOP)/../drm - -# Compiler and flags -CC = cc -CXX = CC -HOST_CC = $(CC) -CFLAGS = -O -CXXFLAGS = -O -LDFLAGS = -HOST_CFLAGS = $(CFLAGS) -GLU_CFLAGS = -GLX_TLS = no - -# Compiler for building demos/tests/etc -APP_CC = $(CC) -APP_CXX = $(CXX) - -# Misc tools and flags -SHELL = /bin/sh -MKLIB = $(SHELL) $(TOP)/bin/mklib -MKLIB_OPTIONS = -MKDEP = makedepend -MKDEP_OPTIONS = -fdepend -MAKE = make - -# Use MINSTALL for installing libraries, INSTALL for everything else -MINSTALL = $(SHELL) $(TOP)/bin/minstall -INSTALL = $(MINSTALL) - -# Tools for regenerating glapi (generally only needed by the developers) -PYTHON2 = python -PYTHON_FLAGS = -t -O -O -INDENT = indent -INDENT_FLAGS = -i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool - -# Library names (base name) -GL_LIB = GL -GLU_LIB = GLU -GLUT_LIB = glut -GLW_LIB = GLw -OSMESA_LIB = OSMesa -EGL_LIB = EGL -GLESv1_CM_LIB = GLESv1_CM -GLESv2_LIB = GLESv2 -VG_LIB = OpenVG - - -# Library names (actual file names) -GL_LIB_NAME = lib$(GL_LIB).so -GLU_LIB_NAME = lib$(GLU_LIB).so -GLUT_LIB_NAME = lib$(GLUT_LIB).so -GLW_LIB_NAME = lib$(GLW_LIB).so -OSMESA_LIB_NAME = lib$(OSMESA_LIB).so -EGL_LIB_NAME = lib$(EGL_LIB).so -GLESv1_CM_LIB_NAME = lib$(GLESv1_CM_LIB).so -GLESv2_LIB_NAME = lib$(GLESv2_LIB).so -VG_LIB_NAME = lib$(VG_LIB).so - -# globs used to install the lib and all symlinks -GL_LIB_GLOB = $(GL_LIB_NAME)* -GLU_LIB_GLOB = $(GLU_LIB_NAME)* -GLUT_LIB_GLOB = $(GLUT_LIB_NAME)* -GLW_LIB_GLOB = $(GLW_LIB_NAME)* -OSMESA_LIB_GLOB = $(OSMESA_LIB_NAME)* -EGL_LIB_GLOB = $(EGL_LIB_NAME)* -GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)* -GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)* -VG_LIB_GLOB = $(VG_LIB_NAME)* - -TALLOC_LIBS = `pkg-config --libs talloc` -TALLOC_CFLAGS = `pkg-config --cflags talloc` - -# Optional assembly language optimization files for libGL -MESA_ASM_SOURCES = - -# GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in -# order to build the Motif widget too) -GLW_SOURCES = GLwDrawA.c -MOTIF_CFLAGS = -I/usr/include/Motif1.2 - - -# Directories to build -LIB_DIR = lib -SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \ - gallium egl gallium/winsys gallium/targets glu glut/glx glw -GLU_DIRS = sgi -DRIVER_DIRS = x11 osmesa - -# EGL drivers to build -EGL_DRIVERS_DIRS = glx - -# Gallium directories and -GALLIUM_DIRS = auxiliary drivers state_trackers -GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a -GALLIUM_DRIVERS_DIRS = softpipe trace rbug noop identity galahad i915 i965 svga r300 nvfx nv50 failover -GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) -GALLIUM_WINSYS_DIRS = sw sw/xlib -GALLIUM_TARGET_DIRS = libgl-xlib -GALLIUM_STATE_TRACKERS_DIRS = glx vega - -# native platforms EGL should support -EGL_PLATFORMS = x11 -EGL_CLIENT_APIS = $(GL_LIB) - -# Library dependencies -#EXTRA_LIB_PATH ?= -GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread $(TALLOC_LIBS) -EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread -OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm -GLW_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11 -APP_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread -GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread -VG_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread - -# Program dependencies - specific GL/glut libraries added in Makefiles -APP_LIB_DEPS = -lm -X11_LIBS = -lX11 - -DLOPEN_LIBS = -ldl - -# Installation directories (for make install) -INSTALL_DIR = /usr/local -INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR) -INSTALL_INC_DIR = $(INSTALL_DIR)/include -DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri - -# Where libGL will look for DRI hardware drivers -DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) - -# EGL driver install directory -EGL_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/egl - -# Xorg driver install directory (for xorg state-tracker) -XORG_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/xorg/modules/drivers - -# pkg-config substitutions -GL_PC_REQ_PRIV = -GL_PC_LIB_PRIV = -GL_PC_CFLAGS = -DRI_PC_REQ_PRIV = -GLU_PC_REQ = gl -GLU_PC_REQ_PRIV = -GLU_PC_LIB_PRIV = -GLU_PC_CFLAGS = -GLUT_PC_REQ_PRIV = -GLUT_PC_LIB_PRIV = -GLUT_PC_CFLAGS = -GLW_PC_REQ_PRIV = -GLW_PC_LIB_PRIV = -GLW_PC_CFLAGS = -OSMESA_PC_REQ = -OSMESA_PC_LIB_PRIV = -GLESv1_CM_PC_REQ_PRIV = -GLESv1_CM_PC_LIB_PRIV = -GLESv1_CM_PC_CFLAGS = -GLESv2_PC_REQ_PRIV = -GLESv2_PC_LIB_PRIV = -GLESv2_PC_CFLAGS = -VG_PC_REQ_PRIV = -VG_PC_LIB_PRIV = -VG_PC_CFLAGS = +# Default/template configuration + +# This is included by other config files which may override some +# of these variables. +# Think of this as a base class from which configs are derived. + + +CONFIG_NAME = default + +# Version info +MESA_MAJOR=7 +MESA_MINOR=11 +MESA_TINY=0 +MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY) + +# external projects. This should be useless now that we use libdrm. +DRM_SOURCE_PATH=$(TOP)/../drm + +# Compiler and flags +CC = cc +CXX = CC +HOST_CC = $(CC) +CFLAGS = -O +CXXFLAGS = -O +LDFLAGS = +HOST_CFLAGS = $(CFLAGS) +GLU_CFLAGS = +GLX_TLS = no + +# Compiler for building demos/tests/etc +APP_CC = $(CC) +APP_CXX = $(CXX) + +# Misc tools and flags +SHELL = /bin/sh +MKLIB = $(SHELL) $(TOP)/bin/mklib +MKLIB_OPTIONS = +MKDEP = makedepend +MKDEP_OPTIONS = -fdepend +MAKE = make + +# Use MINSTALL for installing libraries, INSTALL for everything else +MINSTALL = $(SHELL) $(TOP)/bin/minstall +INSTALL = $(MINSTALL) + +# Tools for regenerating glapi (generally only needed by the developers) +PYTHON2 = python +PYTHON_FLAGS = -t -O -O +INDENT = indent +INDENT_FLAGS = -i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool + +# Library names (base name) +GL_LIB = GL +GLU_LIB = GLU +GLUT_LIB = glut +GLW_LIB = GLw +OSMESA_LIB = OSMesa +EGL_LIB = EGL +GLESv1_CM_LIB = GLESv1_CM +GLESv2_LIB = GLESv2 +VG_LIB = OpenVG +GLAPI_LIB = glapi + + +# Library names (actual file names) +GL_LIB_NAME = lib$(GL_LIB).so +GLU_LIB_NAME = lib$(GLU_LIB).so +GLUT_LIB_NAME = lib$(GLUT_LIB).so +GLW_LIB_NAME = lib$(GLW_LIB).so +OSMESA_LIB_NAME = lib$(OSMESA_LIB).so +EGL_LIB_NAME = lib$(EGL_LIB).so +GLESv1_CM_LIB_NAME = lib$(GLESv1_CM_LIB).so +GLESv2_LIB_NAME = lib$(GLESv2_LIB).so +VG_LIB_NAME = lib$(VG_LIB).so +GLAPI_LIB_NAME = lib$(GLAPI_LIB).so + +# globs used to install the lib and all symlinks +GL_LIB_GLOB = $(GL_LIB_NAME)* +GLU_LIB_GLOB = $(GLU_LIB_NAME)* +GLUT_LIB_GLOB = $(GLUT_LIB_NAME)* +GLW_LIB_GLOB = $(GLW_LIB_NAME)* +OSMESA_LIB_GLOB = $(OSMESA_LIB_NAME)* +EGL_LIB_GLOB = $(EGL_LIB_NAME)* +GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)* +GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)* +VG_LIB_GLOB = $(VG_LIB_NAME)* +GLAPI_LIB_GLOB = $(GLAPI_LIB_NAME)* + +TALLOC_LIBS = `pkg-config --libs talloc` +TALLOC_CFLAGS = `pkg-config --cflags talloc` + +# Optional assembly language optimization files for libGL +MESA_ASM_SOURCES = + +# GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in +# order to build the Motif widget too) +GLW_SOURCES = GLwDrawA.c +MOTIF_CFLAGS = -I/usr/include/Motif1.2 + + +# Directories to build +LIB_DIR = lib +SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \ + gallium egl gallium/winsys gallium/targets glu glut/glx glw +GLU_DIRS = sgi +DRIVER_DIRS = x11 osmesa + +# EGL drivers to build +EGL_DRIVERS_DIRS = glx + +# Gallium directories and +GALLIUM_DIRS = auxiliary drivers state_trackers +GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a +GALLIUM_DRIVERS_DIRS = softpipe trace rbug noop identity galahad i915 i965 svga r300 nvfx nv50 failover +GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) +GALLIUM_WINSYS_DIRS = sw sw/xlib +GALLIUM_TARGET_DIRS = libgl-xlib +GALLIUM_STATE_TRACKERS_DIRS = glx vega + +# native platforms EGL should support +EGL_PLATFORMS = x11 +EGL_CLIENT_APIS = $(GL_LIB) + +# Library dependencies +#EXTRA_LIB_PATH ?= +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread $(TALLOC_LIBS) +EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread +OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm +GLW_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11 +APP_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm +GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread +GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread +VG_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread +GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread + +# Program dependencies - specific GL/glut libraries added in Makefiles +APP_LIB_DEPS = -lm +X11_LIBS = -lX11 + +DLOPEN_LIBS = -ldl + +# Installation directories (for make install) +INSTALL_DIR = /usr/local +INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR) +INSTALL_INC_DIR = $(INSTALL_DIR)/include +DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri + +# Where libGL will look for DRI hardware drivers +DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) + +# EGL driver install directory +EGL_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/egl + +# Xorg driver install directory (for xorg state-tracker) +XORG_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/xorg/modules/drivers + +# pkg-config substitutions +GL_PC_REQ_PRIV = +GL_PC_LIB_PRIV = +GL_PC_CFLAGS = +DRI_PC_REQ_PRIV = +GLU_PC_REQ = gl +GLU_PC_REQ_PRIV = +GLU_PC_LIB_PRIV = +GLU_PC_CFLAGS = +GLUT_PC_REQ_PRIV = +GLUT_PC_LIB_PRIV = +GLUT_PC_CFLAGS = +GLW_PC_REQ_PRIV = +GLW_PC_LIB_PRIV = +GLW_PC_CFLAGS = +OSMESA_PC_REQ = +OSMESA_PC_LIB_PRIV = +GLESv1_CM_PC_REQ_PRIV = +GLESv1_CM_PC_LIB_PRIV = +GLESv1_CM_PC_CFLAGS = +GLESv2_PC_REQ_PRIV = +GLESv2_PC_LIB_PRIV = +GLESv2_PC_CFLAGS = +VG_PC_REQ_PRIV = +VG_PC_LIB_PRIV = +VG_PC_CFLAGS = diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 237da19b8..1c6edb75b 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -1,1825 +1,1859 @@ -dnl Process this file with autoconf to create configure. - -AC_PREREQ([2.59]) - -dnl Versioning - scrape the version from configs/default -m4_define([mesa_version], - [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n' | tr -d '\r'])]) -m4_ifval(mesa_version,, - [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])]) - -dnl Tell the user about autoconf.html in the --help output -m4_divert_once([HELP_END], [ -See docs/autoconf.html for more details on the options for Mesa.]) - -AC_INIT([Mesa],[mesa_version], - [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa]) -AC_CONFIG_AUX_DIR([bin]) -AC_CANONICAL_HOST - -dnl Versions for external dependencies -LIBDRM_REQUIRED=2.4.23 -LIBDRM_RADEON_REQUIRED=2.4.23 -DRI2PROTO_REQUIRED=2.1 -GLPROTO_REQUIRED=1.4.11 -LIBDRM_XORG_REQUIRED=2.4.23 -LIBKMS_XORG_REQUIRED=1.0.0 - -dnl Check for progs -AC_PROG_CPP -AC_PROG_CC -AC_PROG_CXX -AC_CHECK_PROGS([MAKE], [gmake make]) -AC_CHECK_PROGS([PYTHON2], [python2 python]) -AC_PATH_PROG([MKDEP], [makedepend]) -AC_PATH_PROG([SED], [sed]) - -if test "x$MKDEP" = "x"; then - AC_MSG_ERROR([makedepend is required to build Mesa]) -fi - -dnl Our fallback install-sh is a symlink to minstall. Use the existing -dnl configuration in that case. -AC_PROG_INSTALL -test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)' - -dnl We need a POSIX shell for parts of the build. Assume we have one -dnl in most cases. -case "$host_os" in -solaris*) - # Solaris /bin/sh is too old/non-POSIX compliant - AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh]) - SHELL="$POSIX_SHELL" - ;; -esac - -dnl clang is mostly GCC-compatible, but its version is much lower, -dnl so we have to check for it. -AC_MSG_CHECKING([if compiling with clang]) - -AC_COMPILE_IFELSE( -[AC_LANG_PROGRAM([], [[ -#ifndef __clang__ - not clang -#endif -]])], -[CLANG=yes], [CLANG=no]) - -AC_MSG_RESULT([$CLANG]) - -dnl If we're using GCC, make sure that it is at least version 3.3.0. Older -dnl versions are explictly not supported. -if test "x$GCC" = xyes -a "x$CLANG" = xno; then - AC_MSG_CHECKING([whether gcc version is sufficient]) - major=0 - minor=0 - - GCC_VERSION=`$CC -dumpversion` - if test $? -eq 0; then - major=`echo $GCC_VERSION | cut -d. -f1` - minor=`echo $GCC_VERSION | cut -d. -f1` - fi - - if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.]) - else - AC_MSG_RESULT([yes]) - fi -fi - - -MKDEP_OPTIONS=-fdepend -dnl Ask gcc where it's keeping its secret headers -if test "x$GCC" = xyes; then - for dir in include include-fixed; do - GCC_INCLUDES=`$CC -print-file-name=$dir` - if test "x$GCC_INCLUDES" != x && \ - test "$GCC_INCLUDES" != "$dir" && \ - test -d "$GCC_INCLUDES"; then - MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES" - fi - done -fi -AC_SUBST([MKDEP_OPTIONS]) - -dnl Make sure the pkg-config macros are defined -m4_ifndef([PKG_PROG_PKG_CONFIG], - [m4_fatal([Could not locate the pkg-config autoconf macros. - These are usually located in /usr/share/aclocal/pkg.m4. If your macros - are in a different location, try setting the environment variable - ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])]) -PKG_PROG_PKG_CONFIG() - -dnl LIB_DIR - library basename -LIB_DIR=`echo $libdir | $SED 's%.*/%%'` -AC_SUBST([LIB_DIR]) - -dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later -_SAVE_LDFLAGS="$LDFLAGS" -AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker]) -AC_SUBST([EXTRA_LIB_PATH]) - -dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later -_SAVE_CPPFLAGS="$CPPFLAGS" -AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers]) -AC_SUBST([X11_INCLUDES]) - -dnl Compiler macros -DEFINES="" -AC_SUBST([DEFINES]) -case "$host_os" in -linux*|*-gnu*|gnu*) - DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS" - ;; -solaris*) - DEFINES="$DEFINES -DPTHREADS -DSVR4" - ;; -cygwin*) - DEFINES="$DEFINES -DPTHREADS" - ;; -esac - -dnl Add flags for gcc and g++ -if test "x$GCC" = xyes; then - CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99" - if test "x$CLANG" = "xno"; then - CFLAGS="$CFLAGS -ffast-math" - fi - - # Enable -fvisibility=hidden if using a gcc that supports it - save_CFLAGS="$CFLAGS" - AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) - CFLAGS="$CFLAGS -fvisibility=hidden" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), - [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]); - - # Work around aliasing bugs - developers should comment this out - CFLAGS="$CFLAGS -fno-strict-aliasing" -fi -if test "x$GXX" = xyes; then - CXXFLAGS="$CXXFLAGS -Wall" - - # Enable -fvisibility=hidden if using a gcc that supports it - save_CXXFLAGS="$CXXFLAGS" - AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden]) - CXXFLAGS="$CXXFLAGS -fvisibility=hidden" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), - [CXXFLAGS="$save_CXXFLAGS" ; AC_MSG_RESULT([no])]); - - # Work around aliasing bugs - developers should comment this out - CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" -fi - -dnl These should be unnecessary, but let the user set them if they want -AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler. - Default is to use CFLAGS.]) -AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the - compiler. Default is to use CFLAGS.]) -AC_SUBST([OPT_FLAGS]) -AC_SUBST([ARCH_FLAGS]) - -dnl -dnl Hacks to enable 32 or 64 bit build -dnl -AC_ARG_ENABLE([32-bit], - [AS_HELP_STRING([--enable-32-bit], - [build 32-bit libraries @<:@default=auto@:>@])], - [enable_32bit="$enableval"], - [enable_32bit=auto] -) -if test "x$enable_32bit" = xyes; then - if test "x$GCC" = xyes; then - CFLAGS="$CFLAGS -m32" - ARCH_FLAGS="$ARCH_FLAGS -m32" - fi - if test "x$GXX" = xyes; then - CXXFLAGS="$CXXFLAGS -m32" - fi -fi -AC_ARG_ENABLE([64-bit], - [AS_HELP_STRING([--enable-64-bit], - [build 64-bit libraries @<:@default=auto@:>@])], - [enable_64bit="$enableval"], - [enable_64bit=auto] -) -if test "x$enable_64bit" = xyes; then - if test "x$GCC" = xyes; then - CFLAGS="$CFLAGS -m64" - fi - if test "x$GXX" = xyes; then - CXXFLAGS="$CXXFLAGS -m64" - fi -fi - -dnl -dnl shared/static libraries, mimic libtool options -dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static], - [build static libraries @<:@default=disabled@:>@])], - [enable_static="$enableval"], - [enable_static=no] -) -case "x$enable_static" in -xyes|xno ) ;; -x ) enable_static=no ;; -* ) - AC_MSG_ERROR([Static library option '$enable_static' is not a valid]) - ;; -esac -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--disable-shared], - [build shared libraries @<:@default=enabled@:>@])], - [enable_shared="$enableval"], - [enable_shared=yes] -) -case "x$enable_shared" in -xyes|xno ) ;; -x ) enable_shared=yes ;; -* ) - AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid]) - ;; -esac - -dnl Can't have static and shared libraries, default to static if user -dnl explicitly requested. If both disabled, set to static since shared -dnl was explicitly requirested. -case "x$enable_static$enable_shared" in -xyesyes ) - AC_MSG_WARN([Can't build static and shared libraries, disabling shared]) - enable_shared=no - ;; -xnono ) - AC_MSG_WARN([Can't disable both static and shared libraries, enabling static]) - enable_static=yes - ;; -esac - -dnl -dnl mklib options -dnl -AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib]) -if test "$enable_static" = yes; then - MKLIB_OPTIONS="$MKLIB_OPTIONS -static" -fi -AC_SUBST([MKLIB_OPTIONS]) - -dnl -dnl other compiler options -dnl -AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug], - [use debug compiler flags and macros @<:@default=disabled@:>@])], - [enable_debug="$enableval"], - [enable_debug=no] -) -if test "x$enable_debug" = xyes; then - DEFINES="$DEFINES -DDEBUG" - if test "x$GCC" = xyes; then - CFLAGS="$CFLAGS -g" - fi - if test "x$GXX" = xyes; then - CXXFLAGS="$CXXFLAGS -g" - fi -fi - -dnl -dnl library names -dnl -LIB_PREFIX_GLOB='lib' -LIB_VERSION_SEPARATOR='.' -if test "$enable_static" = yes; then - LIB_EXTENSION='a' -else - case "$host_os" in - darwin* ) - LIB_EXTENSION='dylib' ;; - cygwin* ) - dnl prefix can be 'cyg' or 'lib' - LIB_PREFIX_GLOB='???' - LIB_VERSION_SEPARATOR='-' - LIB_EXTENSION='dll' ;; - aix* ) - LIB_EXTENSION='a' ;; - * ) - LIB_EXTENSION='so' ;; - esac -fi - -GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION} -GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION} -GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION} -GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION} -OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION} -EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION} -GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION} -GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION} -VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION} - -GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -GLW_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLW_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' - -AC_SUBST([GL_LIB_NAME]) -AC_SUBST([GLU_LIB_NAME]) -AC_SUBST([GLUT_LIB_NAME]) -AC_SUBST([GLW_LIB_NAME]) -AC_SUBST([OSMESA_LIB_NAME]) -AC_SUBST([EGL_LIB_NAME]) -AC_SUBST([GLESv1_CM_LIB_NAME]) -AC_SUBST([GLESv2_LIB_NAME]) -AC_SUBST([VG_LIB_NAME]) - -AC_SUBST([GL_LIB_GLOB]) -AC_SUBST([GLU_LIB_GLOB]) -AC_SUBST([GLUT_LIB_GLOB]) -AC_SUBST([GLW_LIB_GLOB]) -AC_SUBST([OSMESA_LIB_GLOB]) -AC_SUBST([EGL_LIB_GLOB]) -AC_SUBST([GLESv1_CM_LIB_GLOB]) -AC_SUBST([GLESv2_LIB_GLOB]) -AC_SUBST([VG_LIB_GLOB]) - -dnl -dnl Arch/platform-specific settings -dnl -AC_ARG_ENABLE([asm], - [AS_HELP_STRING([--disable-asm], - [disable assembly usage @<:@default=enabled on supported plaforms@:>@])], - [enable_asm="$enableval"], - [enable_asm=yes] -) -asm_arch="" -ASM_FLAGS="" -MESA_ASM_SOURCES="" -GLAPI_ASM_SOURCES="" -AC_MSG_CHECKING([whether to enable assembly]) -test "x$enable_asm" = xno && AC_MSG_RESULT([no]) -# disable if cross compiling on x86/x86_64 since we must run gen_matypes -if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then - case "$host_cpu" in - i?86 | x86_64) - enable_asm=no - AC_MSG_RESULT([no, cross compiling]) - ;; - esac -fi -# check for supported arches -if test "x$enable_asm" = xyes; then - case "$host_cpu" in - i?86) - case "$host_os" in - linux* | *freebsd* | dragonfly* | *netbsd*) - test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86 - ;; - esac - ;; - x86_64) - case "$host_os" in - linux* | *freebsd* | dragonfly* | *netbsd*) - test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64 - ;; - esac - ;; - powerpc) - case "$host_os" in - linux*) - asm_arch=ppc - ;; - esac - ;; - sparc*) - case "$host_os" in - linux*) - asm_arch=sparc - ;; - esac - ;; - esac - - case "$asm_arch" in - x86) - ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" - MESA_ASM_SOURCES='$(X86_SOURCES)' - GLAPI_ASM_SOURCES='$(X86_API)' - AC_MSG_RESULT([yes, x86]) - ;; - x86_64) - ASM_FLAGS="-DUSE_X86_64_ASM" - MESA_ASM_SOURCES='$(X86-64_SOURCES)' - GLAPI_ASM_SOURCES='$(X86-64_API)' - AC_MSG_RESULT([yes, x86_64]) - ;; - ppc) - ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" - MESA_ASM_SOURCES='$(PPC_SOURCES)' - AC_MSG_RESULT([yes, ppc]) - ;; - sparc) - ASM_FLAGS="-DUSE_SPARC_ASM" - MESA_ASM_SOURCES='$(SPARC_SOURCES)' - GLAPI_ASM_SOURCES='$(SPARC_API)' - AC_MSG_RESULT([yes, sparc]) - ;; - *) - AC_MSG_RESULT([no, platform not supported]) - ;; - esac -fi -AC_SUBST([ASM_FLAGS]) -AC_SUBST([MESA_ASM_SOURCES]) -AC_SUBST([GLAPI_ASM_SOURCES]) - -dnl PIC code macro -MESA_PIC_FLAGS - -dnl Check to see if dlopen is in default libraries (like Solaris, which -dnl has it in libc), or if libdl is needed to get it. -AC_CHECK_FUNC([dlopen], [], - [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])]) -AC_SUBST([DLOPEN_LIBS]) - -dnl See if posix_memalign is available -AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"]) - -dnl SELinux awareness. -AC_ARG_ENABLE([selinux], - [AS_HELP_STRING([--enable-selinux], - [Build SELinux-aware Mesa @<:@default=disabled@:>@])], - [MESA_SELINUX="$enableval"], - [MESA_SELINUX=no]) -if test "x$enable_selinux" = "xyes"; then - AC_CHECK_HEADER([selinux/selinux.h],[], - [AC_MSG_ERROR([SELinux headers not found])]) - AC_CHECK_LIB([selinux],[is_selinux_enabled],[], - [AC_MSG_ERROR([SELinux library not found])]) - SELINUX_LIBS="-lselinux" - DEFINES="$DEFINES -DMESA_SELINUX" -fi - -dnl Determine which APIs to support -AC_ARG_ENABLE([opengl], - [AS_HELP_STRING([--disable-opengl], - [disable support for standard OpenGL API @<:@default=no@:>@])], - [enable_opengl="$enableval"], - [enable_opengl=yes]) -AC_ARG_ENABLE([gles1], - [AS_HELP_STRING([--enable-gles1], - [enable support for OpenGL ES 1.x API @<:@default=no@:>@])], - [enable_gles1="$enableval"], - [enable_gles1=no]) -AC_ARG_ENABLE([gles2], - [AS_HELP_STRING([--enable-gles2], - [enable support for OpenGL ES 2.x API @<:@default=no@:>@])], - [enable_gles2="$enableval"], - [enable_gles2=no]) -AC_ARG_ENABLE([gles-overlay], - [AS_HELP_STRING([--enable-gles-overlay], - [DEPRECATED. Same as --enable-gles1 and --enable-gles2])], - [enable_gles1="$enableval"; enable_gles2="$enableval"], - []) - -AC_ARG_ENABLE([openvg], - [AS_HELP_STRING([--enable-openvg], - [enable support for OpenVG API @<:@default=no@:>@])], - [enable_openvg="$enableval"], - [enable_openvg=no]) - -dnl smooth the transition; should be removed eventually -if test "x$enable_openvg" = xno; then - case "x$with_state_trackers" in - x*vega*) - AC_MSG_WARN([vega state tracker is enabled without --enable-openvg]) - enable_openvg=yes - ;; - esac -fi - -if test "x$enable_opengl" = xno -a \ - "x$enable_gles1" = xno -a \ - "x$enable_gles2" = xno -a \ - "x$enable_openvg" = xno; then - AC_MSG_ERROR([at least one API should be enabled]) -fi - -API_DEFINES="" -if test "x$enable_opengl" = xno; then - API_DEFINES="$API_DEFINES -DFEATURE_GL=0" -else - API_DEFINES="$API_DEFINES -DFEATURE_GL=1" -fi -if test "x$enable_gles1" = xyes; then - API_DEFINES="$API_DEFINES -DFEATURE_ES1=1" -fi -if test "x$enable_gles2" = xyes; then - API_DEFINES="$API_DEFINES -DFEATURE_ES2=1" -fi -AC_SUBST([API_DEFINES]) - -dnl -dnl Driver configuration. Options are xlib, dri and osmesa right now. -dnl More later: fbdev, ... -dnl -default_driver="xlib" - -case "$host_os" in -linux*) - case "$host_cpu" in - i*86|x86_64|powerpc*|sparc*) default_driver="dri";; - esac - ;; -*freebsd* | dragonfly* | *netbsd*) - case "$host_cpu" in - i*86|x86_64|powerpc*|sparc*) default_driver="dri";; - esac - ;; -esac - -if test "x$enable_opengl" = xno; then - default_driver="no" -fi - -AC_ARG_WITH([driver], - [AS_HELP_STRING([--with-driver=DRIVER], - [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])], - [mesa_driver="$withval"], - [mesa_driver="$default_driver"]) -dnl Check for valid option -case "x$mesa_driver" in -xxlib|xdri|xosmesa) - if test "x$enable_opengl" = xno; then - AC_MSG_ERROR([Driver '$mesa_driver' requires OpenGL enabled]) - fi - ;; -xno) - ;; -*) - AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option]) - ;; -esac - -PKG_CHECK_MODULES([TALLOC], [talloc]) -AC_SUBST([TALLOC_LIBS]) -AC_SUBST([TALLOC_CFLAGS]) - -dnl -dnl Driver specific build directories -dnl - -dnl this variable will be prepended to SRC_DIRS and is not exported -CORE_DIRS="" - -SRC_DIRS="" -GLU_DIRS="sgi" -GALLIUM_DIRS="auxiliary drivers state_trackers" -GALLIUM_TARGET_DIRS="" -GALLIUM_WINSYS_DIRS="sw" -GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity" -GALLIUM_STATE_TRACKERS_DIRS="" - -# build glapi if OpenGL is enabled -if test "x$enable_opengl" = xyes; then - CORE_DIRS="$CORE_DIRS mapi/glapi" -fi - -# build es1api if OpenGL ES 1.x is enabled -if test "x$enable_gles1" = xyes; then - CORE_DIRS="$CORE_DIRS mapi/es1api" -fi - -# build es2api if OpenGL ES 2.x is enabled -if test "x$enable_gles2" = xyes; then - CORE_DIRS="$CORE_DIRS mapi/es2api" -fi - -# build vgapi if OpenVG is enabled -if test "x$enable_openvg" = xyes; then - CORE_DIRS="$CORE_DIRS mapi/vgapi" -fi - -# build glsl and mesa if OpenGL or OpenGL ES is enabled -case "x$enable_opengl$enable_gles1$enable_gles2" in -x*yes*) - CORE_DIRS="$CORE_DIRS glsl mesa" - ;; -esac - -case "$mesa_driver" in -xlib) - DRIVER_DIRS="x11" - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib" - GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib" - ;; -dri) - SRC_DIRS="$SRC_DIRS glx" - DRIVER_DIRS="dri" - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri" - ;; -osmesa) - DRIVER_DIRS="osmesa" - ;; -no) - DRIVER_DRIS="" - ;; -esac -AC_SUBST([SRC_DIRS]) -AC_SUBST([GLU_DIRS]) -AC_SUBST([DRIVER_DIRS]) -AC_SUBST([GALLIUM_DIRS]) -AC_SUBST([GALLIUM_TARGET_DIRS]) -AC_SUBST([GALLIUM_WINSYS_DIRS]) -AC_SUBST([GALLIUM_DRIVERS_DIRS]) -AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS]) -AC_SUBST([MESA_LLVM]) - -dnl -dnl Find out if X is available. The variable have_x is set if libX11 is -dnl found to mimic AC_PATH_XTRA. -dnl -if test -n "$PKG_CONFIG"; then - AC_MSG_CHECKING([pkg-config files for X11 are available]) - PKG_CHECK_EXISTS([x11],[ - x11_pkgconfig=yes - have_x=yes - ],[ - x11_pkgconfig=no - ]) - AC_MSG_RESULT([$x11_pkgconfig]) -else - x11_pkgconfig=no -fi -dnl Use the autoconf macro if no pkg-config files -if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES([X11], [x11]) -else - AC_PATH_XTRA - test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS" - test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11" - AC_SUBST([X11_CFLAGS]) - AC_SUBST([X11_LIBS]) -fi - -dnl Try to tell the user that the --x-* options are only used when -dnl pkg-config is not available. This must be right after AC_PATH_XTRA. -m4_divert_once([HELP_BEGIN], -[These options are only used when the X libraries cannot be found by the -pkg-config utility.]) - -dnl We need X for xlib and dri, so bomb now if it's not found -case "$mesa_driver" in -xlib|dri) - if test "$no_x" = yes; then - AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver]) - fi - ;; -esac - -dnl XCB - this is only used for GLX right now -AC_ARG_ENABLE([xcb], - [AS_HELP_STRING([--enable-xcb], - [use XCB for GLX @<:@default=disabled@:>@])], - [enable_xcb="$enableval"], - [enable_xcb=no]) -if test "x$enable_xcb" = xyes; then - DEFINES="$DEFINES -DUSE_XCB" -else - enable_xcb=no -fi - -dnl -dnl libGL configuration per driver -dnl -case "$mesa_driver" in -xlib) - if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES([XLIBGL], [x11 xext]) - GL_PC_REQ_PRIV="x11 xext" - X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS" - GL_LIB_DEPS="$XLIBGL_LIBS" - else - # should check these... - X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" - GL_LIB_DEPS="$X_LIBS -lX11 -lXext" - GL_PC_LIB_PRIV="$GL_LIB_DEPS" - GL_PC_CFLAGS="$X11_INCLUDES" - fi - GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS" - GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS" - - # if static, move the external libraries to the programs - # and empty the libraries for libGL - if test "$enable_static" = yes; then - APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS" - GL_LIB_DEPS="" - fi - ;; -dri|no) # these checks are still desired when there is no mesa_driver - # DRI must be shared, I think - if test "$enable_static" = yes; then - AC_MSG_ERROR([Can't use static libraries for DRI drivers]) - fi - - # Check for libdrm - PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) - PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) - PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED]) - GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED" - DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" - - # find the DRI deps for libGL - if test "$x11_pkgconfig" = yes; then - dri_modules="x11 xext xdamage xfixes" - - # add xf86vidmode if available - PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no) - if test "$HAVE_XF86VIDMODE" = yes ; then - dri_modules="$dri_modules xxf86vm" - fi - - # add xcb modules if necessary - if test "$enable_xcb" = yes; then - dri_modules="$dri_modules x11-xcb xcb-glx" - fi - - PKG_CHECK_MODULES([DRIGL], [$dri_modules]) - GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules" - X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS" - GL_LIB_DEPS="$DRIGL_LIBS" - else - # should check these... - X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" - GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes" - GL_PC_LIB_PRIV="$GL_LIB_DEPS" - GL_PC_CFLAGS="$X11_INCLUDES" - - # XCB can only be used from pkg-config - if test "$enable_xcb" = yes; then - PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx]) - GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx" - X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS" - GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS" - fi - fi - - # need DRM libs, -lpthread, etc. - GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" - GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" - GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" - GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" - GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" - GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" - ;; -osmesa) - # No libGL for osmesa - GL_LIB_DEPS="" - ;; -esac -AC_SUBST([GL_LIB_DEPS]) -AC_SUBST([GL_PC_REQ_PRIV]) -AC_SUBST([GL_PC_LIB_PRIV]) -AC_SUBST([GL_PC_CFLAGS]) -AC_SUBST([DRI_PC_REQ_PRIV]) -AC_SUBST([GLESv1_CM_LIB_DEPS]) -AC_SUBST([GLESv1_CM_PC_LIB_PRIV]) -AC_SUBST([GLESv2_LIB_DEPS]) -AC_SUBST([GLESv2_PC_LIB_PRIV]) - - -AC_SUBST([HAVE_XF86VIDMODE]) - -PKG_CHECK_MODULES([LIBDRM_RADEON], - [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED], - HAVE_LIBDRM_RADEON=yes, - HAVE_LIBDRM_RADEON=no) - -dnl -dnl More X11 setup -dnl -if test "$mesa_driver" = xlib; then - DEFINES="$DEFINES -DUSE_XSHM" -fi - -dnl -dnl TLS detection -dnl - -AC_ARG_ENABLE([glx-tls], - [AS_HELP_STRING([--enable-glx-tls], - [enable TLS support in GLX @<:@default=disabled@:>@])], - [GLX_USE_TLS="$enableval"], - [GLX_USE_TLS=no]) -AC_SUBST(GLX_TLS, ${GLX_USE_TLS}) - -dnl -dnl More DRI setup -dnl -dnl Directory for DRI drivers -AC_ARG_WITH([dri-driverdir], - [AS_HELP_STRING([--with-dri-driverdir=DIR], - [directory for the DRI drivers @<:@${libdir}/dri@:>@])], - [DRI_DRIVER_INSTALL_DIR="$withval"], - [DRI_DRIVER_INSTALL_DIR='${libdir}/dri']) -AC_SUBST([DRI_DRIVER_INSTALL_DIR]) -dnl Extra search path for DRI drivers -AC_ARG_WITH([dri-searchpath], - [AS_HELP_STRING([--with-dri-searchpath=DIRS...], - [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])], - [DRI_DRIVER_SEARCH_DIR="$withval"], - [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}']) -AC_SUBST([DRI_DRIVER_SEARCH_DIR]) -dnl Direct rendering or just indirect rendering -AC_ARG_ENABLE([driglx-direct], - [AS_HELP_STRING([--disable-driglx-direct], - [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])], - [driglx_direct="$enableval"], - [driglx_direct="yes"]) -dnl Which drivers to build - default is chosen by platform -AC_ARG_WITH([dri-drivers], - [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@], - [comma delimited DRI drivers list, e.g. - "swrast,i965,radeon" @<:@default=auto@:>@])], - [with_dri_drivers="$withval"], - [with_dri_drivers=yes]) -if test "x$with_dri_drivers" = x; then - with_dri_drivers=no -fi - -dnl If $with_dri_drivers is yes, directories will be added through -dnl platform checks -DRI_DIRS="" -case "$with_dri_drivers" in -no) ;; -yes) - DRI_DIRS="yes" - ;; -*) - # verify the requested driver directories exist - dri_drivers=`IFS=', '; echo $with_dri_drivers` - for driver in $dri_drivers; do - test -d "$srcdir/src/mesa/drivers/dri/$driver" || \ - AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist]) - done - DRI_DIRS="$dri_drivers" - ;; -esac - -dnl Set DRI_DIRS, DEFINES and LIB_DEPS -if test "$mesa_driver" = dri -o "$mesa_driver" = no; then - # Use TLS in GLX? - if test "x$GLX_USE_TLS" = xyes; then - DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" - fi - - # Platform specific settings and drivers to build - case "$host_os" in - linux*) - DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" - if test "x$driglx_direct" = xyes; then - DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" - fi - DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" - - case "$host_cpu" in - x86_64) - # sis is missing because they have not be converted to use - # the new interface. i810 are missing because there is no - # x86-64 system where they could *ever* be used. - if test "x$DRI_DIRS" = "xyes"; then - DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \ - savage tdfx unichrome swrast" - fi - ;; - powerpc*) - # Build only the drivers for cards that exist on PowerPC. - # At some point MGA will be added, but not yet. - if test "x$DRI_DIRS" = "xyes"; then - DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast" - fi - ;; - sparc*) - # Build only the drivers for cards that exist on sparc` - if test "x$DRI_DIRS" = "xyes"; then - DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast" - fi - ;; - esac - ;; - freebsd* | dragonfly* | *netbsd*) - DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1" - DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS" - DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" - if test "x$driglx_direct" = xyes; then - DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" - fi - - if test "x$DRI_DIRS" = "xyes"; then - DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \ - unichrome savage sis swrast" - fi - ;; - gnu*) - DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" - DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" - ;; - solaris*) - DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" - DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" - if test "x$driglx_direct" = xyes; then - DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" - fi - ;; - esac - - # default drivers - if test "x$DRI_DIRS" = "xyes"; then - DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \ - savage sis tdfx unichrome swrast" - fi - - DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'` - - # Check for expat - if test "$mesa_driver" = dri; then - EXPAT_INCLUDES="" - EXPAT_LIB=-lexpat - AC_ARG_WITH([expat], - [AS_HELP_STRING([--with-expat=DIR], - [expat install directory])],[ - EXPAT_INCLUDES="-I$withval/include" - CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES" - LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR" - EXPAT_LIB="-L$withval/$LIB_DIR -lexpat" - ]) - AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])]) - AC_CHECK_LIB([expat],[XML_ParserCreate],[], - [AC_MSG_ERROR([Expat required for DRI.])]) - fi - - # put all the necessary libs together - DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS" -fi -AC_SUBST([DRI_DIRS]) -AC_SUBST([EXPAT_INCLUDES]) -AC_SUBST([DRI_LIB_DEPS]) - -case $DRI_DIRS in -*i915*|*i965*) - PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.23]) - ;; -esac - -case $DRI_DIRS in -*radeon*|*r200*|*r300*|*r600*) - if test "x$HAVE_LIBDRM_RADEON" = xyes; then - RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS" - RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS - fi - ;; -esac -AC_SUBST([RADEON_CFLAGS]) -AC_SUBST([RADEON_LDFLAGS]) - - -dnl -dnl OSMesa configuration -dnl -if test "$mesa_driver" = xlib; then - default_gl_osmesa=yes -else - default_gl_osmesa=no -fi -AC_ARG_ENABLE([gl-osmesa], - [AS_HELP_STRING([--enable-gl-osmesa], - [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])], - [gl_osmesa="$enableval"], - [gl_osmesa="$default_gl_osmesa"]) -if test "x$gl_osmesa" = xyes; then - if test "x$enable_opengl" = xno; then - AC_MSG_ERROR([OpenGL is not available for OSMesa driver]) - fi - if test "$mesa_driver" = osmesa; then - AC_MSG_ERROR([libGL is not available for OSMesa driver]) - else - DRIVER_DIRS="$DRIVER_DIRS osmesa" - fi -fi - -dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...) -AC_ARG_WITH([osmesa-bits], - [AS_HELP_STRING([--with-osmesa-bits=BITS], - [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])], - [osmesa_bits="$withval"], - [osmesa_bits=8]) -if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then - AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver]) - osmesa_bits=8 -fi -case "x$osmesa_bits" in -x8) - OSMESA_LIB=OSMesa - ;; -x16|x32) - OSMESA_LIB="OSMesa$osmesa_bits" - DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31" - ;; -*) - AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option]) - ;; -esac -AC_SUBST([OSMESA_LIB]) - -case "$DRIVER_DIRS" in -*osmesa*) - # only link libraries with osmesa if shared - if test "$enable_static" = no; then - OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS" - else - OSMESA_LIB_DEPS="" - fi - OSMESA_MESA_DEPS="" - OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS" - ;; -esac -AC_SUBST([OSMESA_LIB_DEPS]) -AC_SUBST([OSMESA_MESA_DEPS]) -AC_SUBST([OSMESA_PC_REQ]) -AC_SUBST([OSMESA_PC_LIB_PRIV]) - -dnl -dnl EGL configuration -dnl -AC_ARG_ENABLE([egl], - [AS_HELP_STRING([--disable-egl], - [disable EGL library @<:@default=enabled@:>@])], - [enable_egl="$enableval"], - [enable_egl=yes]) -if test "x$enable_egl" = xno; then - if test "x$mesa_driver" = xno; then - AC_MSG_ERROR([cannot disable EGL when there is no mesa driver]) - fi - if test "x$enable_openvg" = xyes; then - AC_MSG_ERROR([cannot enable OpenVG without EGL]) - fi -fi -if test "x$enable_egl" = xyes; then - SRC_DIRS="$SRC_DIRS egl" - EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread" - EGL_DRIVERS_DIRS="" - if test "$enable_static" != yes; then - # build egl_glx when libGL is built - if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then - EGL_DRIVERS_DIRS="glx" - fi - - if test "$mesa_driver" = dri; then - # build egl_dri2 when xcb-dri2 is available - PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes], - [have_xcb_dri2=yes],[have_xcb_dri2=no]) - PKG_CHECK_MODULES([LIBUDEV], [libudev > 150], - [have_libudev=yes],[have_libudev=no]) - - if test "$have_xcb_dri2" = yes; then - EGL_DRIVER_DRI2=dri2 - DEFINES="$DEFINES -DHAVE_XCB_DRI2" - if test "$have_libudev" = yes; then - DEFINES="$DEFINES -DHAVE_LIBUDEV" - fi - fi - fi - - EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2" - fi -fi -AC_SUBST([EGL_LIB_DEPS]) -AC_SUBST([EGL_DRIVERS_DIRS]) - -dnl -dnl GLU configuration -dnl -AC_ARG_ENABLE([glu], - [AS_HELP_STRING([--disable-glu], - [enable OpenGL Utility library @<:@default=enabled@:>@])], - [enable_glu="$enableval"], - [enable_glu=yes]) - -if test "x$enable_glu" = xyes -a "x$mesa_driver" = xno; then - AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver]) - enable_glu=no -fi - -if test "x$enable_glu" = xyes; then - SRC_DIRS="$SRC_DIRS glu" - - case "$mesa_driver" in - osmesa) - # Link libGLU to libOSMesa instead of libGL - GLU_LIB_DEPS="" - GLU_PC_REQ="osmesa" - if test "$enable_static" = no; then - GLU_MESA_DEPS='-l$(OSMESA_LIB)' - else - GLU_MESA_DEPS="" - fi - ;; - *) - # If static, empty GLU_LIB_DEPS and add libs for programs to link - GLU_PC_REQ="gl" - GLU_PC_LIB_PRIV="-lm" - if test "$enable_static" = no; then - GLU_LIB_DEPS="-lm" - GLU_MESA_DEPS='-l$(GL_LIB)' - else - GLU_LIB_DEPS="" - GLU_MESA_DEPS="" - APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++" - fi - ;; - esac -fi -if test "$enable_static" = no; then - GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS" -fi -GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS" -AC_SUBST([GLU_LIB_DEPS]) -AC_SUBST([GLU_MESA_DEPS]) -AC_SUBST([GLU_PC_REQ]) -AC_SUBST([GLU_PC_REQ_PRIV]) -AC_SUBST([GLU_PC_LIB_PRIV]) -AC_SUBST([GLU_PC_CFLAGS]) - -dnl -dnl GLw configuration -dnl -AC_ARG_ENABLE([glw], - [AS_HELP_STRING([--disable-glw], - [enable Xt/Motif widget library @<:@default=enabled@:>@])], - [enable_glw="$enableval"], - [enable_glw=yes]) -dnl Don't build GLw on osmesa -if test "x$enable_glw" = xyes; then - case "$mesa_driver" in - osmesa|no) - AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver]) - enable_glw=no - ;; - esac -fi -AC_ARG_ENABLE([motif], - [AS_HELP_STRING([--enable-motif], - [use Motif widgets in GLw @<:@default=disabled@:>@])], - [enable_motif="$enableval"], - [enable_motif=no]) - -if test "x$enable_glw" = xyes; then - SRC_DIRS="$SRC_DIRS glw" - if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES([GLW],[x11 xt]) - GLW_PC_REQ_PRIV="x11 xt" - GLW_LIB_DEPS="$GLW_LIBS" - else - # should check these... - GLW_LIB_DEPS="$X_LIBS -lXt -lX11" - GLW_PC_LIB_PRIV="$GLW_LIB_DEPS" - GLW_PC_CFLAGS="$X11_INCLUDES" - fi - - GLW_SOURCES="GLwDrawA.c" - MOTIF_CFLAGS= - if test "x$enable_motif" = xyes; then - GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c" - AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no]) - if test "x$MOTIF_CONFIG" != xno; then - MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags` - MOTIF_LIBS=`$MOTIF_CONFIG --libs` - else - AC_CHECK_HEADER([Xm/PrimitiveP.h], [], - [AC_MSG_ERROR([Can't locate Motif headers])]) - AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"], - [AC_MSG_ERROR([Can't locate Motif Xm library])]) - fi - # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11 - GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS" - GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV" - GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS" - fi - - # If static, empty GLW_LIB_DEPS and add libs for programs to link - GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV" - if test "$enable_static" = no; then - GLW_MESA_DEPS='-l$(GL_LIB)' - GLW_LIB_DEPS="$GLW_LIB_DEPS" - else - APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS" - GLW_LIB_DEPS="" - GLW_MESA_DEPS="" - fi -fi -AC_SUBST([GLW_LIB_DEPS]) -AC_SUBST([GLW_MESA_DEPS]) -AC_SUBST([GLW_SOURCES]) -AC_SUBST([MOTIF_CFLAGS]) -AC_SUBST([GLW_PC_REQ_PRIV]) -AC_SUBST([GLW_PC_LIB_PRIV]) -AC_SUBST([GLW_PC_CFLAGS]) - -dnl -dnl GLUT configuration -dnl -if test -f "$srcdir/include/GL/glut.h"; then - default_glut=yes -else - default_glut=no -fi -AC_ARG_ENABLE([glut], - [AS_HELP_STRING([--disable-glut], - [enable GLUT library @<:@default=enabled if source available@:>@])], - [enable_glut="$enableval"], - [enable_glut="$default_glut"]) - -dnl Don't build glut on osmesa -if test "x$enable_glut" = xyes; then - case "$mesa_driver" in - osmesa|no) - AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver]) - enable_glut=no - ;; - esac -fi -dnl Can't build glut if GLU not available -if test "x$enable_glu$enable_glut" = xnoyes; then - AC_MSG_WARN([Disabling glut since GLU is disabled]) - enable_glut=no -fi - -if test "x$enable_glut" = xyes; then - SRC_DIRS="$SRC_DIRS glut/glx" - if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES([GLUT],[x11 xmu xi]) - GLUT_PC_REQ_PRIV="x11 xmu xi" - GLUT_LIB_DEPS="$GLUT_LIBS" - else - # should check these... - GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi" - GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS" - GLUT_PC_CFLAGS="$X11_INCLUDES" - fi - if test "x$GCC" = xyes; then - GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions" - fi - GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm" - GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm" - - # If static, empty GLUT_LIB_DEPS and add libs for programs to link - if test "$enable_static" = no; then - GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)' - else - APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS" - GLUT_LIB_DEPS="" - GLUT_MESA_DEPS="" - fi -fi -AC_SUBST([GLUT_LIB_DEPS]) -AC_SUBST([GLUT_MESA_DEPS]) -AC_SUBST([GLUT_CFLAGS]) -AC_SUBST([GLUT_PC_REQ_PRIV]) -AC_SUBST([GLUT_PC_LIB_PRIV]) -AC_SUBST([GLUT_PC_CFLAGS]) - -dnl -dnl Program library dependencies -dnl Only libm is added here if necessary as the libraries should -dnl be pulled in by the linker -dnl -if test "x$APP_LIB_DEPS" = x; then - case "$host_os" in - solaris*) - APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm" - ;; - cygwin*) - APP_LIB_DEPS="-lX11" - ;; - *) - APP_LIB_DEPS="-lm" - ;; - esac -fi -AC_SUBST([APP_LIB_DEPS]) -AC_SUBST([PROGRAM_DIRS]) - -dnl -dnl Gallium configuration -dnl -AC_ARG_ENABLE([gallium], - [AS_HELP_STRING([--disable-gallium], - [build gallium @<:@default=enabled@:>@])], - [enable_gallium="$enableval"], - [enable_gallium=yes]) -if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then - AC_MSG_ERROR([cannot enable OpenVG without Gallium]) -fi -if test "x$enable_gallium" = xyes; then - SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets" - AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"], - [HAS_UDIS86="no"]) - AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no]) -fi - -AC_SUBST([LLVM_CFLAGS]) -AC_SUBST([LLVM_LIBS]) -AC_SUBST([LLVM_LDFLAGS]) -AC_SUBST([LLVM_VERSION]) - -dnl -dnl Gallium state trackers configuration -dnl - -AC_ARG_ENABLE([gallium-egl], - [AS_HELP_STRING([--enable-gallium-egl], - [enable gallium EGL state tracker @<:@default=auto@:>@])], - [enable_gallium_egl="$enableval"], - [enable_gallium_egl=auto]) -if test "x$enable_gallium_egl" = xauto; then - case "$mesa_driver" in - dri|no) - enable_gallium_egl=$enable_egl - ;; - *) - enable_gallium_egl=$enable_openvg - ;; - esac -fi -case "x$enable_egl$enable_gallium_egl" in -xnoyes) - AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL]) -esac - -AC_ARG_WITH([state-trackers], - [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@], - [comma delimited state_trackers list, e.g. - "egl,glx" @<:@default=auto@:>@])], - [with_state_trackers="$withval"], - [with_state_trackers=yes]) - -case "$with_state_trackers" in -no) - GALLIUM_STATE_TRACKERS_DIRS="" - ;; -yes) - # look at what else is built - case "$mesa_driver" in - xlib) - GALLIUM_STATE_TRACKERS_DIRS=glx - ;; - dri) - GALLIUM_STATE_TRACKERS_DIRS="dri" - HAVE_ST_DRI="yes" - # Have only tested st/xorg on 1.6.0 servers - PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED], - HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg", - HAVE_ST_XORG="no") - ;; - esac - - if test "x$enable_egl" = xyes; then - if test "$enable_openvg" = yes; then - GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega" - st_egl="yes" - fi - - if test "$enable_gallium_egl" = yes; then - GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl" - HAVE_ST_EGL="yes" - fi - fi - ;; -*) - # verify the requested state tracker exist - state_trackers="" - _state_trackers=`IFS=', '; echo $with_state_trackers` - for tracker in $_state_trackers; do - case "$tracker" in - dri) - if test "x$mesa_driver" != xdri; then - AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri]) - fi - HAVE_ST_DRI="yes" - ;; - egl) - if test "x$enable_egl" != xyes; then - AC_MSG_ERROR([cannot build egl state tracker without EGL library]) - fi - HAVE_ST_EGL="yes" - ;; - xorg) - PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0]) - PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED]) - PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED]) - HAVE_ST_XORG="yes" - ;; - vega) - if test "x$enable_openvg" != xyes; then - AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg]) - fi - ;; - esac - - if test -n "$tracker"; then - test -d "$srcdir/src/gallium/state_trackers/$tracker" || \ - AC_MSG_ERROR([state tracker '$tracker' doesn't exist]) - if test -n "$state_trackers"; then - state_trackers="$state_trackers $tracker" - else - state_trackers="$tracker" - fi - fi - done - GALLIUM_STATE_TRACKERS_DIRS="$state_trackers" - ;; -esac - - -EGL_CLIENT_APIS="" -VG_LIB_DEPS="" - -case "x$enable_opengl$enable_gles1$enable_gles2" in -x*yes*) - EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)' - ;; -esac -if test "x$enable_openvg" = xyes; then - EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)' - VG_LIB_DEPS="$VG_LIB_DEPS -lpthread" -fi - -AC_SUBST([VG_LIB_DEPS]) -AC_SUBST([EGL_CLIENT_APIS]) - -if test "x$HAVE_ST_EGL" = xyes; then - GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl" -fi - -if test "x$HAVE_ST_XORG" = xyes; then - PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], - HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71", - HAVE_XEXTPROTO_71="no") -fi - -AC_ARG_WITH([egl-platforms], - [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@], - [comma delimited native platforms libEGL supports, e.g. - "x11,drm" @<:@default=auto@:>@])], - [with_egl_platforms="$withval"], - [with_egl_platforms=yes]) -AC_ARG_WITH([egl-displays], - [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@], - [DEPRECATED. Use --with-egl-platforms instead])], - [with_egl_platforms="$withval"]) - -EGL_PLATFORMS="" -case "$with_egl_platforms" in -yes) - if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then - EGL_PLATFORMS="x11" - if test "$mesa_driver" = dri; then - EGL_PLATFORMS="$EGL_PLATFORMS drm" - fi - fi - ;; -*) - if test "x$enable_egl" != xyes; then - AC_MSG_ERROR([cannot build egl state tracker without EGL library]) - fi - # verify the requested driver directories exist - egl_platforms=`IFS=', '; echo $with_egl_platforms` - for plat in $egl_platforms; do - test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \ - AC_MSG_ERROR([EGL platform '$plat' does't exist]) - if test "$plat" = "fbdev"; then - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev" - fi - done - EGL_PLATFORMS="$egl_platforms" - ;; -esac -AC_SUBST([EGL_PLATFORMS]) - -AC_ARG_WITH([egl-driver-dir], - [AS_HELP_STRING([--with-egl-driver-dir=DIR], - [directory for EGL drivers [[default=${libdir}/egl]]])], - [EGL_DRIVER_INSTALL_DIR="$withval"], - [EGL_DRIVER_INSTALL_DIR='${libdir}/egl']) -AC_SUBST([EGL_DRIVER_INSTALL_DIR]) - -AC_ARG_WITH([xorg-driver-dir], - [AS_HELP_STRING([--with-xorg-driver-dir=DIR], - [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])], - [XORG_DRIVER_INSTALL_DIR="$withval"], - [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"]) -AC_SUBST([XORG_DRIVER_INSTALL_DIR]) - -AC_ARG_WITH([max-width], - [AS_HELP_STRING([--with-max-width=N], - [Maximum framebuffer width (4096)])], - [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}"; - AS_IF([test "${withval}" -gt "4096"], - [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])] -) -AC_ARG_WITH([max-height], - [AS_HELP_STRING([--with-max-height=N], - [Maximum framebuffer height (4096)])], - [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}"; - AS_IF([test "${withval}" -gt "4096"], - [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])] -) - -dnl -dnl Gallium LLVM -dnl -AC_ARG_ENABLE([gallium-llvm], - [AS_HELP_STRING([--enable-gallium-llvm], - [build gallium LLVM support @<:@default=disabled@:>@])], - [enable_gallium_llvm="$enableval"], - [enable_gallium_llvm=auto]) -if test "x$enable_gallium_llvm" = xyes; then - if test "x$LLVM_CONFIG" != xno; then - LLVM_VERSION=`$LLVM_CONFIG --version` - LLVM_CFLAGS=`$LLVM_CONFIG --cppflags` - LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++" - - if test "x$HAS_UDIS86" != xno; then - LLVM_LIBS="$LLVM_LIBS -ludis86" - DEFINES="$DEFINES -DHAVE_UDIS86" - fi - LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags` - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe" - DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS" - MESA_LLVM=1 - else - MESA_LLVM=0 - fi -else - MESA_LLVM=0 -fi - -dnl -dnl Gallium helper functions -dnl -gallium_check_st() { - if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1" - fi - if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then - GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2" - fi - if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then - GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3" - fi -} - - -dnl -dnl Gallium SVGA configuration -dnl -AC_ARG_ENABLE([gallium-svga], - [AS_HELP_STRING([--enable-gallium-svga], - [build gallium SVGA @<:@default=disabled@:>@])], - [enable_gallium_svga="$enableval"], - [enable_gallium_svga=auto]) -if test "x$enable_gallium_svga" = xyes; then - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga" - gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx" -elif test "x$enable_gallium_svga" = xauto; then - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga" -fi - -dnl -dnl Gallium i915 configuration -dnl -AC_ARG_ENABLE([gallium-i915], - [AS_HELP_STRING([--enable-gallium-i915], - [build gallium i915 @<:@default=disabled@:>@])], - [enable_gallium_i915="$enableval"], - [enable_gallium_i915=auto]) -if test "x$enable_gallium_i915" = xyes; then - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw" - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915" - gallium_check_st "i915/drm" "dri-i915" "xorg-i915" -elif test "x$enable_gallium_i915" = xauto; then - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw" - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915" -fi - -dnl -dnl Gallium i965 configuration -dnl -AC_ARG_ENABLE([gallium-i965], - [AS_HELP_STRING([--enable-gallium-i965], - [build gallium i965 @<:@default=disabled@:>@])], - [enable_gallium_i965="$enableval"], - [enable_gallium_i965=auto]) -if test "x$enable_gallium_i965" = xyes; then - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965" - gallium_check_st "i965/drm" "dri-i965" "xorg-i965" -elif test "x$enable_gallium_i965" = xauto; then - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965" -fi - -dnl -dnl Gallium Radeon r300g configuration -dnl -AC_ARG_ENABLE([gallium-radeon], - [AS_HELP_STRING([--enable-gallium-radeon], - [build gallium radeon @<:@default=disabled@:>@])], - [enable_gallium_radeon="$enableval"], - [enable_gallium_radeon=auto]) -if test "x$enable_gallium_radeon" = xauto; then - if test "x$HAVE_LIBDRM_RADEON" = xyes; then - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300" - gallium_check_st "radeon/drm" "dri-r300" - else - AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)]) - fi -fi -if test "x$enable_gallium_radeon" = xyes; then - if test "x$HAVE_LIBDRM_RADEON" = xyes; then - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300" - gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon" - else - AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)]) - fi -fi - -dnl -dnl Gallium Radeon r600g configuration -dnl -AC_ARG_ENABLE([gallium-r600], - [AS_HELP_STRING([--enable-gallium-r600], - [build gallium radeon @<:@default=disabled@:>@])], - [enable_gallium_r600="$enableval"], - [enable_gallium_r600=auto]) -if test "x$enable_gallium_r600" = xyes; then - if test "x$HAVE_LIBDRM_RADEON" = xyes; then - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600" - gallium_check_st "r600/drm" "dri-r600" - else - AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600]) - fi -fi - -dnl -dnl Gallium Nouveau configuration -dnl -AC_ARG_ENABLE([gallium-nouveau], - [AS_HELP_STRING([--enable-gallium-nouveau], - [build gallium nouveau @<:@default=disabled@:>@])], - [enable_gallium_nouveau="$enableval"], - [enable_gallium_nouveau=no]) -if test "x$enable_gallium_nouveau" = xyes; then - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0" - gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" -fi - -dnl -dnl Gallium swrast configuration -dnl -AC_ARG_ENABLE([gallium-swrast], - [AS_HELP_STRING([--enable-gallium-swrast], - [build gallium swrast @<:@default=auto@:>@])], - [enable_gallium_swrast="$enableval"], - [enable_gallium_swrast=auto]) -if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then - if test "x$HAVE_ST_DRI" = xyes; then - GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast" - fi -fi - -dnl prepend CORE_DIRS to SRC_DIRS -SRC_DIRS="$CORE_DIRS $SRC_DIRS" - -dnl Restore LDFLAGS and CPPFLAGS -LDFLAGS="$_SAVE_LDFLAGS" -CPPFLAGS="$_SAVE_CPPFLAGS" - -dnl Substitute the config -AC_CONFIG_FILES([configs/autoconf]) - -dnl Replace the configs/current symlink -AC_CONFIG_COMMANDS([configs],[ -if test -f configs/current || test -L configs/current; then - rm -f configs/current -fi -ln -s autoconf configs/current -]) - -AC_OUTPUT - -dnl -dnl Output some configuration info for the user -dnl -echo "" -echo " prefix: $prefix" -echo " exec_prefix: $exec_prefix" -echo " libdir: $libdir" -echo " includedir: $includedir" - -dnl API info -echo "" -echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)" -echo " OpenVG: $enable_openvg" - -dnl Driver info -echo "" -echo " Driver: $mesa_driver" -if test "$mesa_driver" != no; then - if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then - echo " OSMesa: lib$OSMESA_LIB" - else - echo " OSMesa: no" - fi - if test "$mesa_driver" = dri; then - # cleanup the drivers var - dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` - if test "x$DRI_DIRS" = x; then - echo " DRI drivers: no" - else - echo " DRI drivers: $dri_dirs" - fi - echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" - echo " Use XCB: $enable_xcb" - fi -fi -echo "" -echo " GLU: $enable_glu" -echo " GLw: $enable_glw (Motif: $enable_motif)" -echo " glut: $enable_glut" - -dnl EGL -echo "" -echo " EGL: $enable_egl" -if test "$enable_egl" = yes; then - echo " EGL platforms: $EGL_PLATFORMS" - - egl_drivers="" - for d in $EGL_DRIVERS_DIRS; do - egl_drivers="$egl_drivers builtin:egl_$d" - done - - if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then - echo " EGL drivers: ${egl_drivers} egl_gallium" - echo " EGL Gallium STs:$EGL_CLIENT_APIS" - else - echo " EGL drivers: $egl_drivers" - fi -fi - -echo "" -if test "x$MESA_LLVM" = x1; then - echo " llvm: yes" - echo " llvm-config: $LLVM_CONFIG" - echo " llvm-version: $LLVM_VERSION" -else - echo " llvm: no" -fi - -echo "" -if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then - echo " Gallium: yes" - echo " Gallium dirs: $GALLIUM_DIRS" - echo " Target dirs: $GALLIUM_TARGET_DIRS" - echo " Winsys dirs: $GALLIUM_WINSYS_DIRS" - echo " Driver dirs: $GALLIUM_DRIVERS_DIRS" - echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS" -else - echo " Gallium: no" -fi - -dnl Libraries -echo "" -echo " Shared libs: $enable_shared" -echo " Static libs: $enable_static" - -dnl Compiler options -# cleanup the CFLAGS/CXXFLAGS/DEFINES vars -cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ - $SED 's/^ *//;s/ */ /;s/ *$//'` -cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ - $SED 's/^ *//;s/ */ /;s/ *$//'` -defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'` -echo "" -echo " CFLAGS: $cflags" -echo " CXXFLAGS: $cxxflags" -echo " Macros: $defines" -echo "" -echo " PYTHON2: $PYTHON2" - -echo "" -echo " Run '${MAKE-make}' to build Mesa" -echo "" +dnl Process this file with autoconf to create configure. + +AC_PREREQ([2.59]) + +dnl Versioning - scrape the version from configs/default +m4_define([mesa_version], + [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n' | tr -d '\r'])]) +m4_ifval(mesa_version,, + [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])]) + +dnl Tell the user about autoconf.html in the --help output +m4_divert_once([HELP_END], [ +See docs/autoconf.html for more details on the options for Mesa.]) + +AC_INIT([Mesa],[mesa_version], + [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa]) +AC_CONFIG_AUX_DIR([bin]) +AC_CANONICAL_HOST + +dnl Versions for external dependencies +LIBDRM_REQUIRED=2.4.23 +LIBDRM_RADEON_REQUIRED=2.4.23 +DRI2PROTO_REQUIRED=2.1 +GLPROTO_REQUIRED=1.4.11 +LIBDRM_XORG_REQUIRED=2.4.23 +LIBKMS_XORG_REQUIRED=1.0.0 + +dnl Check for progs +AC_PROG_CPP +AC_PROG_CC +AC_PROG_CXX +AC_CHECK_PROGS([MAKE], [gmake make]) +AC_CHECK_PROGS([PYTHON2], [python2 python]) +AC_PATH_PROG([MKDEP], [makedepend]) +AC_PATH_PROG([SED], [sed]) + +if test "x$MKDEP" = "x"; then + AC_MSG_ERROR([makedepend is required to build Mesa]) +fi + +dnl Our fallback install-sh is a symlink to minstall. Use the existing +dnl configuration in that case. +AC_PROG_INSTALL +test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)' + +dnl We need a POSIX shell for parts of the build. Assume we have one +dnl in most cases. +case "$host_os" in +solaris*) + # Solaris /bin/sh is too old/non-POSIX compliant + AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh]) + SHELL="$POSIX_SHELL" + ;; +esac + +dnl clang is mostly GCC-compatible, but its version is much lower, +dnl so we have to check for it. +AC_MSG_CHECKING([if compiling with clang]) + +AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([], [[ +#ifndef __clang__ + not clang +#endif +]])], +[CLANG=yes], [CLANG=no]) + +AC_MSG_RESULT([$CLANG]) + +dnl If we're using GCC, make sure that it is at least version 3.3.0. Older +dnl versions are explictly not supported. +if test "x$GCC" = xyes -a "x$CLANG" = xno; then + AC_MSG_CHECKING([whether gcc version is sufficient]) + major=0 + minor=0 + + GCC_VERSION=`$CC -dumpversion` + if test $? -eq 0; then + major=`echo $GCC_VERSION | cut -d. -f1` + minor=`echo $GCC_VERSION | cut -d. -f1` + fi + + if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.]) + else + AC_MSG_RESULT([yes]) + fi +fi + + +MKDEP_OPTIONS=-fdepend +dnl Ask gcc where it's keeping its secret headers +if test "x$GCC" = xyes; then + for dir in include include-fixed; do + GCC_INCLUDES=`$CC -print-file-name=$dir` + if test "x$GCC_INCLUDES" != x && \ + test "$GCC_INCLUDES" != "$dir" && \ + test -d "$GCC_INCLUDES"; then + MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES" + fi + done +fi +AC_SUBST([MKDEP_OPTIONS]) + +dnl Make sure the pkg-config macros are defined +m4_ifndef([PKG_PROG_PKG_CONFIG], + [m4_fatal([Could not locate the pkg-config autoconf macros. + These are usually located in /usr/share/aclocal/pkg.m4. If your macros + are in a different location, try setting the environment variable + ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])]) +PKG_PROG_PKG_CONFIG() + +dnl LIB_DIR - library basename +LIB_DIR=`echo $libdir | $SED 's%.*/%%'` +AC_SUBST([LIB_DIR]) + +dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later +_SAVE_LDFLAGS="$LDFLAGS" +AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker]) +AC_SUBST([EXTRA_LIB_PATH]) + +dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later +_SAVE_CPPFLAGS="$CPPFLAGS" +AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers]) +AC_SUBST([X11_INCLUDES]) + +dnl Compiler macros +DEFINES="" +AC_SUBST([DEFINES]) +case "$host_os" in +linux*|*-gnu*|gnu*) + DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS" + ;; +solaris*) + DEFINES="$DEFINES -DPTHREADS -DSVR4" + ;; +cygwin*) + DEFINES="$DEFINES -DPTHREADS" + ;; +esac + +dnl Add flags for gcc and g++ +if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99" + if test "x$CLANG" = "xno"; then + CFLAGS="$CFLAGS -ffast-math" + fi + + # Enable -fvisibility=hidden if using a gcc that supports it + save_CFLAGS="$CFLAGS" + AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) + CFLAGS="$CFLAGS -fvisibility=hidden" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), + [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]); + + # Work around aliasing bugs - developers should comment this out + CFLAGS="$CFLAGS -fno-strict-aliasing" +fi +if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -Wall" + + # Enable -fvisibility=hidden if using a gcc that supports it + save_CXXFLAGS="$CXXFLAGS" + AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden]) + CXXFLAGS="$CXXFLAGS -fvisibility=hidden" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), + [CXXFLAGS="$save_CXXFLAGS" ; AC_MSG_RESULT([no])]); + + # Work around aliasing bugs - developers should comment this out + CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" +fi + +dnl These should be unnecessary, but let the user set them if they want +AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler. + Default is to use CFLAGS.]) +AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the + compiler. Default is to use CFLAGS.]) +AC_SUBST([OPT_FLAGS]) +AC_SUBST([ARCH_FLAGS]) + +dnl +dnl Hacks to enable 32 or 64 bit build +dnl +AC_ARG_ENABLE([32-bit], + [AS_HELP_STRING([--enable-32-bit], + [build 32-bit libraries @<:@default=auto@:>@])], + [enable_32bit="$enableval"], + [enable_32bit=auto] +) +if test "x$enable_32bit" = xyes; then + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -m32" + ARCH_FLAGS="$ARCH_FLAGS -m32" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -m32" + fi +fi +AC_ARG_ENABLE([64-bit], + [AS_HELP_STRING([--enable-64-bit], + [build 64-bit libraries @<:@default=auto@:>@])], + [enable_64bit="$enableval"], + [enable_64bit=auto] +) +if test "x$enable_64bit" = xyes; then + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -m64" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -m64" + fi +fi + +dnl +dnl shared/static libraries, mimic libtool options +dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static], + [build static libraries @<:@default=disabled@:>@])], + [enable_static="$enableval"], + [enable_static=no] +) +case "x$enable_static" in +xyes|xno ) ;; +x ) enable_static=no ;; +* ) + AC_MSG_ERROR([Static library option '$enable_static' is not a valid]) + ;; +esac +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--disable-shared], + [build shared libraries @<:@default=enabled@:>@])], + [enable_shared="$enableval"], + [enable_shared=yes] +) +case "x$enable_shared" in +xyes|xno ) ;; +x ) enable_shared=yes ;; +* ) + AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid]) + ;; +esac + +dnl Can't have static and shared libraries, default to static if user +dnl explicitly requested. If both disabled, set to static since shared +dnl was explicitly requirested. +case "x$enable_static$enable_shared" in +xyesyes ) + AC_MSG_WARN([Can't build static and shared libraries, disabling shared]) + enable_shared=no + ;; +xnono ) + AC_MSG_WARN([Can't disable both static and shared libraries, enabling static]) + enable_static=yes + ;; +esac + +dnl +dnl mklib options +dnl +AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib]) +if test "$enable_static" = yes; then + MKLIB_OPTIONS="$MKLIB_OPTIONS -static" +fi +AC_SUBST([MKLIB_OPTIONS]) + +dnl +dnl other compiler options +dnl +AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], + [use debug compiler flags and macros @<:@default=disabled@:>@])], + [enable_debug="$enableval"], + [enable_debug=no] +) +if test "x$enable_debug" = xyes; then + DEFINES="$DEFINES -DDEBUG" + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -g" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -g" + fi +fi + +dnl +dnl library names +dnl +LIB_PREFIX_GLOB='lib' +LIB_VERSION_SEPARATOR='.' +if test "$enable_static" = yes; then + LIB_EXTENSION='a' +else + case "$host_os" in + darwin* ) + LIB_EXTENSION='dylib' ;; + cygwin* ) + dnl prefix can be 'cyg' or 'lib' + LIB_PREFIX_GLOB='???' + LIB_VERSION_SEPARATOR='-' + LIB_EXTENSION='dll' ;; + aix* ) + LIB_EXTENSION='a' ;; + * ) + LIB_EXTENSION='so' ;; + esac +fi + +GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION} +GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION} +GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION} +GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION} +OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION} +EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION} +GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION} +GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION} +VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION} +GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION} + +GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +GLW_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLW_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' +GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' + +AC_SUBST([GL_LIB_NAME]) +AC_SUBST([GLU_LIB_NAME]) +AC_SUBST([GLUT_LIB_NAME]) +AC_SUBST([GLW_LIB_NAME]) +AC_SUBST([OSMESA_LIB_NAME]) +AC_SUBST([EGL_LIB_NAME]) +AC_SUBST([GLESv1_CM_LIB_NAME]) +AC_SUBST([GLESv2_LIB_NAME]) +AC_SUBST([VG_LIB_NAME]) +AC_SUBST([GLAPI_LIB_NAME]) + +AC_SUBST([GL_LIB_GLOB]) +AC_SUBST([GLU_LIB_GLOB]) +AC_SUBST([GLUT_LIB_GLOB]) +AC_SUBST([GLW_LIB_GLOB]) +AC_SUBST([OSMESA_LIB_GLOB]) +AC_SUBST([EGL_LIB_GLOB]) +AC_SUBST([GLESv1_CM_LIB_GLOB]) +AC_SUBST([GLESv2_LIB_GLOB]) +AC_SUBST([VG_LIB_GLOB]) +AC_SUBST([GLAPI_LIB_GLOB]) + +dnl +dnl Arch/platform-specific settings +dnl +AC_ARG_ENABLE([asm], + [AS_HELP_STRING([--disable-asm], + [disable assembly usage @<:@default=enabled on supported plaforms@:>@])], + [enable_asm="$enableval"], + [enable_asm=yes] +) +asm_arch="" +ASM_FLAGS="" +MESA_ASM_SOURCES="" +GLAPI_ASM_SOURCES="" +AC_MSG_CHECKING([whether to enable assembly]) +test "x$enable_asm" = xno && AC_MSG_RESULT([no]) +# disable if cross compiling on x86/x86_64 since we must run gen_matypes +if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then + case "$host_cpu" in + i?86 | x86_64) + enable_asm=no + AC_MSG_RESULT([no, cross compiling]) + ;; + esac +fi +# check for supported arches +if test "x$enable_asm" = xyes; then + case "$host_cpu" in + i?86) + case "$host_os" in + linux* | *freebsd* | dragonfly* | *netbsd*) + test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86 + ;; + esac + ;; + x86_64) + case "$host_os" in + linux* | *freebsd* | dragonfly* | *netbsd*) + test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64 + ;; + esac + ;; + powerpc) + case "$host_os" in + linux*) + asm_arch=ppc + ;; + esac + ;; + sparc*) + case "$host_os" in + linux*) + asm_arch=sparc + ;; + esac + ;; + esac + + case "$asm_arch" in + x86) + ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" + MESA_ASM_SOURCES='$(X86_SOURCES)' + GLAPI_ASM_SOURCES='$(X86_API)' + AC_MSG_RESULT([yes, x86]) + ;; + x86_64) + ASM_FLAGS="-DUSE_X86_64_ASM" + MESA_ASM_SOURCES='$(X86-64_SOURCES)' + GLAPI_ASM_SOURCES='$(X86-64_API)' + AC_MSG_RESULT([yes, x86_64]) + ;; + ppc) + ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" + MESA_ASM_SOURCES='$(PPC_SOURCES)' + AC_MSG_RESULT([yes, ppc]) + ;; + sparc) + ASM_FLAGS="-DUSE_SPARC_ASM" + MESA_ASM_SOURCES='$(SPARC_SOURCES)' + GLAPI_ASM_SOURCES='$(SPARC_API)' + AC_MSG_RESULT([yes, sparc]) + ;; + *) + AC_MSG_RESULT([no, platform not supported]) + ;; + esac +fi +AC_SUBST([ASM_FLAGS]) +AC_SUBST([MESA_ASM_SOURCES]) +AC_SUBST([GLAPI_ASM_SOURCES]) + +dnl PIC code macro +MESA_PIC_FLAGS + +dnl Check to see if dlopen is in default libraries (like Solaris, which +dnl has it in libc), or if libdl is needed to get it. +AC_CHECK_FUNC([dlopen], [], + [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])]) +AC_SUBST([DLOPEN_LIBS]) + +dnl See if posix_memalign is available +AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"]) + +dnl SELinux awareness. +AC_ARG_ENABLE([selinux], + [AS_HELP_STRING([--enable-selinux], + [Build SELinux-aware Mesa @<:@default=disabled@:>@])], + [MESA_SELINUX="$enableval"], + [MESA_SELINUX=no]) +if test "x$enable_selinux" = "xyes"; then + AC_CHECK_HEADER([selinux/selinux.h],[], + [AC_MSG_ERROR([SELinux headers not found])]) + AC_CHECK_LIB([selinux],[is_selinux_enabled],[], + [AC_MSG_ERROR([SELinux library not found])]) + SELINUX_LIBS="-lselinux" + DEFINES="$DEFINES -DMESA_SELINUX" +fi + +dnl Determine which APIs to support +AC_ARG_ENABLE([opengl], + [AS_HELP_STRING([--disable-opengl], + [disable support for standard OpenGL API @<:@default=no@:>@])], + [enable_opengl="$enableval"], + [enable_opengl=yes]) +AC_ARG_ENABLE([gles1], + [AS_HELP_STRING([--enable-gles1], + [enable support for OpenGL ES 1.x API @<:@default=no@:>@])], + [enable_gles1="$enableval"], + [enable_gles1=no]) +AC_ARG_ENABLE([gles2], + [AS_HELP_STRING([--enable-gles2], + [enable support for OpenGL ES 2.x API @<:@default=no@:>@])], + [enable_gles2="$enableval"], + [enable_gles2=no]) +AC_ARG_ENABLE([gles-overlay], + [AS_HELP_STRING([--enable-gles-overlay], + [DEPRECATED. Same as --enable-gles1 and --enable-gles2])], + [enable_gles1="$enableval"; enable_gles2="$enableval"], + []) + +AC_ARG_ENABLE([openvg], + [AS_HELP_STRING([--enable-openvg], + [enable support for OpenVG API @<:@default=no@:>@])], + [enable_openvg="$enableval"], + [enable_openvg=no]) + +dnl smooth the transition; should be removed eventually +if test "x$enable_openvg" = xno; then + case "x$with_state_trackers" in + x*vega*) + AC_MSG_WARN([vega state tracker is enabled without --enable-openvg]) + enable_openvg=yes + ;; + esac +fi + +if test "x$enable_opengl" = xno -a \ + "x$enable_gles1" = xno -a \ + "x$enable_gles2" = xno -a \ + "x$enable_openvg" = xno; then + AC_MSG_ERROR([at least one API should be enabled]) +fi + +API_DEFINES="" +if test "x$enable_opengl" = xno; then + API_DEFINES="$API_DEFINES -DFEATURE_GL=0" +else + API_DEFINES="$API_DEFINES -DFEATURE_GL=1" +fi +if test "x$enable_gles1" = xyes; then + API_DEFINES="$API_DEFINES -DFEATURE_ES1=1" +fi +if test "x$enable_gles2" = xyes; then + API_DEFINES="$API_DEFINES -DFEATURE_ES2=1" +fi +AC_SUBST([API_DEFINES]) + +AC_ARG_ENABLE([shared-glapi], + [AS_HELP_STRING([--enable-shared-glapi], + [EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])], + [enable_shared_glapi="$enableval"], + [enable_shared_glapi=no]) + +SHARED_GLAPI="0" +if test "x$enable_shared_glapi" = xyes; then + SHARED_GLAPI="1" +fi +AC_SUBST([SHARED_GLAPI]) + +dnl +dnl Driver configuration. Options are xlib, dri and osmesa right now. +dnl More later: fbdev, ... +dnl +default_driver="xlib" + +case "$host_os" in +linux*) + case "$host_cpu" in + i*86|x86_64|powerpc*|sparc*) default_driver="dri";; + esac + ;; +*freebsd* | dragonfly* | *netbsd*) + case "$host_cpu" in + i*86|x86_64|powerpc*|sparc*) default_driver="dri";; + esac + ;; +esac + +if test "x$enable_opengl" = xno; then + default_driver="no" +fi + +AC_ARG_WITH([driver], + [AS_HELP_STRING([--with-driver=DRIVER], + [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])], + [mesa_driver="$withval"], + [mesa_driver="$default_driver"]) +dnl Check for valid option +case "x$mesa_driver" in +xxlib|xdri|xosmesa) + if test "x$enable_opengl" = xno; then + AC_MSG_ERROR([Driver '$mesa_driver' requires OpenGL enabled]) + fi + ;; +xno) + ;; +*) + AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option]) + ;; +esac + +PKG_CHECK_MODULES([TALLOC], [talloc]) +AC_SUBST([TALLOC_LIBS]) +AC_SUBST([TALLOC_CFLAGS]) + +dnl +dnl Driver specific build directories +dnl + +dnl this variable will be prepended to SRC_DIRS and is not exported +CORE_DIRS="" + +SRC_DIRS="" +GLU_DIRS="sgi" +GALLIUM_DIRS="auxiliary drivers state_trackers" +GALLIUM_TARGET_DIRS="" +GALLIUM_WINSYS_DIRS="sw" +GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity" +GALLIUM_STATE_TRACKERS_DIRS="" + +# build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled +case "x$enabled_shared_glapi$enable_gles1$enable_gles2" in +x*yes*) + CORE_DIRS="$CORE_DIRS mapi/shared-glapi" + ;; +esac + +# build glapi if OpenGL is enabled +if test "x$enable_opengl" = xyes; then + CORE_DIRS="$CORE_DIRS mapi/glapi" +fi + +# build es1api if OpenGL ES 1.x is enabled +if test "x$enable_gles1" = xyes; then + CORE_DIRS="$CORE_DIRS mapi/es1api" +fi + +# build es2api if OpenGL ES 2.x is enabled +if test "x$enable_gles2" = xyes; then + CORE_DIRS="$CORE_DIRS mapi/es2api" +fi + +# build vgapi if OpenVG is enabled +if test "x$enable_openvg" = xyes; then + CORE_DIRS="$CORE_DIRS mapi/vgapi" +fi + +# build glsl and mesa if OpenGL or OpenGL ES is enabled +case "x$enable_opengl$enable_gles1$enable_gles2" in +x*yes*) + CORE_DIRS="$CORE_DIRS glsl mesa" + ;; +esac + +case "$mesa_driver" in +xlib) + DRIVER_DIRS="x11" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib" + GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib" + ;; +dri) + SRC_DIRS="$SRC_DIRS glx" + DRIVER_DIRS="dri" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri" + ;; +osmesa) + DRIVER_DIRS="osmesa" + ;; +no) + DRIVER_DRIS="" + ;; +esac +AC_SUBST([SRC_DIRS]) +AC_SUBST([GLU_DIRS]) +AC_SUBST([DRIVER_DIRS]) +AC_SUBST([GALLIUM_DIRS]) +AC_SUBST([GALLIUM_TARGET_DIRS]) +AC_SUBST([GALLIUM_WINSYS_DIRS]) +AC_SUBST([GALLIUM_DRIVERS_DIRS]) +AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS]) +AC_SUBST([MESA_LLVM]) + +dnl +dnl Find out if X is available. The variable have_x is set if libX11 is +dnl found to mimic AC_PATH_XTRA. +dnl +if test -n "$PKG_CONFIG"; then + AC_MSG_CHECKING([pkg-config files for X11 are available]) + PKG_CHECK_EXISTS([x11],[ + x11_pkgconfig=yes + have_x=yes + ],[ + x11_pkgconfig=no + ]) + AC_MSG_RESULT([$x11_pkgconfig]) +else + x11_pkgconfig=no +fi +dnl Use the autoconf macro if no pkg-config files +if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([X11], [x11]) +else + AC_PATH_XTRA + test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS" + test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11" + AC_SUBST([X11_CFLAGS]) + AC_SUBST([X11_LIBS]) +fi + +dnl Try to tell the user that the --x-* options are only used when +dnl pkg-config is not available. This must be right after AC_PATH_XTRA. +m4_divert_once([HELP_BEGIN], +[These options are only used when the X libraries cannot be found by the +pkg-config utility.]) + +dnl We need X for xlib and dri, so bomb now if it's not found +case "$mesa_driver" in +xlib|dri) + if test "$no_x" = yes; then + AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver]) + fi + ;; +esac + +dnl XCB - this is only used for GLX right now +AC_ARG_ENABLE([xcb], + [AS_HELP_STRING([--enable-xcb], + [use XCB for GLX @<:@default=disabled@:>@])], + [enable_xcb="$enableval"], + [enable_xcb=no]) +if test "x$enable_xcb" = xyes; then + DEFINES="$DEFINES -DUSE_XCB" +else + enable_xcb=no +fi + +dnl +dnl libGL configuration per driver +dnl +case "$mesa_driver" in +xlib) + if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([XLIBGL], [x11 xext]) + GL_PC_REQ_PRIV="x11 xext" + X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS" + GL_LIB_DEPS="$XLIBGL_LIBS" + else + # should check these... + X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" + GL_LIB_DEPS="$X_LIBS -lX11 -lXext" + GL_PC_LIB_PRIV="$GL_LIB_DEPS" + GL_PC_CFLAGS="$X11_INCLUDES" + fi + GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS" + GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS" + + # if static, move the external libraries to the programs + # and empty the libraries for libGL + if test "$enable_static" = yes; then + APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS" + GL_LIB_DEPS="" + fi + ;; +dri|no) # these checks are still desired when there is no mesa_driver + # DRI must be shared, I think + if test "$enable_static" = yes; then + AC_MSG_ERROR([Can't use static libraries for DRI drivers]) + fi + + # Check for libdrm + PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) + PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) + PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED]) + GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED" + DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" + + # find the DRI deps for libGL + if test "$x11_pkgconfig" = yes; then + dri_modules="x11 xext xdamage xfixes" + + # add xf86vidmode if available + PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no) + if test "$HAVE_XF86VIDMODE" = yes ; then + dri_modules="$dri_modules xxf86vm" + fi + + # add xcb modules if necessary + if test "$enable_xcb" = yes; then + dri_modules="$dri_modules x11-xcb xcb-glx" + fi + + PKG_CHECK_MODULES([DRIGL], [$dri_modules]) + GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules" + X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS" + GL_LIB_DEPS="$DRIGL_LIBS" + else + # should check these... + X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" + GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes" + GL_PC_LIB_PRIV="$GL_LIB_DEPS" + GL_PC_CFLAGS="$X11_INCLUDES" + + # XCB can only be used from pkg-config + if test "$enable_xcb" = yes; then + PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx]) + GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx" + X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS" + GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS" + fi + fi + + # need DRM libs, -lpthread, etc. + GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" + GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" + GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" + GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" + GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" + GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" + ;; +osmesa) + # No libGL for osmesa + GL_LIB_DEPS="" + ;; +esac +AC_SUBST([GL_LIB_DEPS]) +AC_SUBST([GL_PC_REQ_PRIV]) +AC_SUBST([GL_PC_LIB_PRIV]) +AC_SUBST([GL_PC_CFLAGS]) +AC_SUBST([DRI_PC_REQ_PRIV]) +AC_SUBST([GLESv1_CM_LIB_DEPS]) +AC_SUBST([GLESv1_CM_PC_LIB_PRIV]) +AC_SUBST([GLESv2_LIB_DEPS]) +AC_SUBST([GLESv2_PC_LIB_PRIV]) + +GLAPI_LIB_DEPS="-lpthread" +AC_SUBST([GLAPI_LIB_DEPS]) + +AC_SUBST([HAVE_XF86VIDMODE]) + +PKG_CHECK_MODULES([LIBDRM_RADEON], + [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED], + HAVE_LIBDRM_RADEON=yes, + HAVE_LIBDRM_RADEON=no) + +dnl +dnl More X11 setup +dnl +if test "$mesa_driver" = xlib; then + DEFINES="$DEFINES -DUSE_XSHM" +fi + +dnl +dnl TLS detection +dnl + +AC_ARG_ENABLE([glx-tls], + [AS_HELP_STRING([--enable-glx-tls], + [enable TLS support in GLX @<:@default=disabled@:>@])], + [GLX_USE_TLS="$enableval"], + [GLX_USE_TLS=no]) +AC_SUBST(GLX_TLS, ${GLX_USE_TLS}) + +dnl +dnl More DRI setup +dnl +dnl Directory for DRI drivers +AC_ARG_WITH([dri-driverdir], + [AS_HELP_STRING([--with-dri-driverdir=DIR], + [directory for the DRI drivers @<:@${libdir}/dri@:>@])], + [DRI_DRIVER_INSTALL_DIR="$withval"], + [DRI_DRIVER_INSTALL_DIR='${libdir}/dri']) +AC_SUBST([DRI_DRIVER_INSTALL_DIR]) +dnl Extra search path for DRI drivers +AC_ARG_WITH([dri-searchpath], + [AS_HELP_STRING([--with-dri-searchpath=DIRS...], + [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])], + [DRI_DRIVER_SEARCH_DIR="$withval"], + [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}']) +AC_SUBST([DRI_DRIVER_SEARCH_DIR]) +dnl Direct rendering or just indirect rendering +AC_ARG_ENABLE([driglx-direct], + [AS_HELP_STRING([--disable-driglx-direct], + [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])], + [driglx_direct="$enableval"], + [driglx_direct="yes"]) +dnl Which drivers to build - default is chosen by platform +AC_ARG_WITH([dri-drivers], + [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@], + [comma delimited DRI drivers list, e.g. + "swrast,i965,radeon" @<:@default=auto@:>@])], + [with_dri_drivers="$withval"], + [with_dri_drivers=yes]) +if test "x$with_dri_drivers" = x; then + with_dri_drivers=no +fi + +dnl If $with_dri_drivers is yes, directories will be added through +dnl platform checks +DRI_DIRS="" +case "$with_dri_drivers" in +no) ;; +yes) + DRI_DIRS="yes" + ;; +*) + # verify the requested driver directories exist + dri_drivers=`IFS=', '; echo $with_dri_drivers` + for driver in $dri_drivers; do + test -d "$srcdir/src/mesa/drivers/dri/$driver" || \ + AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist]) + done + DRI_DIRS="$dri_drivers" + ;; +esac + +dnl Set DRI_DIRS, DEFINES and LIB_DEPS +if test "$mesa_driver" = dri -o "$mesa_driver" = no; then + # Use TLS in GLX? + if test "x$GLX_USE_TLS" = xyes; then + DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" + fi + + # Platform specific settings and drivers to build + case "$host_os" in + linux*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" + + case "$host_cpu" in + x86_64) + # sis is missing because they have not be converted to use + # the new interface. i810 are missing because there is no + # x86-64 system where they could *ever* be used. + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \ + savage tdfx unichrome swrast" + fi + ;; + powerpc*) + # Build only the drivers for cards that exist on PowerPC. + # At some point MGA will be added, but not yet. + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast" + fi + ;; + sparc*) + # Build only the drivers for cards that exist on sparc` + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast" + fi + ;; + esac + ;; + freebsd* | dragonfly* | *netbsd*) + DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1" + DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \ + unichrome savage sis swrast" + fi + ;; + gnu*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" + ;; + solaris*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + ;; + esac + + # default drivers + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \ + savage sis tdfx unichrome swrast" + fi + + DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'` + + # Check for expat + if test "$mesa_driver" = dri; then + EXPAT_INCLUDES="" + EXPAT_LIB=-lexpat + AC_ARG_WITH([expat], + [AS_HELP_STRING([--with-expat=DIR], + [expat install directory])],[ + EXPAT_INCLUDES="-I$withval/include" + CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES" + LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR" + EXPAT_LIB="-L$withval/$LIB_DIR -lexpat" + ]) + AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])]) + AC_CHECK_LIB([expat],[XML_ParserCreate],[], + [AC_MSG_ERROR([Expat required for DRI.])]) + fi + + # put all the necessary libs together + DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS" +fi +AC_SUBST([DRI_DIRS]) +AC_SUBST([EXPAT_INCLUDES]) +AC_SUBST([DRI_LIB_DEPS]) + +case $DRI_DIRS in +*i915*|*i965*) + PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.23]) + ;; +esac + +case $DRI_DIRS in +*radeon*|*r200*|*r300*|*r600*) + if test "x$HAVE_LIBDRM_RADEON" = xyes; then + RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS" + RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS + fi + ;; +esac +AC_SUBST([RADEON_CFLAGS]) +AC_SUBST([RADEON_LDFLAGS]) + + +dnl +dnl OSMesa configuration +dnl +if test "$mesa_driver" = xlib; then + default_gl_osmesa=yes +else + default_gl_osmesa=no +fi +AC_ARG_ENABLE([gl-osmesa], + [AS_HELP_STRING([--enable-gl-osmesa], + [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])], + [gl_osmesa="$enableval"], + [gl_osmesa="$default_gl_osmesa"]) +if test "x$gl_osmesa" = xyes; then + if test "x$enable_opengl" = xno; then + AC_MSG_ERROR([OpenGL is not available for OSMesa driver]) + fi + if test "$mesa_driver" = osmesa; then + AC_MSG_ERROR([libGL is not available for OSMesa driver]) + else + DRIVER_DIRS="$DRIVER_DIRS osmesa" + fi +fi + +dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...) +AC_ARG_WITH([osmesa-bits], + [AS_HELP_STRING([--with-osmesa-bits=BITS], + [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])], + [osmesa_bits="$withval"], + [osmesa_bits=8]) +if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then + AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver]) + osmesa_bits=8 +fi +case "x$osmesa_bits" in +x8) + OSMESA_LIB=OSMesa + ;; +x16|x32) + OSMESA_LIB="OSMesa$osmesa_bits" + DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31" + ;; +*) + AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option]) + ;; +esac +AC_SUBST([OSMESA_LIB]) + +case "$DRIVER_DIRS" in +*osmesa*) + # only link libraries with osmesa if shared + if test "$enable_static" = no; then + OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS" + else + OSMESA_LIB_DEPS="" + fi + OSMESA_MESA_DEPS="" + OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS" + ;; +esac +AC_SUBST([OSMESA_LIB_DEPS]) +AC_SUBST([OSMESA_MESA_DEPS]) +AC_SUBST([OSMESA_PC_REQ]) +AC_SUBST([OSMESA_PC_LIB_PRIV]) + +dnl +dnl EGL configuration +dnl +AC_ARG_ENABLE([egl], + [AS_HELP_STRING([--disable-egl], + [disable EGL library @<:@default=enabled@:>@])], + [enable_egl="$enableval"], + [enable_egl=yes]) +if test "x$enable_egl" = xno; then + if test "x$mesa_driver" = xno; then + AC_MSG_ERROR([cannot disable EGL when there is no mesa driver]) + fi + if test "x$enable_openvg" = xyes; then + AC_MSG_ERROR([cannot enable OpenVG without EGL]) + fi +fi +if test "x$enable_egl" = xyes; then + SRC_DIRS="$SRC_DIRS egl" + EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread" + EGL_DRIVERS_DIRS="" + if test "$enable_static" != yes; then + # build egl_glx when libGL is built + if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then + EGL_DRIVERS_DIRS="glx" + fi + + if test "$mesa_driver" = dri; then + # build egl_dri2 when xcb-dri2 is available + PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes], + [have_xcb_dri2=yes],[have_xcb_dri2=no]) + PKG_CHECK_MODULES([LIBUDEV], [libudev > 150], + [have_libudev=yes],[have_libudev=no]) + + if test "$have_xcb_dri2" = yes; then + EGL_DRIVER_DRI2=dri2 + DEFINES="$DEFINES -DHAVE_XCB_DRI2" + if test "$have_libudev" = yes; then + DEFINES="$DEFINES -DHAVE_LIBUDEV" + fi + fi + fi + + EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2" + fi +fi +AC_SUBST([EGL_LIB_DEPS]) +AC_SUBST([EGL_DRIVERS_DIRS]) + +dnl +dnl GLU configuration +dnl +AC_ARG_ENABLE([glu], + [AS_HELP_STRING([--disable-glu], + [enable OpenGL Utility library @<:@default=enabled@:>@])], + [enable_glu="$enableval"], + [enable_glu=yes]) + +if test "x$enable_glu" = xyes -a "x$mesa_driver" = xno; then + AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver]) + enable_glu=no +fi + +if test "x$enable_glu" = xyes; then + SRC_DIRS="$SRC_DIRS glu" + + case "$mesa_driver" in + osmesa) + # Link libGLU to libOSMesa instead of libGL + GLU_LIB_DEPS="" + GLU_PC_REQ="osmesa" + if test "$enable_static" = no; then + GLU_MESA_DEPS='-l$(OSMESA_LIB)' + else + GLU_MESA_DEPS="" + fi + ;; + *) + # If static, empty GLU_LIB_DEPS and add libs for programs to link + GLU_PC_REQ="gl" + GLU_PC_LIB_PRIV="-lm" + if test "$enable_static" = no; then + GLU_LIB_DEPS="-lm" + GLU_MESA_DEPS='-l$(GL_LIB)' + else + GLU_LIB_DEPS="" + GLU_MESA_DEPS="" + APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++" + fi + ;; + esac +fi +if test "$enable_static" = no; then + GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS" +fi +GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS" +AC_SUBST([GLU_LIB_DEPS]) +AC_SUBST([GLU_MESA_DEPS]) +AC_SUBST([GLU_PC_REQ]) +AC_SUBST([GLU_PC_REQ_PRIV]) +AC_SUBST([GLU_PC_LIB_PRIV]) +AC_SUBST([GLU_PC_CFLAGS]) + +dnl +dnl GLw configuration +dnl +AC_ARG_ENABLE([glw], + [AS_HELP_STRING([--disable-glw], + [enable Xt/Motif widget library @<:@default=enabled@:>@])], + [enable_glw="$enableval"], + [enable_glw=yes]) +dnl Don't build GLw on osmesa +if test "x$enable_glw" = xyes; then + case "$mesa_driver" in + osmesa|no) + AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver]) + enable_glw=no + ;; + esac +fi +AC_ARG_ENABLE([motif], + [AS_HELP_STRING([--enable-motif], + [use Motif widgets in GLw @<:@default=disabled@:>@])], + [enable_motif="$enableval"], + [enable_motif=no]) + +if test "x$enable_glw" = xyes; then + SRC_DIRS="$SRC_DIRS glw" + if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([GLW],[x11 xt]) + GLW_PC_REQ_PRIV="x11 xt" + GLW_LIB_DEPS="$GLW_LIBS" + else + # should check these... + GLW_LIB_DEPS="$X_LIBS -lXt -lX11" + GLW_PC_LIB_PRIV="$GLW_LIB_DEPS" + GLW_PC_CFLAGS="$X11_INCLUDES" + fi + + GLW_SOURCES="GLwDrawA.c" + MOTIF_CFLAGS= + if test "x$enable_motif" = xyes; then + GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c" + AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no]) + if test "x$MOTIF_CONFIG" != xno; then + MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags` + MOTIF_LIBS=`$MOTIF_CONFIG --libs` + else + AC_CHECK_HEADER([Xm/PrimitiveP.h], [], + [AC_MSG_ERROR([Can't locate Motif headers])]) + AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"], + [AC_MSG_ERROR([Can't locate Motif Xm library])]) + fi + # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11 + GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS" + GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV" + GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS" + fi + + # If static, empty GLW_LIB_DEPS and add libs for programs to link + GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV" + if test "$enable_static" = no; then + GLW_MESA_DEPS='-l$(GL_LIB)' + GLW_LIB_DEPS="$GLW_LIB_DEPS" + else + APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS" + GLW_LIB_DEPS="" + GLW_MESA_DEPS="" + fi +fi +AC_SUBST([GLW_LIB_DEPS]) +AC_SUBST([GLW_MESA_DEPS]) +AC_SUBST([GLW_SOURCES]) +AC_SUBST([MOTIF_CFLAGS]) +AC_SUBST([GLW_PC_REQ_PRIV]) +AC_SUBST([GLW_PC_LIB_PRIV]) +AC_SUBST([GLW_PC_CFLAGS]) + +dnl +dnl GLUT configuration +dnl +if test -f "$srcdir/include/GL/glut.h"; then + default_glut=yes +else + default_glut=no +fi +AC_ARG_ENABLE([glut], + [AS_HELP_STRING([--disable-glut], + [enable GLUT library @<:@default=enabled if source available@:>@])], + [enable_glut="$enableval"], + [enable_glut="$default_glut"]) + +dnl Don't build glut on osmesa +if test "x$enable_glut" = xyes; then + case "$mesa_driver" in + osmesa|no) + AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver]) + enable_glut=no + ;; + esac +fi +dnl Can't build glut if GLU not available +if test "x$enable_glu$enable_glut" = xnoyes; then + AC_MSG_WARN([Disabling glut since GLU is disabled]) + enable_glut=no +fi + +if test "x$enable_glut" = xyes; then + SRC_DIRS="$SRC_DIRS glut/glx" + if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([GLUT],[x11 xmu xi]) + GLUT_PC_REQ_PRIV="x11 xmu xi" + GLUT_LIB_DEPS="$GLUT_LIBS" + else + # should check these... + GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi" + GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS" + GLUT_PC_CFLAGS="$X11_INCLUDES" + fi + if test "x$GCC" = xyes; then + GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions" + fi + GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm" + GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm" + + # If static, empty GLUT_LIB_DEPS and add libs for programs to link + if test "$enable_static" = no; then + GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)' + else + APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS" + GLUT_LIB_DEPS="" + GLUT_MESA_DEPS="" + fi +fi +AC_SUBST([GLUT_LIB_DEPS]) +AC_SUBST([GLUT_MESA_DEPS]) +AC_SUBST([GLUT_CFLAGS]) +AC_SUBST([GLUT_PC_REQ_PRIV]) +AC_SUBST([GLUT_PC_LIB_PRIV]) +AC_SUBST([GLUT_PC_CFLAGS]) + +dnl +dnl Program library dependencies +dnl Only libm is added here if necessary as the libraries should +dnl be pulled in by the linker +dnl +if test "x$APP_LIB_DEPS" = x; then + case "$host_os" in + solaris*) + APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm" + ;; + cygwin*) + APP_LIB_DEPS="-lX11" + ;; + *) + APP_LIB_DEPS="-lm" + ;; + esac +fi +AC_SUBST([APP_LIB_DEPS]) +AC_SUBST([PROGRAM_DIRS]) + +dnl +dnl Gallium configuration +dnl +AC_ARG_ENABLE([gallium], + [AS_HELP_STRING([--disable-gallium], + [build gallium @<:@default=enabled@:>@])], + [enable_gallium="$enableval"], + [enable_gallium=yes]) +if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then + AC_MSG_ERROR([cannot enable OpenVG without Gallium]) +fi +if test "x$enable_gallium" = xyes; then + SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets" + AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"], + [HAS_UDIS86="no"]) + AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no]) +fi + +AC_SUBST([LLVM_CFLAGS]) +AC_SUBST([LLVM_LIBS]) +AC_SUBST([LLVM_LDFLAGS]) +AC_SUBST([LLVM_VERSION]) + +dnl +dnl Gallium state trackers configuration +dnl + +AC_ARG_ENABLE([gallium-egl], + [AS_HELP_STRING([--enable-gallium-egl], + [enable gallium EGL state tracker @<:@default=auto@:>@])], + [enable_gallium_egl="$enableval"], + [enable_gallium_egl=auto]) +if test "x$enable_gallium_egl" = xauto; then + case "$mesa_driver" in + dri|no) + enable_gallium_egl=$enable_egl + ;; + *) + enable_gallium_egl=$enable_openvg + ;; + esac +fi +case "x$enable_egl$enable_gallium_egl" in +xnoyes) + AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL]) +esac + +AC_ARG_WITH([state-trackers], + [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@], + [comma delimited state_trackers list, e.g. + "egl,glx" @<:@default=auto@:>@])], + [with_state_trackers="$withval"], + [with_state_trackers=yes]) + +case "$with_state_trackers" in +no) + GALLIUM_STATE_TRACKERS_DIRS="" + ;; +yes) + # look at what else is built + case "$mesa_driver" in + xlib) + GALLIUM_STATE_TRACKERS_DIRS=glx + ;; + dri) + GALLIUM_STATE_TRACKERS_DIRS="dri" + HAVE_ST_DRI="yes" + # Have only tested st/xorg on 1.6.0 servers + PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED], + HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg", + HAVE_ST_XORG="no") + ;; + esac + + if test "x$enable_egl" = xyes; then + if test "$enable_openvg" = yes; then + GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega" + st_egl="yes" + fi + + if test "$enable_gallium_egl" = yes; then + GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl" + HAVE_ST_EGL="yes" + fi + fi + ;; +*) + # verify the requested state tracker exist + state_trackers="" + _state_trackers=`IFS=', '; echo $with_state_trackers` + for tracker in $_state_trackers; do + case "$tracker" in + dri) + if test "x$mesa_driver" != xdri; then + AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri]) + fi + HAVE_ST_DRI="yes" + ;; + egl) + if test "x$enable_egl" != xyes; then + AC_MSG_ERROR([cannot build egl state tracker without EGL library]) + fi + HAVE_ST_EGL="yes" + ;; + xorg) + PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0]) + PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED]) + PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED]) + HAVE_ST_XORG="yes" + ;; + vega) + if test "x$enable_openvg" != xyes; then + AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg]) + fi + have_st_vega="yes" + ;; + esac + + if test -n "$tracker"; then + test -d "$srcdir/src/gallium/state_trackers/$tracker" || \ + AC_MSG_ERROR([state tracker '$tracker' doesn't exist]) + if test -n "$state_trackers"; then + state_trackers="$state_trackers $tracker" + else + state_trackers="$tracker" + fi + fi + done + GALLIUM_STATE_TRACKERS_DIRS="$state_trackers" + + # append --enable-openvg/--enable-gallium-egl to --with-state-trackers + if test "x$have_st_vega" != xyes -a "x$enable_openvg" = xyes; then + AC_MSG_ERROR([--with-state-trackers specified but vega is missing]) + fi + if test "x$HAVE_ST_EGL" != xyes -a "x$enable_gallium_egl" = xyes; then + AC_MSG_ERROR([--with-state-trackers specified but egl is missing]) + fi + ;; +esac + + +EGL_CLIENT_APIS="" +VG_LIB_DEPS="" + +case "x$enable_opengl$enable_gles1$enable_gles2" in +x*yes*) + EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)' + ;; +esac +if test "x$enable_openvg" = xyes; then + EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)' + VG_LIB_DEPS="$VG_LIB_DEPS -lpthread" +fi + +AC_SUBST([VG_LIB_DEPS]) +AC_SUBST([EGL_CLIENT_APIS]) + +if test "x$HAVE_ST_EGL" = xyes; then + GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl" +fi + +if test "x$HAVE_ST_XORG" = xyes; then + PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], + HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71", + HAVE_XEXTPROTO_71="no") +fi + +AC_ARG_WITH([egl-platforms], + [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@], + [comma delimited native platforms libEGL supports, e.g. + "x11,drm" @<:@default=auto@:>@])], + [with_egl_platforms="$withval"], + [with_egl_platforms=yes]) +AC_ARG_WITH([egl-displays], + [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@], + [DEPRECATED. Use --with-egl-platforms instead])], + [with_egl_platforms="$withval"]) + +EGL_PLATFORMS="" +case "$with_egl_platforms" in +yes) + if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then + EGL_PLATFORMS="x11" + if test "$mesa_driver" = dri; then + EGL_PLATFORMS="$EGL_PLATFORMS drm" + fi + fi + ;; +*) + if test "x$enable_egl" != xyes; then + AC_MSG_ERROR([cannot build egl state tracker without EGL library]) + fi + # verify the requested driver directories exist + egl_platforms=`IFS=', '; echo $with_egl_platforms` + for plat in $egl_platforms; do + test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \ + AC_MSG_ERROR([EGL platform '$plat' does't exist]) + if test "$plat" = "fbdev"; then + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev" + fi + done + EGL_PLATFORMS="$egl_platforms" + ;; +esac +AC_SUBST([EGL_PLATFORMS]) + +AC_ARG_WITH([egl-driver-dir], + [AS_HELP_STRING([--with-egl-driver-dir=DIR], + [directory for EGL drivers [[default=${libdir}/egl]]])], + [EGL_DRIVER_INSTALL_DIR="$withval"], + [EGL_DRIVER_INSTALL_DIR='${libdir}/egl']) +AC_SUBST([EGL_DRIVER_INSTALL_DIR]) + +AC_ARG_WITH([xorg-driver-dir], + [AS_HELP_STRING([--with-xorg-driver-dir=DIR], + [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])], + [XORG_DRIVER_INSTALL_DIR="$withval"], + [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"]) +AC_SUBST([XORG_DRIVER_INSTALL_DIR]) + +AC_ARG_WITH([max-width], + [AS_HELP_STRING([--with-max-width=N], + [Maximum framebuffer width (4096)])], + [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}"; + AS_IF([test "${withval}" -gt "4096"], + [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])] +) +AC_ARG_WITH([max-height], + [AS_HELP_STRING([--with-max-height=N], + [Maximum framebuffer height (4096)])], + [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}"; + AS_IF([test "${withval}" -gt "4096"], + [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])] +) + +dnl +dnl Gallium LLVM +dnl +AC_ARG_ENABLE([gallium-llvm], + [AS_HELP_STRING([--enable-gallium-llvm], + [build gallium LLVM support @<:@default=disabled@:>@])], + [enable_gallium_llvm="$enableval"], + [enable_gallium_llvm=auto]) +if test "x$enable_gallium_llvm" = xyes; then + if test "x$LLVM_CONFIG" != xno; then + LLVM_VERSION=`$LLVM_CONFIG --version` + LLVM_CFLAGS=`$LLVM_CONFIG --cppflags` + LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++" + + if test "x$HAS_UDIS86" != xno; then + LLVM_LIBS="$LLVM_LIBS -ludis86" + DEFINES="$DEFINES -DHAVE_UDIS86" + fi + LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags` + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe" + DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS" + MESA_LLVM=1 + else + MESA_LLVM=0 + fi +else + MESA_LLVM=0 +fi + +dnl +dnl Gallium helper functions +dnl +gallium_check_st() { + if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1" + fi + if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then + GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2" + fi + if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then + GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3" + fi +} + + +dnl +dnl Gallium SVGA configuration +dnl +AC_ARG_ENABLE([gallium-svga], + [AS_HELP_STRING([--enable-gallium-svga], + [build gallium SVGA @<:@default=disabled@:>@])], + [enable_gallium_svga="$enableval"], + [enable_gallium_svga=auto]) +if test "x$enable_gallium_svga" = xyes; then + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga" + gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx" +elif test "x$enable_gallium_svga" = xauto; then + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga" +fi + +dnl +dnl Gallium i915 configuration +dnl +AC_ARG_ENABLE([gallium-i915], + [AS_HELP_STRING([--enable-gallium-i915], + [build gallium i915 @<:@default=disabled@:>@])], + [enable_gallium_i915="$enableval"], + [enable_gallium_i915=auto]) +if test "x$enable_gallium_i915" = xyes; then + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915" + gallium_check_st "i915/drm" "dri-i915" "xorg-i915" +elif test "x$enable_gallium_i915" = xauto; then + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915" +fi + +dnl +dnl Gallium i965 configuration +dnl +AC_ARG_ENABLE([gallium-i965], + [AS_HELP_STRING([--enable-gallium-i965], + [build gallium i965 @<:@default=disabled@:>@])], + [enable_gallium_i965="$enableval"], + [enable_gallium_i965=auto]) +if test "x$enable_gallium_i965" = xyes; then + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965" + gallium_check_st "i965/drm" "dri-i965" "xorg-i965" +elif test "x$enable_gallium_i965" = xauto; then + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965" +fi + +dnl +dnl Gallium Radeon r300g configuration +dnl +AC_ARG_ENABLE([gallium-radeon], + [AS_HELP_STRING([--enable-gallium-radeon], + [build gallium radeon @<:@default=disabled@:>@])], + [enable_gallium_radeon="$enableval"], + [enable_gallium_radeon=auto]) +if test "x$enable_gallium_radeon" = xauto; then + if test "x$HAVE_LIBDRM_RADEON" = xyes; then + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300" + gallium_check_st "radeon/drm" "dri-r300" + else + AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)]) + fi +fi +if test "x$enable_gallium_radeon" = xyes; then + if test "x$HAVE_LIBDRM_RADEON" = xyes; then + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300" + gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon" + else + AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)]) + fi +fi + +dnl +dnl Gallium Radeon r600g configuration +dnl +AC_ARG_ENABLE([gallium-r600], + [AS_HELP_STRING([--enable-gallium-r600], + [build gallium radeon @<:@default=disabled@:>@])], + [enable_gallium_r600="$enableval"], + [enable_gallium_r600=auto]) +if test "x$enable_gallium_r600" = xyes; then + if test "x$HAVE_LIBDRM_RADEON" = xyes; then + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600" + gallium_check_st "r600/drm" "dri-r600" + else + AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600]) + fi +fi + +dnl +dnl Gallium Nouveau configuration +dnl +AC_ARG_ENABLE([gallium-nouveau], + [AS_HELP_STRING([--enable-gallium-nouveau], + [build gallium nouveau @<:@default=disabled@:>@])], + [enable_gallium_nouveau="$enableval"], + [enable_gallium_nouveau=no]) +if test "x$enable_gallium_nouveau" = xyes; then + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0" + gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" +fi + +dnl +dnl Gallium swrast configuration +dnl +AC_ARG_ENABLE([gallium-swrast], + [AS_HELP_STRING([--enable-gallium-swrast], + [build gallium swrast @<:@default=auto@:>@])], + [enable_gallium_swrast="$enableval"], + [enable_gallium_swrast=auto]) +if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then + if test "x$HAVE_ST_DRI" = xyes; then + GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast" + fi +fi + +dnl prepend CORE_DIRS to SRC_DIRS +SRC_DIRS="$CORE_DIRS $SRC_DIRS" + +dnl Restore LDFLAGS and CPPFLAGS +LDFLAGS="$_SAVE_LDFLAGS" +CPPFLAGS="$_SAVE_CPPFLAGS" + +dnl Substitute the config +AC_CONFIG_FILES([configs/autoconf]) + +dnl Replace the configs/current symlink +AC_CONFIG_COMMANDS([configs],[ +if test -f configs/current || test -L configs/current; then + rm -f configs/current +fi +ln -s autoconf configs/current +]) + +AC_OUTPUT + +dnl +dnl Output some configuration info for the user +dnl +echo "" +echo " prefix: $prefix" +echo " exec_prefix: $exec_prefix" +echo " libdir: $libdir" +echo " includedir: $includedir" + +dnl API info +echo "" +echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)" +echo " OpenVG: $enable_openvg" + +dnl Driver info +echo "" +echo " Driver: $mesa_driver" +if test "$mesa_driver" != no; then + if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then + echo " OSMesa: lib$OSMESA_LIB" + else + echo " OSMesa: no" + fi + if test "$mesa_driver" = dri; then + # cleanup the drivers var + dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` + if test "x$DRI_DIRS" = x; then + echo " DRI drivers: no" + else + echo " DRI drivers: $dri_dirs" + fi + echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" + echo " Use XCB: $enable_xcb" + fi +fi +echo "" +echo " GLU: $enable_glu" +echo " GLw: $enable_glw (Motif: $enable_motif)" +echo " glut: $enable_glut" + +dnl EGL +echo "" +echo " EGL: $enable_egl" +if test "$enable_egl" = yes; then + echo " EGL platforms: $EGL_PLATFORMS" + + egl_drivers="" + for d in $EGL_DRIVERS_DIRS; do + egl_drivers="$egl_drivers builtin:egl_$d" + done + + if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then + echo " EGL drivers: ${egl_drivers} egl_gallium" + echo " EGL Gallium STs:$EGL_CLIENT_APIS" + else + echo " EGL drivers: $egl_drivers" + fi +fi + +echo "" +if test "x$MESA_LLVM" = x1; then + echo " llvm: yes" + echo " llvm-config: $LLVM_CONFIG" + echo " llvm-version: $LLVM_VERSION" +else + echo " llvm: no" +fi + +echo "" +if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then + echo " Gallium: yes" + echo " Gallium dirs: $GALLIUM_DIRS" + echo " Target dirs: $GALLIUM_TARGET_DIRS" + echo " Winsys dirs: $GALLIUM_WINSYS_DIRS" + echo " Driver dirs: $GALLIUM_DRIVERS_DIRS" + echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS" +else + echo " Gallium: no" +fi + +dnl Libraries +echo "" +echo " Shared libs: $enable_shared" +echo " Static libs: $enable_static" + +dnl Compiler options +# cleanup the CFLAGS/CXXFLAGS/DEFINES vars +cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ + $SED 's/^ *//;s/ */ /;s/ *$//'` +cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ + $SED 's/^ *//;s/ */ /;s/ *$//'` +defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'` +echo "" +echo " CFLAGS: $cflags" +echo " CXXFLAGS: $cxxflags" +echo " Macros: $defines" +echo "" +echo " PYTHON2: $PYTHON2" + +echo "" +echo " Run '${MAKE-make}' to build Mesa" +echo "" diff --git a/mesalib/docs/README.WIN32 b/mesalib/docs/README.WIN32 index 204b8e660..986b5994f 100644 --- a/mesalib/docs/README.WIN32 +++ b/mesalib/docs/README.WIN32 @@ -1,6 +1,10 @@ File: docs/README.WIN32 -Last updated: Apr 25, 2007 - Karl Schultz - kschultz@users.sourceforge.net +Last updated: Apr 25, 2007 + +NOTE: This information only applies to Mesa 7.8 and older. Nowadays +it's probably better to use Scons to build for Windows. + Quick Start ----- ----- @@ -130,11 +134,5 @@ change all the gl* symbols to mgl*. Because this is easy to do with a global replace operation in a text editor, no additional mangled version of mesa.def is maintained or shipped. -If you have a Windows-related build problem or question, it is -probably better to direct it to me (kschultz@users.sourceforge.net), -rather than directly to the other Mesa developers. I will help you as -much as I can. I also monitor the Mesa mailing lists and will answer -questions in this area there as well. - - -Karl Schultz +If you have a Windows-related build problem or question, please post +to the mesa-dev or mesa-users list. diff --git a/mesalib/src/glsl/glsl_symbol_table.cpp b/mesalib/src/glsl/glsl_symbol_table.cpp index 0bb4b2b92..6fcfe07b9 100644 --- a/mesalib/src/glsl/glsl_symbol_table.cpp +++ b/mesalib/src/glsl/glsl_symbol_table.cpp @@ -1,167 +1,164 @@ -/* -*- c++ -*- */ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "glsl_symbol_table.h" - -class symbol_table_entry { -public: - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *entry = talloc_size(ctx, size); - assert(entry != NULL); - return entry; - } - - /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. Here, C++ will have already called the - * destructor so tell talloc not to do that again. */ - static void operator delete(void *table) - { - talloc_set_destructor(table, NULL); - talloc_free(table); - } - - symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} - symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {} - symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {} - - ir_variable *v; - ir_function *f; - const glsl_type *t; -}; - -glsl_symbol_table::glsl_symbol_table() -{ - this->language_version = 120; - this->table = _mesa_symbol_table_ctor(); - this->mem_ctx = talloc_init("symbol table entries"); -} - -glsl_symbol_table::~glsl_symbol_table() -{ - _mesa_symbol_table_dtor(table); - talloc_free(mem_ctx); -} - -void glsl_symbol_table::push_scope() -{ - _mesa_symbol_table_push_scope(table); -} - -void glsl_symbol_table::pop_scope() -{ - _mesa_symbol_table_pop_scope(table); -} - -bool glsl_symbol_table::name_declared_this_scope(const char *name) -{ - return _mesa_symbol_table_symbol_scope(table, -1, name) == 0; -} - -bool glsl_symbol_table::add_variable(ir_variable *v) -{ - if (this->language_version == 110) { - /* In 1.10, functions and variables have separate namespaces. */ - symbol_table_entry *existing = get_entry(v->name); - if (name_declared_this_scope(v->name)) { - /* If there's already an existing function (not a constructor!) in - * the current scope, just update the existing entry to include 'v'. - */ - if (existing->v == NULL && existing->t == NULL) { - existing->v = v; - return true; - } - } else { - /* If not declared at this scope, add a new entry. But if an existing - * entry includes a function, propagate that to this block - otherwise - * the new variable declaration would shadow the function. - */ - symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); - if (existing != NULL) - entry->f = existing->f; - int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry); - assert(added == 0); - (void)added; - return true; - } - return false; - } - - /* 1.20+ rules: */ - symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); - return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0; -} - -bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) -{ - symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t); - return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; -} - -bool glsl_symbol_table::add_function(ir_function *f) -{ - if (this->language_version == 110 && name_declared_this_scope(f->name)) { - /* In 1.10, functions and variables have separate namespaces. */ - symbol_table_entry *existing = get_entry(f->name); - if ((existing->f == NULL) && (existing->t == NULL)) { - existing->f = f; - return true; - } - } - symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f); - return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0; -} - -void glsl_symbol_table::add_global_function(ir_function *f) -{ - symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f); - int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry); - assert(added == 0); -} - -ir_variable *glsl_symbol_table::get_variable(const char *name) -{ - symbol_table_entry *entry = get_entry(name); - return entry != NULL ? entry->v : NULL; -} - -const glsl_type *glsl_symbol_table::get_type(const char *name) -{ - symbol_table_entry *entry = get_entry(name); - return entry != NULL ? entry->t : NULL; -} - -ir_function *glsl_symbol_table::get_function(const char *name) -{ - symbol_table_entry *entry = get_entry(name); - return entry != NULL ? entry->f : NULL; -} - -symbol_table_entry *glsl_symbol_table::get_entry(const char *name) -{ - return (symbol_table_entry *) - _mesa_symbol_table_find_symbol(table, -1, name); -} +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glsl_symbol_table.h" + +class symbol_table_entry { +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *entry = talloc_size(ctx, size); + assert(entry != NULL); + return entry; + } + + /* If the user *does* call delete, that's OK, we will just talloc_free. */ + static void operator delete(void *entry) + { + talloc_free(entry); + } + + symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} + symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {} + symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {} + + ir_variable *v; + ir_function *f; + const glsl_type *t; +}; + +glsl_symbol_table::glsl_symbol_table() +{ + this->language_version = 120; + this->table = _mesa_symbol_table_ctor(); + this->mem_ctx = talloc_init("symbol table entries"); +} + +glsl_symbol_table::~glsl_symbol_table() +{ + _mesa_symbol_table_dtor(table); + talloc_free(mem_ctx); +} + +void glsl_symbol_table::push_scope() +{ + _mesa_symbol_table_push_scope(table); +} + +void glsl_symbol_table::pop_scope() +{ + _mesa_symbol_table_pop_scope(table); +} + +bool glsl_symbol_table::name_declared_this_scope(const char *name) +{ + return _mesa_symbol_table_symbol_scope(table, -1, name) == 0; +} + +bool glsl_symbol_table::add_variable(ir_variable *v) +{ + if (this->language_version == 110) { + /* In 1.10, functions and variables have separate namespaces. */ + symbol_table_entry *existing = get_entry(v->name); + if (name_declared_this_scope(v->name)) { + /* If there's already an existing function (not a constructor!) in + * the current scope, just update the existing entry to include 'v'. + */ + if (existing->v == NULL && existing->t == NULL) { + existing->v = v; + return true; + } + } else { + /* If not declared at this scope, add a new entry. But if an existing + * entry includes a function, propagate that to this block - otherwise + * the new variable declaration would shadow the function. + */ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); + if (existing != NULL) + entry->f = existing->f; + int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry); + assert(added == 0); + (void)added; + return true; + } + return false; + } + + /* 1.20+ rules: */ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); + return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0; +} + +bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) +{ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t); + return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; +} + +bool glsl_symbol_table::add_function(ir_function *f) +{ + if (this->language_version == 110 && name_declared_this_scope(f->name)) { + /* In 1.10, functions and variables have separate namespaces. */ + symbol_table_entry *existing = get_entry(f->name); + if ((existing->f == NULL) && (existing->t == NULL)) { + existing->f = f; + return true; + } + } + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f); + return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0; +} + +void glsl_symbol_table::add_global_function(ir_function *f) +{ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f); + int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry); + assert(added == 0); +} + +ir_variable *glsl_symbol_table::get_variable(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->v : NULL; +} + +const glsl_type *glsl_symbol_table::get_type(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->t : NULL; +} + +ir_function *glsl_symbol_table::get_function(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->f : NULL; +} + +symbol_table_entry *glsl_symbol_table::get_entry(const char *name) +{ + return (symbol_table_entry *) + _mesa_symbol_table_find_symbol(table, -1, name); +} diff --git a/mesalib/src/mapi/glapi/Makefile b/mesalib/src/mapi/glapi/Makefile index 803926147..203a8abd0 100644 --- a/mesalib/src/mapi/glapi/Makefile +++ b/mesalib/src/mapi/glapi/Makefile @@ -1,53 +1,67 @@ -# src/mapi/glapi/Makefile - -TOP = ../../.. -include $(TOP)/configs/current - -TARGET = glapi - -MAPI = $(TOP)/src/mapi/mapi - -include sources.mak -GLAPI_OBJECTS = $(GLAPI_SOURCES:.c=.o) -GLAPI_ASM_OBJECTS = $(GLAPI_ASM_SOURCES:.S=.o) - -include $(MAPI)/sources.mak -MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o) -MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES)) - -TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS) - -INCLUDE_DIRS = \ - -I$(TOP)/include \ - -I$(TOP)/src/mapi \ - -I$(TOP)/src/mesa - -default: depend lib$(TARGET).a - -lib$(TARGET).a: $(TARGET_OBJECTS) - @$(MKLIB) -o $(TARGET) -static $(TARGET_OBJECTS) - -$(GLAPI_OBJECTS): %.o: %.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ - -$(GLAPI_ASM_OBJECTS): %.o: %.S - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ - -$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ - -install: - -clean: - -rm -f $(TARGET_OBJECTS) - -rm -f lib$(TARGET).a - -rm -f depend depend.bak - -depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) - @ echo "running $(MKDEP)" - @ touch depend - @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \ - -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \ - 2>/dev/null | sed -e 's,^$(MAPI)/,,' > depend - --include depend +# src/mapi/glapi/Makefile + +TOP = ../../.. +include $(TOP)/configs/current + +TARGET = glapi + +MAPI = $(TOP)/src/mapi/mapi + +include sources.mak +include $(MAPI)/sources.mak + +glapi_CPPFLAGS := \ + -I$(TOP)/include \ + -I$(TOP)/src/mapi \ + -I$(TOP)/src/mesa \ + -DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\" + +ifeq ($(SHARED_GLAPI),1) +glapi_CPPFLAGS += -DMAPI_MODE_BRIDGE +glapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES)) + +glapi_GLAPI_OBJECTS := +glapi_ASM_OBJECTS := +glapi_MAPI_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o) +else +glapi_CPPFLAGS += -DMAPI_MODE_UTIL +glapi_SOURCES := $(GLAPI_SOURCES) $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES)) + +glapi_GLAPI_OBJECTS := $(GLAPI_SOURCES:.c=.o) +glapi_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o) +glapi_MAPI_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o) +endif # SHARED_GLAPI + +glapi_OBJECTS := \ + $(glapi_GLAPI_OBJECTS) \ + $(glapi_ASM_OBJECTS) \ + $(glapi_MAPI_OBJECTS) + +default: depend lib$(TARGET).a + +lib$(TARGET).a: $(glapi_OBJECTS) + @$(MKLIB) -o $(TARGET) -static $(glapi_OBJECTS) + +$(glapi_GLAPI_OBJECTS): %.o: %.c + $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@ + +$(glapi_ASM_OBJECTS): %.o: %.S + $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@ + +$(glapi_MAPI_OBJECTS): %.o: $(MAPI)/%.c + $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@ + +install: + +clean: + -rm -f $(glapi_OBJECTS) + -rm -f lib$(TARGET).a + -rm -f depend depend.bak + +depend: $(glapi_SOURCES) + @ echo "running $(MKDEP)" + @ touch depend + @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(glapi_CPPFLAGS) \ + $(glapi_SOURCES) 2>/dev/null | sed -e 's,^$(MAPI)/,,' > depend + +-include depend diff --git a/mesalib/src/mapi/glapi/gen-es/Makefile b/mesalib/src/mapi/glapi/gen-es/Makefile index 6ca403498..7a5bb35ca 100644 --- a/mesalib/src/mapi/glapi/gen-es/Makefile +++ b/mesalib/src/mapi/glapi/gen-es/Makefile @@ -1,92 +1,91 @@ -TOP = ../../../.. -GLAPI = ../gen -include $(TOP)/configs/current - -OUTPUTS := \ - glapi/glapitable.h \ - glapi/glapitemp.h \ - glapi/glprocs.h \ - glapi/glapi_sparc.S \ - glapi/glapi_x86-64.S \ - glapi/glapi_x86.S \ - main/glapidispatch.h \ - main/remap_helper.h - -COMMON = gl_XML.py glX_XML.py license.py typeexpr.py -COMMON := $(addprefix $(GLAPI)/, $(COMMON)) - -ES1_APIXML := es1_API.xml -ES2_APIXML := es2_API.xml -ES1_OUTPUT_DIR := $(TOP)/src/mapi/es1api -ES2_OUTPUT_DIR := $(TOP)/src/mapi/es2api - -ES1_DEPS = $(ES1_APIXML) base1_API.xml es1_EXT.xml es_EXT.xml \ - es1_COMPAT.xml es_COMPAT.xml -ES2_DEPS = $(ES2_APIXML) base2_API.xml es2_EXT.xml es_EXT.xml \ - es2_COMPAT.xml es_COMPAT.xml - -ES1_OUTPUTS := $(addprefix $(ES1_OUTPUT_DIR)/, $(OUTPUTS)) -ES2_OUTPUTS := $(addprefix $(ES2_OUTPUT_DIR)/, $(OUTPUTS)) - -all: es1 es2 - -es1: $(ES1_OUTPUTS) -es2: $(ES2_OUTPUTS) - -$(ES1_OUTPUTS): APIXML := $(ES1_APIXML) -$(ES2_OUTPUTS): APIXML := $(ES2_APIXML) -$(ES1_OUTPUTS): $(ES1_DEPS) -$(ES2_OUTPUTS): $(ES2_DEPS) - -define gen-glapi - @mkdir -p $(dir $@) - $(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) $(1) > $@ -endef - -%/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON) - $(call gen-glapi,-c -m remap_table) - -%/glapitable.h: $(GLAPI)/gl_table.py $(COMMON) - $(call gen-glapi,-c) - -%/glapitemp.h: $(GLAPI)/gl_apitemp.py $(COMMON) - $(call gen-glapi,-c) - -%/glprocs.h: $(GLAPI)/gl_procs.py $(COMMON) - $(call gen-glapi,-c) - -%/glapi_sparc.S: $(GLAPI)/gl_SPARC_asm.py $(COMMON) - $(call gen-glapi) - -%/glapi_x86-64.S: $(GLAPI)/gl_x86-64_asm.py $(COMMON) - $(call gen-glapi) - -%/glapi_x86.S: $(GLAPI)/gl_x86_asm.py $(COMMON) - $(call gen-glapi) - -%/main/remap_helper.h: $(GLAPI)/remap_helper.py $(COMMON) - $(call gen-glapi) - -verify_xml: - @if [ ! -f gl.h ]; then \ - echo "Please copy gl.h and gl2.h to this directory"; \ - exit 1; \ - fi - @echo "Verifying that es1_API.xml covers OpenGL ES 1.1..." - @$(PYTHON2) $(PYTHON_FLAGS) gl_parse_header.py gl.h > tmp.xml - @$(PYTHON2) $(PYTHON_FLAGS) gl_compare.py difference tmp.xml es1_API.xml - @echo "Verifying that es2_API.xml covers OpenGL ES 2.0..." - @$(PYTHON2) $(PYTHON_FLAGS) gl_parse_header.py gl2.h > tmp.xml - @$(PYTHON2) $(PYTHON_FLAGS) gl_compare.py difference tmp.xml es2_API.xml - @rm -f tmp.xml - -clean-es1: - -rm -rf $(ES1_OUTPUT_DIR)/glapi - -rm -rf $(ES1_OUTPUT_DIR)/main - -clean-es2: - -rm -rf $(ES2_OUTPUT_DIR)/glapi - -rm -rf $(ES2_OUTPUT_DIR)/main - -clean: clean-es1 clean-es2 - -rm -f *~ *.pyc *.pyo +TOP = ../../../.. +MAPI = $(TOP)/src/mapi/mapi +GLAPI = ../gen +include $(TOP)/configs/current + +OUTPUTS := \ + glapi_mapi_tmp.h \ + main/glapidispatch.h \ + main/remap_helper.h + +COMMON = gl_and_es_API.xml gl_XML.py glX_XML.py license.py typeexpr.py +COMMON := $(addprefix $(GLAPI)/, $(COMMON)) + +ES1_APIXML := es1_API.xml +ES2_APIXML := es2_API.xml +ES1_OUTPUT_DIR := $(TOP)/src/mapi/es1api +ES2_OUTPUT_DIR := $(TOP)/src/mapi/es2api + +ES1_DEPS = $(ES1_APIXML) base1_API.xml es1_EXT.xml es_EXT.xml \ + es1_COMPAT.xml es_COMPAT.xml +ES2_DEPS = $(ES2_APIXML) base2_API.xml es2_EXT.xml es_EXT.xml \ + es2_COMPAT.xml es_COMPAT.xml + +ES1_OUTPUTS := $(addprefix $(ES1_OUTPUT_DIR)/, $(OUTPUTS)) +ES2_OUTPUTS := $(addprefix $(ES2_OUTPUT_DIR)/, $(OUTPUTS)) + +SHARED_GLAPI_APIXML := $(GLAPI)/gl_and_es_API.xml +SHARED_GLAPI_OUTPUT_DIR := $(TOP)/src/mapi/shared-glapi +SHARED_GLAPI_DEPS := $(SHARED_GLAPI_APIXML) +SHARED_GLAPI_OUTPUTS = $(SHARED_GLAPI_OUTPUT_DIR)/glapi_mapi_tmp.h + +all: es1 es2 shared-glapi + +es1: $(ES1_OUTPUTS) +es2: $(ES2_OUTPUTS) +shared-glapi: $(SHARED_GLAPI_OUTPUTS) + +$(ES1_OUTPUTS): APIXML := $(ES1_APIXML) +$(ES1_OUTPUTS): PRINTER := es1api +$(ES1_OUTPUTS): $(ES1_DEPS) + +$(ES2_OUTPUTS): APIXML := $(ES2_APIXML) +$(ES2_OUTPUTS): PRINTER := es2api +$(ES2_OUTPUTS): $(ES2_DEPS) + +$(SHARED_GLAPI_OUTPUTS): APIXML := $(SHARED_GLAPI_APIXML) +$(SHARED_GLAPI_OUTPUTS): PRINTER := shared-glapi +$(SHARED_GLAPI_OUTPUTS): $(SHARED_GLAPI_DEPS) + +define gen-glapi + @mkdir -p $(dir $@) + $(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) $(1) > $@ +endef + +%/glapi_mapi_tmp.h: $(MAPI)/mapi_abi.py $(COMMON) + @mkdir -p $(dir $@) + $(PYTHON2) $(PYTHON_FLAGS) $< \ + --printer $(PRINTER) --mode lib $(GLAPI)/gl_and_es_API.xml > $@ + +%/main/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON) + $(call gen-glapi,-c -m remap_table) + +%/main/remap_helper.h: $(GLAPI)/remap_helper.py $(COMMON) + $(call gen-glapi) + +verify_xml: + @if [ ! -f gl.h ]; then \ + echo "Please copy gl.h and gl2.h to this directory"; \ + exit 1; \ + fi + @echo "Verifying that es1_API.xml covers OpenGL ES 1.1..." + @$(PYTHON2) $(PYTHON_FLAGS) gl_parse_header.py gl.h > tmp.xml + @$(PYTHON2) $(PYTHON_FLAGS) gl_compare.py difference tmp.xml es1_API.xml + @echo "Verifying that es2_API.xml covers OpenGL ES 2.0..." + @$(PYTHON2) $(PYTHON_FLAGS) gl_parse_header.py gl2.h > tmp.xml + @$(PYTHON2) $(PYTHON_FLAGS) gl_compare.py difference tmp.xml es2_API.xml + @rm -f tmp.xml + +clean-es1: + -rm -f $(ES1_OUTPUTS) + -rm -rf $(ES1_OUTPUT_DIR)/main + +clean-es2: + -rm -f $(ES2_OUTPUTS) + -rm -rf $(ES2_OUTPUT_DIR)/main + +clean-shared-glapi: + -rm -f $(SHARED_GLAPI_OUTPUTS) + +clean: clean-es1 clean-es2 clean-shared-glapi + -rm -f *~ *.pyc *.pyo diff --git a/mesalib/src/mapi/glapi/gen/ARB_get_program_binary.xml b/mesalib/src/mapi/glapi/gen/ARB_get_program_binary.xml new file mode 100644 index 000000000..a3665e540 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_get_program_binary.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile index 570cc8547..51eaf7e93 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile +++ b/mesalib/src/mapi/glapi/gen/Makefile @@ -1,213 +1,228 @@ -# This file isn't used during a normal compilation since we don't want to -# require Python in order to compile Mesa. -# Instead, when the Mesa developers update/change the API interface it's -# up to him/her to re-run this makefile and check in the newly generated files. - - -TOP = ../../../.. -include $(TOP)/configs/current - -MESA_DIR = $(TOP)/src/mesa -MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi -MESA_GLX_DIR = $(TOP)/src/glx - -MESA_GLAPI_OUTPUTS = \ - $(MESA_GLAPI_DIR)/glprocs.h \ - $(MESA_GLAPI_DIR)/glapitemp.h \ - $(MESA_GLAPI_DIR)/glapitable.h - -MESA_GLAPI_ASM_OUTPUTS = \ - $(MESA_GLAPI_DIR)/glapi_x86.S \ - $(MESA_GLAPI_DIR)/glapi_x86-64.S \ - $(MESA_GLAPI_DIR)/glapi_sparc.S - -MESA_OUTPUTS = \ - $(MESA_GLAPI_OUTPUTS) \ - $(MESA_GLAPI_ASM_OUTPUTS) \ - $(MESA_DIR)/main/enums.c \ - $(MESA_DIR)/main/glapidispatch.h \ - $(MESA_DIR)/main/remap_helper.h \ - $(MESA_GLX_DIR)/indirect.c \ - $(MESA_GLX_DIR)/indirect.h \ - $(MESA_GLX_DIR)/indirect_init.c \ - $(MESA_GLX_DIR)/indirect_size.h \ - $(MESA_GLX_DIR)/indirect_size.c - -###################################################################### - -XORG_GLX_DIR = $(XORG_BASE)/glx -XORG_GLAPI_DIR = $(XORG_BASE)/glx - -XORG_GLAPI_FILES = \ - $(XORG_GLAPI_DIR)/glapi.h \ - $(XORG_GLAPI_DIR)/glapi.c \ - $(XORG_GLAPI_DIR)/glapi_getproc.c \ - $(XORG_GLAPI_DIR)/glapi_nop.c \ - $(XORG_GLAPI_DIR)/glthread.c \ - $(XORG_GLAPI_DIR)/glthread.h - -XORG_GLAPI_OUTPUTS = \ - $(XORG_GLAPI_DIR)/glprocs.h \ - $(XORG_GLAPI_DIR)/glapitemp.h \ - $(XORG_GLAPI_DIR)/glapioffsets.h \ - $(XORG_GLAPI_DIR)/glapitable.h \ - $(XORG_GLAPI_DIR)/glapidispatch.h - -XORG_OUTPUTS = \ - $(XORG_GLAPI_FILES) \ - $(XORG_GLAPI_OUTPUTS) \ - $(XORG_GLX_DIR)/indirect_dispatch.c \ - $(XORG_GLX_DIR)/indirect_dispatch_swap.c \ - $(XORG_GLX_DIR)/indirect_dispatch.h \ - $(XORG_GLX_DIR)/indirect_reqsize.c \ - $(XORG_GLX_DIR)/indirect_reqsize.h \ - $(XORG_GLX_DIR)/indirect_size.h \ - $(XORG_GLX_DIR)/indirect_size_get.c \ - $(XORG_GLX_DIR)/indirect_size_get.h \ - $(XORG_GLX_DIR)/indirect_table.c - -###################################################################### - -API_XML = \ - gl_API.xml \ - ARB_copy_buffer.xml \ - ARB_depth_clamp.xml \ - ARB_draw_buffers_blend.xml \ - ARB_draw_elements_base_vertex.xml \ - ARB_draw_instanced.xml \ - ARB_ES2_compatibility.xml \ - ARB_framebuffer_object.xml \ - ARB_geometry_shader4.xml \ - ARB_instanced_arrays.xml \ - ARB_map_buffer_range.xml \ - ARB_seamless_cube_map.xml \ - ARB_sync.xml \ - ARB_vertex_array_object.xml \ - APPLE_object_purgeable.xml \ - APPLE_vertex_array_object.xml \ - EXT_draw_buffers2.xml \ - EXT_framebuffer_object.xml \ - EXT_gpu_shader4.xml \ - EXT_packed_depth_stencil.xml \ - EXT_provoking_vertex.xml \ - EXT_separate_shader_objects.xml \ - EXT_texture_array.xml \ - EXT_texture_integer.xml \ - EXT_transform_feedback.xml \ - NV_conditional_render.xml \ - NV_primitive_restart.xml \ - OES_EGL_image.xml \ - GL3x.xml - - -COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py - -COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py - -###################################################################### - -all: mesa xorg - -mesa: $(MESA_OUTPUTS) - -xorg: check-xorg-source $(XORG_OUTPUTS) - -check-xorg-source: - @if ! test -d $(XORG_GLX_DIR); then \ - echo "ERROR: Must specify path to xserver/GL/ checkout; set XORG_BASE env var."; \ - exit 1; \ - fi - -clean: - -rm -f *~ *.pyo - -rm -f $(MESA_OUTPUTS) - -###################################################################### - -$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c - cp $< $@ - -$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h - cp $< $@ - -###################################################################### - -$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -###################################################################### - -$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -###################################################################### - -$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(ES_API) - $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_API.xml \ - -f $(MESA_GLAPI_DIR)/gen-es/es1_API.xml \ - -f $(MESA_GLAPI_DIR)/gen-es/es2_API.xml > $@ - -$(MESA_DIR)/main/glapidispatch.h: gl_table.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@ - -$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -###################################################################### - -$(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@ - -$(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m init_h > $@ - -$(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m init_c > $@ - -$(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \ - | $(INDENT) $(INDENT_FLAGS) > $@ - -$(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \ - | $(INDENT) $(INDENT_FLAGS) > $@ - -###################################################################### - -$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c > $@ - -$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c -s > $@ - -$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_h -f gl_and_glX_API.xml -s > $@ - -$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ - | $(INDENT) $(INDENT_FLAGS) > $@ - -$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c | $(INDENT) $(INDENT_FLAGS) > $@ - -$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ - | $(INDENT) $(INDENT_FLAGS) -l200 > $@ - -$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_c | $(INDENT) $(INDENT_FLAGS) > $@ - -$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_glX_API.xml > $@ +# This file isn't used during a normal compilation since we don't want to +# require Python in order to compile Mesa. +# Instead, when the Mesa developers update/change the API interface it's +# up to him/her to re-run this makefile and check in the newly generated files. + + +TOP = ../../../.. +include $(TOP)/configs/current + +MESA_DIR = $(TOP)/src/mesa +MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi +MESA_MAPI_DIR = $(TOP)/src/mapi/mapi +MESA_GLX_DIR = $(TOP)/src/glx + +MESA_GLAPI_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h \ + $(MESA_GLAPI_DIR)/glprocs.h \ + $(MESA_GLAPI_DIR)/glapitemp.h \ + $(MESA_GLAPI_DIR)/glapitable.h + +MESA_GLAPI_ASM_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glapi_x86.S \ + $(MESA_GLAPI_DIR)/glapi_x86-64.S \ + $(MESA_GLAPI_DIR)/glapi_sparc.S + +MESA_OUTPUTS = \ + $(MESA_GLAPI_OUTPUTS) \ + $(MESA_GLAPI_ASM_OUTPUTS) \ + $(MESA_DIR)/main/enums.c \ + $(MESA_DIR)/main/glapidispatch.h \ + $(MESA_DIR)/main/remap_helper.h \ + $(MESA_GLX_DIR)/indirect.c \ + $(MESA_GLX_DIR)/indirect.h \ + $(MESA_GLX_DIR)/indirect_init.c \ + $(MESA_GLX_DIR)/indirect_size.h \ + $(MESA_GLX_DIR)/indirect_size.c + +###################################################################### + +XORG_GLX_DIR = $(XORG_BASE)/glx +XORG_GLAPI_DIR = $(XORG_BASE)/glx + +XORG_GLAPI_FILES = \ + $(XORG_GLAPI_DIR)/glapi.h \ + $(XORG_GLAPI_DIR)/glapi.c \ + $(XORG_GLAPI_DIR)/glapi_getproc.c \ + $(XORG_GLAPI_DIR)/glapi_nop.c \ + $(XORG_GLAPI_DIR)/glthread.c \ + $(XORG_GLAPI_DIR)/glthread.h + +XORG_GLAPI_OUTPUTS = \ + $(XORG_GLAPI_DIR)/glprocs.h \ + $(XORG_GLAPI_DIR)/glapitemp.h \ + $(XORG_GLAPI_DIR)/glapioffsets.h \ + $(XORG_GLAPI_DIR)/glapitable.h \ + $(XORG_GLAPI_DIR)/glapidispatch.h + +XORG_OUTPUTS = \ + $(XORG_GLAPI_FILES) \ + $(XORG_GLAPI_OUTPUTS) \ + $(XORG_GLX_DIR)/indirect_dispatch.c \ + $(XORG_GLX_DIR)/indirect_dispatch_swap.c \ + $(XORG_GLX_DIR)/indirect_dispatch.h \ + $(XORG_GLX_DIR)/indirect_reqsize.c \ + $(XORG_GLX_DIR)/indirect_reqsize.h \ + $(XORG_GLX_DIR)/indirect_size.h \ + $(XORG_GLX_DIR)/indirect_size_get.c \ + $(XORG_GLX_DIR)/indirect_size_get.h \ + $(XORG_GLX_DIR)/indirect_table.c + +###################################################################### + +API_XML = \ + gl_API.xml \ + ARB_copy_buffer.xml \ + ARB_depth_clamp.xml \ + ARB_draw_buffers_blend.xml \ + ARB_draw_elements_base_vertex.xml \ + ARB_draw_instanced.xml \ + ARB_ES2_compatibility.xml \ + ARB_framebuffer_object.xml \ + ARB_geometry_shader4.xml \ + ARB_instanced_arrays.xml \ + ARB_map_buffer_range.xml \ + ARB_seamless_cube_map.xml \ + ARB_sync.xml \ + ARB_vertex_array_object.xml \ + APPLE_object_purgeable.xml \ + APPLE_vertex_array_object.xml \ + EXT_draw_buffers2.xml \ + EXT_framebuffer_object.xml \ + EXT_gpu_shader4.xml \ + EXT_packed_depth_stencil.xml \ + EXT_provoking_vertex.xml \ + EXT_separate_shader_objects.xml \ + EXT_texture_array.xml \ + EXT_texture_integer.xml \ + EXT_transform_feedback.xml \ + NV_conditional_render.xml \ + NV_primitive_restart.xml \ + OES_EGL_image.xml \ + GL3x.xml + + +COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py + +COMMON_ES = \ + $(COMMON) \ + gl_and_es_API.xml \ + es_EXT.xml \ + ARB_ES2_compatibility.xml \ + ARB_get_program_binary.xml \ + OES_fixed_point.xml \ + OES_single_precision.xml + +COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py + +###################################################################### + +all: mesa xorg + +mesa: $(MESA_OUTPUTS) + +xorg: check-xorg-source $(XORG_OUTPUTS) + +check-xorg-source: + @if ! test -d $(XORG_GLX_DIR); then \ + echo "ERROR: Must specify path to xserver/GL/ checkout; set XORG_BASE env var."; \ + exit 1; \ + fi + +clean: + -rm -f *~ *.pyo + -rm -f $(MESA_OUTPUTS) + +###################################################################### + +$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c + cp $< $@ + +$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h + cp $< $@ + +###################################################################### + +$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES) + $(PYTHON2) $(PYTHON_FLAGS) $< \ + --printer glapi --mode lib gl_and_es_API.xml > $@ + +$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +###################################################################### + +$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +###################################################################### + +$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(ES_API) + $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_API.xml \ + -f $(MESA_GLAPI_DIR)/gen-es/es1_API.xml \ + -f $(MESA_GLAPI_DIR)/gen-es/es2_API.xml > $@ + +$(MESA_DIR)/main/glapidispatch.h: gl_table.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@ + +$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +###################################################################### + +$(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@ + +$(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m init_h > $@ + +$(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m init_c > $@ + +$(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +$(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +###################################################################### + +$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c > $@ + +$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c -s > $@ + +$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_h -f gl_and_glX_API.xml -s > $@ + +$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ + | $(INDENT) $(INDENT_FLAGS) -l200 > $@ + +$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_c | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_glX_API.xml > $@ diff --git a/mesalib/src/mapi/glapi/gen/OES_fixed_point.xml b/mesalib/src/mapi/glapi/gen/OES_fixed_point.xml new file mode 100644 index 000000000..ee408f4f1 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/OES_fixed_point.xml @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/OES_single_precision.xml b/mesalib/src/mapi/glapi/gen/OES_single_precision.xml new file mode 100644 index 000000000..df8efc8f8 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/OES_single_precision.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/es_EXT.xml b/mesalib/src/mapi/glapi/gen/es_EXT.xml new file mode 100644 index 000000000..1327bb602 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/es_EXT.xml @@ -0,0 +1,618 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py index 9c4f45481..6330d91f7 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py @@ -1,1044 +1,1097 @@ -#!/usr/bin/env python - -# (C) Copyright IBM Corporation 2004, 2005 -# All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, and/or sell copies of the Software, and to permit persons to whom -# the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# Authors: -# Ian Romanick -# Jeremy Kolb - -import gl_XML, glX_XML, glX_proto_common, license -import sys, getopt, copy, string - -def convertStringForXCB(str): - tmp = "" - special = [ "ARB" ] - i = 0 - while i < len(str): - if str[i:i+3] in special: - tmp = '%s_%s' % (tmp, string.lower(str[i:i+3])) - i = i + 2; - elif str[i].isupper(): - tmp = '%s_%s' % (tmp, string.lower(str[i])) - else: - tmp = '%s%s' % (tmp, str[i]) - i += 1 - return tmp - -def hash_pixel_function(func): - """Generate a 'unique' key for a pixel function. The key is based on - the parameters written in the command packet. This includes any - padding that might be added for the original function and the 'NULL - image' flag.""" - - - h = "" - hash_pre = "" - hash_suf = "" - for param in func.parameterIterateGlxSend(): - if param.is_image(): - [dim, junk, junk, junk, junk] = param.get_dimensions() - - d = (dim + 1) & ~1 - hash_pre = "%uD%uD_" % (d - 1, d) - - if param.img_null_flag: - hash_suf = "_NF" - - h += "%u" % (param.size()) - - if func.pad_after(param): - h += "4" - - - n = func.name.replace("%uD" % (dim), "") - n = "__glx_%s_%uD%uD" % (n, d - 1, d) - - h = hash_pre + h + hash_suf - return [h, n] - - -class glx_pixel_function_stub(glX_XML.glx_function): - """Dummy class used to generate pixel "utility" functions that are - shared by multiple dimension image functions. For example, these - objects are used to generate shared functions used to send GLX - protocol for TexImage1D and TexImage2D, TexSubImage1D and - TexSubImage2D, etc.""" - - def __init__(self, func, name): - # The parameters to the utility function are the same as the - # parameters to the real function except for the added "pad" - # parameters. - - self.name = name - self.images = [] - self.parameters = [] - self.parameters_by_name = {} - for _p in func.parameterIterator(): - p = copy.copy(_p) - self.parameters.append(p) - self.parameters_by_name[ p.name ] = p - - - if p.is_image(): - self.images.append(p) - p.height = "height" - - if p.img_yoff == None: - p.img_yoff = "yoffset" - - if p.depth: - if p.extent == None: - p.extent = "extent" - - if p.img_woff == None: - p.img_woff = "woffset" - - - pad_name = func.pad_after(p) - if pad_name: - pad = copy.copy(p) - pad.name = pad_name - self.parameters.append(pad) - self.parameters_by_name[ pad.name ] = pad - - - self.return_type = func.return_type - - self.glx_rop = ~0 - self.glx_sop = 0 - self.glx_vendorpriv = 0 - - self.glx_doubles_in_order = func.glx_doubles_in_order - - self.vectorequiv = None - self.output = None - self.can_be_large = func.can_be_large - self.reply_always_array = func.reply_always_array - self.dimensions_in_reply = func.dimensions_in_reply - self.img_reset = None - - self.server_handcode = 0 - self.client_handcode = 0 - self.ignore = 0 - - self.count_parameter_list = func.count_parameter_list - self.counter_list = func.counter_list - self.offsets_calculated = 0 - return - - -class PrintGlxProtoStubs(glX_proto_common.glx_print_proto): - def __init__(self): - glX_proto_common.glx_print_proto.__init__(self) - self.name = "glX_proto_send.py (from Mesa)" - self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM") - - - self.last_category = "" - self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32] - self.pixel_stubs = {} - self.debug = 0 - return - - def printRealHeader(self): - print '' - print '#include ' - print '#include "indirect.h"' - print '#include "glxclient.h"' - print '#include "indirect_size.h"' - print '#include "glapi.h"' - print '#include "glthread.h"' - print '#include ' - print '#ifdef USE_XCB' - print '#include ' - print '#include ' - print '#include ' - print '#endif /* USE_XCB */' - - print '' - print '#define __GLX_PAD(n) (((n) + 3) & ~3)' - print '' - self.printFastcall() - self.printNoinline() - print '' - print '#ifndef __GNUC__' - print '# define __builtin_expect(x, y) x' - print '#endif' - print '' - print '/* If the size and opcode values are known at compile-time, this will, on' - print ' * x86 at least, emit them with a single instruction.' - print ' */' - print '#define emit_header(dest, op, size) \\' - print ' do { union { short s[2]; int i; } temp; \\' - print ' temp.s[0] = (size); temp.s[1] = (op); \\' - print ' *((int *)(dest)) = temp.i; } while(0)' - print '' - print """NOINLINE CARD32 -__glXReadReply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_array ) -{ - xGLXSingleReply reply; - - (void) _XReply(dpy, (xReply *) & reply, 0, False); - if (size != 0) { - if ((reply.length > 0) || reply_is_always_array) { - const GLint bytes = (reply_is_always_array) - ? (4 * reply.length) : (reply.size * size); - const GLint extra = 4 - (bytes & 3); - - _XRead(dpy, dest, bytes); - if ( extra < 4 ) { - _XEatData(dpy, extra); - } - } - else { - (void) memcpy( dest, &(reply.pad3), size); - } - } - - return reply.retval; -} - -NOINLINE void -__glXReadPixelReply( Display *dpy, struct glx_context * gc, unsigned max_dim, - GLint width, GLint height, GLint depth, GLenum format, GLenum type, - void * dest, GLboolean dimensions_in_reply ) -{ - xGLXSingleReply reply; - GLint size; - - (void) _XReply(dpy, (xReply *) & reply, 0, False); - - if ( dimensions_in_reply ) { - width = reply.pad3; - height = reply.pad4; - depth = reply.pad5; - - if ((height == 0) || (max_dim < 2)) { height = 1; } - if ((depth == 0) || (max_dim < 3)) { depth = 1; } - } - - size = reply.length * 4; - if (size != 0) { - void * buf = Xmalloc( size ); - - if ( buf == NULL ) { - _XEatData(dpy, size); - __glXSetError(gc, GL_OUT_OF_MEMORY); - } - else { - const GLint extra = 4 - (size & 3); - - _XRead(dpy, buf, size); - if ( extra < 4 ) { - _XEatData(dpy, extra); - } - - __glEmptyImage(gc, 3, width, height, depth, format, type, - buf, dest); - Xfree(buf); - } - } -} - -#define X_GLXSingle 0 - -NOINLINE FASTCALL GLubyte * -__glXSetupSingleRequest( struct glx_context * gc, GLint sop, GLint cmdlen ) -{ - xGLXSingleReq * req; - Display * const dpy = gc->currentDpy; - - (void) __glXFlushRenderBuffer(gc, gc->pc); - LockDisplay(dpy); - GetReqExtra(GLXSingle, cmdlen, req); - req->reqType = gc->majorOpcode; - req->contextTag = gc->currentContextTag; - req->glxCode = sop; - return (GLubyte *)(req) + sz_xGLXSingleReq; -} - -NOINLINE FASTCALL GLubyte * -__glXSetupVendorRequest( struct glx_context * gc, GLint code, GLint vop, GLint cmdlen ) -{ - xGLXVendorPrivateReq * req; - Display * const dpy = gc->currentDpy; - - (void) __glXFlushRenderBuffer(gc, gc->pc); - LockDisplay(dpy); - GetReqExtra(GLXVendorPrivate, cmdlen, req); - req->reqType = gc->majorOpcode; - req->glxCode = code; - req->vendorCode = vop; - req->contextTag = gc->currentContextTag; - return (GLubyte *)(req) + sz_xGLXVendorPrivateReq; -} - -const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; - -#define zero (__glXDefaultPixelStore+0) -#define one (__glXDefaultPixelStore+8) -#define default_pixel_store_1D (__glXDefaultPixelStore+4) -#define default_pixel_store_1D_size 20 -#define default_pixel_store_2D (__glXDefaultPixelStore+4) -#define default_pixel_store_2D_size 20 -#define default_pixel_store_3D (__glXDefaultPixelStore+0) -#define default_pixel_store_3D_size 36 -#define default_pixel_store_4D (__glXDefaultPixelStore+0) -#define default_pixel_store_4D_size 36 -""" - - for size in self.generic_sizes: - self.print_generic_function(size) - return - - - def printBody(self, api): - - self.pixel_stubs = {} - generated_stubs = [] - - for func in api.functionIterateGlx(): - if func.client_handcode: continue - - # If the function is a pixel function with a certain - # GLX protocol signature, create a fake stub function - # for it. For example, create a single stub function - # that is used to implement both glTexImage1D and - # glTexImage2D. - - if func.glx_rop != 0: - do_it = 0 - for image in func.get_images(): - if image.img_pad_dimensions: - do_it = 1 - break - - - if do_it: - [h, n] = hash_pixel_function(func) - - - self.pixel_stubs[ func.name ] = n - if h not in generated_stubs: - generated_stubs.append(h) - - fake_func = glx_pixel_function_stub( func, n ) - self.printFunction(fake_func, fake_func.name) - - - self.printFunction(func, func.name) - if func.glx_sop and func.glx_vendorpriv: - self.printFunction(func, func.glx_vendorpriv_names[0]) - - return - - - def printFunction(self, func, name): - footer = '}\n' - if func.glx_rop == ~0: - print 'static %s' % (func.return_type) - print '%s( unsigned opcode, unsigned dim, %s )' % (func.name, func.get_parameter_string()) - print '{' - else: - if func.has_different_protocol(name): - if func.return_type == "void": - ret_string = '' - else: - ret_string = "return " - - func_name = func.static_glx_name(name) - print '#define %s %d' % (func.opcode_vendor_name(name), func.glx_vendorpriv) - print '%s gl%s(%s)' % (func.return_type, func_name, func.get_parameter_string()) - print '{' - print ' struct glx_context * const gc = __glXGetCurrentContext();' - print '' - print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)' - print ' if (gc->isDirect) {' - print ' %sGET_DISPATCH()->%s(%s);' % (ret_string, func.name, func.get_called_parameter_string()) - print ' } else' - print '#endif' - print ' {' - - footer = '}\n}\n' - else: - print '#define %s %d' % (func.opcode_name(), func.opcode_value()) - - print '%s __indirect_gl%s(%s)' % (func.return_type, name, func.get_parameter_string()) - print '{' - - - if func.glx_rop != 0 or func.vectorequiv != None: - if len(func.images): - self.printPixelFunction(func) - else: - self.printRenderFunction(func) - elif func.glx_sop != 0 or func.glx_vendorpriv != 0: - self.printSingleFunction(func, name) - pass - else: - print "/* Missing GLX protocol for %s. */" % (name) - - print footer - return - - - def print_generic_function(self, n): - size = (n + 3) & ~3 - print """static FASTCALL NOINLINE void -generic_%u_byte( GLint rop, const void * ptr ) -{ - struct glx_context * const gc = __glXGetCurrentContext(); - const GLuint cmdlen = %u; - - emit_header(gc->pc, rop, cmdlen); - (void) memcpy((void *)(gc->pc + 4), ptr, %u); - gc->pc += cmdlen; - if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } -} -""" % (n, size + 4, size) - return - - - def common_emit_one_arg(self, p, pc, adjust, extra_offset): - if p.is_array(): - src_ptr = p.name - else: - src_ptr = "&" + p.name - - if p.is_padding: - print '(void) memset((void *)(%s + %u), 0, %s);' \ - % (pc, p.offset + adjust, p.size_string() ) - elif not extra_offset: - print '(void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \ - % (pc, p.offset + adjust, src_ptr, p.size_string() ) - else: - print '(void) memcpy((void *)(%s + %u + %s), (void *)(%s), %s);' \ - % (pc, p.offset + adjust, extra_offset, src_ptr, p.size_string() ) - - def common_emit_args(self, f, pc, adjust, skip_vla): - extra_offset = None - - for p in f.parameterIterateGlxSend( not skip_vla ): - if p.name != f.img_reset: - self.common_emit_one_arg(p, pc, adjust, extra_offset) - - if p.is_variable_length(): - temp = p.size_string() - if extra_offset: - extra_offset += " + %s" % (temp) - else: - extra_offset = temp - - return - - - def pixel_emit_args(self, f, pc, large): - """Emit the arguments for a pixel function. This differs from - common_emit_args in that pixel functions may require padding - be inserted (i.e., for the missing width field for - TexImage1D), and they may also require a 'NULL image' flag - be inserted before the image data.""" - - if large: - adjust = 8 - else: - adjust = 4 - - for param in f.parameterIterateGlxSend(): - if not param.is_image(): - self.common_emit_one_arg(param, pc, adjust, None) - - if f.pad_after(param): - print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset + param.size()) + adjust) - - else: - [dim, width, height, depth, extent] = param.get_dimensions() - if f.glx_rop == ~0: - dim_str = "dim" - else: - dim_str = str(dim) - - if param.is_padding: - print '(void) memset((void *)(%s + %u), 0, %s);' \ - % (pc, (param.offset - 4) + adjust, param.size_string() ) - - if param.img_null_flag: - if large: - print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset - 4) + adjust) - else: - print '(void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (pc, (param.offset - 4) + adjust, param.name) - - - pixHeaderPtr = "%s + %u" % (pc, adjust) - pcPtr = "%s + %u" % (pc, param.offset + adjust) - - if not large: - if param.img_send_null: - condition = '(compsize > 0) && (%s != NULL)' % (param.name) - else: - condition = 'compsize > 0' - - print 'if (%s) {' % (condition) - print ' (*gc->fillImage)(gc, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr) - print '} else {' - print ' (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (pixHeaderPtr, dim, dim) - print '}' - else: - print '__glXSendLargeImage(gc, compsize, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr) - - return - - - def large_emit_begin(self, f, op_name = None): - if not op_name: - op_name = f.opcode_real_name() - - print 'const GLint op = %s;' % (op_name) - print 'const GLuint cmdlenLarge = cmdlen + 4;' - print 'GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);' - print '(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);' - print '(void) memcpy((void *)(pc + 4), (void *)(&op), 4);' - return - - - def common_func_print_just_start(self, f, name): - print ' struct glx_context * const gc = __glXGetCurrentContext();' - - # The only reason that single and vendor private commands need - # a variable called 'dpy' is becuase they use the SyncHandle - # macro. For whatever brain-dead reason, that macro is hard- - # coded to use a variable called 'dpy' instead of taking a - # parameter. - - # FIXME Simplify the logic related to skip_condition and - # FIXME condition_list in this function. Basically, remove - # FIXME skip_condition, and just append the "dpy != NULL" type - # FIXME condition to condition_list from the start. The only - # FIXME reason it's done in this confusing way now is to - # FIXME minimize the diffs in the generated code. - - if not f.glx_rop: - for p in f.parameterIterateOutputs(): - if p.is_image() and (p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP"): - print ' const __GLXattribute * const state = gc->client_state_private;' - break - - print ' Display * const dpy = gc->currentDpy;' - skip_condition = "dpy != NULL" - elif f.can_be_large: - skip_condition = "gc->currentDpy != NULL" - else: - skip_condition = None - - - if f.return_type != 'void': - print ' %s retval = (%s) 0;' % (f.return_type, f.return_type) - - - if name != None and name not in f.glx_vendorpriv_names: - print '#ifndef USE_XCB' - self.emit_packet_size_calculation(f, 0) - if name != None and name not in f.glx_vendorpriv_names: - print '#endif' - - condition_list = [] - for p in f.parameterIterateCounters(): - condition_list.append( "%s >= 0" % (p.name) ) - # 'counter' parameters cannot be negative - print " if (%s < 0) {" % p.name - print " __glXSetError(gc, GL_INVALID_VALUE);" - if f.return_type != 'void': - print " return 0;" - else: - print " return;" - print " }" - - if skip_condition: - condition_list.append( skip_condition ) - - if len( condition_list ) > 0: - if len( condition_list ) > 1: - skip_condition = "(%s)" % (string.join( condition_list, ") && (" )) - else: - skip_condition = "%s" % (condition_list.pop(0)) - - print ' if (__builtin_expect(%s, 1)) {' % (skip_condition) - return 1 - else: - return 0 - - - def printSingleFunction(self, f, name): - self.common_func_print_just_start(f, name) - - if self.debug: - print ' printf( "Enter %%s...\\n", "gl%s" );' % (f.name) - - if name not in f.glx_vendorpriv_names: - - # XCB specific: - print '#ifdef USE_XCB' - if self.debug: - print ' printf("\\tUsing XCB.\\n");' - print ' xcb_connection_t *c = XGetXCBConnection(dpy);' - print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' - xcb_name = 'xcb_glx%s' % convertStringForXCB(name) - - iparams=[] - extra_iparams = [] - output = None - for p in f.parameterIterator(): - if p.is_output: - output = p - - if p.is_image(): - if p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP": - extra_iparams.append("state->storePack.swapEndian") - else: - extra_iparams.append("0") - - # Hardcode this in. lsb_first param (apparently always GL_FALSE) - # also present in GetPolygonStipple, but taken care of above. - if xcb_name == "xcb_glx_read_pixels": - extra_iparams.append("0") - else: - iparams.append(p.name) - - - xcb_request = '%s(%s)' % (xcb_name, ", ".join(["c", "gc->currentContextTag"] + iparams + extra_iparams)) - - if f.needs_reply(): - print ' %s_reply_t *reply = %s_reply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request) - if output and f.reply_always_array: - print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) - - elif output and not f.reply_always_array: - if not output.is_image(): - print ' if (%s_data_length(reply) == 0)' % (xcb_name) - print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name) - print ' else' - print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) - - - if f.return_type != 'void': - print ' retval = reply->ret_val;' - print ' free(reply);' - else: - print ' ' + xcb_request + ';' - print '#else' - # End of XCB specific. - - - if f.parameters != []: - pc_decl = "GLubyte const * pc =" - else: - pc_decl = "(void)" - - if name in f.glx_vendorpriv_names: - print ' %s __glXSetupVendorRequest(gc, %s, %s, cmdlen);' % (pc_decl, f.opcode_real_name(), f.opcode_vendor_name(name)) - else: - print ' %s __glXSetupSingleRequest(gc, %s, cmdlen);' % (pc_decl, f.opcode_name()) - - self.common_emit_args(f, "pc", 0, 0) - - images = f.get_images() - - for img in images: - if img.is_output: - o = f.command_fixed_length() - 4 - print ' *(int32_t *)(pc + %u) = 0;' % (o) - if img.img_format != "GL_COLOR_INDEX" or img.img_type != "GL_BITMAP": - print ' * (int8_t *)(pc + %u) = state->storePack.swapEndian;' % (o) - - if f.img_reset: - print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset) - - - return_name = '' - if f.needs_reply(): - if f.return_type != 'void': - return_name = " retval" - return_str = " retval = (%s)" % (f.return_type) - else: - return_str = " (void)" - - got_reply = 0 - - for p in f.parameterIterateOutputs(): - if p.is_image(): - [dim, w, h, d, junk] = p.get_dimensions() - if f.dimensions_in_reply: - print " __glXReadPixelReply(dpy, gc, %u, 0, 0, 0, %s, %s, %s, GL_TRUE);" % (dim, p.img_format, p.img_type, p.name) - else: - print " __glXReadPixelReply(dpy, gc, %u, %s, %s, %s, %s, %s, %s, GL_FALSE);" % (dim, w, h, d, p.img_format, p.img_type, p.name) - - got_reply = 1 - else: - if f.reply_always_array: - aa = "GL_TRUE" - else: - aa = "GL_FALSE" - - # gl_parameter.size() returns the size - # of the entire data item. If the - # item is a fixed-size array, this is - # the size of the whole array. This - # is not what __glXReadReply wants. It - # wants the size of a single data - # element in the reply packet. - # Dividing by the array size (1 for - # non-arrays) gives us this. - - s = p.size() / p.get_element_count() - print " %s __glXReadReply(dpy, %s, %s, %s);" % (return_str, s, p.name, aa) - got_reply = 1 - - - # If a reply wasn't read to fill an output parameter, - # read a NULL reply to get the return value. - - if not got_reply: - print " %s __glXReadReply(dpy, 0, NULL, GL_FALSE);" % (return_str) - - - elif self.debug: - # Only emit the extra glFinish call for functions - # that don't already require a reply from the server. - print ' __indirect_glFinish();' - - if self.debug: - print ' printf( "Exit %%s.\\n", "gl%s" );' % (name) - - - print ' UnlockDisplay(dpy); SyncHandle();' - - if name not in f.glx_vendorpriv_names: - print '#endif /* USE_XCB */' - - print ' }' - print ' return%s;' % (return_name) - return - - - def printPixelFunction(self, f): - if self.pixel_stubs.has_key( f.name ): - # Normally gl_function::get_parameter_string could be - # used. However, this call needs to have the missing - # dimensions (e.g., a fake height value for - # glTexImage1D) added in. - - p_string = "" - for param in f.parameterIterateGlxSend(): - if param.is_padding: - continue - - p_string += ", " + param.name - - if param.is_image(): - [dim, junk, junk, junk, junk] = param.get_dimensions() - - if f.pad_after(param): - p_string += ", 1" - - print ' %s(%s, %u%s );' % (self.pixel_stubs[f.name] , f.opcode_name(), dim, p_string) - return - - - if self.common_func_print_just_start(f, None): - trailer = " }" - else: - trailer = None - - - if f.can_be_large: - print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {' - print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {' - print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' - print ' }' - - if f.glx_rop == ~0: - opcode = "opcode" - else: - opcode = f.opcode_real_name() - - print 'emit_header(gc->pc, %s, cmdlen);' % (opcode) - - self.pixel_emit_args( f, "gc->pc", 0 ) - print 'gc->pc += cmdlen;' - print 'if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' - - if f.can_be_large: - print '}' - print 'else {' - - self.large_emit_begin(f, opcode) - self.pixel_emit_args(f, "pc", 1) - - print '}' - - if trailer: print trailer - return - - - def printRenderFunction(self, f): - # There is a class of GL functions that take a single pointer - # as a parameter. This pointer points to a fixed-size chunk - # of data, and the protocol for this functions is very - # regular. Since they are so regular and there are so many - # of them, special case them with generic functions. On - # x86, this saves about 26KB in the libGL.so binary. - - if f.variable_length_parameter() == None and len(f.parameters) == 1: - p = f.parameters[0] - if p.is_pointer(): - cmdlen = f.command_fixed_length() - if cmdlen in self.generic_sizes: - print ' generic_%u_byte( %s, %s );' % (cmdlen, f.opcode_real_name(), p.name) - return - - if self.common_func_print_just_start(f, None): - trailer = " }" - else: - trailer = None - - if self.debug: - print 'printf( "Enter %%s...\\n", "gl%s" );' % (f.name) - - if f.can_be_large: - print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {' - print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {' - print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' - print ' }' - - print 'emit_header(gc->pc, %s, cmdlen);' % (f.opcode_real_name()) - - self.common_emit_args(f, "gc->pc", 4, 0) - print 'gc->pc += cmdlen;' - print 'if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' - - if f.can_be_large: - print '}' - print 'else {' - - self.large_emit_begin(f) - self.common_emit_args(f, "pc", 8, 1) - - p = f.variable_length_parameter() - print ' __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (p.offset + 8, p.name, p.size_string()) - print '}' - - if self.debug: - print '__indirect_glFinish();' - print 'printf( "Exit %%s.\\n", "gl%s" );' % (f.name) - - if trailer: print trailer - return - - -class PrintGlxProtoInit_c(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - - self.name = "glX_proto_send.py (from Mesa)" - self.license = license.bsd_license_template % ( \ -"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM") - return - - - def printRealHeader(self): - print """/** - * \\file indirect_init.c - * Initialize indirect rendering dispatch table. - * - * \\author Kevin E. Martin - * \\author Brian Paul - * \\author Ian Romanick - */ - -#include "indirect_init.h" -#include "indirect.h" -#include "glapi.h" - - -/** - * No-op function used to initialize functions that have no GLX protocol - * support. - */ -static int NoOp(void) -{ - return 0; -} - -/** - * Create and initialize a new GL dispatch table. The table is initialized - * with GLX indirect rendering protocol functions. - */ -struct _glapi_table * __glXNewIndirectAPI( void ) -{ - struct _glapi_table *glAPI; - GLuint entries; - - entries = _glapi_get_dispatch_table_size(); - glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *)); - - /* first, set all entries to point to no-op functions */ - { - int i; - void **dispatch = (void **) glAPI; - for (i = 0; i < entries; i++) { - dispatch[i] = (void *) NoOp; - } - } - - /* now, initialize the entries we understand */""" - - def printRealFooter(self): - print """ - return glAPI; -} -""" - return - - - def printBody(self, api): - for [name, number] in api.categoryIterate(): - if number != None: - preamble = '\n /* %3u. %s */\n\n' % (int(number), name) - else: - preamble = '\n /* %s */\n\n' % (name) - - for func in api.functionIterateByCategory(name): - if func.client_supported_for_indirect(): - print '%s glAPI->%s = __indirect_gl%s;' % (preamble, func.name, func.name) - preamble = '' - - return - - -class PrintGlxProtoInit_h(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - - self.name = "glX_proto_send.py (from Mesa)" - self.license = license.bsd_license_template % ( \ -"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM") - self.header_tag = "_INDIRECT_H_" - - self.last_category = "" - return - - - def printRealHeader(self): - print """/** - * \\file - * Prototypes for indirect rendering functions. - * - * \\author Kevin E. Martin - * \\author Ian Romanick - */ -""" - self.printVisibility( "HIDDEN", "hidden" ) - self.printFastcall() - self.printNoinline() - - print """ -#include "glxclient.h" - -extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size, - void * dest, GLboolean reply_is_always_array ); - -extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy, - struct glx_context * gc, unsigned max_dim, GLint width, GLint height, - GLint depth, GLenum format, GLenum type, void * dest, - GLboolean dimensions_in_reply ); - -extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest( - struct glx_context * gc, GLint sop, GLint cmdlen ); - -extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest( - struct glx_context * gc, GLint code, GLint vop, GLint cmdlen ); -""" - - - def printBody(self, api): - for func in api.functionIterateGlx(): - params = func.get_parameter_string() - - print 'extern HIDDEN %s __indirect_gl%s(%s);' % (func.return_type, func.name, params) - - for n in func.entry_points: - if func.has_different_protocol(n): - asdf = func.static_glx_name(n) - if asdf not in func.static_entry_points: - print 'extern HIDDEN %s gl%s(%s);' % (func.return_type, asdf, params) - # give it a easy-to-remember name - if func.client_handcode: - print '#define gl_dispatch_stub_%s gl%s' % (n, asdf) - else: - print 'GLAPI %s GLAPIENTRY gl%s(%s);' % (func.return_type, asdf, params) - - break - - - -def show_usage(): - print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0] - print " -m output_mode Output mode can be one of 'proto', 'init_c' or 'init_h'." - print " -d Enable extra debug information in the generated code." - sys.exit(1) - - -if __name__ == '__main__': - file_name = "gl_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:m:d") - except Exception,e: - show_usage() - - debug = 0 - mode = "proto" - for (arg,val) in args: - if arg == "-f": - file_name = val - elif arg == "-m": - mode = val - elif arg == "-d": - debug = 1 - - if mode == "proto": - printer = PrintGlxProtoStubs() - elif mode == "init_c": - printer = PrintGlxProtoInit_c() - elif mode == "init_h": - printer = PrintGlxProtoInit_h() - else: - show_usage() - - - printer.debug = debug - api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() ) - - printer.Print( api ) +#!/usr/bin/env python + +# (C) Copyright IBM Corporation 2004, 2005 +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# Authors: +# Ian Romanick +# Jeremy Kolb + +import gl_XML, glX_XML, glX_proto_common, license +import sys, getopt, copy, string + +def convertStringForXCB(str): + tmp = "" + special = [ "ARB" ] + i = 0 + while i < len(str): + if str[i:i+3] in special: + tmp = '%s_%s' % (tmp, string.lower(str[i:i+3])) + i = i + 2; + elif str[i].isupper(): + tmp = '%s_%s' % (tmp, string.lower(str[i])) + else: + tmp = '%s%s' % (tmp, str[i]) + i += 1 + return tmp + +def hash_pixel_function(func): + """Generate a 'unique' key for a pixel function. The key is based on + the parameters written in the command packet. This includes any + padding that might be added for the original function and the 'NULL + image' flag.""" + + + h = "" + hash_pre = "" + hash_suf = "" + for param in func.parameterIterateGlxSend(): + if param.is_image(): + [dim, junk, junk, junk, junk] = param.get_dimensions() + + d = (dim + 1) & ~1 + hash_pre = "%uD%uD_" % (d - 1, d) + + if param.img_null_flag: + hash_suf = "_NF" + + h += "%u" % (param.size()) + + if func.pad_after(param): + h += "4" + + + n = func.name.replace("%uD" % (dim), "") + n = "__glx_%s_%uD%uD" % (n, d - 1, d) + + h = hash_pre + h + hash_suf + return [h, n] + + +class glx_pixel_function_stub(glX_XML.glx_function): + """Dummy class used to generate pixel "utility" functions that are + shared by multiple dimension image functions. For example, these + objects are used to generate shared functions used to send GLX + protocol for TexImage1D and TexImage2D, TexSubImage1D and + TexSubImage2D, etc.""" + + def __init__(self, func, name): + # The parameters to the utility function are the same as the + # parameters to the real function except for the added "pad" + # parameters. + + self.name = name + self.images = [] + self.parameters = [] + self.parameters_by_name = {} + for _p in func.parameterIterator(): + p = copy.copy(_p) + self.parameters.append(p) + self.parameters_by_name[ p.name ] = p + + + if p.is_image(): + self.images.append(p) + p.height = "height" + + if p.img_yoff == None: + p.img_yoff = "yoffset" + + if p.depth: + if p.extent == None: + p.extent = "extent" + + if p.img_woff == None: + p.img_woff = "woffset" + + + pad_name = func.pad_after(p) + if pad_name: + pad = copy.copy(p) + pad.name = pad_name + self.parameters.append(pad) + self.parameters_by_name[ pad.name ] = pad + + + self.return_type = func.return_type + + self.glx_rop = ~0 + self.glx_sop = 0 + self.glx_vendorpriv = 0 + + self.glx_doubles_in_order = func.glx_doubles_in_order + + self.vectorequiv = None + self.output = None + self.can_be_large = func.can_be_large + self.reply_always_array = func.reply_always_array + self.dimensions_in_reply = func.dimensions_in_reply + self.img_reset = None + + self.server_handcode = 0 + self.client_handcode = 0 + self.ignore = 0 + + self.count_parameter_list = func.count_parameter_list + self.counter_list = func.counter_list + self.offsets_calculated = 0 + return + + +class PrintGlxProtoStubs(glX_proto_common.glx_print_proto): + def __init__(self): + glX_proto_common.glx_print_proto.__init__(self) + self.name = "glX_proto_send.py (from Mesa)" + self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM") + + + self.last_category = "" + self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32] + self.pixel_stubs = {} + self.debug = 0 + return + + def printRealHeader(self): + print '' + print '#include ' + print '#include "indirect.h"' + print '#include "glxclient.h"' + print '#include "indirect_size.h"' + print '#include "glapi.h"' + print '#include "glthread.h"' + print '#include ' + print '#ifdef USE_XCB' + print '#include ' + print '#include ' + print '#include ' + print '#endif /* USE_XCB */' + + print '' + print '#define __GLX_PAD(n) (((n) + 3) & ~3)' + print '' + self.printFastcall() + self.printNoinline() + print '' + print '#ifndef __GNUC__' + print '# define __builtin_expect(x, y) x' + print '#endif' + print '' + print '/* If the size and opcode values are known at compile-time, this will, on' + print ' * x86 at least, emit them with a single instruction.' + print ' */' + print '#define emit_header(dest, op, size) \\' + print ' do { union { short s[2]; int i; } temp; \\' + print ' temp.s[0] = (size); temp.s[1] = (op); \\' + print ' *((int *)(dest)) = temp.i; } while(0)' + print '' + print """NOINLINE CARD32 +__glXReadReply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_array ) +{ + xGLXSingleReply reply; + + (void) _XReply(dpy, (xReply *) & reply, 0, False); + if (size != 0) { + if ((reply.length > 0) || reply_is_always_array) { + const GLint bytes = (reply_is_always_array) + ? (4 * reply.length) : (reply.size * size); + const GLint extra = 4 - (bytes & 3); + + _XRead(dpy, dest, bytes); + if ( extra < 4 ) { + _XEatData(dpy, extra); + } + } + else { + (void) memcpy( dest, &(reply.pad3), size); + } + } + + return reply.retval; +} + +NOINLINE void +__glXReadPixelReply( Display *dpy, struct glx_context * gc, unsigned max_dim, + GLint width, GLint height, GLint depth, GLenum format, GLenum type, + void * dest, GLboolean dimensions_in_reply ) +{ + xGLXSingleReply reply; + GLint size; + + (void) _XReply(dpy, (xReply *) & reply, 0, False); + + if ( dimensions_in_reply ) { + width = reply.pad3; + height = reply.pad4; + depth = reply.pad5; + + if ((height == 0) || (max_dim < 2)) { height = 1; } + if ((depth == 0) || (max_dim < 3)) { depth = 1; } + } + + size = reply.length * 4; + if (size != 0) { + void * buf = Xmalloc( size ); + + if ( buf == NULL ) { + _XEatData(dpy, size); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } + else { + const GLint extra = 4 - (size & 3); + + _XRead(dpy, buf, size); + if ( extra < 4 ) { + _XEatData(dpy, extra); + } + + __glEmptyImage(gc, 3, width, height, depth, format, type, + buf, dest); + Xfree(buf); + } + } +} + +#define X_GLXSingle 0 + +NOINLINE FASTCALL GLubyte * +__glXSetupSingleRequest( struct glx_context * gc, GLint sop, GLint cmdlen ) +{ + xGLXSingleReq * req; + Display * const dpy = gc->currentDpy; + + (void) __glXFlushRenderBuffer(gc, gc->pc); + LockDisplay(dpy); + GetReqExtra(GLXSingle, cmdlen, req); + req->reqType = gc->majorOpcode; + req->contextTag = gc->currentContextTag; + req->glxCode = sop; + return (GLubyte *)(req) + sz_xGLXSingleReq; +} + +NOINLINE FASTCALL GLubyte * +__glXSetupVendorRequest( struct glx_context * gc, GLint code, GLint vop, GLint cmdlen ) +{ + xGLXVendorPrivateReq * req; + Display * const dpy = gc->currentDpy; + + (void) __glXFlushRenderBuffer(gc, gc->pc); + LockDisplay(dpy); + GetReqExtra(GLXVendorPrivate, cmdlen, req); + req->reqType = gc->majorOpcode; + req->glxCode = code; + req->vendorCode = vop; + req->contextTag = gc->currentContextTag; + return (GLubyte *)(req) + sz_xGLXVendorPrivateReq; +} + +const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + +#define zero (__glXDefaultPixelStore+0) +#define one (__glXDefaultPixelStore+8) +#define default_pixel_store_1D (__glXDefaultPixelStore+4) +#define default_pixel_store_1D_size 20 +#define default_pixel_store_2D (__glXDefaultPixelStore+4) +#define default_pixel_store_2D_size 20 +#define default_pixel_store_3D (__glXDefaultPixelStore+0) +#define default_pixel_store_3D_size 36 +#define default_pixel_store_4D (__glXDefaultPixelStore+0) +#define default_pixel_store_4D_size 36 +""" + + for size in self.generic_sizes: + self.print_generic_function(size) + return + + + def printBody(self, api): + + self.pixel_stubs = {} + generated_stubs = [] + + for func in api.functionIterateGlx(): + if func.client_handcode: continue + + # If the function is a pixel function with a certain + # GLX protocol signature, create a fake stub function + # for it. For example, create a single stub function + # that is used to implement both glTexImage1D and + # glTexImage2D. + + if func.glx_rop != 0: + do_it = 0 + for image in func.get_images(): + if image.img_pad_dimensions: + do_it = 1 + break + + + if do_it: + [h, n] = hash_pixel_function(func) + + + self.pixel_stubs[ func.name ] = n + if h not in generated_stubs: + generated_stubs.append(h) + + fake_func = glx_pixel_function_stub( func, n ) + self.printFunction(fake_func, fake_func.name) + + + self.printFunction(func, func.name) + if func.glx_sop and func.glx_vendorpriv: + self.printFunction(func, func.glx_vendorpriv_names[0]) + + self.printGetProcAddress(api) + return + + def printGetProcAddress(self, api): + procs = {} + for func in api.functionIterateGlx(): + for n in func.entry_points: + if func.has_different_protocol(n): + procs[n] = func.static_glx_name(n) + + print """ +#ifdef GLX_SHARED_GLAPI + +static const struct proc_pair +{ + const char *name; + _glapi_proc proc; +} proc_pairs[%d] = {""" % len(procs) + names = procs.keys() + names.sort() + for i in xrange(len(names)): + comma = ',' if i < len(names) - 1 else '' + print ' { "%s", (_glapi_proc) gl%s }%s' % (names[i], procs[names[i]], comma) + print """}; + +static int +__indirect_get_proc_compare(const void *key, const void *memb) +{ + const struct proc_pair *pair = (const struct proc_pair *) memb; + return strcmp((const char *) key, pair->name); +} + +_glapi_proc +__indirect_get_proc_address(const char *name) +{ + const struct proc_pair *pair; + + /* skip "gl" */ + name += 2; + + pair = (const struct proc_pair *) bsearch((const void *) name, + (const void *) proc_pairs, ARRAY_SIZE(proc_pairs), sizeof(proc_pairs[0]), + __indirect_get_proc_compare); + + return (pair) ? pair->proc : NULL; +} + +#endif /* GLX_SHARED_GLAPI */ +""" + return + + + def printFunction(self, func, name): + footer = '}\n' + if func.glx_rop == ~0: + print 'static %s' % (func.return_type) + print '%s( unsigned opcode, unsigned dim, %s )' % (func.name, func.get_parameter_string()) + print '{' + else: + if func.has_different_protocol(name): + if func.return_type == "void": + ret_string = '' + else: + ret_string = "return " + + func_name = func.static_glx_name(name) + print '#define %s %d' % (func.opcode_vendor_name(name), func.glx_vendorpriv) + print '%s gl%s(%s)' % (func.return_type, func_name, func.get_parameter_string()) + print '{' + print ' struct glx_context * const gc = __glXGetCurrentContext();' + print '' + print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)' + print ' if (gc->isDirect) {' + print ' %sGET_DISPATCH()->%s(%s);' % (ret_string, func.name, func.get_called_parameter_string()) + print ' } else' + print '#endif' + print ' {' + + footer = '}\n}\n' + else: + print '#define %s %d' % (func.opcode_name(), func.opcode_value()) + + print '%s __indirect_gl%s(%s)' % (func.return_type, name, func.get_parameter_string()) + print '{' + + + if func.glx_rop != 0 or func.vectorequiv != None: + if len(func.images): + self.printPixelFunction(func) + else: + self.printRenderFunction(func) + elif func.glx_sop != 0 or func.glx_vendorpriv != 0: + self.printSingleFunction(func, name) + pass + else: + print "/* Missing GLX protocol for %s. */" % (name) + + print footer + return + + + def print_generic_function(self, n): + size = (n + 3) & ~3 + print """static FASTCALL NOINLINE void +generic_%u_byte( GLint rop, const void * ptr ) +{ + struct glx_context * const gc = __glXGetCurrentContext(); + const GLuint cmdlen = %u; + + emit_header(gc->pc, rop, cmdlen); + (void) memcpy((void *)(gc->pc + 4), ptr, %u); + gc->pc += cmdlen; + if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } +} +""" % (n, size + 4, size) + return + + + def common_emit_one_arg(self, p, pc, adjust, extra_offset): + if p.is_array(): + src_ptr = p.name + else: + src_ptr = "&" + p.name + + if p.is_padding: + print '(void) memset((void *)(%s + %u), 0, %s);' \ + % (pc, p.offset + adjust, p.size_string() ) + elif not extra_offset: + print '(void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \ + % (pc, p.offset + adjust, src_ptr, p.size_string() ) + else: + print '(void) memcpy((void *)(%s + %u + %s), (void *)(%s), %s);' \ + % (pc, p.offset + adjust, extra_offset, src_ptr, p.size_string() ) + + def common_emit_args(self, f, pc, adjust, skip_vla): + extra_offset = None + + for p in f.parameterIterateGlxSend( not skip_vla ): + if p.name != f.img_reset: + self.common_emit_one_arg(p, pc, adjust, extra_offset) + + if p.is_variable_length(): + temp = p.size_string() + if extra_offset: + extra_offset += " + %s" % (temp) + else: + extra_offset = temp + + return + + + def pixel_emit_args(self, f, pc, large): + """Emit the arguments for a pixel function. This differs from + common_emit_args in that pixel functions may require padding + be inserted (i.e., for the missing width field for + TexImage1D), and they may also require a 'NULL image' flag + be inserted before the image data.""" + + if large: + adjust = 8 + else: + adjust = 4 + + for param in f.parameterIterateGlxSend(): + if not param.is_image(): + self.common_emit_one_arg(param, pc, adjust, None) + + if f.pad_after(param): + print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset + param.size()) + adjust) + + else: + [dim, width, height, depth, extent] = param.get_dimensions() + if f.glx_rop == ~0: + dim_str = "dim" + else: + dim_str = str(dim) + + if param.is_padding: + print '(void) memset((void *)(%s + %u), 0, %s);' \ + % (pc, (param.offset - 4) + adjust, param.size_string() ) + + if param.img_null_flag: + if large: + print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset - 4) + adjust) + else: + print '(void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (pc, (param.offset - 4) + adjust, param.name) + + + pixHeaderPtr = "%s + %u" % (pc, adjust) + pcPtr = "%s + %u" % (pc, param.offset + adjust) + + if not large: + if param.img_send_null: + condition = '(compsize > 0) && (%s != NULL)' % (param.name) + else: + condition = 'compsize > 0' + + print 'if (%s) {' % (condition) + print ' (*gc->fillImage)(gc, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr) + print '} else {' + print ' (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (pixHeaderPtr, dim, dim) + print '}' + else: + print '__glXSendLargeImage(gc, compsize, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr) + + return + + + def large_emit_begin(self, f, op_name = None): + if not op_name: + op_name = f.opcode_real_name() + + print 'const GLint op = %s;' % (op_name) + print 'const GLuint cmdlenLarge = cmdlen + 4;' + print 'GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);' + print '(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);' + print '(void) memcpy((void *)(pc + 4), (void *)(&op), 4);' + return + + + def common_func_print_just_start(self, f, name): + print ' struct glx_context * const gc = __glXGetCurrentContext();' + + # The only reason that single and vendor private commands need + # a variable called 'dpy' is becuase they use the SyncHandle + # macro. For whatever brain-dead reason, that macro is hard- + # coded to use a variable called 'dpy' instead of taking a + # parameter. + + # FIXME Simplify the logic related to skip_condition and + # FIXME condition_list in this function. Basically, remove + # FIXME skip_condition, and just append the "dpy != NULL" type + # FIXME condition to condition_list from the start. The only + # FIXME reason it's done in this confusing way now is to + # FIXME minimize the diffs in the generated code. + + if not f.glx_rop: + for p in f.parameterIterateOutputs(): + if p.is_image() and (p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP"): + print ' const __GLXattribute * const state = gc->client_state_private;' + break + + print ' Display * const dpy = gc->currentDpy;' + skip_condition = "dpy != NULL" + elif f.can_be_large: + skip_condition = "gc->currentDpy != NULL" + else: + skip_condition = None + + + if f.return_type != 'void': + print ' %s retval = (%s) 0;' % (f.return_type, f.return_type) + + + if name != None and name not in f.glx_vendorpriv_names: + print '#ifndef USE_XCB' + self.emit_packet_size_calculation(f, 0) + if name != None and name not in f.glx_vendorpriv_names: + print '#endif' + + condition_list = [] + for p in f.parameterIterateCounters(): + condition_list.append( "%s >= 0" % (p.name) ) + # 'counter' parameters cannot be negative + print " if (%s < 0) {" % p.name + print " __glXSetError(gc, GL_INVALID_VALUE);" + if f.return_type != 'void': + print " return 0;" + else: + print " return;" + print " }" + + if skip_condition: + condition_list.append( skip_condition ) + + if len( condition_list ) > 0: + if len( condition_list ) > 1: + skip_condition = "(%s)" % (string.join( condition_list, ") && (" )) + else: + skip_condition = "%s" % (condition_list.pop(0)) + + print ' if (__builtin_expect(%s, 1)) {' % (skip_condition) + return 1 + else: + return 0 + + + def printSingleFunction(self, f, name): + self.common_func_print_just_start(f, name) + + if self.debug: + print ' printf( "Enter %%s...\\n", "gl%s" );' % (f.name) + + if name not in f.glx_vendorpriv_names: + + # XCB specific: + print '#ifdef USE_XCB' + if self.debug: + print ' printf("\\tUsing XCB.\\n");' + print ' xcb_connection_t *c = XGetXCBConnection(dpy);' + print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' + xcb_name = 'xcb_glx%s' % convertStringForXCB(name) + + iparams=[] + extra_iparams = [] + output = None + for p in f.parameterIterator(): + if p.is_output: + output = p + + if p.is_image(): + if p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP": + extra_iparams.append("state->storePack.swapEndian") + else: + extra_iparams.append("0") + + # Hardcode this in. lsb_first param (apparently always GL_FALSE) + # also present in GetPolygonStipple, but taken care of above. + if xcb_name == "xcb_glx_read_pixels": + extra_iparams.append("0") + else: + iparams.append(p.name) + + + xcb_request = '%s(%s)' % (xcb_name, ", ".join(["c", "gc->currentContextTag"] + iparams + extra_iparams)) + + if f.needs_reply(): + print ' %s_reply_t *reply = %s_reply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request) + if output and f.reply_always_array: + print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) + + elif output and not f.reply_always_array: + if not output.is_image(): + print ' if (%s_data_length(reply) == 0)' % (xcb_name) + print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name) + print ' else' + print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) + + + if f.return_type != 'void': + print ' retval = reply->ret_val;' + print ' free(reply);' + else: + print ' ' + xcb_request + ';' + print '#else' + # End of XCB specific. + + + if f.parameters != []: + pc_decl = "GLubyte const * pc =" + else: + pc_decl = "(void)" + + if name in f.glx_vendorpriv_names: + print ' %s __glXSetupVendorRequest(gc, %s, %s, cmdlen);' % (pc_decl, f.opcode_real_name(), f.opcode_vendor_name(name)) + else: + print ' %s __glXSetupSingleRequest(gc, %s, cmdlen);' % (pc_decl, f.opcode_name()) + + self.common_emit_args(f, "pc", 0, 0) + + images = f.get_images() + + for img in images: + if img.is_output: + o = f.command_fixed_length() - 4 + print ' *(int32_t *)(pc + %u) = 0;' % (o) + if img.img_format != "GL_COLOR_INDEX" or img.img_type != "GL_BITMAP": + print ' * (int8_t *)(pc + %u) = state->storePack.swapEndian;' % (o) + + if f.img_reset: + print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset) + + + return_name = '' + if f.needs_reply(): + if f.return_type != 'void': + return_name = " retval" + return_str = " retval = (%s)" % (f.return_type) + else: + return_str = " (void)" + + got_reply = 0 + + for p in f.parameterIterateOutputs(): + if p.is_image(): + [dim, w, h, d, junk] = p.get_dimensions() + if f.dimensions_in_reply: + print " __glXReadPixelReply(dpy, gc, %u, 0, 0, 0, %s, %s, %s, GL_TRUE);" % (dim, p.img_format, p.img_type, p.name) + else: + print " __glXReadPixelReply(dpy, gc, %u, %s, %s, %s, %s, %s, %s, GL_FALSE);" % (dim, w, h, d, p.img_format, p.img_type, p.name) + + got_reply = 1 + else: + if f.reply_always_array: + aa = "GL_TRUE" + else: + aa = "GL_FALSE" + + # gl_parameter.size() returns the size + # of the entire data item. If the + # item is a fixed-size array, this is + # the size of the whole array. This + # is not what __glXReadReply wants. It + # wants the size of a single data + # element in the reply packet. + # Dividing by the array size (1 for + # non-arrays) gives us this. + + s = p.size() / p.get_element_count() + print " %s __glXReadReply(dpy, %s, %s, %s);" % (return_str, s, p.name, aa) + got_reply = 1 + + + # If a reply wasn't read to fill an output parameter, + # read a NULL reply to get the return value. + + if not got_reply: + print " %s __glXReadReply(dpy, 0, NULL, GL_FALSE);" % (return_str) + + + elif self.debug: + # Only emit the extra glFinish call for functions + # that don't already require a reply from the server. + print ' __indirect_glFinish();' + + if self.debug: + print ' printf( "Exit %%s.\\n", "gl%s" );' % (name) + + + print ' UnlockDisplay(dpy); SyncHandle();' + + if name not in f.glx_vendorpriv_names: + print '#endif /* USE_XCB */' + + print ' }' + print ' return%s;' % (return_name) + return + + + def printPixelFunction(self, f): + if self.pixel_stubs.has_key( f.name ): + # Normally gl_function::get_parameter_string could be + # used. However, this call needs to have the missing + # dimensions (e.g., a fake height value for + # glTexImage1D) added in. + + p_string = "" + for param in f.parameterIterateGlxSend(): + if param.is_padding: + continue + + p_string += ", " + param.name + + if param.is_image(): + [dim, junk, junk, junk, junk] = param.get_dimensions() + + if f.pad_after(param): + p_string += ", 1" + + print ' %s(%s, %u%s );' % (self.pixel_stubs[f.name] , f.opcode_name(), dim, p_string) + return + + + if self.common_func_print_just_start(f, None): + trailer = " }" + else: + trailer = None + + + if f.can_be_large: + print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {' + print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {' + print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' + print ' }' + + if f.glx_rop == ~0: + opcode = "opcode" + else: + opcode = f.opcode_real_name() + + print 'emit_header(gc->pc, %s, cmdlen);' % (opcode) + + self.pixel_emit_args( f, "gc->pc", 0 ) + print 'gc->pc += cmdlen;' + print 'if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' + + if f.can_be_large: + print '}' + print 'else {' + + self.large_emit_begin(f, opcode) + self.pixel_emit_args(f, "pc", 1) + + print '}' + + if trailer: print trailer + return + + + def printRenderFunction(self, f): + # There is a class of GL functions that take a single pointer + # as a parameter. This pointer points to a fixed-size chunk + # of data, and the protocol for this functions is very + # regular. Since they are so regular and there are so many + # of them, special case them with generic functions. On + # x86, this saves about 26KB in the libGL.so binary. + + if f.variable_length_parameter() == None and len(f.parameters) == 1: + p = f.parameters[0] + if p.is_pointer(): + cmdlen = f.command_fixed_length() + if cmdlen in self.generic_sizes: + print ' generic_%u_byte( %s, %s );' % (cmdlen, f.opcode_real_name(), p.name) + return + + if self.common_func_print_just_start(f, None): + trailer = " }" + else: + trailer = None + + if self.debug: + print 'printf( "Enter %%s...\\n", "gl%s" );' % (f.name) + + if f.can_be_large: + print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {' + print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {' + print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' + print ' }' + + print 'emit_header(gc->pc, %s, cmdlen);' % (f.opcode_real_name()) + + self.common_emit_args(f, "gc->pc", 4, 0) + print 'gc->pc += cmdlen;' + print 'if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' + + if f.can_be_large: + print '}' + print 'else {' + + self.large_emit_begin(f) + self.common_emit_args(f, "pc", 8, 1) + + p = f.variable_length_parameter() + print ' __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (p.offset + 8, p.name, p.size_string()) + print '}' + + if self.debug: + print '__indirect_glFinish();' + print 'printf( "Exit %%s.\\n", "gl%s" );' % (f.name) + + if trailer: print trailer + return + + +class PrintGlxProtoInit_c(gl_XML.gl_print_base): + def __init__(self): + gl_XML.gl_print_base.__init__(self) + + self.name = "glX_proto_send.py (from Mesa)" + self.license = license.bsd_license_template % ( \ +"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM") + return + + + def printRealHeader(self): + print """/** + * \\file indirect_init.c + * Initialize indirect rendering dispatch table. + * + * \\author Kevin E. Martin + * \\author Brian Paul + * \\author Ian Romanick + */ + +#include "indirect_init.h" +#include "indirect.h" +#include "glapi.h" + + +/** + * No-op function used to initialize functions that have no GLX protocol + * support. + */ +static int NoOp(void) +{ + return 0; +} + +/** + * Create and initialize a new GL dispatch table. The table is initialized + * with GLX indirect rendering protocol functions. + */ +struct _glapi_table * __glXNewIndirectAPI( void ) +{ + struct _glapi_table *glAPI; + GLuint entries; + + entries = _glapi_get_dispatch_table_size(); + glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *)); + + /* first, set all entries to point to no-op functions */ + { + int i; + void **dispatch = (void **) glAPI; + for (i = 0; i < entries; i++) { + dispatch[i] = (void *) NoOp; + } + } + + /* now, initialize the entries we understand */""" + + def printRealFooter(self): + print """ + return glAPI; +} +""" + return + + + def printBody(self, api): + for [name, number] in api.categoryIterate(): + if number != None: + preamble = '\n /* %3u. %s */\n\n' % (int(number), name) + else: + preamble = '\n /* %s */\n\n' % (name) + + for func in api.functionIterateByCategory(name): + if func.client_supported_for_indirect(): + print '%s glAPI->%s = __indirect_gl%s;' % (preamble, func.name, func.name) + preamble = '' + + return + + +class PrintGlxProtoInit_h(gl_XML.gl_print_base): + def __init__(self): + gl_XML.gl_print_base.__init__(self) + + self.name = "glX_proto_send.py (from Mesa)" + self.license = license.bsd_license_template % ( \ +"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM") + self.header_tag = "_INDIRECT_H_" + + self.last_category = "" + return + + + def printRealHeader(self): + print """/** + * \\file + * Prototypes for indirect rendering functions. + * + * \\author Kevin E. Martin + * \\author Ian Romanick + */ +""" + self.printVisibility( "HIDDEN", "hidden" ) + self.printFastcall() + self.printNoinline() + + print """ +#include "glxclient.h" + +extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size, + void * dest, GLboolean reply_is_always_array ); + +extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy, + struct glx_context * gc, unsigned max_dim, GLint width, GLint height, + GLint depth, GLenum format, GLenum type, void * dest, + GLboolean dimensions_in_reply ); + +extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest( + struct glx_context * gc, GLint sop, GLint cmdlen ); + +extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest( + struct glx_context * gc, GLint code, GLint vop, GLint cmdlen ); +""" + + + def printBody(self, api): + for func in api.functionIterateGlx(): + params = func.get_parameter_string() + + print 'extern HIDDEN %s __indirect_gl%s(%s);' % (func.return_type, func.name, params) + + for n in func.entry_points: + if func.has_different_protocol(n): + asdf = func.static_glx_name(n) + if asdf not in func.static_entry_points: + print 'extern HIDDEN %s gl%s(%s);' % (func.return_type, asdf, params) + # give it a easy-to-remember name + if func.client_handcode: + print '#define gl_dispatch_stub_%s gl%s' % (n, asdf) + else: + print 'GLAPI %s GLAPIENTRY gl%s(%s);' % (func.return_type, asdf, params) + + break + + print '' + print '#ifdef GLX_SHARED_GLAPI' + print 'extern HIDDEN void (*__indirect_get_proc_address(const char *name))(void);' + print '#endif' + + +def show_usage(): + print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0] + print " -m output_mode Output mode can be one of 'proto', 'init_c' or 'init_h'." + print " -d Enable extra debug information in the generated code." + sys.exit(1) + + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:m:d") + except Exception,e: + show_usage() + + debug = 0 + mode = "proto" + for (arg,val) in args: + if arg == "-f": + file_name = val + elif arg == "-m": + mode = val + elif arg == "-d": + debug = 1 + + if mode == "proto": + printer = PrintGlxProtoStubs() + elif mode == "init_c": + printer = PrintGlxProtoInit_c() + elif mode == "init_h": + printer = PrintGlxProtoInit_h() + else: + show_usage() + + + printer.debug = debug + api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() ) + + printer.Print( api ) diff --git a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml new file mode 100644 index 000000000..ac7d43ced --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py index 0caa01030..d51b74a4a 100644 --- a/mesalib/src/mapi/glapi/gen/gl_enums.py +++ b/mesalib/src/mapi/glapi/gen/gl_enums.py @@ -46,6 +46,7 @@ class PrintGlEnums(gl_XML.gl_print_base): print '#include "main/mfeatures.h"' print '#include "main/enums.h"' print '#include "main/imports.h"' + print '#include "main/mtypes.h"' print '' print 'typedef struct {' print ' size_t offset;' @@ -111,29 +112,39 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } } +/** + * Primitive names + */ +static const char *prim_names[PRIM_UNKNOWN + 1] = { + "GL_POINTS", + "GL_LINES", + "GL_LINE_LOOP", + "GL_LINE_STRIP", + "GL_TRIANGLES", + "GL_TRIANGLE_STRIP", + "GL_TRIANGLE_FAN", + "GL_QUADS", + "GL_QUAD_STRIP", + "GL_POLYGON", + "outside begin/end", + "inside unknown primitive", + "unknown state" +}; + + /* Get the name of an enum given that it is a primitive type. Avoids * GL_FALSE/GL_POINTS ambiguity and others. */ -const char *_mesa_lookup_prim_by_nr( int nr ) +const char * +_mesa_lookup_prim_by_nr(GLuint nr) { - switch (nr) { - case GL_POINTS: return "GL_POINTS"; - case GL_LINES: return "GL_LINES"; - case GL_LINE_STRIP: return "GL_LINE_STRIP"; - case GL_LINE_LOOP: return "GL_LINE_LOOP"; - case GL_TRIANGLES: return "GL_TRIANGLES"; - case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP"; - case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN"; - case GL_QUADS: return "GL_QUADS"; - case GL_QUAD_STRIP: return "GL_QUAD_STRIP"; - case GL_POLYGON: return "GL_POLYGON"; - case GL_POLYGON+1: return "OUTSIDE_BEGIN_END"; - default: return ""; - } + if (nr < Elements(prim_names)) + return prim_names[nr]; + else + return "invalid mode"; } - int _mesa_lookup_enum_by_name( const char *symbol ) { enum_elt * f = NULL; diff --git a/mesalib/src/mapi/glapi/glapi_mapi_tmp.h b/mesalib/src/mapi/glapi/glapi_mapi_tmp.h new file mode 100644 index 000000000..286e779f9 --- /dev/null +++ b/mesalib/src/mapi/glapi/glapi_mapi_tmp.h @@ -0,0 +1,13105 @@ +/* This file is automatically generated by mapi_abi.py. Do not modify. */ + +#ifndef _GLAPI_TMP_H_ +#define _GLAPI_TMP_H_ +#ifdef USE_MGL_NAMESPACE +#define GLAPI_PREFIX(func) mgl##func +#define GLAPI_PREFIX_STR(func) "mgl"#func +#else +#define GLAPI_PREFIX(func) gl##func +#define GLAPI_PREFIX_STR(func) "gl"#func +#endif /* USE_MGL_NAMESPACE */ + +typedef int GLfixed; +typedef int GLclampx; +#endif /* _GLAPI_TMP_H_ */ + +#ifdef MAPI_TMP_DEFINES +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" + +GLAPI void APIENTRY GLAPI_PREFIX(NewList)(GLuint list, GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(EndList)(void); +GLAPI void APIENTRY GLAPI_PREFIX(CallList)(GLuint list); +GLAPI void APIENTRY GLAPI_PREFIX(CallLists)(GLsizei n, GLenum type, const GLvoid *lists); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteLists)(GLuint list, GLsizei range); +GLAPI GLuint APIENTRY GLAPI_PREFIX(GenLists)(GLsizei range); +GLAPI void APIENTRY GLAPI_PREFIX(ListBase)(GLuint base); +GLAPI void APIENTRY GLAPI_PREFIX(Begin)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +GLAPI void APIENTRY GLAPI_PREFIX(Color3b)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY GLAPI_PREFIX(Color3bv)(const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color3d)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY GLAPI_PREFIX(Color3dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color3f)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY GLAPI_PREFIX(Color3fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color3i)(GLint red, GLint green, GLint blue); +GLAPI void APIENTRY GLAPI_PREFIX(Color3iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color3s)(GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY GLAPI_PREFIX(Color3sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color3ub)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY GLAPI_PREFIX(Color3ubv)(const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color3ui)(GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY GLAPI_PREFIX(Color3uiv)(const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color3us)(GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY GLAPI_PREFIX(Color3usv)(const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +GLAPI void APIENTRY GLAPI_PREFIX(Color4bv)(const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +GLAPI void APIENTRY GLAPI_PREFIX(Color4dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY GLAPI_PREFIX(Color4fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color4i)(GLint red, GLint green, GLint blue, GLint alpha); +GLAPI void APIENTRY GLAPI_PREFIX(Color4iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); +GLAPI void APIENTRY GLAPI_PREFIX(Color4sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GLAPI void APIENTRY GLAPI_PREFIX(Color4ubv)(const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); +GLAPI void APIENTRY GLAPI_PREFIX(Color4uiv)(const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); +GLAPI void APIENTRY GLAPI_PREFIX(Color4usv)(const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlag)(GLboolean flag); +GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlagv)(const GLboolean *flag); +GLAPI void APIENTRY GLAPI_PREFIX(End)(void); +GLAPI void APIENTRY GLAPI_PREFIX(Indexd)(GLdouble c); +GLAPI void APIENTRY GLAPI_PREFIX(Indexdv)(const GLdouble *c); +GLAPI void APIENTRY GLAPI_PREFIX(Indexf)(GLfloat c); +GLAPI void APIENTRY GLAPI_PREFIX(Indexfv)(const GLfloat *c); +GLAPI void APIENTRY GLAPI_PREFIX(Indexi)(GLint c); +GLAPI void APIENTRY GLAPI_PREFIX(Indexiv)(const GLint *c); +GLAPI void APIENTRY GLAPI_PREFIX(Indexs)(GLshort c); +GLAPI void APIENTRY GLAPI_PREFIX(Indexsv)(const GLshort *c); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3bv)(const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3i)(GLint nx, GLint ny, GLint nz); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3s)(GLshort nx, GLshort ny, GLshort nz); +GLAPI void APIENTRY GLAPI_PREFIX(Normal3sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2d)(GLdouble x, GLdouble y); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2f)(GLfloat x, GLfloat y); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2i)(GLint x, GLint y); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2s)(GLshort x, GLshort y); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3i)(GLint x, GLint y, GLint z); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3s)(GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4i)(GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +GLAPI void APIENTRY GLAPI_PREFIX(Rectdv)(const GLdouble *v1, const GLdouble *v2); +GLAPI void APIENTRY GLAPI_PREFIX(Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +GLAPI void APIENTRY GLAPI_PREFIX(Rectfv)(const GLfloat *v1, const GLfloat *v2); +GLAPI void APIENTRY GLAPI_PREFIX(Recti)(GLint x1, GLint y1, GLint x2, GLint y2); +GLAPI void APIENTRY GLAPI_PREFIX(Rectiv)(const GLint *v1, const GLint *v2); +GLAPI void APIENTRY GLAPI_PREFIX(Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); +GLAPI void APIENTRY GLAPI_PREFIX(Rectsv)(const GLshort *v1, const GLshort *v2); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1d)(GLdouble s); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1f)(GLfloat s); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1i)(GLint s); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1s)(GLshort s); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2d)(GLdouble s, GLdouble t); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2f)(GLfloat s, GLfloat t); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2i)(GLint s, GLint t); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2s)(GLshort s, GLshort t); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3i)(GLint s, GLint t, GLint r); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3s)(GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4i)(GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2d)(GLdouble x, GLdouble y); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2f)(GLfloat x, GLfloat y); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2i)(GLint x, GLint y); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2s)(GLshort x, GLshort y); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3d)(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3f)(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3i)(GLint x, GLint y, GLint z); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3s)(GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4i)(GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(ClipPlane)(GLenum plane, const GLdouble *equation); +GLAPI void APIENTRY GLAPI_PREFIX(ColorMaterial)(GLenum face, GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(CullFace)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(Fogf)(GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(Fogfv)(GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(Fogi)(GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(Fogiv)(GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(FrontFace)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(Hint)(GLenum target, GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(Lightf)(GLenum light, GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(Lightfv)(GLenum light, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(Lighti)(GLenum light, GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(Lightiv)(GLenum light, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(LightModelf)(GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(LightModelfv)(GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(LightModeli)(GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(LightModeliv)(GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(LineStipple)(GLint factor, GLushort pattern); +GLAPI void APIENTRY GLAPI_PREFIX(LineWidth)(GLfloat width); +GLAPI void APIENTRY GLAPI_PREFIX(Materialf)(GLenum face, GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(Materialfv)(GLenum face, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(Materiali)(GLenum face, GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(Materialiv)(GLenum face, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(PointSize)(GLfloat size); +GLAPI void APIENTRY GLAPI_PREFIX(PolygonMode)(GLenum face, GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(PolygonStipple)(const GLubyte *mask); +GLAPI void APIENTRY GLAPI_PREFIX(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(ShadeModel)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterf)(GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterfv)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexParameteri)(GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(TexParameteriv)(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(TexEnvf)(GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(TexEnvfv)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexEnvi)(GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(TexEnviv)(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexGend)(GLenum coord, GLenum pname, GLdouble param); +GLAPI void APIENTRY GLAPI_PREFIX(TexGendv)(GLenum coord, GLenum pname, const GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexGenf)(GLenum coord, GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(TexGenfv)(GLenum coord, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexGeni)(GLenum coord, GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(TexGeniv)(GLenum coord, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(FeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer); +GLAPI void APIENTRY GLAPI_PREFIX(SelectBuffer)(GLsizei size, GLuint *buffer); +GLAPI GLint APIENTRY GLAPI_PREFIX(RenderMode)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(InitNames)(void); +GLAPI void APIENTRY GLAPI_PREFIX(LoadName)(GLuint name); +GLAPI void APIENTRY GLAPI_PREFIX(PassThrough)(GLfloat token); +GLAPI void APIENTRY GLAPI_PREFIX(PopName)(void); +GLAPI void APIENTRY GLAPI_PREFIX(PushName)(GLuint name); +GLAPI void APIENTRY GLAPI_PREFIX(DrawBuffer)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(Clear)(GLbitfield mask); +GLAPI void APIENTRY GLAPI_PREFIX(ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY GLAPI_PREFIX(ClearIndex)(GLfloat c); +GLAPI void APIENTRY GLAPI_PREFIX(ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY GLAPI_PREFIX(ClearStencil)(GLint s); +GLAPI void APIENTRY GLAPI_PREFIX(ClearDepth)(GLclampd depth); +GLAPI void APIENTRY GLAPI_PREFIX(StencilMask)(GLuint mask); +GLAPI void APIENTRY GLAPI_PREFIX(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GLAPI void APIENTRY GLAPI_PREFIX(DepthMask)(GLboolean flag); +GLAPI void APIENTRY GLAPI_PREFIX(IndexMask)(GLuint mask); +GLAPI void APIENTRY GLAPI_PREFIX(Accum)(GLenum op, GLfloat value); +GLAPI void APIENTRY GLAPI_PREFIX(Disable)(GLenum cap); +GLAPI void APIENTRY GLAPI_PREFIX(Enable)(GLenum cap); +GLAPI void APIENTRY GLAPI_PREFIX(Finish)(void); +GLAPI void APIENTRY GLAPI_PREFIX(Flush)(void); +GLAPI void APIENTRY GLAPI_PREFIX(PopAttrib)(void); +GLAPI void APIENTRY GLAPI_PREFIX(PushAttrib)(GLbitfield mask); +GLAPI void APIENTRY GLAPI_PREFIX(Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI void APIENTRY GLAPI_PREFIX(Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI void APIENTRY GLAPI_PREFIX(Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI void APIENTRY GLAPI_PREFIX(Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +GLAPI void APIENTRY GLAPI_PREFIX(MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); +GLAPI void APIENTRY GLAPI_PREFIX(MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); +GLAPI void APIENTRY GLAPI_PREFIX(MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); +GLAPI void APIENTRY GLAPI_PREFIX(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord1d)(GLdouble u); +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord1dv)(const GLdouble *u); +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord1f)(GLfloat u); +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord1fv)(const GLfloat *u); +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord2d)(GLdouble u, GLdouble v); +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord2dv)(const GLdouble *u); +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord2f)(GLfloat u, GLfloat v); +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord2fv)(const GLfloat *u); +GLAPI void APIENTRY GLAPI_PREFIX(EvalMesh1)(GLenum mode, GLint i1, GLint i2); +GLAPI void APIENTRY GLAPI_PREFIX(EvalPoint1)(GLint i); +GLAPI void APIENTRY GLAPI_PREFIX(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); +GLAPI void APIENTRY GLAPI_PREFIX(EvalPoint2)(GLint i, GLint j); +GLAPI void APIENTRY GLAPI_PREFIX(AlphaFunc)(GLenum func, GLclampf ref); +GLAPI void APIENTRY GLAPI_PREFIX(BlendFunc)(GLenum sfactor, GLenum dfactor); +GLAPI void APIENTRY GLAPI_PREFIX(LogicOp)(GLenum opcode); +GLAPI void APIENTRY GLAPI_PREFIX(StencilFunc)(GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY GLAPI_PREFIX(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); +GLAPI void APIENTRY GLAPI_PREFIX(DepthFunc)(GLenum func); +GLAPI void APIENTRY GLAPI_PREFIX(PixelZoom)(GLfloat xfactor, GLfloat yfactor); +GLAPI void APIENTRY GLAPI_PREFIX(PixelTransferf)(GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(PixelTransferi)(GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(PixelStoref)(GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(PixelStorei)(GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat *values); +GLAPI void APIENTRY GLAPI_PREFIX(PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint *values); +GLAPI void APIENTRY GLAPI_PREFIX(PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort *values); +GLAPI void APIENTRY GLAPI_PREFIX(ReadBuffer)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +GLAPI void APIENTRY GLAPI_PREFIX(ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(GetBooleanv)(GLenum pname, GLboolean *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetClipPlane)(GLenum plane, GLdouble *equation); +GLAPI void APIENTRY GLAPI_PREFIX(GetDoublev)(GLenum pname, GLdouble *params); +GLAPI GLenum APIENTRY GLAPI_PREFIX(GetError)(void); +GLAPI void APIENTRY GLAPI_PREFIX(GetFloatv)(GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetIntegerv)(GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetLightfv)(GLenum light, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetLightiv)(GLenum light, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetMapdv)(GLenum target, GLenum query, GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(GetMapfv)(GLenum target, GLenum query, GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(GetMapiv)(GLenum target, GLenum query, GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(GetMaterialfv)(GLenum face, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetMaterialiv)(GLenum face, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetPixelMapfv)(GLenum map, GLfloat *values); +GLAPI void APIENTRY GLAPI_PREFIX(GetPixelMapuiv)(GLenum map, GLuint *values); +GLAPI void APIENTRY GLAPI_PREFIX(GetPixelMapusv)(GLenum map, GLushort *values); +GLAPI void APIENTRY GLAPI_PREFIX(GetPolygonStipple)(GLubyte *mask); +GLAPI const GLubyte * APIENTRY GLAPI_PREFIX(GetString)(GLenum name); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexEnviv)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexGendv)(GLenum coord, GLenum pname, GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexGenfv)(GLenum coord, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexGeniv)(GLenum coord, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameteriv)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsEnabled)(GLenum cap); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsList)(GLuint list); +GLAPI void APIENTRY GLAPI_PREFIX(DepthRange)(GLclampd zNear, GLclampd zFar); +GLAPI void APIENTRY GLAPI_PREFIX(Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY GLAPI_PREFIX(LoadIdentity)(void); +GLAPI void APIENTRY GLAPI_PREFIX(LoadMatrixf)(const GLfloat *m); +GLAPI void APIENTRY GLAPI_PREFIX(LoadMatrixd)(const GLdouble *m); +GLAPI void APIENTRY GLAPI_PREFIX(MatrixMode)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(MultMatrixf)(const GLfloat *m); +GLAPI void APIENTRY GLAPI_PREFIX(MultMatrixd)(const GLdouble *m); +GLAPI void APIENTRY GLAPI_PREFIX(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY GLAPI_PREFIX(PopMatrix)(void); +GLAPI void APIENTRY GLAPI_PREFIX(PushMatrix)(void); +GLAPI void APIENTRY GLAPI_PREFIX(Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(Scaled)(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(Scalef)(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(Translated)(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(Translatef)(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(ArrayElement)(GLint i); +GLAPI void APIENTRY GLAPI_PREFIX(ArrayElementEXT)(GLint i); +GLAPI void APIENTRY GLAPI_PREFIX(BindTexture)(GLenum target, GLuint texture); +GLAPI void APIENTRY GLAPI_PREFIX(BindTextureEXT)(GLenum target, GLuint texture); +GLAPI void APIENTRY GLAPI_PREFIX(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(DisableClientState)(GLenum array); +GLAPI void APIENTRY GLAPI_PREFIX(DrawArrays)(GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY GLAPI_PREFIX(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY GLAPI_PREFIX(DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlagPointer)(GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(EnableClientState)(GLenum array); +GLAPI void APIENTRY GLAPI_PREFIX(IndexPointer)(GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(Indexub)(GLubyte c); +GLAPI void APIENTRY GLAPI_PREFIX(Indexubv)(const GLubyte *c); +GLAPI void APIENTRY GLAPI_PREFIX(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(NormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(PolygonOffset)(GLfloat factor, GLfloat units); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(AreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(AreTexturesResidentEXT)(GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteTextures)(GLsizei n, const GLuint *textures); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteTexturesEXT)(GLsizei n, const GLuint *textures); +GLAPI void APIENTRY GLAPI_PREFIX(GenTextures)(GLsizei n, GLuint *textures); +GLAPI void APIENTRY GLAPI_PREFIX(GenTexturesEXT)(GLsizei n, GLuint *textures); +GLAPI void APIENTRY GLAPI_PREFIX(GetPointerv)(GLenum pname, GLvoid **params); +GLAPI void APIENTRY GLAPI_PREFIX(GetPointervEXT)(GLenum pname, GLvoid **params); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsTexture)(GLuint texture); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsTextureEXT)(GLuint texture); +GLAPI void APIENTRY GLAPI_PREFIX(PrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities); +GLAPI void APIENTRY GLAPI_PREFIX(PrioritizeTexturesEXT)(GLsizei n, const GLuint *textures, const GLclampf *priorities); +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(PopClientAttrib)(void); +GLAPI void APIENTRY GLAPI_PREFIX(PushClientAttrib)(GLbitfield mask); +GLAPI void APIENTRY GLAPI_PREFIX(BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY GLAPI_PREFIX(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquation)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationEXT)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY GLAPI_PREFIX(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY GLAPI_PREFIX(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +GLAPI void APIENTRY GLAPI_PREFIX(ColorTableEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +GLAPI void APIENTRY GLAPI_PREFIX(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid *table); +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid *table); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_343)(GLenum target, GLenum format, GLenum type, GLvoid *table); +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_344)(GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_345)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY GLAPI_PREFIX(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid *image); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_356)(GLenum target, GLenum format, GLenum type, GLvoid *image); +GLAPI void APIENTRY GLAPI_PREFIX(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_357)(GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_358)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_359)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +GLAPI void APIENTRY GLAPI_PREFIX(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +GLAPI void APIENTRY GLAPI_PREFIX(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_361)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY GLAPI_PREFIX(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_362)(GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_363)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_364)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY GLAPI_PREFIX(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_365)(GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_366)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY GLAPI_PREFIX(Minmax)(GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY GLAPI_PREFIX(ResetHistogram)(GLenum target); +GLAPI void APIENTRY GLAPI_PREFIX(ResetMinmax)(GLenum target); +GLAPI void APIENTRY GLAPI_PREFIX(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(TexImage3DEXT)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(ActiveTextureARB)(GLenum texture); +GLAPI void APIENTRY GLAPI_PREFIX(ActiveTexture)(GLenum texture); +GLAPI void APIENTRY GLAPI_PREFIX(ClientActiveTextureARB)(GLenum texture); +GLAPI void APIENTRY GLAPI_PREFIX(ClientActiveTexture)(GLenum texture); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1dARB)(GLenum target, GLdouble s); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1d)(GLenum target, GLdouble s); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1dvARB)(GLenum target, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1dv)(GLenum target, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1fARB)(GLenum target, GLfloat s); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1f)(GLenum target, GLfloat s); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1fvARB)(GLenum target, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1fv)(GLenum target, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1iARB)(GLenum target, GLint s); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1i)(GLenum target, GLint s); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1ivARB)(GLenum target, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1iv)(GLenum target, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1sARB)(GLenum target, GLshort s); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1s)(GLenum target, GLshort s); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1svARB)(GLenum target, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1sv)(GLenum target, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2d)(GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2dvARB)(GLenum target, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2dv)(GLenum target, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2f)(GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2fvARB)(GLenum target, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2fv)(GLenum target, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2i)(GLenum target, GLint s, GLint t); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2ivARB)(GLenum target, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2iv)(GLenum target, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2s)(GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2svARB)(GLenum target, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2sv)(GLenum target, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3d)(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3dvARB)(GLenum target, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3dv)(GLenum target, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3f)(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3fvARB)(GLenum target, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3fv)(GLenum target, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3i)(GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3ivARB)(GLenum target, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3iv)(GLenum target, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3s)(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3svARB)(GLenum target, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3sv)(GLenum target, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4d)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4dvARB)(GLenum target, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4dv)(GLenum target, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4fvARB)(GLenum target, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4fv)(GLenum target, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4i)(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4ivARB)(GLenum target, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4iv)(GLenum target, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4s)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4svARB)(GLenum target, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4sv)(GLenum target, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(AttachShader)(GLuint program, GLuint shader); +GLAPI GLuint APIENTRY GLAPI_PREFIX(CreateProgram)(void); +GLAPI GLuint APIENTRY GLAPI_PREFIX(CreateShader)(GLenum type); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteProgram)(GLuint program); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteShader)(GLuint program); +GLAPI void APIENTRY GLAPI_PREFIX(DetachShader)(GLuint program, GLuint shader); +GLAPI void APIENTRY GLAPI_PREFIX(GetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramiv)(GLuint program, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderiv)(GLuint shader, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsProgram)(GLuint program); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsShader)(GLuint shader); +GLAPI void APIENTRY GLAPI_PREFIX(StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY GLAPI_PREFIX(StencilMaskSeparate)(GLenum face, GLuint mask); +GLAPI void APIENTRY GLAPI_PREFIX(StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(ClampColor)(GLenum target, GLenum clamp); +GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfi)(GLenum buffer, GLint drawbuffer, const GLfloat depth, const GLint stencil); +GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI const GLubyte * APIENTRY GLAPI_PREFIX(GetStringi)(GLenum name, GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(TexBuffer)(GLenum target, GLenum internalFormat, GLuint buffer); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture)(GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferParameteri64v)(GLenum target, GLenum pname, GLint64 *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetInteger64i_v)(GLenum cap, GLuint index, GLint64 *data); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribDivisor)(GLuint index, GLuint divisor); +GLAPI void APIENTRY GLAPI_PREFIX(LoadTransposeMatrixdARB)(const GLdouble *m); +GLAPI void APIENTRY GLAPI_PREFIX(LoadTransposeMatrixd)(const GLdouble *m); +GLAPI void APIENTRY GLAPI_PREFIX(LoadTransposeMatrixfARB)(const GLfloat *m); +GLAPI void APIENTRY GLAPI_PREFIX(LoadTransposeMatrixf)(const GLfloat *m); +GLAPI void APIENTRY GLAPI_PREFIX(MultTransposeMatrixdARB)(const GLdouble *m); +GLAPI void APIENTRY GLAPI_PREFIX(MultTransposeMatrixd)(const GLdouble *m); +GLAPI void APIENTRY GLAPI_PREFIX(MultTransposeMatrixfARB)(const GLfloat *m); +GLAPI void APIENTRY GLAPI_PREFIX(MultTransposeMatrixf)(const GLfloat *m); +GLAPI void APIENTRY GLAPI_PREFIX(SampleCoverageARB)(GLclampf value, GLboolean invert); +GLAPI void APIENTRY GLAPI_PREFIX(SampleCoverage)(GLclampf value, GLboolean invert); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid *img); +GLAPI void APIENTRY GLAPI_PREFIX(GetCompressedTexImage)(GLenum target, GLint level, GLvoid *img); +GLAPI void APIENTRY GLAPI_PREFIX(DisableVertexAttribArrayARB)(GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(DisableVertexAttribArray)(GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(EnableVertexAttribArrayARB)(GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(EnableVertexAttribArray)(GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramStringARB)(GLenum target, GLenum pname, GLvoid *string); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramivARB)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribdv)(GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribfv)(GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribivARB)(GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribiv)(GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid *string); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dARB)(GLuint index, GLdouble x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1d)(GLuint index, GLdouble x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dvARB)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dv)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fARB)(GLuint index, GLfloat x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1f)(GLuint index, GLfloat x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fvARB)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fv)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1sARB)(GLuint index, GLshort x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1s)(GLuint index, GLshort x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1svARB)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1sv)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2d)(GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dvARB)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dv)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2f)(GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fvARB)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fv)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2s)(GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2svARB)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2sv)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3d)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dvARB)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dv)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3f)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fvARB)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fv)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3s)(GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3svARB)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3sv)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NbvARB)(GLuint index, const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nbv)(GLuint index, const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NivARB)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Niv)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NsvARB)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nsv)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nub)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NubvARB)(GLuint index, const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nubv)(GLuint index, const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NuivARB)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nuiv)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NusvARB)(GLuint index, const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nusv)(GLuint index, const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4bvARB)(GLuint index, const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4bv)(GLuint index, const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4d)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dvARB)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dv)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4f)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fvARB)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fv)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ivARB)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4iv)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4s)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4svARB)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4sv)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubvARB)(GLuint index, const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubv)(GLuint index, const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4uivARB)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4uiv)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4usvARB)(GLuint index, const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4usv)(GLuint index, const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferARB)(GLenum target, GLuint buffer); +GLAPI void APIENTRY GLAPI_PREFIX(BindBuffer)(GLenum target, GLuint buffer); +GLAPI void APIENTRY GLAPI_PREFIX(BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY GLAPI_PREFIX(BufferData)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY GLAPI_PREFIX(BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(BufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteBuffersARB)(GLsizei n, const GLuint *buffer); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteBuffers)(GLsizei n, const GLuint *buffer); +GLAPI void APIENTRY GLAPI_PREFIX(GenBuffersARB)(GLsizei n, GLuint *buffer); +GLAPI void APIENTRY GLAPI_PREFIX(GenBuffers)(GLsizei n, GLuint *buffer); +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferParameterivARB)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferParameteriv)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid **params); +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferPointerv)(GLenum target, GLenum pname, GLvoid **params); +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsBufferARB)(GLuint buffer); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsBuffer)(GLuint buffer); +GLAPI GLvoid * APIENTRY GLAPI_PREFIX(MapBufferARB)(GLenum target, GLenum access); +GLAPI GLvoid * APIENTRY GLAPI_PREFIX(MapBuffer)(GLenum target, GLenum access); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(UnmapBufferARB)(GLenum target); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(UnmapBuffer)(GLenum target); +GLAPI void APIENTRY GLAPI_PREFIX(BeginQueryARB)(GLenum target, GLuint id); +GLAPI void APIENTRY GLAPI_PREFIX(BeginQuery)(GLenum target, GLuint id); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteQueriesARB)(GLsizei n, const GLuint *ids); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteQueries)(GLsizei n, const GLuint *ids); +GLAPI void APIENTRY GLAPI_PREFIX(EndQueryARB)(GLenum target); +GLAPI void APIENTRY GLAPI_PREFIX(EndQuery)(GLenum target); +GLAPI void APIENTRY GLAPI_PREFIX(GenQueriesARB)(GLsizei n, GLuint *ids); +GLAPI void APIENTRY GLAPI_PREFIX(GenQueries)(GLsizei n, GLuint *ids); +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryObjectiv)(GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryObjectuiv)(GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryivARB)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryiv)(GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsQueryARB)(GLuint id); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsQuery)(GLuint id); +GLAPI void APIENTRY GLAPI_PREFIX(AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); +GLAPI void APIENTRY GLAPI_PREFIX(CompileShaderARB)(GLhandleARB shader); +GLAPI void APIENTRY GLAPI_PREFIX(CompileShader)(GLuint shader); +GLAPI GLhandleARB APIENTRY GLAPI_PREFIX(CreateProgramObjectARB)(void); +GLAPI GLhandleARB APIENTRY GLAPI_PREFIX(CreateShaderObjectARB)(GLenum shaderType); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteObjectARB)(GLhandleARB obj); +GLAPI void APIENTRY GLAPI_PREFIX(DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); +GLAPI void APIENTRY GLAPI_PREFIX(GetActiveUniformARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI void APIENTRY GLAPI_PREFIX(GetActiveUniform)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY GLAPI_PREFIX(GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei *length, GLhandleARB *infoLog); +GLAPI GLhandleARB APIENTRY GLAPI_PREFIX(GetHandleARB)(GLenum pname); +GLAPI void APIENTRY GLAPI_PREFIX(GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +GLAPI void APIENTRY GLAPI_PREFIX(GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderSourceARB)(GLhandleARB shader, GLsizei bufSize, GLsizei *length, GLcharARB *source); +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderSource)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI GLint APIENTRY GLAPI_PREFIX(GetUniformLocationARB)(GLhandleARB program, const GLcharARB *name); +GLAPI GLint APIENTRY GLAPI_PREFIX(GetUniformLocation)(GLuint program, const GLchar *name); +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformfvARB)(GLhandleARB program, GLint location, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformfv)(GLuint program, GLint location, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformivARB)(GLhandleARB program, GLint location, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformiv)(GLuint program, GLint location, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(LinkProgramARB)(GLhandleARB program); +GLAPI void APIENTRY GLAPI_PREFIX(LinkProgram)(GLuint program); +GLAPI void APIENTRY GLAPI_PREFIX(ShaderSourceARB)(GLhandleARB shader, GLsizei count, const GLcharARB **string, const GLint *length); +GLAPI void APIENTRY GLAPI_PREFIX(ShaderSource)(GLuint shader, GLsizei count, const GLchar **string, const GLint *length); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1fARB)(GLint location, GLfloat v0); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1f)(GLint location, GLfloat v0); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1fvARB)(GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1fv)(GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1iARB)(GLint location, GLint v0); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1i)(GLint location, GLint v0); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1ivARB)(GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1iv)(GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2f)(GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2fvARB)(GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2fv)(GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2iARB)(GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2i)(GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2ivARB)(GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2iv)(GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3fvARB)(GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3fv)(GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3i)(GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3ivARB)(GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3iv)(GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4fvARB)(GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4fv)(GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4ivARB)(GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4iv)(GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(UseProgramObjectARB)(GLhandleARB program); +GLAPI void APIENTRY GLAPI_PREFIX(UseProgram)(GLuint program); +GLAPI void APIENTRY GLAPI_PREFIX(ValidateProgramARB)(GLhandleARB program); +GLAPI void APIENTRY GLAPI_PREFIX(ValidateProgram)(GLuint program); +GLAPI void APIENTRY GLAPI_PREFIX(BindAttribLocationARB)(GLhandleARB program, GLuint index, const GLcharARB *name); +GLAPI void APIENTRY GLAPI_PREFIX(BindAttribLocation)(GLuint program, GLuint index, const GLchar *name); +GLAPI void APIENTRY GLAPI_PREFIX(GetActiveAttribARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI void APIENTRY GLAPI_PREFIX(GetActiveAttrib)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI GLint APIENTRY GLAPI_PREFIX(GetAttribLocationARB)(GLhandleARB program, const GLcharARB *name); +GLAPI GLint APIENTRY GLAPI_PREFIX(GetAttribLocation)(GLuint program, const GLchar *name); +GLAPI void APIENTRY GLAPI_PREFIX(DrawBuffersARB)(GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY GLAPI_PREFIX(DrawBuffers)(GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY GLAPI_PREFIX(DrawBuffersATI)(GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY GLAPI_PREFIX(DrawArraysInstancedARB)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(DrawArraysInstanced)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(DrawArraysInstancedEXT)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(DrawElementsInstancedARB)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(DrawElementsInstanced)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(DrawElementsInstancedEXT)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureARB)(GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureFaceARB)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameteriARB)(GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribDivisorARB)(GLuint index, GLuint divisor); +GLAPI void APIENTRY GLAPI_PREFIX(FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length); +GLAPI GLvoid * APIENTRY GLAPI_PREFIX(MapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY GLAPI_PREFIX(BindVertexArray)(GLuint array); +GLAPI void APIENTRY GLAPI_PREFIX(GenVertexArrays)(GLsizei n, GLuint *arrays); +GLAPI void APIENTRY GLAPI_PREFIX(CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI GLenum APIENTRY GLAPI_PREFIX(ClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteSync)(GLsync sync); +GLAPI GLsync APIENTRY GLAPI_PREFIX(FenceSync)(GLenum condition, GLbitfield flags); +GLAPI void APIENTRY GLAPI_PREFIX(GetInteger64v)(GLenum pname, GLint64 *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsSync)(GLsync sync); +GLAPI void APIENTRY GLAPI_PREFIX(WaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY GLAPI_PREFIX(DrawElementsBaseVertex)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +GLAPI void APIENTRY GLAPI_PREFIX(DrawRangeElementsBaseVertex)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawElementsBaseVertex)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, const GLint *basevertex); +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationSeparateiARB)(GLuint buf, GLenum modeRGB, GLenum modeA); +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationiARB)(GLuint buf, GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparateiARB)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcA, GLenum dstA); +GLAPI void APIENTRY GLAPI_PREFIX(BlendFunciARB)(GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY GLAPI_PREFIX(BindTransformFeedback)(GLenum target, GLuint id); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteTransformFeedbacks)(GLsizei n, const GLuint *ids); +GLAPI void APIENTRY GLAPI_PREFIX(DrawTransformFeedback)(GLenum mode, GLuint id); +GLAPI void APIENTRY GLAPI_PREFIX(GenTransformFeedbacks)(GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsTransformFeedback)(GLuint id); +GLAPI void APIENTRY GLAPI_PREFIX(PauseTransformFeedback)(void); +GLAPI void APIENTRY GLAPI_PREFIX(ResumeTransformFeedback)(void); +GLAPI void APIENTRY GLAPI_PREFIX(ClearDepthf)(GLclampf depth); +GLAPI void APIENTRY GLAPI_PREFIX(DepthRangef)(GLclampf zNear, GLclampf zFar); +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY GLAPI_PREFIX(ReleaseShaderCompiler)(void); +GLAPI void APIENTRY GLAPI_PREFIX(ShaderBinary)(GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_610)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_611)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_612)(GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY GLAPI_PREFIX(PolygonOffsetEXT)(GLfloat factor, GLfloat bias); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_614)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_615)(const GLfloat *coords); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_616)(GLint x, GLint y, GLint z, GLint width, GLint height); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_617)(const GLint *coords); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_618)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_619)(const GLshort *coords); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_620)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_621)(const GLfixed *coords); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_622)(GLenum type, GLsizei stride, const GLvoid *pointer); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_623)(GLenum pname, GLfloat *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_624)(GLenum pname, GLint *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_625)(GLenum pname, GLfloat param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_626)(GLenum pname, const GLfloat *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_627)(GLenum pname, GLint param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_628)(GLenum pname, const GLint *params); +GLbitfield APIENTRY GLAPI_PREFIX(_dispatch_stub_629)(GLfixed *mantissa, GLint *exponent); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_630)(GLclampf value, GLboolean invert); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_631)(GLenum pattern); +GLAPI void APIENTRY GLAPI_PREFIX(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfEXT)(GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterf)(GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfARB)(GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfvEXT)(GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfv)(GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfvARB)(GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(LockArraysEXT)(GLint first, GLsizei count); +GLAPI void APIENTRY GLAPI_PREFIX(UnlockArraysEXT)(void); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bvEXT)(const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bv)(const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3d)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dvEXT)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3f)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fvEXT)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3i)(GLint red, GLint green, GLint blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ivEXT)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3s)(GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3svEXT)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ub)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubvEXT)(const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubv)(const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ui)(GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uivEXT)(const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uiv)(const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3us)(GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usvEXT)(const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usv)(const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawArraysEXT)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawArrays)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawElementsEXT)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawElements)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordPointer)(GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddEXT)(GLdouble coord); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordd)(GLdouble coord); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddvEXT)(const GLdouble *coord); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddv)(const GLdouble *coord); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfEXT)(GLfloat coord); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordf)(GLfloat coord); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfvEXT)(const GLfloat *coord); +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfv)(const GLfloat *coord); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_666)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY GLAPI_PREFIX(FlushVertexArrayRangeNV)(void); +GLAPI void APIENTRY GLAPI_PREFIX(VertexArrayRangeNV)(GLsizei length, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +GLAPI void APIENTRY GLAPI_PREFIX(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterfNV)(GLenum pname, GLfloat param); +GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterfvNV)(GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameteriNV)(GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterivNV)(GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(ResizeBuffersMESA)(void); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dMESA)(GLdouble x, GLdouble y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2d)(GLdouble x, GLdouble y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dARB)(GLdouble x, GLdouble y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dvMESA)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dvARB)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fMESA)(GLfloat x, GLfloat y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2f)(GLfloat x, GLfloat y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fARB)(GLfloat x, GLfloat y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fvMESA)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fvARB)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iMESA)(GLint x, GLint y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2i)(GLint x, GLint y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iARB)(GLint x, GLint y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2ivMESA)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2ivARB)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sMESA)(GLshort x, GLshort y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2s)(GLshort x, GLshort y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sARB)(GLshort x, GLshort y); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2svMESA)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2svARB)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3d)(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dARB)(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dvMESA)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dv)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dvARB)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3f)(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fARB)(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fvMESA)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fv)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fvARB)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iMESA)(GLint x, GLint y, GLint z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3i)(GLint x, GLint y, GLint z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iARB)(GLint x, GLint y, GLint z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3ivMESA)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iv)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3ivARB)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3s)(GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sARB)(GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3svMESA)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sv)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3svARB)(const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4dvMESA)(const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4fvMESA)(const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4ivMESA)(const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4svMESA)(const GLshort *v); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_708)(const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_709)(const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_710)(GLsizei n, const GLuint *fences); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_711)(GLuint fence); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_712)(GLsizei n, GLuint *fences); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_713)(GLuint fence, GLenum pname, GLint *params); +GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_714)(GLuint fence); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_715)(GLuint fence, GLenum condition); +GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_716)(GLuint fence); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(AreProgramsResidentNV)(GLsizei n, const GLuint *ids, GLboolean *residences); +GLAPI void APIENTRY GLAPI_PREFIX(BindProgramNV)(GLenum target, GLuint program); +GLAPI void APIENTRY GLAPI_PREFIX(BindProgramARB)(GLenum target, GLuint program); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteProgramsNV)(GLsizei n, const GLuint *programs); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteProgramsARB)(GLsizei n, const GLuint *programs); +GLAPI void APIENTRY GLAPI_PREFIX(ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GenProgramsNV)(GLsizei n, GLuint *programs); +GLAPI void APIENTRY GLAPI_PREFIX(GenProgramsARB)(GLsizei n, GLuint *programs); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramStringNV)(GLuint id, GLenum pname, GLubyte *program); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramivNV)(GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid **pointer); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid **pointer); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid **pointer); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribivNV)(GLuint index, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsProgramNV)(GLuint program); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsProgramARB)(GLuint program); +GLAPI void APIENTRY GLAPI_PREFIX(LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte *program); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(RequestResidentProgramsNV)(GLsizei n, const GLuint *ids); +GLAPI void APIENTRY GLAPI_PREFIX(TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dNV)(GLuint index, GLdouble x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dvNV)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fNV)(GLuint index, GLfloat x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fvNV)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1sNV)(GLuint index, GLshort x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1svNV)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dvNV)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fvNV)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2svNV)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dvNV)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fvNV)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3svNV)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dvNV)(GLuint index, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fvNV)(GLuint index, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4svNV)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubvNV)(GLuint index, const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexBumpParameterfvATI)(GLenum pname, GLfloat *param); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexBumpParameterivATI)(GLenum pname, GLint *param); +GLAPI void APIENTRY GLAPI_PREFIX(TexBumpParameterfvATI)(GLenum pname, const GLfloat *param); +GLAPI void APIENTRY GLAPI_PREFIX(TexBumpParameterivATI)(GLenum pname, const GLint *param); +GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +GLAPI void APIENTRY GLAPI_PREFIX(BeginFragmentShaderATI)(void); +GLAPI void APIENTRY GLAPI_PREFIX(BindFragmentShaderATI)(GLuint id); +GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteFragmentShaderATI)(GLuint id); +GLAPI void APIENTRY GLAPI_PREFIX(EndFragmentShaderATI)(void); +GLAPI GLuint APIENTRY GLAPI_PREFIX(GenFragmentShadersATI)(GLuint range); +GLAPI void APIENTRY GLAPI_PREFIX(PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); +GLAPI void APIENTRY GLAPI_PREFIX(SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); +GLAPI void APIENTRY GLAPI_PREFIX(SetFragmentShaderConstantATI)(GLuint dst, const GLfloat *value); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameteriNV)(GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameteri)(GLenum pname, GLint param); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterivNV)(GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(PointParameteriv)(GLenum pname, const GLint *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_797)(GLenum face); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_798)(GLuint array); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_799)(GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteVertexArrays)(GLsizei n, const GLuint *arrays); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_800)(GLsizei n, GLuint *arrays); +GLboolean APIENTRY GLAPI_PREFIX(_dispatch_stub_801)(GLuint array); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsVertexArray)(GLuint array); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartIndexNV)(GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartIndex)(GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartNV)(void); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_810)(GLenum func, GLclampx ref); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_811)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_812)(GLclampx depth); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_813)(GLenum plane, const GLfixed *equation); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_814)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_815)(GLclampx zNear, GLclampx zFar); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_816)(GLenum pname, GLfixed param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_817)(GLenum pname, const GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_818)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_819)(GLenum plane, GLfixed *equation); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_820)(GLenum pname, GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_821)(GLenum light, GLenum pname, GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_822)(GLenum face, GLenum pname, GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_823)(GLenum target, GLenum pname, GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_824)(GLenum coord, GLenum pname, GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_825)(GLenum target, GLenum pname, GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_826)(GLenum pname, GLfixed param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_827)(GLenum pname, const GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_828)(GLenum light, GLenum pname, GLfixed param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_829)(GLenum light, GLenum pname, const GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_830)(GLfixed width); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_831)(const GLfixed *m); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_832)(GLenum face, GLenum pname, GLfixed param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_833)(GLenum face, GLenum pname, const GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_834)(const GLfixed *m); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_835)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_836)(GLfixed nx, GLfixed ny, GLfixed nz); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_837)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_838)(GLenum pname, GLfixed param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_839)(GLenum pname, const GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_840)(GLfixed size); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_841)(GLfixed factor, GLfixed units); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_842)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_843)(GLclampx value, GLboolean invert); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_844)(GLfixed x, GLfixed y, GLfixed z); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_845)(GLenum target, GLenum pname, GLfixed param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_846)(GLenum target, GLenum pname, const GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_847)(GLenum coord, GLenum pname, GLint param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_848)(GLenum coord, GLenum pname, const GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_849)(GLenum target, GLenum pname, GLfixed param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_850)(GLenum target, GLenum pname, const GLfixed *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_851)(GLfixed x, GLfixed y, GLfixed z); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_852)(GLenum plane, const GLfloat *equation); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_853)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_854)(GLenum plane, GLfloat *equation); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_855)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_856)(GLclampd zmin, GLclampd zmax); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_857)(GLenum modeRGB, GLenum modeA); +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA); +GLAPI void APIENTRY GLAPI_PREFIX(BindFramebufferEXT)(GLenum target, GLuint framebuffer); +GLAPI void APIENTRY GLAPI_PREFIX(BindFramebuffer)(GLenum target, GLuint framebuffer); +GLAPI void APIENTRY GLAPI_PREFIX(BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY GLAPI_PREFIX(BindRenderbuffer)(GLenum target, GLuint renderbuffer); +GLAPI GLenum APIENTRY GLAPI_PREFIX(CheckFramebufferStatusEXT)(GLenum target); +GLAPI GLenum APIENTRY GLAPI_PREFIX(CheckFramebufferStatus)(GLenum target); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteFramebuffers)(GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY GLAPI_PREFIX(DeleteRenderbuffers)(GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture1D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture3D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY GLAPI_PREFIX(GenFramebuffersEXT)(GLsizei n, GLuint *framebuffers); +GLAPI void APIENTRY GLAPI_PREFIX(GenFramebuffers)(GLsizei n, GLuint *framebuffers); +GLAPI void APIENTRY GLAPI_PREFIX(GenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY GLAPI_PREFIX(GenRenderbuffers)(GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY GLAPI_PREFIX(GenerateMipmapEXT)(GLenum target); +GLAPI void APIENTRY GLAPI_PREFIX(GenerateMipmap)(GLenum target); +GLAPI void APIENTRY GLAPI_PREFIX(GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsFramebufferEXT)(GLuint framebuffer); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsFramebuffer)(GLuint framebuffer); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsRenderbufferEXT)(GLuint renderbuffer); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsRenderbuffer)(GLuint renderbuffer); +GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_875)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY GLAPI_PREFIX(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_876)(GLenum target, GLenum pname, GLint param); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_877)(GLenum target, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY GLAPI_PREFIX(BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar *name); +GLAPI void APIENTRY GLAPI_PREFIX(BindFragDataLocation)(GLuint program, GLuint colorNumber, const GLchar *name); +GLAPI GLint APIENTRY GLAPI_PREFIX(GetFragDataLocationEXT)(GLuint program, const GLchar *name); +GLAPI GLint APIENTRY GLAPI_PREFIX(GetFragDataLocation)(GLuint program, const GLchar *name); +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformuivEXT)(GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformuiv)(GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIiv)(GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIuiv)(GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uiEXT)(GLint location, GLuint x); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1ui)(GLint location, GLuint x); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uivEXT)(GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uiv)(GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uiEXT)(GLint location, GLuint x, GLuint y); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2ui)(GLint location, GLuint x, GLuint y); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uivEXT)(GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uiv)(GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3ui)(GLint location, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uivEXT)(GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uiv)(GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4ui)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uivEXT)(GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uiv)(GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1iEXT)(GLuint index, GLint x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1i)(GLuint index, GLint x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1ivEXT)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1iv)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uiEXT)(GLuint index, GLuint x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1ui)(GLuint index, GLuint x); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uivEXT)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uiv)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2iEXT)(GLuint index, GLint x, GLint y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2i)(GLuint index, GLint x, GLint y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2ivEXT)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2iv)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uivEXT)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uiv)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3ivEXT)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3iv)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uivEXT)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uiv)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4bvEXT)(GLuint index, const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4bv)(GLuint index, const GLbyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ivEXT)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4iv)(GLuint index, const GLint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4svEXT)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4sv)(GLuint index, const GLshort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ubvEXT)(GLuint index, const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ubv)(GLuint index, const GLubyte *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uivEXT)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uiv)(GLuint index, const GLuint *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4usvEXT)(GLuint index, const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4usv)(GLuint index, const GLushort *v); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribIPointer)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureLayer)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY GLAPI_PREFIX(ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY GLAPI_PREFIX(ColorMaski)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY GLAPI_PREFIX(DisableIndexedEXT)(GLenum target, GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(Disablei)(GLenum target, GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(EnableIndexedEXT)(GLenum target, GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(Enablei)(GLenum target, GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean *data); +GLAPI void APIENTRY GLAPI_PREFIX(GetBooleani_v)(GLenum value, GLuint index, GLboolean *data); +GLAPI void APIENTRY GLAPI_PREFIX(GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint *data); +GLAPI void APIENTRY GLAPI_PREFIX(GetIntegeri_v)(GLenum value, GLuint index, GLint *data); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsEnabledIndexedEXT)(GLenum target, GLuint index); +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsEnabledi)(GLenum target, GLuint index); +GLAPI void APIENTRY GLAPI_PREFIX(ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a); +GLAPI void APIENTRY GLAPI_PREFIX(ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIiv)(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIuiv)(GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIivEXT)(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIiv)(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIuiv)(GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY GLAPI_PREFIX(BeginConditionalRenderNV)(GLuint query, GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(BeginConditionalRender)(GLuint query, GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(EndConditionalRenderNV)(void); +GLAPI void APIENTRY GLAPI_PREFIX(EndConditionalRender)(void); +GLAPI void APIENTRY GLAPI_PREFIX(BeginTransformFeedbackEXT)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(BeginTransformFeedback)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferBase)(GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferRange)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY GLAPI_PREFIX(EndTransformFeedbackEXT)(void); +GLAPI void APIENTRY GLAPI_PREFIX(EndTransformFeedback)(void); +GLAPI void APIENTRY GLAPI_PREFIX(GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY GLAPI_PREFIX(GetTransformFeedbackVarying)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY GLAPI_PREFIX(TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char **varyings, GLenum bufferMode); +GLAPI void APIENTRY GLAPI_PREFIX(TransformFeedbackVaryings)(GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +GLAPI void APIENTRY GLAPI_PREFIX(ProvokingVertexEXT)(GLenum mode); +GLAPI void APIENTRY GLAPI_PREFIX(ProvokingVertex)(GLenum mode); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_935)(GLenum target, GLenum pname, GLvoid **params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_936)(GLenum target, GLsizei length, GLvoid *pointer); +GLAPI void APIENTRY GLAPI_PREFIX(GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint *value); +GLAPI GLenum APIENTRY GLAPI_PREFIX(ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); +GLAPI GLenum APIENTRY GLAPI_PREFIX(ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); +GLAPI void APIENTRY GLAPI_PREFIX(ActiveProgramEXT)(GLuint program); +GLAPI GLuint APIENTRY GLAPI_PREFIX(CreateShaderProgramEXT)(GLenum type, const GLchar *string); +GLAPI void APIENTRY GLAPI_PREFIX(UseShaderProgramEXT)(GLenum type, GLuint program); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_943)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_944)(GLenum target, GLuint index, GLsizei count, const GLfloat *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_945)(GLenum target, GLuint index, GLsizei count, const GLfloat *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_946)(GLuint id, GLenum pname, GLint64EXT *params); +void APIENTRY GLAPI_PREFIX(_dispatch_stub_947)(GLuint id, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY GLAPI_PREFIX(EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid *writeOffset); +GLAPI void APIENTRY GLAPI_PREFIX(EGLImageTargetTexture2DOES)(GLenum target, GLvoid *writeOffset); +#undef MAPI_TMP_DEFINES +#endif /* MAPI_TMP_DEFINES */ + +#ifdef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN +GLAPI void APIENTRY GLAPI_PREFIX(NewList)(GLuint list, GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[0]; + ((void (APIENTRY *)(GLuint list, GLenum mode)) _func)(list, mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EndList)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[1]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CallList)(GLuint list) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[2]; + ((void (APIENTRY *)(GLuint list)) _func)(list); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CallLists)(GLsizei n, GLenum type, const GLvoid *lists) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[3]; + ((void (APIENTRY *)(GLsizei n, GLenum type, const GLvoid *lists)) _func)(n, type, lists); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteLists)(GLuint list, GLsizei range) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[4]; + ((void (APIENTRY *)(GLuint list, GLsizei range)) _func)(list, range); +} + +GLAPI GLuint APIENTRY GLAPI_PREFIX(GenLists)(GLsizei range) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[5]; + return ((GLuint (APIENTRY *)(GLsizei range)) _func)(range); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ListBase)(GLuint base) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[6]; + ((void (APIENTRY *)(GLuint base)) _func)(base); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Begin)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[7]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[8]; + ((void (APIENTRY *)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)) _func)(width, height, xorig, yorig, xmove, ymove, bitmap); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3b)(GLbyte red, GLbyte green, GLbyte blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[9]; + ((void (APIENTRY *)(GLbyte red, GLbyte green, GLbyte blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3bv)(const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[10]; + ((void (APIENTRY *)(const GLbyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3d)(GLdouble red, GLdouble green, GLdouble blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[11]; + ((void (APIENTRY *)(GLdouble red, GLdouble green, GLdouble blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[12]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3f)(GLfloat red, GLfloat green, GLfloat blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[13]; + ((void (APIENTRY *)(GLfloat red, GLfloat green, GLfloat blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[14]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3i)(GLint red, GLint green, GLint blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[15]; + ((void (APIENTRY *)(GLint red, GLint green, GLint blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[16]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3s)(GLshort red, GLshort green, GLshort blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[17]; + ((void (APIENTRY *)(GLshort red, GLshort green, GLshort blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[18]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3ub)(GLubyte red, GLubyte green, GLubyte blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[19]; + ((void (APIENTRY *)(GLubyte red, GLubyte green, GLubyte blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3ubv)(const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[20]; + ((void (APIENTRY *)(const GLubyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3ui)(GLuint red, GLuint green, GLuint blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[21]; + ((void (APIENTRY *)(GLuint red, GLuint green, GLuint blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3uiv)(const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[22]; + ((void (APIENTRY *)(const GLuint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3us)(GLushort red, GLushort green, GLushort blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[23]; + ((void (APIENTRY *)(GLushort red, GLushort green, GLushort blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color3usv)(const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[24]; + ((void (APIENTRY *)(const GLushort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[25]; + ((void (APIENTRY *)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4bv)(const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[26]; + ((void (APIENTRY *)(const GLbyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[27]; + ((void (APIENTRY *)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[28]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[29]; + ((void (APIENTRY *)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[30]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4i)(GLint red, GLint green, GLint blue, GLint alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[31]; + ((void (APIENTRY *)(GLint red, GLint green, GLint blue, GLint alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[32]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[33]; + ((void (APIENTRY *)(GLshort red, GLshort green, GLshort blue, GLshort alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[34]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[35]; + ((void (APIENTRY *)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4ubv)(const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[36]; + ((void (APIENTRY *)(const GLubyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[37]; + ((void (APIENTRY *)(GLuint red, GLuint green, GLuint blue, GLuint alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4uiv)(const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[38]; + ((void (APIENTRY *)(const GLuint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[39]; + ((void (APIENTRY *)(GLushort red, GLushort green, GLushort blue, GLushort alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Color4usv)(const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[40]; + ((void (APIENTRY *)(const GLushort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlag)(GLboolean flag) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[41]; + ((void (APIENTRY *)(GLboolean flag)) _func)(flag); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlagv)(const GLboolean *flag) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[42]; + ((void (APIENTRY *)(const GLboolean *flag)) _func)(flag); +} + +GLAPI void APIENTRY GLAPI_PREFIX(End)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[43]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexd)(GLdouble c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[44]; + ((void (APIENTRY *)(GLdouble c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexdv)(const GLdouble *c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[45]; + ((void (APIENTRY *)(const GLdouble *c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexf)(GLfloat c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[46]; + ((void (APIENTRY *)(GLfloat c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexfv)(const GLfloat *c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[47]; + ((void (APIENTRY *)(const GLfloat *c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexi)(GLint c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[48]; + ((void (APIENTRY *)(GLint c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexiv)(const GLint *c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[49]; + ((void (APIENTRY *)(const GLint *c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexs)(GLshort c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[50]; + ((void (APIENTRY *)(GLshort c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexsv)(const GLshort *c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[51]; + ((void (APIENTRY *)(const GLshort *c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[52]; + ((void (APIENTRY *)(GLbyte nx, GLbyte ny, GLbyte nz)) _func)(nx, ny, nz); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3bv)(const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[53]; + ((void (APIENTRY *)(const GLbyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[54]; + ((void (APIENTRY *)(GLdouble nx, GLdouble ny, GLdouble nz)) _func)(nx, ny, nz); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[55]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[56]; + ((void (APIENTRY *)(GLfloat nx, GLfloat ny, GLfloat nz)) _func)(nx, ny, nz); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[57]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3i)(GLint nx, GLint ny, GLint nz) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[58]; + ((void (APIENTRY *)(GLint nx, GLint ny, GLint nz)) _func)(nx, ny, nz); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[59]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3s)(GLshort nx, GLshort ny, GLshort nz) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[60]; + ((void (APIENTRY *)(GLshort nx, GLshort ny, GLshort nz)) _func)(nx, ny, nz); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Normal3sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[61]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2d)(GLdouble x, GLdouble y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[62]; + ((void (APIENTRY *)(GLdouble x, GLdouble y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[63]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2f)(GLfloat x, GLfloat y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[64]; + ((void (APIENTRY *)(GLfloat x, GLfloat y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[65]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2i)(GLint x, GLint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[66]; + ((void (APIENTRY *)(GLint x, GLint y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[67]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2s)(GLshort x, GLshort y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[68]; + ((void (APIENTRY *)(GLshort x, GLshort y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos2sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[69]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3d)(GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[70]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[71]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3f)(GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[72]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[73]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3i)(GLint x, GLint y, GLint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[74]; + ((void (APIENTRY *)(GLint x, GLint y, GLint z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[75]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3s)(GLshort x, GLshort y, GLshort z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[76]; + ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos3sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[77]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[78]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[79]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[80]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[81]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4i)(GLint x, GLint y, GLint z, GLint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[82]; + ((void (APIENTRY *)(GLint x, GLint y, GLint z, GLint w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[83]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[84]; + ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z, GLshort w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RasterPos4sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[85]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[86]; + ((void (APIENTRY *)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)) _func)(x1, y1, x2, y2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rectdv)(const GLdouble *v1, const GLdouble *v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[87]; + ((void (APIENTRY *)(const GLdouble *v1, const GLdouble *v2)) _func)(v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[88]; + ((void (APIENTRY *)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)) _func)(x1, y1, x2, y2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rectfv)(const GLfloat *v1, const GLfloat *v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[89]; + ((void (APIENTRY *)(const GLfloat *v1, const GLfloat *v2)) _func)(v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Recti)(GLint x1, GLint y1, GLint x2, GLint y2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[90]; + ((void (APIENTRY *)(GLint x1, GLint y1, GLint x2, GLint y2)) _func)(x1, y1, x2, y2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rectiv)(const GLint *v1, const GLint *v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[91]; + ((void (APIENTRY *)(const GLint *v1, const GLint *v2)) _func)(v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[92]; + ((void (APIENTRY *)(GLshort x1, GLshort y1, GLshort x2, GLshort y2)) _func)(x1, y1, x2, y2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rectsv)(const GLshort *v1, const GLshort *v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[93]; + ((void (APIENTRY *)(const GLshort *v1, const GLshort *v2)) _func)(v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1d)(GLdouble s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[94]; + ((void (APIENTRY *)(GLdouble s)) _func)(s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[95]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1f)(GLfloat s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[96]; + ((void (APIENTRY *)(GLfloat s)) _func)(s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[97]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1i)(GLint s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[98]; + ((void (APIENTRY *)(GLint s)) _func)(s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[99]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1s)(GLshort s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[100]; + ((void (APIENTRY *)(GLshort s)) _func)(s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord1sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[101]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2d)(GLdouble s, GLdouble t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[102]; + ((void (APIENTRY *)(GLdouble s, GLdouble t)) _func)(s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[103]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2f)(GLfloat s, GLfloat t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[104]; + ((void (APIENTRY *)(GLfloat s, GLfloat t)) _func)(s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[105]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2i)(GLint s, GLint t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[106]; + ((void (APIENTRY *)(GLint s, GLint t)) _func)(s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[107]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2s)(GLshort s, GLshort t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[108]; + ((void (APIENTRY *)(GLshort s, GLshort t)) _func)(s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord2sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[109]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[110]; + ((void (APIENTRY *)(GLdouble s, GLdouble t, GLdouble r)) _func)(s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[111]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[112]; + ((void (APIENTRY *)(GLfloat s, GLfloat t, GLfloat r)) _func)(s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[113]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3i)(GLint s, GLint t, GLint r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[114]; + ((void (APIENTRY *)(GLint s, GLint t, GLint r)) _func)(s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[115]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3s)(GLshort s, GLshort t, GLshort r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[116]; + ((void (APIENTRY *)(GLshort s, GLshort t, GLshort r)) _func)(s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord3sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[117]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[118]; + ((void (APIENTRY *)(GLdouble s, GLdouble t, GLdouble r, GLdouble q)) _func)(s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[119]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[120]; + ((void (APIENTRY *)(GLfloat s, GLfloat t, GLfloat r, GLfloat q)) _func)(s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[121]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4i)(GLint s, GLint t, GLint r, GLint q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[122]; + ((void (APIENTRY *)(GLint s, GLint t, GLint r, GLint q)) _func)(s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[123]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[124]; + ((void (APIENTRY *)(GLshort s, GLshort t, GLshort r, GLshort q)) _func)(s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoord4sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[125]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2d)(GLdouble x, GLdouble y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[126]; + ((void (APIENTRY *)(GLdouble x, GLdouble y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[127]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2f)(GLfloat x, GLfloat y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[128]; + ((void (APIENTRY *)(GLfloat x, GLfloat y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[129]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2i)(GLint x, GLint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[130]; + ((void (APIENTRY *)(GLint x, GLint y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[131]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2s)(GLshort x, GLshort y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[132]; + ((void (APIENTRY *)(GLshort x, GLshort y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex2sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[133]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3d)(GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[134]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[135]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[136]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[137]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3i)(GLint x, GLint y, GLint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[138]; + ((void (APIENTRY *)(GLint x, GLint y, GLint z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[139]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3s)(GLshort x, GLshort y, GLshort z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[140]; + ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex3sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[141]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[142]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[143]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[144]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[145]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4i)(GLint x, GLint y, GLint z, GLint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[146]; + ((void (APIENTRY *)(GLint x, GLint y, GLint z, GLint w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[147]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[148]; + ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z, GLshort w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Vertex4sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[149]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClipPlane)(GLenum plane, const GLdouble *equation) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[150]; + ((void (APIENTRY *)(GLenum plane, const GLdouble *equation)) _func)(plane, equation); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorMaterial)(GLenum face, GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[151]; + ((void (APIENTRY *)(GLenum face, GLenum mode)) _func)(face, mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CullFace)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[152]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Fogf)(GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[153]; + ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Fogfv)(GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[154]; + ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Fogi)(GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[155]; + ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Fogiv)(GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[156]; + ((void (APIENTRY *)(GLenum pname, const GLint *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FrontFace)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[157]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Hint)(GLenum target, GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[158]; + ((void (APIENTRY *)(GLenum target, GLenum mode)) _func)(target, mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Lightf)(GLenum light, GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[159]; + ((void (APIENTRY *)(GLenum light, GLenum pname, GLfloat param)) _func)(light, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Lightfv)(GLenum light, GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[160]; + ((void (APIENTRY *)(GLenum light, GLenum pname, const GLfloat *params)) _func)(light, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Lighti)(GLenum light, GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[161]; + ((void (APIENTRY *)(GLenum light, GLenum pname, GLint param)) _func)(light, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Lightiv)(GLenum light, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[162]; + ((void (APIENTRY *)(GLenum light, GLenum pname, const GLint *params)) _func)(light, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LightModelf)(GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[163]; + ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LightModelfv)(GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[164]; + ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LightModeli)(GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[165]; + ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LightModeliv)(GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[166]; + ((void (APIENTRY *)(GLenum pname, const GLint *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LineStipple)(GLint factor, GLushort pattern) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[167]; + ((void (APIENTRY *)(GLint factor, GLushort pattern)) _func)(factor, pattern); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LineWidth)(GLfloat width) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[168]; + ((void (APIENTRY *)(GLfloat width)) _func)(width); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Materialf)(GLenum face, GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[169]; + ((void (APIENTRY *)(GLenum face, GLenum pname, GLfloat param)) _func)(face, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Materialfv)(GLenum face, GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[170]; + ((void (APIENTRY *)(GLenum face, GLenum pname, const GLfloat *params)) _func)(face, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Materiali)(GLenum face, GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[171]; + ((void (APIENTRY *)(GLenum face, GLenum pname, GLint param)) _func)(face, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Materialiv)(GLenum face, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[172]; + ((void (APIENTRY *)(GLenum face, GLenum pname, const GLint *params)) _func)(face, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointSize)(GLfloat size) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[173]; + ((void (APIENTRY *)(GLfloat size)) _func)(size); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PolygonMode)(GLenum face, GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[174]; + ((void (APIENTRY *)(GLenum face, GLenum mode)) _func)(face, mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PolygonStipple)(const GLubyte *mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[175]; + ((void (APIENTRY *)(const GLubyte *mask)) _func)(mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[176]; + ((void (APIENTRY *)(GLint x, GLint y, GLsizei width, GLsizei height)) _func)(x, y, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ShadeModel)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[177]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterf)(GLenum target, GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[178]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat param)) _func)(target, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[179]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexParameteri)(GLenum target, GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[180]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint param)) _func)(target, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexParameteriv)(GLenum target, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[181]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[182]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, internalformat, width, border, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[183]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, internalformat, width, height, border, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexEnvf)(GLenum target, GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[184]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat param)) _func)(target, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[185]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexEnvi)(GLenum target, GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[186]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint param)) _func)(target, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexEnviv)(GLenum target, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[187]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexGend)(GLenum coord, GLenum pname, GLdouble param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[188]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, GLdouble param)) _func)(coord, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexGendv)(GLenum coord, GLenum pname, const GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[189]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, const GLdouble *params)) _func)(coord, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexGenf)(GLenum coord, GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[190]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, GLfloat param)) _func)(coord, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexGenfv)(GLenum coord, GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[191]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, const GLfloat *params)) _func)(coord, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexGeni)(GLenum coord, GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[192]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, GLint param)) _func)(coord, pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexGeniv)(GLenum coord, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[193]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, const GLint *params)) _func)(coord, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[194]; + ((void (APIENTRY *)(GLsizei size, GLenum type, GLfloat *buffer)) _func)(size, type, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SelectBuffer)(GLsizei size, GLuint *buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[195]; + ((void (APIENTRY *)(GLsizei size, GLuint *buffer)) _func)(size, buffer); +} + +GLAPI GLint APIENTRY GLAPI_PREFIX(RenderMode)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[196]; + return ((GLint (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(InitNames)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[197]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadName)(GLuint name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[198]; + ((void (APIENTRY *)(GLuint name)) _func)(name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PassThrough)(GLfloat token) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[199]; + ((void (APIENTRY *)(GLfloat token)) _func)(token); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PopName)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[200]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PushName)(GLuint name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[201]; + ((void (APIENTRY *)(GLuint name)) _func)(name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawBuffer)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[202]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Clear)(GLbitfield mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[203]; + ((void (APIENTRY *)(GLbitfield mask)) _func)(mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[204]; + ((void (APIENTRY *)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearIndex)(GLfloat c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[205]; + ((void (APIENTRY *)(GLfloat c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[206]; + ((void (APIENTRY *)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearStencil)(GLint s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[207]; + ((void (APIENTRY *)(GLint s)) _func)(s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearDepth)(GLclampd depth) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[208]; + ((void (APIENTRY *)(GLclampd depth)) _func)(depth); +} + +GLAPI void APIENTRY GLAPI_PREFIX(StencilMask)(GLuint mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[209]; + ((void (APIENTRY *)(GLuint mask)) _func)(mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[210]; + ((void (APIENTRY *)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DepthMask)(GLboolean flag) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[211]; + ((void (APIENTRY *)(GLboolean flag)) _func)(flag); +} + +GLAPI void APIENTRY GLAPI_PREFIX(IndexMask)(GLuint mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[212]; + ((void (APIENTRY *)(GLuint mask)) _func)(mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Accum)(GLenum op, GLfloat value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[213]; + ((void (APIENTRY *)(GLenum op, GLfloat value)) _func)(op, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Disable)(GLenum cap) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[214]; + ((void (APIENTRY *)(GLenum cap)) _func)(cap); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Enable)(GLenum cap) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[215]; + ((void (APIENTRY *)(GLenum cap)) _func)(cap); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Finish)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[216]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Flush)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[217]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PopAttrib)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[218]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PushAttrib)(GLbitfield mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[219]; + ((void (APIENTRY *)(GLbitfield mask)) _func)(mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[220]; + ((void (APIENTRY *)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)) _func)(target, u1, u2, stride, order, points); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[221]; + ((void (APIENTRY *)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)) _func)(target, u1, u2, stride, order, points); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[222]; + ((void (APIENTRY *)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)) _func)(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[223]; + ((void (APIENTRY *)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)) _func)(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MapGrid1d)(GLint un, GLdouble u1, GLdouble u2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[224]; + ((void (APIENTRY *)(GLint un, GLdouble u1, GLdouble u2)) _func)(un, u1, u2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MapGrid1f)(GLint un, GLfloat u1, GLfloat u2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[225]; + ((void (APIENTRY *)(GLint un, GLfloat u1, GLfloat u2)) _func)(un, u1, u2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[226]; + ((void (APIENTRY *)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)) _func)(un, u1, u2, vn, v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[227]; + ((void (APIENTRY *)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)) _func)(un, u1, u2, vn, v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord1d)(GLdouble u) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[228]; + ((void (APIENTRY *)(GLdouble u)) _func)(u); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord1dv)(const GLdouble *u) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[229]; + ((void (APIENTRY *)(const GLdouble *u)) _func)(u); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord1f)(GLfloat u) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[230]; + ((void (APIENTRY *)(GLfloat u)) _func)(u); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord1fv)(const GLfloat *u) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[231]; + ((void (APIENTRY *)(const GLfloat *u)) _func)(u); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord2d)(GLdouble u, GLdouble v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[232]; + ((void (APIENTRY *)(GLdouble u, GLdouble v)) _func)(u, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord2dv)(const GLdouble *u) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[233]; + ((void (APIENTRY *)(const GLdouble *u)) _func)(u); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord2f)(GLfloat u, GLfloat v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[234]; + ((void (APIENTRY *)(GLfloat u, GLfloat v)) _func)(u, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalCoord2fv)(const GLfloat *u) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[235]; + ((void (APIENTRY *)(const GLfloat *u)) _func)(u); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalMesh1)(GLenum mode, GLint i1, GLint i2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[236]; + ((void (APIENTRY *)(GLenum mode, GLint i1, GLint i2)) _func)(mode, i1, i2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalPoint1)(GLint i) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[237]; + ((void (APIENTRY *)(GLint i)) _func)(i); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[238]; + ((void (APIENTRY *)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)) _func)(mode, i1, i2, j1, j2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EvalPoint2)(GLint i, GLint j) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[239]; + ((void (APIENTRY *)(GLint i, GLint j)) _func)(i, j); +} + +GLAPI void APIENTRY GLAPI_PREFIX(AlphaFunc)(GLenum func, GLclampf ref) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[240]; + ((void (APIENTRY *)(GLenum func, GLclampf ref)) _func)(func, ref); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendFunc)(GLenum sfactor, GLenum dfactor) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[241]; + ((void (APIENTRY *)(GLenum sfactor, GLenum dfactor)) _func)(sfactor, dfactor); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LogicOp)(GLenum opcode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[242]; + ((void (APIENTRY *)(GLenum opcode)) _func)(opcode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(StencilFunc)(GLenum func, GLint ref, GLuint mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[243]; + ((void (APIENTRY *)(GLenum func, GLint ref, GLuint mask)) _func)(func, ref, mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[244]; + ((void (APIENTRY *)(GLenum fail, GLenum zfail, GLenum zpass)) _func)(fail, zfail, zpass); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DepthFunc)(GLenum func) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[245]; + ((void (APIENTRY *)(GLenum func)) _func)(func); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PixelZoom)(GLfloat xfactor, GLfloat yfactor) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[246]; + ((void (APIENTRY *)(GLfloat xfactor, GLfloat yfactor)) _func)(xfactor, yfactor); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PixelTransferf)(GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[247]; + ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PixelTransferi)(GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[248]; + ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PixelStoref)(GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[249]; + ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PixelStorei)(GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[250]; + ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[251]; + ((void (APIENTRY *)(GLenum map, GLsizei mapsize, const GLfloat *values)) _func)(map, mapsize, values); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[252]; + ((void (APIENTRY *)(GLenum map, GLsizei mapsize, const GLuint *values)) _func)(map, mapsize, values); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[253]; + ((void (APIENTRY *)(GLenum map, GLsizei mapsize, const GLushort *values)) _func)(map, mapsize, values); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ReadBuffer)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[254]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[255]; + ((void (APIENTRY *)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)) _func)(x, y, width, height, type); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[256]; + ((void (APIENTRY *)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)) _func)(x, y, width, height, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[257]; + ((void (APIENTRY *)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) _func)(width, height, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBooleanv)(GLenum pname, GLboolean *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[258]; + ((void (APIENTRY *)(GLenum pname, GLboolean *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetClipPlane)(GLenum plane, GLdouble *equation) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[259]; + ((void (APIENTRY *)(GLenum plane, GLdouble *equation)) _func)(plane, equation); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetDoublev)(GLenum pname, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[260]; + ((void (APIENTRY *)(GLenum pname, GLdouble *params)) _func)(pname, params); +} + +GLAPI GLenum APIENTRY GLAPI_PREFIX(GetError)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[261]; + return ((GLenum (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetFloatv)(GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[262]; + ((void (APIENTRY *)(GLenum pname, GLfloat *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetIntegerv)(GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[263]; + ((void (APIENTRY *)(GLenum pname, GLint *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetLightfv)(GLenum light, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[264]; + ((void (APIENTRY *)(GLenum light, GLenum pname, GLfloat *params)) _func)(light, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetLightiv)(GLenum light, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[265]; + ((void (APIENTRY *)(GLenum light, GLenum pname, GLint *params)) _func)(light, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetMapdv)(GLenum target, GLenum query, GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[266]; + ((void (APIENTRY *)(GLenum target, GLenum query, GLdouble *v)) _func)(target, query, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetMapfv)(GLenum target, GLenum query, GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[267]; + ((void (APIENTRY *)(GLenum target, GLenum query, GLfloat *v)) _func)(target, query, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetMapiv)(GLenum target, GLenum query, GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[268]; + ((void (APIENTRY *)(GLenum target, GLenum query, GLint *v)) _func)(target, query, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[269]; + ((void (APIENTRY *)(GLenum face, GLenum pname, GLfloat *params)) _func)(face, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetMaterialiv)(GLenum face, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[270]; + ((void (APIENTRY *)(GLenum face, GLenum pname, GLint *params)) _func)(face, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetPixelMapfv)(GLenum map, GLfloat *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[271]; + ((void (APIENTRY *)(GLenum map, GLfloat *values)) _func)(map, values); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetPixelMapuiv)(GLenum map, GLuint *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[272]; + ((void (APIENTRY *)(GLenum map, GLuint *values)) _func)(map, values); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetPixelMapusv)(GLenum map, GLushort *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[273]; + ((void (APIENTRY *)(GLenum map, GLushort *values)) _func)(map, values); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetPolygonStipple)(GLubyte *mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[274]; + ((void (APIENTRY *)(GLubyte *mask)) _func)(mask); +} + +GLAPI const GLubyte * APIENTRY GLAPI_PREFIX(GetString)(GLenum name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[275]; + return ((const GLubyte * (APIENTRY *)(GLenum name)) _func)(name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[276]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexEnviv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[277]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexGendv)(GLenum coord, GLenum pname, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[278]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, GLdouble *params)) _func)(coord, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexGenfv)(GLenum coord, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[279]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, GLfloat *params)) _func)(coord, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexGeniv)(GLenum coord, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[280]; + ((void (APIENTRY *)(GLenum coord, GLenum pname, GLint *params)) _func)(coord, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[281]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)) _func)(target, level, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[282]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameteriv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[283]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[284]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum pname, GLfloat *params)) _func)(target, level, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[285]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum pname, GLint *params)) _func)(target, level, pname, params); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsEnabled)(GLenum cap) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[286]; + return ((GLboolean (APIENTRY *)(GLenum cap)) _func)(cap); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsList)(GLuint list) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[287]; + return ((GLboolean (APIENTRY *)(GLuint list)) _func)(list); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DepthRange)(GLclampd zNear, GLclampd zFar) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[288]; + ((void (APIENTRY *)(GLclampd zNear, GLclampd zFar)) _func)(zNear, zFar); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[289]; + ((void (APIENTRY *)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) _func)(left, right, bottom, top, zNear, zFar); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadIdentity)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[290]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadMatrixf)(const GLfloat *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[291]; + ((void (APIENTRY *)(const GLfloat *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadMatrixd)(const GLdouble *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[292]; + ((void (APIENTRY *)(const GLdouble *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MatrixMode)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[293]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultMatrixf)(const GLfloat *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[294]; + ((void (APIENTRY *)(const GLfloat *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultMatrixd)(const GLdouble *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[295]; + ((void (APIENTRY *)(const GLdouble *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[296]; + ((void (APIENTRY *)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) _func)(left, right, bottom, top, zNear, zFar); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PopMatrix)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[297]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PushMatrix)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[298]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[299]; + ((void (APIENTRY *)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)) _func)(angle, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[300]; + ((void (APIENTRY *)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)) _func)(angle, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Scaled)(GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[301]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Scalef)(GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[302]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Translated)(GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[303]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Translatef)(GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[304]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[305]; + ((void (APIENTRY *)(GLint x, GLint y, GLsizei width, GLsizei height)) _func)(x, y, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ArrayElement)(GLint i) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[306]; + ((void (APIENTRY *)(GLint i)) _func)(i); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ArrayElementEXT)(GLint i) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[306]; + ((void (APIENTRY *)(GLint i)) _func)(i); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindTexture)(GLenum target, GLuint texture) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[307]; + ((void (APIENTRY *)(GLenum target, GLuint texture)) _func)(target, texture); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindTextureEXT)(GLenum target, GLuint texture) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[307]; + ((void (APIENTRY *)(GLenum target, GLuint texture)) _func)(target, texture); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[308]; + ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(size, type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DisableClientState)(GLenum array) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[309]; + ((void (APIENTRY *)(GLenum array)) _func)(array); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawArrays)(GLenum mode, GLint first, GLsizei count) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[310]; + ((void (APIENTRY *)(GLenum mode, GLint first, GLsizei count)) _func)(mode, first, count); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[310]; + ((void (APIENTRY *)(GLenum mode, GLint first, GLsizei count)) _func)(mode, first, count); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[311]; + ((void (APIENTRY *)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)) _func)(mode, count, type, indices); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlagPointer)(GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[312]; + ((void (APIENTRY *)(GLsizei stride, const GLvoid *pointer)) _func)(stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EnableClientState)(GLenum array) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[313]; + ((void (APIENTRY *)(GLenum array)) _func)(array); +} + +GLAPI void APIENTRY GLAPI_PREFIX(IndexPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[314]; + ((void (APIENTRY *)(GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexub)(GLubyte c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[315]; + ((void (APIENTRY *)(GLubyte c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Indexubv)(const GLubyte *c) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[316]; + ((void (APIENTRY *)(const GLubyte *c)) _func)(c); +} + +GLAPI void APIENTRY GLAPI_PREFIX(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[317]; + ((void (APIENTRY *)(GLenum format, GLsizei stride, const GLvoid *pointer)) _func)(format, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(NormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[318]; + ((void (APIENTRY *)(GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PolygonOffset)(GLfloat factor, GLfloat units) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[319]; + ((void (APIENTRY *)(GLfloat factor, GLfloat units)) _func)(factor, units); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[320]; + ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(size, type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[321]; + ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(size, type, stride, pointer); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(AreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[322]; + return ((GLboolean (APIENTRY *)(GLsizei n, const GLuint *textures, GLboolean *residences)) _func)(n, textures, residences); +} + +#if 0 +GLAPI GLboolean APIENTRY GLAPI_PREFIX(AreTexturesResidentEXT)(GLsizei n, const GLuint *textures, GLboolean *residences) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[322]; + return ((GLboolean (APIENTRY *)(GLsizei n, const GLuint *textures, GLboolean *residences)) _func)(n, textures, residences); +} +#endif + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[323]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)) _func)(target, level, internalformat, x, y, width, border); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[323]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)) _func)(target, level, internalformat, x, y, width, border); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[324]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) _func)(target, level, internalformat, x, y, width, height, border); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[324]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) _func)(target, level, internalformat, x, y, width, height, border); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[325]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)) _func)(target, level, xoffset, x, y, width); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[325]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)) _func)(target, level, xoffset, x, y, width); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[326]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) _func)(target, level, xoffset, yoffset, x, y, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[326]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) _func)(target, level, xoffset, yoffset, x, y, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteTextures)(GLsizei n, const GLuint *textures) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[327]; + ((void (APIENTRY *)(GLsizei n, const GLuint *textures)) _func)(n, textures); +} + +#if 0 +GLAPI void APIENTRY GLAPI_PREFIX(DeleteTexturesEXT)(GLsizei n, const GLuint *textures) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[327]; + ((void (APIENTRY *)(GLsizei n, const GLuint *textures)) _func)(n, textures); +} +#endif + +GLAPI void APIENTRY GLAPI_PREFIX(GenTextures)(GLsizei n, GLuint *textures) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[328]; + ((void (APIENTRY *)(GLsizei n, GLuint *textures)) _func)(n, textures); +} + +#if 0 +GLAPI void APIENTRY GLAPI_PREFIX(GenTexturesEXT)(GLsizei n, GLuint *textures) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[328]; + ((void (APIENTRY *)(GLsizei n, GLuint *textures)) _func)(n, textures); +} +#endif + +GLAPI void APIENTRY GLAPI_PREFIX(GetPointerv)(GLenum pname, GLvoid **params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[329]; + ((void (APIENTRY *)(GLenum pname, GLvoid **params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetPointervEXT)(GLenum pname, GLvoid **params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[329]; + ((void (APIENTRY *)(GLenum pname, GLvoid **params)) _func)(pname, params); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsTexture)(GLuint texture) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[330]; + return ((GLboolean (APIENTRY *)(GLuint texture)) _func)(texture); +} + +#if 0 +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsTextureEXT)(GLuint texture) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[330]; + return ((GLboolean (APIENTRY *)(GLuint texture)) _func)(texture); +} +#endif + +GLAPI void APIENTRY GLAPI_PREFIX(PrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[331]; + ((void (APIENTRY *)(GLsizei n, const GLuint *textures, const GLclampf *priorities)) _func)(n, textures, priorities); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PrioritizeTexturesEXT)(GLsizei n, const GLuint *textures, const GLclampf *priorities) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[331]; + ((void (APIENTRY *)(GLsizei n, const GLuint *textures, const GLclampf *priorities)) _func)(n, textures, priorities); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[332]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, xoffset, width, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[332]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, xoffset, width, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[333]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, xoffset, yoffset, width, height, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[333]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, xoffset, yoffset, width, height, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PopClientAttrib)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[334]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PushClientAttrib)(GLbitfield mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[335]; + ((void (APIENTRY *)(GLbitfield mask)) _func)(mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[336]; + ((void (APIENTRY *)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[336]; + ((void (APIENTRY *)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) _func)(red, green, blue, alpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquation)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[337]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationEXT)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[337]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[338]; + ((void (APIENTRY *)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)) _func)(mode, start, end, count, type, indices); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[338]; + ((void (APIENTRY *)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)) _func)(mode, start, end, count, type, indices); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[339]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)) _func)(target, internalformat, width, format, type, table); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorTableEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[339]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)) _func)(target, internalformat, width, format, type, table); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[340]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[341]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[342]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)) _func)(target, internalformat, x, y, width); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid *table) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[343]; + ((void (APIENTRY *)(GLenum target, GLenum format, GLenum type, GLvoid *table)) _func)(target, format, type, table); +} + +#if 0 +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid *table) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[343]; + ((void (APIENTRY *)(GLenum target, GLenum format, GLenum type, GLvoid *table)) _func)(target, format, type, table); +} +#endif + +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[344]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat *params)) _func)(target, pname, params); +} + +#if 0 +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[344]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat *params)) _func)(target, pname, params); +} +#endif + +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[345]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +#if 0 +GLAPI void APIENTRY GLAPI_PREFIX(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[345]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} +#endif + +GLAPI void APIENTRY GLAPI_PREFIX(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[346]; + ((void (APIENTRY *)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)) _func)(target, start, count, format, type, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[347]; + ((void (APIENTRY *)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)) _func)(target, start, x, y, width); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[348]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)) _func)(target, internalformat, width, format, type, image); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[349]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)) _func)(target, internalformat, width, height, format, type, image); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[350]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[351]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[352]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[353]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[354]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)) _func)(target, internalformat, x, y, width); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[355]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)) _func)(target, internalformat, x, y, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid *image) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[356]; + ((void (APIENTRY *)(GLenum target, GLenum format, GLenum type, GLvoid *image)) _func)(target, format, type, image); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[357]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[358]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[359]; + ((void (APIENTRY *)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)) _func)(target, format, type, row, column, span); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[360]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)) _func)(target, internalformat, width, height, format, type, row, column); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[361]; + ((void (APIENTRY *)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)) _func)(target, reset, format, type, values); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[362]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[363]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[364]; + ((void (APIENTRY *)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)) _func)(target, reset, format, type, values); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[365]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLfloat *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[366]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[367]; + ((void (APIENTRY *)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)) _func)(target, width, internalformat, sink); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Minmax)(GLenum target, GLenum internalformat, GLboolean sink) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[368]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLboolean sink)) _func)(target, internalformat, sink); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ResetHistogram)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[369]; + ((void (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ResetMinmax)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[370]; + ((void (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[371]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, internalformat, width, height, depth, border, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexImage3DEXT)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[371]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, internalformat, width, height, depth, border, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[372]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[372]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)) _func)(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[373]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)) _func)(target, level, xoffset, yoffset, zoffset, x, y, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[373]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)) _func)(target, level, xoffset, yoffset, zoffset, x, y, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ActiveTextureARB)(GLenum texture) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[374]; + ((void (APIENTRY *)(GLenum texture)) _func)(texture); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ActiveTexture)(GLenum texture) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[374]; + ((void (APIENTRY *)(GLenum texture)) _func)(texture); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClientActiveTextureARB)(GLenum texture) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[375]; + ((void (APIENTRY *)(GLenum texture)) _func)(texture); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClientActiveTexture)(GLenum texture) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[375]; + ((void (APIENTRY *)(GLenum texture)) _func)(texture); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1dARB)(GLenum target, GLdouble s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[376]; + ((void (APIENTRY *)(GLenum target, GLdouble s)) _func)(target, s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1d)(GLenum target, GLdouble s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[376]; + ((void (APIENTRY *)(GLenum target, GLdouble s)) _func)(target, s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1dvARB)(GLenum target, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[377]; + ((void (APIENTRY *)(GLenum target, const GLdouble *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1dv)(GLenum target, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[377]; + ((void (APIENTRY *)(GLenum target, const GLdouble *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1fARB)(GLenum target, GLfloat s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[378]; + ((void (APIENTRY *)(GLenum target, GLfloat s)) _func)(target, s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1f)(GLenum target, GLfloat s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[378]; + ((void (APIENTRY *)(GLenum target, GLfloat s)) _func)(target, s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1fvARB)(GLenum target, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[379]; + ((void (APIENTRY *)(GLenum target, const GLfloat *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1fv)(GLenum target, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[379]; + ((void (APIENTRY *)(GLenum target, const GLfloat *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1iARB)(GLenum target, GLint s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[380]; + ((void (APIENTRY *)(GLenum target, GLint s)) _func)(target, s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1i)(GLenum target, GLint s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[380]; + ((void (APIENTRY *)(GLenum target, GLint s)) _func)(target, s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1ivARB)(GLenum target, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[381]; + ((void (APIENTRY *)(GLenum target, const GLint *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1iv)(GLenum target, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[381]; + ((void (APIENTRY *)(GLenum target, const GLint *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1sARB)(GLenum target, GLshort s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[382]; + ((void (APIENTRY *)(GLenum target, GLshort s)) _func)(target, s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1s)(GLenum target, GLshort s) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[382]; + ((void (APIENTRY *)(GLenum target, GLshort s)) _func)(target, s); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1svARB)(GLenum target, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[383]; + ((void (APIENTRY *)(GLenum target, const GLshort *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord1sv)(GLenum target, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[383]; + ((void (APIENTRY *)(GLenum target, const GLshort *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[384]; + ((void (APIENTRY *)(GLenum target, GLdouble s, GLdouble t)) _func)(target, s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2d)(GLenum target, GLdouble s, GLdouble t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[384]; + ((void (APIENTRY *)(GLenum target, GLdouble s, GLdouble t)) _func)(target, s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2dvARB)(GLenum target, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[385]; + ((void (APIENTRY *)(GLenum target, const GLdouble *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2dv)(GLenum target, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[385]; + ((void (APIENTRY *)(GLenum target, const GLdouble *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[386]; + ((void (APIENTRY *)(GLenum target, GLfloat s, GLfloat t)) _func)(target, s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2f)(GLenum target, GLfloat s, GLfloat t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[386]; + ((void (APIENTRY *)(GLenum target, GLfloat s, GLfloat t)) _func)(target, s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2fvARB)(GLenum target, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[387]; + ((void (APIENTRY *)(GLenum target, const GLfloat *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2fv)(GLenum target, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[387]; + ((void (APIENTRY *)(GLenum target, const GLfloat *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[388]; + ((void (APIENTRY *)(GLenum target, GLint s, GLint t)) _func)(target, s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2i)(GLenum target, GLint s, GLint t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[388]; + ((void (APIENTRY *)(GLenum target, GLint s, GLint t)) _func)(target, s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2ivARB)(GLenum target, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[389]; + ((void (APIENTRY *)(GLenum target, const GLint *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2iv)(GLenum target, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[389]; + ((void (APIENTRY *)(GLenum target, const GLint *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[390]; + ((void (APIENTRY *)(GLenum target, GLshort s, GLshort t)) _func)(target, s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2s)(GLenum target, GLshort s, GLshort t) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[390]; + ((void (APIENTRY *)(GLenum target, GLshort s, GLshort t)) _func)(target, s, t); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2svARB)(GLenum target, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[391]; + ((void (APIENTRY *)(GLenum target, const GLshort *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord2sv)(GLenum target, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[391]; + ((void (APIENTRY *)(GLenum target, const GLshort *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[392]; + ((void (APIENTRY *)(GLenum target, GLdouble s, GLdouble t, GLdouble r)) _func)(target, s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3d)(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[392]; + ((void (APIENTRY *)(GLenum target, GLdouble s, GLdouble t, GLdouble r)) _func)(target, s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3dvARB)(GLenum target, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[393]; + ((void (APIENTRY *)(GLenum target, const GLdouble *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3dv)(GLenum target, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[393]; + ((void (APIENTRY *)(GLenum target, const GLdouble *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[394]; + ((void (APIENTRY *)(GLenum target, GLfloat s, GLfloat t, GLfloat r)) _func)(target, s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3f)(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[394]; + ((void (APIENTRY *)(GLenum target, GLfloat s, GLfloat t, GLfloat r)) _func)(target, s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3fvARB)(GLenum target, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[395]; + ((void (APIENTRY *)(GLenum target, const GLfloat *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3fv)(GLenum target, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[395]; + ((void (APIENTRY *)(GLenum target, const GLfloat *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[396]; + ((void (APIENTRY *)(GLenum target, GLint s, GLint t, GLint r)) _func)(target, s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3i)(GLenum target, GLint s, GLint t, GLint r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[396]; + ((void (APIENTRY *)(GLenum target, GLint s, GLint t, GLint r)) _func)(target, s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3ivARB)(GLenum target, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[397]; + ((void (APIENTRY *)(GLenum target, const GLint *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3iv)(GLenum target, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[397]; + ((void (APIENTRY *)(GLenum target, const GLint *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[398]; + ((void (APIENTRY *)(GLenum target, GLshort s, GLshort t, GLshort r)) _func)(target, s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3s)(GLenum target, GLshort s, GLshort t, GLshort r) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[398]; + ((void (APIENTRY *)(GLenum target, GLshort s, GLshort t, GLshort r)) _func)(target, s, t, r); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3svARB)(GLenum target, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[399]; + ((void (APIENTRY *)(GLenum target, const GLshort *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord3sv)(GLenum target, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[399]; + ((void (APIENTRY *)(GLenum target, const GLshort *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[400]; + ((void (APIENTRY *)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)) _func)(target, s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4d)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[400]; + ((void (APIENTRY *)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)) _func)(target, s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4dvARB)(GLenum target, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[401]; + ((void (APIENTRY *)(GLenum target, const GLdouble *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4dv)(GLenum target, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[401]; + ((void (APIENTRY *)(GLenum target, const GLdouble *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[402]; + ((void (APIENTRY *)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)) _func)(target, s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[402]; + ((void (APIENTRY *)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)) _func)(target, s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4fvARB)(GLenum target, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[403]; + ((void (APIENTRY *)(GLenum target, const GLfloat *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4fv)(GLenum target, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[403]; + ((void (APIENTRY *)(GLenum target, const GLfloat *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[404]; + ((void (APIENTRY *)(GLenum target, GLint s, GLint t, GLint r, GLint q)) _func)(target, s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4i)(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[404]; + ((void (APIENTRY *)(GLenum target, GLint s, GLint t, GLint r, GLint q)) _func)(target, s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4ivARB)(GLenum target, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[405]; + ((void (APIENTRY *)(GLenum target, const GLint *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4iv)(GLenum target, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[405]; + ((void (APIENTRY *)(GLenum target, const GLint *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[406]; + ((void (APIENTRY *)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)) _func)(target, s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4s)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[406]; + ((void (APIENTRY *)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)) _func)(target, s, t, r, q); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4svARB)(GLenum target, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[407]; + ((void (APIENTRY *)(GLenum target, const GLshort *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiTexCoord4sv)(GLenum target, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[407]; + ((void (APIENTRY *)(GLenum target, const GLshort *v)) _func)(target, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(AttachShader)(GLuint program, GLuint shader) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[408]; + ((void (APIENTRY *)(GLuint program, GLuint shader)) _func)(program, shader); +} + +GLAPI GLuint APIENTRY GLAPI_PREFIX(CreateProgram)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[409]; + return ((GLuint (APIENTRY *)(void)) _func)(); +} + +GLAPI GLuint APIENTRY GLAPI_PREFIX(CreateShader)(GLenum type) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[410]; + return ((GLuint (APIENTRY *)(GLenum type)) _func)(type); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteProgram)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[411]; + ((void (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteShader)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[412]; + ((void (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DetachShader)(GLuint program, GLuint shader) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[413]; + ((void (APIENTRY *)(GLuint program, GLuint shader)) _func)(program, shader); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[414]; + ((void (APIENTRY *)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)) _func)(program, maxCount, count, obj); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[415]; + ((void (APIENTRY *)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)) _func)(program, bufSize, length, infoLog); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramiv)(GLuint program, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[416]; + ((void (APIENTRY *)(GLuint program, GLenum pname, GLint *params)) _func)(program, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[417]; + ((void (APIENTRY *)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)) _func)(shader, bufSize, length, infoLog); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderiv)(GLuint shader, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[418]; + ((void (APIENTRY *)(GLuint shader, GLenum pname, GLint *params)) _func)(shader, pname, params); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsProgram)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[419]; + return ((GLboolean (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsShader)(GLuint shader) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[420]; + return ((GLboolean (APIENTRY *)(GLuint shader)) _func)(shader); +} + +GLAPI void APIENTRY GLAPI_PREFIX(StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[421]; + ((void (APIENTRY *)(GLenum face, GLenum func, GLint ref, GLuint mask)) _func)(face, func, ref, mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(StencilMaskSeparate)(GLenum face, GLuint mask) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[422]; + ((void (APIENTRY *)(GLenum face, GLuint mask)) _func)(face, mask); +} + +GLAPI void APIENTRY GLAPI_PREFIX(StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[423]; + ((void (APIENTRY *)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)) _func)(face, sfail, zfail, zpass); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[424]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[425]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[426]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[427]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[428]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[429]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClampColor)(GLenum target, GLenum clamp) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[430]; + ((void (APIENTRY *)(GLenum target, GLenum clamp)) _func)(target, clamp); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfi)(GLenum buffer, GLint drawbuffer, const GLfloat depth, const GLint stencil) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[431]; + ((void (APIENTRY *)(GLenum buffer, GLint drawbuffer, const GLfloat depth, const GLint stencil)) _func)(buffer, drawbuffer, depth, stencil); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[432]; + ((void (APIENTRY *)(GLenum buffer, GLint drawbuffer, const GLfloat *value)) _func)(buffer, drawbuffer, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[433]; + ((void (APIENTRY *)(GLenum buffer, GLint drawbuffer, const GLint *value)) _func)(buffer, drawbuffer, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[434]; + ((void (APIENTRY *)(GLenum buffer, GLint drawbuffer, const GLuint *value)) _func)(buffer, drawbuffer, value); +} + +GLAPI const GLubyte * APIENTRY GLAPI_PREFIX(GetStringi)(GLenum name, GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[435]; + return ((const GLubyte * (APIENTRY *)(GLenum name, GLuint index)) _func)(name, index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexBuffer)(GLenum target, GLenum internalFormat, GLuint buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[436]; + ((void (APIENTRY *)(GLenum target, GLenum internalFormat, GLuint buffer)) _func)(target, internalFormat, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture)(GLenum target, GLenum attachment, GLuint texture, GLint level) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[437]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLuint texture, GLint level)) _func)(target, attachment, texture, level); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferParameteri64v)(GLenum target, GLenum pname, GLint64 *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[438]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint64 *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetInteger64i_v)(GLenum cap, GLuint index, GLint64 *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[439]; + ((void (APIENTRY *)(GLenum cap, GLuint index, GLint64 *data)) _func)(cap, index, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribDivisor)(GLuint index, GLuint divisor) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[440]; + ((void (APIENTRY *)(GLuint index, GLuint divisor)) _func)(index, divisor); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadTransposeMatrixdARB)(const GLdouble *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[441]; + ((void (APIENTRY *)(const GLdouble *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadTransposeMatrixd)(const GLdouble *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[441]; + ((void (APIENTRY *)(const GLdouble *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadTransposeMatrixfARB)(const GLfloat *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[442]; + ((void (APIENTRY *)(const GLfloat *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadTransposeMatrixf)(const GLfloat *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[442]; + ((void (APIENTRY *)(const GLfloat *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultTransposeMatrixdARB)(const GLdouble *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[443]; + ((void (APIENTRY *)(const GLdouble *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultTransposeMatrixd)(const GLdouble *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[443]; + ((void (APIENTRY *)(const GLdouble *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultTransposeMatrixfARB)(const GLfloat *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[444]; + ((void (APIENTRY *)(const GLfloat *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultTransposeMatrixf)(const GLfloat *m) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[444]; + ((void (APIENTRY *)(const GLfloat *m)) _func)(m); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SampleCoverageARB)(GLclampf value, GLboolean invert) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[445]; + ((void (APIENTRY *)(GLclampf value, GLboolean invert)) _func)(value, invert); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SampleCoverage)(GLclampf value, GLboolean invert) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[445]; + ((void (APIENTRY *)(GLclampf value, GLboolean invert)) _func)(value, invert); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[446]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)) _func)(target, level, internalformat, width, border, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[446]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)) _func)(target, level, internalformat, width, border, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[447]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)) _func)(target, level, internalformat, width, height, border, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[447]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)) _func)(target, level, internalformat, width, height, border, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[448]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)) _func)(target, level, internalformat, width, height, depth, border, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[448]; + ((void (APIENTRY *)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)) _func)(target, level, internalformat, width, height, depth, border, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[449]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)) _func)(target, level, xoffset, width, format, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[449]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)) _func)(target, level, xoffset, width, format, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[450]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)) _func)(target, level, xoffset, yoffset, width, height, format, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[450]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)) _func)(target, level, xoffset, yoffset, width, height, format, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[451]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)) _func)(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[451]; + ((void (APIENTRY *)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)) _func)(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid *img) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[452]; + ((void (APIENTRY *)(GLenum target, GLint level, GLvoid *img)) _func)(target, level, img); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetCompressedTexImage)(GLenum target, GLint level, GLvoid *img) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[452]; + ((void (APIENTRY *)(GLenum target, GLint level, GLvoid *img)) _func)(target, level, img); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DisableVertexAttribArrayARB)(GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[453]; + ((void (APIENTRY *)(GLuint index)) _func)(index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DisableVertexAttribArray)(GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[453]; + ((void (APIENTRY *)(GLuint index)) _func)(index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EnableVertexAttribArrayARB)(GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[454]; + ((void (APIENTRY *)(GLuint index)) _func)(index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EnableVertexAttribArray)(GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[454]; + ((void (APIENTRY *)(GLuint index)) _func)(index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[455]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLdouble *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[456]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLfloat *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[457]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLdouble *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[458]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLfloat *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramStringARB)(GLenum target, GLenum pname, GLvoid *string) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[459]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLvoid *string)) _func)(target, pname, string); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramivARB)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[460]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[461]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLdouble *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribdv)(GLuint index, GLenum pname, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[461]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLdouble *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[462]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLfloat *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribfv)(GLuint index, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[462]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLfloat *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribivARB)(GLuint index, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[463]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLint *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribiv)(GLuint index, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[463]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLint *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[464]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(target, index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[464]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(target, index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[465]; + ((void (APIENTRY *)(GLenum target, GLuint index, const GLdouble *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[465]; + ((void (APIENTRY *)(GLenum target, GLuint index, const GLdouble *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[466]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(target, index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[466]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(target, index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[467]; + ((void (APIENTRY *)(GLenum target, GLuint index, const GLfloat *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[467]; + ((void (APIENTRY *)(GLenum target, GLuint index, const GLfloat *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[468]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(target, index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[469]; + ((void (APIENTRY *)(GLenum target, GLuint index, const GLdouble *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[470]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(target, index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[471]; + ((void (APIENTRY *)(GLenum target, GLuint index, const GLfloat *params)) _func)(target, index, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid *string) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[472]; + ((void (APIENTRY *)(GLenum target, GLenum format, GLsizei len, const GLvoid *string)) _func)(target, format, len, string); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dARB)(GLuint index, GLdouble x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[473]; + ((void (APIENTRY *)(GLuint index, GLdouble x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1d)(GLuint index, GLdouble x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[473]; + ((void (APIENTRY *)(GLuint index, GLdouble x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dvARB)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[474]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dv)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[474]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fARB)(GLuint index, GLfloat x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[475]; + ((void (APIENTRY *)(GLuint index, GLfloat x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1f)(GLuint index, GLfloat x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[475]; + ((void (APIENTRY *)(GLuint index, GLfloat x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fvARB)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[476]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fv)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[476]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1sARB)(GLuint index, GLshort x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[477]; + ((void (APIENTRY *)(GLuint index, GLshort x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1s)(GLuint index, GLshort x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[477]; + ((void (APIENTRY *)(GLuint index, GLshort x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1svARB)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[478]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1sv)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[478]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[479]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2d)(GLuint index, GLdouble x, GLdouble y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[479]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dvARB)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[480]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dv)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[480]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[481]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2f)(GLuint index, GLfloat x, GLfloat y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[481]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fvARB)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[482]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fv)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[482]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[483]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2s)(GLuint index, GLshort x, GLshort y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[483]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2svARB)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[484]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2sv)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[484]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[485]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y, GLdouble z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3d)(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[485]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y, GLdouble z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dvARB)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[486]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dv)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[486]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[487]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y, GLfloat z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3f)(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[487]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y, GLfloat z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fvARB)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[488]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fv)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[488]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[489]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y, GLshort z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3s)(GLuint index, GLshort x, GLshort y, GLshort z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[489]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y, GLshort z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3svARB)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[490]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3sv)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[490]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NbvARB)(GLuint index, const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[491]; + ((void (APIENTRY *)(GLuint index, const GLbyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nbv)(GLuint index, const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[491]; + ((void (APIENTRY *)(GLuint index, const GLbyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NivARB)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[492]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Niv)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[492]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NsvARB)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[493]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nsv)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[493]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[494]; + ((void (APIENTRY *)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nub)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[494]; + ((void (APIENTRY *)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NubvARB)(GLuint index, const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[495]; + ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nubv)(GLuint index, const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[495]; + ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NuivARB)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[496]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nuiv)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[496]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4NusvARB)(GLuint index, const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[497]; + ((void (APIENTRY *)(GLuint index, const GLushort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4Nusv)(GLuint index, const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[497]; + ((void (APIENTRY *)(GLuint index, const GLushort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4bvARB)(GLuint index, const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[498]; + ((void (APIENTRY *)(GLuint index, const GLbyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4bv)(GLuint index, const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[498]; + ((void (APIENTRY *)(GLuint index, const GLbyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[499]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4d)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[499]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dvARB)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[500]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dv)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[500]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[501]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4f)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[501]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fvARB)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[502]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fv)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[502]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ivARB)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[503]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4iv)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[503]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[504]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4s)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[504]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4svARB)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[505]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4sv)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[505]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubvARB)(GLuint index, const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[506]; + ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubv)(GLuint index, const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[506]; + ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4uivARB)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[507]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4uiv)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[507]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4usvARB)(GLuint index, const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[508]; + ((void (APIENTRY *)(GLuint index, const GLushort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4usv)(GLuint index, const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[508]; + ((void (APIENTRY *)(GLuint index, const GLushort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[509]; + ((void (APIENTRY *)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)) _func)(index, size, type, normalized, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[509]; + ((void (APIENTRY *)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)) _func)(index, size, type, normalized, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferARB)(GLenum target, GLuint buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[510]; + ((void (APIENTRY *)(GLenum target, GLuint buffer)) _func)(target, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindBuffer)(GLenum target, GLuint buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[510]; + ((void (APIENTRY *)(GLenum target, GLuint buffer)) _func)(target, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[511]; + ((void (APIENTRY *)(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage)) _func)(target, size, data, usage); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BufferData)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[511]; + ((void (APIENTRY *)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)) _func)(target, size, data, usage); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[512]; + ((void (APIENTRY *)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data)) _func)(target, offset, size, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[512]; + ((void (APIENTRY *)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)) _func)(target, offset, size, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteBuffersARB)(GLsizei n, const GLuint *buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[513]; + ((void (APIENTRY *)(GLsizei n, const GLuint *buffer)) _func)(n, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteBuffers)(GLsizei n, const GLuint *buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[513]; + ((void (APIENTRY *)(GLsizei n, const GLuint *buffer)) _func)(n, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenBuffersARB)(GLsizei n, GLuint *buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[514]; + ((void (APIENTRY *)(GLsizei n, GLuint *buffer)) _func)(n, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenBuffers)(GLsizei n, GLuint *buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[514]; + ((void (APIENTRY *)(GLsizei n, GLuint *buffer)) _func)(n, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferParameterivARB)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[515]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[515]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid **params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[516]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLvoid **params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferPointerv)(GLenum target, GLenum pname, GLvoid **params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[516]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLvoid **params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[517]; + ((void (APIENTRY *)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data)) _func)(target, offset, size, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[517]; + ((void (APIENTRY *)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)) _func)(target, offset, size, data); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsBufferARB)(GLuint buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[518]; + return ((GLboolean (APIENTRY *)(GLuint buffer)) _func)(buffer); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsBuffer)(GLuint buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[518]; + return ((GLboolean (APIENTRY *)(GLuint buffer)) _func)(buffer); +} + +GLAPI GLvoid * APIENTRY GLAPI_PREFIX(MapBufferARB)(GLenum target, GLenum access) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[519]; + return ((GLvoid * (APIENTRY *)(GLenum target, GLenum access)) _func)(target, access); +} + +GLAPI GLvoid * APIENTRY GLAPI_PREFIX(MapBuffer)(GLenum target, GLenum access) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[519]; + return ((GLvoid * (APIENTRY *)(GLenum target, GLenum access)) _func)(target, access); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(UnmapBufferARB)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[520]; + return ((GLboolean (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(UnmapBuffer)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[520]; + return ((GLboolean (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BeginQueryARB)(GLenum target, GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[521]; + ((void (APIENTRY *)(GLenum target, GLuint id)) _func)(target, id); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BeginQuery)(GLenum target, GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[521]; + ((void (APIENTRY *)(GLenum target, GLuint id)) _func)(target, id); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteQueriesARB)(GLsizei n, const GLuint *ids) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[522]; + ((void (APIENTRY *)(GLsizei n, const GLuint *ids)) _func)(n, ids); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteQueries)(GLsizei n, const GLuint *ids) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[522]; + ((void (APIENTRY *)(GLsizei n, const GLuint *ids)) _func)(n, ids); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EndQueryARB)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[523]; + ((void (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EndQuery)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[523]; + ((void (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenQueriesARB)(GLsizei n, GLuint *ids) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[524]; + ((void (APIENTRY *)(GLsizei n, GLuint *ids)) _func)(n, ids); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenQueries)(GLsizei n, GLuint *ids) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[524]; + ((void (APIENTRY *)(GLsizei n, GLuint *ids)) _func)(n, ids); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[525]; + ((void (APIENTRY *)(GLuint id, GLenum pname, GLint *params)) _func)(id, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryObjectiv)(GLuint id, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[525]; + ((void (APIENTRY *)(GLuint id, GLenum pname, GLint *params)) _func)(id, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[526]; + ((void (APIENTRY *)(GLuint id, GLenum pname, GLuint *params)) _func)(id, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryObjectuiv)(GLuint id, GLenum pname, GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[526]; + ((void (APIENTRY *)(GLuint id, GLenum pname, GLuint *params)) _func)(id, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryivARB)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[527]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetQueryiv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[527]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsQueryARB)(GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[528]; + return ((GLboolean (APIENTRY *)(GLuint id)) _func)(id); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsQuery)(GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[528]; + return ((GLboolean (APIENTRY *)(GLuint id)) _func)(id); +} + +GLAPI void APIENTRY GLAPI_PREFIX(AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[529]; + ((void (APIENTRY *)(GLhandleARB containerObj, GLhandleARB obj)) _func)(containerObj, obj); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompileShaderARB)(GLhandleARB shader) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[530]; + ((void (APIENTRY *)(GLhandleARB shader)) _func)(shader); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CompileShader)(GLuint shader) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[530]; + ((void (APIENTRY *)(GLuint shader)) _func)(shader); +} + +GLAPI GLhandleARB APIENTRY GLAPI_PREFIX(CreateProgramObjectARB)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[531]; + return ((GLhandleARB (APIENTRY *)(void)) _func)(); +} + +GLAPI GLhandleARB APIENTRY GLAPI_PREFIX(CreateShaderObjectARB)(GLenum shaderType) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[532]; + return ((GLhandleARB (APIENTRY *)(GLenum shaderType)) _func)(shaderType); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteObjectARB)(GLhandleARB obj) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[533]; + ((void (APIENTRY *)(GLhandleARB obj)) _func)(obj); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[534]; + ((void (APIENTRY *)(GLhandleARB containerObj, GLhandleARB attachedObj)) _func)(containerObj, attachedObj); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetActiveUniformARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[535]; + ((void (APIENTRY *)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name)) _func)(program, index, bufSize, length, size, type, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetActiveUniform)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[535]; + ((void (APIENTRY *)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) _func)(program, index, bufSize, length, size, type, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei *length, GLhandleARB *infoLog) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[536]; + ((void (APIENTRY *)(GLhandleARB containerObj, GLsizei maxLength, GLsizei *length, GLhandleARB *infoLog)) _func)(containerObj, maxLength, length, infoLog); +} + +GLAPI GLhandleARB APIENTRY GLAPI_PREFIX(GetHandleARB)(GLenum pname) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[537]; + return ((GLhandleARB (APIENTRY *)(GLenum pname)) _func)(pname); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[538]; + ((void (APIENTRY *)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog)) _func)(obj, maxLength, length, infoLog); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[539]; + ((void (APIENTRY *)(GLhandleARB obj, GLenum pname, GLfloat *params)) _func)(obj, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[540]; + ((void (APIENTRY *)(GLhandleARB obj, GLenum pname, GLint *params)) _func)(obj, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderSourceARB)(GLhandleARB shader, GLsizei bufSize, GLsizei *length, GLcharARB *source) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[541]; + ((void (APIENTRY *)(GLhandleARB shader, GLsizei bufSize, GLsizei *length, GLcharARB *source)) _func)(shader, bufSize, length, source); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderSource)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[541]; + ((void (APIENTRY *)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)) _func)(shader, bufSize, length, source); +} + +GLAPI GLint APIENTRY GLAPI_PREFIX(GetUniformLocationARB)(GLhandleARB program, const GLcharARB *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[542]; + return ((GLint (APIENTRY *)(GLhandleARB program, const GLcharARB *name)) _func)(program, name); +} + +GLAPI GLint APIENTRY GLAPI_PREFIX(GetUniformLocation)(GLuint program, const GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[542]; + return ((GLint (APIENTRY *)(GLuint program, const GLchar *name)) _func)(program, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformfvARB)(GLhandleARB program, GLint location, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[543]; + ((void (APIENTRY *)(GLhandleARB program, GLint location, GLfloat *params)) _func)(program, location, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformfv)(GLuint program, GLint location, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[543]; + ((void (APIENTRY *)(GLuint program, GLint location, GLfloat *params)) _func)(program, location, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformivARB)(GLhandleARB program, GLint location, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[544]; + ((void (APIENTRY *)(GLhandleARB program, GLint location, GLint *params)) _func)(program, location, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformiv)(GLuint program, GLint location, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[544]; + ((void (APIENTRY *)(GLuint program, GLint location, GLint *params)) _func)(program, location, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LinkProgramARB)(GLhandleARB program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[545]; + ((void (APIENTRY *)(GLhandleARB program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LinkProgram)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[545]; + ((void (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ShaderSourceARB)(GLhandleARB shader, GLsizei count, const GLcharARB **string, const GLint *length) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[546]; + ((void (APIENTRY *)(GLhandleARB shader, GLsizei count, const GLcharARB **string, const GLint *length)) _func)(shader, count, string, length); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ShaderSource)(GLuint shader, GLsizei count, const GLchar **string, const GLint *length) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[546]; + ((void (APIENTRY *)(GLuint shader, GLsizei count, const GLchar **string, const GLint *length)) _func)(shader, count, string, length); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1fARB)(GLint location, GLfloat v0) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[547]; + ((void (APIENTRY *)(GLint location, GLfloat v0)) _func)(location, v0); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1f)(GLint location, GLfloat v0) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[547]; + ((void (APIENTRY *)(GLint location, GLfloat v0)) _func)(location, v0); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1fvARB)(GLint location, GLsizei count, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[548]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLfloat *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1fv)(GLint location, GLsizei count, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[548]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLfloat *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1iARB)(GLint location, GLint v0) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[549]; + ((void (APIENTRY *)(GLint location, GLint v0)) _func)(location, v0); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1i)(GLint location, GLint v0) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[549]; + ((void (APIENTRY *)(GLint location, GLint v0)) _func)(location, v0); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1ivARB)(GLint location, GLsizei count, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[550]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1iv)(GLint location, GLsizei count, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[550]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[551]; + ((void (APIENTRY *)(GLint location, GLfloat v0, GLfloat v1)) _func)(location, v0, v1); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2f)(GLint location, GLfloat v0, GLfloat v1) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[551]; + ((void (APIENTRY *)(GLint location, GLfloat v0, GLfloat v1)) _func)(location, v0, v1); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2fvARB)(GLint location, GLsizei count, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[552]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLfloat *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2fv)(GLint location, GLsizei count, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[552]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLfloat *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2iARB)(GLint location, GLint v0, GLint v1) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[553]; + ((void (APIENTRY *)(GLint location, GLint v0, GLint v1)) _func)(location, v0, v1); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2i)(GLint location, GLint v0, GLint v1) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[553]; + ((void (APIENTRY *)(GLint location, GLint v0, GLint v1)) _func)(location, v0, v1); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2ivARB)(GLint location, GLsizei count, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[554]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2iv)(GLint location, GLsizei count, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[554]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[555]; + ((void (APIENTRY *)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)) _func)(location, v0, v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[555]; + ((void (APIENTRY *)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)) _func)(location, v0, v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3fvARB)(GLint location, GLsizei count, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[556]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLfloat *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3fv)(GLint location, GLsizei count, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[556]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLfloat *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[557]; + ((void (APIENTRY *)(GLint location, GLint v0, GLint v1, GLint v2)) _func)(location, v0, v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3i)(GLint location, GLint v0, GLint v1, GLint v2) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[557]; + ((void (APIENTRY *)(GLint location, GLint v0, GLint v1, GLint v2)) _func)(location, v0, v1, v2); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3ivARB)(GLint location, GLsizei count, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[558]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3iv)(GLint location, GLsizei count, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[558]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[559]; + ((void (APIENTRY *)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)) _func)(location, v0, v1, v2, v3); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[559]; + ((void (APIENTRY *)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)) _func)(location, v0, v1, v2, v3); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4fvARB)(GLint location, GLsizei count, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[560]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLfloat *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4fv)(GLint location, GLsizei count, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[560]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLfloat *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[561]; + ((void (APIENTRY *)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)) _func)(location, v0, v1, v2, v3); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[561]; + ((void (APIENTRY *)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)) _func)(location, v0, v1, v2, v3); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4ivARB)(GLint location, GLsizei count, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[562]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4iv)(GLint location, GLsizei count, const GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[562]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[563]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[563]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[564]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[564]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[565]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[565]; + ((void (APIENTRY *)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) _func)(location, count, transpose, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UseProgramObjectARB)(GLhandleARB program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[566]; + ((void (APIENTRY *)(GLhandleARB program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UseProgram)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[566]; + ((void (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ValidateProgramARB)(GLhandleARB program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[567]; + ((void (APIENTRY *)(GLhandleARB program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ValidateProgram)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[567]; + ((void (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindAttribLocationARB)(GLhandleARB program, GLuint index, const GLcharARB *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[568]; + ((void (APIENTRY *)(GLhandleARB program, GLuint index, const GLcharARB *name)) _func)(program, index, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindAttribLocation)(GLuint program, GLuint index, const GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[568]; + ((void (APIENTRY *)(GLuint program, GLuint index, const GLchar *name)) _func)(program, index, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetActiveAttribARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[569]; + ((void (APIENTRY *)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name)) _func)(program, index, bufSize, length, size, type, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetActiveAttrib)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[569]; + ((void (APIENTRY *)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) _func)(program, index, bufSize, length, size, type, name); +} + +GLAPI GLint APIENTRY GLAPI_PREFIX(GetAttribLocationARB)(GLhandleARB program, const GLcharARB *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[570]; + return ((GLint (APIENTRY *)(GLhandleARB program, const GLcharARB *name)) _func)(program, name); +} + +GLAPI GLint APIENTRY GLAPI_PREFIX(GetAttribLocation)(GLuint program, const GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[570]; + return ((GLint (APIENTRY *)(GLuint program, const GLchar *name)) _func)(program, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawBuffersARB)(GLsizei n, const GLenum *bufs) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[571]; + ((void (APIENTRY *)(GLsizei n, const GLenum *bufs)) _func)(n, bufs); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawBuffers)(GLsizei n, const GLenum *bufs) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[571]; + ((void (APIENTRY *)(GLsizei n, const GLenum *bufs)) _func)(n, bufs); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawBuffersATI)(GLsizei n, const GLenum *bufs) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[571]; + ((void (APIENTRY *)(GLsizei n, const GLenum *bufs)) _func)(n, bufs); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawArraysInstancedARB)(GLenum mode, GLint first, GLsizei count, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[572]; + ((void (APIENTRY *)(GLenum mode, GLint first, GLsizei count, GLsizei primcount)) _func)(mode, first, count, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawArraysInstanced)(GLenum mode, GLint first, GLsizei count, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[572]; + ((void (APIENTRY *)(GLenum mode, GLint first, GLsizei count, GLsizei primcount)) _func)(mode, first, count, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawArraysInstancedEXT)(GLenum mode, GLint first, GLsizei count, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[572]; + ((void (APIENTRY *)(GLenum mode, GLint first, GLsizei count, GLsizei primcount)) _func)(mode, first, count, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawElementsInstancedARB)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[573]; + ((void (APIENTRY *)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount)) _func)(mode, count, type, indices, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawElementsInstanced)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[573]; + ((void (APIENTRY *)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount)) _func)(mode, count, type, indices, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawElementsInstancedEXT)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[573]; + ((void (APIENTRY *)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount)) _func)(mode, count, type, indices, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[574]; + ((void (APIENTRY *)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)) _func)(target, samples, internalformat, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[574]; + ((void (APIENTRY *)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)) _func)(target, samples, internalformat, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureARB)(GLenum target, GLenum attachment, GLuint texture, GLint level) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[575]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLuint texture, GLint level)) _func)(target, attachment, texture, level); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureFaceARB)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[576]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face)) _func)(target, attachment, texture, level, face); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameteriARB)(GLuint program, GLenum pname, GLint value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[577]; + ((void (APIENTRY *)(GLuint program, GLenum pname, GLint value)) _func)(program, pname, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribDivisorARB)(GLuint index, GLuint divisor) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[578]; + ((void (APIENTRY *)(GLuint index, GLuint divisor)) _func)(index, divisor); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[579]; + ((void (APIENTRY *)(GLenum target, GLintptr offset, GLsizeiptr length)) _func)(target, offset, length); +} + +GLAPI GLvoid * APIENTRY GLAPI_PREFIX(MapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[580]; + return ((GLvoid * (APIENTRY *)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)) _func)(target, offset, length, access); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindVertexArray)(GLuint array) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[581]; + ((void (APIENTRY *)(GLuint array)) _func)(array); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenVertexArrays)(GLsizei n, GLuint *arrays) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[582]; + ((void (APIENTRY *)(GLsizei n, GLuint *arrays)) _func)(n, arrays); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[583]; + ((void (APIENTRY *)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)) _func)(readTarget, writeTarget, readOffset, writeOffset, size); +} + +GLAPI GLenum APIENTRY GLAPI_PREFIX(ClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[584]; + return ((GLenum (APIENTRY *)(GLsync sync, GLbitfield flags, GLuint64 timeout)) _func)(sync, flags, timeout); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteSync)(GLsync sync) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[585]; + ((void (APIENTRY *)(GLsync sync)) _func)(sync); +} + +GLAPI GLsync APIENTRY GLAPI_PREFIX(FenceSync)(GLenum condition, GLbitfield flags) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[586]; + return ((GLsync (APIENTRY *)(GLenum condition, GLbitfield flags)) _func)(condition, flags); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetInteger64v)(GLenum pname, GLint64 *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[587]; + ((void (APIENTRY *)(GLenum pname, GLint64 *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[588]; + ((void (APIENTRY *)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)) _func)(sync, pname, bufSize, length, values); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsSync)(GLsync sync) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[589]; + return ((GLboolean (APIENTRY *)(GLsync sync)) _func)(sync); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[590]; + ((void (APIENTRY *)(GLsync sync, GLbitfield flags, GLuint64 timeout)) _func)(sync, flags, timeout); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawElementsBaseVertex)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[591]; + ((void (APIENTRY *)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)) _func)(mode, count, type, indices, basevertex); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawRangeElementsBaseVertex)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[592]; + ((void (APIENTRY *)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)) _func)(mode, start, end, count, type, indices, basevertex); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawElementsBaseVertex)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, const GLint *basevertex) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[593]; + ((void (APIENTRY *)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, const GLint *basevertex)) _func)(mode, count, type, indices, primcount, basevertex); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationSeparateiARB)(GLuint buf, GLenum modeRGB, GLenum modeA) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[594]; + ((void (APIENTRY *)(GLuint buf, GLenum modeRGB, GLenum modeA)) _func)(buf, modeRGB, modeA); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationiARB)(GLuint buf, GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[595]; + ((void (APIENTRY *)(GLuint buf, GLenum mode)) _func)(buf, mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparateiARB)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcA, GLenum dstA) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[596]; + ((void (APIENTRY *)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcA, GLenum dstA)) _func)(buf, srcRGB, dstRGB, srcA, dstA); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendFunciARB)(GLuint buf, GLenum src, GLenum dst) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[597]; + ((void (APIENTRY *)(GLuint buf, GLenum src, GLenum dst)) _func)(buf, src, dst); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindTransformFeedback)(GLenum target, GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[598]; + ((void (APIENTRY *)(GLenum target, GLuint id)) _func)(target, id); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteTransformFeedbacks)(GLsizei n, const GLuint *ids) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[599]; + ((void (APIENTRY *)(GLsizei n, const GLuint *ids)) _func)(n, ids); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DrawTransformFeedback)(GLenum mode, GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[600]; + ((void (APIENTRY *)(GLenum mode, GLuint id)) _func)(mode, id); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenTransformFeedbacks)(GLsizei n, GLuint *ids) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[601]; + ((void (APIENTRY *)(GLsizei n, GLuint *ids)) _func)(n, ids); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsTransformFeedback)(GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[602]; + return ((GLboolean (APIENTRY *)(GLuint id)) _func)(id); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PauseTransformFeedback)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[603]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ResumeTransformFeedback)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[604]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearDepthf)(GLclampf depth) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[605]; + ((void (APIENTRY *)(GLclampf depth)) _func)(depth); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DepthRangef)(GLclampf zNear, GLclampf zFar) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[606]; + ((void (APIENTRY *)(GLclampf zNear, GLclampf zFar)) _func)(zNear, zFar); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[607]; + ((void (APIENTRY *)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)) _func)(shadertype, precisiontype, range, precision); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ReleaseShaderCompiler)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[608]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ShaderBinary)(GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[609]; + ((void (APIENTRY *)(GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)) _func)(n, shaders, binaryformat, binary, length); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[613]; + ((void (APIENTRY *)(GLfloat factor, GLfloat bias)) _func)(factor, bias); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[632]; + ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(size, type, stride, count, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[633]; + ((void (APIENTRY *)(GLsizei stride, GLsizei count, const GLboolean *pointer)) _func)(stride, count, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[634]; + ((void (APIENTRY *)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(type, stride, count, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[635]; + ((void (APIENTRY *)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(type, stride, count, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[636]; + ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(size, type, stride, count, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[637]; + ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)) _func)(size, type, stride, count, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfEXT)(GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[638]; + ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterf)(GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[638]; + ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfARB)(GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[638]; + ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfvEXT)(GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[639]; + ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfv)(GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[639]; + ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterfvARB)(GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[639]; + ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LockArraysEXT)(GLint first, GLsizei count) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[640]; + ((void (APIENTRY *)(GLint first, GLsizei count)) _func)(first, count); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UnlockArraysEXT)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[641]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[642]; + ((void (APIENTRY *)(GLbyte red, GLbyte green, GLbyte blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[642]; + ((void (APIENTRY *)(GLbyte red, GLbyte green, GLbyte blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bvEXT)(const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[643]; + ((void (APIENTRY *)(const GLbyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3bv)(const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[643]; + ((void (APIENTRY *)(const GLbyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[644]; + ((void (APIENTRY *)(GLdouble red, GLdouble green, GLdouble blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3d)(GLdouble red, GLdouble green, GLdouble blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[644]; + ((void (APIENTRY *)(GLdouble red, GLdouble green, GLdouble blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dvEXT)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[645]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[645]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[646]; + ((void (APIENTRY *)(GLfloat red, GLfloat green, GLfloat blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3f)(GLfloat red, GLfloat green, GLfloat blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[646]; + ((void (APIENTRY *)(GLfloat red, GLfloat green, GLfloat blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fvEXT)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[647]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[647]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[648]; + ((void (APIENTRY *)(GLint red, GLint green, GLint blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3i)(GLint red, GLint green, GLint blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[648]; + ((void (APIENTRY *)(GLint red, GLint green, GLint blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ivEXT)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[649]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[649]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[650]; + ((void (APIENTRY *)(GLshort red, GLshort green, GLshort blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3s)(GLshort red, GLshort green, GLshort blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[650]; + ((void (APIENTRY *)(GLshort red, GLshort green, GLshort blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3svEXT)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[651]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[651]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[652]; + ((void (APIENTRY *)(GLubyte red, GLubyte green, GLubyte blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ub)(GLubyte red, GLubyte green, GLubyte blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[652]; + ((void (APIENTRY *)(GLubyte red, GLubyte green, GLubyte blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubvEXT)(const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[653]; + ((void (APIENTRY *)(const GLubyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ubv)(const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[653]; + ((void (APIENTRY *)(const GLubyte *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[654]; + ((void (APIENTRY *)(GLuint red, GLuint green, GLuint blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3ui)(GLuint red, GLuint green, GLuint blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[654]; + ((void (APIENTRY *)(GLuint red, GLuint green, GLuint blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uivEXT)(const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[655]; + ((void (APIENTRY *)(const GLuint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3uiv)(const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[655]; + ((void (APIENTRY *)(const GLuint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[656]; + ((void (APIENTRY *)(GLushort red, GLushort green, GLushort blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3us)(GLushort red, GLushort green, GLushort blue) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[656]; + ((void (APIENTRY *)(GLushort red, GLushort green, GLushort blue)) _func)(red, green, blue); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usvEXT)(const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[657]; + ((void (APIENTRY *)(const GLushort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColor3usv)(const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[657]; + ((void (APIENTRY *)(const GLushort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[658]; + ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(size, type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SecondaryColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[658]; + ((void (APIENTRY *)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(size, type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawArraysEXT)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[659]; + ((void (APIENTRY *)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)) _func)(mode, first, count, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawArrays)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[659]; + ((void (APIENTRY *)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)) _func)(mode, first, count, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawElementsEXT)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[660]; + ((void (APIENTRY *)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)) _func)(mode, count, type, indices, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(MultiDrawElements)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[660]; + ((void (APIENTRY *)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)) _func)(mode, count, type, indices, primcount); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[661]; + ((void (APIENTRY *)(GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[661]; + ((void (APIENTRY *)(GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddEXT)(GLdouble coord) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[662]; + ((void (APIENTRY *)(GLdouble coord)) _func)(coord); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordd)(GLdouble coord) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[662]; + ((void (APIENTRY *)(GLdouble coord)) _func)(coord); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddvEXT)(const GLdouble *coord) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[663]; + ((void (APIENTRY *)(const GLdouble *coord)) _func)(coord); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoorddv)(const GLdouble *coord) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[663]; + ((void (APIENTRY *)(const GLdouble *coord)) _func)(coord); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfEXT)(GLfloat coord) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[664]; + ((void (APIENTRY *)(GLfloat coord)) _func)(coord); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordf)(GLfloat coord) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[664]; + ((void (APIENTRY *)(GLfloat coord)) _func)(coord); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfvEXT)(const GLfloat *coord) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[665]; + ((void (APIENTRY *)(const GLfloat *coord)) _func)(coord); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FogCoordfv)(const GLfloat *coord) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[665]; + ((void (APIENTRY *)(const GLfloat *coord)) _func)(coord); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[667]; + ((void (APIENTRY *)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)) _func)(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[667]; + ((void (APIENTRY *)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)) _func)(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FlushVertexArrayRangeNV)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[668]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexArrayRangeNV)(GLsizei length, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[669]; + ((void (APIENTRY *)(GLsizei length, const GLvoid *pointer)) _func)(length, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[670]; + ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)) _func)(stage, portion, variable, input, mapping, componentUsage); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[671]; + ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum)) _func)(stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterfNV)(GLenum pname, GLfloat param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[672]; + ((void (APIENTRY *)(GLenum pname, GLfloat param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterfvNV)(GLenum pname, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[673]; + ((void (APIENTRY *)(GLenum pname, const GLfloat *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameteriNV)(GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[674]; + ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(CombinerParameterivNV)(GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[675]; + ((void (APIENTRY *)(GLenum pname, const GLint *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[676]; + ((void (APIENTRY *)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)) _func)(variable, input, mapping, componentUsage); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[677]; + ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params)) _func)(stage, portion, variable, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[678]; + ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params)) _func)(stage, portion, variable, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[679]; + ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum pname, GLfloat *params)) _func)(stage, portion, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[680]; + ((void (APIENTRY *)(GLenum stage, GLenum portion, GLenum pname, GLint *params)) _func)(stage, portion, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[681]; + ((void (APIENTRY *)(GLenum variable, GLenum pname, GLfloat *params)) _func)(variable, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[682]; + ((void (APIENTRY *)(GLenum variable, GLenum pname, GLint *params)) _func)(variable, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ResizeBuffersMESA)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[683]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dMESA)(GLdouble x, GLdouble y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[684]; + ((void (APIENTRY *)(GLdouble x, GLdouble y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2d)(GLdouble x, GLdouble y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[684]; + ((void (APIENTRY *)(GLdouble x, GLdouble y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dARB)(GLdouble x, GLdouble y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[684]; + ((void (APIENTRY *)(GLdouble x, GLdouble y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dvMESA)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[685]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[685]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2dvARB)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[685]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fMESA)(GLfloat x, GLfloat y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[686]; + ((void (APIENTRY *)(GLfloat x, GLfloat y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2f)(GLfloat x, GLfloat y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[686]; + ((void (APIENTRY *)(GLfloat x, GLfloat y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fARB)(GLfloat x, GLfloat y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[686]; + ((void (APIENTRY *)(GLfloat x, GLfloat y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fvMESA)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[687]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[687]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2fvARB)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[687]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iMESA)(GLint x, GLint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[688]; + ((void (APIENTRY *)(GLint x, GLint y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2i)(GLint x, GLint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[688]; + ((void (APIENTRY *)(GLint x, GLint y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iARB)(GLint x, GLint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[688]; + ((void (APIENTRY *)(GLint x, GLint y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2ivMESA)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[689]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[689]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2ivARB)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[689]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sMESA)(GLshort x, GLshort y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[690]; + ((void (APIENTRY *)(GLshort x, GLshort y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2s)(GLshort x, GLshort y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[690]; + ((void (APIENTRY *)(GLshort x, GLshort y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sARB)(GLshort x, GLshort y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[690]; + ((void (APIENTRY *)(GLshort x, GLshort y)) _func)(x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2svMESA)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[691]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[691]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos2svARB)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[691]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[692]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3d)(GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[692]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dARB)(GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[692]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dvMESA)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[693]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dv)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[693]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3dvARB)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[693]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[694]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3f)(GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[694]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fARB)(GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[694]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fvMESA)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[695]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fv)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[695]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3fvARB)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[695]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iMESA)(GLint x, GLint y, GLint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[696]; + ((void (APIENTRY *)(GLint x, GLint y, GLint z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3i)(GLint x, GLint y, GLint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[696]; + ((void (APIENTRY *)(GLint x, GLint y, GLint z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iARB)(GLint x, GLint y, GLint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[696]; + ((void (APIENTRY *)(GLint x, GLint y, GLint z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3ivMESA)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[697]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3iv)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[697]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3ivARB)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[697]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[698]; + ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3s)(GLshort x, GLshort y, GLshort z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[698]; + ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sARB)(GLshort x, GLshort y, GLshort z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[698]; + ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z)) _func)(x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3svMESA)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[699]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3sv)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[699]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos3svARB)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[699]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[700]; + ((void (APIENTRY *)(GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4dvMESA)(const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[701]; + ((void (APIENTRY *)(const GLdouble *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[702]; + ((void (APIENTRY *)(GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4fvMESA)(const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[703]; + ((void (APIENTRY *)(const GLfloat *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[704]; + ((void (APIENTRY *)(GLint x, GLint y, GLint z, GLint w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4ivMESA)(const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[705]; + ((void (APIENTRY *)(const GLint *v)) _func)(v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[706]; + ((void (APIENTRY *)(GLshort x, GLshort y, GLshort z, GLshort w)) _func)(x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(WindowPos4svMESA)(const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[707]; + ((void (APIENTRY *)(const GLshort *v)) _func)(v); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(AreProgramsResidentNV)(GLsizei n, const GLuint *ids, GLboolean *residences) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[717]; + return ((GLboolean (APIENTRY *)(GLsizei n, const GLuint *ids, GLboolean *residences)) _func)(n, ids, residences); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindProgramNV)(GLenum target, GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[718]; + ((void (APIENTRY *)(GLenum target, GLuint program)) _func)(target, program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindProgramARB)(GLenum target, GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[718]; + ((void (APIENTRY *)(GLenum target, GLuint program)) _func)(target, program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteProgramsNV)(GLsizei n, const GLuint *programs) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[719]; + ((void (APIENTRY *)(GLsizei n, const GLuint *programs)) _func)(n, programs); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteProgramsARB)(GLsizei n, const GLuint *programs) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[719]; + ((void (APIENTRY *)(GLsizei n, const GLuint *programs)) _func)(n, programs); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[720]; + ((void (APIENTRY *)(GLenum target, GLuint id, const GLfloat *params)) _func)(target, id, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenProgramsNV)(GLsizei n, GLuint *programs) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[721]; + ((void (APIENTRY *)(GLsizei n, GLuint *programs)) _func)(n, programs); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenProgramsARB)(GLsizei n, GLuint *programs) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[721]; + ((void (APIENTRY *)(GLsizei n, GLuint *programs)) _func)(n, programs); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[722]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLenum pname, GLdouble *params)) _func)(target, index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[723]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLenum pname, GLfloat *params)) _func)(target, index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramStringNV)(GLuint id, GLenum pname, GLubyte *program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[724]; + ((void (APIENTRY *)(GLuint id, GLenum pname, GLubyte *program)) _func)(id, pname, program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramivNV)(GLuint id, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[725]; + ((void (APIENTRY *)(GLuint id, GLenum pname, GLint *params)) _func)(id, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[726]; + ((void (APIENTRY *)(GLenum target, GLuint address, GLenum pname, GLint *params)) _func)(target, address, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid **pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[727]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLvoid **pointer)) _func)(index, pname, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid **pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[727]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLvoid **pointer)) _func)(index, pname, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid **pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[727]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLvoid **pointer)) _func)(index, pname, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[728]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLdouble *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[729]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLfloat *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribivNV)(GLuint index, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[730]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLint *params)) _func)(index, pname, params); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsProgramNV)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[731]; + return ((GLboolean (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsProgramARB)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[731]; + return ((GLboolean (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte *program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[732]; + ((void (APIENTRY *)(GLenum target, GLuint id, GLsizei len, const GLubyte *program)) _func)(target, id, len, program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[733]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLsizei num, const GLdouble *params)) _func)(target, index, num, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[734]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLsizei num, const GLfloat *params)) _func)(target, index, num, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RequestResidentProgramsNV)(GLsizei n, const GLuint *ids) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[735]; + ((void (APIENTRY *)(GLsizei n, const GLuint *ids)) _func)(n, ids); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[736]; + ((void (APIENTRY *)(GLenum target, GLuint address, GLenum matrix, GLenum transform)) _func)(target, address, matrix, transform); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dNV)(GLuint index, GLdouble x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[737]; + ((void (APIENTRY *)(GLuint index, GLdouble x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1dvNV)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[738]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fNV)(GLuint index, GLfloat x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[739]; + ((void (APIENTRY *)(GLuint index, GLfloat x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1fvNV)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[740]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1sNV)(GLuint index, GLshort x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[741]; + ((void (APIENTRY *)(GLuint index, GLshort x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib1svNV)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[742]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[743]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2dvNV)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[744]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[745]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2fvNV)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[746]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[747]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib2svNV)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[748]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[749]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y, GLdouble z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3dvNV)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[750]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[751]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y, GLfloat z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3fvNV)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[752]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[753]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y, GLshort z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib3svNV)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[754]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[755]; + ((void (APIENTRY *)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4dvNV)(GLuint index, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[756]; + ((void (APIENTRY *)(GLuint index, const GLdouble *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[757]; + ((void (APIENTRY *)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4fvNV)(GLuint index, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[758]; + ((void (APIENTRY *)(GLuint index, const GLfloat *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[759]; + ((void (APIENTRY *)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4svNV)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[760]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[761]; + ((void (APIENTRY *)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttrib4ubvNV)(GLuint index, const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[762]; + ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[763]; + ((void (APIENTRY *)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(index, size, type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[764]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLdouble *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[765]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLfloat *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[766]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLshort *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[767]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLdouble *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[768]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLfloat *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[769]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLshort *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[770]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLdouble *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[771]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLfloat *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[772]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLshort *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[773]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLdouble *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[774]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLfloat *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[775]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLshort *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[776]; + ((void (APIENTRY *)(GLuint index, GLsizei n, const GLubyte *v)) _func)(index, n, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexBumpParameterfvATI)(GLenum pname, GLfloat *param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[777]; + ((void (APIENTRY *)(GLenum pname, GLfloat *param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexBumpParameterivATI)(GLenum pname, GLint *param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[778]; + ((void (APIENTRY *)(GLenum pname, GLint *param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexBumpParameterfvATI)(GLenum pname, const GLfloat *param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[779]; + ((void (APIENTRY *)(GLenum pname, const GLfloat *param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexBumpParameterivATI)(GLenum pname, const GLint *param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[780]; + ((void (APIENTRY *)(GLenum pname, const GLint *param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[781]; + ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)) _func)(op, dst, dstMod, arg1, arg1Rep, arg1Mod); +} + +GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[782]; + ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)) _func)(op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod); +} + +GLAPI void APIENTRY GLAPI_PREFIX(AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[783]; + ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)) _func)(op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BeginFragmentShaderATI)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[784]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindFragmentShaderATI)(GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[785]; + ((void (APIENTRY *)(GLuint id)) _func)(id); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[786]; + ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)) _func)(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[787]; + ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)) _func)(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[788]; + ((void (APIENTRY *)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)) _func)(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteFragmentShaderATI)(GLuint id) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[789]; + ((void (APIENTRY *)(GLuint id)) _func)(id); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EndFragmentShaderATI)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[790]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI GLuint APIENTRY GLAPI_PREFIX(GenFragmentShadersATI)(GLuint range) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[791]; + return ((GLuint (APIENTRY *)(GLuint range)) _func)(range); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[792]; + ((void (APIENTRY *)(GLuint dst, GLuint coord, GLenum swizzle)) _func)(dst, coord, swizzle); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[793]; + ((void (APIENTRY *)(GLuint dst, GLuint interp, GLenum swizzle)) _func)(dst, interp, swizzle); +} + +GLAPI void APIENTRY GLAPI_PREFIX(SetFragmentShaderConstantATI)(GLuint dst, const GLfloat *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[794]; + ((void (APIENTRY *)(GLuint dst, const GLfloat *value)) _func)(dst, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameteriNV)(GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[795]; + ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameteri)(GLenum pname, GLint param) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[795]; + ((void (APIENTRY *)(GLenum pname, GLint param)) _func)(pname, param); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameterivNV)(GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[796]; + ((void (APIENTRY *)(GLenum pname, const GLint *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PointParameteriv)(GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[796]; + ((void (APIENTRY *)(GLenum pname, const GLint *params)) _func)(pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteVertexArrays)(GLsizei n, const GLuint *arrays) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[799]; + ((void (APIENTRY *)(GLsizei n, const GLuint *arrays)) _func)(n, arrays); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsVertexArray)(GLuint array) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[801]; + return ((GLboolean (APIENTRY *)(GLuint array)) _func)(array); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[802]; + ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params)) _func)(id, len, name, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[803]; + ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params)) _func)(id, len, name, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[804]; + ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) _func)(id, len, name, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[805]; + ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v)) _func)(id, len, name, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[806]; + ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) _func)(id, len, name, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[807]; + ((void (APIENTRY *)(GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v)) _func)(id, len, name, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartIndexNV)(GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[808]; + ((void (APIENTRY *)(GLuint index)) _func)(index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartIndex)(GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[808]; + ((void (APIENTRY *)(GLuint index)) _func)(index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(PrimitiveRestartNV)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[809]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[857]; + ((void (APIENTRY *)(GLenum modeRGB, GLenum modeA)) _func)(modeRGB, modeA); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindFramebufferEXT)(GLenum target, GLuint framebuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[858]; + ((void (APIENTRY *)(GLenum target, GLuint framebuffer)) _func)(target, framebuffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindFramebuffer)(GLenum target, GLuint framebuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[858]; + ((void (APIENTRY *)(GLenum target, GLuint framebuffer)) _func)(target, framebuffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindRenderbufferEXT)(GLenum target, GLuint renderbuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[859]; + ((void (APIENTRY *)(GLenum target, GLuint renderbuffer)) _func)(target, renderbuffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindRenderbuffer)(GLenum target, GLuint renderbuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[859]; + ((void (APIENTRY *)(GLenum target, GLuint renderbuffer)) _func)(target, renderbuffer); +} + +GLAPI GLenum APIENTRY GLAPI_PREFIX(CheckFramebufferStatusEXT)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[860]; + return ((GLenum (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI GLenum APIENTRY GLAPI_PREFIX(CheckFramebufferStatus)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[860]; + return ((GLenum (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[861]; + ((void (APIENTRY *)(GLsizei n, const GLuint *framebuffers)) _func)(n, framebuffers); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteFramebuffers)(GLsizei n, const GLuint *framebuffers) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[861]; + ((void (APIENTRY *)(GLsizei n, const GLuint *framebuffers)) _func)(n, framebuffers); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[862]; + ((void (APIENTRY *)(GLsizei n, const GLuint *renderbuffers)) _func)(n, renderbuffers); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DeleteRenderbuffers)(GLsizei n, const GLuint *renderbuffers) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[862]; + ((void (APIENTRY *)(GLsizei n, const GLuint *renderbuffers)) _func)(n, renderbuffers); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[863]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) _func)(target, attachment, renderbuffertarget, renderbuffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[863]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)) _func)(target, attachment, renderbuffertarget, renderbuffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[864]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) _func)(target, attachment, textarget, texture, level); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture1D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[864]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) _func)(target, attachment, textarget, texture, level); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[865]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) _func)(target, attachment, textarget, texture, level); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[865]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)) _func)(target, attachment, textarget, texture, level); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[866]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)) _func)(target, attachment, textarget, texture, level, zoffset); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTexture3D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[866]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)) _func)(target, attachment, textarget, texture, level, zoffset); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenFramebuffersEXT)(GLsizei n, GLuint *framebuffers) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[867]; + ((void (APIENTRY *)(GLsizei n, GLuint *framebuffers)) _func)(n, framebuffers); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenFramebuffers)(GLsizei n, GLuint *framebuffers) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[867]; + ((void (APIENTRY *)(GLsizei n, GLuint *framebuffers)) _func)(n, framebuffers); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[868]; + ((void (APIENTRY *)(GLsizei n, GLuint *renderbuffers)) _func)(n, renderbuffers); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenRenderbuffers)(GLsizei n, GLuint *renderbuffers) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[868]; + ((void (APIENTRY *)(GLsizei n, GLuint *renderbuffers)) _func)(n, renderbuffers); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenerateMipmapEXT)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[869]; + ((void (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GenerateMipmap)(GLenum target) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[869]; + ((void (APIENTRY *)(GLenum target)) _func)(target); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[870]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum pname, GLint *params)) _func)(target, attachment, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[870]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLenum pname, GLint *params)) _func)(target, attachment, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[871]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[871]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsFramebufferEXT)(GLuint framebuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[872]; + return ((GLboolean (APIENTRY *)(GLuint framebuffer)) _func)(framebuffer); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsFramebuffer)(GLuint framebuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[872]; + return ((GLboolean (APIENTRY *)(GLuint framebuffer)) _func)(framebuffer); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsRenderbufferEXT)(GLuint renderbuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[873]; + return ((GLboolean (APIENTRY *)(GLuint renderbuffer)) _func)(renderbuffer); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsRenderbuffer)(GLuint renderbuffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[873]; + return ((GLboolean (APIENTRY *)(GLuint renderbuffer)) _func)(renderbuffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[874]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)) _func)(target, internalformat, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(RenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[874]; + ((void (APIENTRY *)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)) _func)(target, internalformat, width, height); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[875]; + ((void (APIENTRY *)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)) _func)(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[878]; + ((void (APIENTRY *)(GLuint program, GLuint colorNumber, const GLchar *name)) _func)(program, colorNumber, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindFragDataLocation)(GLuint program, GLuint colorNumber, const GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[878]; + ((void (APIENTRY *)(GLuint program, GLuint colorNumber, const GLchar *name)) _func)(program, colorNumber, name); +} + +GLAPI GLint APIENTRY GLAPI_PREFIX(GetFragDataLocationEXT)(GLuint program, const GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[879]; + return ((GLint (APIENTRY *)(GLuint program, const GLchar *name)) _func)(program, name); +} + +GLAPI GLint APIENTRY GLAPI_PREFIX(GetFragDataLocation)(GLuint program, const GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[879]; + return ((GLint (APIENTRY *)(GLuint program, const GLchar *name)) _func)(program, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformuivEXT)(GLuint program, GLint location, GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[880]; + ((void (APIENTRY *)(GLuint program, GLint location, GLuint *params)) _func)(program, location, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetUniformuiv)(GLuint program, GLint location, GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[880]; + ((void (APIENTRY *)(GLuint program, GLint location, GLuint *params)) _func)(program, location, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[881]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLint *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIiv)(GLuint index, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[881]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLint *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[882]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLuint *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetVertexAttribIuiv)(GLuint index, GLenum pname, GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[882]; + ((void (APIENTRY *)(GLuint index, GLenum pname, GLuint *params)) _func)(index, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uiEXT)(GLint location, GLuint x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[883]; + ((void (APIENTRY *)(GLint location, GLuint x)) _func)(location, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1ui)(GLint location, GLuint x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[883]; + ((void (APIENTRY *)(GLint location, GLuint x)) _func)(location, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uivEXT)(GLint location, GLsizei count, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[884]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform1uiv)(GLint location, GLsizei count, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[884]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uiEXT)(GLint location, GLuint x, GLuint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[885]; + ((void (APIENTRY *)(GLint location, GLuint x, GLuint y)) _func)(location, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2ui)(GLint location, GLuint x, GLuint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[885]; + ((void (APIENTRY *)(GLint location, GLuint x, GLuint y)) _func)(location, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uivEXT)(GLint location, GLsizei count, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[886]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform2uiv)(GLint location, GLsizei count, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[886]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[887]; + ((void (APIENTRY *)(GLint location, GLuint x, GLuint y, GLuint z)) _func)(location, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3ui)(GLint location, GLuint x, GLuint y, GLuint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[887]; + ((void (APIENTRY *)(GLint location, GLuint x, GLuint y, GLuint z)) _func)(location, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uivEXT)(GLint location, GLsizei count, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[888]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform3uiv)(GLint location, GLsizei count, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[888]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[889]; + ((void (APIENTRY *)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)) _func)(location, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4ui)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[889]; + ((void (APIENTRY *)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)) _func)(location, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uivEXT)(GLint location, GLsizei count, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[890]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Uniform4uiv)(GLint location, GLsizei count, const GLuint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[890]; + ((void (APIENTRY *)(GLint location, GLsizei count, const GLuint *value)) _func)(location, count, value); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1iEXT)(GLuint index, GLint x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[891]; + ((void (APIENTRY *)(GLuint index, GLint x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1i)(GLuint index, GLint x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[891]; + ((void (APIENTRY *)(GLuint index, GLint x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1ivEXT)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[892]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1iv)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[892]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uiEXT)(GLuint index, GLuint x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[893]; + ((void (APIENTRY *)(GLuint index, GLuint x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1ui)(GLuint index, GLuint x) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[893]; + ((void (APIENTRY *)(GLuint index, GLuint x)) _func)(index, x); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uivEXT)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[894]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI1uiv)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[894]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2iEXT)(GLuint index, GLint x, GLint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[895]; + ((void (APIENTRY *)(GLuint index, GLint x, GLint y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2i)(GLuint index, GLint x, GLint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[895]; + ((void (APIENTRY *)(GLuint index, GLint x, GLint y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2ivEXT)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[896]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2iv)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[896]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[897]; + ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[897]; + ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y)) _func)(index, x, y); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uivEXT)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[898]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI2uiv)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[898]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[899]; + ((void (APIENTRY *)(GLuint index, GLint x, GLint y, GLint z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[899]; + ((void (APIENTRY *)(GLuint index, GLint x, GLint y, GLint z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3ivEXT)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[900]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3iv)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[900]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[901]; + ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y, GLuint z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[901]; + ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y, GLuint z)) _func)(index, x, y, z); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uivEXT)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[902]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI3uiv)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[902]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4bvEXT)(GLuint index, const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[903]; + ((void (APIENTRY *)(GLuint index, const GLbyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4bv)(GLuint index, const GLbyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[903]; + ((void (APIENTRY *)(GLuint index, const GLbyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[904]; + ((void (APIENTRY *)(GLuint index, GLint x, GLint y, GLint z, GLint w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[904]; + ((void (APIENTRY *)(GLuint index, GLint x, GLint y, GLint z, GLint w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ivEXT)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[905]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4iv)(GLuint index, const GLint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[905]; + ((void (APIENTRY *)(GLuint index, const GLint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4svEXT)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[906]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4sv)(GLuint index, const GLshort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[906]; + ((void (APIENTRY *)(GLuint index, const GLshort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ubvEXT)(GLuint index, const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[907]; + ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ubv)(GLuint index, const GLubyte *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[907]; + ((void (APIENTRY *)(GLuint index, const GLubyte *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[908]; + ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[908]; + ((void (APIENTRY *)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)) _func)(index, x, y, z, w); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uivEXT)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[909]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4uiv)(GLuint index, const GLuint *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[909]; + ((void (APIENTRY *)(GLuint index, const GLuint *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4usvEXT)(GLuint index, const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[910]; + ((void (APIENTRY *)(GLuint index, const GLushort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribI4usv)(GLuint index, const GLushort *v) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[910]; + ((void (APIENTRY *)(GLuint index, const GLushort *v)) _func)(index, v); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[911]; + ((void (APIENTRY *)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(index, size, type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(VertexAttribIPointer)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[911]; + ((void (APIENTRY *)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) _func)(index, size, type, stride, pointer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[912]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)) _func)(target, attachment, texture, level, layer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(FramebufferTextureLayer)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[912]; + ((void (APIENTRY *)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)) _func)(target, attachment, texture, level, layer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[913]; + ((void (APIENTRY *)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)) _func)(buf, r, g, b, a); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ColorMaski)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[913]; + ((void (APIENTRY *)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)) _func)(buf, r, g, b, a); +} + +GLAPI void APIENTRY GLAPI_PREFIX(DisableIndexedEXT)(GLenum target, GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[914]; + ((void (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Disablei)(GLenum target, GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[914]; + ((void (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EnableIndexedEXT)(GLenum target, GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[915]; + ((void (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(Enablei)(GLenum target, GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[915]; + ((void (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[916]; + ((void (APIENTRY *)(GLenum value, GLuint index, GLboolean *data)) _func)(value, index, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetBooleani_v)(GLenum value, GLuint index, GLboolean *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[916]; + ((void (APIENTRY *)(GLenum value, GLuint index, GLboolean *data)) _func)(value, index, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[917]; + ((void (APIENTRY *)(GLenum value, GLuint index, GLint *data)) _func)(value, index, data); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetIntegeri_v)(GLenum value, GLuint index, GLint *data) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[917]; + ((void (APIENTRY *)(GLenum value, GLuint index, GLint *data)) _func)(value, index, data); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsEnabledIndexedEXT)(GLenum target, GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[918]; + return ((GLboolean (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index); +} + +GLAPI GLboolean APIENTRY GLAPI_PREFIX(IsEnabledi)(GLenum target, GLuint index) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[918]; + return ((GLboolean (APIENTRY *)(GLenum target, GLuint index)) _func)(target, index); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[919]; + ((void (APIENTRY *)(GLint r, GLint g, GLint b, GLint a)) _func)(r, g, b, a); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[920]; + ((void (APIENTRY *)(GLuint r, GLuint g, GLuint b, GLuint a)) _func)(r, g, b, a); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[921]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIiv)(GLenum target, GLenum pname, GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[921]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[922]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLuint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTexParameterIuiv)(GLenum target, GLenum pname, GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[922]; + ((void (APIENTRY *)(GLenum target, GLenum pname, GLuint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[923]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIiv)(GLenum target, GLenum pname, const GLint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[923]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[924]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLuint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TexParameterIuiv)(GLenum target, GLenum pname, const GLuint *params) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[924]; + ((void (APIENTRY *)(GLenum target, GLenum pname, const GLuint *params)) _func)(target, pname, params); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BeginConditionalRenderNV)(GLuint query, GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[925]; + ((void (APIENTRY *)(GLuint query, GLenum mode)) _func)(query, mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BeginConditionalRender)(GLuint query, GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[925]; + ((void (APIENTRY *)(GLuint query, GLenum mode)) _func)(query, mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EndConditionalRenderNV)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[926]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EndConditionalRender)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[926]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BeginTransformFeedbackEXT)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[927]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BeginTransformFeedback)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[927]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[928]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer)) _func)(target, index, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferBase)(GLenum target, GLuint index, GLuint buffer) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[928]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer)) _func)(target, index, buffer); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[929]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer, GLintptr offset)) _func)(target, index, buffer, offset); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[930]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)) _func)(target, index, buffer, offset, size); +} + +GLAPI void APIENTRY GLAPI_PREFIX(BindBufferRange)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[930]; + ((void (APIENTRY *)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)) _func)(target, index, buffer, offset, size); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EndTransformFeedbackEXT)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[931]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EndTransformFeedback)(void) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[931]; + ((void (APIENTRY *)(void)) _func)(); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[932]; + ((void (APIENTRY *)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)) _func)(program, index, bufSize, length, size, type, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetTransformFeedbackVarying)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[932]; + ((void (APIENTRY *)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)) _func)(program, index, bufSize, length, size, type, name); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char **varyings, GLenum bufferMode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[933]; + ((void (APIENTRY *)(GLuint program, GLsizei count, const char **varyings, GLenum bufferMode)) _func)(program, count, varyings, bufferMode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(TransformFeedbackVaryings)(GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[933]; + ((void (APIENTRY *)(GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode)) _func)(program, count, varyings, bufferMode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProvokingVertexEXT)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[934]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ProvokingVertex)(GLenum mode) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[934]; + ((void (APIENTRY *)(GLenum mode)) _func)(mode); +} + +GLAPI void APIENTRY GLAPI_PREFIX(GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint *value) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[937]; + ((void (APIENTRY *)(GLenum objectType, GLuint name, GLenum pname, GLint *value)) _func)(objectType, name, pname, value); +} + +GLAPI GLenum APIENTRY GLAPI_PREFIX(ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[938]; + return ((GLenum (APIENTRY *)(GLenum objectType, GLuint name, GLenum option)) _func)(objectType, name, option); +} + +GLAPI GLenum APIENTRY GLAPI_PREFIX(ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[939]; + return ((GLenum (APIENTRY *)(GLenum objectType, GLuint name, GLenum option)) _func)(objectType, name, option); +} + +GLAPI void APIENTRY GLAPI_PREFIX(ActiveProgramEXT)(GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[940]; + ((void (APIENTRY *)(GLuint program)) _func)(program); +} + +GLAPI GLuint APIENTRY GLAPI_PREFIX(CreateShaderProgramEXT)(GLenum type, const GLchar *string) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[941]; + return ((GLuint (APIENTRY *)(GLenum type, const GLchar *string)) _func)(type, string); +} + +GLAPI void APIENTRY GLAPI_PREFIX(UseShaderProgramEXT)(GLenum type, GLuint program) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[942]; + ((void (APIENTRY *)(GLenum type, GLuint program)) _func)(type, program); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid *writeOffset) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[948]; + ((void (APIENTRY *)(GLenum target, GLvoid *writeOffset)) _func)(target, writeOffset); +} + +GLAPI void APIENTRY GLAPI_PREFIX(EGLImageTargetTexture2DOES)(GLenum target, GLvoid *writeOffset) +{ + const struct mapi_table *_tbl = entry_current_get(); + mapi_func _func = ((const mapi_func *) _tbl)[949]; + ((void (APIENTRY *)(GLenum target, GLvoid *writeOffset)) _func)(target, writeOffset); +} + +/* does not need public_entries */ +#undef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN +#endif /* MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN */ + +#ifdef MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN +__asm__( +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(NewList))"\n" +"\t"STUB_ASM_CODE("0")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EndList))"\n" +"\t"STUB_ASM_CODE("1")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CallList))"\n" +"\t"STUB_ASM_CODE("2")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CallLists))"\n" +"\t"STUB_ASM_CODE("3")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteLists))"\n" +"\t"STUB_ASM_CODE("4")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenLists))"\n" +"\t"STUB_ASM_CODE("5")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ListBase))"\n" +"\t"STUB_ASM_CODE("6")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Begin))"\n" +"\t"STUB_ASM_CODE("7")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Bitmap))"\n" +"\t"STUB_ASM_CODE("8")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3b))"\n" +"\t"STUB_ASM_CODE("9")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3bv))"\n" +"\t"STUB_ASM_CODE("10")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3d))"\n" +"\t"STUB_ASM_CODE("11")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3dv))"\n" +"\t"STUB_ASM_CODE("12")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3f))"\n" +"\t"STUB_ASM_CODE("13")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3fv))"\n" +"\t"STUB_ASM_CODE("14")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3i))"\n" +"\t"STUB_ASM_CODE("15")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3iv))"\n" +"\t"STUB_ASM_CODE("16")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3s))"\n" +"\t"STUB_ASM_CODE("17")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3sv))"\n" +"\t"STUB_ASM_CODE("18")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3ub))"\n" +"\t"STUB_ASM_CODE("19")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3ubv))"\n" +"\t"STUB_ASM_CODE("20")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3ui))"\n" +"\t"STUB_ASM_CODE("21")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3uiv))"\n" +"\t"STUB_ASM_CODE("22")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3us))"\n" +"\t"STUB_ASM_CODE("23")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color3usv))"\n" +"\t"STUB_ASM_CODE("24")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4b))"\n" +"\t"STUB_ASM_CODE("25")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4bv))"\n" +"\t"STUB_ASM_CODE("26")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4d))"\n" +"\t"STUB_ASM_CODE("27")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4dv))"\n" +"\t"STUB_ASM_CODE("28")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4f))"\n" +"\t"STUB_ASM_CODE("29")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4fv))"\n" +"\t"STUB_ASM_CODE("30")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4i))"\n" +"\t"STUB_ASM_CODE("31")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4iv))"\n" +"\t"STUB_ASM_CODE("32")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4s))"\n" +"\t"STUB_ASM_CODE("33")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4sv))"\n" +"\t"STUB_ASM_CODE("34")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4ub))"\n" +"\t"STUB_ASM_CODE("35")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4ubv))"\n" +"\t"STUB_ASM_CODE("36")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4ui))"\n" +"\t"STUB_ASM_CODE("37")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4uiv))"\n" +"\t"STUB_ASM_CODE("38")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4us))"\n" +"\t"STUB_ASM_CODE("39")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Color4usv))"\n" +"\t"STUB_ASM_CODE("40")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EdgeFlag))"\n" +"\t"STUB_ASM_CODE("41")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EdgeFlagv))"\n" +"\t"STUB_ASM_CODE("42")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(End))"\n" +"\t"STUB_ASM_CODE("43")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexd))"\n" +"\t"STUB_ASM_CODE("44")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexdv))"\n" +"\t"STUB_ASM_CODE("45")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexf))"\n" +"\t"STUB_ASM_CODE("46")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexfv))"\n" +"\t"STUB_ASM_CODE("47")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexi))"\n" +"\t"STUB_ASM_CODE("48")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexiv))"\n" +"\t"STUB_ASM_CODE("49")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexs))"\n" +"\t"STUB_ASM_CODE("50")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexsv))"\n" +"\t"STUB_ASM_CODE("51")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3b))"\n" +"\t"STUB_ASM_CODE("52")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3bv))"\n" +"\t"STUB_ASM_CODE("53")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3d))"\n" +"\t"STUB_ASM_CODE("54")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3dv))"\n" +"\t"STUB_ASM_CODE("55")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3f))"\n" +"\t"STUB_ASM_CODE("56")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3fv))"\n" +"\t"STUB_ASM_CODE("57")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3i))"\n" +"\t"STUB_ASM_CODE("58")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3iv))"\n" +"\t"STUB_ASM_CODE("59")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3s))"\n" +"\t"STUB_ASM_CODE("60")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Normal3sv))"\n" +"\t"STUB_ASM_CODE("61")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos2d))"\n" +"\t"STUB_ASM_CODE("62")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos2dv))"\n" +"\t"STUB_ASM_CODE("63")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos2f))"\n" +"\t"STUB_ASM_CODE("64")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos2fv))"\n" +"\t"STUB_ASM_CODE("65")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos2i))"\n" +"\t"STUB_ASM_CODE("66")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos2iv))"\n" +"\t"STUB_ASM_CODE("67")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos2s))"\n" +"\t"STUB_ASM_CODE("68")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos2sv))"\n" +"\t"STUB_ASM_CODE("69")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos3d))"\n" +"\t"STUB_ASM_CODE("70")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos3dv))"\n" +"\t"STUB_ASM_CODE("71")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos3f))"\n" +"\t"STUB_ASM_CODE("72")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos3fv))"\n" +"\t"STUB_ASM_CODE("73")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos3i))"\n" +"\t"STUB_ASM_CODE("74")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos3iv))"\n" +"\t"STUB_ASM_CODE("75")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos3s))"\n" +"\t"STUB_ASM_CODE("76")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos3sv))"\n" +"\t"STUB_ASM_CODE("77")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos4d))"\n" +"\t"STUB_ASM_CODE("78")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos4dv))"\n" +"\t"STUB_ASM_CODE("79")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos4f))"\n" +"\t"STUB_ASM_CODE("80")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos4fv))"\n" +"\t"STUB_ASM_CODE("81")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos4i))"\n" +"\t"STUB_ASM_CODE("82")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos4iv))"\n" +"\t"STUB_ASM_CODE("83")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos4s))"\n" +"\t"STUB_ASM_CODE("84")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RasterPos4sv))"\n" +"\t"STUB_ASM_CODE("85")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rectd))"\n" +"\t"STUB_ASM_CODE("86")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rectdv))"\n" +"\t"STUB_ASM_CODE("87")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rectf))"\n" +"\t"STUB_ASM_CODE("88")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rectfv))"\n" +"\t"STUB_ASM_CODE("89")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Recti))"\n" +"\t"STUB_ASM_CODE("90")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rectiv))"\n" +"\t"STUB_ASM_CODE("91")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rects))"\n" +"\t"STUB_ASM_CODE("92")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rectsv))"\n" +"\t"STUB_ASM_CODE("93")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord1d))"\n" +"\t"STUB_ASM_CODE("94")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord1dv))"\n" +"\t"STUB_ASM_CODE("95")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord1f))"\n" +"\t"STUB_ASM_CODE("96")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord1fv))"\n" +"\t"STUB_ASM_CODE("97")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord1i))"\n" +"\t"STUB_ASM_CODE("98")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord1iv))"\n" +"\t"STUB_ASM_CODE("99")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord1s))"\n" +"\t"STUB_ASM_CODE("100")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord1sv))"\n" +"\t"STUB_ASM_CODE("101")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord2d))"\n" +"\t"STUB_ASM_CODE("102")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord2dv))"\n" +"\t"STUB_ASM_CODE("103")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord2f))"\n" +"\t"STUB_ASM_CODE("104")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord2fv))"\n" +"\t"STUB_ASM_CODE("105")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord2i))"\n" +"\t"STUB_ASM_CODE("106")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord2iv))"\n" +"\t"STUB_ASM_CODE("107")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord2s))"\n" +"\t"STUB_ASM_CODE("108")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord2sv))"\n" +"\t"STUB_ASM_CODE("109")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord3d))"\n" +"\t"STUB_ASM_CODE("110")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord3dv))"\n" +"\t"STUB_ASM_CODE("111")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord3f))"\n" +"\t"STUB_ASM_CODE("112")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord3fv))"\n" +"\t"STUB_ASM_CODE("113")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord3i))"\n" +"\t"STUB_ASM_CODE("114")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord3iv))"\n" +"\t"STUB_ASM_CODE("115")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord3s))"\n" +"\t"STUB_ASM_CODE("116")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord3sv))"\n" +"\t"STUB_ASM_CODE("117")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord4d))"\n" +"\t"STUB_ASM_CODE("118")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord4dv))"\n" +"\t"STUB_ASM_CODE("119")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord4f))"\n" +"\t"STUB_ASM_CODE("120")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord4fv))"\n" +"\t"STUB_ASM_CODE("121")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord4i))"\n" +"\t"STUB_ASM_CODE("122")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord4iv))"\n" +"\t"STUB_ASM_CODE("123")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord4s))"\n" +"\t"STUB_ASM_CODE("124")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoord4sv))"\n" +"\t"STUB_ASM_CODE("125")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex2d))"\n" +"\t"STUB_ASM_CODE("126")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex2dv))"\n" +"\t"STUB_ASM_CODE("127")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex2f))"\n" +"\t"STUB_ASM_CODE("128")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex2fv))"\n" +"\t"STUB_ASM_CODE("129")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex2i))"\n" +"\t"STUB_ASM_CODE("130")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex2iv))"\n" +"\t"STUB_ASM_CODE("131")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex2s))"\n" +"\t"STUB_ASM_CODE("132")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex2sv))"\n" +"\t"STUB_ASM_CODE("133")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex3d))"\n" +"\t"STUB_ASM_CODE("134")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex3dv))"\n" +"\t"STUB_ASM_CODE("135")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex3f))"\n" +"\t"STUB_ASM_CODE("136")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex3fv))"\n" +"\t"STUB_ASM_CODE("137")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex3i))"\n" +"\t"STUB_ASM_CODE("138")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex3iv))"\n" +"\t"STUB_ASM_CODE("139")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex3s))"\n" +"\t"STUB_ASM_CODE("140")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex3sv))"\n" +"\t"STUB_ASM_CODE("141")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex4d))"\n" +"\t"STUB_ASM_CODE("142")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex4dv))"\n" +"\t"STUB_ASM_CODE("143")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex4f))"\n" +"\t"STUB_ASM_CODE("144")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex4fv))"\n" +"\t"STUB_ASM_CODE("145")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex4i))"\n" +"\t"STUB_ASM_CODE("146")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex4iv))"\n" +"\t"STUB_ASM_CODE("147")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex4s))"\n" +"\t"STUB_ASM_CODE("148")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Vertex4sv))"\n" +"\t"STUB_ASM_CODE("149")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClipPlane))"\n" +"\t"STUB_ASM_CODE("150")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorMaterial))"\n" +"\t"STUB_ASM_CODE("151")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CullFace))"\n" +"\t"STUB_ASM_CODE("152")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Fogf))"\n" +"\t"STUB_ASM_CODE("153")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Fogfv))"\n" +"\t"STUB_ASM_CODE("154")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Fogi))"\n" +"\t"STUB_ASM_CODE("155")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Fogiv))"\n" +"\t"STUB_ASM_CODE("156")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FrontFace))"\n" +"\t"STUB_ASM_CODE("157")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Hint))"\n" +"\t"STUB_ASM_CODE("158")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Lightf))"\n" +"\t"STUB_ASM_CODE("159")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Lightfv))"\n" +"\t"STUB_ASM_CODE("160")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Lighti))"\n" +"\t"STUB_ASM_CODE("161")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Lightiv))"\n" +"\t"STUB_ASM_CODE("162")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LightModelf))"\n" +"\t"STUB_ASM_CODE("163")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LightModelfv))"\n" +"\t"STUB_ASM_CODE("164")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LightModeli))"\n" +"\t"STUB_ASM_CODE("165")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LightModeliv))"\n" +"\t"STUB_ASM_CODE("166")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LineStipple))"\n" +"\t"STUB_ASM_CODE("167")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LineWidth))"\n" +"\t"STUB_ASM_CODE("168")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Materialf))"\n" +"\t"STUB_ASM_CODE("169")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Materialfv))"\n" +"\t"STUB_ASM_CODE("170")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Materiali))"\n" +"\t"STUB_ASM_CODE("171")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Materialiv))"\n" +"\t"STUB_ASM_CODE("172")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointSize))"\n" +"\t"STUB_ASM_CODE("173")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PolygonMode))"\n" +"\t"STUB_ASM_CODE("174")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PolygonStipple))"\n" +"\t"STUB_ASM_CODE("175")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Scissor))"\n" +"\t"STUB_ASM_CODE("176")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ShadeModel))"\n" +"\t"STUB_ASM_CODE("177")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexParameterf))"\n" +"\t"STUB_ASM_CODE("178")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexParameterfv))"\n" +"\t"STUB_ASM_CODE("179")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexParameteri))"\n" +"\t"STUB_ASM_CODE("180")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexParameteriv))"\n" +"\t"STUB_ASM_CODE("181")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexImage1D))"\n" +"\t"STUB_ASM_CODE("182")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexImage2D))"\n" +"\t"STUB_ASM_CODE("183")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexEnvf))"\n" +"\t"STUB_ASM_CODE("184")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexEnvfv))"\n" +"\t"STUB_ASM_CODE("185")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexEnvi))"\n" +"\t"STUB_ASM_CODE("186")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexEnviv))"\n" +"\t"STUB_ASM_CODE("187")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexGend))"\n" +"\t"STUB_ASM_CODE("188")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexGendv))"\n" +"\t"STUB_ASM_CODE("189")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexGenf))"\n" +"\t"STUB_ASM_CODE("190")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexGenfv))"\n" +"\t"STUB_ASM_CODE("191")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexGeni))"\n" +"\t"STUB_ASM_CODE("192")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexGeniv))"\n" +"\t"STUB_ASM_CODE("193")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FeedbackBuffer))"\n" +"\t"STUB_ASM_CODE("194")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SelectBuffer))"\n" +"\t"STUB_ASM_CODE("195")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RenderMode))"\n" +"\t"STUB_ASM_CODE("196")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(InitNames))"\n" +"\t"STUB_ASM_CODE("197")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LoadName))"\n" +"\t"STUB_ASM_CODE("198")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PassThrough))"\n" +"\t"STUB_ASM_CODE("199")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PopName))"\n" +"\t"STUB_ASM_CODE("200")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PushName))"\n" +"\t"STUB_ASM_CODE("201")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawBuffer))"\n" +"\t"STUB_ASM_CODE("202")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Clear))"\n" +"\t"STUB_ASM_CODE("203")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearAccum))"\n" +"\t"STUB_ASM_CODE("204")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearIndex))"\n" +"\t"STUB_ASM_CODE("205")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearColor))"\n" +"\t"STUB_ASM_CODE("206")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearStencil))"\n" +"\t"STUB_ASM_CODE("207")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearDepth))"\n" +"\t"STUB_ASM_CODE("208")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(StencilMask))"\n" +"\t"STUB_ASM_CODE("209")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorMask))"\n" +"\t"STUB_ASM_CODE("210")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DepthMask))"\n" +"\t"STUB_ASM_CODE("211")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IndexMask))"\n" +"\t"STUB_ASM_CODE("212")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Accum))"\n" +"\t"STUB_ASM_CODE("213")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Disable))"\n" +"\t"STUB_ASM_CODE("214")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Enable))"\n" +"\t"STUB_ASM_CODE("215")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Finish))"\n" +"\t"STUB_ASM_CODE("216")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Flush))"\n" +"\t"STUB_ASM_CODE("217")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PopAttrib))"\n" +"\t"STUB_ASM_CODE("218")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PushAttrib))"\n" +"\t"STUB_ASM_CODE("219")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Map1d))"\n" +"\t"STUB_ASM_CODE("220")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Map1f))"\n" +"\t"STUB_ASM_CODE("221")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Map2d))"\n" +"\t"STUB_ASM_CODE("222")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Map2f))"\n" +"\t"STUB_ASM_CODE("223")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MapGrid1d))"\n" +"\t"STUB_ASM_CODE("224")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MapGrid1f))"\n" +"\t"STUB_ASM_CODE("225")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MapGrid2d))"\n" +"\t"STUB_ASM_CODE("226")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MapGrid2f))"\n" +"\t"STUB_ASM_CODE("227")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalCoord1d))"\n" +"\t"STUB_ASM_CODE("228")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalCoord1dv))"\n" +"\t"STUB_ASM_CODE("229")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalCoord1f))"\n" +"\t"STUB_ASM_CODE("230")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalCoord1fv))"\n" +"\t"STUB_ASM_CODE("231")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalCoord2d))"\n" +"\t"STUB_ASM_CODE("232")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalCoord2dv))"\n" +"\t"STUB_ASM_CODE("233")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalCoord2f))"\n" +"\t"STUB_ASM_CODE("234")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalCoord2fv))"\n" +"\t"STUB_ASM_CODE("235")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalMesh1))"\n" +"\t"STUB_ASM_CODE("236")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalPoint1))"\n" +"\t"STUB_ASM_CODE("237")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalMesh2))"\n" +"\t"STUB_ASM_CODE("238")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EvalPoint2))"\n" +"\t"STUB_ASM_CODE("239")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AlphaFunc))"\n" +"\t"STUB_ASM_CODE("240")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendFunc))"\n" +"\t"STUB_ASM_CODE("241")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LogicOp))"\n" +"\t"STUB_ASM_CODE("242")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(StencilFunc))"\n" +"\t"STUB_ASM_CODE("243")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(StencilOp))"\n" +"\t"STUB_ASM_CODE("244")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DepthFunc))"\n" +"\t"STUB_ASM_CODE("245")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PixelZoom))"\n" +"\t"STUB_ASM_CODE("246")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PixelTransferf))"\n" +"\t"STUB_ASM_CODE("247")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PixelTransferi))"\n" +"\t"STUB_ASM_CODE("248")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PixelStoref))"\n" +"\t"STUB_ASM_CODE("249")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PixelStorei))"\n" +"\t"STUB_ASM_CODE("250")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PixelMapfv))"\n" +"\t"STUB_ASM_CODE("251")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PixelMapuiv))"\n" +"\t"STUB_ASM_CODE("252")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PixelMapusv))"\n" +"\t"STUB_ASM_CODE("253")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ReadBuffer))"\n" +"\t"STUB_ASM_CODE("254")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyPixels))"\n" +"\t"STUB_ASM_CODE("255")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ReadPixels))"\n" +"\t"STUB_ASM_CODE("256")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawPixels))"\n" +"\t"STUB_ASM_CODE("257")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetBooleanv))"\n" +"\t"STUB_ASM_CODE("258")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetClipPlane))"\n" +"\t"STUB_ASM_CODE("259")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetDoublev))"\n" +"\t"STUB_ASM_CODE("260")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetError))"\n" +"\t"STUB_ASM_CODE("261")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFloatv))"\n" +"\t"STUB_ASM_CODE("262")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetIntegerv))"\n" +"\t"STUB_ASM_CODE("263")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetLightfv))"\n" +"\t"STUB_ASM_CODE("264")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetLightiv))"\n" +"\t"STUB_ASM_CODE("265")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetMapdv))"\n" +"\t"STUB_ASM_CODE("266")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetMapfv))"\n" +"\t"STUB_ASM_CODE("267")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetMapiv))"\n" +"\t"STUB_ASM_CODE("268")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetMaterialfv))"\n" +"\t"STUB_ASM_CODE("269")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetMaterialiv))"\n" +"\t"STUB_ASM_CODE("270")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetPixelMapfv))"\n" +"\t"STUB_ASM_CODE("271")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetPixelMapuiv))"\n" +"\t"STUB_ASM_CODE("272")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetPixelMapusv))"\n" +"\t"STUB_ASM_CODE("273")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetPolygonStipple))"\n" +"\t"STUB_ASM_CODE("274")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetString))"\n" +"\t"STUB_ASM_CODE("275")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexEnvfv))"\n" +"\t"STUB_ASM_CODE("276")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexEnviv))"\n" +"\t"STUB_ASM_CODE("277")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexGendv))"\n" +"\t"STUB_ASM_CODE("278")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexGenfv))"\n" +"\t"STUB_ASM_CODE("279")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexGeniv))"\n" +"\t"STUB_ASM_CODE("280")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexImage))"\n" +"\t"STUB_ASM_CODE("281")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexParameterfv))"\n" +"\t"STUB_ASM_CODE("282")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexParameteriv))"\n" +"\t"STUB_ASM_CODE("283")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexLevelParameterfv))"\n" +"\t"STUB_ASM_CODE("284")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexLevelParameteriv))"\n" +"\t"STUB_ASM_CODE("285")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsEnabled))"\n" +"\t"STUB_ASM_CODE("286")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsList))"\n" +"\t"STUB_ASM_CODE("287")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DepthRange))"\n" +"\t"STUB_ASM_CODE("288")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Frustum))"\n" +"\t"STUB_ASM_CODE("289")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LoadIdentity))"\n" +"\t"STUB_ASM_CODE("290")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LoadMatrixf))"\n" +"\t"STUB_ASM_CODE("291")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LoadMatrixd))"\n" +"\t"STUB_ASM_CODE("292")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MatrixMode))"\n" +"\t"STUB_ASM_CODE("293")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultMatrixf))"\n" +"\t"STUB_ASM_CODE("294")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultMatrixd))"\n" +"\t"STUB_ASM_CODE("295")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Ortho))"\n" +"\t"STUB_ASM_CODE("296")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PopMatrix))"\n" +"\t"STUB_ASM_CODE("297")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PushMatrix))"\n" +"\t"STUB_ASM_CODE("298")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rotated))"\n" +"\t"STUB_ASM_CODE("299")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Rotatef))"\n" +"\t"STUB_ASM_CODE("300")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Scaled))"\n" +"\t"STUB_ASM_CODE("301")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Scalef))"\n" +"\t"STUB_ASM_CODE("302")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Translated))"\n" +"\t"STUB_ASM_CODE("303")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Translatef))"\n" +"\t"STUB_ASM_CODE("304")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Viewport))"\n" +"\t"STUB_ASM_CODE("305")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ArrayElement))"\n" +"\t"STUB_ASM_CODE("306")"\n" + +".globl "GLAPI_PREFIX_STR(ArrayElementEXT)"\n" +".set "GLAPI_PREFIX_STR(ArrayElementEXT)", "GLAPI_PREFIX_STR(ArrayElement)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindTexture))"\n" +"\t"STUB_ASM_CODE("307")"\n" + +".globl "GLAPI_PREFIX_STR(BindTextureEXT)"\n" +".set "GLAPI_PREFIX_STR(BindTextureEXT)", "GLAPI_PREFIX_STR(BindTexture)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorPointer))"\n" +"\t"STUB_ASM_CODE("308")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DisableClientState))"\n" +"\t"STUB_ASM_CODE("309")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawArrays))"\n" +"\t"STUB_ASM_CODE("310")"\n" + +".globl "GLAPI_PREFIX_STR(DrawArraysEXT)"\n" +".set "GLAPI_PREFIX_STR(DrawArraysEXT)", "GLAPI_PREFIX_STR(DrawArrays)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawElements))"\n" +"\t"STUB_ASM_CODE("311")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EdgeFlagPointer))"\n" +"\t"STUB_ASM_CODE("312")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EnableClientState))"\n" +"\t"STUB_ASM_CODE("313")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IndexPointer))"\n" +"\t"STUB_ASM_CODE("314")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexub))"\n" +"\t"STUB_ASM_CODE("315")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Indexubv))"\n" +"\t"STUB_ASM_CODE("316")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(InterleavedArrays))"\n" +"\t"STUB_ASM_CODE("317")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(NormalPointer))"\n" +"\t"STUB_ASM_CODE("318")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PolygonOffset))"\n" +"\t"STUB_ASM_CODE("319")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoordPointer))"\n" +"\t"STUB_ASM_CODE("320")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexPointer))"\n" +"\t"STUB_ASM_CODE("321")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AreTexturesResident))"\n" +"\t"STUB_ASM_CODE("322")"\n" + +#if 0 +".globl "GLAPI_PREFIX_STR(AreTexturesResidentEXT)"\n" +".set "GLAPI_PREFIX_STR(AreTexturesResidentEXT)", "GLAPI_PREFIX_STR(AreTexturesResident)"\n" +#endif + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyTexImage1D))"\n" +"\t"STUB_ASM_CODE("323")"\n" + +".globl "GLAPI_PREFIX_STR(CopyTexImage1DEXT)"\n" +".set "GLAPI_PREFIX_STR(CopyTexImage1DEXT)", "GLAPI_PREFIX_STR(CopyTexImage1D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyTexImage2D))"\n" +"\t"STUB_ASM_CODE("324")"\n" + +".globl "GLAPI_PREFIX_STR(CopyTexImage2DEXT)"\n" +".set "GLAPI_PREFIX_STR(CopyTexImage2DEXT)", "GLAPI_PREFIX_STR(CopyTexImage2D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyTexSubImage1D))"\n" +"\t"STUB_ASM_CODE("325")"\n" + +".globl "GLAPI_PREFIX_STR(CopyTexSubImage1DEXT)"\n" +".set "GLAPI_PREFIX_STR(CopyTexSubImage1DEXT)", "GLAPI_PREFIX_STR(CopyTexSubImage1D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyTexSubImage2D))"\n" +"\t"STUB_ASM_CODE("326")"\n" + +".globl "GLAPI_PREFIX_STR(CopyTexSubImage2DEXT)"\n" +".set "GLAPI_PREFIX_STR(CopyTexSubImage2DEXT)", "GLAPI_PREFIX_STR(CopyTexSubImage2D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteTextures))"\n" +"\t"STUB_ASM_CODE("327")"\n" + +#if 0 +".globl "GLAPI_PREFIX_STR(DeleteTexturesEXT)"\n" +".set "GLAPI_PREFIX_STR(DeleteTexturesEXT)", "GLAPI_PREFIX_STR(DeleteTextures)"\n" +#endif + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenTextures))"\n" +"\t"STUB_ASM_CODE("328")"\n" + +#if 0 +".globl "GLAPI_PREFIX_STR(GenTexturesEXT)"\n" +".set "GLAPI_PREFIX_STR(GenTexturesEXT)", "GLAPI_PREFIX_STR(GenTextures)"\n" +#endif + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetPointerv))"\n" +"\t"STUB_ASM_CODE("329")"\n" + +".globl "GLAPI_PREFIX_STR(GetPointervEXT)"\n" +".set "GLAPI_PREFIX_STR(GetPointervEXT)", "GLAPI_PREFIX_STR(GetPointerv)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsTexture))"\n" +"\t"STUB_ASM_CODE("330")"\n" + +#if 0 +".globl "GLAPI_PREFIX_STR(IsTextureEXT)"\n" +".set "GLAPI_PREFIX_STR(IsTextureEXT)", "GLAPI_PREFIX_STR(IsTexture)"\n" +#endif + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PrioritizeTextures))"\n" +"\t"STUB_ASM_CODE("331")"\n" + +".globl "GLAPI_PREFIX_STR(PrioritizeTexturesEXT)"\n" +".set "GLAPI_PREFIX_STR(PrioritizeTexturesEXT)", "GLAPI_PREFIX_STR(PrioritizeTextures)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexSubImage1D))"\n" +"\t"STUB_ASM_CODE("332")"\n" + +".globl "GLAPI_PREFIX_STR(TexSubImage1DEXT)"\n" +".set "GLAPI_PREFIX_STR(TexSubImage1DEXT)", "GLAPI_PREFIX_STR(TexSubImage1D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexSubImage2D))"\n" +"\t"STUB_ASM_CODE("333")"\n" + +".globl "GLAPI_PREFIX_STR(TexSubImage2DEXT)"\n" +".set "GLAPI_PREFIX_STR(TexSubImage2DEXT)", "GLAPI_PREFIX_STR(TexSubImage2D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PopClientAttrib))"\n" +"\t"STUB_ASM_CODE("334")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PushClientAttrib))"\n" +"\t"STUB_ASM_CODE("335")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendColor))"\n" +"\t"STUB_ASM_CODE("336")"\n" + +".globl "GLAPI_PREFIX_STR(BlendColorEXT)"\n" +".set "GLAPI_PREFIX_STR(BlendColorEXT)", "GLAPI_PREFIX_STR(BlendColor)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendEquation))"\n" +"\t"STUB_ASM_CODE("337")"\n" + +".globl "GLAPI_PREFIX_STR(BlendEquationEXT)"\n" +".set "GLAPI_PREFIX_STR(BlendEquationEXT)", "GLAPI_PREFIX_STR(BlendEquation)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawRangeElements))"\n" +"\t"STUB_ASM_CODE("338")"\n" + +".globl "GLAPI_PREFIX_STR(DrawRangeElementsEXT)"\n" +".set "GLAPI_PREFIX_STR(DrawRangeElementsEXT)", "GLAPI_PREFIX_STR(DrawRangeElements)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorTable))"\n" +"\t"STUB_ASM_CODE("339")"\n" + +".globl "GLAPI_PREFIX_STR(ColorTableEXT)"\n" +".set "GLAPI_PREFIX_STR(ColorTableEXT)", "GLAPI_PREFIX_STR(ColorTable)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorTableParameterfv))"\n" +"\t"STUB_ASM_CODE("340")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorTableParameteriv))"\n" +"\t"STUB_ASM_CODE("341")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyColorTable))"\n" +"\t"STUB_ASM_CODE("342")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetColorTable))"\n" +"\t"STUB_ASM_CODE("343")"\n" + +#if 0 +".globl "GLAPI_PREFIX_STR(GetColorTableEXT)"\n" +".set "GLAPI_PREFIX_STR(GetColorTableEXT)", "GLAPI_PREFIX_STR(GetColorTable)"\n" +#endif + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetColorTableParameterfv))"\n" +"\t"STUB_ASM_CODE("344")"\n" + +#if 0 +".globl "GLAPI_PREFIX_STR(GetColorTableParameterfvEXT)"\n" +".set "GLAPI_PREFIX_STR(GetColorTableParameterfvEXT)", "GLAPI_PREFIX_STR(GetColorTableParameterfv)"\n" +#endif + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetColorTableParameteriv))"\n" +"\t"STUB_ASM_CODE("345")"\n" + +#if 0 +".globl "GLAPI_PREFIX_STR(GetColorTableParameterivEXT)"\n" +".set "GLAPI_PREFIX_STR(GetColorTableParameterivEXT)", "GLAPI_PREFIX_STR(GetColorTableParameteriv)"\n" +#endif + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorSubTable))"\n" +"\t"STUB_ASM_CODE("346")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyColorSubTable))"\n" +"\t"STUB_ASM_CODE("347")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ConvolutionFilter1D))"\n" +"\t"STUB_ASM_CODE("348")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ConvolutionFilter2D))"\n" +"\t"STUB_ASM_CODE("349")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ConvolutionParameterf))"\n" +"\t"STUB_ASM_CODE("350")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ConvolutionParameterfv))"\n" +"\t"STUB_ASM_CODE("351")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ConvolutionParameteri))"\n" +"\t"STUB_ASM_CODE("352")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ConvolutionParameteriv))"\n" +"\t"STUB_ASM_CODE("353")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyConvolutionFilter1D))"\n" +"\t"STUB_ASM_CODE("354")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyConvolutionFilter2D))"\n" +"\t"STUB_ASM_CODE("355")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetConvolutionFilter))"\n" +"\t"STUB_ASM_CODE("356")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetConvolutionParameterfv))"\n" +"\t"STUB_ASM_CODE("357")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetConvolutionParameteriv))"\n" +"\t"STUB_ASM_CODE("358")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetSeparableFilter))"\n" +"\t"STUB_ASM_CODE("359")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SeparableFilter2D))"\n" +"\t"STUB_ASM_CODE("360")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetHistogram))"\n" +"\t"STUB_ASM_CODE("361")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetHistogramParameterfv))"\n" +"\t"STUB_ASM_CODE("362")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetHistogramParameteriv))"\n" +"\t"STUB_ASM_CODE("363")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetMinmax))"\n" +"\t"STUB_ASM_CODE("364")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetMinmaxParameterfv))"\n" +"\t"STUB_ASM_CODE("365")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetMinmaxParameteriv))"\n" +"\t"STUB_ASM_CODE("366")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Histogram))"\n" +"\t"STUB_ASM_CODE("367")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Minmax))"\n" +"\t"STUB_ASM_CODE("368")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ResetHistogram))"\n" +"\t"STUB_ASM_CODE("369")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ResetMinmax))"\n" +"\t"STUB_ASM_CODE("370")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexImage3D))"\n" +"\t"STUB_ASM_CODE("371")"\n" + +".globl "GLAPI_PREFIX_STR(TexImage3DEXT)"\n" +".set "GLAPI_PREFIX_STR(TexImage3DEXT)", "GLAPI_PREFIX_STR(TexImage3D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexSubImage3D))"\n" +"\t"STUB_ASM_CODE("372")"\n" + +".globl "GLAPI_PREFIX_STR(TexSubImage3DEXT)"\n" +".set "GLAPI_PREFIX_STR(TexSubImage3DEXT)", "GLAPI_PREFIX_STR(TexSubImage3D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyTexSubImage3D))"\n" +"\t"STUB_ASM_CODE("373")"\n" + +".globl "GLAPI_PREFIX_STR(CopyTexSubImage3DEXT)"\n" +".set "GLAPI_PREFIX_STR(CopyTexSubImage3DEXT)", "GLAPI_PREFIX_STR(CopyTexSubImage3D)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ActiveTextureARB))"\n" +"\t"STUB_ASM_CODE("374")"\n" + +".globl "GLAPI_PREFIX_STR(ActiveTexture)"\n" +".set "GLAPI_PREFIX_STR(ActiveTexture)", "GLAPI_PREFIX_STR(ActiveTextureARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClientActiveTextureARB))"\n" +"\t"STUB_ASM_CODE("375")"\n" + +".globl "GLAPI_PREFIX_STR(ClientActiveTexture)"\n" +".set "GLAPI_PREFIX_STR(ClientActiveTexture)", "GLAPI_PREFIX_STR(ClientActiveTextureARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord1dARB))"\n" +"\t"STUB_ASM_CODE("376")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord1d)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord1d)", "GLAPI_PREFIX_STR(MultiTexCoord1dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord1dvARB))"\n" +"\t"STUB_ASM_CODE("377")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord1dv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord1dv)", "GLAPI_PREFIX_STR(MultiTexCoord1dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord1fARB))"\n" +"\t"STUB_ASM_CODE("378")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord1f)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord1f)", "GLAPI_PREFIX_STR(MultiTexCoord1fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord1fvARB))"\n" +"\t"STUB_ASM_CODE("379")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord1fv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord1fv)", "GLAPI_PREFIX_STR(MultiTexCoord1fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord1iARB))"\n" +"\t"STUB_ASM_CODE("380")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord1i)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord1i)", "GLAPI_PREFIX_STR(MultiTexCoord1iARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord1ivARB))"\n" +"\t"STUB_ASM_CODE("381")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord1iv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord1iv)", "GLAPI_PREFIX_STR(MultiTexCoord1ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord1sARB))"\n" +"\t"STUB_ASM_CODE("382")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord1s)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord1s)", "GLAPI_PREFIX_STR(MultiTexCoord1sARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord1svARB))"\n" +"\t"STUB_ASM_CODE("383")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord1sv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord1sv)", "GLAPI_PREFIX_STR(MultiTexCoord1svARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord2dARB))"\n" +"\t"STUB_ASM_CODE("384")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord2d)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord2d)", "GLAPI_PREFIX_STR(MultiTexCoord2dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord2dvARB))"\n" +"\t"STUB_ASM_CODE("385")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord2dv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord2dv)", "GLAPI_PREFIX_STR(MultiTexCoord2dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord2fARB))"\n" +"\t"STUB_ASM_CODE("386")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord2f)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord2f)", "GLAPI_PREFIX_STR(MultiTexCoord2fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord2fvARB))"\n" +"\t"STUB_ASM_CODE("387")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord2fv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord2fv)", "GLAPI_PREFIX_STR(MultiTexCoord2fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord2iARB))"\n" +"\t"STUB_ASM_CODE("388")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord2i)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord2i)", "GLAPI_PREFIX_STR(MultiTexCoord2iARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord2ivARB))"\n" +"\t"STUB_ASM_CODE("389")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord2iv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord2iv)", "GLAPI_PREFIX_STR(MultiTexCoord2ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord2sARB))"\n" +"\t"STUB_ASM_CODE("390")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord2s)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord2s)", "GLAPI_PREFIX_STR(MultiTexCoord2sARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord2svARB))"\n" +"\t"STUB_ASM_CODE("391")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord2sv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord2sv)", "GLAPI_PREFIX_STR(MultiTexCoord2svARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord3dARB))"\n" +"\t"STUB_ASM_CODE("392")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord3d)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord3d)", "GLAPI_PREFIX_STR(MultiTexCoord3dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord3dvARB))"\n" +"\t"STUB_ASM_CODE("393")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord3dv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord3dv)", "GLAPI_PREFIX_STR(MultiTexCoord3dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord3fARB))"\n" +"\t"STUB_ASM_CODE("394")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord3f)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord3f)", "GLAPI_PREFIX_STR(MultiTexCoord3fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord3fvARB))"\n" +"\t"STUB_ASM_CODE("395")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord3fv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord3fv)", "GLAPI_PREFIX_STR(MultiTexCoord3fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord3iARB))"\n" +"\t"STUB_ASM_CODE("396")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord3i)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord3i)", "GLAPI_PREFIX_STR(MultiTexCoord3iARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord3ivARB))"\n" +"\t"STUB_ASM_CODE("397")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord3iv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord3iv)", "GLAPI_PREFIX_STR(MultiTexCoord3ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord3sARB))"\n" +"\t"STUB_ASM_CODE("398")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord3s)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord3s)", "GLAPI_PREFIX_STR(MultiTexCoord3sARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord3svARB))"\n" +"\t"STUB_ASM_CODE("399")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord3sv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord3sv)", "GLAPI_PREFIX_STR(MultiTexCoord3svARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord4dARB))"\n" +"\t"STUB_ASM_CODE("400")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord4d)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord4d)", "GLAPI_PREFIX_STR(MultiTexCoord4dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord4dvARB))"\n" +"\t"STUB_ASM_CODE("401")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord4dv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord4dv)", "GLAPI_PREFIX_STR(MultiTexCoord4dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord4fARB))"\n" +"\t"STUB_ASM_CODE("402")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord4f)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord4f)", "GLAPI_PREFIX_STR(MultiTexCoord4fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord4fvARB))"\n" +"\t"STUB_ASM_CODE("403")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord4fv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord4fv)", "GLAPI_PREFIX_STR(MultiTexCoord4fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord4iARB))"\n" +"\t"STUB_ASM_CODE("404")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord4i)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord4i)", "GLAPI_PREFIX_STR(MultiTexCoord4iARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord4ivARB))"\n" +"\t"STUB_ASM_CODE("405")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord4iv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord4iv)", "GLAPI_PREFIX_STR(MultiTexCoord4ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord4sARB))"\n" +"\t"STUB_ASM_CODE("406")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord4s)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord4s)", "GLAPI_PREFIX_STR(MultiTexCoord4sARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiTexCoord4svARB))"\n" +"\t"STUB_ASM_CODE("407")"\n" + +".globl "GLAPI_PREFIX_STR(MultiTexCoord4sv)"\n" +".set "GLAPI_PREFIX_STR(MultiTexCoord4sv)", "GLAPI_PREFIX_STR(MultiTexCoord4svARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AttachShader))"\n" +"\t"STUB_ASM_CODE("408")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CreateProgram))"\n" +"\t"STUB_ASM_CODE("409")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CreateShader))"\n" +"\t"STUB_ASM_CODE("410")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteProgram))"\n" +"\t"STUB_ASM_CODE("411")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteShader))"\n" +"\t"STUB_ASM_CODE("412")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DetachShader))"\n" +"\t"STUB_ASM_CODE("413")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetAttachedShaders))"\n" +"\t"STUB_ASM_CODE("414")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramInfoLog))"\n" +"\t"STUB_ASM_CODE("415")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramiv))"\n" +"\t"STUB_ASM_CODE("416")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetShaderInfoLog))"\n" +"\t"STUB_ASM_CODE("417")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetShaderiv))"\n" +"\t"STUB_ASM_CODE("418")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsProgram))"\n" +"\t"STUB_ASM_CODE("419")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsShader))"\n" +"\t"STUB_ASM_CODE("420")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(StencilFuncSeparate))"\n" +"\t"STUB_ASM_CODE("421")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(StencilMaskSeparate))"\n" +"\t"STUB_ASM_CODE("422")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(StencilOpSeparate))"\n" +"\t"STUB_ASM_CODE("423")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix2x3fv))"\n" +"\t"STUB_ASM_CODE("424")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix2x4fv))"\n" +"\t"STUB_ASM_CODE("425")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix3x2fv))"\n" +"\t"STUB_ASM_CODE("426")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix3x4fv))"\n" +"\t"STUB_ASM_CODE("427")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix4x2fv))"\n" +"\t"STUB_ASM_CODE("428")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix4x3fv))"\n" +"\t"STUB_ASM_CODE("429")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClampColor))"\n" +"\t"STUB_ASM_CODE("430")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearBufferfi))"\n" +"\t"STUB_ASM_CODE("431")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearBufferfv))"\n" +"\t"STUB_ASM_CODE("432")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearBufferiv))"\n" +"\t"STUB_ASM_CODE("433")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearBufferuiv))"\n" +"\t"STUB_ASM_CODE("434")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetStringi))"\n" +"\t"STUB_ASM_CODE("435")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexBuffer))"\n" +"\t"STUB_ASM_CODE("436")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTexture))"\n" +"\t"STUB_ASM_CODE("437")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetBufferParameteri64v))"\n" +"\t"STUB_ASM_CODE("438")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetInteger64i_v))"\n" +"\t"STUB_ASM_CODE("439")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribDivisor))"\n" +"\t"STUB_ASM_CODE("440")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LoadTransposeMatrixdARB))"\n" +"\t"STUB_ASM_CODE("441")"\n" + +".globl "GLAPI_PREFIX_STR(LoadTransposeMatrixd)"\n" +".set "GLAPI_PREFIX_STR(LoadTransposeMatrixd)", "GLAPI_PREFIX_STR(LoadTransposeMatrixdARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LoadTransposeMatrixfARB))"\n" +"\t"STUB_ASM_CODE("442")"\n" + +".globl "GLAPI_PREFIX_STR(LoadTransposeMatrixf)"\n" +".set "GLAPI_PREFIX_STR(LoadTransposeMatrixf)", "GLAPI_PREFIX_STR(LoadTransposeMatrixfARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultTransposeMatrixdARB))"\n" +"\t"STUB_ASM_CODE("443")"\n" + +".globl "GLAPI_PREFIX_STR(MultTransposeMatrixd)"\n" +".set "GLAPI_PREFIX_STR(MultTransposeMatrixd)", "GLAPI_PREFIX_STR(MultTransposeMatrixdARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultTransposeMatrixfARB))"\n" +"\t"STUB_ASM_CODE("444")"\n" + +".globl "GLAPI_PREFIX_STR(MultTransposeMatrixf)"\n" +".set "GLAPI_PREFIX_STR(MultTransposeMatrixf)", "GLAPI_PREFIX_STR(MultTransposeMatrixfARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SampleCoverageARB))"\n" +"\t"STUB_ASM_CODE("445")"\n" + +".globl "GLAPI_PREFIX_STR(SampleCoverage)"\n" +".set "GLAPI_PREFIX_STR(SampleCoverage)", "GLAPI_PREFIX_STR(SampleCoverageARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CompressedTexImage1DARB))"\n" +"\t"STUB_ASM_CODE("446")"\n" + +".globl "GLAPI_PREFIX_STR(CompressedTexImage1D)"\n" +".set "GLAPI_PREFIX_STR(CompressedTexImage1D)", "GLAPI_PREFIX_STR(CompressedTexImage1DARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CompressedTexImage2DARB))"\n" +"\t"STUB_ASM_CODE("447")"\n" + +".globl "GLAPI_PREFIX_STR(CompressedTexImage2D)"\n" +".set "GLAPI_PREFIX_STR(CompressedTexImage2D)", "GLAPI_PREFIX_STR(CompressedTexImage2DARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CompressedTexImage3DARB))"\n" +"\t"STUB_ASM_CODE("448")"\n" + +".globl "GLAPI_PREFIX_STR(CompressedTexImage3D)"\n" +".set "GLAPI_PREFIX_STR(CompressedTexImage3D)", "GLAPI_PREFIX_STR(CompressedTexImage3DARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CompressedTexSubImage1DARB))"\n" +"\t"STUB_ASM_CODE("449")"\n" + +".globl "GLAPI_PREFIX_STR(CompressedTexSubImage1D)"\n" +".set "GLAPI_PREFIX_STR(CompressedTexSubImage1D)", "GLAPI_PREFIX_STR(CompressedTexSubImage1DARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CompressedTexSubImage2DARB))"\n" +"\t"STUB_ASM_CODE("450")"\n" + +".globl "GLAPI_PREFIX_STR(CompressedTexSubImage2D)"\n" +".set "GLAPI_PREFIX_STR(CompressedTexSubImage2D)", "GLAPI_PREFIX_STR(CompressedTexSubImage2DARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CompressedTexSubImage3DARB))"\n" +"\t"STUB_ASM_CODE("451")"\n" + +".globl "GLAPI_PREFIX_STR(CompressedTexSubImage3D)"\n" +".set "GLAPI_PREFIX_STR(CompressedTexSubImage3D)", "GLAPI_PREFIX_STR(CompressedTexSubImage3DARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCompressedTexImageARB))"\n" +"\t"STUB_ASM_CODE("452")"\n" + +".globl "GLAPI_PREFIX_STR(GetCompressedTexImage)"\n" +".set "GLAPI_PREFIX_STR(GetCompressedTexImage)", "GLAPI_PREFIX_STR(GetCompressedTexImageARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DisableVertexAttribArrayARB))"\n" +"\t"STUB_ASM_CODE("453")"\n" + +".globl "GLAPI_PREFIX_STR(DisableVertexAttribArray)"\n" +".set "GLAPI_PREFIX_STR(DisableVertexAttribArray)", "GLAPI_PREFIX_STR(DisableVertexAttribArrayARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EnableVertexAttribArrayARB))"\n" +"\t"STUB_ASM_CODE("454")"\n" + +".globl "GLAPI_PREFIX_STR(EnableVertexAttribArray)"\n" +".set "GLAPI_PREFIX_STR(EnableVertexAttribArray)", "GLAPI_PREFIX_STR(EnableVertexAttribArrayARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramEnvParameterdvARB))"\n" +"\t"STUB_ASM_CODE("455")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramEnvParameterfvARB))"\n" +"\t"STUB_ASM_CODE("456")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramLocalParameterdvARB))"\n" +"\t"STUB_ASM_CODE("457")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramLocalParameterfvARB))"\n" +"\t"STUB_ASM_CODE("458")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramStringARB))"\n" +"\t"STUB_ASM_CODE("459")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramivARB))"\n" +"\t"STUB_ASM_CODE("460")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribdvARB))"\n" +"\t"STUB_ASM_CODE("461")"\n" + +".globl "GLAPI_PREFIX_STR(GetVertexAttribdv)"\n" +".set "GLAPI_PREFIX_STR(GetVertexAttribdv)", "GLAPI_PREFIX_STR(GetVertexAttribdvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribfvARB))"\n" +"\t"STUB_ASM_CODE("462")"\n" + +".globl "GLAPI_PREFIX_STR(GetVertexAttribfv)"\n" +".set "GLAPI_PREFIX_STR(GetVertexAttribfv)", "GLAPI_PREFIX_STR(GetVertexAttribfvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribivARB))"\n" +"\t"STUB_ASM_CODE("463")"\n" + +".globl "GLAPI_PREFIX_STR(GetVertexAttribiv)"\n" +".set "GLAPI_PREFIX_STR(GetVertexAttribiv)", "GLAPI_PREFIX_STR(GetVertexAttribivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramEnvParameter4dARB))"\n" +"\t"STUB_ASM_CODE("464")"\n" + +".globl "GLAPI_PREFIX_STR(ProgramParameter4dNV)"\n" +".set "GLAPI_PREFIX_STR(ProgramParameter4dNV)", "GLAPI_PREFIX_STR(ProgramEnvParameter4dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramEnvParameter4dvARB))"\n" +"\t"STUB_ASM_CODE("465")"\n" + +".globl "GLAPI_PREFIX_STR(ProgramParameter4dvNV)"\n" +".set "GLAPI_PREFIX_STR(ProgramParameter4dvNV)", "GLAPI_PREFIX_STR(ProgramEnvParameter4dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramEnvParameter4fARB))"\n" +"\t"STUB_ASM_CODE("466")"\n" + +".globl "GLAPI_PREFIX_STR(ProgramParameter4fNV)"\n" +".set "GLAPI_PREFIX_STR(ProgramParameter4fNV)", "GLAPI_PREFIX_STR(ProgramEnvParameter4fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramEnvParameter4fvARB))"\n" +"\t"STUB_ASM_CODE("467")"\n" + +".globl "GLAPI_PREFIX_STR(ProgramParameter4fvNV)"\n" +".set "GLAPI_PREFIX_STR(ProgramParameter4fvNV)", "GLAPI_PREFIX_STR(ProgramEnvParameter4fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramLocalParameter4dARB))"\n" +"\t"STUB_ASM_CODE("468")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramLocalParameter4dvARB))"\n" +"\t"STUB_ASM_CODE("469")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramLocalParameter4fARB))"\n" +"\t"STUB_ASM_CODE("470")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramLocalParameter4fvARB))"\n" +"\t"STUB_ASM_CODE("471")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramStringARB))"\n" +"\t"STUB_ASM_CODE("472")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1dARB))"\n" +"\t"STUB_ASM_CODE("473")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib1d)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib1d)", "GLAPI_PREFIX_STR(VertexAttrib1dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1dvARB))"\n" +"\t"STUB_ASM_CODE("474")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib1dv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib1dv)", "GLAPI_PREFIX_STR(VertexAttrib1dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1fARB))"\n" +"\t"STUB_ASM_CODE("475")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib1f)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib1f)", "GLAPI_PREFIX_STR(VertexAttrib1fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1fvARB))"\n" +"\t"STUB_ASM_CODE("476")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib1fv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib1fv)", "GLAPI_PREFIX_STR(VertexAttrib1fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1sARB))"\n" +"\t"STUB_ASM_CODE("477")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib1s)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib1s)", "GLAPI_PREFIX_STR(VertexAttrib1sARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1svARB))"\n" +"\t"STUB_ASM_CODE("478")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib1sv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib1sv)", "GLAPI_PREFIX_STR(VertexAttrib1svARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2dARB))"\n" +"\t"STUB_ASM_CODE("479")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib2d)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib2d)", "GLAPI_PREFIX_STR(VertexAttrib2dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2dvARB))"\n" +"\t"STUB_ASM_CODE("480")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib2dv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib2dv)", "GLAPI_PREFIX_STR(VertexAttrib2dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2fARB))"\n" +"\t"STUB_ASM_CODE("481")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib2f)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib2f)", "GLAPI_PREFIX_STR(VertexAttrib2fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2fvARB))"\n" +"\t"STUB_ASM_CODE("482")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib2fv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib2fv)", "GLAPI_PREFIX_STR(VertexAttrib2fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2sARB))"\n" +"\t"STUB_ASM_CODE("483")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib2s)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib2s)", "GLAPI_PREFIX_STR(VertexAttrib2sARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2svARB))"\n" +"\t"STUB_ASM_CODE("484")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib2sv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib2sv)", "GLAPI_PREFIX_STR(VertexAttrib2svARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3dARB))"\n" +"\t"STUB_ASM_CODE("485")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib3d)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib3d)", "GLAPI_PREFIX_STR(VertexAttrib3dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3dvARB))"\n" +"\t"STUB_ASM_CODE("486")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib3dv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib3dv)", "GLAPI_PREFIX_STR(VertexAttrib3dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3fARB))"\n" +"\t"STUB_ASM_CODE("487")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib3f)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib3f)", "GLAPI_PREFIX_STR(VertexAttrib3fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3fvARB))"\n" +"\t"STUB_ASM_CODE("488")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib3fv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib3fv)", "GLAPI_PREFIX_STR(VertexAttrib3fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3sARB))"\n" +"\t"STUB_ASM_CODE("489")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib3s)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib3s)", "GLAPI_PREFIX_STR(VertexAttrib3sARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3svARB))"\n" +"\t"STUB_ASM_CODE("490")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib3sv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib3sv)", "GLAPI_PREFIX_STR(VertexAttrib3svARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4NbvARB))"\n" +"\t"STUB_ASM_CODE("491")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4Nbv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4Nbv)", "GLAPI_PREFIX_STR(VertexAttrib4NbvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4NivARB))"\n" +"\t"STUB_ASM_CODE("492")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4Niv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4Niv)", "GLAPI_PREFIX_STR(VertexAttrib4NivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4NsvARB))"\n" +"\t"STUB_ASM_CODE("493")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4Nsv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4Nsv)", "GLAPI_PREFIX_STR(VertexAttrib4NsvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4NubARB))"\n" +"\t"STUB_ASM_CODE("494")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4Nub)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4Nub)", "GLAPI_PREFIX_STR(VertexAttrib4NubARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4NubvARB))"\n" +"\t"STUB_ASM_CODE("495")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4Nubv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4Nubv)", "GLAPI_PREFIX_STR(VertexAttrib4NubvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4NuivARB))"\n" +"\t"STUB_ASM_CODE("496")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4Nuiv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4Nuiv)", "GLAPI_PREFIX_STR(VertexAttrib4NuivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4NusvARB))"\n" +"\t"STUB_ASM_CODE("497")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4Nusv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4Nusv)", "GLAPI_PREFIX_STR(VertexAttrib4NusvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4bvARB))"\n" +"\t"STUB_ASM_CODE("498")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4bv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4bv)", "GLAPI_PREFIX_STR(VertexAttrib4bvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4dARB))"\n" +"\t"STUB_ASM_CODE("499")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4d)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4d)", "GLAPI_PREFIX_STR(VertexAttrib4dARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4dvARB))"\n" +"\t"STUB_ASM_CODE("500")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4dv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4dv)", "GLAPI_PREFIX_STR(VertexAttrib4dvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4fARB))"\n" +"\t"STUB_ASM_CODE("501")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4f)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4f)", "GLAPI_PREFIX_STR(VertexAttrib4fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4fvARB))"\n" +"\t"STUB_ASM_CODE("502")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4fv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4fv)", "GLAPI_PREFIX_STR(VertexAttrib4fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4ivARB))"\n" +"\t"STUB_ASM_CODE("503")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4iv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4iv)", "GLAPI_PREFIX_STR(VertexAttrib4ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4sARB))"\n" +"\t"STUB_ASM_CODE("504")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4s)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4s)", "GLAPI_PREFIX_STR(VertexAttrib4sARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4svARB))"\n" +"\t"STUB_ASM_CODE("505")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4sv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4sv)", "GLAPI_PREFIX_STR(VertexAttrib4svARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4ubvARB))"\n" +"\t"STUB_ASM_CODE("506")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4ubv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4ubv)", "GLAPI_PREFIX_STR(VertexAttrib4ubvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4uivARB))"\n" +"\t"STUB_ASM_CODE("507")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4uiv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4uiv)", "GLAPI_PREFIX_STR(VertexAttrib4uivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4usvARB))"\n" +"\t"STUB_ASM_CODE("508")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttrib4usv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttrib4usv)", "GLAPI_PREFIX_STR(VertexAttrib4usvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribPointerARB))"\n" +"\t"STUB_ASM_CODE("509")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribPointer)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribPointer)", "GLAPI_PREFIX_STR(VertexAttribPointerARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindBufferARB))"\n" +"\t"STUB_ASM_CODE("510")"\n" + +".globl "GLAPI_PREFIX_STR(BindBuffer)"\n" +".set "GLAPI_PREFIX_STR(BindBuffer)", "GLAPI_PREFIX_STR(BindBufferARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BufferDataARB))"\n" +"\t"STUB_ASM_CODE("511")"\n" + +".globl "GLAPI_PREFIX_STR(BufferData)"\n" +".set "GLAPI_PREFIX_STR(BufferData)", "GLAPI_PREFIX_STR(BufferDataARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BufferSubDataARB))"\n" +"\t"STUB_ASM_CODE("512")"\n" + +".globl "GLAPI_PREFIX_STR(BufferSubData)"\n" +".set "GLAPI_PREFIX_STR(BufferSubData)", "GLAPI_PREFIX_STR(BufferSubDataARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteBuffersARB))"\n" +"\t"STUB_ASM_CODE("513")"\n" + +".globl "GLAPI_PREFIX_STR(DeleteBuffers)"\n" +".set "GLAPI_PREFIX_STR(DeleteBuffers)", "GLAPI_PREFIX_STR(DeleteBuffersARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenBuffersARB))"\n" +"\t"STUB_ASM_CODE("514")"\n" + +".globl "GLAPI_PREFIX_STR(GenBuffers)"\n" +".set "GLAPI_PREFIX_STR(GenBuffers)", "GLAPI_PREFIX_STR(GenBuffersARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetBufferParameterivARB))"\n" +"\t"STUB_ASM_CODE("515")"\n" + +".globl "GLAPI_PREFIX_STR(GetBufferParameteriv)"\n" +".set "GLAPI_PREFIX_STR(GetBufferParameteriv)", "GLAPI_PREFIX_STR(GetBufferParameterivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetBufferPointervARB))"\n" +"\t"STUB_ASM_CODE("516")"\n" + +".globl "GLAPI_PREFIX_STR(GetBufferPointerv)"\n" +".set "GLAPI_PREFIX_STR(GetBufferPointerv)", "GLAPI_PREFIX_STR(GetBufferPointervARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetBufferSubDataARB))"\n" +"\t"STUB_ASM_CODE("517")"\n" + +".globl "GLAPI_PREFIX_STR(GetBufferSubData)"\n" +".set "GLAPI_PREFIX_STR(GetBufferSubData)", "GLAPI_PREFIX_STR(GetBufferSubDataARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsBufferARB))"\n" +"\t"STUB_ASM_CODE("518")"\n" + +".globl "GLAPI_PREFIX_STR(IsBuffer)"\n" +".set "GLAPI_PREFIX_STR(IsBuffer)", "GLAPI_PREFIX_STR(IsBufferARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MapBufferARB))"\n" +"\t"STUB_ASM_CODE("519")"\n" + +".globl "GLAPI_PREFIX_STR(MapBuffer)"\n" +".set "GLAPI_PREFIX_STR(MapBuffer)", "GLAPI_PREFIX_STR(MapBufferARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UnmapBufferARB))"\n" +"\t"STUB_ASM_CODE("520")"\n" + +".globl "GLAPI_PREFIX_STR(UnmapBuffer)"\n" +".set "GLAPI_PREFIX_STR(UnmapBuffer)", "GLAPI_PREFIX_STR(UnmapBufferARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BeginQueryARB))"\n" +"\t"STUB_ASM_CODE("521")"\n" + +".globl "GLAPI_PREFIX_STR(BeginQuery)"\n" +".set "GLAPI_PREFIX_STR(BeginQuery)", "GLAPI_PREFIX_STR(BeginQueryARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteQueriesARB))"\n" +"\t"STUB_ASM_CODE("522")"\n" + +".globl "GLAPI_PREFIX_STR(DeleteQueries)"\n" +".set "GLAPI_PREFIX_STR(DeleteQueries)", "GLAPI_PREFIX_STR(DeleteQueriesARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EndQueryARB))"\n" +"\t"STUB_ASM_CODE("523")"\n" + +".globl "GLAPI_PREFIX_STR(EndQuery)"\n" +".set "GLAPI_PREFIX_STR(EndQuery)", "GLAPI_PREFIX_STR(EndQueryARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenQueriesARB))"\n" +"\t"STUB_ASM_CODE("524")"\n" + +".globl "GLAPI_PREFIX_STR(GenQueries)"\n" +".set "GLAPI_PREFIX_STR(GenQueries)", "GLAPI_PREFIX_STR(GenQueriesARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetQueryObjectivARB))"\n" +"\t"STUB_ASM_CODE("525")"\n" + +".globl "GLAPI_PREFIX_STR(GetQueryObjectiv)"\n" +".set "GLAPI_PREFIX_STR(GetQueryObjectiv)", "GLAPI_PREFIX_STR(GetQueryObjectivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetQueryObjectuivARB))"\n" +"\t"STUB_ASM_CODE("526")"\n" + +".globl "GLAPI_PREFIX_STR(GetQueryObjectuiv)"\n" +".set "GLAPI_PREFIX_STR(GetQueryObjectuiv)", "GLAPI_PREFIX_STR(GetQueryObjectuivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetQueryivARB))"\n" +"\t"STUB_ASM_CODE("527")"\n" + +".globl "GLAPI_PREFIX_STR(GetQueryiv)"\n" +".set "GLAPI_PREFIX_STR(GetQueryiv)", "GLAPI_PREFIX_STR(GetQueryivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsQueryARB))"\n" +"\t"STUB_ASM_CODE("528")"\n" + +".globl "GLAPI_PREFIX_STR(IsQuery)"\n" +".set "GLAPI_PREFIX_STR(IsQuery)", "GLAPI_PREFIX_STR(IsQueryARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AttachObjectARB))"\n" +"\t"STUB_ASM_CODE("529")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CompileShaderARB))"\n" +"\t"STUB_ASM_CODE("530")"\n" + +".globl "GLAPI_PREFIX_STR(CompileShader)"\n" +".set "GLAPI_PREFIX_STR(CompileShader)", "GLAPI_PREFIX_STR(CompileShaderARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CreateProgramObjectARB))"\n" +"\t"STUB_ASM_CODE("531")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CreateShaderObjectARB))"\n" +"\t"STUB_ASM_CODE("532")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteObjectARB))"\n" +"\t"STUB_ASM_CODE("533")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DetachObjectARB))"\n" +"\t"STUB_ASM_CODE("534")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetActiveUniformARB))"\n" +"\t"STUB_ASM_CODE("535")"\n" + +".globl "GLAPI_PREFIX_STR(GetActiveUniform)"\n" +".set "GLAPI_PREFIX_STR(GetActiveUniform)", "GLAPI_PREFIX_STR(GetActiveUniformARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetAttachedObjectsARB))"\n" +"\t"STUB_ASM_CODE("536")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetHandleARB))"\n" +"\t"STUB_ASM_CODE("537")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetInfoLogARB))"\n" +"\t"STUB_ASM_CODE("538")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetObjectParameterfvARB))"\n" +"\t"STUB_ASM_CODE("539")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetObjectParameterivARB))"\n" +"\t"STUB_ASM_CODE("540")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetShaderSourceARB))"\n" +"\t"STUB_ASM_CODE("541")"\n" + +".globl "GLAPI_PREFIX_STR(GetShaderSource)"\n" +".set "GLAPI_PREFIX_STR(GetShaderSource)", "GLAPI_PREFIX_STR(GetShaderSourceARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetUniformLocationARB))"\n" +"\t"STUB_ASM_CODE("542")"\n" + +".globl "GLAPI_PREFIX_STR(GetUniformLocation)"\n" +".set "GLAPI_PREFIX_STR(GetUniformLocation)", "GLAPI_PREFIX_STR(GetUniformLocationARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetUniformfvARB))"\n" +"\t"STUB_ASM_CODE("543")"\n" + +".globl "GLAPI_PREFIX_STR(GetUniformfv)"\n" +".set "GLAPI_PREFIX_STR(GetUniformfv)", "GLAPI_PREFIX_STR(GetUniformfvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetUniformivARB))"\n" +"\t"STUB_ASM_CODE("544")"\n" + +".globl "GLAPI_PREFIX_STR(GetUniformiv)"\n" +".set "GLAPI_PREFIX_STR(GetUniformiv)", "GLAPI_PREFIX_STR(GetUniformivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LinkProgramARB))"\n" +"\t"STUB_ASM_CODE("545")"\n" + +".globl "GLAPI_PREFIX_STR(LinkProgram)"\n" +".set "GLAPI_PREFIX_STR(LinkProgram)", "GLAPI_PREFIX_STR(LinkProgramARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ShaderSourceARB))"\n" +"\t"STUB_ASM_CODE("546")"\n" + +".globl "GLAPI_PREFIX_STR(ShaderSource)"\n" +".set "GLAPI_PREFIX_STR(ShaderSource)", "GLAPI_PREFIX_STR(ShaderSourceARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform1fARB))"\n" +"\t"STUB_ASM_CODE("547")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform1f)"\n" +".set "GLAPI_PREFIX_STR(Uniform1f)", "GLAPI_PREFIX_STR(Uniform1fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform1fvARB))"\n" +"\t"STUB_ASM_CODE("548")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform1fv)"\n" +".set "GLAPI_PREFIX_STR(Uniform1fv)", "GLAPI_PREFIX_STR(Uniform1fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform1iARB))"\n" +"\t"STUB_ASM_CODE("549")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform1i)"\n" +".set "GLAPI_PREFIX_STR(Uniform1i)", "GLAPI_PREFIX_STR(Uniform1iARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform1ivARB))"\n" +"\t"STUB_ASM_CODE("550")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform1iv)"\n" +".set "GLAPI_PREFIX_STR(Uniform1iv)", "GLAPI_PREFIX_STR(Uniform1ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform2fARB))"\n" +"\t"STUB_ASM_CODE("551")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform2f)"\n" +".set "GLAPI_PREFIX_STR(Uniform2f)", "GLAPI_PREFIX_STR(Uniform2fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform2fvARB))"\n" +"\t"STUB_ASM_CODE("552")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform2fv)"\n" +".set "GLAPI_PREFIX_STR(Uniform2fv)", "GLAPI_PREFIX_STR(Uniform2fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform2iARB))"\n" +"\t"STUB_ASM_CODE("553")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform2i)"\n" +".set "GLAPI_PREFIX_STR(Uniform2i)", "GLAPI_PREFIX_STR(Uniform2iARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform2ivARB))"\n" +"\t"STUB_ASM_CODE("554")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform2iv)"\n" +".set "GLAPI_PREFIX_STR(Uniform2iv)", "GLAPI_PREFIX_STR(Uniform2ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform3fARB))"\n" +"\t"STUB_ASM_CODE("555")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform3f)"\n" +".set "GLAPI_PREFIX_STR(Uniform3f)", "GLAPI_PREFIX_STR(Uniform3fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform3fvARB))"\n" +"\t"STUB_ASM_CODE("556")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform3fv)"\n" +".set "GLAPI_PREFIX_STR(Uniform3fv)", "GLAPI_PREFIX_STR(Uniform3fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform3iARB))"\n" +"\t"STUB_ASM_CODE("557")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform3i)"\n" +".set "GLAPI_PREFIX_STR(Uniform3i)", "GLAPI_PREFIX_STR(Uniform3iARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform3ivARB))"\n" +"\t"STUB_ASM_CODE("558")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform3iv)"\n" +".set "GLAPI_PREFIX_STR(Uniform3iv)", "GLAPI_PREFIX_STR(Uniform3ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform4fARB))"\n" +"\t"STUB_ASM_CODE("559")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform4f)"\n" +".set "GLAPI_PREFIX_STR(Uniform4f)", "GLAPI_PREFIX_STR(Uniform4fARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform4fvARB))"\n" +"\t"STUB_ASM_CODE("560")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform4fv)"\n" +".set "GLAPI_PREFIX_STR(Uniform4fv)", "GLAPI_PREFIX_STR(Uniform4fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform4iARB))"\n" +"\t"STUB_ASM_CODE("561")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform4i)"\n" +".set "GLAPI_PREFIX_STR(Uniform4i)", "GLAPI_PREFIX_STR(Uniform4iARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform4ivARB))"\n" +"\t"STUB_ASM_CODE("562")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform4iv)"\n" +".set "GLAPI_PREFIX_STR(Uniform4iv)", "GLAPI_PREFIX_STR(Uniform4ivARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix2fvARB))"\n" +"\t"STUB_ASM_CODE("563")"\n" + +".globl "GLAPI_PREFIX_STR(UniformMatrix2fv)"\n" +".set "GLAPI_PREFIX_STR(UniformMatrix2fv)", "GLAPI_PREFIX_STR(UniformMatrix2fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix3fvARB))"\n" +"\t"STUB_ASM_CODE("564")"\n" + +".globl "GLAPI_PREFIX_STR(UniformMatrix3fv)"\n" +".set "GLAPI_PREFIX_STR(UniformMatrix3fv)", "GLAPI_PREFIX_STR(UniformMatrix3fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UniformMatrix4fvARB))"\n" +"\t"STUB_ASM_CODE("565")"\n" + +".globl "GLAPI_PREFIX_STR(UniformMatrix4fv)"\n" +".set "GLAPI_PREFIX_STR(UniformMatrix4fv)", "GLAPI_PREFIX_STR(UniformMatrix4fvARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UseProgramObjectARB))"\n" +"\t"STUB_ASM_CODE("566")"\n" + +".globl "GLAPI_PREFIX_STR(UseProgram)"\n" +".set "GLAPI_PREFIX_STR(UseProgram)", "GLAPI_PREFIX_STR(UseProgramObjectARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ValidateProgramARB))"\n" +"\t"STUB_ASM_CODE("567")"\n" + +".globl "GLAPI_PREFIX_STR(ValidateProgram)"\n" +".set "GLAPI_PREFIX_STR(ValidateProgram)", "GLAPI_PREFIX_STR(ValidateProgramARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindAttribLocationARB))"\n" +"\t"STUB_ASM_CODE("568")"\n" + +".globl "GLAPI_PREFIX_STR(BindAttribLocation)"\n" +".set "GLAPI_PREFIX_STR(BindAttribLocation)", "GLAPI_PREFIX_STR(BindAttribLocationARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetActiveAttribARB))"\n" +"\t"STUB_ASM_CODE("569")"\n" + +".globl "GLAPI_PREFIX_STR(GetActiveAttrib)"\n" +".set "GLAPI_PREFIX_STR(GetActiveAttrib)", "GLAPI_PREFIX_STR(GetActiveAttribARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetAttribLocationARB))"\n" +"\t"STUB_ASM_CODE("570")"\n" + +".globl "GLAPI_PREFIX_STR(GetAttribLocation)"\n" +".set "GLAPI_PREFIX_STR(GetAttribLocation)", "GLAPI_PREFIX_STR(GetAttribLocationARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawBuffersARB))"\n" +"\t"STUB_ASM_CODE("571")"\n" + +".globl "GLAPI_PREFIX_STR(DrawBuffers)"\n" +".set "GLAPI_PREFIX_STR(DrawBuffers)", "GLAPI_PREFIX_STR(DrawBuffersARB)"\n" + +".globl "GLAPI_PREFIX_STR(DrawBuffersATI)"\n" +".set "GLAPI_PREFIX_STR(DrawBuffersATI)", "GLAPI_PREFIX_STR(DrawBuffersARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawArraysInstancedARB))"\n" +"\t"STUB_ASM_CODE("572")"\n" + +".globl "GLAPI_PREFIX_STR(DrawArraysInstanced)"\n" +".set "GLAPI_PREFIX_STR(DrawArraysInstanced)", "GLAPI_PREFIX_STR(DrawArraysInstancedARB)"\n" + +".globl "GLAPI_PREFIX_STR(DrawArraysInstancedEXT)"\n" +".set "GLAPI_PREFIX_STR(DrawArraysInstancedEXT)", "GLAPI_PREFIX_STR(DrawArraysInstancedARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawElementsInstancedARB))"\n" +"\t"STUB_ASM_CODE("573")"\n" + +".globl "GLAPI_PREFIX_STR(DrawElementsInstanced)"\n" +".set "GLAPI_PREFIX_STR(DrawElementsInstanced)", "GLAPI_PREFIX_STR(DrawElementsInstancedARB)"\n" + +".globl "GLAPI_PREFIX_STR(DrawElementsInstancedEXT)"\n" +".set "GLAPI_PREFIX_STR(DrawElementsInstancedEXT)", "GLAPI_PREFIX_STR(DrawElementsInstancedARB)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RenderbufferStorageMultisample))"\n" +"\t"STUB_ASM_CODE("574")"\n" + +".globl "GLAPI_PREFIX_STR(RenderbufferStorageMultisampleEXT)"\n" +".set "GLAPI_PREFIX_STR(RenderbufferStorageMultisampleEXT)", "GLAPI_PREFIX_STR(RenderbufferStorageMultisample)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTextureARB))"\n" +"\t"STUB_ASM_CODE("575")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTextureFaceARB))"\n" +"\t"STUB_ASM_CODE("576")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramParameteriARB))"\n" +"\t"STUB_ASM_CODE("577")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribDivisorARB))"\n" +"\t"STUB_ASM_CODE("578")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FlushMappedBufferRange))"\n" +"\t"STUB_ASM_CODE("579")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MapBufferRange))"\n" +"\t"STUB_ASM_CODE("580")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindVertexArray))"\n" +"\t"STUB_ASM_CODE("581")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenVertexArrays))"\n" +"\t"STUB_ASM_CODE("582")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CopyBufferSubData))"\n" +"\t"STUB_ASM_CODE("583")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClientWaitSync))"\n" +"\t"STUB_ASM_CODE("584")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteSync))"\n" +"\t"STUB_ASM_CODE("585")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FenceSync))"\n" +"\t"STUB_ASM_CODE("586")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetInteger64v))"\n" +"\t"STUB_ASM_CODE("587")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetSynciv))"\n" +"\t"STUB_ASM_CODE("588")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsSync))"\n" +"\t"STUB_ASM_CODE("589")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WaitSync))"\n" +"\t"STUB_ASM_CODE("590")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawElementsBaseVertex))"\n" +"\t"STUB_ASM_CODE("591")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawRangeElementsBaseVertex))"\n" +"\t"STUB_ASM_CODE("592")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiDrawElementsBaseVertex))"\n" +"\t"STUB_ASM_CODE("593")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendEquationSeparateiARB))"\n" +"\t"STUB_ASM_CODE("594")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendEquationiARB))"\n" +"\t"STUB_ASM_CODE("595")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendFuncSeparateiARB))"\n" +"\t"STUB_ASM_CODE("596")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendFunciARB))"\n" +"\t"STUB_ASM_CODE("597")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindTransformFeedback))"\n" +"\t"STUB_ASM_CODE("598")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteTransformFeedbacks))"\n" +"\t"STUB_ASM_CODE("599")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DrawTransformFeedback))"\n" +"\t"STUB_ASM_CODE("600")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenTransformFeedbacks))"\n" +"\t"STUB_ASM_CODE("601")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsTransformFeedback))"\n" +"\t"STUB_ASM_CODE("602")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PauseTransformFeedback))"\n" +"\t"STUB_ASM_CODE("603")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ResumeTransformFeedback))"\n" +"\t"STUB_ASM_CODE("604")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearDepthf))"\n" +"\t"STUB_ASM_CODE("605")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DepthRangef))"\n" +"\t"STUB_ASM_CODE("606")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetShaderPrecisionFormat))"\n" +"\t"STUB_ASM_CODE("607")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ReleaseShaderCompiler))"\n" +"\t"STUB_ASM_CODE("608")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ShaderBinary))"\n" +"\t"STUB_ASM_CODE("609")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PolygonOffsetEXT))"\n" +"\t"STUB_ASM_CODE("613")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorPointerEXT))"\n" +"\t"STUB_ASM_CODE("632")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EdgeFlagPointerEXT))"\n" +"\t"STUB_ASM_CODE("633")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IndexPointerEXT))"\n" +"\t"STUB_ASM_CODE("634")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(NormalPointerEXT))"\n" +"\t"STUB_ASM_CODE("635")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexCoordPointerEXT))"\n" +"\t"STUB_ASM_CODE("636")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexPointerEXT))"\n" +"\t"STUB_ASM_CODE("637")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameterfEXT))"\n" +"\t"STUB_ASM_CODE("638")"\n" + +".globl "GLAPI_PREFIX_STR(PointParameterf)"\n" +".set "GLAPI_PREFIX_STR(PointParameterf)", "GLAPI_PREFIX_STR(PointParameterfEXT)"\n" + +".globl "GLAPI_PREFIX_STR(PointParameterfARB)"\n" +".set "GLAPI_PREFIX_STR(PointParameterfARB)", "GLAPI_PREFIX_STR(PointParameterfEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameterfvEXT))"\n" +"\t"STUB_ASM_CODE("639")"\n" + +".globl "GLAPI_PREFIX_STR(PointParameterfv)"\n" +".set "GLAPI_PREFIX_STR(PointParameterfv)", "GLAPI_PREFIX_STR(PointParameterfvEXT)"\n" + +".globl "GLAPI_PREFIX_STR(PointParameterfvARB)"\n" +".set "GLAPI_PREFIX_STR(PointParameterfvARB)", "GLAPI_PREFIX_STR(PointParameterfvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LockArraysEXT))"\n" +"\t"STUB_ASM_CODE("640")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UnlockArraysEXT))"\n" +"\t"STUB_ASM_CODE("641")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3bEXT))"\n" +"\t"STUB_ASM_CODE("642")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3b)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3b)", "GLAPI_PREFIX_STR(SecondaryColor3bEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3bvEXT))"\n" +"\t"STUB_ASM_CODE("643")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3bv)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3bv)", "GLAPI_PREFIX_STR(SecondaryColor3bvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3dEXT))"\n" +"\t"STUB_ASM_CODE("644")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3d)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3d)", "GLAPI_PREFIX_STR(SecondaryColor3dEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3dvEXT))"\n" +"\t"STUB_ASM_CODE("645")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3dv)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3dv)", "GLAPI_PREFIX_STR(SecondaryColor3dvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3fEXT))"\n" +"\t"STUB_ASM_CODE("646")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3f)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3f)", "GLAPI_PREFIX_STR(SecondaryColor3fEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3fvEXT))"\n" +"\t"STUB_ASM_CODE("647")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3fv)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3fv)", "GLAPI_PREFIX_STR(SecondaryColor3fvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3iEXT))"\n" +"\t"STUB_ASM_CODE("648")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3i)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3i)", "GLAPI_PREFIX_STR(SecondaryColor3iEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3ivEXT))"\n" +"\t"STUB_ASM_CODE("649")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3iv)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3iv)", "GLAPI_PREFIX_STR(SecondaryColor3ivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3sEXT))"\n" +"\t"STUB_ASM_CODE("650")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3s)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3s)", "GLAPI_PREFIX_STR(SecondaryColor3sEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3svEXT))"\n" +"\t"STUB_ASM_CODE("651")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3sv)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3sv)", "GLAPI_PREFIX_STR(SecondaryColor3svEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3ubEXT))"\n" +"\t"STUB_ASM_CODE("652")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3ub)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3ub)", "GLAPI_PREFIX_STR(SecondaryColor3ubEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3ubvEXT))"\n" +"\t"STUB_ASM_CODE("653")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3ubv)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3ubv)", "GLAPI_PREFIX_STR(SecondaryColor3ubvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3uiEXT))"\n" +"\t"STUB_ASM_CODE("654")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3ui)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3ui)", "GLAPI_PREFIX_STR(SecondaryColor3uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3uivEXT))"\n" +"\t"STUB_ASM_CODE("655")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3uiv)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3uiv)", "GLAPI_PREFIX_STR(SecondaryColor3uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3usEXT))"\n" +"\t"STUB_ASM_CODE("656")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3us)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3us)", "GLAPI_PREFIX_STR(SecondaryColor3usEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColor3usvEXT))"\n" +"\t"STUB_ASM_CODE("657")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColor3usv)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColor3usv)", "GLAPI_PREFIX_STR(SecondaryColor3usvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SecondaryColorPointerEXT))"\n" +"\t"STUB_ASM_CODE("658")"\n" + +".globl "GLAPI_PREFIX_STR(SecondaryColorPointer)"\n" +".set "GLAPI_PREFIX_STR(SecondaryColorPointer)", "GLAPI_PREFIX_STR(SecondaryColorPointerEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiDrawArraysEXT))"\n" +"\t"STUB_ASM_CODE("659")"\n" + +".globl "GLAPI_PREFIX_STR(MultiDrawArrays)"\n" +".set "GLAPI_PREFIX_STR(MultiDrawArrays)", "GLAPI_PREFIX_STR(MultiDrawArraysEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(MultiDrawElementsEXT))"\n" +"\t"STUB_ASM_CODE("660")"\n" + +".globl "GLAPI_PREFIX_STR(MultiDrawElements)"\n" +".set "GLAPI_PREFIX_STR(MultiDrawElements)", "GLAPI_PREFIX_STR(MultiDrawElementsEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoordPointerEXT))"\n" +"\t"STUB_ASM_CODE("661")"\n" + +".globl "GLAPI_PREFIX_STR(FogCoordPointer)"\n" +".set "GLAPI_PREFIX_STR(FogCoordPointer)", "GLAPI_PREFIX_STR(FogCoordPointerEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoorddEXT))"\n" +"\t"STUB_ASM_CODE("662")"\n" + +".globl "GLAPI_PREFIX_STR(FogCoordd)"\n" +".set "GLAPI_PREFIX_STR(FogCoordd)", "GLAPI_PREFIX_STR(FogCoorddEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoorddvEXT))"\n" +"\t"STUB_ASM_CODE("663")"\n" + +".globl "GLAPI_PREFIX_STR(FogCoorddv)"\n" +".set "GLAPI_PREFIX_STR(FogCoorddv)", "GLAPI_PREFIX_STR(FogCoorddvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoordfEXT))"\n" +"\t"STUB_ASM_CODE("664")"\n" + +".globl "GLAPI_PREFIX_STR(FogCoordf)"\n" +".set "GLAPI_PREFIX_STR(FogCoordf)", "GLAPI_PREFIX_STR(FogCoordfEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FogCoordfvEXT))"\n" +"\t"STUB_ASM_CODE("665")"\n" + +".globl "GLAPI_PREFIX_STR(FogCoordfv)"\n" +".set "GLAPI_PREFIX_STR(FogCoordfv)", "GLAPI_PREFIX_STR(FogCoordfvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendFuncSeparateEXT))"\n" +"\t"STUB_ASM_CODE("667")"\n" + +".globl "GLAPI_PREFIX_STR(BlendFuncSeparate)"\n" +".set "GLAPI_PREFIX_STR(BlendFuncSeparate)", "GLAPI_PREFIX_STR(BlendFuncSeparateEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FlushVertexArrayRangeNV))"\n" +"\t"STUB_ASM_CODE("668")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexArrayRangeNV))"\n" +"\t"STUB_ASM_CODE("669")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerInputNV))"\n" +"\t"STUB_ASM_CODE("670")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerOutputNV))"\n" +"\t"STUB_ASM_CODE("671")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerParameterfNV))"\n" +"\t"STUB_ASM_CODE("672")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerParameterfvNV))"\n" +"\t"STUB_ASM_CODE("673")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerParameteriNV))"\n" +"\t"STUB_ASM_CODE("674")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CombinerParameterivNV))"\n" +"\t"STUB_ASM_CODE("675")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FinalCombinerInputNV))"\n" +"\t"STUB_ASM_CODE("676")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCombinerInputParameterfvNV))"\n" +"\t"STUB_ASM_CODE("677")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCombinerInputParameterivNV))"\n" +"\t"STUB_ASM_CODE("678")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCombinerOutputParameterfvNV))"\n" +"\t"STUB_ASM_CODE("679")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetCombinerOutputParameterivNV))"\n" +"\t"STUB_ASM_CODE("680")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFinalCombinerInputParameterfvNV))"\n" +"\t"STUB_ASM_CODE("681")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFinalCombinerInputParameterivNV))"\n" +"\t"STUB_ASM_CODE("682")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ResizeBuffersMESA))"\n" +"\t"STUB_ASM_CODE("683")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2dMESA))"\n" +"\t"STUB_ASM_CODE("684")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2d)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2d)", "GLAPI_PREFIX_STR(WindowPos2dMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2dARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2dARB)", "GLAPI_PREFIX_STR(WindowPos2dMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2dvMESA))"\n" +"\t"STUB_ASM_CODE("685")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2dv)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2dv)", "GLAPI_PREFIX_STR(WindowPos2dvMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2dvARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2dvARB)", "GLAPI_PREFIX_STR(WindowPos2dvMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2fMESA))"\n" +"\t"STUB_ASM_CODE("686")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2f)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2f)", "GLAPI_PREFIX_STR(WindowPos2fMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2fARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2fARB)", "GLAPI_PREFIX_STR(WindowPos2fMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2fvMESA))"\n" +"\t"STUB_ASM_CODE("687")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2fv)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2fv)", "GLAPI_PREFIX_STR(WindowPos2fvMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2fvARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2fvARB)", "GLAPI_PREFIX_STR(WindowPos2fvMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2iMESA))"\n" +"\t"STUB_ASM_CODE("688")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2i)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2i)", "GLAPI_PREFIX_STR(WindowPos2iMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2iARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2iARB)", "GLAPI_PREFIX_STR(WindowPos2iMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2ivMESA))"\n" +"\t"STUB_ASM_CODE("689")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2iv)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2iv)", "GLAPI_PREFIX_STR(WindowPos2ivMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2ivARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2ivARB)", "GLAPI_PREFIX_STR(WindowPos2ivMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2sMESA))"\n" +"\t"STUB_ASM_CODE("690")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2s)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2s)", "GLAPI_PREFIX_STR(WindowPos2sMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2sARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2sARB)", "GLAPI_PREFIX_STR(WindowPos2sMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos2svMESA))"\n" +"\t"STUB_ASM_CODE("691")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2sv)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2sv)", "GLAPI_PREFIX_STR(WindowPos2svMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos2svARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos2svARB)", "GLAPI_PREFIX_STR(WindowPos2svMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3dMESA))"\n" +"\t"STUB_ASM_CODE("692")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3d)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3d)", "GLAPI_PREFIX_STR(WindowPos3dMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3dARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3dARB)", "GLAPI_PREFIX_STR(WindowPos3dMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3dvMESA))"\n" +"\t"STUB_ASM_CODE("693")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3dv)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3dv)", "GLAPI_PREFIX_STR(WindowPos3dvMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3dvARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3dvARB)", "GLAPI_PREFIX_STR(WindowPos3dvMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3fMESA))"\n" +"\t"STUB_ASM_CODE("694")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3f)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3f)", "GLAPI_PREFIX_STR(WindowPos3fMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3fARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3fARB)", "GLAPI_PREFIX_STR(WindowPos3fMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3fvMESA))"\n" +"\t"STUB_ASM_CODE("695")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3fv)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3fv)", "GLAPI_PREFIX_STR(WindowPos3fvMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3fvARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3fvARB)", "GLAPI_PREFIX_STR(WindowPos3fvMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3iMESA))"\n" +"\t"STUB_ASM_CODE("696")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3i)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3i)", "GLAPI_PREFIX_STR(WindowPos3iMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3iARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3iARB)", "GLAPI_PREFIX_STR(WindowPos3iMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3ivMESA))"\n" +"\t"STUB_ASM_CODE("697")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3iv)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3iv)", "GLAPI_PREFIX_STR(WindowPos3ivMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3ivARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3ivARB)", "GLAPI_PREFIX_STR(WindowPos3ivMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3sMESA))"\n" +"\t"STUB_ASM_CODE("698")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3s)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3s)", "GLAPI_PREFIX_STR(WindowPos3sMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3sARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3sARB)", "GLAPI_PREFIX_STR(WindowPos3sMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos3svMESA))"\n" +"\t"STUB_ASM_CODE("699")"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3sv)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3sv)", "GLAPI_PREFIX_STR(WindowPos3svMESA)"\n" + +".globl "GLAPI_PREFIX_STR(WindowPos3svARB)"\n" +".set "GLAPI_PREFIX_STR(WindowPos3svARB)", "GLAPI_PREFIX_STR(WindowPos3svMESA)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4dMESA))"\n" +"\t"STUB_ASM_CODE("700")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4dvMESA))"\n" +"\t"STUB_ASM_CODE("701")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4fMESA))"\n" +"\t"STUB_ASM_CODE("702")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4fvMESA))"\n" +"\t"STUB_ASM_CODE("703")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4iMESA))"\n" +"\t"STUB_ASM_CODE("704")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4ivMESA))"\n" +"\t"STUB_ASM_CODE("705")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4sMESA))"\n" +"\t"STUB_ASM_CODE("706")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(WindowPos4svMESA))"\n" +"\t"STUB_ASM_CODE("707")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AreProgramsResidentNV))"\n" +"\t"STUB_ASM_CODE("717")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindProgramNV))"\n" +"\t"STUB_ASM_CODE("718")"\n" + +".globl "GLAPI_PREFIX_STR(BindProgramARB)"\n" +".set "GLAPI_PREFIX_STR(BindProgramARB)", "GLAPI_PREFIX_STR(BindProgramNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteProgramsNV))"\n" +"\t"STUB_ASM_CODE("719")"\n" + +".globl "GLAPI_PREFIX_STR(DeleteProgramsARB)"\n" +".set "GLAPI_PREFIX_STR(DeleteProgramsARB)", "GLAPI_PREFIX_STR(DeleteProgramsNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ExecuteProgramNV))"\n" +"\t"STUB_ASM_CODE("720")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenProgramsNV))"\n" +"\t"STUB_ASM_CODE("721")"\n" + +".globl "GLAPI_PREFIX_STR(GenProgramsARB)"\n" +".set "GLAPI_PREFIX_STR(GenProgramsARB)", "GLAPI_PREFIX_STR(GenProgramsNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramParameterdvNV))"\n" +"\t"STUB_ASM_CODE("722")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramParameterfvNV))"\n" +"\t"STUB_ASM_CODE("723")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramStringNV))"\n" +"\t"STUB_ASM_CODE("724")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramivNV))"\n" +"\t"STUB_ASM_CODE("725")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTrackMatrixivNV))"\n" +"\t"STUB_ASM_CODE("726")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribPointervNV))"\n" +"\t"STUB_ASM_CODE("727")"\n" + +".globl "GLAPI_PREFIX_STR(GetVertexAttribPointerv)"\n" +".set "GLAPI_PREFIX_STR(GetVertexAttribPointerv)", "GLAPI_PREFIX_STR(GetVertexAttribPointervNV)"\n" + +".globl "GLAPI_PREFIX_STR(GetVertexAttribPointervARB)"\n" +".set "GLAPI_PREFIX_STR(GetVertexAttribPointervARB)", "GLAPI_PREFIX_STR(GetVertexAttribPointervNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribdvNV))"\n" +"\t"STUB_ASM_CODE("728")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribfvNV))"\n" +"\t"STUB_ASM_CODE("729")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribivNV))"\n" +"\t"STUB_ASM_CODE("730")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsProgramNV))"\n" +"\t"STUB_ASM_CODE("731")"\n" + +".globl "GLAPI_PREFIX_STR(IsProgramARB)"\n" +".set "GLAPI_PREFIX_STR(IsProgramARB)", "GLAPI_PREFIX_STR(IsProgramNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(LoadProgramNV))"\n" +"\t"STUB_ASM_CODE("732")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramParameters4dvNV))"\n" +"\t"STUB_ASM_CODE("733")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramParameters4fvNV))"\n" +"\t"STUB_ASM_CODE("734")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RequestResidentProgramsNV))"\n" +"\t"STUB_ASM_CODE("735")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TrackMatrixNV))"\n" +"\t"STUB_ASM_CODE("736")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1dNV))"\n" +"\t"STUB_ASM_CODE("737")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1dvNV))"\n" +"\t"STUB_ASM_CODE("738")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1fNV))"\n" +"\t"STUB_ASM_CODE("739")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1fvNV))"\n" +"\t"STUB_ASM_CODE("740")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1sNV))"\n" +"\t"STUB_ASM_CODE("741")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib1svNV))"\n" +"\t"STUB_ASM_CODE("742")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2dNV))"\n" +"\t"STUB_ASM_CODE("743")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2dvNV))"\n" +"\t"STUB_ASM_CODE("744")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2fNV))"\n" +"\t"STUB_ASM_CODE("745")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2fvNV))"\n" +"\t"STUB_ASM_CODE("746")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2sNV))"\n" +"\t"STUB_ASM_CODE("747")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib2svNV))"\n" +"\t"STUB_ASM_CODE("748")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3dNV))"\n" +"\t"STUB_ASM_CODE("749")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3dvNV))"\n" +"\t"STUB_ASM_CODE("750")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3fNV))"\n" +"\t"STUB_ASM_CODE("751")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3fvNV))"\n" +"\t"STUB_ASM_CODE("752")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3sNV))"\n" +"\t"STUB_ASM_CODE("753")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib3svNV))"\n" +"\t"STUB_ASM_CODE("754")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4dNV))"\n" +"\t"STUB_ASM_CODE("755")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4dvNV))"\n" +"\t"STUB_ASM_CODE("756")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4fNV))"\n" +"\t"STUB_ASM_CODE("757")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4fvNV))"\n" +"\t"STUB_ASM_CODE("758")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4sNV))"\n" +"\t"STUB_ASM_CODE("759")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4svNV))"\n" +"\t"STUB_ASM_CODE("760")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4ubNV))"\n" +"\t"STUB_ASM_CODE("761")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttrib4ubvNV))"\n" +"\t"STUB_ASM_CODE("762")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribPointerNV))"\n" +"\t"STUB_ASM_CODE("763")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs1dvNV))"\n" +"\t"STUB_ASM_CODE("764")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs1fvNV))"\n" +"\t"STUB_ASM_CODE("765")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs1svNV))"\n" +"\t"STUB_ASM_CODE("766")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs2dvNV))"\n" +"\t"STUB_ASM_CODE("767")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs2fvNV))"\n" +"\t"STUB_ASM_CODE("768")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs2svNV))"\n" +"\t"STUB_ASM_CODE("769")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs3dvNV))"\n" +"\t"STUB_ASM_CODE("770")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs3fvNV))"\n" +"\t"STUB_ASM_CODE("771")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs3svNV))"\n" +"\t"STUB_ASM_CODE("772")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs4dvNV))"\n" +"\t"STUB_ASM_CODE("773")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs4fvNV))"\n" +"\t"STUB_ASM_CODE("774")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs4svNV))"\n" +"\t"STUB_ASM_CODE("775")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribs4ubvNV))"\n" +"\t"STUB_ASM_CODE("776")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexBumpParameterfvATI))"\n" +"\t"STUB_ASM_CODE("777")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexBumpParameterivATI))"\n" +"\t"STUB_ASM_CODE("778")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexBumpParameterfvATI))"\n" +"\t"STUB_ASM_CODE("779")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexBumpParameterivATI))"\n" +"\t"STUB_ASM_CODE("780")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AlphaFragmentOp1ATI))"\n" +"\t"STUB_ASM_CODE("781")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AlphaFragmentOp2ATI))"\n" +"\t"STUB_ASM_CODE("782")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(AlphaFragmentOp3ATI))"\n" +"\t"STUB_ASM_CODE("783")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BeginFragmentShaderATI))"\n" +"\t"STUB_ASM_CODE("784")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindFragmentShaderATI))"\n" +"\t"STUB_ASM_CODE("785")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorFragmentOp1ATI))"\n" +"\t"STUB_ASM_CODE("786")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorFragmentOp2ATI))"\n" +"\t"STUB_ASM_CODE("787")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorFragmentOp3ATI))"\n" +"\t"STUB_ASM_CODE("788")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteFragmentShaderATI))"\n" +"\t"STUB_ASM_CODE("789")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EndFragmentShaderATI))"\n" +"\t"STUB_ASM_CODE("790")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenFragmentShadersATI))"\n" +"\t"STUB_ASM_CODE("791")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PassTexCoordATI))"\n" +"\t"STUB_ASM_CODE("792")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SampleMapATI))"\n" +"\t"STUB_ASM_CODE("793")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(SetFragmentShaderConstantATI))"\n" +"\t"STUB_ASM_CODE("794")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameteriNV))"\n" +"\t"STUB_ASM_CODE("795")"\n" + +".globl "GLAPI_PREFIX_STR(PointParameteri)"\n" +".set "GLAPI_PREFIX_STR(PointParameteri)", "GLAPI_PREFIX_STR(PointParameteriNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PointParameterivNV))"\n" +"\t"STUB_ASM_CODE("796")"\n" + +".globl "GLAPI_PREFIX_STR(PointParameteriv)"\n" +".set "GLAPI_PREFIX_STR(PointParameteriv)", "GLAPI_PREFIX_STR(PointParameterivNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteVertexArrays))"\n" +"\t"STUB_ASM_CODE("799")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsVertexArray))"\n" +"\t"STUB_ASM_CODE("801")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramNamedParameterdvNV))"\n" +"\t"STUB_ASM_CODE("802")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetProgramNamedParameterfvNV))"\n" +"\t"STUB_ASM_CODE("803")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramNamedParameter4dNV))"\n" +"\t"STUB_ASM_CODE("804")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramNamedParameter4dvNV))"\n" +"\t"STUB_ASM_CODE("805")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramNamedParameter4fNV))"\n" +"\t"STUB_ASM_CODE("806")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProgramNamedParameter4fvNV))"\n" +"\t"STUB_ASM_CODE("807")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PrimitiveRestartIndexNV))"\n" +"\t"STUB_ASM_CODE("808")"\n" + +".globl "GLAPI_PREFIX_STR(PrimitiveRestartIndex)"\n" +".set "GLAPI_PREFIX_STR(PrimitiveRestartIndex)", "GLAPI_PREFIX_STR(PrimitiveRestartIndexNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(PrimitiveRestartNV))"\n" +"\t"STUB_ASM_CODE("809")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlendEquationSeparate))"\n" +"\t"STUB_ASM_CODE("857")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindFramebufferEXT))"\n" +"\t"STUB_ASM_CODE("858")"\n" + +".globl "GLAPI_PREFIX_STR(BindFramebuffer)"\n" +".set "GLAPI_PREFIX_STR(BindFramebuffer)", "GLAPI_PREFIX_STR(BindFramebufferEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindRenderbufferEXT))"\n" +"\t"STUB_ASM_CODE("859")"\n" + +".globl "GLAPI_PREFIX_STR(BindRenderbuffer)"\n" +".set "GLAPI_PREFIX_STR(BindRenderbuffer)", "GLAPI_PREFIX_STR(BindRenderbufferEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CheckFramebufferStatusEXT))"\n" +"\t"STUB_ASM_CODE("860")"\n" + +".globl "GLAPI_PREFIX_STR(CheckFramebufferStatus)"\n" +".set "GLAPI_PREFIX_STR(CheckFramebufferStatus)", "GLAPI_PREFIX_STR(CheckFramebufferStatusEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteFramebuffersEXT))"\n" +"\t"STUB_ASM_CODE("861")"\n" + +".globl "GLAPI_PREFIX_STR(DeleteFramebuffers)"\n" +".set "GLAPI_PREFIX_STR(DeleteFramebuffers)", "GLAPI_PREFIX_STR(DeleteFramebuffersEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DeleteRenderbuffersEXT))"\n" +"\t"STUB_ASM_CODE("862")"\n" + +".globl "GLAPI_PREFIX_STR(DeleteRenderbuffers)"\n" +".set "GLAPI_PREFIX_STR(DeleteRenderbuffers)", "GLAPI_PREFIX_STR(DeleteRenderbuffersEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferRenderbufferEXT))"\n" +"\t"STUB_ASM_CODE("863")"\n" + +".globl "GLAPI_PREFIX_STR(FramebufferRenderbuffer)"\n" +".set "GLAPI_PREFIX_STR(FramebufferRenderbuffer)", "GLAPI_PREFIX_STR(FramebufferRenderbufferEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTexture1DEXT))"\n" +"\t"STUB_ASM_CODE("864")"\n" + +".globl "GLAPI_PREFIX_STR(FramebufferTexture1D)"\n" +".set "GLAPI_PREFIX_STR(FramebufferTexture1D)", "GLAPI_PREFIX_STR(FramebufferTexture1DEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTexture2DEXT))"\n" +"\t"STUB_ASM_CODE("865")"\n" + +".globl "GLAPI_PREFIX_STR(FramebufferTexture2D)"\n" +".set "GLAPI_PREFIX_STR(FramebufferTexture2D)", "GLAPI_PREFIX_STR(FramebufferTexture2DEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTexture3DEXT))"\n" +"\t"STUB_ASM_CODE("866")"\n" + +".globl "GLAPI_PREFIX_STR(FramebufferTexture3D)"\n" +".set "GLAPI_PREFIX_STR(FramebufferTexture3D)", "GLAPI_PREFIX_STR(FramebufferTexture3DEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenFramebuffersEXT))"\n" +"\t"STUB_ASM_CODE("867")"\n" + +".globl "GLAPI_PREFIX_STR(GenFramebuffers)"\n" +".set "GLAPI_PREFIX_STR(GenFramebuffers)", "GLAPI_PREFIX_STR(GenFramebuffersEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenRenderbuffersEXT))"\n" +"\t"STUB_ASM_CODE("868")"\n" + +".globl "GLAPI_PREFIX_STR(GenRenderbuffers)"\n" +".set "GLAPI_PREFIX_STR(GenRenderbuffers)", "GLAPI_PREFIX_STR(GenRenderbuffersEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GenerateMipmapEXT))"\n" +"\t"STUB_ASM_CODE("869")"\n" + +".globl "GLAPI_PREFIX_STR(GenerateMipmap)"\n" +".set "GLAPI_PREFIX_STR(GenerateMipmap)", "GLAPI_PREFIX_STR(GenerateMipmapEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFramebufferAttachmentParameterivEXT))"\n" +"\t"STUB_ASM_CODE("870")"\n" + +".globl "GLAPI_PREFIX_STR(GetFramebufferAttachmentParameteriv)"\n" +".set "GLAPI_PREFIX_STR(GetFramebufferAttachmentParameteriv)", "GLAPI_PREFIX_STR(GetFramebufferAttachmentParameterivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetRenderbufferParameterivEXT))"\n" +"\t"STUB_ASM_CODE("871")"\n" + +".globl "GLAPI_PREFIX_STR(GetRenderbufferParameteriv)"\n" +".set "GLAPI_PREFIX_STR(GetRenderbufferParameteriv)", "GLAPI_PREFIX_STR(GetRenderbufferParameterivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsFramebufferEXT))"\n" +"\t"STUB_ASM_CODE("872")"\n" + +".globl "GLAPI_PREFIX_STR(IsFramebuffer)"\n" +".set "GLAPI_PREFIX_STR(IsFramebuffer)", "GLAPI_PREFIX_STR(IsFramebufferEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsRenderbufferEXT))"\n" +"\t"STUB_ASM_CODE("873")"\n" + +".globl "GLAPI_PREFIX_STR(IsRenderbuffer)"\n" +".set "GLAPI_PREFIX_STR(IsRenderbuffer)", "GLAPI_PREFIX_STR(IsRenderbufferEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(RenderbufferStorageEXT))"\n" +"\t"STUB_ASM_CODE("874")"\n" + +".globl "GLAPI_PREFIX_STR(RenderbufferStorage)"\n" +".set "GLAPI_PREFIX_STR(RenderbufferStorage)", "GLAPI_PREFIX_STR(RenderbufferStorageEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BlitFramebuffer))"\n" +"\t"STUB_ASM_CODE("875")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindFragDataLocationEXT))"\n" +"\t"STUB_ASM_CODE("878")"\n" + +".globl "GLAPI_PREFIX_STR(BindFragDataLocation)"\n" +".set "GLAPI_PREFIX_STR(BindFragDataLocation)", "GLAPI_PREFIX_STR(BindFragDataLocationEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetFragDataLocationEXT))"\n" +"\t"STUB_ASM_CODE("879")"\n" + +".globl "GLAPI_PREFIX_STR(GetFragDataLocation)"\n" +".set "GLAPI_PREFIX_STR(GetFragDataLocation)", "GLAPI_PREFIX_STR(GetFragDataLocationEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetUniformuivEXT))"\n" +"\t"STUB_ASM_CODE("880")"\n" + +".globl "GLAPI_PREFIX_STR(GetUniformuiv)"\n" +".set "GLAPI_PREFIX_STR(GetUniformuiv)", "GLAPI_PREFIX_STR(GetUniformuivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribIivEXT))"\n" +"\t"STUB_ASM_CODE("881")"\n" + +".globl "GLAPI_PREFIX_STR(GetVertexAttribIiv)"\n" +".set "GLAPI_PREFIX_STR(GetVertexAttribIiv)", "GLAPI_PREFIX_STR(GetVertexAttribIivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetVertexAttribIuivEXT))"\n" +"\t"STUB_ASM_CODE("882")"\n" + +".globl "GLAPI_PREFIX_STR(GetVertexAttribIuiv)"\n" +".set "GLAPI_PREFIX_STR(GetVertexAttribIuiv)", "GLAPI_PREFIX_STR(GetVertexAttribIuivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform1uiEXT))"\n" +"\t"STUB_ASM_CODE("883")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform1ui)"\n" +".set "GLAPI_PREFIX_STR(Uniform1ui)", "GLAPI_PREFIX_STR(Uniform1uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform1uivEXT))"\n" +"\t"STUB_ASM_CODE("884")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform1uiv)"\n" +".set "GLAPI_PREFIX_STR(Uniform1uiv)", "GLAPI_PREFIX_STR(Uniform1uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform2uiEXT))"\n" +"\t"STUB_ASM_CODE("885")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform2ui)"\n" +".set "GLAPI_PREFIX_STR(Uniform2ui)", "GLAPI_PREFIX_STR(Uniform2uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform2uivEXT))"\n" +"\t"STUB_ASM_CODE("886")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform2uiv)"\n" +".set "GLAPI_PREFIX_STR(Uniform2uiv)", "GLAPI_PREFIX_STR(Uniform2uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform3uiEXT))"\n" +"\t"STUB_ASM_CODE("887")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform3ui)"\n" +".set "GLAPI_PREFIX_STR(Uniform3ui)", "GLAPI_PREFIX_STR(Uniform3uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform3uivEXT))"\n" +"\t"STUB_ASM_CODE("888")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform3uiv)"\n" +".set "GLAPI_PREFIX_STR(Uniform3uiv)", "GLAPI_PREFIX_STR(Uniform3uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform4uiEXT))"\n" +"\t"STUB_ASM_CODE("889")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform4ui)"\n" +".set "GLAPI_PREFIX_STR(Uniform4ui)", "GLAPI_PREFIX_STR(Uniform4uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(Uniform4uivEXT))"\n" +"\t"STUB_ASM_CODE("890")"\n" + +".globl "GLAPI_PREFIX_STR(Uniform4uiv)"\n" +".set "GLAPI_PREFIX_STR(Uniform4uiv)", "GLAPI_PREFIX_STR(Uniform4uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI1iEXT))"\n" +"\t"STUB_ASM_CODE("891")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI1i)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI1i)", "GLAPI_PREFIX_STR(VertexAttribI1iEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI1ivEXT))"\n" +"\t"STUB_ASM_CODE("892")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI1iv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI1iv)", "GLAPI_PREFIX_STR(VertexAttribI1ivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI1uiEXT))"\n" +"\t"STUB_ASM_CODE("893")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI1ui)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI1ui)", "GLAPI_PREFIX_STR(VertexAttribI1uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI1uivEXT))"\n" +"\t"STUB_ASM_CODE("894")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI1uiv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI1uiv)", "GLAPI_PREFIX_STR(VertexAttribI1uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI2iEXT))"\n" +"\t"STUB_ASM_CODE("895")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI2i)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI2i)", "GLAPI_PREFIX_STR(VertexAttribI2iEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI2ivEXT))"\n" +"\t"STUB_ASM_CODE("896")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI2iv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI2iv)", "GLAPI_PREFIX_STR(VertexAttribI2ivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI2uiEXT))"\n" +"\t"STUB_ASM_CODE("897")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI2ui)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI2ui)", "GLAPI_PREFIX_STR(VertexAttribI2uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI2uivEXT))"\n" +"\t"STUB_ASM_CODE("898")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI2uiv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI2uiv)", "GLAPI_PREFIX_STR(VertexAttribI2uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI3iEXT))"\n" +"\t"STUB_ASM_CODE("899")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI3i)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI3i)", "GLAPI_PREFIX_STR(VertexAttribI3iEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI3ivEXT))"\n" +"\t"STUB_ASM_CODE("900")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI3iv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI3iv)", "GLAPI_PREFIX_STR(VertexAttribI3ivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI3uiEXT))"\n" +"\t"STUB_ASM_CODE("901")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI3ui)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI3ui)", "GLAPI_PREFIX_STR(VertexAttribI3uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI3uivEXT))"\n" +"\t"STUB_ASM_CODE("902")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI3uiv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI3uiv)", "GLAPI_PREFIX_STR(VertexAttribI3uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4bvEXT))"\n" +"\t"STUB_ASM_CODE("903")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI4bv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI4bv)", "GLAPI_PREFIX_STR(VertexAttribI4bvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4iEXT))"\n" +"\t"STUB_ASM_CODE("904")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI4i)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI4i)", "GLAPI_PREFIX_STR(VertexAttribI4iEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4ivEXT))"\n" +"\t"STUB_ASM_CODE("905")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI4iv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI4iv)", "GLAPI_PREFIX_STR(VertexAttribI4ivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4svEXT))"\n" +"\t"STUB_ASM_CODE("906")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI4sv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI4sv)", "GLAPI_PREFIX_STR(VertexAttribI4svEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4ubvEXT))"\n" +"\t"STUB_ASM_CODE("907")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI4ubv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI4ubv)", "GLAPI_PREFIX_STR(VertexAttribI4ubvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4uiEXT))"\n" +"\t"STUB_ASM_CODE("908")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI4ui)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI4ui)", "GLAPI_PREFIX_STR(VertexAttribI4uiEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4uivEXT))"\n" +"\t"STUB_ASM_CODE("909")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI4uiv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI4uiv)", "GLAPI_PREFIX_STR(VertexAttribI4uivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribI4usvEXT))"\n" +"\t"STUB_ASM_CODE("910")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribI4usv)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribI4usv)", "GLAPI_PREFIX_STR(VertexAttribI4usvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(VertexAttribIPointerEXT))"\n" +"\t"STUB_ASM_CODE("911")"\n" + +".globl "GLAPI_PREFIX_STR(VertexAttribIPointer)"\n" +".set "GLAPI_PREFIX_STR(VertexAttribIPointer)", "GLAPI_PREFIX_STR(VertexAttribIPointerEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(FramebufferTextureLayerEXT))"\n" +"\t"STUB_ASM_CODE("912")"\n" + +".globl "GLAPI_PREFIX_STR(FramebufferTextureLayer)"\n" +".set "GLAPI_PREFIX_STR(FramebufferTextureLayer)", "GLAPI_PREFIX_STR(FramebufferTextureLayerEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ColorMaskIndexedEXT))"\n" +"\t"STUB_ASM_CODE("913")"\n" + +".globl "GLAPI_PREFIX_STR(ColorMaski)"\n" +".set "GLAPI_PREFIX_STR(ColorMaski)", "GLAPI_PREFIX_STR(ColorMaskIndexedEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(DisableIndexedEXT))"\n" +"\t"STUB_ASM_CODE("914")"\n" + +".globl "GLAPI_PREFIX_STR(Disablei)"\n" +".set "GLAPI_PREFIX_STR(Disablei)", "GLAPI_PREFIX_STR(DisableIndexedEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EnableIndexedEXT))"\n" +"\t"STUB_ASM_CODE("915")"\n" + +".globl "GLAPI_PREFIX_STR(Enablei)"\n" +".set "GLAPI_PREFIX_STR(Enablei)", "GLAPI_PREFIX_STR(EnableIndexedEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetBooleanIndexedvEXT))"\n" +"\t"STUB_ASM_CODE("916")"\n" + +".globl "GLAPI_PREFIX_STR(GetBooleani_v)"\n" +".set "GLAPI_PREFIX_STR(GetBooleani_v)", "GLAPI_PREFIX_STR(GetBooleanIndexedvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetIntegerIndexedvEXT))"\n" +"\t"STUB_ASM_CODE("917")"\n" + +".globl "GLAPI_PREFIX_STR(GetIntegeri_v)"\n" +".set "GLAPI_PREFIX_STR(GetIntegeri_v)", "GLAPI_PREFIX_STR(GetIntegerIndexedvEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(IsEnabledIndexedEXT))"\n" +"\t"STUB_ASM_CODE("918")"\n" + +".globl "GLAPI_PREFIX_STR(IsEnabledi)"\n" +".set "GLAPI_PREFIX_STR(IsEnabledi)", "GLAPI_PREFIX_STR(IsEnabledIndexedEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearColorIiEXT))"\n" +"\t"STUB_ASM_CODE("919")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ClearColorIuiEXT))"\n" +"\t"STUB_ASM_CODE("920")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexParameterIivEXT))"\n" +"\t"STUB_ASM_CODE("921")"\n" + +".globl "GLAPI_PREFIX_STR(GetTexParameterIiv)"\n" +".set "GLAPI_PREFIX_STR(GetTexParameterIiv)", "GLAPI_PREFIX_STR(GetTexParameterIivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTexParameterIuivEXT))"\n" +"\t"STUB_ASM_CODE("922")"\n" + +".globl "GLAPI_PREFIX_STR(GetTexParameterIuiv)"\n" +".set "GLAPI_PREFIX_STR(GetTexParameterIuiv)", "GLAPI_PREFIX_STR(GetTexParameterIuivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexParameterIivEXT))"\n" +"\t"STUB_ASM_CODE("923")"\n" + +".globl "GLAPI_PREFIX_STR(TexParameterIiv)"\n" +".set "GLAPI_PREFIX_STR(TexParameterIiv)", "GLAPI_PREFIX_STR(TexParameterIivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TexParameterIuivEXT))"\n" +"\t"STUB_ASM_CODE("924")"\n" + +".globl "GLAPI_PREFIX_STR(TexParameterIuiv)"\n" +".set "GLAPI_PREFIX_STR(TexParameterIuiv)", "GLAPI_PREFIX_STR(TexParameterIuivEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BeginConditionalRenderNV))"\n" +"\t"STUB_ASM_CODE("925")"\n" + +".globl "GLAPI_PREFIX_STR(BeginConditionalRender)"\n" +".set "GLAPI_PREFIX_STR(BeginConditionalRender)", "GLAPI_PREFIX_STR(BeginConditionalRenderNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EndConditionalRenderNV))"\n" +"\t"STUB_ASM_CODE("926")"\n" + +".globl "GLAPI_PREFIX_STR(EndConditionalRender)"\n" +".set "GLAPI_PREFIX_STR(EndConditionalRender)", "GLAPI_PREFIX_STR(EndConditionalRenderNV)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BeginTransformFeedbackEXT))"\n" +"\t"STUB_ASM_CODE("927")"\n" + +".globl "GLAPI_PREFIX_STR(BeginTransformFeedback)"\n" +".set "GLAPI_PREFIX_STR(BeginTransformFeedback)", "GLAPI_PREFIX_STR(BeginTransformFeedbackEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindBufferBaseEXT))"\n" +"\t"STUB_ASM_CODE("928")"\n" + +".globl "GLAPI_PREFIX_STR(BindBufferBase)"\n" +".set "GLAPI_PREFIX_STR(BindBufferBase)", "GLAPI_PREFIX_STR(BindBufferBaseEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindBufferOffsetEXT))"\n" +"\t"STUB_ASM_CODE("929")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(BindBufferRangeEXT))"\n" +"\t"STUB_ASM_CODE("930")"\n" + +".globl "GLAPI_PREFIX_STR(BindBufferRange)"\n" +".set "GLAPI_PREFIX_STR(BindBufferRange)", "GLAPI_PREFIX_STR(BindBufferRangeEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EndTransformFeedbackEXT))"\n" +"\t"STUB_ASM_CODE("931")"\n" + +".globl "GLAPI_PREFIX_STR(EndTransformFeedback)"\n" +".set "GLAPI_PREFIX_STR(EndTransformFeedback)", "GLAPI_PREFIX_STR(EndTransformFeedbackEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetTransformFeedbackVaryingEXT))"\n" +"\t"STUB_ASM_CODE("932")"\n" + +".globl "GLAPI_PREFIX_STR(GetTransformFeedbackVarying)"\n" +".set "GLAPI_PREFIX_STR(GetTransformFeedbackVarying)", "GLAPI_PREFIX_STR(GetTransformFeedbackVaryingEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(TransformFeedbackVaryingsEXT))"\n" +"\t"STUB_ASM_CODE("933")"\n" + +".globl "GLAPI_PREFIX_STR(TransformFeedbackVaryings)"\n" +".set "GLAPI_PREFIX_STR(TransformFeedbackVaryings)", "GLAPI_PREFIX_STR(TransformFeedbackVaryingsEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ProvokingVertexEXT))"\n" +"\t"STUB_ASM_CODE("934")"\n" + +".globl "GLAPI_PREFIX_STR(ProvokingVertex)"\n" +".set "GLAPI_PREFIX_STR(ProvokingVertex)", "GLAPI_PREFIX_STR(ProvokingVertexEXT)"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(GetObjectParameterivAPPLE))"\n" +"\t"STUB_ASM_CODE("937")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ObjectPurgeableAPPLE))"\n" +"\t"STUB_ASM_CODE("938")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ObjectUnpurgeableAPPLE))"\n" +"\t"STUB_ASM_CODE("939")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(ActiveProgramEXT))"\n" +"\t"STUB_ASM_CODE("940")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(CreateShaderProgramEXT))"\n" +"\t"STUB_ASM_CODE("941")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(UseShaderProgramEXT))"\n" +"\t"STUB_ASM_CODE("942")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EGLImageTargetRenderbufferStorageOES))"\n" +"\t"STUB_ASM_CODE("948")"\n" + +STUB_ASM_ENTRY(GLAPI_PREFIX_STR(EGLImageTargetTexture2DOES))"\n" +"\t"STUB_ASM_CODE("949")"\n" + +); +#undef MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN +#endif /* MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN */ diff --git a/mesalib/src/mapi/mapi/entry.c b/mesalib/src/mapi/mapi/entry.c index 6ffd62d7f..f378ccfda 100644 --- a/mesalib/src/mapi/mapi/entry.c +++ b/mesalib/src/mapi/mapi/entry.c @@ -1,73 +1,98 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu - */ - -#include "entry.h" - -#if defined(USE_X86_ASM) && defined(__GNUC__) -# ifdef GLX_USE_TLS -# include "entry_x86_tls.h" -# else -# include "entry_x86_tsd.h" -# endif -#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS) -# include "entry_x86-64_tls.h" -#else - -#include -#include "u_current.h" - -/* C version of the public entries */ -#define MAPI_TMP_DEFINES -#define MAPI_TMP_PUBLIC_DECLARES -#define MAPI_TMP_PUBLIC_ENTRIES -#include "mapi_tmp.h" - -void -entry_patch_public(void) -{ -} - -mapi_func -entry_get_public(int slot) -{ - /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */ - return public_entries[slot]; -} - -mapi_func -entry_generate(int slot) -{ - return NULL; -} - -void -entry_patch(mapi_func entry, int slot) -{ -} - -#endif /* asm */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + +#include "entry.h" +#include "u_current.h" +#include "u_macros.h" + +/* define macros for use by assembly dispatchers */ +#define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table) + +/* in bridge mode, mapi is a user of glapi */ +#ifdef MAPI_MODE_BRIDGE +#define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch" +#else +#define ENTRY_CURRENT_TABLE_GET "u_current_get_internal" +#endif + +#if defined(USE_X86_ASM) && defined(__GNUC__) +# ifdef GLX_USE_TLS +# include "entry_x86_tls.h" +# else +# include "entry_x86_tsd.h" +# endif +#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS) +# include "entry_x86-64_tls.h" +#else + +#include + +static INLINE const struct mapi_table * +entry_current_get(void) +{ +#ifdef MAPI_MODE_BRIDGE + return GET_DISPATCH(); +#else + return u_current_get(); +#endif +} + +/* C version of the public entries */ +#define MAPI_TMP_DEFINES +#define MAPI_TMP_PUBLIC_DECLARES +#define MAPI_TMP_PUBLIC_ENTRIES +#include "mapi_tmp.h" + +#ifndef MAPI_MODE_BRIDGE + +void +entry_patch_public(void) +{ +} + +mapi_func +entry_get_public(int slot) +{ + /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */ + return public_entries[slot]; +} + +mapi_func +entry_generate(int slot) +{ + return NULL; +} + +void +entry_patch(mapi_func entry, int slot) +{ +} + +#endif /* MAPI_MODE_BRIDGE */ + +#endif /* asm */ diff --git a/mesalib/src/mapi/mapi/entry_x86-64_tls.h b/mesalib/src/mapi/mapi/entry_x86-64_tls.h index 6768afb61..d3b606c8a 100644 --- a/mesalib/src/mapi/mapi/entry_x86-64_tls.h +++ b/mesalib/src/mapi/mapi/entry_x86-64_tls.h @@ -1,120 +1,124 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu - */ - -#include -#include "u_execmem.h" -#include "u_macros.h" - -#ifdef __linux__ -__asm__(".section .note.ABI-tag, \"a\"\n\t" - ".p2align 2\n\t" - ".long 1f - 0f\n\t" /* name length */ - ".long 3f - 2f\n\t" /* data length */ - ".long 1\n\t" /* note length */ - "0: .asciz \"GNU\"\n\t" /* vendor name */ - "1: .p2align 2\n\t" - "2: .long 0\n\t" /* note data: the ABI tag */ - ".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ - "3: .p2align 2\n\t"); /* pad out section */ -#endif /* __linux__ */ - -__asm__(".text"); - -__asm__("x86_64_current_tls:\n\t" - "movq u_current_table@GOTTPOFF(%rip), %rax\n\t" - "ret"); - -__asm__(".balign 32\n" - "x86_64_entry_start:"); - -#define STUB_ASM_ENTRY(func) \ - ".globl " func "\n" \ - ".type " func ", @function\n" \ - ".balign 32\n" \ - func ":" - -#define STUB_ASM_CODE(slot) \ - "movq u_current_table@GOTTPOFF(%rip), %rax\n\t" \ - "movq %fs:(%rax), %r11\n\t" \ - "jmp *(8 * " slot ")(%r11)" - -#define MAPI_TMP_STUB_ASM_GCC -#include "mapi_tmp.h" - -extern unsigned long -x86_64_current_tls(); - -void -entry_patch_public(void) -{ -} - -mapi_func -entry_get_public(int slot) -{ - extern char x86_64_entry_start[]; - return (mapi_func) (x86_64_entry_start + slot * 32); -} - -void -entry_patch(mapi_func entry, int slot) -{ - char *code = (char *) entry; - *((unsigned int *) (code + 12)) = slot * sizeof(mapi_func); -} - -mapi_func -entry_generate(int slot) -{ - const char code_templ[16] = { - /* movq %fs:0, %r11 */ - 0x64, 0x4c, 0x8b, 0x1c, 0x25, 0x00, 0x00, 0x00, 0x00, - /* jmp *0x1234(%r11) */ - 0x41, 0xff, 0xa3, 0x34, 0x12, 0x00, 0x00, - }; - unsigned long addr; - void *code; - mapi_func entry; - - addr = x86_64_current_tls(); - if ((addr >> 32) != 0xffffffff) - return NULL; - addr &= 0xffffffff; - - code = u_execmem_alloc(sizeof(code_templ)); - if (!code) - return NULL; - - memcpy(code, code_templ, sizeof(code_templ)); - - *((unsigned int *) (code + 5)) = addr; - entry = (mapi_func) code; - entry_patch(entry, slot); - - return entry; -} +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + +#include "u_macros.h" + +#ifdef __linux__ +__asm__(".section .note.ABI-tag, \"a\"\n\t" + ".p2align 2\n\t" + ".long 1f - 0f\n\t" /* name length */ + ".long 3f - 2f\n\t" /* data length */ + ".long 1\n\t" /* note length */ + "0: .asciz \"GNU\"\n\t" /* vendor name */ + "1: .p2align 2\n\t" + "2: .long 0\n\t" /* note data: the ABI tag */ + ".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ + "3: .p2align 2\n\t"); /* pad out section */ +#endif /* __linux__ */ + +__asm__(".text\n" + ".balign 32\n" + "x86_64_entry_start:"); + +#define STUB_ASM_ENTRY(func) \ + ".globl " func "\n" \ + ".type " func ", @function\n" \ + ".balign 32\n" \ + func ":" + +#define STUB_ASM_CODE(slot) \ + "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \ + "movq %fs:(%rax), %r11\n\t" \ + "jmp *(8 * " slot ")(%r11)" + +#define MAPI_TMP_STUB_ASM_GCC +#include "mapi_tmp.h" + +#ifndef MAPI_MODE_BRIDGE + +__asm__("x86_64_current_tls:\n\t" + "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" + "ret"); + +extern unsigned long +x86_64_current_tls(); + +#include +#include "u_execmem.h" + +void +entry_patch_public(void) +{ +} + +mapi_func +entry_get_public(int slot) +{ + extern char x86_64_entry_start[]; + return (mapi_func) (x86_64_entry_start + slot * 32); +} + +void +entry_patch(mapi_func entry, int slot) +{ + char *code = (char *) entry; + *((unsigned int *) (code + 12)) = slot * sizeof(mapi_func); +} + +mapi_func +entry_generate(int slot) +{ + const char code_templ[16] = { + /* movq %fs:0, %r11 */ + 0x64, 0x4c, 0x8b, 0x1c, 0x25, 0x00, 0x00, 0x00, 0x00, + /* jmp *0x1234(%r11) */ + 0x41, 0xff, 0xa3, 0x34, 0x12, 0x00, 0x00, + }; + unsigned long addr; + void *code; + mapi_func entry; + + addr = x86_64_current_tls(); + if ((addr >> 32) != 0xffffffff) + return NULL; + addr &= 0xffffffff; + + code = u_execmem_alloc(sizeof(code_templ)); + if (!code) + return NULL; + + memcpy(code, code_templ, sizeof(code_templ)); + + *((unsigned int *) (code + 5)) = addr; + entry = (mapi_func) code; + entry_patch(entry, slot); + + return entry; +} + +#endif /* MAPI_MODE_BRIDGE */ diff --git a/mesalib/src/mapi/mapi/entry_x86_tls.h b/mesalib/src/mapi/mapi/entry_x86_tls.h index a1b3c27c7..5169069a1 100644 --- a/mesalib/src/mapi/mapi/entry_x86_tls.h +++ b/mesalib/src/mapi/mapi/entry_x86_tls.h @@ -1,141 +1,146 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu - */ - -#include -#include "u_execmem.h" -#include "u_macros.h" - -#ifdef __linux__ -__asm__(".section .note.ABI-tag, \"a\"\n\t" - ".p2align 2\n\t" - ".long 1f - 0f\n\t" /* name length */ - ".long 3f - 2f\n\t" /* data length */ - ".long 1\n\t" /* note length */ - "0: .asciz \"GNU\"\n\t" /* vendor name */ - "1: .p2align 2\n\t" - "2: .long 0\n\t" /* note data: the ABI tag */ - ".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ - "3: .p2align 2\n\t"); /* pad out section */ -#endif /* __linux__ */ - -__asm__(".text"); - -__asm__("x86_current_tls:\n\t" - "call 1f\n" - "1:\n\t" - "popl %eax\n\t" - "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" - "movl u_current_table@GOTNTPOFF(%eax), %eax\n\t" - "ret"); - -#ifndef GLX_X86_READONLY_TEXT -__asm__(".section wtext, \"awx\", @progbits"); -#endif /* GLX_X86_READONLY_TEXT */ - -__asm__(".balign 16\n" - "x86_entry_start:"); - -#define STUB_ASM_ENTRY(func) \ - ".globl " func "\n" \ - ".type " func ", @function\n" \ - ".balign 16\n" \ - func ":" - -#define STUB_ASM_CODE(slot) \ - "call x86_current_tls\n\t" \ - "movl %gs:(%eax), %eax\n\t" \ - "jmp *(4 * " slot ")(%eax)" - -#define MAPI_TMP_STUB_ASM_GCC -#include "mapi_tmp.h" - -#ifndef GLX_X86_READONLY_TEXT -__asm__(".balign 16\n" - "x86_entry_end:"); -__asm__(".text"); -#endif /* GLX_X86_READONLY_TEXT */ - -extern unsigned long -x86_current_tls(); - -void -entry_patch_public(void) -{ -#ifndef GLX_X86_READONLY_TEXT - extern char x86_entry_start[]; - extern char x86_entry_end[]; - char patch[8] = { - 0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0, %eax */ - 0x90, 0x90 /* nop's */ - }; - char *entry; - - *((unsigned long *) (patch + 2)) = x86_current_tls(); - - for (entry = x86_entry_start; entry < x86_entry_end; entry += 16) - memcpy(entry, patch, sizeof(patch)); -#endif -} - -mapi_func -entry_get_public(int slot) -{ - extern char x86_entry_start[]; - return (mapi_func) (x86_entry_start + slot * 16); -} - -void -entry_patch(mapi_func entry, int slot) -{ - char *code = (char *) entry; - *((unsigned long *) (code + 8)) = slot * sizeof(mapi_func); -} - -mapi_func -entry_generate(int slot) -{ - const char code_templ[16] = { - 0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0, %eax */ - 0xff, 0xa0, 0x34, 0x12, 0x00, 0x00, /* jmp *0x1234(%eax) */ - 0x90, 0x90, 0x90, 0x90 /* nop's */ - }; - void *code; - mapi_func entry; - - code = u_execmem_alloc(sizeof(code_templ)); - if (!code) - return NULL; - - memcpy(code, code_templ, sizeof(code_templ)); - - *((unsigned long *) (code + 2)) = x86_current_tls(); - entry = (mapi_func) code; - entry_patch(entry, slot); - - return entry; -} +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + +#include +#include "u_macros.h" + +#ifdef __linux__ +__asm__(".section .note.ABI-tag, \"a\"\n\t" + ".p2align 2\n\t" + ".long 1f - 0f\n\t" /* name length */ + ".long 3f - 2f\n\t" /* data length */ + ".long 1\n\t" /* note length */ + "0: .asciz \"GNU\"\n\t" /* vendor name */ + "1: .p2align 2\n\t" + "2: .long 0\n\t" /* note data: the ABI tag */ + ".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ + "3: .p2align 2\n\t"); /* pad out section */ +#endif /* __linux__ */ + +__asm__(".text"); + +__asm__("x86_current_tls:\n\t" + "call 1f\n" + "1:\n\t" + "popl %eax\n\t" + "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" + "movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t" + "ret"); + +#ifndef GLX_X86_READONLY_TEXT +__asm__(".section wtext, \"awx\", @progbits"); +#endif /* GLX_X86_READONLY_TEXT */ + +__asm__(".balign 16\n" + "x86_entry_start:"); + +#define STUB_ASM_ENTRY(func) \ + ".globl " func "\n" \ + ".type " func ", @function\n" \ + ".balign 16\n" \ + func ":" + +#define STUB_ASM_CODE(slot) \ + "call x86_current_tls\n\t" \ + "movl %gs:(%eax), %eax\n\t" \ + "jmp *(4 * " slot ")(%eax)" + +#define MAPI_TMP_STUB_ASM_GCC +#include "mapi_tmp.h" + +#ifndef GLX_X86_READONLY_TEXT +__asm__(".balign 16\n" + "x86_entry_end:"); +__asm__(".text"); +#endif /* GLX_X86_READONLY_TEXT */ + +#ifndef MAPI_MODE_BRIDGE + +#include "u_execmem.h" + +extern unsigned long +x86_current_tls(); + +void +entry_patch_public(void) +{ +#ifndef GLX_X86_READONLY_TEXT + extern char x86_entry_start[]; + extern char x86_entry_end[]; + char patch[8] = { + 0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0, %eax */ + 0x90, 0x90 /* nop's */ + }; + char *entry; + + *((unsigned long *) (patch + 2)) = x86_current_tls(); + + for (entry = x86_entry_start; entry < x86_entry_end; entry += 16) + memcpy(entry, patch, sizeof(patch)); +#endif +} + +mapi_func +entry_get_public(int slot) +{ + extern char x86_entry_start[]; + return (mapi_func) (x86_entry_start + slot * 16); +} + +void +entry_patch(mapi_func entry, int slot) +{ + char *code = (char *) entry; + *((unsigned long *) (code + 8)) = slot * sizeof(mapi_func); +} + +mapi_func +entry_generate(int slot) +{ + const char code_templ[16] = { + 0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0, %eax */ + 0xff, 0xa0, 0x34, 0x12, 0x00, 0x00, /* jmp *0x1234(%eax) */ + 0x90, 0x90, 0x90, 0x90 /* nop's */ + }; + void *code; + mapi_func entry; + + code = u_execmem_alloc(sizeof(code_templ)); + if (!code) + return NULL; + + memcpy(code, code_templ, sizeof(code_templ)); + + *((unsigned long *) (code + 2)) = x86_current_tls(); + entry = (mapi_func) code; + entry_patch(entry, slot); + + return entry; +} + +#endif /* MAPI_MODE_BRIDGE */ diff --git a/mesalib/src/mapi/mapi/entry_x86_tsd.h b/mesalib/src/mapi/mapi/entry_x86_tsd.h index 752be5528..1491478d4 100644 --- a/mesalib/src/mapi/mapi/entry_x86_tsd.h +++ b/mesalib/src/mapi/mapi/entry_x86_tsd.h @@ -1,98 +1,103 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu - */ - -#include -#include "u_execmem.h" -#include "u_macros.h" - -#define X86_ENTRY_SIZE 32 - -__asm__(".text\n" - ".balign 32\n" - "x86_entry_start:"); - -#define STUB_ASM_ENTRY(func) \ - ".globl " func "\n" \ - ".type " func ", @function\n" \ - ".balign 32\n" \ - func ":" - -#define STUB_ASM_CODE(slot) \ - "movl u_current_table, %eax\n\t" \ - "testl %eax, %eax\n\t" \ - "je 1f\n\t" \ - "jmp *(4 * " slot ")(%eax)\n" \ - "1:\n\t" \ - "call u_current_get_internal\n\t"\ - "jmp *(4 * " slot ")(%eax)" - -#define MAPI_TMP_STUB_ASM_GCC -#include "mapi_tmp.h" - -__asm__(".balign 32\n" - "x86_entry_end:"); - -void -entry_patch_public(void) -{ -} - -mapi_func -entry_get_public(int slot) -{ - extern const char x86_entry_start[]; - return (mapi_func) (x86_entry_start + slot * X86_ENTRY_SIZE); -} - -void -entry_patch(mapi_func entry, int slot) -{ - char *code = (char *) entry; - - *((unsigned long *) (code + 11)) = slot * sizeof(mapi_func); - *((unsigned long *) (code + 22)) = slot * sizeof(mapi_func); -} - -mapi_func -entry_generate(int slot) -{ - extern const char x86_entry_end[]; - const char *code_templ = x86_entry_end - X86_ENTRY_SIZE; - void *code; - mapi_func entry; - - code = u_execmem_alloc(X86_ENTRY_SIZE); - if (!code) - return NULL; - - memcpy(code, code_templ, X86_ENTRY_SIZE); - entry = (mapi_func) code; - entry_patch(entry, slot); - - return entry; -} +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + +#include "u_macros.h" + +#define X86_ENTRY_SIZE 32 + +__asm__(".text\n" + ".balign 32\n" + "x86_entry_start:"); + +#define STUB_ASM_ENTRY(func) \ + ".globl " func "\n" \ + ".type " func ", @function\n" \ + ".balign 32\n" \ + func ":" + +#define STUB_ASM_CODE(slot) \ + "movl " ENTRY_CURRENT_TABLE ", %eax\n\t" \ + "testl %eax, %eax\n\t" \ + "je 1f\n\t" \ + "jmp *(4 * " slot ")(%eax)\n" \ + "1:\n\t" \ + "call " ENTRY_CURRENT_TABLE_GET "\n\t" \ + "jmp *(4 * " slot ")(%eax)" + +#define MAPI_TMP_STUB_ASM_GCC +#include "mapi_tmp.h" + +#ifndef MAPI_MODE_BRIDGE + +__asm__(".balign 32\n" + "x86_entry_end:"); + +#include +#include "u_execmem.h" + +void +entry_patch_public(void) +{ +} + +mapi_func +entry_get_public(int slot) +{ + extern const char x86_entry_start[]; + return (mapi_func) (x86_entry_start + slot * X86_ENTRY_SIZE); +} + +void +entry_patch(mapi_func entry, int slot) +{ + char *code = (char *) entry; + + *((unsigned long *) (code + 11)) = slot * sizeof(mapi_func); + *((unsigned long *) (code + 22)) = slot * sizeof(mapi_func); +} + +mapi_func +entry_generate(int slot) +{ + extern const char x86_entry_end[]; + const char *code_templ = x86_entry_end - X86_ENTRY_SIZE; + void *code; + mapi_func entry; + + code = u_execmem_alloc(X86_ENTRY_SIZE); + if (!code) + return NULL; + + memcpy(code, code_templ, X86_ENTRY_SIZE); + entry = (mapi_func) code; + entry_patch(entry, slot); + + return entry; +} + +#endif /* MAPI_MODE_BRIDGE */ diff --git a/mesalib/src/mapi/mapi/mapi_abi.py b/mesalib/src/mapi/mapi/mapi_abi.py index ba59be798..cb9fc0ef8 100644 --- a/mesalib/src/mapi/mapi/mapi_abi.py +++ b/mesalib/src/mapi/mapi/mapi_abi.py @@ -1,662 +1,1281 @@ -#!/usr/bin/env python - -# Mesa 3-D graphics library -# Version: 7.9 -# -# Copyright (C) 2010 LunarG Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# -# Authors: -# Chia-I Wu - -import sys -import re -from optparse import OptionParser - -# number of dynamic entries -ABI_NUM_DYNAMIC_ENTRIES = 256 - -class ABIEntry(object): - """Represent an ABI entry.""" - - _match_c_param = re.compile( - '^(?P[\w\s*]+?)(?P\w+)(\[(?P\d+)\])?$') - - def __init__(self, cols, attrs): - self._parse(cols) - - self.slot = attrs['slot'] - self.hidden = attrs['hidden'] - self.alias = attrs['alias'] - self.handcode = attrs['handcode'] - - def c_prototype(self): - return '%s %s(%s)' % (self.c_return(), self.name, self.c_params()) - - def c_return(self): - ret = self.ret - if not ret: - ret = 'void' - - return ret - - def c_params(self): - """Return the parameter list used in the entry prototype.""" - c_params = [] - for t, n, a in self.params: - sep = '' if t.endswith('*') else ' ' - arr = '[%d]' % a if a else '' - c_params.append(t + sep + n + arr) - if not c_params: - c_params.append('void') - - return ", ".join(c_params) - - def c_args(self): - """Return the argument list used in the entry invocation.""" - c_args = [] - for t, n, a in self.params: - c_args.append(n) - - return ", ".join(c_args) - - def _parse(self, cols): - ret = cols.pop(0) - if ret == 'void': - ret = None - - name = cols.pop(0) - - params = [] - if not cols: - raise Exception(cols) - elif len(cols) == 1 and cols[0] == 'void': - pass - else: - for val in cols: - params.append(self._parse_param(val)) - - self.ret = ret - self.name = name - self.params = params - - def _parse_param(self, c_param): - m = self._match_c_param.match(c_param) - if not m: - raise Exception('unrecognized param ' + c_param) - - c_type = m.group('type').strip() - c_name = m.group('name') - c_array = m.group('array') - c_array = int(c_array) if c_array else 0 - - return (c_type, c_name, c_array) - - def __str__(self): - return self.c_prototype() - - def __cmp__(self, other): - # compare slot, alias, and then name - res = cmp(self.slot, other.slot) - if not res: - if not self.alias: - res = -1 - elif not other.alias: - res = 1 - - if not res: - res = cmp(self.name, other.name) - - return res - -def abi_parse_line(line): - cols = [col.strip() for col in line.split(',')] - - attrs = { - 'slot': -1, - 'hidden': False, - 'alias': None, - 'handcode': None, - } - - # extract attributes from the first column - vals = cols[0].split(':') - while len(vals) > 1: - val = vals.pop(0) - if val.startswith('slot='): - attrs['slot'] = int(val[5:]) - elif val == 'hidden': - attrs['hidden'] = True - elif val.startswith('alias='): - attrs['alias'] = val[6:] - elif val.startswith('handcode='): - attrs['handcode'] = val[9:] - elif not val: - pass - else: - raise Exception('unknown attribute %s' % val) - cols[0] = vals[0] - - return (attrs, cols) - -def abi_parse(filename): - """Parse a CSV file for ABI entries.""" - fp = open(filename) if filename != '-' else sys.stdin - lines = [line.strip() for line in fp.readlines() - if not line.startswith('#') and line.strip()] - - entry_dict = {} - next_slot = 0 - for line in lines: - attrs, cols = abi_parse_line(line) - - # post-process attributes - if attrs['alias']: - try: - alias = entry_dict[attrs['alias']] - except KeyError: - raise Exception('failed to alias %s' % attrs['alias']) - if alias.alias: - raise Exception('recursive alias %s' % ent.name) - slot = alias.slot - attrs['alias'] = alias - else: - slot = next_slot - next_slot += 1 - - if attrs['slot'] < 0: - attrs['slot'] = slot - elif attrs['slot'] != slot: - raise Exception('invalid slot in %s' % (line)) - - ent = ABIEntry(cols, attrs) - if entry_dict.has_key(ent.name): - raise Exception('%s is duplicated' % (ent.name)) - entry_dict[ent.name] = ent - - entries = entry_dict.values() - entries.sort() - - # sanity check - i = 0 - for slot in xrange(next_slot): - if entries[i].slot != slot: - raise Exception('entries are not ordered by slots') - if entries[i].alias: - raise Exception('first entry of slot %d aliases %s' - % (slot, entries[i].alias.name)) - handcode = None - while i < len(entries) and entries[i].slot == slot: - ent = entries[i] - if not handcode and ent.handcode: - handcode = ent.handcode - elif ent.handcode != handcode: - raise Exception('two aliases with handcode %s != %s', - ent.handcode, handcode) - i += 1 - if i < len(entries): - raise Exception('there are %d invalid entries' % (len(entries) - 1)) - - return entries - -class ABIPrinter(object): - """MAPI Printer""" - - def __init__(self, entries): - self.entries = entries - - # sort entries by their names - self.entries_sorted_by_names = self.entries[:] - self.entries_sorted_by_names.sort(lambda x, y: cmp(x.name, y.name)) - - self.indent = ' ' * 3 - self.noop_warn = 'noop_warn' - self.noop_generic = 'noop_generic' - - self.api_defines = [] - self.api_headers = ['"KHR/khrplatform.h"'] - self.api_call = 'KHRONOS_APICALL' - self.api_entry = 'KHRONOS_APIENTRY' - self.api_attrs = 'KHRONOS_APIATTRIBUTES' - - self.lib_need_table_size = True - self.lib_need_noop_array = True - self.lib_need_stubs = True - self.lib_need_entries = True - - def c_notice(self): - return '/* This file is automatically generated by mapi_abi.py. Do not modify. */' - - def c_public_includes(self): - """Return includes of the client API headers.""" - defines = ['#define ' + d for d in self.api_defines] - includes = ['#include ' + h for h in self.api_headers] - return "\n".join(defines + includes) - - def need_entry_point(self, ent): - """Return True if an entry point is needed for the entry.""" - # non-handcode hidden aliases may share the entry they alias - use_alias = (ent.hidden and ent.alias and not ent.handcode) - return not use_alias - - def c_public_declarations(self, prefix): - """Return the declarations of public entry points.""" - decls = [] - for ent in self.entries: - if not self.need_entry_point(ent): - continue - export = self.api_call if not ent.hidden else '' - decls.append(self._c_decl(ent, prefix, True, export) + ';') - - return "\n".join(decls) - - def c_mapi_table(self): - """Return defines of the dispatch table size.""" - num_static_entries = 0 - for ent in self.entries: - if not ent.alias: - num_static_entries += 1 - - return ('#define MAPI_TABLE_NUM_STATIC %d\n' + \ - '#define MAPI_TABLE_NUM_DYNAMIC %d') % ( - num_static_entries, ABI_NUM_DYNAMIC_ENTRIES) - - def c_mapi_table_initializer(self, prefix): - """Return the array initializer for mapi_table_fill.""" - entries = [self._c_function(ent, prefix) - for ent in self.entries if not ent.alias] - pre = self.indent + '(mapi_proc) ' - return pre + (',\n' + pre).join(entries) - - def c_mapi_table_spec(self): - """Return the spec for mapi_init.""" - specv1 = [] - line = '"1' - for ent in self.entries: - if not ent.alias: - line += '\\0"\n' - specv1.append(line) - line = '"' - line += '%s\\0' % ent.name - line += '";' - specv1.append(line) - - return self.indent + self.indent.join(specv1) - - def _c_function(self, ent, prefix, mangle=False, stringify=False): - """Return the function name of an entry.""" - formats = { True: '"%s%s"', False: '%s%s' } - fmt = formats[stringify] - name = ent.name - if mangle and ent.hidden: - name = '_dispatch_stub_' + str(ent.slot) - return fmt % (prefix, name) - - def _c_function_call(self, ent, prefix): - """Return the function name used for calling.""" - if ent.handcode: - # _c_function does not handle this case - fmt = '%s%s' - name = fmt % (prefix, ent.handcode) - elif self.need_entry_point(ent): - name = self._c_function(ent, prefix, True) - else: - name = self._c_function(ent.alias, prefix, True) - return name - - def _c_decl(self, ent, prefix, mangle=False, export=''): - """Return the C declaration for the entry.""" - decl = '%s %s %s(%s)' % (ent.c_return(), self.api_entry, - self._c_function(ent, prefix, mangle), ent.c_params()) - if export: - decl = export + ' ' + decl - if self.api_attrs: - decl += ' ' + self.api_attrs - - return decl - - def _c_cast(self, ent): - """Return the C cast for the entry.""" - cast = '%s (%s *)(%s)' % ( - ent.c_return(), self.api_entry, ent.c_params()) - - return cast - - def c_private_declarations(self, prefix): - """Return the declarations of private functions.""" - decls = [self._c_decl(ent, prefix) + ';' - for ent in self.entries if not ent.alias] - - return "\n".join(decls) - - def c_public_dispatches(self, prefix): - """Return the public dispatch functions.""" - dispatches = [] - for ent in self.entries: - if not self.need_entry_point(ent): - continue - - export = self.api_call if not ent.hidden else '' - - proto = self._c_decl(ent, prefix, True, export) - cast = self._c_cast(ent) - - ret = '' - if ent.ret: - ret = 'return ' - stmt1 = self.indent - stmt1 += 'const struct mapi_table *tbl = u_current_get();' - stmt2 = self.indent - stmt2 += 'mapi_func func = ((const mapi_func *) tbl)[%d];' % ( - ent.slot) - stmt3 = self.indent - stmt3 += '%s((%s) func)(%s);' % (ret, cast, ent.c_args()) - - disp = '%s\n{\n%s\n%s\n%s\n}' % (proto, stmt1, stmt2, stmt3) - - if ent.handcode: - disp = '#if 0\n' + disp + '\n#endif' - - dispatches.append(disp) - - return '\n\n'.join(dispatches) - - def c_public_initializer(self, prefix): - """Return the initializer for public dispatch functions.""" - names = [] - for ent in self.entries: - if ent.alias: - continue - - name = '%s(mapi_func) %s' % (self.indent, - self._c_function_call(ent, prefix)) - names.append(name) - - return ',\n'.join(names) - - def c_stub_string_pool(self): - """Return the string pool for use by stubs.""" - # sort entries by their names - sorted_entries = self.entries[:] - sorted_entries.sort(lambda x, y: cmp(x.name, y.name)) - - pool = [] - offsets = {} - count = 0 - for ent in sorted_entries: - offsets[ent] = count - pool.append('%s' % (ent.name)) - count += len(ent.name) + 1 - - pool_str = self.indent + '"' + \ - ('\\0"\n' + self.indent + '"').join(pool) + '";' - return (pool_str, offsets) - - def c_stub_initializer(self, prefix, pool_offsets): - """Return the initializer for struct mapi_stub array.""" - stubs = [] - for ent in self.entries_sorted_by_names: - stubs.append('%s{ (void *) %d, %d, NULL }' % ( - self.indent, pool_offsets[ent], ent.slot)) - - return ',\n'.join(stubs) - - def c_noop_functions(self, prefix, warn_prefix): - """Return the noop functions.""" - noops = [] - for ent in self.entries: - if ent.alias: - continue - - proto = self._c_decl(ent, prefix, False, 'static') - - stmt1 = self.indent + '%s(%s);' % (self.noop_warn, - self._c_function(ent, warn_prefix, False, True)) - - if ent.ret: - stmt2 = self.indent + 'return (%s) 0;' % (ent.ret) - noop = '%s\n{\n%s\n%s\n}' % (proto, stmt1, stmt2) - else: - noop = '%s\n{\n%s\n}' % (proto, stmt1) - - noops.append(noop) - - return '\n\n'.join(noops) - - def c_noop_initializer(self, prefix, use_generic): - """Return an initializer for the noop dispatch table.""" - entries = [self._c_function(ent, prefix) - for ent in self.entries if not ent.alias] - if use_generic: - entries = [self.noop_generic] * len(entries) - - entries.extend([self.noop_generic] * ABI_NUM_DYNAMIC_ENTRIES) - - pre = self.indent + '(mapi_func) ' - return pre + (',\n' + pre).join(entries) - - def c_asm_gcc(self, prefix): - asm = [] - - asm.append('__asm__(') - for ent in self.entries: - if not self.need_entry_point(ent): - continue - - name = self._c_function(ent, prefix, True, True) - - if ent.handcode: - asm.append('#if 0') - - if ent.hidden: - asm.append('".hidden "%s"\\n"' % (name)) - - if ent.alias: - asm.append('".globl "%s"\\n"' % (name)) - asm.append('".set "%s", "%s"\\n"' % (name, - self._c_function(ent.alias, prefix, True, True))) - else: - asm.append('STUB_ASM_ENTRY(%s)"\\n"' % (name)) - asm.append('"\\t"STUB_ASM_CODE("%d")"\\n"' % (ent.slot)) - - if ent.handcode: - asm.append('#endif') - asm.append('') - asm.append(');') - - return "\n".join(asm) - - def output_for_lib(self): - print self.c_notice() - print - print '#ifdef MAPI_TMP_DEFINES' - print self.c_public_includes() - print - print self.c_public_declarations(self.prefix_lib) - print '#undef MAPI_TMP_DEFINES' - print '#endif /* MAPI_TMP_DEFINES */' - - if self.lib_need_table_size: - print - print '#ifdef MAPI_TMP_TABLE' - print self.c_mapi_table() - print '#undef MAPI_TMP_TABLE' - print '#endif /* MAPI_TMP_TABLE */' - - if self.lib_need_noop_array: - print - print '#ifdef MAPI_TMP_NOOP_ARRAY' - print '#ifdef DEBUG' - print - print self.c_noop_functions(self.prefix_noop, self.prefix_lib) - print - print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop) - print self.c_noop_initializer(self.prefix_noop, False) - print '};' - print - print '#else /* DEBUG */' - print - print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop) - print self.c_noop_initializer(self.prefix_noop, True) - print '};' - print - print '#endif /* DEBUG */' - print '#undef MAPI_TMP_NOOP_ARRAY' - print '#endif /* MAPI_TMP_NOOP_ARRAY */' - - if self.lib_need_stubs: - pool, pool_offsets = self.c_stub_string_pool() - print - print '#ifdef MAPI_TMP_PUBLIC_STUBS' - print 'static const char public_string_pool[] =' - print pool - print - print 'static const struct mapi_stub public_stubs[] = {' - print self.c_stub_initializer(self.prefix_lib, pool_offsets) - print '};' - print '#undef MAPI_TMP_PUBLIC_STUBS' - print '#endif /* MAPI_TMP_PUBLIC_STUBS */' - - if self.lib_need_entries: - print - print '#ifdef MAPI_TMP_PUBLIC_ENTRIES' - print self.c_public_dispatches(self.prefix_lib) - print - print 'static const mapi_func public_entries[] = {' - print self.c_public_initializer(self.prefix_lib) - print '};' - print '#undef MAPI_TMP_PUBLIC_ENTRIES' - print '#endif /* MAPI_TMP_PUBLIC_ENTRIES */' - - print - print '#ifdef MAPI_TMP_STUB_ASM_GCC' - print self.c_asm_gcc(self.prefix_lib) - print '#undef MAPI_TMP_STUB_ASM_GCC' - print '#endif /* MAPI_TMP_STUB_ASM_GCC */' - - def output_for_app(self): - print self.c_notice() - print - print self.c_private_declarations(self.prefix_app) - print - print '#ifdef API_TMP_DEFINE_SPEC' - print - print 'static const char %s_spec[] =' % (self.prefix_app) - print self.c_mapi_table_spec() - print - print 'static const mapi_proc %s_procs[] = {' % (self.prefix_app) - print self.c_mapi_table_initializer(self.prefix_app) - print '};' - print - print '#endif /* API_TMP_DEFINE_SPEC */' - -class GLAPIPrinter(ABIPrinter): - """OpenGL API Printer""" - - def __init__(self, entries): - super(GLAPIPrinter, self).__init__(entries) - - self.api_defines = ['GL_GLEXT_PROTOTYPES'] - self.api_headers = ['"GL/gl.h"', '"GL/glext.h"'] - self.api_call = 'GLAPI' - self.api_entry = 'APIENTRY' - self.api_attrs = '' - - self.prefix_lib = 'gl' - self.prefix_app = '_mesa_' - self.prefix_noop = 'noop' - - def output_for_app(self): - # not used - pass - -class ES1APIPrinter(GLAPIPrinter): - """OpenGL ES 1.x API Printer""" - - def __init__(self, entries): - super(ES1APIPrinter, self).__init__(entries) - - self.api_headers = ['"GLES/gl.h"', '"GLES/glext.h"'] - self.api_call = 'GL_API' - self.api_entry = 'GL_APIENTRY' - -class ES2APIPrinter(GLAPIPrinter): - """OpenGL ES 2.x API Printer""" - - def __init__(self, entries): - super(ES2APIPrinter, self).__init__(entries) - - self.api_headers = ['"GLES2/gl2.h"', '"GLES2/gl2ext.h"'] - self.api_call = 'GL_APICALL' - self.api_entry = 'GL_APIENTRY' - -class VGAPIPrinter(ABIPrinter): - """OpenVG API Printer""" - - def __init__(self, entries): - super(VGAPIPrinter, self).__init__(entries) - - self.api_defines = ['VG_VGEXT_PROTOTYPES'] - self.api_headers = ['"VG/openvg.h"', '"VG/vgext.h"'] - self.api_call = 'VG_API_CALL' - self.api_entry = 'VG_API_ENTRY' - self.api_attrs = 'VG_API_EXIT' - - self.prefix_lib = 'vg' - self.prefix_app = 'vega' - self.prefix_noop = 'noop' - -def parse_args(): - printers = ['glapi', 'es1api', 'es2api', 'vgapi'] - modes = ['lib', 'app'] - - parser = OptionParser(usage='usage: %prog [options] ') - parser.add_option('-p', '--printer', dest='printer', - help='printer to use: %s' % (", ".join(printers))) - parser.add_option('-m', '--mode', dest='mode', - help='target user: %s' % (", ".join(modes))) - - options, args = parser.parse_args() - if not args or options.printer not in printers or \ - options.mode not in modes: - parser.print_help() - sys.exit(1) - - return (args[0], options) - -def main(): - printers = { - 'vgapi': VGAPIPrinter, - 'glapi': GLAPIPrinter, - 'es1api': ES1APIPrinter, - 'es2api': ES2APIPrinter - } - - filename, options = parse_args() - - entries = abi_parse(filename) - printer = printers[options.printer](entries) - if options.mode == 'lib': - printer.output_for_lib() - else: - printer.output_for_app() - -if __name__ == '__main__': - main() +#!/usr/bin/env python + +# Mesa 3-D graphics library +# Version: 7.9 +# +# Copyright (C) 2010 LunarG Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +# Authors: +# Chia-I Wu + +import sys +import re +from optparse import OptionParser + +# number of dynamic entries +ABI_NUM_DYNAMIC_ENTRIES = 256 + +class ABIEntry(object): + """Represent an ABI entry.""" + + _match_c_param = re.compile( + '^(?P[\w\s*]+?)(?P\w+)(\[(?P\d+)\])?$') + + def __init__(self, cols, attrs): + self._parse(cols) + + self.slot = attrs['slot'] + self.hidden = attrs['hidden'] + self.alias = attrs['alias'] + self.handcode = attrs['handcode'] + + def c_prototype(self): + return '%s %s(%s)' % (self.c_return(), self.name, self.c_params()) + + def c_return(self): + ret = self.ret + if not ret: + ret = 'void' + + return ret + + def c_params(self): + """Return the parameter list used in the entry prototype.""" + c_params = [] + for t, n, a in self.params: + sep = '' if t.endswith('*') else ' ' + arr = '[%d]' % a if a else '' + c_params.append(t + sep + n + arr) + if not c_params: + c_params.append('void') + + return ", ".join(c_params) + + def c_args(self): + """Return the argument list used in the entry invocation.""" + c_args = [] + for t, n, a in self.params: + c_args.append(n) + + return ", ".join(c_args) + + def _parse(self, cols): + ret = cols.pop(0) + if ret == 'void': + ret = None + + name = cols.pop(0) + + params = [] + if not cols: + raise Exception(cols) + elif len(cols) == 1 and cols[0] == 'void': + pass + else: + for val in cols: + params.append(self._parse_param(val)) + + self.ret = ret + self.name = name + self.params = params + + def _parse_param(self, c_param): + m = self._match_c_param.match(c_param) + if not m: + raise Exception('unrecognized param ' + c_param) + + c_type = m.group('type').strip() + c_name = m.group('name') + c_array = m.group('array') + c_array = int(c_array) if c_array else 0 + + return (c_type, c_name, c_array) + + def __str__(self): + return self.c_prototype() + + def __cmp__(self, other): + # compare slot, alias, and then name + res = cmp(self.slot, other.slot) + if not res: + if not self.alias: + res = -1 + elif not other.alias: + res = 1 + + if not res: + res = cmp(self.name, other.name) + + return res + +def abi_parse_xml(xml): + """Parse a GLAPI XML file for ABI entries.""" + import os + GLAPI = "./%s/../glapi/gen" % (os.path.dirname(sys.argv[0])) + sys.path.append(GLAPI) + import gl_XML, glX_XML + + api = gl_XML.parse_GL_API(xml, glX_XML.glx_item_factory()) + + entry_dict = {} + for func in api.functionIterateByOffset(): + # make sure func.name appear first + entry_points = func.entry_points[:] + entry_points.remove(func.name) + entry_points.insert(0, func.name) + + for name in entry_points: + attrs = { + 'slot': func.offset, + 'hidden': not func.is_static_entry_point(name), + 'alias': None if name == func.name else func.name, + 'handcode': bool(func.has_different_protocol(name)), + } + + # post-process attrs + if attrs['alias']: + try: + alias = entry_dict[attrs['alias']] + except KeyError: + raise Exception('failed to alias %s' % attrs['alias']) + if alias.alias: + raise Exception('recursive alias %s' % ent.name) + attrs['alias'] = alias + if attrs['handcode']: + attrs['handcode'] = func.static_glx_name(name) + else: + attrs['handcode'] = None + + if entry_dict.has_key(name): + raise Exception('%s is duplicated' % (name)) + + cols = [] + cols.append(func.return_type) + cols.append(name) + params = func.get_parameter_string(name) + cols.extend([p.strip() for p in params.split(',')]) + + ent = ABIEntry(cols, attrs) + entry_dict[ent.name] = ent + + entries = entry_dict.values() + entries.sort() + + return entries + +def abi_parse_line(line): + cols = [col.strip() for col in line.split(',')] + + attrs = { + 'slot': -1, + 'hidden': False, + 'alias': None, + 'handcode': None, + } + + # extract attributes from the first column + vals = cols[0].split(':') + while len(vals) > 1: + val = vals.pop(0) + if val.startswith('slot='): + attrs['slot'] = int(val[5:]) + elif val == 'hidden': + attrs['hidden'] = True + elif val.startswith('alias='): + attrs['alias'] = val[6:] + elif val.startswith('handcode='): + attrs['handcode'] = val[9:] + elif not val: + pass + else: + raise Exception('unknown attribute %s' % val) + cols[0] = vals[0] + + return (attrs, cols) + +def abi_parse(filename): + """Parse a CSV file for ABI entries.""" + fp = open(filename) if filename != '-' else sys.stdin + lines = [line.strip() for line in fp.readlines() + if not line.startswith('#') and line.strip()] + + entry_dict = {} + next_slot = 0 + for line in lines: + attrs, cols = abi_parse_line(line) + + # post-process attributes + if attrs['alias']: + try: + alias = entry_dict[attrs['alias']] + except KeyError: + raise Exception('failed to alias %s' % attrs['alias']) + if alias.alias: + raise Exception('recursive alias %s' % ent.name) + slot = alias.slot + attrs['alias'] = alias + else: + slot = next_slot + next_slot += 1 + + if attrs['slot'] < 0: + attrs['slot'] = slot + elif attrs['slot'] != slot: + raise Exception('invalid slot in %s' % (line)) + + ent = ABIEntry(cols, attrs) + if entry_dict.has_key(ent.name): + raise Exception('%s is duplicated' % (ent.name)) + entry_dict[ent.name] = ent + + entries = entry_dict.values() + entries.sort() + + return entries + +def abi_sanity_check(entries): + if not entries: + return + + all_names = [] + last_slot = entries[-1].slot + i = 0 + for slot in xrange(last_slot + 1): + if entries[i].slot != slot: + raise Exception('entries are not ordered by slots') + if entries[i].alias: + raise Exception('first entry of slot %d aliases %s' + % (slot, entries[i].alias.name)) + handcode = None + while i < len(entries) and entries[i].slot == slot: + ent = entries[i] + if not handcode and ent.handcode: + handcode = ent.handcode + elif ent.handcode != handcode: + raise Exception('two aliases with handcode %s != %s', + ent.handcode, handcode) + + if ent.name in all_names: + raise Exception('%s is duplicated' % (ent.name)) + if ent.alias and ent.alias.name not in all_names: + raise Exception('failed to alias %s' % (ent.alias.name)) + all_names.append(ent.name) + i += 1 + if i < len(entries): + raise Exception('there are %d invalid entries' % (len(entries) - 1)) + +class ABIPrinter(object): + """MAPI Printer""" + + def __init__(self, entries): + self.entries = entries + + # sort entries by their names + self.entries_sorted_by_names = self.entries[:] + self.entries_sorted_by_names.sort(lambda x, y: cmp(x.name, y.name)) + + self.indent = ' ' * 3 + self.noop_warn = 'noop_warn' + self.noop_generic = 'noop_generic' + self.current_get = 'entry_current_get' + + self.api_defines = [] + self.api_headers = ['"KHR/khrplatform.h"'] + self.api_call = 'KHRONOS_APICALL' + self.api_entry = 'KHRONOS_APIENTRY' + self.api_attrs = 'KHRONOS_APIATTRIBUTES' + + self.c_header = '' + + self.lib_need_table_size = True + self.lib_need_noop_array = True + self.lib_need_stubs = True + self.lib_need_all_entries = True + self.lib_need_non_hidden_entries = False + + def c_notice(self): + return '/* This file is automatically generated by mapi_abi.py. Do not modify. */' + + def c_public_includes(self): + """Return includes of the client API headers.""" + defines = ['#define ' + d for d in self.api_defines] + includes = ['#include ' + h for h in self.api_headers] + return "\n".join(defines + includes) + + def need_entry_point(self, ent): + """Return True if an entry point is needed for the entry.""" + # non-handcode hidden aliases may share the entry they alias + use_alias = (ent.hidden and ent.alias and not ent.handcode) + return not use_alias + + def c_public_declarations(self, prefix): + """Return the declarations of public entry points.""" + decls = [] + for ent in self.entries: + if not self.need_entry_point(ent): + continue + export = self.api_call if not ent.hidden else '' + decls.append(self._c_decl(ent, prefix, True, export) + ';') + + return "\n".join(decls) + + def c_mapi_table(self): + """Return defines of the dispatch table size.""" + num_static_entries = self.entries[-1].slot + 1 + return ('#define MAPI_TABLE_NUM_STATIC %d\n' + \ + '#define MAPI_TABLE_NUM_DYNAMIC %d') % ( + num_static_entries, ABI_NUM_DYNAMIC_ENTRIES) + + def c_mapi_table_initializer(self, prefix): + """Return the array initializer for mapi_table_fill.""" + entries = [self._c_function(ent, prefix) + for ent in self.entries if not ent.alias] + pre = self.indent + '(mapi_proc) ' + return pre + (',\n' + pre).join(entries) + + def c_mapi_table_spec(self): + """Return the spec for mapi_init.""" + specv1 = [] + line = '"1' + for ent in self.entries: + if not ent.alias: + line += '\\0"\n' + specv1.append(line) + line = '"' + line += '%s\\0' % ent.name + line += '";' + specv1.append(line) + + return self.indent + self.indent.join(specv1) + + def _c_function(self, ent, prefix, mangle=False, stringify=False): + """Return the function name of an entry.""" + formats = { + True: { True: '%s_STR(%s)', False: '%s(%s)' }, + False: { True: '"%s%s"', False: '%s%s' }, + } + fmt = formats[prefix.isupper()][stringify] + name = ent.name + if mangle and ent.hidden: + name = '_dispatch_stub_' + str(ent.slot) + return fmt % (prefix, name) + + def _c_function_call(self, ent, prefix): + """Return the function name used for calling.""" + if ent.handcode: + # _c_function does not handle this case + formats = { True: '%s(%s)', False: '%s%s' } + fmt = formats[prefix.isupper()] + name = fmt % (prefix, ent.handcode) + elif self.need_entry_point(ent): + name = self._c_function(ent, prefix, True) + else: + name = self._c_function(ent.alias, prefix, True) + return name + + def _c_decl(self, ent, prefix, mangle=False, export=''): + """Return the C declaration for the entry.""" + decl = '%s %s %s(%s)' % (ent.c_return(), self.api_entry, + self._c_function(ent, prefix, mangle), ent.c_params()) + if export: + decl = export + ' ' + decl + if self.api_attrs: + decl += ' ' + self.api_attrs + + return decl + + def _c_cast(self, ent): + """Return the C cast for the entry.""" + cast = '%s (%s *)(%s)' % ( + ent.c_return(), self.api_entry, ent.c_params()) + + return cast + + def c_private_declarations(self, prefix): + """Return the declarations of private functions.""" + decls = [self._c_decl(ent, prefix) + ';' + for ent in self.entries if not ent.alias] + + return "\n".join(decls) + + def c_public_dispatches(self, prefix, no_hidden): + """Return the public dispatch functions.""" + dispatches = [] + for ent in self.entries: + if ent.hidden and no_hidden: + continue + + if not self.need_entry_point(ent): + continue + + export = self.api_call if not ent.hidden else '' + + proto = self._c_decl(ent, prefix, True, export) + cast = self._c_cast(ent) + + ret = '' + if ent.ret: + ret = 'return ' + stmt1 = self.indent + stmt1 += 'const struct mapi_table *_tbl = %s();' % ( + self.current_get) + stmt2 = self.indent + stmt2 += 'mapi_func _func = ((const mapi_func *) _tbl)[%d];' % ( + ent.slot) + stmt3 = self.indent + stmt3 += '%s((%s) _func)(%s);' % (ret, cast, ent.c_args()) + + disp = '%s\n{\n%s\n%s\n%s\n}' % (proto, stmt1, stmt2, stmt3) + + if ent.handcode: + disp = '#if 0\n' + disp + '\n#endif' + + dispatches.append(disp) + + return '\n\n'.join(dispatches) + + def c_public_initializer(self, prefix): + """Return the initializer for public dispatch functions.""" + names = [] + for ent in self.entries: + if ent.alias: + continue + + name = '%s(mapi_func) %s' % (self.indent, + self._c_function_call(ent, prefix)) + names.append(name) + + return ',\n'.join(names) + + def c_stub_string_pool(self): + """Return the string pool for use by stubs.""" + # sort entries by their names + sorted_entries = self.entries[:] + sorted_entries.sort(lambda x, y: cmp(x.name, y.name)) + + pool = [] + offsets = {} + count = 0 + for ent in sorted_entries: + offsets[ent] = count + pool.append('%s' % (ent.name)) + count += len(ent.name) + 1 + + pool_str = self.indent + '"' + \ + ('\\0"\n' + self.indent + '"').join(pool) + '";' + return (pool_str, offsets) + + def c_stub_initializer(self, prefix, pool_offsets): + """Return the initializer for struct mapi_stub array.""" + stubs = [] + for ent in self.entries_sorted_by_names: + stubs.append('%s{ (void *) %d, %d, NULL }' % ( + self.indent, pool_offsets[ent], ent.slot)) + + return ',\n'.join(stubs) + + def c_noop_functions(self, prefix, warn_prefix): + """Return the noop functions.""" + noops = [] + for ent in self.entries: + if ent.alias: + continue + + proto = self._c_decl(ent, prefix, False, 'static') + + stmt1 = self.indent + '%s(%s);' % (self.noop_warn, + self._c_function(ent, warn_prefix, False, True)) + + if ent.ret: + stmt2 = self.indent + 'return (%s) 0;' % (ent.ret) + noop = '%s\n{\n%s\n%s\n}' % (proto, stmt1, stmt2) + else: + noop = '%s\n{\n%s\n}' % (proto, stmt1) + + noops.append(noop) + + return '\n\n'.join(noops) + + def c_noop_initializer(self, prefix, use_generic): + """Return an initializer for the noop dispatch table.""" + entries = [self._c_function(ent, prefix) + for ent in self.entries if not ent.alias] + if use_generic: + entries = [self.noop_generic] * len(entries) + + entries.extend([self.noop_generic] * ABI_NUM_DYNAMIC_ENTRIES) + + pre = self.indent + '(mapi_func) ' + return pre + (',\n' + pre).join(entries) + + def c_asm_gcc(self, prefix, no_hidden): + asm = [] + + for ent in self.entries: + if ent.hidden and no_hidden: + continue + + if not self.need_entry_point(ent): + continue + + name = self._c_function(ent, prefix, True, True) + + if ent.handcode: + asm.append('#if 0') + + if ent.hidden: + asm.append('".hidden "%s"\\n"' % (name)) + + if ent.alias and not (ent.alias.hidden and no_hidden): + asm.append('".globl "%s"\\n"' % (name)) + asm.append('".set "%s", "%s"\\n"' % (name, + self._c_function(ent.alias, prefix, True, True))) + else: + asm.append('STUB_ASM_ENTRY(%s)"\\n"' % (name)) + asm.append('"\\t"STUB_ASM_CODE("%d")"\\n"' % (ent.slot)) + + if ent.handcode: + asm.append('#endif') + asm.append('') + + return "\n".join(asm) + + def output_for_lib(self): + print self.c_notice() + + if self.c_header: + print + print self.c_header + + print + print '#ifdef MAPI_TMP_DEFINES' + print self.c_public_includes() + print + print self.c_public_declarations(self.prefix_lib) + print '#undef MAPI_TMP_DEFINES' + print '#endif /* MAPI_TMP_DEFINES */' + + if self.lib_need_table_size: + print + print '#ifdef MAPI_TMP_TABLE' + print self.c_mapi_table() + print '#undef MAPI_TMP_TABLE' + print '#endif /* MAPI_TMP_TABLE */' + + if self.lib_need_noop_array: + print + print '#ifdef MAPI_TMP_NOOP_ARRAY' + print '#ifdef DEBUG' + print + print self.c_noop_functions(self.prefix_noop, self.prefix_warn) + print + print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop) + print self.c_noop_initializer(self.prefix_noop, False) + print '};' + print + print '#else /* DEBUG */' + print + print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop) + print self.c_noop_initializer(self.prefix_noop, True) + print '};' + print + print '#endif /* DEBUG */' + print '#undef MAPI_TMP_NOOP_ARRAY' + print '#endif /* MAPI_TMP_NOOP_ARRAY */' + + if self.lib_need_stubs: + pool, pool_offsets = self.c_stub_string_pool() + print + print '#ifdef MAPI_TMP_PUBLIC_STUBS' + print 'static const char public_string_pool[] =' + print pool + print + print 'static const struct mapi_stub public_stubs[] = {' + print self.c_stub_initializer(self.prefix_lib, pool_offsets) + print '};' + print '#undef MAPI_TMP_PUBLIC_STUBS' + print '#endif /* MAPI_TMP_PUBLIC_STUBS */' + + if self.lib_need_all_entries: + print + print '#ifdef MAPI_TMP_PUBLIC_ENTRIES' + print self.c_public_dispatches(self.prefix_lib, False) + print + print 'static const mapi_func public_entries[] = {' + print self.c_public_initializer(self.prefix_lib) + print '};' + print '#undef MAPI_TMP_PUBLIC_ENTRIES' + print '#endif /* MAPI_TMP_PUBLIC_ENTRIES */' + + print + print '#ifdef MAPI_TMP_STUB_ASM_GCC' + print '__asm__(' + print self.c_asm_gcc(self.prefix_lib, False) + print ');' + print '#undef MAPI_TMP_STUB_ASM_GCC' + print '#endif /* MAPI_TMP_STUB_ASM_GCC */' + + if self.lib_need_non_hidden_entries: + all_hidden = True + for ent in self.entries: + if not ent.hidden: + all_hidden = False + break + if not all_hidden: + print + print '#ifdef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN' + print self.c_public_dispatches(self.prefix_lib, True) + print + print '/* does not need public_entries */' + print '#undef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN' + print '#endif /* MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN */' + + print + print '#ifdef MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN' + print '__asm__(' + print self.c_asm_gcc(self.prefix_lib, True) + print ');' + print '#undef MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN' + print '#endif /* MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN */' + + def output_for_app(self): + print self.c_notice() + print + print self.c_private_declarations(self.prefix_app) + print + print '#ifdef API_TMP_DEFINE_SPEC' + print + print 'static const char %s_spec[] =' % (self.prefix_app) + print self.c_mapi_table_spec() + print + print 'static const mapi_proc %s_procs[] = {' % (self.prefix_app) + print self.c_mapi_table_initializer(self.prefix_app) + print '};' + print + print '#endif /* API_TMP_DEFINE_SPEC */' + +class GLAPIPrinter(ABIPrinter): + """OpenGL API Printer""" + + def __init__(self, entries, api=None): + api_entries = self._get_api_entries(entries, api) + super(GLAPIPrinter, self).__init__(api_entries) + + self.api_defines = ['GL_GLEXT_PROTOTYPES'] + self.api_headers = ['"GL/gl.h"', '"GL/glext.h"'] + self.api_call = 'GLAPI' + self.api_entry = 'APIENTRY' + self.api_attrs = '' + + self.lib_need_table_size = False + self.lib_need_noop_array = False + self.lib_need_stubs = False + self.lib_need_all_entries = False + self.lib_need_non_hidden_entries = True + + self.prefix_lib = 'GLAPI_PREFIX' + self.prefix_app = '_mesa_' + self.prefix_noop = 'noop' + self.prefix_warn = self.prefix_lib + + self.c_header = self._get_c_header() + + def _get_api_entries(self, entries, api): + """Override the entry attributes according to API.""" + import copy + + # no override + if api is None: + return entries + + api_entries = {} + for ent in entries: + ent = copy.copy(ent) + + # override 'hidden' and 'handcode' + ent.hidden = ent.name not in api + ent.handcode = False + if ent.alias: + ent.alias = api_entries[ent.alias.name] + + api_entries[ent.name] = ent + + # sanity check + missed = [name for name in api if name not in api_entries] + if missed: + raise Exception('%s is missing' % str(missed)) + + entries = api_entries.values() + entries.sort() + + return entries + + def _get_c_header(self): + header = """#ifndef _GLAPI_TMP_H_ +#define _GLAPI_TMP_H_ +#ifdef USE_MGL_NAMESPACE +#define GLAPI_PREFIX(func) mgl##func +#define GLAPI_PREFIX_STR(func) "mgl"#func +#else +#define GLAPI_PREFIX(func) gl##func +#define GLAPI_PREFIX_STR(func) "gl"#func +#endif /* USE_MGL_NAMESPACE */ + +typedef int GLfixed; +typedef int GLclampx; +#endif /* _GLAPI_TMP_H_ */""" + + return header + +class ES1APIPrinter(GLAPIPrinter): + """OpenGL ES 1.x API Printer""" + + def __init__(self, entries): + es1_api = [ + # OpenGL ES 1.1 + 'ActiveTexture', + 'AlphaFunc', + 'AlphaFuncx', + 'BindBuffer', + 'BindTexture', + 'BlendFunc', + 'BufferData', + 'BufferSubData', + 'Clear', + 'ClearColor', + 'ClearColorx', + 'ClearDepthf', + 'ClearDepthx', + 'ClearStencil', + 'ClientActiveTexture', + 'ClipPlanef', + 'ClipPlanex', + 'Color4f', + 'Color4ub', + 'Color4x', + 'ColorMask', + 'ColorPointer', + 'CompressedTexImage2D', + 'CompressedTexSubImage2D', + 'CopyTexImage2D', + 'CopyTexSubImage2D', + 'CullFace', + 'DeleteBuffers', + 'DeleteTextures', + 'DepthFunc', + 'DepthMask', + 'DepthRangef', + 'DepthRangex', + 'Disable', + 'DisableClientState', + 'DrawArrays', + 'DrawElements', + 'Enable', + 'EnableClientState', + 'Finish', + 'Flush', + 'Fogf', + 'Fogfv', + 'Fogx', + 'Fogxv', + 'FrontFace', + 'Frustumf', + 'Frustumx', + 'GenBuffers', + 'GenTextures', + 'GetBooleanv', + 'GetBufferParameteriv', + 'GetClipPlanef', + 'GetClipPlanex', + 'GetError', + 'GetFixedv', + 'GetFloatv', + 'GetIntegerv', + 'GetLightfv', + 'GetLightxv', + 'GetMaterialfv', + 'GetMaterialxv', + 'GetPointerv', + 'GetString', + 'GetTexEnvfv', + 'GetTexEnviv', + 'GetTexEnvxv', + 'GetTexParameterfv', + 'GetTexParameteriv', + 'GetTexParameterxv', + 'Hint', + 'IsBuffer', + 'IsEnabled', + 'IsTexture', + 'Lightf', + 'Lightfv', + 'LightModelf', + 'LightModelfv', + 'LightModelx', + 'LightModelxv', + 'Lightx', + 'Lightxv', + 'LineWidth', + 'LineWidthx', + 'LoadIdentity', + 'LoadMatrixf', + 'LoadMatrixx', + 'LogicOp', + 'Materialf', + 'Materialfv', + 'Materialx', + 'Materialxv', + 'MatrixMode', + 'MultiTexCoord4f', + 'MultiTexCoord4x', + 'MultMatrixf', + 'MultMatrixx', + 'Normal3f', + 'Normal3x', + 'NormalPointer', + 'Orthof', + 'Orthox', + 'PixelStorei', + 'PointParameterf', + 'PointParameterfv', + 'PointParameterx', + 'PointParameterxv', + 'PointSize', + 'PointSizex', + 'PolygonOffset', + 'PolygonOffsetx', + 'PopMatrix', + 'PushMatrix', + 'ReadPixels', + 'Rotatef', + 'Rotatex', + 'SampleCoverage', + 'SampleCoveragex', + 'Scalef', + 'Scalex', + 'Scissor', + 'ShadeModel', + 'StencilFunc', + 'StencilMask', + 'StencilOp', + 'TexCoordPointer', + 'TexEnvf', + 'TexEnvfv', + 'TexEnvi', + 'TexEnviv', + 'TexEnvx', + 'TexEnvxv', + 'TexImage2D', + 'TexParameterf', + 'TexParameterfv', + 'TexParameteri', + 'TexParameteriv', + 'TexParameterx', + 'TexParameterxv', + 'TexSubImage2D', + 'Translatef', + 'Translatex', + 'VertexPointer', + 'Viewport', + # GL_OES_EGL_image + 'EGLImageTargetTexture2DOES', + 'EGLImageTargetRenderbufferStorageOES', + # GL_OES_mapbuffer + 'GetBufferPointervOES', + 'MapBufferOES', + 'UnmapBufferOES', + # GL_EXT_multi_draw_arrays + 'MultiDrawArraysEXT', + 'MultiDrawElementsEXT', + # GL_OES_blend_equation_separate + 'BlendEquationSeparateOES', + # GL_OES_blend_func_separate + 'BlendFuncSeparateOES', + # GL_OES_blend_subtract + 'BlendEquationOES', + # GL_OES_draw_texture + 'DrawTexiOES', + 'DrawTexivOES', + 'DrawTexfOES', + 'DrawTexfvOES', + 'DrawTexsOES', + 'DrawTexsvOES', + 'DrawTexxOES', + 'DrawTexxvOES', + # GL_OES_fixed_point + 'AlphaFuncxOES', + 'ClearColorxOES', + 'ClearDepthxOES', + 'Color4xOES', + 'DepthRangexOES', + 'FogxOES', + 'FogxvOES', + 'FrustumxOES', + 'LightModelxOES', + 'LightModelxvOES', + 'LightxOES', + 'LightxvOES', + 'LineWidthxOES', + 'LoadMatrixxOES', + 'MaterialxOES', + 'MaterialxvOES', + 'MultiTexCoord4xOES', + 'MultMatrixxOES', + 'Normal3xOES', + 'OrthoxOES', + 'PointSizexOES', + 'PolygonOffsetxOES', + 'RotatexOES', + 'SampleCoveragexOES', + 'ScalexOES', + 'TexEnvxOES', + 'TexEnvxvOES', + 'TexParameterxOES', + 'TranslatexOES', + 'ClipPlanexOES', + 'GetClipPlanexOES', + 'GetFixedvOES', + 'GetLightxvOES', + 'GetMaterialxvOES', + 'GetTexEnvxvOES', + 'GetTexParameterxvOES', + 'PointParameterxOES', + 'PointParameterxvOES', + 'TexParameterxvOES', + # GL_OES_framebuffer_object + 'BindFramebufferOES', + 'BindRenderbufferOES', + 'CheckFramebufferStatusOES', + 'DeleteFramebuffersOES', + 'DeleteRenderbuffersOES', + 'FramebufferRenderbufferOES', + 'FramebufferTexture2DOES', + 'GenerateMipmapOES', + 'GenFramebuffersOES', + 'GenRenderbuffersOES', + 'GetFramebufferAttachmentParameterivOES', + 'GetRenderbufferParameterivOES', + 'IsFramebufferOES', + 'IsRenderbufferOES', + 'RenderbufferStorageOES', + # GL_OES_point_size_array + 'PointSizePointerOES', + # GL_OES_query_matrix + 'QueryMatrixxOES', + # GL_OES_single_precision + 'ClearDepthfOES', + 'DepthRangefOES', + 'FrustumfOES', + 'OrthofOES', + 'ClipPlanefOES', + 'GetClipPlanefOES', + # GL_OES_texture_cube_map + 'GetTexGenfvOES', + 'GetTexGenivOES', + 'GetTexGenxvOES', + 'TexGenfOES', + 'TexGenfvOES', + 'TexGeniOES', + 'TexGenivOES', + 'TexGenxOES', + 'TexGenxvOES', + ] + + super(ES1APIPrinter, self).__init__(entries, es1_api) + self.prefix_lib = 'gl' + self.prefix_warn = 'gl' + + def _get_c_header(self): + header = """#ifndef _GLAPI_TMP_H_ +#define _GLAPI_TMP_H_ +typedef int GLfixed; +typedef int GLclampx; +#endif /* _GLAPI_TMP_H_ */""" + + return header + +class ES2APIPrinter(GLAPIPrinter): + """OpenGL ES 2.x API Printer""" + + def __init__(self, entries): + es2_api = [ + # OpenGL ES 2.0 + "ActiveTexture", + "AttachShader", + "BindAttribLocation", + "BindBuffer", + "BindFramebuffer", + "BindRenderbuffer", + "BindTexture", + "BlendColor", + "BlendEquation", + "BlendEquationSeparate", + "BlendFunc", + "BlendFuncSeparate", + "BufferData", + "BufferSubData", + "CheckFramebufferStatus", + "Clear", + "ClearColor", + "ClearDepthf", + "ClearStencil", + "ColorMask", + "CompileShader", + "CompressedTexImage2D", + "CompressedTexSubImage2D", + "CopyTexImage2D", + "CopyTexSubImage2D", + "CreateProgram", + "CreateShader", + "CullFace", + "DeleteBuffers", + "DeleteFramebuffers", + "DeleteProgram", + "DeleteRenderbuffers", + "DeleteShader", + "DeleteTextures", + "DepthFunc", + "DepthMask", + "DepthRangef", + "DetachShader", + "Disable", + "DisableVertexAttribArray", + "DrawArrays", + "DrawElements", + "Enable", + "EnableVertexAttribArray", + "Finish", + "Flush", + "FramebufferRenderbuffer", + "FramebufferTexture2D", + "FrontFace", + "GenBuffers", + "GenerateMipmap", + "GenFramebuffers", + "GenRenderbuffers", + "GenTextures", + "GetActiveAttrib", + "GetActiveUniform", + "GetAttachedShaders", + "GetAttribLocation", + "GetBooleanv", + "GetBufferParameteriv", + "GetError", + "GetFloatv", + "GetFramebufferAttachmentParameteriv", + "GetIntegerv", + "GetProgramInfoLog", + "GetProgramiv", + "GetRenderbufferParameteriv", + "GetShaderInfoLog", + "GetShaderiv", + "GetShaderPrecisionFormat", + "GetShaderSource", + "GetString", + "GetTexParameterfv", + "GetTexParameteriv", + "GetUniformfv", + "GetUniformiv", + "GetUniformLocation", + "GetVertexAttribfv", + "GetVertexAttribiv", + "GetVertexAttribPointerv", + "Hint", + "IsBuffer", + "IsEnabled", + "IsFramebuffer", + "IsProgram", + "IsRenderbuffer", + "IsShader", + "IsTexture", + "LineWidth", + "LinkProgram", + "PixelStorei", + "PolygonOffset", + "ReadPixels", + "ReleaseShaderCompiler", + "RenderbufferStorage", + "SampleCoverage", + "Scissor", + "ShaderBinary", + "ShaderSource", + "StencilFunc", + "StencilFuncSeparate", + "StencilMask", + "StencilMaskSeparate", + "StencilOp", + "StencilOpSeparate", + "TexImage2D", + "TexParameterf", + "TexParameterfv", + "TexParameteri", + "TexParameteriv", + "TexSubImage2D", + "Uniform1f", + "Uniform1fv", + "Uniform1i", + "Uniform1iv", + "Uniform2f", + "Uniform2fv", + "Uniform2i", + "Uniform2iv", + "Uniform3f", + "Uniform3fv", + "Uniform3i", + "Uniform3iv", + "Uniform4f", + "Uniform4fv", + "Uniform4i", + "Uniform4iv", + "UniformMatrix2fv", + "UniformMatrix3fv", + "UniformMatrix4fv", + "UseProgram", + "ValidateProgram", + "VertexAttrib1f", + "VertexAttrib1fv", + "VertexAttrib2f", + "VertexAttrib2fv", + "VertexAttrib3f", + "VertexAttrib3fv", + "VertexAttrib4f", + "VertexAttrib4fv", + "VertexAttribPointer", + "Viewport", + # GL_OES_EGL_image + 'EGLImageTargetTexture2DOES', + 'EGLImageTargetRenderbufferStorageOES', + # GL_OES_mapbuffer + 'GetBufferPointervOES', + 'MapBufferOES', + 'UnmapBufferOES', + # GL_EXT_multi_draw_arrays + 'MultiDrawArraysEXT', + 'MultiDrawElementsEXT', + # GL_OES_texture_3D + 'CompressedTexImage3DOES', + 'CompressedTexSubImage3DOES', + 'CopyTexSubImage3DOES', + 'FramebufferTexture3DOES', + 'TexImage3DOES', + 'TexSubImage3DOES', + # GL_OES_get_program_binary + 'GetProgramBinaryOES', + 'ProgramBinaryOES', + ] + + super(ES2APIPrinter, self).__init__(entries, es2_api) + self.prefix_lib = 'gl' + self.prefix_warn = 'gl' + + def _get_c_header(self): + header = """#ifndef _GLAPI_TMP_H_ +#define _GLAPI_TMP_H_ +typedef int GLfixed; +typedef int GLclampx; +#endif /* _GLAPI_TMP_H_ */""" + + return header + +class SharedGLAPIPrinter(GLAPIPrinter): + """Shared GLAPI API Printer""" + + def __init__(self, entries): + super(SharedGLAPIPrinter, self).__init__(entries, []) + + self.lib_need_table_size = True + self.lib_need_noop_array = True + self.lib_need_stubs = True + self.lib_need_all_entries = True + self.lib_need_non_hidden_entries = False + + self.prefix_lib = 'shared' + self.prefix_warn = 'gl' + + def _get_c_header(self): + header = """#ifndef _GLAPI_TMP_H_ +#define _GLAPI_TMP_H_ +typedef int GLfixed; +typedef int GLclampx; +#endif /* _GLAPI_TMP_H_ */""" + + return header + +class VGAPIPrinter(ABIPrinter): + """OpenVG API Printer""" + + def __init__(self, entries): + super(VGAPIPrinter, self).__init__(entries) + + self.api_defines = ['VG_VGEXT_PROTOTYPES'] + self.api_headers = ['"VG/openvg.h"', '"VG/vgext.h"'] + self.api_call = 'VG_API_CALL' + self.api_entry = 'VG_API_ENTRY' + self.api_attrs = 'VG_API_EXIT' + + self.prefix_lib = 'vg' + self.prefix_app = 'vega' + self.prefix_noop = 'noop' + self.prefix_warn = 'vg' + +def parse_args(): + printers = ['vgapi', 'glapi', 'es1api', 'es2api', 'shared-glapi'] + modes = ['lib', 'app'] + + parser = OptionParser(usage='usage: %prog [options] ') + parser.add_option('-p', '--printer', dest='printer', + help='printer to use: %s' % (", ".join(printers))) + parser.add_option('-m', '--mode', dest='mode', + help='target user: %s' % (", ".join(modes))) + + options, args = parser.parse_args() + if not args or options.printer not in printers or \ + options.mode not in modes: + parser.print_help() + sys.exit(1) + + return (args[0], options) + +def main(): + printers = { + 'vgapi': VGAPIPrinter, + 'glapi': GLAPIPrinter, + 'es1api': ES1APIPrinter, + 'es2api': ES2APIPrinter, + 'shared-glapi': SharedGLAPIPrinter, + } + + filename, options = parse_args() + + if filename.endswith('.xml'): + entries = abi_parse_xml(filename) + else: + entries = abi_parse(filename) + abi_sanity_check(entries) + + printer = printers[options.printer](entries) + if options.mode == 'lib': + printer.output_for_lib() + else: + printer.output_for_app() + +if __name__ == '__main__': + main() diff --git a/mesalib/src/mapi/mapi/mapi_glapi.c b/mesalib/src/mapi/mapi/mapi_glapi.c new file mode 100644 index 000000000..adfc0cbcc --- /dev/null +++ b/mesalib/src/mapi/mapi/mapi_glapi.c @@ -0,0 +1,240 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + +#include +#include "glapi/glapi.h" +#include "mapi/u_current.h" +#include "mapi/table.h" /* for MAPI_TABLE_NUM_SLOTS */ +#include "mapi/stub.h" + +/* + * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in + * u_current.c. + */ + +#ifdef GLX_USE_TLS +/* not used, but defined for compatibility */ +const struct _glapi_table *_glapi_Dispatch; +const void *_glapi_Context; +#endif /* GLX_USE_TLS */ + +void +_glapi_destroy_multithread(void) +{ + u_current_destroy(); +} + +void +_glapi_check_multithread(void) +{ + u_current_init(); +} + +void +_glapi_set_context(void *context) +{ + u_current_set_user((const void *) context); +} + +void +_glapi_set_dispatch(struct _glapi_table *dispatch) +{ + u_current_set((const struct mapi_table *) dispatch); +} + +/** + * Return size of dispatch table struct as number of functions (or + * slots). + */ +unsigned int +_glapi_get_dispatch_table_size(void) +{ + return MAPI_TABLE_NUM_SLOTS; +} + +/** + * Fill-in the dispatch stub for the named function. + * + * This function is intended to be called by a hardware driver. When called, + * a dispatch stub may be created created for the function. A pointer to this + * dispatch function will be returned by glXGetProcAddress. + * + * \param function_names Array of pointers to function names that should + * share a common dispatch offset. + * \param parameter_signature String representing the types of the parameters + * passed to the named function. Parameter types + * are converted to characters using the following + * rules: + * - 'i' for \c GLint, \c GLuint, and \c GLenum + * - 'p' for any pointer type + * - 'f' for \c GLfloat and \c GLclampf + * - 'd' for \c GLdouble and \c GLclampd + * + * \returns + * The offset in the dispatch table of the named function. A pointer to the + * driver's implementation of the named function should be stored at + * \c dispatch_table[\c offset]. Return -1 if error/problem. + * + * \sa glXGetProcAddress + * + * \warning + * This function can only handle up to 8 names at a time. As far as I know, + * the maximum number of names ever associated with an existing GL function is + * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT, + * \c glPointParameterfARB, and \c glPointParameterf), so this should not be + * too painful of a limitation. + * + * \todo + * Check parameter_signature. + */ +int +_glapi_add_dispatch( const char * const * function_names, + const char * parameter_signature ) +{ + const struct mapi_stub *function_stubs[8]; + const struct mapi_stub *alias = NULL; + unsigned i; + + (void) memset(function_stubs, 0, sizeof(function_stubs)); + + /* find the missing stubs, and decide the alias */ + for (i = 0; function_names[i] != NULL && i < 8; i++) { + const char * funcName = function_names[i]; + const struct mapi_stub *stub; + int slot; + + if (!funcName || funcName[0] != 'g' || funcName[1] != 'l') + return -1; + funcName += 2; + + stub = stub_find_public(funcName); + if (!stub) + stub = stub_find_dynamic(funcName, 0); + + slot = (stub) ? stub_get_slot(stub) : -1; + if (slot >= 0) { + if (alias && stub_get_slot(alias) != slot) + return -1; + /* use the first existing stub as the alias */ + if (!alias) + alias = stub; + + function_stubs[i] = stub; + } + } + + /* generate missing stubs */ + for (i = 0; function_names[i] != NULL && i < 8; i++) { + const char * funcName = function_names[i] + 2; + struct mapi_stub *stub; + + if (function_stubs[i]) + continue; + + stub = stub_find_dynamic(funcName, 1); + if (!stub) + return -1; + + stub_fix_dynamic(stub, alias); + if (!alias) + alias = stub; + } + + return (alias) ? stub_get_slot(alias) : -1; +} + +static const struct mapi_stub * +_glapi_get_stub(const char *name, int generate) +{ + const struct mapi_stub *stub; + +#ifdef USE_MGL_NAMESPACE + if (name) + name++; +#endif + + if (!name || name[0] != 'g' || name[1] != 'l') + return NULL; + name += 2; + + stub = stub_find_public(name); + if (!stub) + stub = stub_find_dynamic(name, generate); + + return stub; +} + +/** + * Return offset of entrypoint for named function within dispatch table. + */ +int +_glapi_get_proc_offset(const char *funcName) +{ + const struct mapi_stub *stub = _glapi_get_stub(funcName, 0); + return (stub) ? stub_get_slot(stub) : -1; +} + +/** + * Return pointer to the named function. If the function name isn't found + * in the name of static functions, try generating a new API entrypoint on + * the fly with assembly language. + */ +_glapi_proc +_glapi_get_proc_address(const char *funcName) +{ + const struct mapi_stub *stub = _glapi_get_stub(funcName, 1); + return (stub) ? (_glapi_proc) stub_get_addr(stub) : NULL; +} + +/** + * Return the name of the function at the given dispatch offset. + * This is only intended for debugging. + */ +const char * +_glapi_get_proc_name(unsigned int offset) +{ + /* not implemented */ + return NULL; +} + +unsigned long +_glthread_GetID(void) +{ + return u_thread_self(); +} + +void +_glapi_noop_enable_warnings(unsigned char enable) +{ +} + +void +_glapi_set_warning_func(_glapi_proc func) +{ +} diff --git a/mesalib/src/mapi/mapi/mapi_tmp.h b/mesalib/src/mapi/mapi/mapi_tmp.h index bc78eaabf..f326b4a4e 100644 --- a/mesalib/src/mapi/mapi/mapi_tmp.h +++ b/mesalib/src/mapi/mapi/mapi_tmp.h @@ -1,33 +1,48 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu - */ - -#ifndef MAPI_ABI_HEADER -#error "MAPI_ABI_HEADER must be defined" -#endif - -#include MAPI_ABI_HEADER +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu + */ + +#ifndef MAPI_ABI_HEADER +#error "MAPI_ABI_HEADER must be defined" +#endif + +/* does not need hidden entries in bridge mode */ +#ifdef MAPI_MODE_BRIDGE + +#ifdef MAPI_TMP_PUBLIC_ENTRIES +#undef MAPI_TMP_PUBLIC_ENTRIES +#define MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN +#endif + +#ifdef MAPI_TMP_STUB_ASM_GCC +#undef MAPI_TMP_STUB_ASM_GCC +#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN +#endif + +#endif /* MAPI_MODE_BRIDGE */ + +#include MAPI_ABI_HEADER diff --git a/mesalib/src/mapi/mapi/sources.mak b/mesalib/src/mapi/mapi/sources.mak index 1f4a42da7..c50234b57 100644 --- a/mesalib/src/mapi/mapi/sources.mak +++ b/mesalib/src/mapi/mapi/sources.mak @@ -1,21 +1,37 @@ -# src/mapi/mapi/sources.mak -# -# mapi may be used in several ways -# -# - In default mode, mapi implements the interface defined by mapi.h. To use -# this mode, compile MAPI_SOURCES. -# -# - In util mode, mapi provides utility functions for use with glapi. To use -# this mode, compile MAPI_UTIL_SOURCES with MAPI_MODE_UTIL defined. - -MAPI_UTIL_SOURCES = \ - u_current.c \ - u_execmem.c \ - u_thread.c - -MAPI_SOURCES = \ - entry.c \ - mapi.c \ - stub.c \ - table.c \ - $(MAPI_UTIL_SOURCES) +# src/mapi/mapi/sources.mak +# +# mapi may be used in several ways +# +# - In default mode, mapi implements the interface defined by mapi.h. To use +# this mode, compile MAPI_SOURCES. +# +# - In util mode, mapi provides utility functions for use with glapi. To use +# this mode, compile MAPI_UTIL_SOURCES with MAPI_MODE_UTIL defined. +# +# - In glapi mode, mapi implements the interface defined by glapi.h. To use +# this mode, compile MAPI_GLAPI_SOURCES with MAPI_MODE_GLAPI defined. +# +# - In bridge mode, mapi provides entry points calling into glapi. To use +# this mode, compile MAPI_BRIDGE_SOURCES with MAPI_MODE_BRIDGE defined. + +MAPI_UTIL_SOURCES = \ + u_current.c \ + u_execmem.c \ + u_thread.c + +MAPI_SOURCES = \ + entry.c \ + mapi.c \ + stub.c \ + table.c \ + $(MAPI_UTIL_SOURCES) + +MAPI_GLAPI_SOURCES = \ + entry.c \ + mapi_glapi.c \ + stub.c \ + table.c \ + $(MAPI_UTIL_SOURCES) + +MAPI_BRIDGE_SOURCES = \ + entry.c diff --git a/mesalib/src/mapi/mapi/u_current.h b/mesalib/src/mapi/mapi/u_current.h index 295a70c03..f9cffd8c3 100644 --- a/mesalib/src/mapi/mapi/u_current.h +++ b/mesalib/src/mapi/mapi/u_current.h @@ -1,86 +1,87 @@ -#ifndef _U_CURRENT_H_ -#define _U_CURRENT_H_ - -#ifdef MAPI_MODE_UTIL - -#include "glapi/glapi.h" - -/* ugly renames to match glapi.h */ -#define mapi_table _glapi_table - -#ifdef GLX_USE_TLS -#define u_current_table _glapi_tls_Dispatch -#define u_current_user _glapi_tls_Context -#else -#define u_current_table _glapi_Dispatch -#define u_current_user _glapi_Context -#endif - -#define u_current_get_internal _glapi_get_dispatch -#define u_current_get_user_internal _glapi_get_context - -#define u_current_table_tsd _gl_DispatchTSD - -#else /* MAPI_MODE_UTIL */ - -#include "u_compiler.h" - -struct mapi_table; - -#ifdef GLX_USE_TLS - -extern __thread struct mapi_table *u_current_table - __attribute__((tls_model("initial-exec"))); - -extern __thread void *u_current_user - __attribute__((tls_model("initial-exec"))); - -#else /* GLX_USE_TLS */ - -extern struct mapi_table *u_current_table; -extern void *u_current_user; - -#endif /* GLX_USE_TLS */ - -#endif /* MAPI_MODE_UTIL */ - -void -u_current_init(void); - -void -u_current_destroy(void); - -void -u_current_set(const struct mapi_table *tbl); - -struct mapi_table * -u_current_get_internal(void); - -void -u_current_set_user(const void *ptr); - -void * -u_current_get_user_internal(void); - -static INLINE const struct mapi_table * -u_current_get(void) -{ -#ifdef GLX_USE_TLS - return u_current_table; -#else - return (likely(u_current_table) ? - u_current_table : u_current_get_internal()); -#endif -} - -static INLINE const void * -u_current_get_user(void) -{ -#ifdef GLX_USE_TLS - return u_current_user; -#else - return likely(u_current_user) ? u_current_user : u_current_get_user_internal(); -#endif -} - -#endif /* _U_CURRENT_H_ */ +#ifndef _U_CURRENT_H_ +#define _U_CURRENT_H_ + +#if defined(MAPI_MODE_UTIL) || defined(MAPI_MODE_GLAPI) || \ + defined(MAPI_MODE_BRIDGE) + +#include "glapi/glapi.h" + +/* ugly renames to match glapi.h */ +#define mapi_table _glapi_table + +#ifdef GLX_USE_TLS +#define u_current_table _glapi_tls_Dispatch +#define u_current_user _glapi_tls_Context +#else +#define u_current_table _glapi_Dispatch +#define u_current_user _glapi_Context +#endif + +#define u_current_get_internal _glapi_get_dispatch +#define u_current_get_user_internal _glapi_get_context + +#define u_current_table_tsd _gl_DispatchTSD + +#else /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */ + +#include "u_compiler.h" + +struct mapi_table; + +#ifdef GLX_USE_TLS + +extern __thread struct mapi_table *u_current_table + __attribute__((tls_model("initial-exec"))); + +extern __thread void *u_current_user + __attribute__((tls_model("initial-exec"))); + +#else /* GLX_USE_TLS */ + +extern struct mapi_table *u_current_table; +extern void *u_current_user; + +#endif /* GLX_USE_TLS */ + +#endif /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */ + +void +u_current_init(void); + +void +u_current_destroy(void); + +void +u_current_set(const struct mapi_table *tbl); + +struct mapi_table * +u_current_get_internal(void); + +void +u_current_set_user(const void *ptr); + +void * +u_current_get_user_internal(void); + +static INLINE const struct mapi_table * +u_current_get(void) +{ +#ifdef GLX_USE_TLS + return u_current_table; +#else + return (likely(u_current_table) ? + u_current_table : u_current_get_internal()); +#endif +} + +static INLINE const void * +u_current_get_user(void) +{ +#ifdef GLX_USE_TLS + return u_current_user; +#else + return likely(u_current_user) ? u_current_user : u_current_get_user_internal(); +#endif +} + +#endif /* _U_CURRENT_H_ */ diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index fe370fa36..e017939a4 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -534,8 +534,17 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) prog->MediumFloat.RangeMax = 127; prog->MediumFloat.Precision = 23; prog->LowFloat = prog->HighFloat = prog->MediumFloat; - /* assume ints are stored as floats for now */ - prog->LowInt = prog->MediumInt = prog->HighInt = prog->MediumFloat; + + /* Assume ints are stored as floats for now, since this is the least-common + * denominator. The OpenGL ES spec implies (page 132) that the precision + * of integer types should be 0. Practically speaking, IEEE + * single-precision floating point values can only store integers in the + * range [-0x01000000, 0x01000000] without loss of precision. + */ + prog->MediumInt.RangeMin = 24; + prog->MediumInt.RangeMax = 24; + prog->MediumInt.Precision = 0; + prog->LowInt = prog->HighInt = prog->MediumInt; } diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 51e757be5..749c30a4c 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -1,1201 +1,1196 @@ -/** - * \file dd.h - * Device driver interfaces. - */ - -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 Brian Paul 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 - * BRIAN PAUL 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. - */ - - -#ifndef DD_INCLUDED -#define DD_INCLUDED - -/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ - -#include "glheader.h" - -struct gl_buffer_object; -struct gl_context; -struct gl_display_list; -struct gl_framebuffer; -struct gl_pixelstore_attrib; -struct gl_program; -struct gl_renderbuffer; -struct gl_renderbuffer_attachment; -struct gl_shader; -struct gl_shader_program; -struct gl_texture_image; -struct gl_texture_object; - -/* GL_ARB_vertex_buffer_object */ -/* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return - * NULL) if buffer is unavailable for immediate mapping. - * - * Does GL_MAP_INVALIDATE_RANGE_BIT do this? It seems so, but it - * would require more book-keeping in the driver than seems necessary - * at this point. - * - * Does GL_MAP_INVALDIATE_BUFFER_BIT do this? Not really -- we don't - * want to provoke the driver to throw away the old storage, we will - * respect the contents of already referenced data. - */ -#define MESA_MAP_NOWAIT_BIT 0x0040 - - -/** - * Device driver function table. - * Core Mesa uses these function pointers to call into device drivers. - * Most of these functions directly correspond to OpenGL state commands. - * Core Mesa will call these functions after error checking has been done - * so that the drivers don't have to worry about error testing. - * - * Vertex transformation/clipping/lighting is patched into the T&L module. - * Rasterization functions are patched into the swrast module. - * - * Note: when new functions are added here, the drivers/common/driverfuncs.c - * file should be updated too!!! - */ -struct dd_function_table { - /** - * Return a string as needed by glGetString(). - * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be - * returned. - */ - const GLubyte * (*GetString)( struct gl_context *ctx, GLenum name ); - - /** - * Notify the driver after Mesa has made some internal state changes. - * - * This is in addition to any state change callbacks Mesa may already have - * made. - */ - void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state ); - - /** - * Get the width and height of the named buffer/window. - * - * Mesa uses this to determine when the driver's window size has changed. - * XXX OBSOLETE: this function will be removed in the future. - */ - void (*GetBufferSize)( struct gl_framebuffer *buffer, - GLuint *width, GLuint *height ); - - /** - * Resize the given framebuffer to the given size. - * XXX OBSOLETE: this function will be removed in the future. - */ - void (*ResizeBuffers)( struct gl_context *ctx, struct gl_framebuffer *fb, - GLuint width, GLuint height); - - /** - * Called whenever an error is generated. - * __struct gl_contextRec::ErrorValue contains the error value. - */ - void (*Error)( struct gl_context *ctx ); - - /** - * This is called whenever glFinish() is called. - */ - void (*Finish)( struct gl_context *ctx ); - - /** - * This is called whenever glFlush() is called. - */ - void (*Flush)( struct gl_context *ctx ); - - /** - * Clear the color/depth/stencil/accum buffer(s). - * \param buffers a bitmask of BUFFER_BIT_* flags indicating which - * renderbuffers need to be cleared. - */ - void (*Clear)( struct gl_context *ctx, GLbitfield buffers ); - - /** - * Execute glAccum command. - */ - void (*Accum)( struct gl_context *ctx, GLenum op, GLfloat value ); - - - /** - * Execute glRasterPos, updating the ctx->Current.Raster fields - */ - void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] ); - - /** - * \name Image-related functions - */ - /*@{*/ - - /** - * Called by glDrawPixels(). - * \p unpack describes how to unpack the source image data. - */ - void (*DrawPixels)( struct gl_context *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels ); - - /** - * Called by glReadPixels(). - */ - void (*ReadPixels)( struct gl_context *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - GLvoid *dest ); - - /** - * Called by glCopyPixels(). - */ - void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy, - GLsizei width, GLsizei height, - GLint dstx, GLint dsty, GLenum type ); - - /** - * Called by glBitmap(). - */ - void (*Bitmap)( struct gl_context *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap ); - /*@}*/ - - - /** - * \name Texture image functions - */ - /*@{*/ - - /** - * Choose texture format. - * - * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback - * functions. The driver should examine \p internalFormat and return a - * gl_format value. - */ - GLuint (*ChooseTextureFormat)( struct gl_context *ctx, GLint internalFormat, - GLenum srcFormat, GLenum srcType ); - - /** - * Called by glTexImage1D(). - * - * \param target user specified. - * \param format user specified. - * \param type user specified. - * \param pixels user specified. - * \param packing indicates the image packing of pixels. - * \param texObj is the target texture object. - * \param texImage is the target texture image. It will have the texture \p - * width, \p height, \p depth, \p border and \p internalFormat information. - * - * \p retainInternalCopy is returned by this function and indicates whether - * core Mesa should keep an internal copy of the texture image. - * - * Drivers should call a fallback routine from texstore.c if needed. - */ - void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - - /** - * Called by glTexImage2D(). - * - * \sa dd_function_table::TexImage1D. - */ - void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - - /** - * Called by glTexImage3D(). - * - * \sa dd_function_table::TexImage1D. - */ - void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - - /** - * Called by glTexSubImage1D(). - * - * \param target user specified. - * \param level user specified. - * \param xoffset user specified. - * \param yoffset user specified. - * \param zoffset user specified. - * \param width user specified. - * \param height user specified. - * \param depth user specified. - * \param format user specified. - * \param type user specified. - * \param pixels user specified. - * \param packing indicates the image packing of pixels. - * \param texObj is the target texture object. - * \param texImage is the target texture image. It will have the texture \p - * width, \p height, \p border and \p internalFormat information. - * - * The driver should use a fallback routine from texstore.c if needed. - */ - void (*TexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - - /** - * Called by glTexSubImage2D(). - * - * \sa dd_function_table::TexSubImage1D. - */ - void (*TexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - - /** - * Called by glTexSubImage3D(). - * - * \sa dd_function_table::TexSubImage1D. - */ - void (*TexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLint depth, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - - /** - * Called by glGetTexImage(). - */ - void (*GetTexImage)( struct gl_context *ctx, GLenum target, GLint level, - GLenum format, GLenum type, GLvoid *pixels, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - - /** - * Called by glCopyTexImage1D(). - * - * Drivers should use a fallback routine from texstore.c if needed. - */ - void (*CopyTexImage1D)( struct gl_context *ctx, GLenum target, GLint level, - GLenum internalFormat, GLint x, GLint y, - GLsizei width, GLint border ); - - /** - * Called by glCopyTexImage2D(). - * - * Drivers should use a fallback routine from texstore.c if needed. - */ - void (*CopyTexImage2D)( struct gl_context *ctx, GLenum target, GLint level, - GLenum internalFormat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border ); - - /** - * Called by glCopyTexSubImage1D(). - * - * Drivers should use a fallback routine from texstore.c if needed. - */ - void (*CopyTexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, - GLint x, GLint y, GLsizei width ); - /** - * Called by glCopyTexSubImage2D(). - * - * Drivers should use a fallback routine from texstore.c if needed. - */ - void (*CopyTexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint x, GLint y, - GLsizei width, GLsizei height ); - /** - * Called by glCopyTexSubImage3D(). - * - * Drivers should use a fallback routine from texstore.c if needed. - */ - void (*CopyTexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint x, GLint y, - GLsizei width, GLsizei height ); - - /** - * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. - */ - void (*GenerateMipmap)(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj); - - /** - * Called by glTexImage[123]D when user specifies a proxy texture - * target. - * - * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails. - */ - GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target, - GLint level, GLint internalFormat, - GLenum format, GLenum type, - GLint width, GLint height, - GLint depth, GLint border); - /*@}*/ - - - /** - * \name Compressed texture functions - */ - /*@{*/ - - /** - * Called by glCompressedTexImage1D(). - * - * \param target user specified. - * \param format user specified. - * \param type user specified. - * \param pixels user specified. - * \param packing indicates the image packing of pixels. - * \param texObj is the target texture object. - * \param texImage is the target texture image. It will have the texture \p - * width, \p height, \p depth, \p border and \p internalFormat information. - * - * \a retainInternalCopy is returned by this function and indicates whether - * core Mesa should keep an internal copy of the texture image. - */ - void (*CompressedTexImage1D)( struct gl_context *ctx, GLenum target, - GLint level, GLint internalFormat, - GLsizei width, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - /** - * Called by glCompressedTexImage2D(). - * - * \sa dd_function_table::CompressedTexImage1D. - */ - void (*CompressedTexImage2D)( struct gl_context *ctx, GLenum target, - GLint level, GLint internalFormat, - GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - /** - * Called by glCompressedTexImage3D(). - * - * \sa dd_function_table::CompressedTexImage3D. - */ - void (*CompressedTexImage3D)( struct gl_context *ctx, GLenum target, - GLint level, GLint internalFormat, - GLsizei width, GLsizei height, GLsizei depth, - GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - - /** - * Called by glCompressedTexSubImage1D(). - * - * \param target user specified. - * \param level user specified. - * \param xoffset user specified. - * \param yoffset user specified. - * \param zoffset user specified. - * \param width user specified. - * \param height user specified. - * \param depth user specified. - * \param imageSize user specified. - * \param data user specified. - * \param texObj is the target texture object. - * \param texImage is the target texture image. It will have the texture \p - * width, \p height, \p depth, \p border and \p internalFormat information. - */ - void (*CompressedTexSubImage1D)(struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLsizei width, - GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - /** - * Called by glCompressedTexSubImage2D(). - * - * \sa dd_function_table::CompressedTexImage3D. - */ - void (*CompressedTexSubImage2D)(struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLint height, - GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - /** - * Called by glCompressedTexSubImage3D(). - * - * \sa dd_function_table::CompressedTexImage3D. - */ - void (*CompressedTexSubImage3D)(struct gl_context *ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLint height, GLint depth, - GLenum format, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - - - /** - * Called by glGetCompressedTexImage. - */ - void (*GetCompressedTexImage)(struct gl_context *ctx, GLenum target, GLint level, - GLvoid *img, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - - /*@}*/ - - /** - * \name Texture object functions - */ - /*@{*/ - - /** - * Called by glBindTexture(). - */ - void (*BindTexture)( struct gl_context *ctx, GLenum target, - struct gl_texture_object *tObj ); - - /** - * Called to allocate a new texture object. - * A new gl_texture_object should be returned. The driver should - * attach to it any device-specific info it needs. - */ - struct gl_texture_object * (*NewTextureObject)( struct gl_context *ctx, GLuint name, - GLenum target ); - /** - * Called when a texture object is about to be deallocated. - * - * Driver should delete the gl_texture_object object and anything - * hanging off of it. - */ - void (*DeleteTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); - - /** - * Called to allocate a new texture image object. - */ - struct gl_texture_image * (*NewTextureImage)( struct gl_context *ctx ); - - /** - * Called to free tImage->Data. - */ - void (*FreeTexImageData)( struct gl_context *ctx, struct gl_texture_image *tImage ); - - /** Map texture image data into user space */ - void (*MapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); - /** Unmap texture images from user space */ - void (*UnmapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); - - /** - * Note: no context argument. This function doesn't initially look - * like it belongs here, except that the driver is the only entity - * that knows for sure how the texture memory is allocated - via - * the above callbacks. There is then an argument that the driver - * knows what memcpy paths might be fast. Typically this is invoked with - * - * to -- a pointer into texture memory allocated by NewTextureImage() above. - * from -- a pointer into client memory or a mesa temporary. - * sz -- nr bytes to copy. - */ - void* (*TextureMemCpy)( void *to, const void *from, size_t sz ); - - /** - * Called by glAreTextureResident(). - */ - GLboolean (*IsTextureResident)( struct gl_context *ctx, - struct gl_texture_object *t ); - - /** - * Called when the texture's color lookup table is changed. - * - * If \p tObj is NULL then the shared texture palette - * gl_texture_object::Palette is to be updated. - */ - void (*UpdateTexturePalette)( struct gl_context *ctx, - struct gl_texture_object *tObj ); - /*@}*/ - - - /** - * \name Imaging functionality - */ - /*@{*/ - void (*CopyColorTable)( struct gl_context *ctx, - GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width ); - - void (*CopyColorSubTable)( struct gl_context *ctx, - GLenum target, GLsizei start, - GLint x, GLint y, GLsizei width ); - /*@}*/ - - - /** - * \name Vertex/fragment program functions - */ - /*@{*/ - /** Bind a vertex/fragment program */ - void (*BindProgram)(struct gl_context *ctx, GLenum target, struct gl_program *prog); - /** Allocate a new program */ - struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target, GLuint id); - /** Delete a program */ - void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog); - /** - * Notify driver that a program string (and GPU code) has been specified - * or modified. Return GL_TRUE or GL_FALSE to indicate if the program is - * supported by the driver. - */ - GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target, - struct gl_program *prog); - - /** Query if program can be loaded onto hardware */ - GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target, - struct gl_program *prog); - - /*@}*/ - - /** - * \name GLSL shader/program functions. - */ - /*@{*/ - /** - * Called when a shader is compiled. - * - * Note that not all shader objects get ShaderCompile called on - * them. Notably, the shaders containing builtin functions do not - * have CompileShader() called, so if lowering passes are done they - * need to also be performed in LinkShader(). - */ - GLboolean (*CompileShader)(struct gl_context *ctx, struct gl_shader *shader); - /** - * Called when a shader program is linked. - * - * This gives drivers an opportunity to clone the IR and make their - * own transformations on it for the purposes of code generation. - */ - GLboolean (*LinkShader)(struct gl_context *ctx, struct gl_shader_program *shader); - /*@}*/ - - /** - * \name State-changing functions. - * - * \note drawing functions are above. - * - * These functions are called by their corresponding OpenGL API functions. - * They are \e also called by the gl_PopAttrib() function!!! - * May add more functions like these to the device driver in the future. - */ - /*@{*/ - /** Specify the alpha test function */ - void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref); - /** Set the blend color */ - void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]); - /** Set the blend equation */ - void (*BlendEquationSeparate)(struct gl_context *ctx, GLenum modeRGB, GLenum modeA); - void (*BlendEquationSeparatei)(struct gl_context *ctx, GLuint buffer, - GLenum modeRGB, GLenum modeA); - /** Specify pixel arithmetic */ - void (*BlendFuncSeparate)(struct gl_context *ctx, - GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA); - void (*BlendFuncSeparatei)(struct gl_context *ctx, GLuint buffer, - GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA); - /** Specify clear values for the color buffers */ - void (*ClearColor)(struct gl_context *ctx, const GLfloat color[4]); - /** Specify the clear value for the depth buffer */ - void (*ClearDepth)(struct gl_context *ctx, GLclampd d); - /** Specify the clear value for the stencil buffer */ - void (*ClearStencil)(struct gl_context *ctx, GLint s); - /** Specify a plane against which all geometry is clipped */ - void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *equation ); - /** Enable and disable writing of frame buffer color components */ - void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask, - GLboolean bmask, GLboolean amask ); - void (*ColorMaskIndexed)(struct gl_context *ctx, GLuint buf, GLboolean rmask, - GLboolean gmask, GLboolean bmask, GLboolean amask); - /** Cause a material color to track the current color */ - void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode); - /** Specify whether front- or back-facing facets can be culled */ - void (*CullFace)(struct gl_context *ctx, GLenum mode); - /** Define front- and back-facing polygons */ - void (*FrontFace)(struct gl_context *ctx, GLenum mode); - /** Specify the value used for depth buffer comparisons */ - void (*DepthFunc)(struct gl_context *ctx, GLenum func); - /** Enable or disable writing into the depth buffer */ - void (*DepthMask)(struct gl_context *ctx, GLboolean flag); - /** Specify mapping of depth values from NDC to window coordinates */ - void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval); - /** Specify the current buffer for writing */ - void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer ); - /** Specify the buffers for writing for fragment programs*/ - void (*DrawBuffers)( struct gl_context *ctx, GLsizei n, const GLenum *buffers ); - /** Enable or disable server-side gl capabilities */ - void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state); - /** Specify fog parameters */ - void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params); - /** Specify implementation-specific hints */ - void (*Hint)(struct gl_context *ctx, GLenum target, GLenum mode); - /** Set light source parameters. - * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already - * been transformed to eye-space. - */ - void (*Lightfv)(struct gl_context *ctx, GLenum light, - GLenum pname, const GLfloat *params ); - /** Set the lighting model parameters */ - void (*LightModelfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params); - /** Specify the line stipple pattern */ - void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern ); - /** Specify the width of rasterized lines */ - void (*LineWidth)(struct gl_context *ctx, GLfloat width); - /** Specify a logical pixel operation for color index rendering */ - void (*LogicOpcode)(struct gl_context *ctx, GLenum opcode); - void (*PointParameterfv)(struct gl_context *ctx, GLenum pname, - const GLfloat *params); - /** Specify the diameter of rasterized points */ - void (*PointSize)(struct gl_context *ctx, GLfloat size); - /** Select a polygon rasterization mode */ - void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode); - /** Set the scale and units used to calculate depth values */ - void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units); - /** Set the polygon stippling pattern */ - void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask ); - /* Specifies the current buffer for reading */ - void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer ); - /** Set rasterization mode */ - void (*RenderMode)(struct gl_context *ctx, GLenum mode ); - /** Define the scissor box */ - void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); - /** Select flat or smooth shading */ - void (*ShadeModel)(struct gl_context *ctx, GLenum mode); - /** OpenGL 2.0 two-sided StencilFunc */ - void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func, - GLint ref, GLuint mask); - /** OpenGL 2.0 two-sided StencilMask */ - void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask); - /** OpenGL 2.0 two-sided StencilOp */ - void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail, - GLenum zfail, GLenum zpass); - /** Control the generation of texture coordinates */ - void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname, - const GLfloat *params); - /** Set texture environment parameters */ - void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname, - const GLfloat *param); - /** Set texture parameters */ - void (*TexParameter)(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj, - GLenum pname, const GLfloat *params); - /** Set the viewport */ - void (*Viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); - /*@}*/ - - - /** - * \name Vertex/pixel buffer object functions - */ - /*@{*/ - void (*BindBuffer)( struct gl_context *ctx, GLenum target, - struct gl_buffer_object *obj ); - - struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, GLuint buffer, - GLenum target ); - - void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj ); - - GLboolean (*BufferData)( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, - const GLvoid *data, GLenum usage, - struct gl_buffer_object *obj ); - - void (*BufferSubData)( struct gl_context *ctx, GLenum target, GLintptrARB offset, - GLsizeiptrARB size, const GLvoid *data, - struct gl_buffer_object *obj ); - - void (*GetBufferSubData)( struct gl_context *ctx, GLenum target, - GLintptrARB offset, GLsizeiptrARB size, - GLvoid *data, struct gl_buffer_object *obj ); - - void * (*MapBuffer)( struct gl_context *ctx, GLenum target, GLenum access, - struct gl_buffer_object *obj ); - - void (*CopyBufferSubData)( struct gl_context *ctx, - struct gl_buffer_object *src, - struct gl_buffer_object *dst, - GLintptr readOffset, GLintptr writeOffset, - GLsizeiptr size ); - - /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access: - */ - void * (*MapBufferRange)( struct gl_context *ctx, GLenum target, GLintptr offset, - GLsizeiptr length, GLbitfield access, - struct gl_buffer_object *obj); - - void (*FlushMappedBufferRange)(struct gl_context *ctx, GLenum target, - GLintptr offset, GLsizeiptr length, - struct gl_buffer_object *obj); - - GLboolean (*UnmapBuffer)( struct gl_context *ctx, GLenum target, - struct gl_buffer_object *obj ); - /*@}*/ - - /** - * \name Functions for GL_APPLE_object_purgeable - */ - /*@{*/ - /* variations on ObjectPurgeable */ - GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); - GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); - GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); - - /* variations on ObjectUnpurgeable */ - GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); - GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); - GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); - /*@}*/ - - /** - * \name Functions for GL_EXT_framebuffer_{object,blit}. - */ - /*@{*/ - struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx, GLuint name); - struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx, GLuint name); - void (*BindFramebuffer)(struct gl_context *ctx, GLenum target, - struct gl_framebuffer *drawFb, - struct gl_framebuffer *readFb); - void (*FramebufferRenderbuffer)(struct gl_context *ctx, - struct gl_framebuffer *fb, - GLenum attachment, - struct gl_renderbuffer *rb); - void (*RenderTexture)(struct gl_context *ctx, - struct gl_framebuffer *fb, - struct gl_renderbuffer_attachment *att); - void (*FinishRenderTexture)(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att); - void (*ValidateFramebuffer)(struct gl_context *ctx, - struct gl_framebuffer *fb); - /*@}*/ - void (*BlitFramebuffer)(struct gl_context *ctx, - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, - GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, - GLbitfield mask, GLenum filter); - - /** - * \name Query objects - */ - /*@{*/ - struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id); - void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q); - void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q); - void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q); - void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q); - void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q); - /*@}*/ - - - /** - * \name Vertex Array objects - */ - /*@{*/ - struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id); - void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); - void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); - /*@}*/ - - /** - * \name GLSL-related functions (ARB extensions and OpenGL 2.x) - */ - /*@{*/ - struct gl_shader *(*NewShader)(struct gl_context *ctx, GLuint name, GLenum type); - void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader); - struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx, GLuint name); - void (*DeleteShaderProgram)(struct gl_context *ctx, - struct gl_shader_program *shProg); - void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg); - /*@}*/ - - - /** - * \name Support for multiple T&L engines - */ - /*@{*/ - - /** - * Bitmask of state changes that require the current T&L module to be - * validated, using ValidateTnlModule() below. - */ - GLuint NeedValidate; - - /** - * Validate the current T&L module. - * - * This is called directly after UpdateState() when a state change that has - * occurred matches the dd_function_table::NeedValidate bitmask above. This - * ensures all computed values are up to date, thus allowing the driver to - * decide if the current T&L module needs to be swapped out. - * - * This must be non-NULL if a driver installs a custom T&L module and sets - * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise. - */ - void (*ValidateTnlModule)( struct gl_context *ctx, GLuint new_state ); - - -#define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1) -#define PRIM_INSIDE_UNKNOWN_PRIM (GL_POLYGON+2) -#define PRIM_UNKNOWN (GL_POLYGON+3) - - /** - * Set by the driver-supplied T&L engine. - * - * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd(). - */ - GLuint CurrentExecPrimitive; - - /** - * Current state of an in-progress compilation. - * - * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END, - * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above. - */ - GLuint CurrentSavePrimitive; - - -#define FLUSH_STORED_VERTICES 0x1 -#define FLUSH_UPDATE_CURRENT 0x2 - /** - * Set by the driver-supplied T&L engine whenever vertices are buffered - * between glBegin()/glEnd() objects or __struct gl_contextRec::Current is not - * updated. - * - * The dd_function_table::FlushVertices call below may be used to resolve - * these conditions. - */ - GLuint NeedFlush; - GLuint SaveNeedFlush; - - - /* Called prior to any of the GLvertexformat functions being - * called. Paired with Driver.FlushVertices(). - */ - void (*BeginVertices)( struct gl_context *ctx ); - - /** - * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if - * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered - * vertices, if FLUSH_UPDATE_CURRENT bit is set updates - * __struct gl_contextRec::Current and gl_light_attrib::Material - * - * Note that the default T&L engine never clears the - * FLUSH_UPDATE_CURRENT bit, even after performing the update. - */ - void (*FlushVertices)( struct gl_context *ctx, GLuint flags ); - void (*SaveFlushVertices)( struct gl_context *ctx ); - - /** - * Give the driver the opportunity to hook in its own vtxfmt for - * compiling optimized display lists. This is called on each valid - * glBegin() during list compilation. - */ - GLboolean (*NotifySaveBegin)( struct gl_context *ctx, GLenum mode ); - - /** - * Notify driver that the special derived value _NeedEyeCoords has - * changed. - */ - void (*LightingSpaceChange)( struct gl_context *ctx ); - - /** - * Called by glNewList(). - * - * Let the T&L component know what is going on with display lists - * in time to make changes to dispatch tables, etc. - */ - void (*NewList)( struct gl_context *ctx, GLuint list, GLenum mode ); - /** - * Called by glEndList(). - * - * \sa dd_function_table::NewList. - */ - void (*EndList)( struct gl_context *ctx ); - - /** - * Called by glCallList(s). - * - * Notify the T&L component before and after calling a display list. - */ - void (*BeginCallList)( struct gl_context *ctx, - struct gl_display_list *dlist ); - /** - * Called by glEndCallList(). - * - * \sa dd_function_table::BeginCallList. - */ - void (*EndCallList)( struct gl_context *ctx ); - - - /** - * \name GL_ARB_sync interfaces - */ - /*@{*/ - struct gl_sync_object * (*NewSyncObject)(struct gl_context *, GLenum); - void (*FenceSync)(struct gl_context *, struct gl_sync_object *, GLenum, GLbitfield); - void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *); - void (*CheckSync)(struct gl_context *, struct gl_sync_object *); - void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *, - GLbitfield, GLuint64); - void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *, - GLbitfield, GLuint64); - /*@}*/ - - /** GL_NV_conditional_render */ - void (*BeginConditionalRender)(struct gl_context *ctx, struct gl_query_object *q, - GLenum mode); - void (*EndConditionalRender)(struct gl_context *ctx, struct gl_query_object *q); - - /** - * \name GL_OES_draw_texture interface - */ - /*@{*/ - void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, - GLfloat width, GLfloat height); - /*@}*/ - - /** - * \name GL_OES_EGL_image interface - */ - void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage, - GLeglImageOES image_handle); - void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx, - struct gl_renderbuffer *rb, - void *image_handle); - - /** - * \name GL_EXT_transform_feedback interface - */ - struct gl_transform_feedback_object * - (*NewTransformFeedback)(struct gl_context *ctx, GLuint name); - void (*DeleteTransformFeedback)(struct gl_context *ctx, - struct gl_transform_feedback_object *obj); - void (*BeginTransformFeedback)(struct gl_context *ctx, GLenum mode, - struct gl_transform_feedback_object *obj); - void (*EndTransformFeedback)(struct gl_context *ctx, - struct gl_transform_feedback_object *obj); - void (*PauseTransformFeedback)(struct gl_context *ctx, - struct gl_transform_feedback_object *obj); - void (*ResumeTransformFeedback)(struct gl_context *ctx, - struct gl_transform_feedback_object *obj); - void (*DrawTransformFeedback)(struct gl_context *ctx, GLenum mode, - struct gl_transform_feedback_object *obj); -}; - - -/** - * Transform/Clip/Lighting interface - * - * Drivers present a reduced set of the functions possible in - * glBegin()/glEnd() objects. Core mesa provides translation stubs for the - * remaining functions to map down to these entry points. - * - * These are the initial values to be installed into dispatch by - * mesa. If the T&L driver wants to modify the dispatch table - * while installed, it must do so itself. It would be possible for - * the vertexformat to install its own initial values for these - * functions, but this way there is an obvious list of what is - * expected of the driver. - * - * If the driver wants to hook in entry points other than those - * listed, it must restore them to their original values in - * the disable() callback, below. - */ -typedef struct { - /** - * \name Vertex - */ - /*@{*/ - void (GLAPIENTRYP ArrayElement)( GLint ); - void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP Color3fv)( const GLfloat * ); - void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP Color4fv)( const GLfloat * ); - void (GLAPIENTRYP EdgeFlag)( GLboolean ); - void (GLAPIENTRYP EvalCoord1f)( GLfloat ); - void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); - void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); - void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); - void (GLAPIENTRYP EvalPoint1)( GLint ); - void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); - void (GLAPIENTRYP FogCoordfEXT)( GLfloat ); - void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * ); - void (GLAPIENTRYP Indexf)( GLfloat ); - void (GLAPIENTRYP Indexfv)( const GLfloat * ); - void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); - void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat ); - void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * ); - void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); - void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * ); - void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * ); - void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * ); - void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP Normal3fv)( const GLfloat * ); - void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * ); - void (GLAPIENTRYP TexCoord1f)( GLfloat ); - void (GLAPIENTRYP TexCoord1fv)( const GLfloat * ); - void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat ); - void (GLAPIENTRYP TexCoord2fv)( const GLfloat * ); - void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP TexCoord3fv)( const GLfloat * ); - void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP TexCoord4fv)( const GLfloat * ); - void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat ); - void (GLAPIENTRYP Vertex2fv)( const GLfloat * ); - void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP Vertex3fv)( const GLfloat * ); - void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); - void (GLAPIENTRYP Vertex4fv)( const GLfloat * ); - void (GLAPIENTRYP CallList)( GLuint ); - void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); - void (GLAPIENTRYP Begin)( GLenum ); - void (GLAPIENTRYP End)( void ); - void (GLAPIENTRYP PrimitiveRestartNV)( void ); - /* GL_NV_vertex_program */ - void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x ); - void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v ); - void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ); - void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v ); - void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); - void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); - void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); - void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); - /* GL_ARB_vertex_program */ - void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x ); - void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v ); - void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ); - void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v ); - void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); - void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v ); - void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); - void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v ); - - /* GL_EXT_gpu_shader4 / GL 3.0 */ - void (GLAPIENTRYP VertexAttribI1i)( GLuint index, GLint x); - void (GLAPIENTRYP VertexAttribI2i)( GLuint index, GLint x, GLint y); - void (GLAPIENTRYP VertexAttribI3i)( GLuint index, GLint x, GLint y, GLint z); - void (GLAPIENTRYP VertexAttribI4i)( GLuint index, GLint x, GLint y, GLint z, GLint w); - void (GLAPIENTRYP VertexAttribI2iv)( GLuint index, const GLint *v); - void (GLAPIENTRYP VertexAttribI3iv)( GLuint index, const GLint *v); - void (GLAPIENTRYP VertexAttribI4iv)( GLuint index, const GLint *v); - - void (GLAPIENTRYP VertexAttribI1ui)( GLuint index, GLuint x); - void (GLAPIENTRYP VertexAttribI2ui)( GLuint index, GLuint x, GLuint y); - void (GLAPIENTRYP VertexAttribI3ui)( GLuint index, GLuint x, GLuint y, GLuint z); - void (GLAPIENTRYP VertexAttribI4ui)( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); - void (GLAPIENTRYP VertexAttribI2uiv)( GLuint index, const GLuint *v); - void (GLAPIENTRYP VertexAttribI3uiv)( GLuint index, const GLuint *v); - void (GLAPIENTRYP VertexAttribI4uiv)( GLuint index, const GLuint *v); - - /*@}*/ - - void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); - - /** - * \name Array - */ - /*@{*/ - void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count ); - void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices ); - void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start, - GLuint end, GLsizei count, - GLenum type, const GLvoid *indices ); - void (GLAPIENTRYP MultiDrawElementsEXT)( GLenum mode, const GLsizei *count, - GLenum type, - const GLvoid **indices, - GLsizei primcount); - void (GLAPIENTRYP DrawElementsBaseVertex)( GLenum mode, GLsizei count, - GLenum type, - const GLvoid *indices, - GLint basevertex ); - void (GLAPIENTRYP DrawRangeElementsBaseVertex)( GLenum mode, GLuint start, - GLuint end, GLsizei count, - GLenum type, - const GLvoid *indices, - GLint basevertex); - void (GLAPIENTRYP MultiDrawElementsBaseVertex)( GLenum mode, - const GLsizei *count, - GLenum type, - const GLvoid **indices, - GLsizei primcount, - const GLint *basevertex); - void (GLAPIENTRYP DrawArraysInstanced)(GLenum mode, GLint first, - GLsizei count, GLsizei primcount); - void (GLAPIENTRYP DrawElementsInstanced)(GLenum mode, GLsizei count, - GLenum type, const GLvoid *indices, - GLsizei primcount); - /*@}*/ - - /** - * \name Eval - * - * If you don't support eval, fallback to the default vertex format - * on receiving an eval call and use the pipeline mechanism to - * provide partial T&L acceleration. - * - * Mesa will provide a set of helper functions to do eval within - * accelerated vertex formats, eventually... - */ - /*@{*/ - void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 ); - void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); - /*@}*/ - -} GLvertexformat; - - -#endif /* DD_INCLUDED */ +/** + * \file dd.h + * Device driver interfaces. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 Brian Paul 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 + * BRIAN PAUL 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. + */ + + +#ifndef DD_INCLUDED +#define DD_INCLUDED + +/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ + +#include "glheader.h" + +struct gl_buffer_object; +struct gl_context; +struct gl_display_list; +struct gl_framebuffer; +struct gl_pixelstore_attrib; +struct gl_program; +struct gl_renderbuffer; +struct gl_renderbuffer_attachment; +struct gl_shader; +struct gl_shader_program; +struct gl_texture_image; +struct gl_texture_object; + +/* GL_ARB_vertex_buffer_object */ +/* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return + * NULL) if buffer is unavailable for immediate mapping. + * + * Does GL_MAP_INVALIDATE_RANGE_BIT do this? It seems so, but it + * would require more book-keeping in the driver than seems necessary + * at this point. + * + * Does GL_MAP_INVALDIATE_BUFFER_BIT do this? Not really -- we don't + * want to provoke the driver to throw away the old storage, we will + * respect the contents of already referenced data. + */ +#define MESA_MAP_NOWAIT_BIT 0x0040 + + +/** + * Device driver function table. + * Core Mesa uses these function pointers to call into device drivers. + * Most of these functions directly correspond to OpenGL state commands. + * Core Mesa will call these functions after error checking has been done + * so that the drivers don't have to worry about error testing. + * + * Vertex transformation/clipping/lighting is patched into the T&L module. + * Rasterization functions are patched into the swrast module. + * + * Note: when new functions are added here, the drivers/common/driverfuncs.c + * file should be updated too!!! + */ +struct dd_function_table { + /** + * Return a string as needed by glGetString(). + * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be + * returned. + */ + const GLubyte * (*GetString)( struct gl_context *ctx, GLenum name ); + + /** + * Notify the driver after Mesa has made some internal state changes. + * + * This is in addition to any state change callbacks Mesa may already have + * made. + */ + void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state ); + + /** + * Get the width and height of the named buffer/window. + * + * Mesa uses this to determine when the driver's window size has changed. + * XXX OBSOLETE: this function will be removed in the future. + */ + void (*GetBufferSize)( struct gl_framebuffer *buffer, + GLuint *width, GLuint *height ); + + /** + * Resize the given framebuffer to the given size. + * XXX OBSOLETE: this function will be removed in the future. + */ + void (*ResizeBuffers)( struct gl_context *ctx, struct gl_framebuffer *fb, + GLuint width, GLuint height); + + /** + * Called whenever an error is generated. + * __struct gl_contextRec::ErrorValue contains the error value. + */ + void (*Error)( struct gl_context *ctx ); + + /** + * This is called whenever glFinish() is called. + */ + void (*Finish)( struct gl_context *ctx ); + + /** + * This is called whenever glFlush() is called. + */ + void (*Flush)( struct gl_context *ctx ); + + /** + * Clear the color/depth/stencil/accum buffer(s). + * \param buffers a bitmask of BUFFER_BIT_* flags indicating which + * renderbuffers need to be cleared. + */ + void (*Clear)( struct gl_context *ctx, GLbitfield buffers ); + + /** + * Execute glAccum command. + */ + void (*Accum)( struct gl_context *ctx, GLenum op, GLfloat value ); + + + /** + * Execute glRasterPos, updating the ctx->Current.Raster fields + */ + void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] ); + + /** + * \name Image-related functions + */ + /*@{*/ + + /** + * Called by glDrawPixels(). + * \p unpack describes how to unpack the source image data. + */ + void (*DrawPixels)( struct gl_context *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ); + + /** + * Called by glReadPixels(). + */ + void (*ReadPixels)( struct gl_context *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + GLvoid *dest ); + + /** + * Called by glCopyPixels(). + */ + void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy, + GLsizei width, GLsizei height, + GLint dstx, GLint dsty, GLenum type ); + + /** + * Called by glBitmap(). + */ + void (*Bitmap)( struct gl_context *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + /*@}*/ + + + /** + * \name Texture image functions + */ + /*@{*/ + + /** + * Choose texture format. + * + * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback + * functions. The driver should examine \p internalFormat and return a + * gl_format value. + */ + GLuint (*ChooseTextureFormat)( struct gl_context *ctx, GLint internalFormat, + GLenum srcFormat, GLenum srcType ); + + /** + * Called by glTexImage1D(). + * + * \param target user specified. + * \param format user specified. + * \param type user specified. + * \param pixels user specified. + * \param packing indicates the image packing of pixels. + * \param texObj is the target texture object. + * \param texImage is the target texture image. It will have the texture \p + * width, \p height, \p depth, \p border and \p internalFormat information. + * + * \p retainInternalCopy is returned by this function and indicates whether + * core Mesa should keep an internal copy of the texture image. + * + * Drivers should call a fallback routine from texstore.c if needed. + */ + void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level, + GLint internalFormat, + GLint width, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glTexImage2D(). + * + * \sa dd_function_table::TexImage1D. + */ + void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level, + GLint internalFormat, + GLint width, GLint height, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glTexImage3D(). + * + * \sa dd_function_table::TexImage1D. + */ + void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glTexSubImage1D(). + * + * \param target user specified. + * \param level user specified. + * \param xoffset user specified. + * \param yoffset user specified. + * \param zoffset user specified. + * \param width user specified. + * \param height user specified. + * \param depth user specified. + * \param format user specified. + * \param type user specified. + * \param pixels user specified. + * \param packing indicates the image packing of pixels. + * \param texObj is the target texture object. + * \param texImage is the target texture image. It will have the texture \p + * width, \p height, \p border and \p internalFormat information. + * + * The driver should use a fallback routine from texstore.c if needed. + */ + void (*TexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glTexSubImage2D(). + * + * \sa dd_function_table::TexSubImage1D. + */ + void (*TexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glTexSubImage3D(). + * + * \sa dd_function_table::TexSubImage1D. + */ + void (*TexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glGetTexImage(). + */ + void (*GetTexImage)( struct gl_context *ctx, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glCopyTexImage1D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexImage1D)( struct gl_context *ctx, GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLint border ); + + /** + * Called by glCopyTexImage2D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexImage2D)( struct gl_context *ctx, GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLsizei height, GLint border ); + + /** + * Called by glCopyTexSubImage1D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, + GLint x, GLint y, GLsizei width ); + /** + * Called by glCopyTexSubImage2D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + /** + * Called by glCopyTexSubImage3D(). + * + * Drivers should use a fallback routine from texstore.c if needed. + */ + void (*CopyTexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + /** + * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. + */ + void (*GenerateMipmap)(struct gl_context *ctx, GLenum target, + struct gl_texture_object *texObj); + + /** + * Called by glTexImage[123]D when user specifies a proxy texture + * target. + * + * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails. + */ + GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLint width, GLint height, + GLint depth, GLint border); + /*@}*/ + + + /** + * \name Compressed texture functions + */ + /*@{*/ + + /** + * Called by glCompressedTexImage1D(). + * + * \param target user specified. + * \param format user specified. + * \param type user specified. + * \param pixels user specified. + * \param packing indicates the image packing of pixels. + * \param texObj is the target texture object. + * \param texImage is the target texture image. It will have the texture \p + * width, \p height, \p depth, \p border and \p internalFormat information. + * + * \a retainInternalCopy is returned by this function and indicates whether + * core Mesa should keep an internal copy of the texture image. + */ + void (*CompressedTexImage1D)( struct gl_context *ctx, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /** + * Called by glCompressedTexImage2D(). + * + * \sa dd_function_table::CompressedTexImage1D. + */ + void (*CompressedTexImage2D)( struct gl_context *ctx, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /** + * Called by glCompressedTexImage3D(). + * + * \sa dd_function_table::CompressedTexImage3D. + */ + void (*CompressedTexImage3D)( struct gl_context *ctx, GLenum target, + GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + + /** + * Called by glCompressedTexSubImage1D(). + * + * \param target user specified. + * \param level user specified. + * \param xoffset user specified. + * \param yoffset user specified. + * \param zoffset user specified. + * \param width user specified. + * \param height user specified. + * \param depth user specified. + * \param imageSize user specified. + * \param data user specified. + * \param texObj is the target texture object. + * \param texImage is the target texture image. It will have the texture \p + * width, \p height, \p depth, \p border and \p internalFormat information. + */ + void (*CompressedTexSubImage1D)(struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + /** + * Called by glCompressedTexSubImage2D(). + * + * \sa dd_function_table::CompressedTexImage3D. + */ + void (*CompressedTexSubImage2D)(struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLint height, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + /** + * Called by glCompressedTexSubImage3D(). + * + * \sa dd_function_table::CompressedTexImage3D. + */ + void (*CompressedTexSubImage3D)(struct gl_context *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLint height, GLint depth, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + + + /** + * Called by glGetCompressedTexImage. + */ + void (*GetCompressedTexImage)(struct gl_context *ctx, GLenum target, GLint level, + GLvoid *img, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + + /*@}*/ + + /** + * \name Texture object functions + */ + /*@{*/ + + /** + * Called by glBindTexture(). + */ + void (*BindTexture)( struct gl_context *ctx, GLenum target, + struct gl_texture_object *tObj ); + + /** + * Called to allocate a new texture object. + * A new gl_texture_object should be returned. The driver should + * attach to it any device-specific info it needs. + */ + struct gl_texture_object * (*NewTextureObject)( struct gl_context *ctx, GLuint name, + GLenum target ); + /** + * Called when a texture object is about to be deallocated. + * + * Driver should delete the gl_texture_object object and anything + * hanging off of it. + */ + void (*DeleteTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); + + /** + * Called to allocate a new texture image object. + */ + struct gl_texture_image * (*NewTextureImage)( struct gl_context *ctx ); + + /** + * Called to free tImage->Data. + */ + void (*FreeTexImageData)( struct gl_context *ctx, struct gl_texture_image *tImage ); + + /** Map texture image data into user space */ + void (*MapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); + /** Unmap texture images from user space */ + void (*UnmapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); + + /** + * Note: no context argument. This function doesn't initially look + * like it belongs here, except that the driver is the only entity + * that knows for sure how the texture memory is allocated - via + * the above callbacks. There is then an argument that the driver + * knows what memcpy paths might be fast. Typically this is invoked with + * + * to -- a pointer into texture memory allocated by NewTextureImage() above. + * from -- a pointer into client memory or a mesa temporary. + * sz -- nr bytes to copy. + */ + void* (*TextureMemCpy)( void *to, const void *from, size_t sz ); + + /** + * Called by glAreTextureResident(). + */ + GLboolean (*IsTextureResident)( struct gl_context *ctx, + struct gl_texture_object *t ); + + /** + * Called when the texture's color lookup table is changed. + * + * If \p tObj is NULL then the shared texture palette + * gl_texture_object::Palette is to be updated. + */ + void (*UpdateTexturePalette)( struct gl_context *ctx, + struct gl_texture_object *tObj ); + /*@}*/ + + + /** + * \name Imaging functionality + */ + /*@{*/ + void (*CopyColorTable)( struct gl_context *ctx, + GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + + void (*CopyColorSubTable)( struct gl_context *ctx, + GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + /*@}*/ + + + /** + * \name Vertex/fragment program functions + */ + /*@{*/ + /** Bind a vertex/fragment program */ + void (*BindProgram)(struct gl_context *ctx, GLenum target, struct gl_program *prog); + /** Allocate a new program */ + struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target, GLuint id); + /** Delete a program */ + void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog); + /** + * Notify driver that a program string (and GPU code) has been specified + * or modified. Return GL_TRUE or GL_FALSE to indicate if the program is + * supported by the driver. + */ + GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target, + struct gl_program *prog); + + /** Query if program can be loaded onto hardware */ + GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target, + struct gl_program *prog); + + /*@}*/ + + /** + * \name GLSL shader/program functions. + */ + /*@{*/ + /** + * Called when a shader is compiled. + * + * Note that not all shader objects get ShaderCompile called on + * them. Notably, the shaders containing builtin functions do not + * have CompileShader() called, so if lowering passes are done they + * need to also be performed in LinkShader(). + */ + GLboolean (*CompileShader)(struct gl_context *ctx, struct gl_shader *shader); + /** + * Called when a shader program is linked. + * + * This gives drivers an opportunity to clone the IR and make their + * own transformations on it for the purposes of code generation. + */ + GLboolean (*LinkShader)(struct gl_context *ctx, struct gl_shader_program *shader); + /*@}*/ + + /** + * \name State-changing functions. + * + * \note drawing functions are above. + * + * These functions are called by their corresponding OpenGL API functions. + * They are \e also called by the gl_PopAttrib() function!!! + * May add more functions like these to the device driver in the future. + */ + /*@{*/ + /** Specify the alpha test function */ + void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref); + /** Set the blend color */ + void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]); + /** Set the blend equation */ + void (*BlendEquationSeparate)(struct gl_context *ctx, GLenum modeRGB, GLenum modeA); + void (*BlendEquationSeparatei)(struct gl_context *ctx, GLuint buffer, + GLenum modeRGB, GLenum modeA); + /** Specify pixel arithmetic */ + void (*BlendFuncSeparate)(struct gl_context *ctx, + GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA); + void (*BlendFuncSeparatei)(struct gl_context *ctx, GLuint buffer, + GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA); + /** Specify clear values for the color buffers */ + void (*ClearColor)(struct gl_context *ctx, const GLfloat color[4]); + /** Specify the clear value for the depth buffer */ + void (*ClearDepth)(struct gl_context *ctx, GLclampd d); + /** Specify the clear value for the stencil buffer */ + void (*ClearStencil)(struct gl_context *ctx, GLint s); + /** Specify a plane against which all geometry is clipped */ + void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *equation ); + /** Enable and disable writing of frame buffer color components */ + void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask, + GLboolean bmask, GLboolean amask ); + void (*ColorMaskIndexed)(struct gl_context *ctx, GLuint buf, GLboolean rmask, + GLboolean gmask, GLboolean bmask, GLboolean amask); + /** Cause a material color to track the current color */ + void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode); + /** Specify whether front- or back-facing facets can be culled */ + void (*CullFace)(struct gl_context *ctx, GLenum mode); + /** Define front- and back-facing polygons */ + void (*FrontFace)(struct gl_context *ctx, GLenum mode); + /** Specify the value used for depth buffer comparisons */ + void (*DepthFunc)(struct gl_context *ctx, GLenum func); + /** Enable or disable writing into the depth buffer */ + void (*DepthMask)(struct gl_context *ctx, GLboolean flag); + /** Specify mapping of depth values from NDC to window coordinates */ + void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval); + /** Specify the current buffer for writing */ + void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer ); + /** Specify the buffers for writing for fragment programs*/ + void (*DrawBuffers)( struct gl_context *ctx, GLsizei n, const GLenum *buffers ); + /** Enable or disable server-side gl capabilities */ + void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state); + /** Specify fog parameters */ + void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params); + /** Specify implementation-specific hints */ + void (*Hint)(struct gl_context *ctx, GLenum target, GLenum mode); + /** Set light source parameters. + * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already + * been transformed to eye-space. + */ + void (*Lightfv)(struct gl_context *ctx, GLenum light, + GLenum pname, const GLfloat *params ); + /** Set the lighting model parameters */ + void (*LightModelfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params); + /** Specify the line stipple pattern */ + void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern ); + /** Specify the width of rasterized lines */ + void (*LineWidth)(struct gl_context *ctx, GLfloat width); + /** Specify a logical pixel operation for color index rendering */ + void (*LogicOpcode)(struct gl_context *ctx, GLenum opcode); + void (*PointParameterfv)(struct gl_context *ctx, GLenum pname, + const GLfloat *params); + /** Specify the diameter of rasterized points */ + void (*PointSize)(struct gl_context *ctx, GLfloat size); + /** Select a polygon rasterization mode */ + void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode); + /** Set the scale and units used to calculate depth values */ + void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units); + /** Set the polygon stippling pattern */ + void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask ); + /* Specifies the current buffer for reading */ + void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer ); + /** Set rasterization mode */ + void (*RenderMode)(struct gl_context *ctx, GLenum mode ); + /** Define the scissor box */ + void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + /** Select flat or smooth shading */ + void (*ShadeModel)(struct gl_context *ctx, GLenum mode); + /** OpenGL 2.0 two-sided StencilFunc */ + void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func, + GLint ref, GLuint mask); + /** OpenGL 2.0 two-sided StencilMask */ + void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask); + /** OpenGL 2.0 two-sided StencilOp */ + void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail, + GLenum zfail, GLenum zpass); + /** Control the generation of texture coordinates */ + void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname, + const GLfloat *params); + /** Set texture environment parameters */ + void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname, + const GLfloat *param); + /** Set texture parameters */ + void (*TexParameter)(struct gl_context *ctx, GLenum target, + struct gl_texture_object *texObj, + GLenum pname, const GLfloat *params); + /** Set the viewport */ + void (*Viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + /*@}*/ + + + /** + * \name Vertex/pixel buffer object functions + */ + /*@{*/ + void (*BindBuffer)( struct gl_context *ctx, GLenum target, + struct gl_buffer_object *obj ); + + struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, GLuint buffer, + GLenum target ); + + void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj ); + + GLboolean (*BufferData)( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, + const GLvoid *data, GLenum usage, + struct gl_buffer_object *obj ); + + void (*BufferSubData)( struct gl_context *ctx, GLenum target, GLintptrARB offset, + GLsizeiptrARB size, const GLvoid *data, + struct gl_buffer_object *obj ); + + void (*GetBufferSubData)( struct gl_context *ctx, GLenum target, + GLintptrARB offset, GLsizeiptrARB size, + GLvoid *data, struct gl_buffer_object *obj ); + + void * (*MapBuffer)( struct gl_context *ctx, GLenum target, GLenum access, + struct gl_buffer_object *obj ); + + void (*CopyBufferSubData)( struct gl_context *ctx, + struct gl_buffer_object *src, + struct gl_buffer_object *dst, + GLintptr readOffset, GLintptr writeOffset, + GLsizeiptr size ); + + /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access: + */ + void * (*MapBufferRange)( struct gl_context *ctx, GLenum target, GLintptr offset, + GLsizeiptr length, GLbitfield access, + struct gl_buffer_object *obj); + + void (*FlushMappedBufferRange)(struct gl_context *ctx, GLenum target, + GLintptr offset, GLsizeiptr length, + struct gl_buffer_object *obj); + + GLboolean (*UnmapBuffer)( struct gl_context *ctx, GLenum target, + struct gl_buffer_object *obj ); + /*@}*/ + + /** + * \name Functions for GL_APPLE_object_purgeable + */ + /*@{*/ + /* variations on ObjectPurgeable */ + GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); + GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); + GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); + + /* variations on ObjectUnpurgeable */ + GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); + GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); + GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); + /*@}*/ + + /** + * \name Functions for GL_EXT_framebuffer_{object,blit}. + */ + /*@{*/ + struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx, GLuint name); + struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx, GLuint name); + void (*BindFramebuffer)(struct gl_context *ctx, GLenum target, + struct gl_framebuffer *drawFb, + struct gl_framebuffer *readFb); + void (*FramebufferRenderbuffer)(struct gl_context *ctx, + struct gl_framebuffer *fb, + GLenum attachment, + struct gl_renderbuffer *rb); + void (*RenderTexture)(struct gl_context *ctx, + struct gl_framebuffer *fb, + struct gl_renderbuffer_attachment *att); + void (*FinishRenderTexture)(struct gl_context *ctx, + struct gl_renderbuffer_attachment *att); + void (*ValidateFramebuffer)(struct gl_context *ctx, + struct gl_framebuffer *fb); + /*@}*/ + void (*BlitFramebuffer)(struct gl_context *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + + /** + * \name Query objects + */ + /*@{*/ + struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id); + void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q); + /*@}*/ + + + /** + * \name Vertex Array objects + */ + /*@{*/ + struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id); + void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); + void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); + /*@}*/ + + /** + * \name GLSL-related functions (ARB extensions and OpenGL 2.x) + */ + /*@{*/ + struct gl_shader *(*NewShader)(struct gl_context *ctx, GLuint name, GLenum type); + void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader); + struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx, GLuint name); + void (*DeleteShaderProgram)(struct gl_context *ctx, + struct gl_shader_program *shProg); + void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg); + /*@}*/ + + + /** + * \name Support for multiple T&L engines + */ + /*@{*/ + + /** + * Bitmask of state changes that require the current T&L module to be + * validated, using ValidateTnlModule() below. + */ + GLuint NeedValidate; + + /** + * Validate the current T&L module. + * + * This is called directly after UpdateState() when a state change that has + * occurred matches the dd_function_table::NeedValidate bitmask above. This + * ensures all computed values are up to date, thus allowing the driver to + * decide if the current T&L module needs to be swapped out. + * + * This must be non-NULL if a driver installs a custom T&L module and sets + * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise. + */ + void (*ValidateTnlModule)( struct gl_context *ctx, GLuint new_state ); + + /** + * Set by the driver-supplied T&L engine. + * + * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd(). + */ + GLuint CurrentExecPrimitive; + + /** + * Current state of an in-progress compilation. + * + * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END, + * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above. + */ + GLuint CurrentSavePrimitive; + + +#define FLUSH_STORED_VERTICES 0x1 +#define FLUSH_UPDATE_CURRENT 0x2 + /** + * Set by the driver-supplied T&L engine whenever vertices are buffered + * between glBegin()/glEnd() objects or __struct gl_contextRec::Current is not + * updated. + * + * The dd_function_table::FlushVertices call below may be used to resolve + * these conditions. + */ + GLuint NeedFlush; + GLuint SaveNeedFlush; + + + /* Called prior to any of the GLvertexformat functions being + * called. Paired with Driver.FlushVertices(). + */ + void (*BeginVertices)( struct gl_context *ctx ); + + /** + * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if + * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered + * vertices, if FLUSH_UPDATE_CURRENT bit is set updates + * __struct gl_contextRec::Current and gl_light_attrib::Material + * + * Note that the default T&L engine never clears the + * FLUSH_UPDATE_CURRENT bit, even after performing the update. + */ + void (*FlushVertices)( struct gl_context *ctx, GLuint flags ); + void (*SaveFlushVertices)( struct gl_context *ctx ); + + /** + * Give the driver the opportunity to hook in its own vtxfmt for + * compiling optimized display lists. This is called on each valid + * glBegin() during list compilation. + */ + GLboolean (*NotifySaveBegin)( struct gl_context *ctx, GLenum mode ); + + /** + * Notify driver that the special derived value _NeedEyeCoords has + * changed. + */ + void (*LightingSpaceChange)( struct gl_context *ctx ); + + /** + * Called by glNewList(). + * + * Let the T&L component know what is going on with display lists + * in time to make changes to dispatch tables, etc. + */ + void (*NewList)( struct gl_context *ctx, GLuint list, GLenum mode ); + /** + * Called by glEndList(). + * + * \sa dd_function_table::NewList. + */ + void (*EndList)( struct gl_context *ctx ); + + /** + * Called by glCallList(s). + * + * Notify the T&L component before and after calling a display list. + */ + void (*BeginCallList)( struct gl_context *ctx, + struct gl_display_list *dlist ); + /** + * Called by glEndCallList(). + * + * \sa dd_function_table::BeginCallList. + */ + void (*EndCallList)( struct gl_context *ctx ); + + + /** + * \name GL_ARB_sync interfaces + */ + /*@{*/ + struct gl_sync_object * (*NewSyncObject)(struct gl_context *, GLenum); + void (*FenceSync)(struct gl_context *, struct gl_sync_object *, GLenum, GLbitfield); + void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *); + void (*CheckSync)(struct gl_context *, struct gl_sync_object *); + void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *, + GLbitfield, GLuint64); + void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *, + GLbitfield, GLuint64); + /*@}*/ + + /** GL_NV_conditional_render */ + void (*BeginConditionalRender)(struct gl_context *ctx, struct gl_query_object *q, + GLenum mode); + void (*EndConditionalRender)(struct gl_context *ctx, struct gl_query_object *q); + + /** + * \name GL_OES_draw_texture interface + */ + /*@{*/ + void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, + GLfloat width, GLfloat height); + /*@}*/ + + /** + * \name GL_OES_EGL_image interface + */ + void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLeglImageOES image_handle); + void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx, + struct gl_renderbuffer *rb, + void *image_handle); + + /** + * \name GL_EXT_transform_feedback interface + */ + struct gl_transform_feedback_object * + (*NewTransformFeedback)(struct gl_context *ctx, GLuint name); + void (*DeleteTransformFeedback)(struct gl_context *ctx, + struct gl_transform_feedback_object *obj); + void (*BeginTransformFeedback)(struct gl_context *ctx, GLenum mode, + struct gl_transform_feedback_object *obj); + void (*EndTransformFeedback)(struct gl_context *ctx, + struct gl_transform_feedback_object *obj); + void (*PauseTransformFeedback)(struct gl_context *ctx, + struct gl_transform_feedback_object *obj); + void (*ResumeTransformFeedback)(struct gl_context *ctx, + struct gl_transform_feedback_object *obj); + void (*DrawTransformFeedback)(struct gl_context *ctx, GLenum mode, + struct gl_transform_feedback_object *obj); +}; + + +/** + * Transform/Clip/Lighting interface + * + * Drivers present a reduced set of the functions possible in + * glBegin()/glEnd() objects. Core mesa provides translation stubs for the + * remaining functions to map down to these entry points. + * + * These are the initial values to be installed into dispatch by + * mesa. If the T&L driver wants to modify the dispatch table + * while installed, it must do so itself. It would be possible for + * the vertexformat to install its own initial values for these + * functions, but this way there is an obvious list of what is + * expected of the driver. + * + * If the driver wants to hook in entry points other than those + * listed, it must restore them to their original values in + * the disable() callback, below. + */ +typedef struct { + /** + * \name Vertex + */ + /*@{*/ + void (GLAPIENTRYP ArrayElement)( GLint ); + void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Color3fv)( const GLfloat * ); + void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Color4fv)( const GLfloat * ); + void (GLAPIENTRYP EdgeFlag)( GLboolean ); + void (GLAPIENTRYP EvalCoord1f)( GLfloat ); + void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); + void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); + void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); + void (GLAPIENTRYP EvalPoint1)( GLint ); + void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); + void (GLAPIENTRYP FogCoordfEXT)( GLfloat ); + void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * ); + void (GLAPIENTRYP Indexf)( GLfloat ); + void (GLAPIENTRYP Indexfv)( const GLfloat * ); + void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat ); + void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * ); + void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Normal3fv)( const GLfloat * ); + void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * ); + void (GLAPIENTRYP TexCoord1f)( GLfloat ); + void (GLAPIENTRYP TexCoord1fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord2fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord3fv)( const GLfloat * ); + void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP TexCoord4fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex2fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex3fv)( const GLfloat * ); + void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); + void (GLAPIENTRYP Vertex4fv)( const GLfloat * ); + void (GLAPIENTRYP CallList)( GLuint ); + void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); + void (GLAPIENTRYP Begin)( GLenum ); + void (GLAPIENTRYP End)( void ); + void (GLAPIENTRYP PrimitiveRestartNV)( void ); + /* GL_NV_vertex_program */ + void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x ); + void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ); + void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); + void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); + void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); + /* GL_ARB_vertex_program */ + void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x ); + void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ); + void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); + void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v ); + void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); + void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v ); + + /* GL_EXT_gpu_shader4 / GL 3.0 */ + void (GLAPIENTRYP VertexAttribI1i)( GLuint index, GLint x); + void (GLAPIENTRYP VertexAttribI2i)( GLuint index, GLint x, GLint y); + void (GLAPIENTRYP VertexAttribI3i)( GLuint index, GLint x, GLint y, GLint z); + void (GLAPIENTRYP VertexAttribI4i)( GLuint index, GLint x, GLint y, GLint z, GLint w); + void (GLAPIENTRYP VertexAttribI2iv)( GLuint index, const GLint *v); + void (GLAPIENTRYP VertexAttribI3iv)( GLuint index, const GLint *v); + void (GLAPIENTRYP VertexAttribI4iv)( GLuint index, const GLint *v); + + void (GLAPIENTRYP VertexAttribI1ui)( GLuint index, GLuint x); + void (GLAPIENTRYP VertexAttribI2ui)( GLuint index, GLuint x, GLuint y); + void (GLAPIENTRYP VertexAttribI3ui)( GLuint index, GLuint x, GLuint y, GLuint z); + void (GLAPIENTRYP VertexAttribI4ui)( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); + void (GLAPIENTRYP VertexAttribI2uiv)( GLuint index, const GLuint *v); + void (GLAPIENTRYP VertexAttribI3uiv)( GLuint index, const GLuint *v); + void (GLAPIENTRYP VertexAttribI4uiv)( GLuint index, const GLuint *v); + + /*@}*/ + + void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); + + /** + * \name Array + */ + /*@{*/ + void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count ); + void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices ); + void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start, + GLuint end, GLsizei count, + GLenum type, const GLvoid *indices ); + void (GLAPIENTRYP MultiDrawElementsEXT)( GLenum mode, const GLsizei *count, + GLenum type, + const GLvoid **indices, + GLsizei primcount); + void (GLAPIENTRYP DrawElementsBaseVertex)( GLenum mode, GLsizei count, + GLenum type, + const GLvoid *indices, + GLint basevertex ); + void (GLAPIENTRYP DrawRangeElementsBaseVertex)( GLenum mode, GLuint start, + GLuint end, GLsizei count, + GLenum type, + const GLvoid *indices, + GLint basevertex); + void (GLAPIENTRYP MultiDrawElementsBaseVertex)( GLenum mode, + const GLsizei *count, + GLenum type, + const GLvoid **indices, + GLsizei primcount, + const GLint *basevertex); + void (GLAPIENTRYP DrawArraysInstanced)(GLenum mode, GLint first, + GLsizei count, GLsizei primcount); + void (GLAPIENTRYP DrawElementsInstanced)(GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices, + GLsizei primcount); + /*@}*/ + + /** + * \name Eval + * + * If you don't support eval, fallback to the default vertex format + * on receiving an eval call and use the pipeline mechanism to + * provide partial T&L acceleration. + * + * Mesa will provide a set of helper functions to do eval within + * accelerated vertex formats, eventually... + */ + /*@{*/ + void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 ); + void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + /*@}*/ + +} GLvertexformat; + + +#endif /* DD_INCLUDED */ diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c index f0752d1a3..a6a909b48 100644 --- a/mesalib/src/mesa/main/debug.c +++ b/mesalib/src/mesa/main/debug.c @@ -1,633 +1,613 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * 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 - * BRIAN PAUL 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. - */ - -#include "mtypes.h" -#include "attrib.h" -#include "colormac.h" -#include "enums.h" -#include "formats.h" -#include "hash.h" -#include "imports.h" -#include "debug.h" -#include "get.h" -#include "pixelstore.h" -#include "readpix.h" -#include "texobj.h" - - -/** - * Primitive names - */ -const char *_mesa_prim_name[GL_POLYGON+4] = { - "GL_POINTS", - "GL_LINES", - "GL_LINE_LOOP", - "GL_LINE_STRIP", - "GL_TRIANGLES", - "GL_TRIANGLE_STRIP", - "GL_TRIANGLE_FAN", - "GL_QUADS", - "GL_QUAD_STRIP", - "GL_POLYGON", - "outside begin/end", - "inside unknown primitive", - "unknown state" -}; - - -static const char * -tex_target_name(GLenum tgt) -{ - static const struct { - GLenum target; - const char *name; - } tex_targets[] = { - { GL_TEXTURE_1D, "GL_TEXTURE_1D" }, - { GL_TEXTURE_2D, "GL_TEXTURE_2D" }, - { GL_TEXTURE_3D, "GL_TEXTURE_3D" }, - { GL_TEXTURE_CUBE_MAP, "GL_TEXTURE_CUBE_MAP" }, - { GL_TEXTURE_RECTANGLE, "GL_TEXTURE_RECTANGLE" }, - { GL_TEXTURE_1D_ARRAY_EXT, "GL_TEXTURE_1D_ARRAY" }, - { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" } - }; - GLuint i; - for (i = 0; i < Elements(tex_targets); i++) { - if (tex_targets[i].target == tgt) - return tex_targets[i].name; - } - return "UNKNOWN TEX TARGET"; -} - - -void -_mesa_print_state( const char *msg, GLuint state ) -{ - _mesa_debug(NULL, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", - msg, - state, - (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", - (state & _NEW_PROJECTION) ? "ctx->Projection, " : "", - (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", - (state & _NEW_ACCUM) ? "ctx->Accum, " : "", - (state & _NEW_COLOR) ? "ctx->Color, " : "", - (state & _NEW_DEPTH) ? "ctx->Depth, " : "", - (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "", - (state & _NEW_FOG) ? "ctx->Fog, " : "", - (state & _NEW_HINT) ? "ctx->Hint, " : "", - (state & _NEW_LIGHT) ? "ctx->Light, " : "", - (state & _NEW_LINE) ? "ctx->Line, " : "", - (state & _NEW_PIXEL) ? "ctx->Pixel, " : "", - (state & _NEW_POINT) ? "ctx->Point, " : "", - (state & _NEW_POLYGON) ? "ctx->Polygon, " : "", - (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "", - (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "", - (state & _NEW_STENCIL) ? "ctx->Stencil, " : "", - (state & _NEW_TEXTURE) ? "ctx->Texture, " : "", - (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", - (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", - (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "", - (state & _NEW_ARRAY) ? "ctx->Array, " : "", - (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", - (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); -} - - - -void -_mesa_print_tri_caps( const char *name, GLuint flags ) -{ - _mesa_debug(NULL, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s\n", - name, - flags, - (flags & DD_FLATSHADE) ? "flat-shade, " : "", - (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "", - (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", - (flags & DD_TRI_TWOSTENCIL) ? "tri-twostencil, " : "", - (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", - (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", - (flags & DD_TRI_OFFSET) ? "tri-offset, " : "", - (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "", - (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", - (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", - (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", - (flags & DD_POINT_ATTEN) ? "point-atten, " : "", - (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "" - ); -} - - -/** - * Print information about this Mesa version and build options. - */ -void _mesa_print_info( void ) -{ - _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", - (char *) _mesa_GetString(GL_VERSION)); - _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", - (char *) _mesa_GetString(GL_RENDERER)); - _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", - (char *) _mesa_GetString(GL_VENDOR)); - _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", - (char *) _mesa_GetString(GL_EXTENSIONS)); -#if defined(THREADS) - _mesa_debug(NULL, "Mesa thread-safe: YES\n"); -#else - _mesa_debug(NULL, "Mesa thread-safe: NO\n"); -#endif -#if defined(USE_X86_ASM) - _mesa_debug(NULL, "Mesa x86-optimized: YES\n"); -#else - _mesa_debug(NULL, "Mesa x86-optimized: NO\n"); -#endif -#if defined(USE_SPARC_ASM) - _mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); -#else - _mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); -#endif -} - - -/** - * Set the debugging flags. - * - * \param debug debug string - * - * If compiled with debugging support then search for keywords in \p debug and - * enables the verbose debug output of the respective feature. - */ -static void add_debug_flags( const char *debug ) -{ -#ifdef DEBUG - struct debug_option { - const char *name; - GLbitfield flag; - }; - static const struct debug_option debug_opt[] = { - { "varray", VERBOSE_VARRAY }, - { "tex", VERBOSE_TEXTURE }, - { "mat", VERBOSE_MATERIAL }, - { "pipe", VERBOSE_PIPELINE }, - { "driver", VERBOSE_DRIVER }, - { "state", VERBOSE_STATE }, - { "api", VERBOSE_API }, - { "list", VERBOSE_DISPLAY_LIST }, - { "lighting", VERBOSE_LIGHTING }, - { "disassem", VERBOSE_DISASSEM }, - { "draw", VERBOSE_DRAW }, - { "swap", VERBOSE_SWAPBUFFERS } - }; - GLuint i; - - MESA_VERBOSE = 0x0; - for (i = 0; i < Elements(debug_opt); i++) { - if (strstr(debug, debug_opt[i].name)) - MESA_VERBOSE |= debug_opt[i].flag; - } - - /* Debug flag: - */ - if (strstr(debug, "flush")) - MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; - -#if defined(_FPU_GETCW) && defined(_FPU_SETCW) - if (strstr(debug, "fpexceptions")) { - /* raise FP exceptions */ - fpu_control_t mask; - _FPU_GETCW(mask); - mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM - | _FPU_MASK_OM | _FPU_MASK_UM); - _FPU_SETCW(mask); - } -#endif - -#else - (void) debug; -#endif -} - - -void -_mesa_init_debug( struct gl_context *ctx ) -{ - char *c; - - /* Dither disable */ - ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; - if (ctx->NoDither) { - if (_mesa_getenv("MESA_DEBUG")) { - _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); - } - ctx->Color.DitherFlag = GL_FALSE; - } - - c = _mesa_getenv("MESA_DEBUG"); - if (c) - add_debug_flags(c); - - c = _mesa_getenv("MESA_VERBOSE"); - if (c) - add_debug_flags(c); -} - - -/* - * Write ppm file - */ -static void -write_ppm(const char *filename, const GLubyte *buffer, int width, int height, - int comps, int rcomp, int gcomp, int bcomp, GLboolean invert) -{ - FILE *f = fopen( filename, "w" ); - if (f) { - int x, y; - const GLubyte *ptr = buffer; - fprintf(f,"P6\n"); - fprintf(f,"# ppm-file created by osdemo.c\n"); - fprintf(f,"%i %i\n", width,height); - fprintf(f,"255\n"); - fclose(f); - f = fopen( filename, "ab" ); /* reopen in binary append mode */ - for (y=0; y < height; y++) { - for (x = 0; x < width; x++) { - int yy = invert ? (height - 1 - y) : y; - int i = (yy * width + x) * comps; - fputc(ptr[i+rcomp], f); /* write red */ - fputc(ptr[i+gcomp], f); /* write green */ - fputc(ptr[i+bcomp], f); /* write blue */ - } - } - fclose(f); - } -} - - -/** - * Write a texture image to a ppm file. - * \param face cube face in [0,5] - * \param level mipmap level - */ -static void -write_texture_image(struct gl_texture_object *texObj, - GLuint face, GLuint level) -{ - struct gl_texture_image *img = texObj->Image[face][level]; - if (img) { - GET_CURRENT_CONTEXT(ctx); - struct gl_pixelstore_attrib store; - GLubyte *buffer; - char s[100]; - - buffer = (GLubyte *) malloc(img->Width * img->Height - * img->Depth * 4); - - store = ctx->Pack; /* save */ - ctx->Pack = ctx->DefaultPacking; - - ctx->Driver.GetTexImage(ctx, texObj->Target, level, - GL_RGBA, GL_UNSIGNED_BYTE, - buffer, texObj, img); - - /* make filename */ - _mesa_snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); - - printf(" Writing image level %u to %s\n", level, s); - write_ppm(s, buffer, img->Width, img->Height, 4, 0, 1, 2, GL_FALSE); - - ctx->Pack = store; /* restore */ - - free(buffer); - } -} - - -/** - * Write renderbuffer image to a ppm file. - */ -static void -write_renderbuffer_image(const struct gl_renderbuffer *rb) -{ - GET_CURRENT_CONTEXT(ctx); - GLubyte *buffer; - char s[100]; - GLenum format, type; - - if (rb->_BaseFormat == GL_RGB || - rb->_BaseFormat == GL_RGBA) { - format = GL_RGBA; - type = GL_UNSIGNED_BYTE; - } - else if (rb->_BaseFormat == GL_DEPTH_STENCIL) { - format = GL_DEPTH_STENCIL; - type = GL_UNSIGNED_INT_24_8; - } - else { - return; - } - - buffer = (GLubyte *) malloc(rb->Width * rb->Height * 4); - - ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height, - format, type, &ctx->DefaultPacking, buffer); - - /* make filename */ - _mesa_snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name); - - printf(" Writing renderbuffer image to %s\n", s); - write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE); - - free(buffer); -} - - -/** How many texture images (mipmap levels, faces) to write to files */ -#define WRITE_NONE 0 -#define WRITE_ONE 1 -#define WRITE_ALL 2 - -static GLuint WriteImages; - - -static void -dump_texture(struct gl_texture_object *texObj, GLuint writeImages) -{ - const GLuint numFaces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1; - GLboolean written = GL_FALSE; - GLuint i, j; - - printf("Texture %u\n", texObj->Name); - printf(" Target %s\n", tex_target_name(texObj->Target)); - for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { - for (j = 0; j < numFaces; j++) { - struct gl_texture_image *texImg = texObj->Image[j][i]; - if (texImg) { - printf(" Face %u level %u: %d x %d x %d, format %s at %p\n", - j, i, - texImg->Width, texImg->Height, texImg->Depth, - _mesa_get_format_name(texImg->TexFormat), - texImg->Data); - if (writeImages == WRITE_ALL || - (writeImages == WRITE_ONE && !written)) { - write_texture_image(texObj, j, i); - written = GL_TRUE; - } - } - } - } -} - - -/** - * Dump a single texture. - */ -void -_mesa_dump_texture(GLuint texture, GLuint writeImages) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture); - if (texObj) { - dump_texture(texObj, writeImages); - } -} - - -static void -dump_texture_cb(GLuint id, void *data, void *userData) -{ - struct gl_texture_object *texObj = (struct gl_texture_object *) data; - (void) userData; - dump_texture(texObj, WriteImages); -} - - -/** - * Print basic info about all texture objext to stdout. - * If dumpImages is true, write PPM of level[0] image to a file. - */ -void -_mesa_dump_textures(GLuint writeImages) -{ - GET_CURRENT_CONTEXT(ctx); - WriteImages = writeImages; - _mesa_HashWalk(ctx->Shared->TexObjects, dump_texture_cb, ctx); -} - - -static void -dump_renderbuffer(const struct gl_renderbuffer *rb, GLboolean writeImage) -{ - printf("Renderbuffer %u: %u x %u IntFormat = %s\n", - rb->Name, rb->Width, rb->Height, - _mesa_lookup_enum_by_nr(rb->InternalFormat)); - if (writeImage) { - write_renderbuffer_image(rb); - } -} - - -static void -dump_renderbuffer_cb(GLuint id, void *data, void *userData) -{ - const struct gl_renderbuffer *rb = (const struct gl_renderbuffer *) data; - (void) userData; - dump_renderbuffer(rb, WriteImages); -} - - -/** - * Print basic info about all renderbuffers to stdout. - * If dumpImages is true, write PPM of level[0] image to a file. - */ -void -_mesa_dump_renderbuffers(GLboolean writeImages) -{ - GET_CURRENT_CONTEXT(ctx); - WriteImages = writeImages; - _mesa_HashWalk(ctx->Shared->RenderBuffers, dump_renderbuffer_cb, ctx); -} - - - -void -_mesa_dump_color_buffer(const char *filename) -{ - GET_CURRENT_CONTEXT(ctx); - const GLuint w = ctx->DrawBuffer->Width; - const GLuint h = ctx->DrawBuffer->Height; - GLubyte *buf; - - buf = (GLubyte *) malloc(w * h * 4); - - _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); - _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); - _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); - - _mesa_ReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); - - printf("ReadBuffer %p 0x%x DrawBuffer %p 0x%x\n", - (void *) ctx->ReadBuffer->_ColorReadBuffer, - ctx->ReadBuffer->ColorReadBuffer, - (void *) ctx->DrawBuffer->_ColorDrawBuffers[0], - ctx->DrawBuffer->ColorDrawBuffer[0]); - printf("Writing %d x %d color buffer to %s\n", w, h, filename); - write_ppm(filename, buf, w, h, 4, 0, 1, 2, GL_TRUE); - - _mesa_PopClientAttrib(); - - free(buf); -} - - -void -_mesa_dump_depth_buffer(const char *filename) -{ - GET_CURRENT_CONTEXT(ctx); - const GLuint w = ctx->DrawBuffer->Width; - const GLuint h = ctx->DrawBuffer->Height; - GLuint *buf; - GLubyte *buf2; - GLuint i; - - buf = (GLuint *) malloc(w * h * 4); /* 4 bpp */ - buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */ - - _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); - _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); - _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); - - _mesa_ReadPixels(0, 0, w, h, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buf); - - /* spread 24 bits of Z across R, G, B */ - for (i = 0; i < w * h; i++) { - buf2[i*3+0] = (buf[i] >> 24) & 0xff; - buf2[i*3+1] = (buf[i] >> 16) & 0xff; - buf2[i*3+2] = (buf[i] >> 8) & 0xff; - } - - printf("Writing %d x %d depth buffer to %s\n", w, h, filename); - write_ppm(filename, buf2, w, h, 3, 0, 1, 2, GL_TRUE); - - _mesa_PopClientAttrib(); - - free(buf); - free(buf2); -} - - -void -_mesa_dump_stencil_buffer(const char *filename) -{ - GET_CURRENT_CONTEXT(ctx); - const GLuint w = ctx->DrawBuffer->Width; - const GLuint h = ctx->DrawBuffer->Height; - GLubyte *buf; - GLubyte *buf2; - GLuint i; - - buf = (GLubyte *) malloc(w * h); /* 1 bpp */ - buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */ - - _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); - _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); - _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); - - _mesa_ReadPixels(0, 0, w, h, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, buf); - - for (i = 0; i < w * h; i++) { - buf2[i*3+0] = buf[i]; - buf2[i*3+1] = (buf[i] & 127) * 2; - buf2[i*3+2] = (buf[i] - 128) * 2; - } - - printf("Writing %d x %d stencil buffer to %s\n", w, h, filename); - write_ppm(filename, buf2, w, h, 3, 0, 1, 2, GL_TRUE); - - _mesa_PopClientAttrib(); - - free(buf); - free(buf2); -} - - -/** - * Quick and dirty function to "print" a texture to stdout. - */ -void -_mesa_print_texture(struct gl_context *ctx, const struct gl_texture_image *img) -{ -#if CHAN_TYPE != GL_UNSIGNED_BYTE - _mesa_problem(NULL, "PrintTexture not supported"); -#else - GLuint i, j, c; - const GLubyte *data = (const GLubyte *) img->Data; - - if (!data) { - printf("No texture data\n"); - return; - } - - /* XXX add more formats or make into a new format utility function */ - switch (img->TexFormat) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_CI8: - c = 1; - break; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - c = 2; - break; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: - c = 3; - break; - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_ARGB8888: - c = 4; - break; - default: - _mesa_problem(NULL, "error in PrintTexture\n"); - return; - } - - for (i = 0; i < img->Height; i++) { - for (j = 0; j < img->Width; j++) { - if (c==1) - printf("%02x ", data[0]); - else if (c==2) - printf("%02x%02x ", data[0], data[1]); - else if (c==3) - printf("%02x%02x%02x ", data[0], data[1], data[2]); - else if (c==4) - printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); - data += (img->RowStride - img->Width) * c; - } - /* XXX use img->ImageStride here */ - printf("\n"); - } -#endif -} +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * 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 + * BRIAN PAUL 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. + */ + +#include "mtypes.h" +#include "attrib.h" +#include "colormac.h" +#include "enums.h" +#include "formats.h" +#include "hash.h" +#include "imports.h" +#include "debug.h" +#include "get.h" +#include "pixelstore.h" +#include "readpix.h" +#include "texobj.h" + + +static const char * +tex_target_name(GLenum tgt) +{ + static const struct { + GLenum target; + const char *name; + } tex_targets[] = { + { GL_TEXTURE_1D, "GL_TEXTURE_1D" }, + { GL_TEXTURE_2D, "GL_TEXTURE_2D" }, + { GL_TEXTURE_3D, "GL_TEXTURE_3D" }, + { GL_TEXTURE_CUBE_MAP, "GL_TEXTURE_CUBE_MAP" }, + { GL_TEXTURE_RECTANGLE, "GL_TEXTURE_RECTANGLE" }, + { GL_TEXTURE_1D_ARRAY_EXT, "GL_TEXTURE_1D_ARRAY" }, + { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" } + }; + GLuint i; + for (i = 0; i < Elements(tex_targets); i++) { + if (tex_targets[i].target == tgt) + return tex_targets[i].name; + } + return "UNKNOWN TEX TARGET"; +} + + +void +_mesa_print_state( const char *msg, GLuint state ) +{ + _mesa_debug(NULL, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + msg, + state, + (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", + (state & _NEW_PROJECTION) ? "ctx->Projection, " : "", + (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", + (state & _NEW_ACCUM) ? "ctx->Accum, " : "", + (state & _NEW_COLOR) ? "ctx->Color, " : "", + (state & _NEW_DEPTH) ? "ctx->Depth, " : "", + (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "", + (state & _NEW_FOG) ? "ctx->Fog, " : "", + (state & _NEW_HINT) ? "ctx->Hint, " : "", + (state & _NEW_LIGHT) ? "ctx->Light, " : "", + (state & _NEW_LINE) ? "ctx->Line, " : "", + (state & _NEW_PIXEL) ? "ctx->Pixel, " : "", + (state & _NEW_POINT) ? "ctx->Point, " : "", + (state & _NEW_POLYGON) ? "ctx->Polygon, " : "", + (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "", + (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "", + (state & _NEW_STENCIL) ? "ctx->Stencil, " : "", + (state & _NEW_TEXTURE) ? "ctx->Texture, " : "", + (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", + (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", + (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "", + (state & _NEW_ARRAY) ? "ctx->Array, " : "", + (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", + (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); +} + + + +void +_mesa_print_tri_caps( const char *name, GLuint flags ) +{ + _mesa_debug(NULL, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s\n", + name, + flags, + (flags & DD_FLATSHADE) ? "flat-shade, " : "", + (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "", + (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", + (flags & DD_TRI_TWOSTENCIL) ? "tri-twostencil, " : "", + (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", + (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", + (flags & DD_TRI_OFFSET) ? "tri-offset, " : "", + (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "", + (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", + (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", + (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", + (flags & DD_POINT_ATTEN) ? "point-atten, " : "", + (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "" + ); +} + + +/** + * Print information about this Mesa version and build options. + */ +void _mesa_print_info( void ) +{ + _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", + (char *) _mesa_GetString(GL_VERSION)); + _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", + (char *) _mesa_GetString(GL_RENDERER)); + _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", + (char *) _mesa_GetString(GL_VENDOR)); + _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", + (char *) _mesa_GetString(GL_EXTENSIONS)); +#if defined(THREADS) + _mesa_debug(NULL, "Mesa thread-safe: YES\n"); +#else + _mesa_debug(NULL, "Mesa thread-safe: NO\n"); +#endif +#if defined(USE_X86_ASM) + _mesa_debug(NULL, "Mesa x86-optimized: YES\n"); +#else + _mesa_debug(NULL, "Mesa x86-optimized: NO\n"); +#endif +#if defined(USE_SPARC_ASM) + _mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); +#else + _mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); +#endif +} + + +/** + * Set the debugging flags. + * + * \param debug debug string + * + * If compiled with debugging support then search for keywords in \p debug and + * enables the verbose debug output of the respective feature. + */ +static void add_debug_flags( const char *debug ) +{ +#ifdef DEBUG + struct debug_option { + const char *name; + GLbitfield flag; + }; + static const struct debug_option debug_opt[] = { + { "varray", VERBOSE_VARRAY }, + { "tex", VERBOSE_TEXTURE }, + { "mat", VERBOSE_MATERIAL }, + { "pipe", VERBOSE_PIPELINE }, + { "driver", VERBOSE_DRIVER }, + { "state", VERBOSE_STATE }, + { "api", VERBOSE_API }, + { "list", VERBOSE_DISPLAY_LIST }, + { "lighting", VERBOSE_LIGHTING }, + { "disassem", VERBOSE_DISASSEM }, + { "draw", VERBOSE_DRAW }, + { "swap", VERBOSE_SWAPBUFFERS } + }; + GLuint i; + + MESA_VERBOSE = 0x0; + for (i = 0; i < Elements(debug_opt); i++) { + if (strstr(debug, debug_opt[i].name)) + MESA_VERBOSE |= debug_opt[i].flag; + } + + /* Debug flag: + */ + if (strstr(debug, "flush")) + MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; + +#if defined(_FPU_GETCW) && defined(_FPU_SETCW) + if (strstr(debug, "fpexceptions")) { + /* raise FP exceptions */ + fpu_control_t mask; + _FPU_GETCW(mask); + mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM + | _FPU_MASK_OM | _FPU_MASK_UM); + _FPU_SETCW(mask); + } +#endif + +#else + (void) debug; +#endif +} + + +void +_mesa_init_debug( struct gl_context *ctx ) +{ + char *c; + + /* Dither disable */ + ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; + if (ctx->NoDither) { + if (_mesa_getenv("MESA_DEBUG")) { + _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); + } + ctx->Color.DitherFlag = GL_FALSE; + } + + c = _mesa_getenv("MESA_DEBUG"); + if (c) + add_debug_flags(c); + + c = _mesa_getenv("MESA_VERBOSE"); + if (c) + add_debug_flags(c); +} + + +/* + * Write ppm file + */ +static void +write_ppm(const char *filename, const GLubyte *buffer, int width, int height, + int comps, int rcomp, int gcomp, int bcomp, GLboolean invert) +{ + FILE *f = fopen( filename, "w" ); + if (f) { + int x, y; + const GLubyte *ptr = buffer; + fprintf(f,"P6\n"); + fprintf(f,"# ppm-file created by osdemo.c\n"); + fprintf(f,"%i %i\n", width,height); + fprintf(f,"255\n"); + fclose(f); + f = fopen( filename, "ab" ); /* reopen in binary append mode */ + for (y=0; y < height; y++) { + for (x = 0; x < width; x++) { + int yy = invert ? (height - 1 - y) : y; + int i = (yy * width + x) * comps; + fputc(ptr[i+rcomp], f); /* write red */ + fputc(ptr[i+gcomp], f); /* write green */ + fputc(ptr[i+bcomp], f); /* write blue */ + } + } + fclose(f); + } +} + + +/** + * Write a texture image to a ppm file. + * \param face cube face in [0,5] + * \param level mipmap level + */ +static void +write_texture_image(struct gl_texture_object *texObj, + GLuint face, GLuint level) +{ + struct gl_texture_image *img = texObj->Image[face][level]; + if (img) { + GET_CURRENT_CONTEXT(ctx); + struct gl_pixelstore_attrib store; + GLubyte *buffer; + char s[100]; + + buffer = (GLubyte *) malloc(img->Width * img->Height + * img->Depth * 4); + + store = ctx->Pack; /* save */ + ctx->Pack = ctx->DefaultPacking; + + ctx->Driver.GetTexImage(ctx, texObj->Target, level, + GL_RGBA, GL_UNSIGNED_BYTE, + buffer, texObj, img); + + /* make filename */ + _mesa_snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); + + printf(" Writing image level %u to %s\n", level, s); + write_ppm(s, buffer, img->Width, img->Height, 4, 0, 1, 2, GL_FALSE); + + ctx->Pack = store; /* restore */ + + free(buffer); + } +} + + +/** + * Write renderbuffer image to a ppm file. + */ +static void +write_renderbuffer_image(const struct gl_renderbuffer *rb) +{ + GET_CURRENT_CONTEXT(ctx); + GLubyte *buffer; + char s[100]; + GLenum format, type; + + if (rb->_BaseFormat == GL_RGB || + rb->_BaseFormat == GL_RGBA) { + format = GL_RGBA; + type = GL_UNSIGNED_BYTE; + } + else if (rb->_BaseFormat == GL_DEPTH_STENCIL) { + format = GL_DEPTH_STENCIL; + type = GL_UNSIGNED_INT_24_8; + } + else { + return; + } + + buffer = (GLubyte *) malloc(rb->Width * rb->Height * 4); + + ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height, + format, type, &ctx->DefaultPacking, buffer); + + /* make filename */ + _mesa_snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name); + + printf(" Writing renderbuffer image to %s\n", s); + write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE); + + free(buffer); +} + + +/** How many texture images (mipmap levels, faces) to write to files */ +#define WRITE_NONE 0 +#define WRITE_ONE 1 +#define WRITE_ALL 2 + +static GLuint WriteImages; + + +static void +dump_texture(struct gl_texture_object *texObj, GLuint writeImages) +{ + const GLuint numFaces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1; + GLboolean written = GL_FALSE; + GLuint i, j; + + printf("Texture %u\n", texObj->Name); + printf(" Target %s\n", tex_target_name(texObj->Target)); + for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { + for (j = 0; j < numFaces; j++) { + struct gl_texture_image *texImg = texObj->Image[j][i]; + if (texImg) { + printf(" Face %u level %u: %d x %d x %d, format %s at %p\n", + j, i, + texImg->Width, texImg->Height, texImg->Depth, + _mesa_get_format_name(texImg->TexFormat), + texImg->Data); + if (writeImages == WRITE_ALL || + (writeImages == WRITE_ONE && !written)) { + write_texture_image(texObj, j, i); + written = GL_TRUE; + } + } + } + } +} + + +/** + * Dump a single texture. + */ +void +_mesa_dump_texture(GLuint texture, GLuint writeImages) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture); + if (texObj) { + dump_texture(texObj, writeImages); + } +} + + +static void +dump_texture_cb(GLuint id, void *data, void *userData) +{ + struct gl_texture_object *texObj = (struct gl_texture_object *) data; + (void) userData; + dump_texture(texObj, WriteImages); +} + + +/** + * Print basic info about all texture objext to stdout. + * If dumpImages is true, write PPM of level[0] image to a file. + */ +void +_mesa_dump_textures(GLuint writeImages) +{ + GET_CURRENT_CONTEXT(ctx); + WriteImages = writeImages; + _mesa_HashWalk(ctx->Shared->TexObjects, dump_texture_cb, ctx); +} + + +static void +dump_renderbuffer(const struct gl_renderbuffer *rb, GLboolean writeImage) +{ + printf("Renderbuffer %u: %u x %u IntFormat = %s\n", + rb->Name, rb->Width, rb->Height, + _mesa_lookup_enum_by_nr(rb->InternalFormat)); + if (writeImage) { + write_renderbuffer_image(rb); + } +} + + +static void +dump_renderbuffer_cb(GLuint id, void *data, void *userData) +{ + const struct gl_renderbuffer *rb = (const struct gl_renderbuffer *) data; + (void) userData; + dump_renderbuffer(rb, WriteImages); +} + + +/** + * Print basic info about all renderbuffers to stdout. + * If dumpImages is true, write PPM of level[0] image to a file. + */ +void +_mesa_dump_renderbuffers(GLboolean writeImages) +{ + GET_CURRENT_CONTEXT(ctx); + WriteImages = writeImages; + _mesa_HashWalk(ctx->Shared->RenderBuffers, dump_renderbuffer_cb, ctx); +} + + + +void +_mesa_dump_color_buffer(const char *filename) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint w = ctx->DrawBuffer->Width; + const GLuint h = ctx->DrawBuffer->Height; + GLubyte *buf; + + buf = (GLubyte *) malloc(w * h * 4); + + _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); + _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + + _mesa_ReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); + + printf("ReadBuffer %p 0x%x DrawBuffer %p 0x%x\n", + (void *) ctx->ReadBuffer->_ColorReadBuffer, + ctx->ReadBuffer->ColorReadBuffer, + (void *) ctx->DrawBuffer->_ColorDrawBuffers[0], + ctx->DrawBuffer->ColorDrawBuffer[0]); + printf("Writing %d x %d color buffer to %s\n", w, h, filename); + write_ppm(filename, buf, w, h, 4, 0, 1, 2, GL_TRUE); + + _mesa_PopClientAttrib(); + + free(buf); +} + + +void +_mesa_dump_depth_buffer(const char *filename) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint w = ctx->DrawBuffer->Width; + const GLuint h = ctx->DrawBuffer->Height; + GLuint *buf; + GLubyte *buf2; + GLuint i; + + buf = (GLuint *) malloc(w * h * 4); /* 4 bpp */ + buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */ + + _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); + _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + + _mesa_ReadPixels(0, 0, w, h, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buf); + + /* spread 24 bits of Z across R, G, B */ + for (i = 0; i < w * h; i++) { + buf2[i*3+0] = (buf[i] >> 24) & 0xff; + buf2[i*3+1] = (buf[i] >> 16) & 0xff; + buf2[i*3+2] = (buf[i] >> 8) & 0xff; + } + + printf("Writing %d x %d depth buffer to %s\n", w, h, filename); + write_ppm(filename, buf2, w, h, 3, 0, 1, 2, GL_TRUE); + + _mesa_PopClientAttrib(); + + free(buf); + free(buf2); +} + + +void +_mesa_dump_stencil_buffer(const char *filename) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint w = ctx->DrawBuffer->Width; + const GLuint h = ctx->DrawBuffer->Height; + GLubyte *buf; + GLubyte *buf2; + GLuint i; + + buf = (GLubyte *) malloc(w * h); /* 1 bpp */ + buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */ + + _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); + _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + + _mesa_ReadPixels(0, 0, w, h, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, buf); + + for (i = 0; i < w * h; i++) { + buf2[i*3+0] = buf[i]; + buf2[i*3+1] = (buf[i] & 127) * 2; + buf2[i*3+2] = (buf[i] - 128) * 2; + } + + printf("Writing %d x %d stencil buffer to %s\n", w, h, filename); + write_ppm(filename, buf2, w, h, 3, 0, 1, 2, GL_TRUE); + + _mesa_PopClientAttrib(); + + free(buf); + free(buf2); +} + + +/** + * Quick and dirty function to "print" a texture to stdout. + */ +void +_mesa_print_texture(struct gl_context *ctx, const struct gl_texture_image *img) +{ +#if CHAN_TYPE != GL_UNSIGNED_BYTE + _mesa_problem(NULL, "PrintTexture not supported"); +#else + GLuint i, j, c; + const GLubyte *data = (const GLubyte *) img->Data; + + if (!data) { + printf("No texture data\n"); + return; + } + + /* XXX add more formats or make into a new format utility function */ + switch (img->TexFormat) { + case MESA_FORMAT_A8: + case MESA_FORMAT_L8: + case MESA_FORMAT_I8: + case MESA_FORMAT_CI8: + c = 1; + break; + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: + c = 2; + break; + case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR888: + c = 3; + break; + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_ARGB8888: + c = 4; + break; + default: + _mesa_problem(NULL, "error in PrintTexture\n"); + return; + } + + for (i = 0; i < img->Height; i++) { + for (j = 0; j < img->Width; j++) { + if (c==1) + printf("%02x ", data[0]); + else if (c==2) + printf("%02x%02x ", data[0], data[1]); + else if (c==3) + printf("%02x%02x%02x ", data[0], data[1], data[2]); + else if (c==4) + printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); + data += (img->RowStride - img->Width) * c; + } + /* XXX use img->ImageStride here */ + printf("\n"); + } +#endif +} diff --git a/mesalib/src/mesa/main/enums.c b/mesalib/src/mesa/main/enums.c index e95d58372..83d7fb66c 100644 --- a/mesalib/src/mesa/main/enums.c +++ b/mesalib/src/mesa/main/enums.c @@ -1,6283 +1,6294 @@ -/* DO NOT EDIT - This file generated automatically by gl_enums.py (from Mesa) script */ - -/* - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sub license, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL, - * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "main/glheader.h" -#include "main/mfeatures.h" -#include "main/enums.h" -#include "main/imports.h" - -typedef struct { - size_t offset; - int n; -} enum_elt; - -LONGSTRING static const char enum_string_table[] = - "GL_2D\0" - "GL_2_BYTES\0" - "GL_3D\0" - "GL_3D_COLOR\0" - "GL_3D_COLOR_TEXTURE\0" - "GL_3_BYTES\0" - "GL_4D_COLOR_TEXTURE\0" - "GL_4_BYTES\0" - "GL_ACCUM\0" - "GL_ACCUM_ALPHA_BITS\0" - "GL_ACCUM_BLUE_BITS\0" - "GL_ACCUM_BUFFER_BIT\0" - "GL_ACCUM_CLEAR_VALUE\0" - "GL_ACCUM_GREEN_BITS\0" - "GL_ACCUM_RED_BITS\0" - "GL_ACTIVE_ATTRIBUTES\0" - "GL_ACTIVE_ATTRIBUTE_MAX_LENGTH\0" - "GL_ACTIVE_PROGRAM_EXT\0" - "GL_ACTIVE_STENCIL_FACE_EXT\0" - "GL_ACTIVE_TEXTURE\0" - "GL_ACTIVE_TEXTURE_ARB\0" - "GL_ACTIVE_UNIFORMS\0" - "GL_ACTIVE_UNIFORM_MAX_LENGTH\0" - "GL_ACTIVE_VERTEX_UNITS_ARB\0" - "GL_ADD\0" - "GL_ADD_SIGNED\0" - "GL_ADD_SIGNED_ARB\0" - "GL_ADD_SIGNED_EXT\0" - "GL_ALIASED_LINE_WIDTH_RANGE\0" - "GL_ALIASED_POINT_SIZE_RANGE\0" - "GL_ALL_ATTRIB_BITS\0" - "GL_ALL_CLIENT_ATTRIB_BITS\0" - "GL_ALPHA\0" - "GL_ALPHA12\0" - "GL_ALPHA12_EXT\0" - "GL_ALPHA16\0" - "GL_ALPHA16I_EXT\0" - "GL_ALPHA16UI_EXT\0" - "GL_ALPHA16_EXT\0" - "GL_ALPHA32I_EXT\0" - "GL_ALPHA32UI_EXT\0" - "GL_ALPHA4\0" - "GL_ALPHA4_EXT\0" - "GL_ALPHA8\0" - "GL_ALPHA8I_EXT\0" - "GL_ALPHA8UI_EXT\0" - "GL_ALPHA8_EXT\0" - "GL_ALPHA_BIAS\0" - "GL_ALPHA_BITS\0" - "GL_ALPHA_INTEGER_EXT\0" - "GL_ALPHA_SCALE\0" - "GL_ALPHA_TEST\0" - "GL_ALPHA_TEST_FUNC\0" - "GL_ALPHA_TEST_REF\0" - "GL_ALREADY_SIGNALED\0" - "GL_ALWAYS\0" - "GL_AMBIENT\0" - "GL_AMBIENT_AND_DIFFUSE\0" - "GL_AND\0" - "GL_AND_INVERTED\0" - "GL_AND_REVERSE\0" - "GL_ARRAY_BUFFER\0" - "GL_ARRAY_BUFFER_BINDING\0" - "GL_ARRAY_BUFFER_BINDING_ARB\0" - "GL_ATTACHED_SHADERS\0" - "GL_ATTRIB_ARRAY_POINTER_NV\0" - "GL_ATTRIB_ARRAY_SIZE_NV\0" - "GL_ATTRIB_ARRAY_STRIDE_NV\0" - "GL_ATTRIB_ARRAY_TYPE_NV\0" - "GL_ATTRIB_STACK_DEPTH\0" - "GL_AUTO_NORMAL\0" - "GL_AUX0\0" - "GL_AUX1\0" - "GL_AUX2\0" - "GL_AUX3\0" - "GL_AUX_BUFFERS\0" - "GL_BACK\0" - "GL_BACK_LEFT\0" - "GL_BACK_RIGHT\0" - "GL_BGR\0" - "GL_BGRA\0" - "GL_BGRA_EXT\0" - "GL_BGRA_INTEGER\0" - "GL_BGRA_INTEGER_EXT\0" - "GL_BGR_INTEGER\0" - "GL_BGR_INTEGER_EXT\0" - "GL_BITMAP\0" - "GL_BITMAP_TOKEN\0" - "GL_BLEND\0" - "GL_BLEND_COLOR\0" - "GL_BLEND_COLOR_EXT\0" - "GL_BLEND_DST\0" - "GL_BLEND_DST_ALPHA\0" - "GL_BLEND_DST_ALPHA_OES\0" - "GL_BLEND_DST_RGB\0" - "GL_BLEND_DST_RGB_OES\0" - "GL_BLEND_EQUATION\0" - "GL_BLEND_EQUATION_ALPHA\0" - "GL_BLEND_EQUATION_ALPHA_EXT\0" - "GL_BLEND_EQUATION_ALPHA_OES\0" - "GL_BLEND_EQUATION_EXT\0" - "GL_BLEND_EQUATION_OES\0" - "GL_BLEND_EQUATION_RGB\0" - "GL_BLEND_EQUATION_RGB_EXT\0" - "GL_BLEND_EQUATION_RGB_OES\0" - "GL_BLEND_SRC\0" - "GL_BLEND_SRC_ALPHA\0" - "GL_BLEND_SRC_ALPHA_OES\0" - "GL_BLEND_SRC_RGB\0" - "GL_BLEND_SRC_RGB_OES\0" - "GL_BLUE\0" - "GL_BLUE_BIAS\0" - "GL_BLUE_BITS\0" - "GL_BLUE_INTEGER\0" - "GL_BLUE_INTEGER_EXT\0" - "GL_BLUE_SCALE\0" - "GL_BOOL\0" - "GL_BOOL_ARB\0" - "GL_BOOL_VEC2\0" - "GL_BOOL_VEC2_ARB\0" - "GL_BOOL_VEC3\0" - "GL_BOOL_VEC3_ARB\0" - "GL_BOOL_VEC4\0" - "GL_BOOL_VEC4_ARB\0" - "GL_BUFFER_ACCESS\0" - "GL_BUFFER_ACCESS_ARB\0" - "GL_BUFFER_ACCESS_FLAGS\0" - "GL_BUFFER_ACCESS_OES\0" - "GL_BUFFER_FLUSHING_UNMAP_APPLE\0" - "GL_BUFFER_MAPPED\0" - "GL_BUFFER_MAPPED_ARB\0" - "GL_BUFFER_MAPPED_OES\0" - "GL_BUFFER_MAP_LENGTH\0" - "GL_BUFFER_MAP_OFFSET\0" - "GL_BUFFER_MAP_POINTER\0" - "GL_BUFFER_MAP_POINTER_ARB\0" - "GL_BUFFER_MAP_POINTER_OES\0" - "GL_BUFFER_OBJECT_APPLE\0" - "GL_BUFFER_SERIALIZED_MODIFY_APPLE\0" - "GL_BUFFER_SIZE\0" - "GL_BUFFER_SIZE_ARB\0" - "GL_BUFFER_USAGE\0" - "GL_BUFFER_USAGE_ARB\0" - "GL_BUMP_ENVMAP_ATI\0" - "GL_BUMP_NUM_TEX_UNITS_ATI\0" - "GL_BUMP_ROT_MATRIX_ATI\0" - "GL_BUMP_ROT_MATRIX_SIZE_ATI\0" - "GL_BUMP_TARGET_ATI\0" - "GL_BUMP_TEX_UNITS_ATI\0" - "GL_BYTE\0" - "GL_C3F_V3F\0" - "GL_C4F_N3F_V3F\0" - "GL_C4UB_V2F\0" - "GL_C4UB_V3F\0" - "GL_CCW\0" - "GL_CLAMP\0" - "GL_CLAMP_READ_COLOR\0" - "GL_CLAMP_TO_BORDER\0" - "GL_CLAMP_TO_BORDER_ARB\0" - "GL_CLAMP_TO_BORDER_SGIS\0" - "GL_CLAMP_TO_EDGE\0" - "GL_CLAMP_TO_EDGE_SGIS\0" - "GL_CLEAR\0" - "GL_CLIENT_ACTIVE_TEXTURE\0" - "GL_CLIENT_ACTIVE_TEXTURE_ARB\0" - "GL_CLIENT_ALL_ATTRIB_BITS\0" - "GL_CLIENT_ATTRIB_STACK_DEPTH\0" - "GL_CLIENT_PIXEL_STORE_BIT\0" - "GL_CLIENT_VERTEX_ARRAY_BIT\0" - "GL_CLIP_DISTANCE0\0" - "GL_CLIP_DISTANCE1\0" - "GL_CLIP_DISTANCE2\0" - "GL_CLIP_DISTANCE3\0" - "GL_CLIP_DISTANCE4\0" - "GL_CLIP_DISTANCE5\0" - "GL_CLIP_DISTANCE6\0" - "GL_CLIP_DISTANCE7\0" - "GL_CLIP_PLANE0\0" - "GL_CLIP_PLANE1\0" - "GL_CLIP_PLANE2\0" - "GL_CLIP_PLANE3\0" - "GL_CLIP_PLANE4\0" - "GL_CLIP_PLANE5\0" - "GL_CLIP_VOLUME_CLIPPING_HINT_EXT\0" - "GL_COEFF\0" - "GL_COLOR\0" - "GL_COLOR_ARRAY\0" - "GL_COLOR_ARRAY_BUFFER_BINDING\0" - "GL_COLOR_ARRAY_BUFFER_BINDING_ARB\0" - "GL_COLOR_ARRAY_POINTER\0" - "GL_COLOR_ARRAY_SIZE\0" - "GL_COLOR_ARRAY_STRIDE\0" - "GL_COLOR_ARRAY_TYPE\0" - "GL_COLOR_ATTACHMENT0\0" - "GL_COLOR_ATTACHMENT0_EXT\0" - "GL_COLOR_ATTACHMENT0_OES\0" - "GL_COLOR_ATTACHMENT1\0" - "GL_COLOR_ATTACHMENT10\0" - "GL_COLOR_ATTACHMENT10_EXT\0" - "GL_COLOR_ATTACHMENT11\0" - "GL_COLOR_ATTACHMENT11_EXT\0" - "GL_COLOR_ATTACHMENT12\0" - "GL_COLOR_ATTACHMENT12_EXT\0" - "GL_COLOR_ATTACHMENT13\0" - "GL_COLOR_ATTACHMENT13_EXT\0" - "GL_COLOR_ATTACHMENT14\0" - "GL_COLOR_ATTACHMENT14_EXT\0" - "GL_COLOR_ATTACHMENT15\0" - "GL_COLOR_ATTACHMENT15_EXT\0" - "GL_COLOR_ATTACHMENT1_EXT\0" - "GL_COLOR_ATTACHMENT2\0" - "GL_COLOR_ATTACHMENT2_EXT\0" - "GL_COLOR_ATTACHMENT3\0" - "GL_COLOR_ATTACHMENT3_EXT\0" - "GL_COLOR_ATTACHMENT4\0" - "GL_COLOR_ATTACHMENT4_EXT\0" - "GL_COLOR_ATTACHMENT5\0" - "GL_COLOR_ATTACHMENT5_EXT\0" - "GL_COLOR_ATTACHMENT6\0" - "GL_COLOR_ATTACHMENT6_EXT\0" - "GL_COLOR_ATTACHMENT7\0" - "GL_COLOR_ATTACHMENT7_EXT\0" - "GL_COLOR_ATTACHMENT8\0" - "GL_COLOR_ATTACHMENT8_EXT\0" - "GL_COLOR_ATTACHMENT9\0" - "GL_COLOR_ATTACHMENT9_EXT\0" - "GL_COLOR_BUFFER_BIT\0" - "GL_COLOR_CLEAR_VALUE\0" - "GL_COLOR_INDEX\0" - "GL_COLOR_INDEXES\0" - "GL_COLOR_LOGIC_OP\0" - "GL_COLOR_MATERIAL\0" - "GL_COLOR_MATERIAL_FACE\0" - "GL_COLOR_MATERIAL_PARAMETER\0" - "GL_COLOR_MATRIX\0" - "GL_COLOR_MATRIX_SGI\0" - "GL_COLOR_MATRIX_STACK_DEPTH\0" - "GL_COLOR_MATRIX_STACK_DEPTH_SGI\0" - "GL_COLOR_SUM\0" - "GL_COLOR_SUM_ARB\0" - "GL_COLOR_TABLE\0" - "GL_COLOR_TABLE_ALPHA_SIZE\0" - "GL_COLOR_TABLE_ALPHA_SIZE_EXT\0" - "GL_COLOR_TABLE_ALPHA_SIZE_SGI\0" - "GL_COLOR_TABLE_BIAS\0" - "GL_COLOR_TABLE_BIAS_SGI\0" - "GL_COLOR_TABLE_BLUE_SIZE\0" - "GL_COLOR_TABLE_BLUE_SIZE_EXT\0" - "GL_COLOR_TABLE_BLUE_SIZE_SGI\0" - "GL_COLOR_TABLE_FORMAT\0" - "GL_COLOR_TABLE_FORMAT_EXT\0" - "GL_COLOR_TABLE_FORMAT_SGI\0" - "GL_COLOR_TABLE_GREEN_SIZE\0" - "GL_COLOR_TABLE_GREEN_SIZE_EXT\0" - "GL_COLOR_TABLE_GREEN_SIZE_SGI\0" - "GL_COLOR_TABLE_INTENSITY_SIZE\0" - "GL_COLOR_TABLE_INTENSITY_SIZE_EXT\0" - "GL_COLOR_TABLE_INTENSITY_SIZE_SGI\0" - "GL_COLOR_TABLE_LUMINANCE_SIZE\0" - "GL_COLOR_TABLE_LUMINANCE_SIZE_EXT\0" - "GL_COLOR_TABLE_LUMINANCE_SIZE_SGI\0" - "GL_COLOR_TABLE_RED_SIZE\0" - "GL_COLOR_TABLE_RED_SIZE_EXT\0" - "GL_COLOR_TABLE_RED_SIZE_SGI\0" - "GL_COLOR_TABLE_SCALE\0" - "GL_COLOR_TABLE_SCALE_SGI\0" - "GL_COLOR_TABLE_WIDTH\0" - "GL_COLOR_TABLE_WIDTH_EXT\0" - "GL_COLOR_TABLE_WIDTH_SGI\0" - "GL_COLOR_WRITEMASK\0" - "GL_COMBINE\0" - "GL_COMBINE4\0" - "GL_COMBINE_ALPHA\0" - "GL_COMBINE_ALPHA_ARB\0" - "GL_COMBINE_ALPHA_EXT\0" - "GL_COMBINE_ARB\0" - "GL_COMBINE_EXT\0" - "GL_COMBINE_RGB\0" - "GL_COMBINE_RGB_ARB\0" - "GL_COMBINE_RGB_EXT\0" - "GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT\0" - "GL_COMPARE_REF_TO_TEXTURE\0" - "GL_COMPARE_R_TO_TEXTURE\0" - "GL_COMPARE_R_TO_TEXTURE_ARB\0" - "GL_COMPILE\0" - "GL_COMPILE_AND_EXECUTE\0" - "GL_COMPILE_STATUS\0" - "GL_COMPRESSED_ALPHA\0" - "GL_COMPRESSED_ALPHA_ARB\0" - "GL_COMPRESSED_INTENSITY\0" - "GL_COMPRESSED_INTENSITY_ARB\0" - "GL_COMPRESSED_LUMINANCE\0" - "GL_COMPRESSED_LUMINANCE_ALPHA\0" - "GL_COMPRESSED_LUMINANCE_ALPHA_ARB\0" - "GL_COMPRESSED_LUMINANCE_ARB\0" - "GL_COMPRESSED_RED\0" - "GL_COMPRESSED_RG\0" - "GL_COMPRESSED_RGB\0" - "GL_COMPRESSED_RGBA\0" - "GL_COMPRESSED_RGBA_ARB\0" - "GL_COMPRESSED_RGBA_FXT1_3DFX\0" - "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT\0" - "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT\0" - "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT\0" - "GL_COMPRESSED_RGB_ARB\0" - "GL_COMPRESSED_RGB_FXT1_3DFX\0" - "GL_COMPRESSED_RGB_S3TC_DXT1_EXT\0" - "GL_COMPRESSED_SLUMINANCE\0" - "GL_COMPRESSED_SLUMINANCE_ALPHA\0" - "GL_COMPRESSED_SRGB\0" - "GL_COMPRESSED_SRGB_ALPHA\0" - "GL_COMPRESSED_TEXTURE_FORMATS\0" - "GL_CONDITION_SATISFIED\0" - "GL_CONSTANT\0" - "GL_CONSTANT_ALPHA\0" - "GL_CONSTANT_ALPHA_EXT\0" - "GL_CONSTANT_ARB\0" - "GL_CONSTANT_ATTENUATION\0" - "GL_CONSTANT_BORDER_HP\0" - "GL_CONSTANT_COLOR\0" - "GL_CONSTANT_COLOR_EXT\0" - "GL_CONSTANT_EXT\0" - "GL_CONTEXT_COMPATIBILITY_PROFILE_BIT\0" - "GL_CONTEXT_CORE_PROFILE_BIT\0" - "GL_CONTEXT_FLAGS\0" - "GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT\0" - "GL_CONTEXT_PROFILE_MASK\0" - "GL_CONVOLUTION_1D\0" - "GL_CONVOLUTION_2D\0" - "GL_CONVOLUTION_BORDER_COLOR\0" - "GL_CONVOLUTION_BORDER_COLOR_HP\0" - "GL_CONVOLUTION_BORDER_MODE\0" - "GL_CONVOLUTION_BORDER_MODE_EXT\0" - "GL_CONVOLUTION_FILTER_BIAS\0" - "GL_CONVOLUTION_FILTER_BIAS_EXT\0" - "GL_CONVOLUTION_FILTER_SCALE\0" - "GL_CONVOLUTION_FILTER_SCALE_EXT\0" - "GL_CONVOLUTION_FORMAT\0" - "GL_CONVOLUTION_FORMAT_EXT\0" - "GL_CONVOLUTION_HEIGHT\0" - "GL_CONVOLUTION_HEIGHT_EXT\0" - "GL_CONVOLUTION_WIDTH\0" - "GL_CONVOLUTION_WIDTH_EXT\0" - "GL_COORD_REPLACE\0" - "GL_COORD_REPLACE_ARB\0" - "GL_COORD_REPLACE_NV\0" - "GL_COORD_REPLACE_OES\0" - "GL_COPY\0" - "GL_COPY_INVERTED\0" - "GL_COPY_PIXEL_TOKEN\0" - "GL_COPY_READ_BUFFER\0" - "GL_COPY_WRITE_BUFFER\0" - "GL_CULL_FACE\0" - "GL_CULL_FACE_MODE\0" - "GL_CULL_VERTEX_EXT\0" - "GL_CULL_VERTEX_EYE_POSITION_EXT\0" - "GL_CULL_VERTEX_OBJECT_POSITION_EXT\0" - "GL_CURRENT_ATTRIB_NV\0" - "GL_CURRENT_BIT\0" - "GL_CURRENT_COLOR\0" - "GL_CURRENT_FOG_COORD\0" - "GL_CURRENT_FOG_COORDINATE\0" - "GL_CURRENT_INDEX\0" - "GL_CURRENT_MATRIX_ARB\0" - "GL_CURRENT_MATRIX_INDEX_ARB\0" - "GL_CURRENT_MATRIX_NV\0" - "GL_CURRENT_MATRIX_STACK_DEPTH_ARB\0" - "GL_CURRENT_MATRIX_STACK_DEPTH_NV\0" - "GL_CURRENT_NORMAL\0" - "GL_CURRENT_PALETTE_MATRIX_ARB\0" - "GL_CURRENT_PALETTE_MATRIX_OES\0" - "GL_CURRENT_PROGRAM\0" - "GL_CURRENT_QUERY\0" - "GL_CURRENT_QUERY_ARB\0" - "GL_CURRENT_RASTER_COLOR\0" - "GL_CURRENT_RASTER_DISTANCE\0" - "GL_CURRENT_RASTER_INDEX\0" - "GL_CURRENT_RASTER_POSITION\0" - "GL_CURRENT_RASTER_POSITION_VALID\0" - "GL_CURRENT_RASTER_SECONDARY_COLOR\0" - "GL_CURRENT_RASTER_TEXTURE_COORDS\0" - "GL_CURRENT_SECONDARY_COLOR\0" - "GL_CURRENT_TEXTURE_COORDS\0" - "GL_CURRENT_VERTEX_ATTRIB\0" - "GL_CURRENT_VERTEX_ATTRIB_ARB\0" - "GL_CURRENT_WEIGHT_ARB\0" - "GL_CW\0" - "GL_DEBUG_ASSERT_MESA\0" - "GL_DEBUG_OBJECT_MESA\0" - "GL_DEBUG_PRINT_MESA\0" - "GL_DECAL\0" - "GL_DECR\0" - "GL_DECR_WRAP\0" - "GL_DECR_WRAP_EXT\0" - "GL_DELETE_STATUS\0" - "GL_DEPTH\0" - "GL_DEPTH24_STENCIL8\0" - "GL_DEPTH24_STENCIL8_EXT\0" - "GL_DEPTH24_STENCIL8_OES\0" - "GL_DEPTH_ATTACHMENT\0" - "GL_DEPTH_ATTACHMENT_EXT\0" - "GL_DEPTH_ATTACHMENT_OES\0" - "GL_DEPTH_BIAS\0" - "GL_DEPTH_BITS\0" - "GL_DEPTH_BOUNDS_EXT\0" - "GL_DEPTH_BOUNDS_TEST_EXT\0" - "GL_DEPTH_BUFFER\0" - "GL_DEPTH_BUFFER_BIT\0" - "GL_DEPTH_CLAMP\0" - "GL_DEPTH_CLAMP_NV\0" - "GL_DEPTH_CLEAR_VALUE\0" - "GL_DEPTH_COMPONENT\0" - "GL_DEPTH_COMPONENT16\0" - "GL_DEPTH_COMPONENT16_ARB\0" - "GL_DEPTH_COMPONENT16_OES\0" - "GL_DEPTH_COMPONENT16_SGIX\0" - "GL_DEPTH_COMPONENT24\0" - "GL_DEPTH_COMPONENT24_ARB\0" - "GL_DEPTH_COMPONENT24_OES\0" - "GL_DEPTH_COMPONENT24_SGIX\0" - "GL_DEPTH_COMPONENT32\0" - "GL_DEPTH_COMPONENT32_ARB\0" - "GL_DEPTH_COMPONENT32_OES\0" - "GL_DEPTH_COMPONENT32_SGIX\0" - "GL_DEPTH_FUNC\0" - "GL_DEPTH_RANGE\0" - "GL_DEPTH_SCALE\0" - "GL_DEPTH_STENCIL\0" - "GL_DEPTH_STENCIL_ATTACHMENT\0" - "GL_DEPTH_STENCIL_EXT\0" - "GL_DEPTH_STENCIL_NV\0" - "GL_DEPTH_STENCIL_OES\0" - "GL_DEPTH_STENCIL_TO_BGRA_NV\0" - "GL_DEPTH_STENCIL_TO_RGBA_NV\0" - "GL_DEPTH_TEST\0" - "GL_DEPTH_TEXTURE_MODE\0" - "GL_DEPTH_TEXTURE_MODE_ARB\0" - "GL_DEPTH_WRITEMASK\0" - "GL_DIFFUSE\0" - "GL_DITHER\0" - "GL_DOMAIN\0" - "GL_DONT_CARE\0" - "GL_DOT3_RGB\0" - "GL_DOT3_RGBA\0" - "GL_DOT3_RGBA_ARB\0" - "GL_DOT3_RGBA_EXT\0" - "GL_DOT3_RGB_ARB\0" - "GL_DOT3_RGB_EXT\0" - "GL_DOUBLE\0" - "GL_DOUBLEBUFFER\0" - "GL_DRAW_BUFFER\0" - "GL_DRAW_BUFFER0\0" - "GL_DRAW_BUFFER0_ARB\0" - "GL_DRAW_BUFFER0_ATI\0" - "GL_DRAW_BUFFER1\0" - "GL_DRAW_BUFFER10\0" - "GL_DRAW_BUFFER10_ARB\0" - "GL_DRAW_BUFFER10_ATI\0" - "GL_DRAW_BUFFER11\0" - "GL_DRAW_BUFFER11_ARB\0" - "GL_DRAW_BUFFER11_ATI\0" - "GL_DRAW_BUFFER12\0" - "GL_DRAW_BUFFER12_ARB\0" - "GL_DRAW_BUFFER12_ATI\0" - "GL_DRAW_BUFFER13\0" - "GL_DRAW_BUFFER13_ARB\0" - "GL_DRAW_BUFFER13_ATI\0" - "GL_DRAW_BUFFER14\0" - "GL_DRAW_BUFFER14_ARB\0" - "GL_DRAW_BUFFER14_ATI\0" - "GL_DRAW_BUFFER15\0" - "GL_DRAW_BUFFER15_ARB\0" - "GL_DRAW_BUFFER15_ATI\0" - "GL_DRAW_BUFFER1_ARB\0" - "GL_DRAW_BUFFER1_ATI\0" - "GL_DRAW_BUFFER2\0" - "GL_DRAW_BUFFER2_ARB\0" - "GL_DRAW_BUFFER2_ATI\0" - "GL_DRAW_BUFFER3\0" - "GL_DRAW_BUFFER3_ARB\0" - "GL_DRAW_BUFFER3_ATI\0" - "GL_DRAW_BUFFER4\0" - "GL_DRAW_BUFFER4_ARB\0" - "GL_DRAW_BUFFER4_ATI\0" - "GL_DRAW_BUFFER5\0" - "GL_DRAW_BUFFER5_ARB\0" - "GL_DRAW_BUFFER5_ATI\0" - "GL_DRAW_BUFFER6\0" - "GL_DRAW_BUFFER6_ARB\0" - "GL_DRAW_BUFFER6_ATI\0" - "GL_DRAW_BUFFER7\0" - "GL_DRAW_BUFFER7_ARB\0" - "GL_DRAW_BUFFER7_ATI\0" - "GL_DRAW_BUFFER8\0" - "GL_DRAW_BUFFER8_ARB\0" - "GL_DRAW_BUFFER8_ATI\0" - "GL_DRAW_BUFFER9\0" - "GL_DRAW_BUFFER9_ARB\0" - "GL_DRAW_BUFFER9_ATI\0" - "GL_DRAW_FRAMEBUFFER\0" - "GL_DRAW_FRAMEBUFFER_BINDING\0" - "GL_DRAW_FRAMEBUFFER_BINDING_EXT\0" - "GL_DRAW_FRAMEBUFFER_EXT\0" - "GL_DRAW_PIXEL_TOKEN\0" - "GL_DST_ALPHA\0" - "GL_DST_COLOR\0" - "GL_DU8DV8_ATI\0" - "GL_DUDV_ATI\0" - "GL_DYNAMIC_COPY\0" - "GL_DYNAMIC_COPY_ARB\0" - "GL_DYNAMIC_DRAW\0" - "GL_DYNAMIC_DRAW_ARB\0" - "GL_DYNAMIC_READ\0" - "GL_DYNAMIC_READ_ARB\0" - "GL_EDGE_FLAG\0" - "GL_EDGE_FLAG_ARRAY\0" - "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING\0" - "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB\0" - "GL_EDGE_FLAG_ARRAY_POINTER\0" - "GL_EDGE_FLAG_ARRAY_STRIDE\0" - "GL_ELEMENT_ARRAY_BUFFER\0" - "GL_ELEMENT_ARRAY_BUFFER_BINDING\0" - "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB\0" - "GL_EMISSION\0" - "GL_ENABLE_BIT\0" - "GL_EQUAL\0" - "GL_EQUIV\0" - "GL_EVAL_BIT\0" - "GL_EXP\0" - "GL_EXP2\0" - "GL_EXTENSIONS\0" - "GL_EYE_LINEAR\0" - "GL_EYE_PLANE\0" - "GL_EYE_PLANE_ABSOLUTE_NV\0" - "GL_EYE_RADIAL_NV\0" - "GL_FALSE\0" - "GL_FASTEST\0" - "GL_FEEDBACK\0" - "GL_FEEDBACK_BUFFER_POINTER\0" - "GL_FEEDBACK_BUFFER_SIZE\0" - "GL_FEEDBACK_BUFFER_TYPE\0" - "GL_FILL\0" - "GL_FIRST_VERTEX_CONVENTION\0" - "GL_FIRST_VERTEX_CONVENTION_EXT\0" - "GL_FIXED\0" - "GL_FIXED_OES\0" - "GL_FIXED_ONLY\0" - "GL_FLAT\0" - "GL_FLOAT\0" - "GL_FLOAT_MAT2\0" - "GL_FLOAT_MAT2_ARB\0" - "GL_FLOAT_MAT2x3\0" - "GL_FLOAT_MAT2x4\0" - "GL_FLOAT_MAT3\0" - "GL_FLOAT_MAT3_ARB\0" - "GL_FLOAT_MAT3x2\0" - "GL_FLOAT_MAT3x4\0" - "GL_FLOAT_MAT4\0" - "GL_FLOAT_MAT4_ARB\0" - "GL_FLOAT_MAT4x2\0" - "GL_FLOAT_MAT4x3\0" - "GL_FLOAT_VEC2\0" - "GL_FLOAT_VEC2_ARB\0" - "GL_FLOAT_VEC3\0" - "GL_FLOAT_VEC3_ARB\0" - "GL_FLOAT_VEC4\0" - "GL_FLOAT_VEC4_ARB\0" - "GL_FOG\0" - "GL_FOG_BIT\0" - "GL_FOG_COLOR\0" - "GL_FOG_COORD\0" - "GL_FOG_COORDINATE\0" - "GL_FOG_COORDINATE_ARRAY\0" - "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING\0" - "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB\0" - "GL_FOG_COORDINATE_ARRAY_POINTER\0" - "GL_FOG_COORDINATE_ARRAY_STRIDE\0" - "GL_FOG_COORDINATE_ARRAY_TYPE\0" - "GL_FOG_COORDINATE_SOURCE\0" - "GL_FOG_COORD_ARRAY\0" - "GL_FOG_COORD_ARRAY_BUFFER_BINDING\0" - "GL_FOG_COORD_ARRAY_POINTER\0" - "GL_FOG_COORD_ARRAY_STRIDE\0" - "GL_FOG_COORD_ARRAY_TYPE\0" - "GL_FOG_COORD_SRC\0" - "GL_FOG_DENSITY\0" - "GL_FOG_DISTANCE_MODE_NV\0" - "GL_FOG_END\0" - "GL_FOG_HINT\0" - "GL_FOG_INDEX\0" - "GL_FOG_MODE\0" - "GL_FOG_OFFSET_SGIX\0" - "GL_FOG_OFFSET_VALUE_SGIX\0" - "GL_FOG_START\0" - "GL_FRAGMENT_DEPTH\0" - "GL_FRAGMENT_PROGRAM_ARB\0" - "GL_FRAGMENT_SHADER\0" - "GL_FRAGMENT_SHADER_ARB\0" - "GL_FRAGMENT_SHADER_DERIVATIVE_HINT\0" - "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES\0" - "GL_FRAMEBUFFER\0" - "GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE\0" - "GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE\0" - "GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING\0" - "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE\0" - "GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE\0" - "GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE\0" - "GL_FRAMEBUFFER_ATTACHMENT_LAYERED\0" - "GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB\0" - "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME\0" - "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT\0" - "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES\0" - "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE\0" - "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT\0" - "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES\0" - "GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE\0" - "GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT\0" - "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES\0" - "GL_FRAMEBUFFER_BINDING\0" - "GL_FRAMEBUFFER_BINDING_EXT\0" - "GL_FRAMEBUFFER_BINDING_OES\0" - "GL_FRAMEBUFFER_COMPLETE\0" - "GL_FRAMEBUFFER_COMPLETE_EXT\0" - "GL_FRAMEBUFFER_COMPLETE_OES\0" - "GL_FRAMEBUFFER_DEFAULT\0" - "GL_FRAMEBUFFER_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\0" - "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES\0" - "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS\0" - "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES\0" - "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\0" - "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES\0" - "GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES\0" - "GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB\0" - "GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS\0" - "GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB\0" - "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\0" - "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES\0" - "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\0" - "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\0" - "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\0" - "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES\0" - "GL_FRAMEBUFFER_OES\0" - "GL_FRAMEBUFFER_STATUS_ERROR_EXT\0" - "GL_FRAMEBUFFER_UNDEFINED\0" - "GL_FRAMEBUFFER_UNSUPPORTED\0" - "GL_FRAMEBUFFER_UNSUPPORTED_EXT\0" - "GL_FRAMEBUFFER_UNSUPPORTED_OES\0" - "GL_FRONT\0" - "GL_FRONT_AND_BACK\0" - "GL_FRONT_FACE\0" - "GL_FRONT_LEFT\0" - "GL_FRONT_RIGHT\0" - "GL_FUNC_ADD\0" - "GL_FUNC_ADD_EXT\0" - "GL_FUNC_ADD_OES\0" - "GL_FUNC_REVERSE_SUBTRACT\0" - "GL_FUNC_REVERSE_SUBTRACT_EXT\0" - "GL_FUNC_REVERSE_SUBTRACT_OES\0" - "GL_FUNC_SUBTRACT\0" - "GL_FUNC_SUBTRACT_EXT\0" - "GL_FUNC_SUBTRACT_OES\0" - "GL_GENERATE_MIPMAP\0" - "GL_GENERATE_MIPMAP_HINT\0" - "GL_GENERATE_MIPMAP_HINT_SGIS\0" - "GL_GENERATE_MIPMAP_SGIS\0" - "GL_GEOMETRY_INPUT_TYPE\0" - "GL_GEOMETRY_INPUT_TYPE_ARB\0" - "GL_GEOMETRY_OUTPUT_TYPE\0" - "GL_GEOMETRY_OUTPUT_TYPE_ARB\0" - "GL_GEOMETRY_SHADER\0" - "GL_GEOMETRY_SHADER_ARB\0" - "GL_GEOMETRY_VERTICES_OUT\0" - "GL_GEOMETRY_VERTICES_OUT_ARB\0" - "GL_GEQUAL\0" - "GL_GREATER\0" - "GL_GREEN\0" - "GL_GREEN_BIAS\0" - "GL_GREEN_BITS\0" - "GL_GREEN_INTEGER\0" - "GL_GREEN_INTEGER_EXT\0" - "GL_GREEN_SCALE\0" - "GL_HALF_FLOAT\0" - "GL_HALF_FLOAT_OES\0" - "GL_HIGH_FLOAT\0" - "GL_HIGH_INT\0" - "GL_HINT_BIT\0" - "GL_HISTOGRAM\0" - "GL_HISTOGRAM_ALPHA_SIZE\0" - "GL_HISTOGRAM_ALPHA_SIZE_EXT\0" - "GL_HISTOGRAM_BLUE_SIZE\0" - "GL_HISTOGRAM_BLUE_SIZE_EXT\0" - "GL_HISTOGRAM_EXT\0" - "GL_HISTOGRAM_FORMAT\0" - "GL_HISTOGRAM_FORMAT_EXT\0" - "GL_HISTOGRAM_GREEN_SIZE\0" - "GL_HISTOGRAM_GREEN_SIZE_EXT\0" - "GL_HISTOGRAM_LUMINANCE_SIZE\0" - "GL_HISTOGRAM_LUMINANCE_SIZE_EXT\0" - "GL_HISTOGRAM_RED_SIZE\0" - "GL_HISTOGRAM_RED_SIZE_EXT\0" - "GL_HISTOGRAM_SINK\0" - "GL_HISTOGRAM_SINK_EXT\0" - "GL_HISTOGRAM_WIDTH\0" - "GL_HISTOGRAM_WIDTH_EXT\0" - "GL_IDENTITY_NV\0" - "GL_IGNORE_BORDER_HP\0" - "GL_IMPLEMENTATION_COLOR_READ_FORMAT\0" - "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES\0" - "GL_IMPLEMENTATION_COLOR_READ_TYPE\0" - "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES\0" - "GL_INCR\0" - "GL_INCR_WRAP\0" - "GL_INCR_WRAP_EXT\0" - "GL_INDEX\0" - "GL_INDEX_ARRAY\0" - "GL_INDEX_ARRAY_BUFFER_BINDING\0" - "GL_INDEX_ARRAY_BUFFER_BINDING_ARB\0" - "GL_INDEX_ARRAY_POINTER\0" - "GL_INDEX_ARRAY_STRIDE\0" - "GL_INDEX_ARRAY_TYPE\0" - "GL_INDEX_BITS\0" - "GL_INDEX_CLEAR_VALUE\0" - "GL_INDEX_LOGIC_OP\0" - "GL_INDEX_MODE\0" - "GL_INDEX_OFFSET\0" - "GL_INDEX_SHIFT\0" - "GL_INDEX_WRITEMASK\0" - "GL_INFO_LOG_LENGTH\0" - "GL_INT\0" - "GL_INTENSITY\0" - "GL_INTENSITY12\0" - "GL_INTENSITY12_EXT\0" - "GL_INTENSITY16\0" - "GL_INTENSITY16I_EXT\0" - "GL_INTENSITY16UI_EXT\0" - "GL_INTENSITY16_EXT\0" - "GL_INTENSITY32I_EXT\0" - "GL_INTENSITY32UI_EXT\0" - "GL_INTENSITY4\0" - "GL_INTENSITY4_EXT\0" - "GL_INTENSITY8\0" - "GL_INTENSITY8I_EXT\0" - "GL_INTENSITY8UI_EXT\0" - "GL_INTENSITY8_EXT\0" - "GL_INTENSITY_EXT\0" - "GL_INTERLEAVED_ATTRIBS\0" - "GL_INTERLEAVED_ATTRIBS_EXT\0" - "GL_INTERPOLATE\0" - "GL_INTERPOLATE_ARB\0" - "GL_INTERPOLATE_EXT\0" - "GL_INT_10_10_10_2_OES\0" - "GL_INT_SAMPLER_1D\0" - "GL_INT_SAMPLER_1D_ARRAY\0" - "GL_INT_SAMPLER_1D_ARRAY_EXT\0" - "GL_INT_SAMPLER_1D_EXT\0" - "GL_INT_SAMPLER_2D\0" - "GL_INT_SAMPLER_2D_ARRAY\0" - "GL_INT_SAMPLER_2D_ARRAY_EXT\0" - "GL_INT_SAMPLER_2D_EXT\0" - "GL_INT_SAMPLER_2D_RECT\0" - "GL_INT_SAMPLER_2D_RECT_EXT\0" - "GL_INT_SAMPLER_3D\0" - "GL_INT_SAMPLER_3D_EXT\0" - "GL_INT_SAMPLER_BUFFER\0" - "GL_INT_SAMPLER_BUFFER_EXT\0" - "GL_INT_SAMPLER_CUBE\0" - "GL_INT_SAMPLER_CUBE_EXT\0" - "GL_INT_VEC2\0" - "GL_INT_VEC2_ARB\0" - "GL_INT_VEC3\0" - "GL_INT_VEC3_ARB\0" - "GL_INT_VEC4\0" - "GL_INT_VEC4_ARB\0" - "GL_INVALID_ENUM\0" - "GL_INVALID_FRAMEBUFFER_OPERATION\0" - "GL_INVALID_FRAMEBUFFER_OPERATION_EXT\0" - "GL_INVALID_FRAMEBUFFER_OPERATION_OES\0" - "GL_INVALID_OPERATION\0" - "GL_INVALID_VALUE\0" - "GL_INVERSE_NV\0" - "GL_INVERSE_TRANSPOSE_NV\0" - "GL_INVERT\0" - "GL_KEEP\0" - "GL_LAST_VERTEX_CONVENTION\0" - "GL_LAST_VERTEX_CONVENTION_EXT\0" - "GL_LEFT\0" - "GL_LEQUAL\0" - "GL_LESS\0" - "GL_LIGHT0\0" - "GL_LIGHT1\0" - "GL_LIGHT2\0" - "GL_LIGHT3\0" - "GL_LIGHT4\0" - "GL_LIGHT5\0" - "GL_LIGHT6\0" - "GL_LIGHT7\0" - "GL_LIGHTING\0" - "GL_LIGHTING_BIT\0" - "GL_LIGHT_MODEL_AMBIENT\0" - "GL_LIGHT_MODEL_COLOR_CONTROL\0" - "GL_LIGHT_MODEL_COLOR_CONTROL_EXT\0" - "GL_LIGHT_MODEL_LOCAL_VIEWER\0" - "GL_LIGHT_MODEL_TWO_SIDE\0" - "GL_LINE\0" - "GL_LINEAR\0" - "GL_LINEAR_ATTENUATION\0" - "GL_LINEAR_CLIPMAP_LINEAR_SGIX\0" - "GL_LINEAR_CLIPMAP_NEAREST_SGIX\0" - "GL_LINEAR_MIPMAP_LINEAR\0" - "GL_LINEAR_MIPMAP_NEAREST\0" - "GL_LINES\0" - "GL_LINES_ADJACENCY\0" - "GL_LINES_ADJACENCY_ARB\0" - "GL_LINE_BIT\0" - "GL_LINE_LOOP\0" - "GL_LINE_RESET_TOKEN\0" - "GL_LINE_SMOOTH\0" - "GL_LINE_SMOOTH_HINT\0" - "GL_LINE_STIPPLE\0" - "GL_LINE_STIPPLE_PATTERN\0" - "GL_LINE_STIPPLE_REPEAT\0" - "GL_LINE_STRIP\0" - "GL_LINE_STRIP_ADJACENCY\0" - "GL_LINE_STRIP_ADJACENCY_ARB\0" - "GL_LINE_TOKEN\0" - "GL_LINE_WIDTH\0" - "GL_LINE_WIDTH_GRANULARITY\0" - "GL_LINE_WIDTH_RANGE\0" - "GL_LINK_STATUS\0" - "GL_LIST_BASE\0" - "GL_LIST_BIT\0" - "GL_LIST_INDEX\0" - "GL_LIST_MODE\0" - "GL_LOAD\0" - "GL_LOGIC_OP\0" - "GL_LOGIC_OP_MODE\0" - "GL_LOWER_LEFT\0" - "GL_LOW_FLOAT\0" - "GL_LOW_INT\0" - "GL_LUMINANCE\0" - "GL_LUMINANCE12\0" - "GL_LUMINANCE12_ALPHA12\0" - "GL_LUMINANCE12_ALPHA12_EXT\0" - "GL_LUMINANCE12_ALPHA4\0" - "GL_LUMINANCE12_ALPHA4_EXT\0" - "GL_LUMINANCE12_EXT\0" - "GL_LUMINANCE16\0" - "GL_LUMINANCE16I_EXT\0" - "GL_LUMINANCE16UI_EXT\0" - "GL_LUMINANCE16_ALPHA16\0" - "GL_LUMINANCE16_ALPHA16_EXT\0" - "GL_LUMINANCE16_EXT\0" - "GL_LUMINANCE32I_EXT\0" - "GL_LUMINANCE32UI_EXT\0" - "GL_LUMINANCE4\0" - "GL_LUMINANCE4_ALPHA4\0" - "GL_LUMINANCE4_ALPHA4_EXT\0" - "GL_LUMINANCE4_EXT\0" - "GL_LUMINANCE6_ALPHA2\0" - "GL_LUMINANCE6_ALPHA2_EXT\0" - "GL_LUMINANCE8\0" - "GL_LUMINANCE8I_EXT\0" - "GL_LUMINANCE8UI_EXT\0" - "GL_LUMINANCE8_ALPHA8\0" - "GL_LUMINANCE8_ALPHA8_EXT\0" - "GL_LUMINANCE8_EXT\0" - "GL_LUMINANCE_ALPHA\0" - "GL_LUMINANCE_ALPHA16I_EXT\0" - "GL_LUMINANCE_ALPHA16UI_EXT\0" - "GL_LUMINANCE_ALPHA32I_EXT\0" - "GL_LUMINANCE_ALPHA32UI_EXT\0" - "GL_LUMINANCE_ALPHA8I_EXT\0" - "GL_LUMINANCE_ALPHA8UI_EXT\0" - "GL_LUMINANCE_ALPHA_INTEGER_EXT\0" - "GL_LUMINANCE_INTEGER_EXT\0" - "GL_MAJOR_VERSION\0" - "GL_MAP1_COLOR_4\0" - "GL_MAP1_GRID_DOMAIN\0" - "GL_MAP1_GRID_SEGMENTS\0" - "GL_MAP1_INDEX\0" - "GL_MAP1_NORMAL\0" - "GL_MAP1_TEXTURE_COORD_1\0" - "GL_MAP1_TEXTURE_COORD_2\0" - "GL_MAP1_TEXTURE_COORD_3\0" - "GL_MAP1_TEXTURE_COORD_4\0" - "GL_MAP1_VERTEX_3\0" - "GL_MAP1_VERTEX_4\0" - "GL_MAP1_VERTEX_ATTRIB0_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB10_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB11_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB12_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB13_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB14_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB15_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB1_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB2_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB3_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB4_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB5_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB6_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB7_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB8_4_NV\0" - "GL_MAP1_VERTEX_ATTRIB9_4_NV\0" - "GL_MAP2_COLOR_4\0" - "GL_MAP2_GRID_DOMAIN\0" - "GL_MAP2_GRID_SEGMENTS\0" - "GL_MAP2_INDEX\0" - "GL_MAP2_NORMAL\0" - "GL_MAP2_TEXTURE_COORD_1\0" - "GL_MAP2_TEXTURE_COORD_2\0" - "GL_MAP2_TEXTURE_COORD_3\0" - "GL_MAP2_TEXTURE_COORD_4\0" - "GL_MAP2_VERTEX_3\0" - "GL_MAP2_VERTEX_4\0" - "GL_MAP2_VERTEX_ATTRIB0_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB10_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB11_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB12_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB13_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB14_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB15_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB1_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB2_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB3_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB4_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB5_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB6_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB7_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB8_4_NV\0" - "GL_MAP2_VERTEX_ATTRIB9_4_NV\0" - "GL_MAP_COLOR\0" - "GL_MAP_FLUSH_EXPLICIT_BIT\0" - "GL_MAP_INVALIDATE_BUFFER_BIT\0" - "GL_MAP_INVALIDATE_RANGE_BIT\0" - "GL_MAP_READ_BIT\0" - "GL_MAP_STENCIL\0" - "GL_MAP_UNSYNCHRONIZED_BIT\0" - "GL_MAP_WRITE_BIT\0" - "GL_MATRIX0_ARB\0" - "GL_MATRIX0_NV\0" - "GL_MATRIX10_ARB\0" - "GL_MATRIX11_ARB\0" - "GL_MATRIX12_ARB\0" - "GL_MATRIX13_ARB\0" - "GL_MATRIX14_ARB\0" - "GL_MATRIX15_ARB\0" - "GL_MATRIX16_ARB\0" - "GL_MATRIX17_ARB\0" - "GL_MATRIX18_ARB\0" - "GL_MATRIX19_ARB\0" - "GL_MATRIX1_ARB\0" - "GL_MATRIX1_NV\0" - "GL_MATRIX20_ARB\0" - "GL_MATRIX21_ARB\0" - "GL_MATRIX22_ARB\0" - "GL_MATRIX23_ARB\0" - "GL_MATRIX24_ARB\0" - "GL_MATRIX25_ARB\0" - "GL_MATRIX26_ARB\0" - "GL_MATRIX27_ARB\0" - "GL_MATRIX28_ARB\0" - "GL_MATRIX29_ARB\0" - "GL_MATRIX2_ARB\0" - "GL_MATRIX2_NV\0" - "GL_MATRIX30_ARB\0" - "GL_MATRIX31_ARB\0" - "GL_MATRIX3_ARB\0" - "GL_MATRIX3_NV\0" - "GL_MATRIX4_ARB\0" - "GL_MATRIX4_NV\0" - "GL_MATRIX5_ARB\0" - "GL_MATRIX5_NV\0" - "GL_MATRIX6_ARB\0" - "GL_MATRIX6_NV\0" - "GL_MATRIX7_ARB\0" - "GL_MATRIX7_NV\0" - "GL_MATRIX8_ARB\0" - "GL_MATRIX9_ARB\0" - "GL_MATRIX_INDEX_ARRAY_ARB\0" - "GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES\0" - "GL_MATRIX_INDEX_ARRAY_OES\0" - "GL_MATRIX_INDEX_ARRAY_POINTER_ARB\0" - "GL_MATRIX_INDEX_ARRAY_POINTER_OES\0" - "GL_MATRIX_INDEX_ARRAY_SIZE_ARB\0" - "GL_MATRIX_INDEX_ARRAY_SIZE_OES\0" - "GL_MATRIX_INDEX_ARRAY_STRIDE_ARB\0" - "GL_MATRIX_INDEX_ARRAY_STRIDE_OES\0" - "GL_MATRIX_INDEX_ARRAY_TYPE_ARB\0" - "GL_MATRIX_INDEX_ARRAY_TYPE_OES\0" - "GL_MATRIX_MODE\0" - "GL_MATRIX_PALETTE_ARB\0" - "GL_MATRIX_PALETTE_OES\0" - "GL_MAX\0" - "GL_MAX_3D_TEXTURE_SIZE\0" - "GL_MAX_3D_TEXTURE_SIZE_OES\0" - "GL_MAX_ARRAY_TEXTURE_LAYERS\0" - "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT\0" - "GL_MAX_ATTRIB_STACK_DEPTH\0" - "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH\0" - "GL_MAX_CLIPMAP_DEPTH_SGIX\0" - "GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX\0" - "GL_MAX_CLIP_DISTANCES\0" - "GL_MAX_CLIP_PLANES\0" - "GL_MAX_COLOR_ATTACHMENTS\0" - "GL_MAX_COLOR_ATTACHMENTS_EXT\0" - "GL_MAX_COLOR_MATRIX_STACK_DEPTH\0" - "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI\0" - "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS\0" - "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB\0" - "GL_MAX_CONVOLUTION_HEIGHT\0" - "GL_MAX_CONVOLUTION_HEIGHT_EXT\0" - "GL_MAX_CONVOLUTION_WIDTH\0" - "GL_MAX_CONVOLUTION_WIDTH_EXT\0" - "GL_MAX_CUBE_MAP_TEXTURE_SIZE\0" - "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB\0" - "GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES\0" - "GL_MAX_DRAW_BUFFERS\0" - "GL_MAX_DRAW_BUFFERS_ARB\0" - "GL_MAX_DRAW_BUFFERS_ATI\0" - "GL_MAX_ELEMENTS_INDICES\0" - "GL_MAX_ELEMENTS_VERTICES\0" - "GL_MAX_EVAL_ORDER\0" - "GL_MAX_EXT\0" - "GL_MAX_FRAGMENT_INPUT_COMPONENTS\0" - "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS\0" - "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB\0" - "GL_MAX_FRAGMENT_UNIFORM_VECTORS\0" - "GL_MAX_GEOMETRY_INPUT_COMPONENTS\0" - "GL_MAX_GEOMETRY_OUTPUT_COMPONENTS\0" - "GL_MAX_GEOMETRY_OUTPUT_VERTICES\0" - "GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB\0" - "GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS\0" - "GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB\0" - "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS\0" - "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB\0" - "GL_MAX_GEOMETRY_UNIFORM_COMPONENTS\0" - "GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB\0" - "GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB\0" - "GL_MAX_LIGHTS\0" - "GL_MAX_LIST_NESTING\0" - "GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB\0" - "GL_MAX_MODELVIEW_STACK_DEPTH\0" - "GL_MAX_NAME_STACK_DEPTH\0" - "GL_MAX_PALETTE_MATRICES_ARB\0" - "GL_MAX_PALETTE_MATRICES_OES\0" - "GL_MAX_PIXEL_MAP_TABLE\0" - "GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB\0" - "GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB\0" - "GL_MAX_PROGRAM_ATTRIBS_ARB\0" - "GL_MAX_PROGRAM_CALL_DEPTH_NV\0" - "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB\0" - "GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV\0" - "GL_MAX_PROGRAM_IF_DEPTH_NV\0" - "GL_MAX_PROGRAM_INSTRUCTIONS_ARB\0" - "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB\0" - "GL_MAX_PROGRAM_LOOP_COUNT_NV\0" - "GL_MAX_PROGRAM_LOOP_DEPTH_NV\0" - "GL_MAX_PROGRAM_MATRICES_ARB\0" - "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB\0" - "GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB\0" - "GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB\0" - "GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB\0" - "GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB\0" - "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB\0" - "GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB\0" - "GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB\0" - "GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB\0" - "GL_MAX_PROGRAM_PARAMETERS_ARB\0" - "GL_MAX_PROGRAM_TEMPORARIES_ARB\0" - "GL_MAX_PROGRAM_TEXEL_OFFSET\0" - "GL_MAX_PROGRAM_TEXEL_OFFSET_EXT\0" - "GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB\0" - "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB\0" - "GL_MAX_PROJECTION_STACK_DEPTH\0" - "GL_MAX_RECTANGLE_TEXTURE_SIZE\0" - "GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\0" - "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV\0" - "GL_MAX_RENDERBUFFER_SIZE\0" - "GL_MAX_RENDERBUFFER_SIZE_EXT\0" - "GL_MAX_RENDERBUFFER_SIZE_OES\0" - "GL_MAX_SAMPLES\0" - "GL_MAX_SAMPLES_EXT\0" - "GL_MAX_SERVER_WAIT_TIMEOUT\0" - "GL_MAX_SHININESS_NV\0" - "GL_MAX_SPOT_EXPONENT_NV\0" - "GL_MAX_TEXTURE_BUFFER_SIZE\0" - "GL_MAX_TEXTURE_COORDS\0" - "GL_MAX_TEXTURE_COORDS_ARB\0" - "GL_MAX_TEXTURE_IMAGE_UNITS\0" - "GL_MAX_TEXTURE_IMAGE_UNITS_ARB\0" - "GL_MAX_TEXTURE_LOD_BIAS\0" - "GL_MAX_TEXTURE_LOD_BIAS_EXT\0" - "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT\0" - "GL_MAX_TEXTURE_SIZE\0" - "GL_MAX_TEXTURE_STACK_DEPTH\0" - "GL_MAX_TEXTURE_UNITS\0" - "GL_MAX_TEXTURE_UNITS_ARB\0" - "GL_MAX_TRACK_MATRICES_NV\0" - "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0" - "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS\0" - "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT\0" - "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS\0" - "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT\0" - "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS\0" - "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT\0" - "GL_MAX_VARYING_COMPONENTS\0" - "GL_MAX_VARYING_FLOATS\0" - "GL_MAX_VARYING_FLOATS_ARB\0" - "GL_MAX_VARYING_VECTORS\0" - "GL_MAX_VERTEX_ATTRIBS\0" - "GL_MAX_VERTEX_ATTRIBS_ARB\0" - "GL_MAX_VERTEX_OUTPUT_COMPONENTS\0" - "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS\0" - "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0" - "GL_MAX_VERTEX_UNIFORM_COMPONENTS\0" - "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB\0" - "GL_MAX_VERTEX_UNIFORM_VECTORS\0" - "GL_MAX_VERTEX_UNITS_ARB\0" - "GL_MAX_VERTEX_UNITS_OES\0" - "GL_MAX_VERTEX_VARYING_COMPONENTS_ARB\0" - "GL_MAX_VIEWPORT_DIMS\0" - "GL_MEDIUM_FLOAT\0" - "GL_MEDIUM_INT\0" - "GL_MIN\0" - "GL_MINMAX\0" - "GL_MINMAX_EXT\0" - "GL_MINMAX_FORMAT\0" - "GL_MINMAX_FORMAT_EXT\0" - "GL_MINMAX_SINK\0" - "GL_MINMAX_SINK_EXT\0" - "GL_MINOR_VERSION\0" - "GL_MIN_EXT\0" - "GL_MIN_PROGRAM_TEXEL_OFFSET\0" - "GL_MIN_PROGRAM_TEXEL_OFFSET_EXT\0" - "GL_MIRRORED_REPEAT\0" - "GL_MIRRORED_REPEAT_ARB\0" - "GL_MIRRORED_REPEAT_IBM\0" - "GL_MIRROR_CLAMP_ATI\0" - "GL_MIRROR_CLAMP_EXT\0" - "GL_MIRROR_CLAMP_TO_BORDER_EXT\0" - "GL_MIRROR_CLAMP_TO_EDGE_ATI\0" - "GL_MIRROR_CLAMP_TO_EDGE_EXT\0" - "GL_MODELVIEW\0" - "GL_MODELVIEW0_ARB\0" - "GL_MODELVIEW10_ARB\0" - "GL_MODELVIEW11_ARB\0" - "GL_MODELVIEW12_ARB\0" - "GL_MODELVIEW13_ARB\0" - "GL_MODELVIEW14_ARB\0" - "GL_MODELVIEW15_ARB\0" - "GL_MODELVIEW16_ARB\0" - "GL_MODELVIEW17_ARB\0" - "GL_MODELVIEW18_ARB\0" - "GL_MODELVIEW19_ARB\0" - "GL_MODELVIEW1_ARB\0" - "GL_MODELVIEW20_ARB\0" - "GL_MODELVIEW21_ARB\0" - "GL_MODELVIEW22_ARB\0" - "GL_MODELVIEW23_ARB\0" - "GL_MODELVIEW24_ARB\0" - "GL_MODELVIEW25_ARB\0" - "GL_MODELVIEW26_ARB\0" - "GL_MODELVIEW27_ARB\0" - "GL_MODELVIEW28_ARB\0" - "GL_MODELVIEW29_ARB\0" - "GL_MODELVIEW2_ARB\0" - "GL_MODELVIEW30_ARB\0" - "GL_MODELVIEW31_ARB\0" - "GL_MODELVIEW3_ARB\0" - "GL_MODELVIEW4_ARB\0" - "GL_MODELVIEW5_ARB\0" - "GL_MODELVIEW6_ARB\0" - "GL_MODELVIEW7_ARB\0" - "GL_MODELVIEW8_ARB\0" - "GL_MODELVIEW9_ARB\0" - "GL_MODELVIEW_MATRIX\0" - "GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES\0" - "GL_MODELVIEW_PROJECTION_NV\0" - "GL_MODELVIEW_STACK_DEPTH\0" - "GL_MODULATE\0" - "GL_MODULATE_ADD_ATI\0" - "GL_MODULATE_SIGNED_ADD_ATI\0" - "GL_MODULATE_SUBTRACT_ATI\0" - "GL_MULT\0" - "GL_MULTISAMPLE\0" - "GL_MULTISAMPLE_3DFX\0" - "GL_MULTISAMPLE_ARB\0" - "GL_MULTISAMPLE_BIT\0" - "GL_MULTISAMPLE_BIT_3DFX\0" - "GL_MULTISAMPLE_BIT_ARB\0" - "GL_MULTISAMPLE_FILTER_HINT_NV\0" - "GL_N3F_V3F\0" - "GL_NAME_STACK_DEPTH\0" - "GL_NAND\0" - "GL_NEAREST\0" - "GL_NEAREST_CLIPMAP_LINEAR_SGIX\0" - "GL_NEAREST_CLIPMAP_NEAREST_SGIX\0" - "GL_NEAREST_MIPMAP_LINEAR\0" - "GL_NEAREST_MIPMAP_NEAREST\0" - "GL_NEVER\0" - "GL_NICEST\0" - "GL_NONE\0" - "GL_NONE_OES\0" - "GL_NOOP\0" - "GL_NOR\0" - "GL_NORMALIZE\0" - "GL_NORMAL_ARRAY\0" - "GL_NORMAL_ARRAY_BUFFER_BINDING\0" - "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB\0" - "GL_NORMAL_ARRAY_POINTER\0" - "GL_NORMAL_ARRAY_STRIDE\0" - "GL_NORMAL_ARRAY_TYPE\0" - "GL_NORMAL_MAP\0" - "GL_NORMAL_MAP_ARB\0" - "GL_NORMAL_MAP_NV\0" - "GL_NORMAL_MAP_OES\0" - "GL_NOTEQUAL\0" - "GL_NO_ERROR\0" - "GL_NUM_COMPRESSED_TEXTURE_FORMATS\0" - "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB\0" - "GL_NUM_EXTENSIONS\0" - "GL_NUM_PROGRAM_BINARY_FORMATS_OES\0" - "GL_NUM_SHADER_BINARY_FORMATS\0" - "GL_OBJECT_ACTIVE_ATTRIBUTES_ARB\0" - "GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB\0" - "GL_OBJECT_ACTIVE_UNIFORMS_ARB\0" - "GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB\0" - "GL_OBJECT_ATTACHED_OBJECTS_ARB\0" - "GL_OBJECT_COMPILE_STATUS_ARB\0" - "GL_OBJECT_DELETE_STATUS_ARB\0" - "GL_OBJECT_INFO_LOG_LENGTH_ARB\0" - "GL_OBJECT_LINEAR\0" - "GL_OBJECT_LINK_STATUS_ARB\0" - "GL_OBJECT_PLANE\0" - "GL_OBJECT_SHADER_SOURCE_LENGTH_ARB\0" - "GL_OBJECT_SUBTYPE_ARB\0" - "GL_OBJECT_TYPE\0" - "GL_OBJECT_TYPE_ARB\0" - "GL_OBJECT_VALIDATE_STATUS_ARB\0" - "GL_OCCLUSION_TEST_HP\0" - "GL_OCCLUSION_TEST_RESULT_HP\0" - "GL_ONE\0" - "GL_ONE_MINUS_CONSTANT_ALPHA\0" - "GL_ONE_MINUS_CONSTANT_ALPHA_EXT\0" - "GL_ONE_MINUS_CONSTANT_COLOR\0" - "GL_ONE_MINUS_CONSTANT_COLOR_EXT\0" - "GL_ONE_MINUS_DST_ALPHA\0" - "GL_ONE_MINUS_DST_COLOR\0" - "GL_ONE_MINUS_SRC_ALPHA\0" - "GL_ONE_MINUS_SRC_COLOR\0" - "GL_OPERAND0_ALPHA\0" - "GL_OPERAND0_ALPHA_ARB\0" - "GL_OPERAND0_ALPHA_EXT\0" - "GL_OPERAND0_RGB\0" - "GL_OPERAND0_RGB_ARB\0" - "GL_OPERAND0_RGB_EXT\0" - "GL_OPERAND1_ALPHA\0" - "GL_OPERAND1_ALPHA_ARB\0" - "GL_OPERAND1_ALPHA_EXT\0" - "GL_OPERAND1_RGB\0" - "GL_OPERAND1_RGB_ARB\0" - "GL_OPERAND1_RGB_EXT\0" - "GL_OPERAND2_ALPHA\0" - "GL_OPERAND2_ALPHA_ARB\0" - "GL_OPERAND2_ALPHA_EXT\0" - "GL_OPERAND2_RGB\0" - "GL_OPERAND2_RGB_ARB\0" - "GL_OPERAND2_RGB_EXT\0" - "GL_OPERAND3_ALPHA_NV\0" - "GL_OPERAND3_RGB_NV\0" - "GL_OR\0" - "GL_ORDER\0" - "GL_OR_INVERTED\0" - "GL_OR_REVERSE\0" - "GL_OUT_OF_MEMORY\0" - "GL_PACK_ALIGNMENT\0" - "GL_PACK_IMAGE_HEIGHT\0" - "GL_PACK_INVERT_MESA\0" - "GL_PACK_LSB_FIRST\0" - "GL_PACK_ROW_LENGTH\0" - "GL_PACK_SKIP_IMAGES\0" - "GL_PACK_SKIP_PIXELS\0" - "GL_PACK_SKIP_ROWS\0" - "GL_PACK_SWAP_BYTES\0" - "GL_PALETTE4_R5_G6_B5_OES\0" - "GL_PALETTE4_RGB5_A1_OES\0" - "GL_PALETTE4_RGB8_OES\0" - "GL_PALETTE4_RGBA4_OES\0" - "GL_PALETTE4_RGBA8_OES\0" - "GL_PALETTE8_R5_G6_B5_OES\0" - "GL_PALETTE8_RGB5_A1_OES\0" - "GL_PALETTE8_RGB8_OES\0" - "GL_PALETTE8_RGBA4_OES\0" - "GL_PALETTE8_RGBA8_OES\0" - "GL_PASS_THROUGH_TOKEN\0" - "GL_PERSPECTIVE_CORRECTION_HINT\0" - "GL_PIXEL_MAP_A_TO_A\0" - "GL_PIXEL_MAP_A_TO_A_SIZE\0" - "GL_PIXEL_MAP_B_TO_B\0" - "GL_PIXEL_MAP_B_TO_B_SIZE\0" - "GL_PIXEL_MAP_G_TO_G\0" - "GL_PIXEL_MAP_G_TO_G_SIZE\0" - "GL_PIXEL_MAP_I_TO_A\0" - "GL_PIXEL_MAP_I_TO_A_SIZE\0" - "GL_PIXEL_MAP_I_TO_B\0" - "GL_PIXEL_MAP_I_TO_B_SIZE\0" - "GL_PIXEL_MAP_I_TO_G\0" - "GL_PIXEL_MAP_I_TO_G_SIZE\0" - "GL_PIXEL_MAP_I_TO_I\0" - "GL_PIXEL_MAP_I_TO_I_SIZE\0" - "GL_PIXEL_MAP_I_TO_R\0" - "GL_PIXEL_MAP_I_TO_R_SIZE\0" - "GL_PIXEL_MAP_R_TO_R\0" - "GL_PIXEL_MAP_R_TO_R_SIZE\0" - "GL_PIXEL_MAP_S_TO_S\0" - "GL_PIXEL_MAP_S_TO_S_SIZE\0" - "GL_PIXEL_MODE_BIT\0" - "GL_PIXEL_PACK_BUFFER\0" - "GL_PIXEL_PACK_BUFFER_BINDING\0" - "GL_PIXEL_PACK_BUFFER_BINDING_EXT\0" - "GL_PIXEL_PACK_BUFFER_EXT\0" - "GL_PIXEL_UNPACK_BUFFER\0" - "GL_PIXEL_UNPACK_BUFFER_BINDING\0" - "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT\0" - "GL_PIXEL_UNPACK_BUFFER_EXT\0" - "GL_POINT\0" - "GL_POINTS\0" - "GL_POINT_BIT\0" - "GL_POINT_DISTANCE_ATTENUATION\0" - "GL_POINT_DISTANCE_ATTENUATION_ARB\0" - "GL_POINT_DISTANCE_ATTENUATION_EXT\0" - "GL_POINT_DISTANCE_ATTENUATION_SGIS\0" - "GL_POINT_FADE_THRESHOLD_SIZE\0" - "GL_POINT_FADE_THRESHOLD_SIZE_ARB\0" - "GL_POINT_FADE_THRESHOLD_SIZE_EXT\0" - "GL_POINT_FADE_THRESHOLD_SIZE_SGIS\0" - "GL_POINT_SIZE\0" - "GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES\0" - "GL_POINT_SIZE_ARRAY_OES\0" - "GL_POINT_SIZE_ARRAY_POINTER_OES\0" - "GL_POINT_SIZE_ARRAY_STRIDE_OES\0" - "GL_POINT_SIZE_ARRAY_TYPE_OES\0" - "GL_POINT_SIZE_GRANULARITY\0" - "GL_POINT_SIZE_MAX\0" - "GL_POINT_SIZE_MAX_ARB\0" - "GL_POINT_SIZE_MAX_EXT\0" - "GL_POINT_SIZE_MAX_SGIS\0" - "GL_POINT_SIZE_MIN\0" - "GL_POINT_SIZE_MIN_ARB\0" - "GL_POINT_SIZE_MIN_EXT\0" - "GL_POINT_SIZE_MIN_SGIS\0" - "GL_POINT_SIZE_RANGE\0" - "GL_POINT_SMOOTH\0" - "GL_POINT_SMOOTH_HINT\0" - "GL_POINT_SPRITE\0" - "GL_POINT_SPRITE_ARB\0" - "GL_POINT_SPRITE_COORD_ORIGIN\0" - "GL_POINT_SPRITE_NV\0" - "GL_POINT_SPRITE_OES\0" - "GL_POINT_SPRITE_R_MODE_NV\0" - "GL_POINT_TOKEN\0" - "GL_POLYGON\0" - "GL_POLYGON_BIT\0" - "GL_POLYGON_MODE\0" - "GL_POLYGON_OFFSET_BIAS\0" - "GL_POLYGON_OFFSET_FACTOR\0" - "GL_POLYGON_OFFSET_FILL\0" - "GL_POLYGON_OFFSET_LINE\0" - "GL_POLYGON_OFFSET_POINT\0" - "GL_POLYGON_OFFSET_UNITS\0" - "GL_POLYGON_SMOOTH\0" - "GL_POLYGON_SMOOTH_HINT\0" - "GL_POLYGON_STIPPLE\0" - "GL_POLYGON_STIPPLE_BIT\0" - "GL_POLYGON_TOKEN\0" - "GL_POSITION\0" - "GL_POST_COLOR_MATRIX_ALPHA_BIAS\0" - "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI\0" - "GL_POST_COLOR_MATRIX_ALPHA_SCALE\0" - "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI\0" - "GL_POST_COLOR_MATRIX_BLUE_BIAS\0" - "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI\0" - "GL_POST_COLOR_MATRIX_BLUE_SCALE\0" - "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI\0" - "GL_POST_COLOR_MATRIX_COLOR_TABLE\0" - "GL_POST_COLOR_MATRIX_GREEN_BIAS\0" - "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI\0" - "GL_POST_COLOR_MATRIX_GREEN_SCALE\0" - "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI\0" - "GL_POST_COLOR_MATRIX_RED_BIAS\0" - "GL_POST_COLOR_MATRIX_RED_BIAS_SGI\0" - "GL_POST_COLOR_MATRIX_RED_SCALE\0" - "GL_POST_COLOR_MATRIX_RED_SCALE_SGI\0" - "GL_POST_CONVOLUTION_ALPHA_BIAS\0" - "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT\0" - "GL_POST_CONVOLUTION_ALPHA_SCALE\0" - "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT\0" - "GL_POST_CONVOLUTION_BLUE_BIAS\0" - "GL_POST_CONVOLUTION_BLUE_BIAS_EXT\0" - "GL_POST_CONVOLUTION_BLUE_SCALE\0" - "GL_POST_CONVOLUTION_BLUE_SCALE_EXT\0" - "GL_POST_CONVOLUTION_COLOR_TABLE\0" - "GL_POST_CONVOLUTION_GREEN_BIAS\0" - "GL_POST_CONVOLUTION_GREEN_BIAS_EXT\0" - "GL_POST_CONVOLUTION_GREEN_SCALE\0" - "GL_POST_CONVOLUTION_GREEN_SCALE_EXT\0" - "GL_POST_CONVOLUTION_RED_BIAS\0" - "GL_POST_CONVOLUTION_RED_BIAS_EXT\0" - "GL_POST_CONVOLUTION_RED_SCALE\0" - "GL_POST_CONVOLUTION_RED_SCALE_EXT\0" - "GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX\0" - "GL_POST_TEXTURE_FILTER_BIAS_SGIX\0" - "GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX\0" - "GL_POST_TEXTURE_FILTER_SCALE_SGIX\0" - "GL_PREVIOUS\0" - "GL_PREVIOUS_ARB\0" - "GL_PREVIOUS_EXT\0" - "GL_PRIMARY_COLOR\0" - "GL_PRIMARY_COLOR_ARB\0" - "GL_PRIMARY_COLOR_EXT\0" - "GL_PRIMITIVES_GENERATED\0" - "GL_PRIMITIVES_GENERATED_EXT\0" - "GL_PRIMITIVE_RESTART\0" - "GL_PRIMITIVE_RESTART_INDEX\0" - "GL_PRIMITIVE_RESTART_INDEX_NV\0" - "GL_PRIMITIVE_RESTART_NV\0" - "GL_PROGRAM_ADDRESS_REGISTERS_ARB\0" - "GL_PROGRAM_ALU_INSTRUCTIONS_ARB\0" - "GL_PROGRAM_ATTRIBS_ARB\0" - "GL_PROGRAM_BINARY_FORMATS_OES\0" - "GL_PROGRAM_BINARY_LENGTH_OES\0" - "GL_PROGRAM_BINDING_ARB\0" - "GL_PROGRAM_ERROR_POSITION_ARB\0" - "GL_PROGRAM_ERROR_POSITION_NV\0" - "GL_PROGRAM_ERROR_STRING_ARB\0" - "GL_PROGRAM_FORMAT_ARB\0" - "GL_PROGRAM_FORMAT_ASCII_ARB\0" - "GL_PROGRAM_INSTRUCTIONS_ARB\0" - "GL_PROGRAM_LENGTH_ARB\0" - "GL_PROGRAM_LENGTH_NV\0" - "GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB\0" - "GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB\0" - "GL_PROGRAM_NATIVE_ATTRIBS_ARB\0" - "GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB\0" - "GL_PROGRAM_NATIVE_PARAMETERS_ARB\0" - "GL_PROGRAM_NATIVE_TEMPORARIES_ARB\0" - "GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB\0" - "GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB\0" - "GL_PROGRAM_OBJECT_ARB\0" - "GL_PROGRAM_PARAMETERS_ARB\0" - "GL_PROGRAM_PARAMETER_NV\0" - "GL_PROGRAM_POINT_SIZE\0" - "GL_PROGRAM_POINT_SIZE_ARB\0" - "GL_PROGRAM_RESIDENT_NV\0" - "GL_PROGRAM_STRING_ARB\0" - "GL_PROGRAM_STRING_NV\0" - "GL_PROGRAM_TARGET_NV\0" - "GL_PROGRAM_TEMPORARIES_ARB\0" - "GL_PROGRAM_TEX_INDIRECTIONS_ARB\0" - "GL_PROGRAM_TEX_INSTRUCTIONS_ARB\0" - "GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB\0" - "GL_PROJECTION\0" - "GL_PROJECTION_MATRIX\0" - "GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES\0" - "GL_PROJECTION_STACK_DEPTH\0" - "GL_PROVOKING_VERTEX\0" - "GL_PROVOKING_VERTEX_EXT\0" - "GL_PROXY_COLOR_TABLE\0" - "GL_PROXY_HISTOGRAM\0" - "GL_PROXY_HISTOGRAM_EXT\0" - "GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE\0" - "GL_PROXY_POST_CONVOLUTION_COLOR_TABLE\0" - "GL_PROXY_TEXTURE_1D\0" - "GL_PROXY_TEXTURE_1D_ARRAY\0" - "GL_PROXY_TEXTURE_1D_ARRAY_EXT\0" - "GL_PROXY_TEXTURE_1D_EXT\0" - "GL_PROXY_TEXTURE_2D\0" - "GL_PROXY_TEXTURE_2D_ARRAY\0" - "GL_PROXY_TEXTURE_2D_ARRAY_EXT\0" - "GL_PROXY_TEXTURE_2D_EXT\0" - "GL_PROXY_TEXTURE_3D\0" - "GL_PROXY_TEXTURE_COLOR_TABLE_SGI\0" - "GL_PROXY_TEXTURE_CUBE_MAP\0" - "GL_PROXY_TEXTURE_CUBE_MAP_ARB\0" - "GL_PROXY_TEXTURE_RECTANGLE\0" - "GL_PROXY_TEXTURE_RECTANGLE_ARB\0" - "GL_PROXY_TEXTURE_RECTANGLE_NV\0" - "GL_PURGEABLE_APPLE\0" - "GL_Q\0" - "GL_QUADRATIC_ATTENUATION\0" - "GL_QUADS\0" - "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION\0" - "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT\0" - "GL_QUAD_MESH_SUN\0" - "GL_QUAD_STRIP\0" - "GL_QUERY_BY_REGION_NO_WAIT\0" - "GL_QUERY_BY_REGION_NO_WAIT_NV\0" - "GL_QUERY_BY_REGION_WAIT\0" - "GL_QUERY_BY_REGION_WAIT_NV\0" - "GL_QUERY_COUNTER_BITS\0" - "GL_QUERY_COUNTER_BITS_ARB\0" - "GL_QUERY_NO_WAIT\0" - "GL_QUERY_NO_WAIT_NV\0" - "GL_QUERY_RESULT\0" - "GL_QUERY_RESULT_ARB\0" - "GL_QUERY_RESULT_AVAILABLE\0" - "GL_QUERY_RESULT_AVAILABLE_ARB\0" - "GL_QUERY_WAIT\0" - "GL_QUERY_WAIT_NV\0" - "GL_R\0" - "GL_R11F_G11F_B10F\0" - "GL_R16_SNORM\0" - "GL_R3_G3_B2\0" - "GL_R8_SNORM\0" - "GL_RASTERIZER_DISCARD\0" - "GL_RASTERIZER_DISCARD_EXT\0" - "GL_RASTER_POSITION_UNCLIPPED_IBM\0" - "GL_READ_BUFFER\0" - "GL_READ_FRAMEBUFFER\0" - "GL_READ_FRAMEBUFFER_BINDING\0" - "GL_READ_FRAMEBUFFER_BINDING_EXT\0" - "GL_READ_FRAMEBUFFER_EXT\0" - "GL_READ_ONLY\0" - "GL_READ_ONLY_ARB\0" - "GL_READ_WRITE\0" - "GL_READ_WRITE_ARB\0" - "GL_RED\0" - "GL_REDUCE\0" - "GL_REDUCE_EXT\0" - "GL_RED_BIAS\0" - "GL_RED_BITS\0" - "GL_RED_INTEGER\0" - "GL_RED_INTEGER_EXT\0" - "GL_RED_SCALE\0" - "GL_RED_SNORM\0" - "GL_REFLECTION_MAP\0" - "GL_REFLECTION_MAP_ARB\0" - "GL_REFLECTION_MAP_NV\0" - "GL_REFLECTION_MAP_OES\0" - "GL_RELEASED_APPLE\0" - "GL_RENDER\0" - "GL_RENDERBUFFER\0" - "GL_RENDERBUFFER_ALPHA_SIZE\0" - "GL_RENDERBUFFER_ALPHA_SIZE_OES\0" - "GL_RENDERBUFFER_BINDING\0" - "GL_RENDERBUFFER_BINDING_EXT\0" - "GL_RENDERBUFFER_BINDING_OES\0" - "GL_RENDERBUFFER_BLUE_SIZE\0" - "GL_RENDERBUFFER_BLUE_SIZE_OES\0" - "GL_RENDERBUFFER_DEPTH_SIZE\0" - "GL_RENDERBUFFER_DEPTH_SIZE_OES\0" - "GL_RENDERBUFFER_EXT\0" - "GL_RENDERBUFFER_GREEN_SIZE\0" - "GL_RENDERBUFFER_GREEN_SIZE_OES\0" - "GL_RENDERBUFFER_HEIGHT\0" - "GL_RENDERBUFFER_HEIGHT_EXT\0" - "GL_RENDERBUFFER_HEIGHT_OES\0" - "GL_RENDERBUFFER_INTERNAL_FORMAT\0" - "GL_RENDERBUFFER_INTERNAL_FORMAT_EXT\0" - "GL_RENDERBUFFER_INTERNAL_FORMAT_OES\0" - "GL_RENDERBUFFER_OES\0" - "GL_RENDERBUFFER_RED_SIZE\0" - "GL_RENDERBUFFER_RED_SIZE_OES\0" - "GL_RENDERBUFFER_SAMPLES\0" - "GL_RENDERBUFFER_SAMPLES_EXT\0" - "GL_RENDERBUFFER_STENCIL_SIZE\0" - "GL_RENDERBUFFER_STENCIL_SIZE_OES\0" - "GL_RENDERBUFFER_WIDTH\0" - "GL_RENDERBUFFER_WIDTH_EXT\0" - "GL_RENDERBUFFER_WIDTH_OES\0" - "GL_RENDERER\0" - "GL_RENDER_MODE\0" - "GL_REPEAT\0" - "GL_REPLACE\0" - "GL_REPLACE_EXT\0" - "GL_REPLICATE_BORDER_HP\0" - "GL_RESCALE_NORMAL\0" - "GL_RESCALE_NORMAL_EXT\0" - "GL_RETAINED_APPLE\0" - "GL_RETURN\0" - "GL_RG16_SNORM\0" - "GL_RG8_SNORM\0" - "GL_RGB\0" - "GL_RGB10\0" - "GL_RGB10_A2\0" - "GL_RGB10_A2_EXT\0" - "GL_RGB10_EXT\0" - "GL_RGB12\0" - "GL_RGB12_EXT\0" - "GL_RGB16\0" - "GL_RGB16F\0" - "GL_RGB16I\0" - "GL_RGB16I_EXT\0" - "GL_RGB16UI\0" - "GL_RGB16UI_EXT\0" - "GL_RGB16_EXT\0" - "GL_RGB16_SNORM\0" - "GL_RGB2_EXT\0" - "GL_RGB32F\0" - "GL_RGB32I\0" - "GL_RGB32I_EXT\0" - "GL_RGB32UI\0" - "GL_RGB32UI_EXT\0" - "GL_RGB4\0" - "GL_RGB4_EXT\0" - "GL_RGB4_S3TC\0" - "GL_RGB5\0" - "GL_RGB565\0" - "GL_RGB565_OES\0" - "GL_RGB5_A1\0" - "GL_RGB5_A1_EXT\0" - "GL_RGB5_A1_OES\0" - "GL_RGB5_EXT\0" - "GL_RGB8\0" - "GL_RGB8I\0" - "GL_RGB8I_EXT\0" - "GL_RGB8UI\0" - "GL_RGB8UI_EXT\0" - "GL_RGB8_EXT\0" - "GL_RGB8_OES\0" - "GL_RGB8_SNORM\0" - "GL_RGB9_E5\0" - "GL_RGBA\0" - "GL_RGBA12\0" - "GL_RGBA12_EXT\0" - "GL_RGBA16\0" - "GL_RGBA16F\0" - "GL_RGBA16I\0" - "GL_RGBA16I_EXT\0" - "GL_RGBA16UI\0" - "GL_RGBA16UI_EXT\0" - "GL_RGBA16_EXT\0" - "GL_RGBA16_SNORM\0" - "GL_RGBA2\0" - "GL_RGBA2_EXT\0" - "GL_RGBA32F\0" - "GL_RGBA32I\0" - "GL_RGBA32I_EXT\0" - "GL_RGBA32UI\0" - "GL_RGBA32UI_EXT\0" - "GL_RGBA4\0" - "GL_RGBA4_DXT5_S3TC\0" - "GL_RGBA4_EXT\0" - "GL_RGBA4_OES\0" - "GL_RGBA4_S3TC\0" - "GL_RGBA8\0" - "GL_RGBA8I\0" - "GL_RGBA8I_EXT\0" - "GL_RGBA8UI\0" - "GL_RGBA8UI_EXT\0" - "GL_RGBA8_EXT\0" - "GL_RGBA8_OES\0" - "GL_RGBA8_SNORM\0" - "GL_RGBA_DXT5_S3TC\0" - "GL_RGBA_INTEGER\0" - "GL_RGBA_INTEGER_EXT\0" - "GL_RGBA_INTEGER_MODE_EXT\0" - "GL_RGBA_MODE\0" - "GL_RGBA_S3TC\0" - "GL_RGBA_SNORM\0" - "GL_RGB_INTEGER\0" - "GL_RGB_INTEGER_EXT\0" - "GL_RGB_S3TC\0" - "GL_RGB_SCALE\0" - "GL_RGB_SCALE_ARB\0" - "GL_RGB_SCALE_EXT\0" - "GL_RGB_SNORM\0" - "GL_RG_SNORM\0" - "GL_RIGHT\0" - "GL_S\0" - "GL_SAMPLER_1D\0" - "GL_SAMPLER_1D_ARRAY\0" - "GL_SAMPLER_1D_ARRAY_EXT\0" - "GL_SAMPLER_1D_ARRAY_SHADOW\0" - "GL_SAMPLER_1D_ARRAY_SHADOW_EXT\0" - "GL_SAMPLER_1D_SHADOW\0" - "GL_SAMPLER_2D\0" - "GL_SAMPLER_2D_ARRAY\0" - "GL_SAMPLER_2D_ARRAY_EXT\0" - "GL_SAMPLER_2D_ARRAY_SHADOW\0" - "GL_SAMPLER_2D_ARRAY_SHADOW_EXT\0" - "GL_SAMPLER_2D_RECT\0" - "GL_SAMPLER_2D_RECT_SHADOW\0" - "GL_SAMPLER_2D_SHADOW\0" - "GL_SAMPLER_3D\0" - "GL_SAMPLER_3D_OES\0" - "GL_SAMPLER_BUFFER\0" - "GL_SAMPLER_BUFFER_EXT\0" - "GL_SAMPLER_CUBE\0" - "GL_SAMPLER_CUBE_SHADOW\0" - "GL_SAMPLER_CUBE_SHADOW_EXT\0" - "GL_SAMPLES\0" - "GL_SAMPLES_3DFX\0" - "GL_SAMPLES_ARB\0" - "GL_SAMPLES_PASSED\0" - "GL_SAMPLES_PASSED_ARB\0" - "GL_SAMPLE_ALPHA_TO_COVERAGE\0" - "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB\0" - "GL_SAMPLE_ALPHA_TO_ONE\0" - "GL_SAMPLE_ALPHA_TO_ONE_ARB\0" - "GL_SAMPLE_BUFFERS\0" - "GL_SAMPLE_BUFFERS_3DFX\0" - "GL_SAMPLE_BUFFERS_ARB\0" - "GL_SAMPLE_COVERAGE\0" - "GL_SAMPLE_COVERAGE_ARB\0" - "GL_SAMPLE_COVERAGE_INVERT\0" - "GL_SAMPLE_COVERAGE_INVERT_ARB\0" - "GL_SAMPLE_COVERAGE_VALUE\0" - "GL_SAMPLE_COVERAGE_VALUE_ARB\0" - "GL_SCISSOR_BIT\0" - "GL_SCISSOR_BOX\0" - "GL_SCISSOR_TEST\0" - "GL_SECONDARY_COLOR_ARRAY\0" - "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING\0" - "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB\0" - "GL_SECONDARY_COLOR_ARRAY_POINTER\0" - "GL_SECONDARY_COLOR_ARRAY_SIZE\0" - "GL_SECONDARY_COLOR_ARRAY_STRIDE\0" - "GL_SECONDARY_COLOR_ARRAY_TYPE\0" - "GL_SELECT\0" - "GL_SELECTION_BUFFER_POINTER\0" - "GL_SELECTION_BUFFER_SIZE\0" - "GL_SEPARABLE_2D\0" - "GL_SEPARATE_ATTRIBS\0" - "GL_SEPARATE_ATTRIBS_EXT\0" - "GL_SEPARATE_SPECULAR_COLOR\0" - "GL_SEPARATE_SPECULAR_COLOR_EXT\0" - "GL_SET\0" - "GL_SHADER_BINARY_FORMATS\0" - "GL_SHADER_COMPILER\0" - "GL_SHADER_OBJECT_ARB\0" - "GL_SHADER_SOURCE_LENGTH\0" - "GL_SHADER_TYPE\0" - "GL_SHADE_MODEL\0" - "GL_SHADING_LANGUAGE_VERSION\0" - "GL_SHADOW_AMBIENT_SGIX\0" - "GL_SHARED_TEXTURE_PALETTE_EXT\0" - "GL_SHININESS\0" - "GL_SHORT\0" - "GL_SIGNALED\0" - "GL_SIGNED_NORMALIZED\0" - "GL_SINGLE_COLOR\0" - "GL_SINGLE_COLOR_EXT\0" - "GL_SLICE_ACCUM_SUN\0" - "GL_SLUMINANCE\0" - "GL_SLUMINANCE8\0" - "GL_SLUMINANCE8_ALPHA8\0" - "GL_SLUMINANCE_ALPHA\0" - "GL_SMOOTH\0" - "GL_SMOOTH_LINE_WIDTH_GRANULARITY\0" - "GL_SMOOTH_LINE_WIDTH_RANGE\0" - "GL_SMOOTH_POINT_SIZE_GRANULARITY\0" - "GL_SMOOTH_POINT_SIZE_RANGE\0" - "GL_SOURCE0_ALPHA\0" - "GL_SOURCE0_ALPHA_ARB\0" - "GL_SOURCE0_ALPHA_EXT\0" - "GL_SOURCE0_RGB\0" - "GL_SOURCE0_RGB_ARB\0" - "GL_SOURCE0_RGB_EXT\0" - "GL_SOURCE1_ALPHA\0" - "GL_SOURCE1_ALPHA_ARB\0" - "GL_SOURCE1_ALPHA_EXT\0" - "GL_SOURCE1_RGB\0" - "GL_SOURCE1_RGB_ARB\0" - "GL_SOURCE1_RGB_EXT\0" - "GL_SOURCE2_ALPHA\0" - "GL_SOURCE2_ALPHA_ARB\0" - "GL_SOURCE2_ALPHA_EXT\0" - "GL_SOURCE2_RGB\0" - "GL_SOURCE2_RGB_ARB\0" - "GL_SOURCE2_RGB_EXT\0" - "GL_SOURCE3_ALPHA_NV\0" - "GL_SOURCE3_RGB_NV\0" - "GL_SPECULAR\0" - "GL_SPHERE_MAP\0" - "GL_SPOT_CUTOFF\0" - "GL_SPOT_DIRECTION\0" - "GL_SPOT_EXPONENT\0" - "GL_SRC0_ALPHA\0" - "GL_SRC0_RGB\0" - "GL_SRC1_ALPHA\0" - "GL_SRC1_RGB\0" - "GL_SRC2_ALPHA\0" - "GL_SRC2_RGB\0" - "GL_SRC_ALPHA\0" - "GL_SRC_ALPHA_SATURATE\0" - "GL_SRC_COLOR\0" - "GL_SRGB\0" - "GL_SRGB8\0" - "GL_SRGB8_ALPHA8\0" - "GL_SRGB_ALPHA\0" - "GL_STACK_OVERFLOW\0" - "GL_STACK_UNDERFLOW\0" - "GL_STATIC_COPY\0" - "GL_STATIC_COPY_ARB\0" - "GL_STATIC_DRAW\0" - "GL_STATIC_DRAW_ARB\0" - "GL_STATIC_READ\0" - "GL_STATIC_READ_ARB\0" - "GL_STENCIL\0" - "GL_STENCIL_ATTACHMENT\0" - "GL_STENCIL_ATTACHMENT_EXT\0" - "GL_STENCIL_ATTACHMENT_OES\0" - "GL_STENCIL_BACK_FAIL\0" - "GL_STENCIL_BACK_FAIL_ATI\0" - "GL_STENCIL_BACK_FUNC\0" - "GL_STENCIL_BACK_FUNC_ATI\0" - "GL_STENCIL_BACK_PASS_DEPTH_FAIL\0" - "GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI\0" - "GL_STENCIL_BACK_PASS_DEPTH_PASS\0" - "GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI\0" - "GL_STENCIL_BACK_REF\0" - "GL_STENCIL_BACK_VALUE_MASK\0" - "GL_STENCIL_BACK_WRITEMASK\0" - "GL_STENCIL_BITS\0" - "GL_STENCIL_BUFFER\0" - "GL_STENCIL_BUFFER_BIT\0" - "GL_STENCIL_CLEAR_VALUE\0" - "GL_STENCIL_FAIL\0" - "GL_STENCIL_FUNC\0" - "GL_STENCIL_INDEX\0" - "GL_STENCIL_INDEX1\0" - "GL_STENCIL_INDEX16\0" - "GL_STENCIL_INDEX16_EXT\0" - "GL_STENCIL_INDEX1_EXT\0" - "GL_STENCIL_INDEX1_OES\0" - "GL_STENCIL_INDEX4\0" - "GL_STENCIL_INDEX4_EXT\0" - "GL_STENCIL_INDEX4_OES\0" - "GL_STENCIL_INDEX8\0" - "GL_STENCIL_INDEX8_EXT\0" - "GL_STENCIL_INDEX8_OES\0" - "GL_STENCIL_INDEX_EXT\0" - "GL_STENCIL_PASS_DEPTH_FAIL\0" - "GL_STENCIL_PASS_DEPTH_PASS\0" - "GL_STENCIL_REF\0" - "GL_STENCIL_TEST\0" - "GL_STENCIL_TEST_TWO_SIDE_EXT\0" - "GL_STENCIL_VALUE_MASK\0" - "GL_STENCIL_WRITEMASK\0" - "GL_STEREO\0" - "GL_STORAGE_CACHED_APPLE\0" - "GL_STORAGE_PRIVATE_APPLE\0" - "GL_STORAGE_SHARED_APPLE\0" - "GL_STREAM_COPY\0" - "GL_STREAM_COPY_ARB\0" - "GL_STREAM_DRAW\0" - "GL_STREAM_DRAW_ARB\0" - "GL_STREAM_READ\0" - "GL_STREAM_READ_ARB\0" - "GL_SUBPIXEL_BITS\0" - "GL_SUBTRACT\0" - "GL_SUBTRACT_ARB\0" - "GL_SYNC_CONDITION\0" - "GL_SYNC_FENCE\0" - "GL_SYNC_FLAGS\0" - "GL_SYNC_FLUSH_COMMANDS_BIT\0" - "GL_SYNC_GPU_COMMANDS_COMPLETE\0" - "GL_SYNC_STATUS\0" - "GL_T\0" - "GL_T2F_C3F_V3F\0" - "GL_T2F_C4F_N3F_V3F\0" - "GL_T2F_C4UB_V3F\0" - "GL_T2F_N3F_V3F\0" - "GL_T2F_V3F\0" - "GL_T4F_C4F_N3F_V4F\0" - "GL_T4F_V4F\0" - "GL_TABLE_TOO_LARGE_EXT\0" - "GL_TEXTURE\0" - "GL_TEXTURE0\0" - "GL_TEXTURE0_ARB\0" - "GL_TEXTURE1\0" - "GL_TEXTURE10\0" - "GL_TEXTURE10_ARB\0" - "GL_TEXTURE11\0" - "GL_TEXTURE11_ARB\0" - "GL_TEXTURE12\0" - "GL_TEXTURE12_ARB\0" - "GL_TEXTURE13\0" - "GL_TEXTURE13_ARB\0" - "GL_TEXTURE14\0" - "GL_TEXTURE14_ARB\0" - "GL_TEXTURE15\0" - "GL_TEXTURE15_ARB\0" - "GL_TEXTURE16\0" - "GL_TEXTURE16_ARB\0" - "GL_TEXTURE17\0" - "GL_TEXTURE17_ARB\0" - "GL_TEXTURE18\0" - "GL_TEXTURE18_ARB\0" - "GL_TEXTURE19\0" - "GL_TEXTURE19_ARB\0" - "GL_TEXTURE1_ARB\0" - "GL_TEXTURE2\0" - "GL_TEXTURE20\0" - "GL_TEXTURE20_ARB\0" - "GL_TEXTURE21\0" - "GL_TEXTURE21_ARB\0" - "GL_TEXTURE22\0" - "GL_TEXTURE22_ARB\0" - "GL_TEXTURE23\0" - "GL_TEXTURE23_ARB\0" - "GL_TEXTURE24\0" - "GL_TEXTURE24_ARB\0" - "GL_TEXTURE25\0" - "GL_TEXTURE25_ARB\0" - "GL_TEXTURE26\0" - "GL_TEXTURE26_ARB\0" - "GL_TEXTURE27\0" - "GL_TEXTURE27_ARB\0" - "GL_TEXTURE28\0" - "GL_TEXTURE28_ARB\0" - "GL_TEXTURE29\0" - "GL_TEXTURE29_ARB\0" - "GL_TEXTURE2_ARB\0" - "GL_TEXTURE3\0" - "GL_TEXTURE30\0" - "GL_TEXTURE30_ARB\0" - "GL_TEXTURE31\0" - "GL_TEXTURE31_ARB\0" - "GL_TEXTURE3_ARB\0" - "GL_TEXTURE4\0" - "GL_TEXTURE4_ARB\0" - "GL_TEXTURE5\0" - "GL_TEXTURE5_ARB\0" - "GL_TEXTURE6\0" - "GL_TEXTURE6_ARB\0" - "GL_TEXTURE7\0" - "GL_TEXTURE7_ARB\0" - "GL_TEXTURE8\0" - "GL_TEXTURE8_ARB\0" - "GL_TEXTURE9\0" - "GL_TEXTURE9_ARB\0" - "GL_TEXTURE_1D\0" - "GL_TEXTURE_1D_ARRAY\0" - "GL_TEXTURE_1D_ARRAY_EXT\0" - "GL_TEXTURE_2D\0" - "GL_TEXTURE_2D_ARRAY\0" - "GL_TEXTURE_2D_ARRAY_EXT\0" - "GL_TEXTURE_3D\0" - "GL_TEXTURE_3D_OES\0" - "GL_TEXTURE_ALPHA_SIZE\0" - "GL_TEXTURE_ALPHA_SIZE_EXT\0" - "GL_TEXTURE_BASE_LEVEL\0" - "GL_TEXTURE_BINDING_1D\0" - "GL_TEXTURE_BINDING_1D_ARRAY\0" - "GL_TEXTURE_BINDING_1D_ARRAY_EXT\0" - "GL_TEXTURE_BINDING_2D\0" - "GL_TEXTURE_BINDING_2D_ARRAY\0" - "GL_TEXTURE_BINDING_2D_ARRAY_EXT\0" - "GL_TEXTURE_BINDING_3D\0" - "GL_TEXTURE_BINDING_3D_OES\0" - "GL_TEXTURE_BINDING_BUFFER\0" - "GL_TEXTURE_BINDING_CUBE_MAP\0" - "GL_TEXTURE_BINDING_CUBE_MAP_ARB\0" - "GL_TEXTURE_BINDING_CUBE_MAP_OES\0" - "GL_TEXTURE_BINDING_RECTANGLE\0" - "GL_TEXTURE_BINDING_RECTANGLE_ARB\0" - "GL_TEXTURE_BINDING_RECTANGLE_NV\0" - "GL_TEXTURE_BIT\0" - "GL_TEXTURE_BLUE_SIZE\0" - "GL_TEXTURE_BLUE_SIZE_EXT\0" - "GL_TEXTURE_BORDER\0" - "GL_TEXTURE_BORDER_COLOR\0" - "GL_TEXTURE_BUFFER\0" - "GL_TEXTURE_BUFFER_DATA_STORE_BINDING\0" - "GL_TEXTURE_BUFFER_FORMAT\0" - "GL_TEXTURE_CLIPMAP_CENTER_SGIX\0" - "GL_TEXTURE_CLIPMAP_DEPTH_SGIX\0" - "GL_TEXTURE_CLIPMAP_FRAME_SGIX\0" - "GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX\0" - "GL_TEXTURE_CLIPMAP_OFFSET_SGIX\0" - "GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX\0" - "GL_TEXTURE_COLOR_TABLE_SGI\0" - "GL_TEXTURE_COLOR_WRITEMASK_SGIS\0" - "GL_TEXTURE_COMPARE_FAIL_VALUE_ARB\0" - "GL_TEXTURE_COMPARE_FUNC\0" - "GL_TEXTURE_COMPARE_FUNC_ARB\0" - "GL_TEXTURE_COMPARE_MODE\0" - "GL_TEXTURE_COMPARE_MODE_ARB\0" - "GL_TEXTURE_COMPARE_OPERATOR_SGIX\0" - "GL_TEXTURE_COMPARE_SGIX\0" - "GL_TEXTURE_COMPONENTS\0" - "GL_TEXTURE_COMPRESSED\0" - "GL_TEXTURE_COMPRESSED_ARB\0" - "GL_TEXTURE_COMPRESSED_FORMATS_ARB\0" - "GL_TEXTURE_COMPRESSED_IMAGE_SIZE\0" - "GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB\0" - "GL_TEXTURE_COMPRESSION_HINT\0" - "GL_TEXTURE_COMPRESSION_HINT_ARB\0" - "GL_TEXTURE_COORD_ARRAY\0" - "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING\0" - "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB\0" - "GL_TEXTURE_COORD_ARRAY_POINTER\0" - "GL_TEXTURE_COORD_ARRAY_SIZE\0" - "GL_TEXTURE_COORD_ARRAY_STRIDE\0" - "GL_TEXTURE_COORD_ARRAY_TYPE\0" - "GL_TEXTURE_CROP_RECT_OES\0" - "GL_TEXTURE_CUBE_MAP\0" - "GL_TEXTURE_CUBE_MAP_ARB\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_X\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB\0" - "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES\0" - "GL_TEXTURE_CUBE_MAP_OES\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_X\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_Y\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_Z\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB\0" - "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES\0" - "GL_TEXTURE_CUBE_MAP_SEAMLESS\0" - "GL_TEXTURE_DEPTH\0" - "GL_TEXTURE_DEPTH_SIZE\0" - "GL_TEXTURE_DEPTH_SIZE_ARB\0" - "GL_TEXTURE_ENV\0" - "GL_TEXTURE_ENV_COLOR\0" - "GL_TEXTURE_ENV_MODE\0" - "GL_TEXTURE_FILTER_CONTROL\0" - "GL_TEXTURE_FILTER_CONTROL_EXT\0" - "GL_TEXTURE_GEN_MODE\0" - "GL_TEXTURE_GEN_MODE_OES\0" - "GL_TEXTURE_GEN_Q\0" - "GL_TEXTURE_GEN_R\0" - "GL_TEXTURE_GEN_S\0" - "GL_TEXTURE_GEN_STR_OES\0" - "GL_TEXTURE_GEN_T\0" - "GL_TEXTURE_GEQUAL_R_SGIX\0" - "GL_TEXTURE_GREEN_SIZE\0" - "GL_TEXTURE_GREEN_SIZE_EXT\0" - "GL_TEXTURE_HEIGHT\0" - "GL_TEXTURE_INDEX_SIZE_EXT\0" - "GL_TEXTURE_INTENSITY_SIZE\0" - "GL_TEXTURE_INTENSITY_SIZE_EXT\0" - "GL_TEXTURE_INTERNAL_FORMAT\0" - "GL_TEXTURE_LEQUAL_R_SGIX\0" - "GL_TEXTURE_LOD_BIAS\0" - "GL_TEXTURE_LOD_BIAS_EXT\0" - "GL_TEXTURE_LOD_BIAS_R_SGIX\0" - "GL_TEXTURE_LOD_BIAS_S_SGIX\0" - "GL_TEXTURE_LOD_BIAS_T_SGIX\0" - "GL_TEXTURE_LUMINANCE_SIZE\0" - "GL_TEXTURE_LUMINANCE_SIZE_EXT\0" - "GL_TEXTURE_MAG_FILTER\0" - "GL_TEXTURE_MATRIX\0" - "GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES\0" - "GL_TEXTURE_MAX_ANISOTROPY_EXT\0" - "GL_TEXTURE_MAX_CLAMP_R_SGIX\0" - "GL_TEXTURE_MAX_CLAMP_S_SGIX\0" - "GL_TEXTURE_MAX_CLAMP_T_SGIX\0" - "GL_TEXTURE_MAX_LEVEL\0" - "GL_TEXTURE_MAX_LOD\0" - "GL_TEXTURE_MIN_FILTER\0" - "GL_TEXTURE_MIN_LOD\0" - "GL_TEXTURE_PRIORITY\0" - "GL_TEXTURE_RANGE_LENGTH_APPLE\0" - "GL_TEXTURE_RANGE_POINTER_APPLE\0" - "GL_TEXTURE_RECTANGLE\0" - "GL_TEXTURE_RECTANGLE_ARB\0" - "GL_TEXTURE_RECTANGLE_NV\0" - "GL_TEXTURE_RED_SIZE\0" - "GL_TEXTURE_RED_SIZE_EXT\0" - "GL_TEXTURE_RESIDENT\0" - "GL_TEXTURE_SHARED_SIZE\0" - "GL_TEXTURE_STACK_DEPTH\0" - "GL_TEXTURE_STENCIL_SIZE\0" - "GL_TEXTURE_STENCIL_SIZE_EXT\0" - "GL_TEXTURE_STORAGE_HINT_APPLE\0" - "GL_TEXTURE_TOO_LARGE_EXT\0" - "GL_TEXTURE_UNSIGNED_REMAP_MODE_NV\0" - "GL_TEXTURE_WIDTH\0" - "GL_TEXTURE_WRAP_R\0" - "GL_TEXTURE_WRAP_R_OES\0" - "GL_TEXTURE_WRAP_S\0" - "GL_TEXTURE_WRAP_T\0" - "GL_TIMEOUT_EXPIRED\0" - "GL_TIME_ELAPSED_EXT\0" - "GL_TRACK_MATRIX_NV\0" - "GL_TRACK_MATRIX_TRANSFORM_NV\0" - "GL_TRANSFORM_BIT\0" - "GL_TRANSFORM_FEEDBACK\0" - "GL_TRANSFORM_FEEDBACK_BINDING\0" - "GL_TRANSFORM_FEEDBACK_BUFFER\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_EXT\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_MODE\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_START\0" - "GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT\0" - "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN\0" - "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT\0" - "GL_TRANSFORM_FEEDBACK_VARYINGS\0" - "GL_TRANSFORM_FEEDBACK_VARYINGS_EXT\0" - "GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH\0" - "GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT\0" - "GL_TRANSPOSE_COLOR_MATRIX\0" - "GL_TRANSPOSE_COLOR_MATRIX_ARB\0" - "GL_TRANSPOSE_CURRENT_MATRIX_ARB\0" - "GL_TRANSPOSE_MODELVIEW_MATRIX\0" - "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB\0" - "GL_TRANSPOSE_NV\0" - "GL_TRANSPOSE_PROJECTION_MATRIX\0" - "GL_TRANSPOSE_PROJECTION_MATRIX_ARB\0" - "GL_TRANSPOSE_TEXTURE_MATRIX\0" - "GL_TRANSPOSE_TEXTURE_MATRIX_ARB\0" - "GL_TRIANGLES\0" - "GL_TRIANGLES_ADJACENCY\0" - "GL_TRIANGLES_ADJACENCY_ARB\0" - "GL_TRIANGLE_FAN\0" - "GL_TRIANGLE_MESH_SUN\0" - "GL_TRIANGLE_STRIP\0" - "GL_TRIANGLE_STRIP_ADJACENCY\0" - "GL_TRIANGLE_STRIP_ADJACENCY_ARB\0" - "GL_TRUE\0" - "GL_UNDEFINED_APPLE\0" - "GL_UNPACK_ALIGNMENT\0" - "GL_UNPACK_IMAGE_HEIGHT\0" - "GL_UNPACK_LSB_FIRST\0" - "GL_UNPACK_ROW_LENGTH\0" - "GL_UNPACK_SKIP_IMAGES\0" - "GL_UNPACK_SKIP_PIXELS\0" - "GL_UNPACK_SKIP_ROWS\0" - "GL_UNPACK_SWAP_BYTES\0" - "GL_UNSIGNALED\0" - "GL_UNSIGNED_BYTE\0" - "GL_UNSIGNED_BYTE_2_3_3_REV\0" - "GL_UNSIGNED_BYTE_3_3_2\0" - "GL_UNSIGNED_INT\0" - "GL_UNSIGNED_INT_10F_11F_11F_REV\0" - "GL_UNSIGNED_INT_10_10_10_2\0" - "GL_UNSIGNED_INT_10_10_10_2_OES\0" - "GL_UNSIGNED_INT_24_8\0" - "GL_UNSIGNED_INT_24_8_EXT\0" - "GL_UNSIGNED_INT_24_8_NV\0" - "GL_UNSIGNED_INT_24_8_OES\0" - "GL_UNSIGNED_INT_2_10_10_10_REV\0" - "GL_UNSIGNED_INT_2_10_10_10_REV_EXT\0" - "GL_UNSIGNED_INT_5_9_9_9_REV\0" - "GL_UNSIGNED_INT_8_8_8_8\0" - "GL_UNSIGNED_INT_8_8_8_8_REV\0" - "GL_UNSIGNED_INT_SAMPLER_1D\0" - "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY\0" - "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT\0" - "GL_UNSIGNED_INT_SAMPLER_1D_EXT\0" - "GL_UNSIGNED_INT_SAMPLER_2D\0" - "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY\0" - "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT\0" - "GL_UNSIGNED_INT_SAMPLER_2D_EXT\0" - "GL_UNSIGNED_INT_SAMPLER_2D_RECT\0" - "GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT\0" - "GL_UNSIGNED_INT_SAMPLER_3D\0" - "GL_UNSIGNED_INT_SAMPLER_3D_EXT\0" - "GL_UNSIGNED_INT_SAMPLER_BUFFER\0" - "GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT\0" - "GL_UNSIGNED_INT_SAMPLER_CUBE\0" - "GL_UNSIGNED_INT_SAMPLER_CUBE_EXT\0" - "GL_UNSIGNED_INT_VEC2\0" - "GL_UNSIGNED_INT_VEC2_EXT\0" - "GL_UNSIGNED_INT_VEC3\0" - "GL_UNSIGNED_INT_VEC3_EXT\0" - "GL_UNSIGNED_INT_VEC4\0" - "GL_UNSIGNED_INT_VEC4_EXT\0" - "GL_UNSIGNED_NORMALIZED\0" - "GL_UNSIGNED_SHORT\0" - "GL_UNSIGNED_SHORT_1_5_5_5_REV\0" - "GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT\0" - "GL_UNSIGNED_SHORT_4_4_4_4\0" - "GL_UNSIGNED_SHORT_4_4_4_4_REV\0" - "GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT\0" - "GL_UNSIGNED_SHORT_5_5_5_1\0" - "GL_UNSIGNED_SHORT_5_6_5\0" - "GL_UNSIGNED_SHORT_5_6_5_REV\0" - "GL_UNSIGNED_SHORT_8_8_APPLE\0" - "GL_UNSIGNED_SHORT_8_8_MESA\0" - "GL_UNSIGNED_SHORT_8_8_REV_APPLE\0" - "GL_UNSIGNED_SHORT_8_8_REV_MESA\0" - "GL_UPPER_LEFT\0" - "GL_V2F\0" - "GL_V3F\0" - "GL_VALIDATE_STATUS\0" - "GL_VENDOR\0" - "GL_VERSION\0" - "GL_VERTEX_ARRAY\0" - "GL_VERTEX_ARRAY_BINDING\0" - "GL_VERTEX_ARRAY_BINDING_APPLE\0" - "GL_VERTEX_ARRAY_BUFFER_BINDING\0" - "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB\0" - "GL_VERTEX_ARRAY_POINTER\0" - "GL_VERTEX_ARRAY_SIZE\0" - "GL_VERTEX_ARRAY_STRIDE\0" - "GL_VERTEX_ARRAY_TYPE\0" - "GL_VERTEX_ATTRIB_ARRAY0_NV\0" - "GL_VERTEX_ATTRIB_ARRAY10_NV\0" - "GL_VERTEX_ATTRIB_ARRAY11_NV\0" - "GL_VERTEX_ATTRIB_ARRAY12_NV\0" - "GL_VERTEX_ATTRIB_ARRAY13_NV\0" - "GL_VERTEX_ATTRIB_ARRAY14_NV\0" - "GL_VERTEX_ATTRIB_ARRAY15_NV\0" - "GL_VERTEX_ATTRIB_ARRAY1_NV\0" - "GL_VERTEX_ATTRIB_ARRAY2_NV\0" - "GL_VERTEX_ATTRIB_ARRAY3_NV\0" - "GL_VERTEX_ATTRIB_ARRAY4_NV\0" - "GL_VERTEX_ATTRIB_ARRAY5_NV\0" - "GL_VERTEX_ATTRIB_ARRAY6_NV\0" - "GL_VERTEX_ATTRIB_ARRAY7_NV\0" - "GL_VERTEX_ATTRIB_ARRAY8_NV\0" - "GL_VERTEX_ATTRIB_ARRAY9_NV\0" - "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING\0" - "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB\0" - "GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB\0" - "GL_VERTEX_ATTRIB_ARRAY_ENABLED\0" - "GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB\0" - "GL_VERTEX_ATTRIB_ARRAY_INTEGER\0" - "GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT\0" - "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED\0" - "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB\0" - "GL_VERTEX_ATTRIB_ARRAY_POINTER\0" - "GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB\0" - "GL_VERTEX_ATTRIB_ARRAY_SIZE\0" - "GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB\0" - "GL_VERTEX_ATTRIB_ARRAY_STRIDE\0" - "GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB\0" - "GL_VERTEX_ATTRIB_ARRAY_TYPE\0" - "GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB\0" - "GL_VERTEX_BLEND_ARB\0" - "GL_VERTEX_PROGRAM_ARB\0" - "GL_VERTEX_PROGRAM_BINDING_NV\0" - "GL_VERTEX_PROGRAM_NV\0" - "GL_VERTEX_PROGRAM_POINT_SIZE\0" - "GL_VERTEX_PROGRAM_POINT_SIZE_ARB\0" - "GL_VERTEX_PROGRAM_POINT_SIZE_NV\0" - "GL_VERTEX_PROGRAM_TWO_SIDE\0" - "GL_VERTEX_PROGRAM_TWO_SIDE_ARB\0" - "GL_VERTEX_PROGRAM_TWO_SIDE_NV\0" - "GL_VERTEX_SHADER\0" - "GL_VERTEX_SHADER_ARB\0" - "GL_VERTEX_STATE_PROGRAM_NV\0" - "GL_VIEWPORT\0" - "GL_VIEWPORT_BIT\0" - "GL_VOLATILE_APPLE\0" - "GL_WAIT_FAILED\0" - "GL_WEIGHT_ARRAY_ARB\0" - "GL_WEIGHT_ARRAY_BUFFER_BINDING\0" - "GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB\0" - "GL_WEIGHT_ARRAY_BUFFER_BINDING_OES\0" - "GL_WEIGHT_ARRAY_OES\0" - "GL_WEIGHT_ARRAY_POINTER_ARB\0" - "GL_WEIGHT_ARRAY_POINTER_OES\0" - "GL_WEIGHT_ARRAY_SIZE_ARB\0" - "GL_WEIGHT_ARRAY_SIZE_OES\0" - "GL_WEIGHT_ARRAY_STRIDE_ARB\0" - "GL_WEIGHT_ARRAY_STRIDE_OES\0" - "GL_WEIGHT_ARRAY_TYPE_ARB\0" - "GL_WEIGHT_ARRAY_TYPE_OES\0" - "GL_WEIGHT_SUM_UNITY_ARB\0" - "GL_WRAP_BORDER_SUN\0" - "GL_WRITE_ONLY\0" - "GL_WRITE_ONLY_ARB\0" - "GL_WRITE_ONLY_OES\0" - "GL_XOR\0" - "GL_YCBCR_422_APPLE\0" - "GL_YCBCR_MESA\0" - "GL_ZERO\0" - "GL_ZOOM_X\0" - "GL_ZOOM_Y\0" - ; - -static const enum_elt all_enums[2295] = -{ - { 0, 0x00000600 }, /* GL_2D */ - { 6, 0x00001407 }, /* GL_2_BYTES */ - { 17, 0x00000601 }, /* GL_3D */ - { 23, 0x00000602 }, /* GL_3D_COLOR */ - { 35, 0x00000603 }, /* GL_3D_COLOR_TEXTURE */ - { 55, 0x00001408 }, /* GL_3_BYTES */ - { 66, 0x00000604 }, /* GL_4D_COLOR_TEXTURE */ - { 86, 0x00001409 }, /* GL_4_BYTES */ - { 97, 0x00000100 }, /* GL_ACCUM */ - { 106, 0x00000D5B }, /* GL_ACCUM_ALPHA_BITS */ - { 126, 0x00000D5A }, /* GL_ACCUM_BLUE_BITS */ - { 145, 0x00000200 }, /* GL_ACCUM_BUFFER_BIT */ - { 165, 0x00000B80 }, /* GL_ACCUM_CLEAR_VALUE */ - { 186, 0x00000D59 }, /* GL_ACCUM_GREEN_BITS */ - { 206, 0x00000D58 }, /* GL_ACCUM_RED_BITS */ - { 224, 0x00008B89 }, /* GL_ACTIVE_ATTRIBUTES */ - { 245, 0x00008B8A }, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ - { 276, 0x00008B8D }, /* GL_ACTIVE_PROGRAM_EXT */ - { 298, 0x00008911 }, /* GL_ACTIVE_STENCIL_FACE_EXT */ - { 325, 0x000084E0 }, /* GL_ACTIVE_TEXTURE */ - { 343, 0x000084E0 }, /* GL_ACTIVE_TEXTURE_ARB */ - { 365, 0x00008B86 }, /* GL_ACTIVE_UNIFORMS */ - { 384, 0x00008B87 }, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ - { 413, 0x000086A5 }, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - { 440, 0x00000104 }, /* GL_ADD */ - { 447, 0x00008574 }, /* GL_ADD_SIGNED */ - { 461, 0x00008574 }, /* GL_ADD_SIGNED_ARB */ - { 479, 0x00008574 }, /* GL_ADD_SIGNED_EXT */ - { 497, 0x0000846E }, /* GL_ALIASED_LINE_WIDTH_RANGE */ - { 525, 0x0000846D }, /* GL_ALIASED_POINT_SIZE_RANGE */ - { 553, 0x000FFFFF }, /* GL_ALL_ATTRIB_BITS */ - { 572, 0xFFFFFFFF }, /* GL_ALL_CLIENT_ATTRIB_BITS */ - { 598, 0x00001906 }, /* GL_ALPHA */ - { 607, 0x0000803D }, /* GL_ALPHA12 */ - { 618, 0x0000803D }, /* GL_ALPHA12_EXT */ - { 633, 0x0000803E }, /* GL_ALPHA16 */ - { 644, 0x00008D8A }, /* GL_ALPHA16I_EXT */ - { 660, 0x00008D78 }, /* GL_ALPHA16UI_EXT */ - { 677, 0x0000803E }, /* GL_ALPHA16_EXT */ - { 692, 0x00008D84 }, /* GL_ALPHA32I_EXT */ - { 708, 0x00008D72 }, /* GL_ALPHA32UI_EXT */ - { 725, 0x0000803B }, /* GL_ALPHA4 */ - { 735, 0x0000803B }, /* GL_ALPHA4_EXT */ - { 749, 0x0000803C }, /* GL_ALPHA8 */ - { 759, 0x00008D90 }, /* GL_ALPHA8I_EXT */ - { 774, 0x00008D7E }, /* GL_ALPHA8UI_EXT */ - { 790, 0x0000803C }, /* GL_ALPHA8_EXT */ - { 804, 0x00000D1D }, /* GL_ALPHA_BIAS */ - { 818, 0x00000D55 }, /* GL_ALPHA_BITS */ - { 832, 0x00008D97 }, /* GL_ALPHA_INTEGER_EXT */ - { 853, 0x00000D1C }, /* GL_ALPHA_SCALE */ - { 868, 0x00000BC0 }, /* GL_ALPHA_TEST */ - { 882, 0x00000BC1 }, /* GL_ALPHA_TEST_FUNC */ - { 901, 0x00000BC2 }, /* GL_ALPHA_TEST_REF */ - { 919, 0x0000911A }, /* GL_ALREADY_SIGNALED */ - { 939, 0x00000207 }, /* GL_ALWAYS */ - { 949, 0x00001200 }, /* GL_AMBIENT */ - { 960, 0x00001602 }, /* GL_AMBIENT_AND_DIFFUSE */ - { 983, 0x00001501 }, /* GL_AND */ - { 990, 0x00001504 }, /* GL_AND_INVERTED */ - { 1006, 0x00001502 }, /* GL_AND_REVERSE */ - { 1021, 0x00008892 }, /* GL_ARRAY_BUFFER */ - { 1037, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING */ - { 1061, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING_ARB */ - { 1089, 0x00008B85 }, /* GL_ATTACHED_SHADERS */ - { 1109, 0x00008645 }, /* GL_ATTRIB_ARRAY_POINTER_NV */ - { 1136, 0x00008623 }, /* GL_ATTRIB_ARRAY_SIZE_NV */ - { 1160, 0x00008624 }, /* GL_ATTRIB_ARRAY_STRIDE_NV */ - { 1186, 0x00008625 }, /* GL_ATTRIB_ARRAY_TYPE_NV */ - { 1210, 0x00000BB0 }, /* GL_ATTRIB_STACK_DEPTH */ - { 1232, 0x00000D80 }, /* GL_AUTO_NORMAL */ - { 1247, 0x00000409 }, /* GL_AUX0 */ - { 1255, 0x0000040A }, /* GL_AUX1 */ - { 1263, 0x0000040B }, /* GL_AUX2 */ - { 1271, 0x0000040C }, /* GL_AUX3 */ - { 1279, 0x00000C00 }, /* GL_AUX_BUFFERS */ - { 1294, 0x00000405 }, /* GL_BACK */ - { 1302, 0x00000402 }, /* GL_BACK_LEFT */ - { 1315, 0x00000403 }, /* GL_BACK_RIGHT */ - { 1329, 0x000080E0 }, /* GL_BGR */ - { 1336, 0x000080E1 }, /* GL_BGRA */ - { 1344, 0x000080E1 }, /* GL_BGRA_EXT */ - { 1356, 0x00008D9B }, /* GL_BGRA_INTEGER */ - { 1372, 0x00008D9B }, /* GL_BGRA_INTEGER_EXT */ - { 1392, 0x00008D9A }, /* GL_BGR_INTEGER */ - { 1407, 0x00008D9A }, /* GL_BGR_INTEGER_EXT */ - { 1426, 0x00001A00 }, /* GL_BITMAP */ - { 1436, 0x00000704 }, /* GL_BITMAP_TOKEN */ - { 1452, 0x00000BE2 }, /* GL_BLEND */ - { 1461, 0x00008005 }, /* GL_BLEND_COLOR */ - { 1476, 0x00008005 }, /* GL_BLEND_COLOR_EXT */ - { 1495, 0x00000BE0 }, /* GL_BLEND_DST */ - { 1508, 0x000080CA }, /* GL_BLEND_DST_ALPHA */ - { 1527, 0x000080CA }, /* GL_BLEND_DST_ALPHA_OES */ - { 1550, 0x000080C8 }, /* GL_BLEND_DST_RGB */ - { 1567, 0x000080C8 }, /* GL_BLEND_DST_RGB_OES */ - { 1588, 0x00008009 }, /* GL_BLEND_EQUATION */ - { 1606, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA */ - { 1630, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */ - { 1658, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_OES */ - { 1686, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */ - { 1708, 0x00008009 }, /* GL_BLEND_EQUATION_OES */ - { 1730, 0x00008009 }, /* GL_BLEND_EQUATION_RGB */ - { 1752, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */ - { 1778, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_OES */ - { 1804, 0x00000BE1 }, /* GL_BLEND_SRC */ - { 1817, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */ - { 1836, 0x000080CB }, /* GL_BLEND_SRC_ALPHA_OES */ - { 1859, 0x000080C9 }, /* GL_BLEND_SRC_RGB */ - { 1876, 0x000080C9 }, /* GL_BLEND_SRC_RGB_OES */ - { 1897, 0x00001905 }, /* GL_BLUE */ - { 1905, 0x00000D1B }, /* GL_BLUE_BIAS */ - { 1918, 0x00000D54 }, /* GL_BLUE_BITS */ - { 1931, 0x00008D96 }, /* GL_BLUE_INTEGER */ - { 1947, 0x00008D96 }, /* GL_BLUE_INTEGER_EXT */ - { 1967, 0x00000D1A }, /* GL_BLUE_SCALE */ - { 1981, 0x00008B56 }, /* GL_BOOL */ - { 1989, 0x00008B56 }, /* GL_BOOL_ARB */ - { 2001, 0x00008B57 }, /* GL_BOOL_VEC2 */ - { 2014, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */ - { 2031, 0x00008B58 }, /* GL_BOOL_VEC3 */ - { 2044, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */ - { 2061, 0x00008B59 }, /* GL_BOOL_VEC4 */ - { 2074, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */ - { 2091, 0x000088BB }, /* GL_BUFFER_ACCESS */ - { 2108, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */ - { 2129, 0x0000911F }, /* GL_BUFFER_ACCESS_FLAGS */ - { 2152, 0x000088BB }, /* GL_BUFFER_ACCESS_OES */ - { 2173, 0x00008A13 }, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ - { 2204, 0x000088BC }, /* GL_BUFFER_MAPPED */ - { 2221, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */ - { 2242, 0x000088BC }, /* GL_BUFFER_MAPPED_OES */ - { 2263, 0x00009120 }, /* GL_BUFFER_MAP_LENGTH */ - { 2284, 0x00009121 }, /* GL_BUFFER_MAP_OFFSET */ - { 2305, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */ - { 2327, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */ - { 2353, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_OES */ - { 2379, 0x000085B3 }, /* GL_BUFFER_OBJECT_APPLE */ - { 2402, 0x00008A12 }, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ - { 2436, 0x00008764 }, /* GL_BUFFER_SIZE */ - { 2451, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */ - { 2470, 0x00008765 }, /* GL_BUFFER_USAGE */ - { 2486, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */ - { 2506, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */ - { 2525, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */ - { 2551, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */ - { 2574, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ - { 2602, 0x0000877C }, /* GL_BUMP_TARGET_ATI */ - { 2621, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */ - { 2643, 0x00001400 }, /* GL_BYTE */ - { 2651, 0x00002A24 }, /* GL_C3F_V3F */ - { 2662, 0x00002A26 }, /* GL_C4F_N3F_V3F */ - { 2677, 0x00002A22 }, /* GL_C4UB_V2F */ - { 2689, 0x00002A23 }, /* GL_C4UB_V3F */ - { 2701, 0x00000901 }, /* GL_CCW */ - { 2708, 0x00002900 }, /* GL_CLAMP */ - { 2717, 0x0000891C }, /* GL_CLAMP_READ_COLOR */ - { 2737, 0x0000812D }, /* GL_CLAMP_TO_BORDER */ - { 2756, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */ - { 2779, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */ - { 2803, 0x0000812F }, /* GL_CLAMP_TO_EDGE */ - { 2820, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */ - { 2842, 0x00001500 }, /* GL_CLEAR */ - { 2851, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */ - { 2876, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */ - { 2905, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */ - { 2931, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ - { 2960, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */ - { 2986, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */ - { 3013, 0x00003000 }, /* GL_CLIP_DISTANCE0 */ - { 3031, 0x00003001 }, /* GL_CLIP_DISTANCE1 */ - { 3049, 0x00003002 }, /* GL_CLIP_DISTANCE2 */ - { 3067, 0x00003003 }, /* GL_CLIP_DISTANCE3 */ - { 3085, 0x00003004 }, /* GL_CLIP_DISTANCE4 */ - { 3103, 0x00003005 }, /* GL_CLIP_DISTANCE5 */ - { 3121, 0x00003006 }, /* GL_CLIP_DISTANCE6 */ - { 3139, 0x00003007 }, /* GL_CLIP_DISTANCE7 */ - { 3157, 0x00003000 }, /* GL_CLIP_PLANE0 */ - { 3172, 0x00003001 }, /* GL_CLIP_PLANE1 */ - { 3187, 0x00003002 }, /* GL_CLIP_PLANE2 */ - { 3202, 0x00003003 }, /* GL_CLIP_PLANE3 */ - { 3217, 0x00003004 }, /* GL_CLIP_PLANE4 */ - { 3232, 0x00003005 }, /* GL_CLIP_PLANE5 */ - { 3247, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - { 3280, 0x00000A00 }, /* GL_COEFF */ - { 3289, 0x00001800 }, /* GL_COLOR */ - { 3298, 0x00008076 }, /* GL_COLOR_ARRAY */ - { 3313, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - { 3343, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 3377, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */ - { 3400, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */ - { 3420, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */ - { 3442, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */ - { 3462, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */ - { 3483, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */ - { 3508, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_OES */ - { 3533, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */ - { 3554, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */ - { 3576, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */ - { 3602, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */ - { 3624, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */ - { 3650, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */ - { 3672, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */ - { 3698, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */ - { 3720, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */ - { 3746, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */ - { 3768, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */ - { 3794, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */ - { 3816, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */ - { 3842, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */ - { 3867, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */ - { 3888, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */ - { 3913, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */ - { 3934, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */ - { 3959, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */ - { 3980, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */ - { 4005, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */ - { 4026, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */ - { 4051, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */ - { 4072, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */ - { 4097, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */ - { 4118, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */ - { 4143, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */ - { 4164, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */ - { 4189, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */ - { 4210, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */ - { 4235, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */ - { 4255, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */ - { 4276, 0x00001900 }, /* GL_COLOR_INDEX */ - { 4291, 0x00001603 }, /* GL_COLOR_INDEXES */ - { 4308, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */ - { 4326, 0x00000B57 }, /* GL_COLOR_MATERIAL */ - { 4344, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */ - { 4367, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */ - { 4395, 0x000080B1 }, /* GL_COLOR_MATRIX */ - { 4411, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */ - { 4431, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */ - { 4459, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 4491, 0x00008458 }, /* GL_COLOR_SUM */ - { 4504, 0x00008458 }, /* GL_COLOR_SUM_ARB */ - { 4521, 0x000080D0 }, /* GL_COLOR_TABLE */ - { 4536, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */ - { 4562, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */ - { 4592, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */ - { 4622, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */ - { 4642, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */ - { 4666, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */ - { 4691, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */ - { 4720, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */ - { 4749, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */ - { 4771, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */ - { 4797, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */ - { 4823, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */ - { 4849, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */ - { 4879, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */ - { 4909, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */ - { 4939, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */ - { 4973, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */ - { 5007, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ - { 5037, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */ - { 5071, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */ - { 5105, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */ - { 5129, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */ - { 5157, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */ - { 5185, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */ - { 5206, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */ - { 5231, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */ - { 5252, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */ - { 5277, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */ - { 5302, 0x00000C23 }, /* GL_COLOR_WRITEMASK */ - { 5321, 0x00008570 }, /* GL_COMBINE */ - { 5332, 0x00008503 }, /* GL_COMBINE4 */ - { 5344, 0x00008572 }, /* GL_COMBINE_ALPHA */ - { 5361, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */ - { 5382, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */ - { 5403, 0x00008570 }, /* GL_COMBINE_ARB */ - { 5418, 0x00008570 }, /* GL_COMBINE_EXT */ - { 5433, 0x00008571 }, /* GL_COMBINE_RGB */ - { 5448, 0x00008571 }, /* GL_COMBINE_RGB_ARB */ - { 5467, 0x00008571 }, /* GL_COMBINE_RGB_EXT */ - { 5486, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */ - { 5522, 0x0000884E }, /* GL_COMPARE_REF_TO_TEXTURE */ - { 5548, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */ - { 5572, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */ - { 5600, 0x00001300 }, /* GL_COMPILE */ - { 5611, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */ - { 5634, 0x00008B81 }, /* GL_COMPILE_STATUS */ - { 5652, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */ - { 5672, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */ - { 5696, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */ - { 5720, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */ - { 5748, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */ - { 5772, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */ - { 5802, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */ - { 5836, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */ - { 5864, 0x00008225 }, /* GL_COMPRESSED_RED */ - { 5882, 0x00008226 }, /* GL_COMPRESSED_RG */ - { 5899, 0x000084ED }, /* GL_COMPRESSED_RGB */ - { 5917, 0x000084EE }, /* GL_COMPRESSED_RGBA */ - { 5936, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */ - { 5959, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - { 5988, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ - { 6021, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ - { 6054, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - { 6087, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */ - { 6109, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */ - { 6137, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ - { 6169, 0x00008C4A }, /* GL_COMPRESSED_SLUMINANCE */ - { 6194, 0x00008C4B }, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ - { 6225, 0x00008C48 }, /* GL_COMPRESSED_SRGB */ - { 6244, 0x00008C49 }, /* GL_COMPRESSED_SRGB_ALPHA */ - { 6269, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */ - { 6299, 0x0000911C }, /* GL_CONDITION_SATISFIED */ - { 6322, 0x00008576 }, /* GL_CONSTANT */ - { 6334, 0x00008003 }, /* GL_CONSTANT_ALPHA */ - { 6352, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */ - { 6374, 0x00008576 }, /* GL_CONSTANT_ARB */ - { 6390, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */ - { 6414, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */ - { 6436, 0x00008001 }, /* GL_CONSTANT_COLOR */ - { 6454, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */ - { 6476, 0x00008576 }, /* GL_CONSTANT_EXT */ - { 6492, 0x00000002 }, /* GL_CONTEXT_COMPATIBILITY_PROFILE_BIT */ - { 6529, 0x00000001 }, /* GL_CONTEXT_CORE_PROFILE_BIT */ - { 6557, 0x0000821E }, /* GL_CONTEXT_FLAGS */ - { 6574, 0x00000001 }, /* GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ - { 6613, 0x00009126 }, /* GL_CONTEXT_PROFILE_MASK */ - { 6637, 0x00008010 }, /* GL_CONVOLUTION_1D */ - { 6655, 0x00008011 }, /* GL_CONVOLUTION_2D */ - { 6673, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */ - { 6701, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */ - { 6732, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */ - { 6759, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */ - { 6790, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */ - { 6817, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */ - { 6848, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */ - { 6876, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */ - { 6908, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */ - { 6930, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */ - { 6956, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */ - { 6978, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */ - { 7004, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */ - { 7025, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */ - { 7050, 0x00008862 }, /* GL_COORD_REPLACE */ - { 7067, 0x00008862 }, /* GL_COORD_REPLACE_ARB */ - { 7088, 0x00008862 }, /* GL_COORD_REPLACE_NV */ - { 7108, 0x00008862 }, /* GL_COORD_REPLACE_OES */ - { 7129, 0x00001503 }, /* GL_COPY */ - { 7137, 0x0000150C }, /* GL_COPY_INVERTED */ - { 7154, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ - { 7174, 0x00008F36 }, /* GL_COPY_READ_BUFFER */ - { 7194, 0x00008F37 }, /* GL_COPY_WRITE_BUFFER */ - { 7215, 0x00000B44 }, /* GL_CULL_FACE */ - { 7228, 0x00000B45 }, /* GL_CULL_FACE_MODE */ - { 7246, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ - { 7265, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - { 7297, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ - { 7332, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ - { 7353, 0x00000001 }, /* GL_CURRENT_BIT */ - { 7368, 0x00000B00 }, /* GL_CURRENT_COLOR */ - { 7385, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ - { 7406, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ - { 7432, 0x00000B01 }, /* GL_CURRENT_INDEX */ - { 7449, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ - { 7471, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ - { 7499, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ - { 7520, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ - { 7554, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ - { 7587, 0x00000B02 }, /* GL_CURRENT_NORMAL */ - { 7605, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - { 7635, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_OES */ - { 7665, 0x00008B8D }, /* GL_CURRENT_PROGRAM */ - { 7684, 0x00008865 }, /* GL_CURRENT_QUERY */ - { 7701, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ - { 7722, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ - { 7746, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ - { 7773, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ - { 7797, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ - { 7824, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ - { 7857, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ - { 7891, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ - { 7924, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ - { 7951, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ - { 7977, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */ - { 8002, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ - { 8031, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ - { 8053, 0x00000900 }, /* GL_CW */ - { 8059, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */ - { 8080, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */ - { 8101, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */ - { 8121, 0x00002101 }, /* GL_DECAL */ - { 8130, 0x00001E03 }, /* GL_DECR */ - { 8138, 0x00008508 }, /* GL_DECR_WRAP */ - { 8151, 0x00008508 }, /* GL_DECR_WRAP_EXT */ - { 8168, 0x00008B80 }, /* GL_DELETE_STATUS */ - { 8185, 0x00001801 }, /* GL_DEPTH */ - { 8194, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ - { 8214, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */ - { 8238, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_OES */ - { 8262, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ - { 8282, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ - { 8306, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_OES */ - { 8330, 0x00000D1F }, /* GL_DEPTH_BIAS */ - { 8344, 0x00000D56 }, /* GL_DEPTH_BITS */ - { 8358, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ - { 8378, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ - { 8403, 0x00008223 }, /* GL_DEPTH_BUFFER */ - { 8419, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ - { 8439, 0x0000864F }, /* GL_DEPTH_CLAMP */ - { 8454, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ - { 8472, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ - { 8493, 0x00001902 }, /* GL_DEPTH_COMPONENT */ - { 8512, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ - { 8533, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ - { 8558, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_OES */ - { 8583, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ - { 8609, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ - { 8630, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ - { 8655, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_OES */ - { 8680, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ - { 8706, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ - { 8727, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ - { 8752, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_OES */ - { 8777, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ - { 8803, 0x00000B74 }, /* GL_DEPTH_FUNC */ - { 8817, 0x00000B70 }, /* GL_DEPTH_RANGE */ - { 8832, 0x00000D1E }, /* GL_DEPTH_SCALE */ - { 8847, 0x000084F9 }, /* GL_DEPTH_STENCIL */ - { 8864, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ - { 8892, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */ - { 8913, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ - { 8933, 0x000084F9 }, /* GL_DEPTH_STENCIL_OES */ - { 8954, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - { 8982, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - { 9010, 0x00000B71 }, /* GL_DEPTH_TEST */ - { 9024, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ - { 9046, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ - { 9072, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ - { 9091, 0x00001201 }, /* GL_DIFFUSE */ - { 9102, 0x00000BD0 }, /* GL_DITHER */ - { 9112, 0x00000A02 }, /* GL_DOMAIN */ - { 9122, 0x00001100 }, /* GL_DONT_CARE */ - { 9135, 0x000086AE }, /* GL_DOT3_RGB */ - { 9147, 0x000086AF }, /* GL_DOT3_RGBA */ - { 9160, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ - { 9177, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ - { 9194, 0x000086AE }, /* GL_DOT3_RGB_ARB */ - { 9210, 0x00008740 }, /* GL_DOT3_RGB_EXT */ - { 9226, 0x0000140A }, /* GL_DOUBLE */ - { 9236, 0x00000C32 }, /* GL_DOUBLEBUFFER */ - { 9252, 0x00000C01 }, /* GL_DRAW_BUFFER */ - { 9267, 0x00008825 }, /* GL_DRAW_BUFFER0 */ - { 9283, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ - { 9303, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ - { 9323, 0x00008826 }, /* GL_DRAW_BUFFER1 */ - { 9339, 0x0000882F }, /* GL_DRAW_BUFFER10 */ - { 9356, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ - { 9377, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ - { 9398, 0x00008830 }, /* GL_DRAW_BUFFER11 */ - { 9415, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ - { 9436, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ - { 9457, 0x00008831 }, /* GL_DRAW_BUFFER12 */ - { 9474, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ - { 9495, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ - { 9516, 0x00008832 }, /* GL_DRAW_BUFFER13 */ - { 9533, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ - { 9554, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ - { 9575, 0x00008833 }, /* GL_DRAW_BUFFER14 */ - { 9592, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ - { 9613, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ - { 9634, 0x00008834 }, /* GL_DRAW_BUFFER15 */ - { 9651, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ - { 9672, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ - { 9693, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ - { 9713, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ - { 9733, 0x00008827 }, /* GL_DRAW_BUFFER2 */ - { 9749, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ - { 9769, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ - { 9789, 0x00008828 }, /* GL_DRAW_BUFFER3 */ - { 9805, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ - { 9825, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ - { 9845, 0x00008829 }, /* GL_DRAW_BUFFER4 */ - { 9861, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ - { 9881, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ - { 9901, 0x0000882A }, /* GL_DRAW_BUFFER5 */ - { 9917, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ - { 9937, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ - { 9957, 0x0000882B }, /* GL_DRAW_BUFFER6 */ - { 9973, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ - { 9993, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ - { 10013, 0x0000882C }, /* GL_DRAW_BUFFER7 */ - { 10029, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ - { 10049, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ - { 10069, 0x0000882D }, /* GL_DRAW_BUFFER8 */ - { 10085, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ - { 10105, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ - { 10125, 0x0000882E }, /* GL_DRAW_BUFFER9 */ - { 10141, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ - { 10161, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ - { 10181, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ - { 10201, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */ - { 10229, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - { 10261, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ - { 10285, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ - { 10305, 0x00000304 }, /* GL_DST_ALPHA */ - { 10318, 0x00000306 }, /* GL_DST_COLOR */ - { 10331, 0x0000877A }, /* GL_DU8DV8_ATI */ - { 10345, 0x00008779 }, /* GL_DUDV_ATI */ - { 10357, 0x000088EA }, /* GL_DYNAMIC_COPY */ - { 10373, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ - { 10393, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ - { 10409, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ - { 10429, 0x000088E9 }, /* GL_DYNAMIC_READ */ - { 10445, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ - { 10465, 0x00000B43 }, /* GL_EDGE_FLAG */ - { 10478, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ - { 10497, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - { 10531, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ - { 10569, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ - { 10596, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - { 10622, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ - { 10646, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - { 10678, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ - { 10714, 0x00001600 }, /* GL_EMISSION */ - { 10726, 0x00002000 }, /* GL_ENABLE_BIT */ - { 10740, 0x00000202 }, /* GL_EQUAL */ - { 10749, 0x00001509 }, /* GL_EQUIV */ - { 10758, 0x00010000 }, /* GL_EVAL_BIT */ - { 10770, 0x00000800 }, /* GL_EXP */ - { 10777, 0x00000801 }, /* GL_EXP2 */ - { 10785, 0x00001F03 }, /* GL_EXTENSIONS */ - { 10799, 0x00002400 }, /* GL_EYE_LINEAR */ - { 10813, 0x00002502 }, /* GL_EYE_PLANE */ - { 10826, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ - { 10851, 0x0000855B }, /* GL_EYE_RADIAL_NV */ - { 10868, 0x00000000 }, /* GL_FALSE */ - { 10877, 0x00001101 }, /* GL_FASTEST */ - { 10888, 0x00001C01 }, /* GL_FEEDBACK */ - { 10900, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ - { 10927, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ - { 10951, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ - { 10975, 0x00001B02 }, /* GL_FILL */ - { 10983, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */ - { 11010, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ - { 11041, 0x0000140C }, /* GL_FIXED */ - { 11050, 0x0000140C }, /* GL_FIXED_OES */ - { 11063, 0x0000891D }, /* GL_FIXED_ONLY */ - { 11077, 0x00001D00 }, /* GL_FLAT */ - { 11085, 0x00001406 }, /* GL_FLOAT */ - { 11094, 0x00008B5A }, /* GL_FLOAT_MAT2 */ - { 11108, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ - { 11126, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ - { 11142, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ - { 11158, 0x00008B5B }, /* GL_FLOAT_MAT3 */ - { 11172, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ - { 11190, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ - { 11206, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ - { 11222, 0x00008B5C }, /* GL_FLOAT_MAT4 */ - { 11236, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ - { 11254, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ - { 11270, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ - { 11286, 0x00008B50 }, /* GL_FLOAT_VEC2 */ - { 11300, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ - { 11318, 0x00008B51 }, /* GL_FLOAT_VEC3 */ - { 11332, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ - { 11350, 0x00008B52 }, /* GL_FLOAT_VEC4 */ - { 11364, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ - { 11382, 0x00000B60 }, /* GL_FOG */ - { 11389, 0x00000080 }, /* GL_FOG_BIT */ - { 11400, 0x00000B66 }, /* GL_FOG_COLOR */ - { 11413, 0x00008451 }, /* GL_FOG_COORD */ - { 11426, 0x00008451 }, /* GL_FOG_COORDINATE */ - { 11444, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ - { 11468, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - { 11507, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ - { 11550, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - { 11582, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - { 11613, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - { 11642, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ - { 11667, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ - { 11686, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ - { 11720, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ - { 11747, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ - { 11773, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ - { 11797, 0x00008450 }, /* GL_FOG_COORD_SRC */ - { 11814, 0x00000B62 }, /* GL_FOG_DENSITY */ - { 11829, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ - { 11853, 0x00000B64 }, /* GL_FOG_END */ - { 11864, 0x00000C54 }, /* GL_FOG_HINT */ - { 11876, 0x00000B61 }, /* GL_FOG_INDEX */ - { 11889, 0x00000B65 }, /* GL_FOG_MODE */ - { 11901, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ - { 11920, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ - { 11945, 0x00000B63 }, /* GL_FOG_START */ - { 11958, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ - { 11976, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ - { 12000, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ - { 12019, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ - { 12042, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - { 12077, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES */ - { 12116, 0x00008D40 }, /* GL_FRAMEBUFFER */ - { 12131, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - { 12168, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - { 12204, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - { 12245, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - { 12286, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - { 12323, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - { 12360, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */ - { 12394, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB */ - { 12432, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - { 12470, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ - { 12512, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES */ - { 12554, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - { 12592, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ - { 12634, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES */ - { 12676, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - { 12711, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - { 12750, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ - { 12799, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES */ - { 12848, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - { 12896, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ - { 12948, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES */ - { 13000, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - { 13040, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ - { 13084, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - { 13124, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ - { 13168, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES */ - { 13212, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */ - { 13235, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ - { 13262, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_OES */ - { 13289, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ - { 13313, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ - { 13341, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_OES */ - { 13369, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ - { 13392, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ - { 13411, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - { 13448, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ - { 13489, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES */ - { 13530, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS */ - { 13567, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - { 13608, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES */ - { 13649, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ - { 13687, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - { 13729, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES */ - { 13771, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - { 13822, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - { 13860, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES */ - { 13898, 0x00008DA9 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */ - { 13940, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */ - { 13980, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB */ - { 14024, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - { 14069, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ - { 14118, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES */ - { 14167, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - { 14205, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */ - { 14247, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ - { 14285, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - { 14327, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES */ - { 14369, 0x00008D40 }, /* GL_FRAMEBUFFER_OES */ - { 14388, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - { 14420, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ - { 14445, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ - { 14472, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ - { 14503, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_OES */ - { 14534, 0x00000404 }, /* GL_FRONT */ - { 14543, 0x00000408 }, /* GL_FRONT_AND_BACK */ - { 14561, 0x00000B46 }, /* GL_FRONT_FACE */ - { 14575, 0x00000400 }, /* GL_FRONT_LEFT */ - { 14589, 0x00000401 }, /* GL_FRONT_RIGHT */ - { 14604, 0x00008006 }, /* GL_FUNC_ADD */ - { 14616, 0x00008006 }, /* GL_FUNC_ADD_EXT */ - { 14632, 0x00008006 }, /* GL_FUNC_ADD_OES */ - { 14648, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ - { 14673, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ - { 14702, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_OES */ - { 14731, 0x0000800A }, /* GL_FUNC_SUBTRACT */ - { 14748, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ - { 14769, 0x0000800A }, /* GL_FUNC_SUBTRACT_OES */ - { 14790, 0x00008191 }, /* GL_GENERATE_MIPMAP */ - { 14809, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ - { 14833, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ - { 14862, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ - { 14886, 0x00008917 }, /* GL_GEOMETRY_INPUT_TYPE */ - { 14909, 0x00008DDB }, /* GL_GEOMETRY_INPUT_TYPE_ARB */ - { 14936, 0x00008918 }, /* GL_GEOMETRY_OUTPUT_TYPE */ - { 14960, 0x00008DDC }, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */ - { 14988, 0x00008DD9 }, /* GL_GEOMETRY_SHADER */ - { 15007, 0x00008DD9 }, /* GL_GEOMETRY_SHADER_ARB */ - { 15030, 0x00008916 }, /* GL_GEOMETRY_VERTICES_OUT */ - { 15055, 0x00008DDA }, /* GL_GEOMETRY_VERTICES_OUT_ARB */ - { 15084, 0x00000206 }, /* GL_GEQUAL */ - { 15094, 0x00000204 }, /* GL_GREATER */ - { 15105, 0x00001904 }, /* GL_GREEN */ - { 15114, 0x00000D19 }, /* GL_GREEN_BIAS */ - { 15128, 0x00000D53 }, /* GL_GREEN_BITS */ - { 15142, 0x00008D95 }, /* GL_GREEN_INTEGER */ - { 15159, 0x00008D95 }, /* GL_GREEN_INTEGER_EXT */ - { 15180, 0x00000D18 }, /* GL_GREEN_SCALE */ - { 15195, 0x0000140B }, /* GL_HALF_FLOAT */ - { 15209, 0x00008D61 }, /* GL_HALF_FLOAT_OES */ - { 15227, 0x00008DF2 }, /* GL_HIGH_FLOAT */ - { 15241, 0x00008DF5 }, /* GL_HIGH_INT */ - { 15253, 0x00008000 }, /* GL_HINT_BIT */ - { 15265, 0x00008024 }, /* GL_HISTOGRAM */ - { 15278, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ - { 15302, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ - { 15330, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ - { 15353, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ - { 15380, 0x00008024 }, /* GL_HISTOGRAM_EXT */ - { 15397, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ - { 15417, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ - { 15441, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ - { 15465, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ - { 15493, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - { 15521, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ - { 15553, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ - { 15575, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ - { 15601, 0x0000802D }, /* GL_HISTOGRAM_SINK */ - { 15619, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ - { 15641, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ - { 15660, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ - { 15683, 0x0000862A }, /* GL_IDENTITY_NV */ - { 15698, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ - { 15718, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */ - { 15754, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - { 15794, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */ - { 15828, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - { 15866, 0x00001E02 }, /* GL_INCR */ - { 15874, 0x00008507 }, /* GL_INCR_WRAP */ - { 15887, 0x00008507 }, /* GL_INCR_WRAP_EXT */ - { 15904, 0x00008222 }, /* GL_INDEX */ - { 15913, 0x00008077 }, /* GL_INDEX_ARRAY */ - { 15928, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - { 15958, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ - { 15992, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ - { 16015, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ - { 16037, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ - { 16057, 0x00000D51 }, /* GL_INDEX_BITS */ - { 16071, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ - { 16092, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ - { 16110, 0x00000C30 }, /* GL_INDEX_MODE */ - { 16124, 0x00000D13 }, /* GL_INDEX_OFFSET */ - { 16140, 0x00000D12 }, /* GL_INDEX_SHIFT */ - { 16155, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ - { 16174, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ - { 16193, 0x00001404 }, /* GL_INT */ - { 16200, 0x00008049 }, /* GL_INTENSITY */ - { 16213, 0x0000804C }, /* GL_INTENSITY12 */ - { 16228, 0x0000804C }, /* GL_INTENSITY12_EXT */ - { 16247, 0x0000804D }, /* GL_INTENSITY16 */ - { 16262, 0x00008D8B }, /* GL_INTENSITY16I_EXT */ - { 16282, 0x00008D79 }, /* GL_INTENSITY16UI_EXT */ - { 16303, 0x0000804D }, /* GL_INTENSITY16_EXT */ - { 16322, 0x00008D85 }, /* GL_INTENSITY32I_EXT */ - { 16342, 0x00008D73 }, /* GL_INTENSITY32UI_EXT */ - { 16363, 0x0000804A }, /* GL_INTENSITY4 */ - { 16377, 0x0000804A }, /* GL_INTENSITY4_EXT */ - { 16395, 0x0000804B }, /* GL_INTENSITY8 */ - { 16409, 0x00008D91 }, /* GL_INTENSITY8I_EXT */ - { 16428, 0x00008D7F }, /* GL_INTENSITY8UI_EXT */ - { 16448, 0x0000804B }, /* GL_INTENSITY8_EXT */ - { 16466, 0x00008049 }, /* GL_INTENSITY_EXT */ - { 16483, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS */ - { 16506, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS_EXT */ - { 16533, 0x00008575 }, /* GL_INTERPOLATE */ - { 16548, 0x00008575 }, /* GL_INTERPOLATE_ARB */ - { 16567, 0x00008575 }, /* GL_INTERPOLATE_EXT */ - { 16586, 0x00008DF7 }, /* GL_INT_10_10_10_2_OES */ - { 16608, 0x00008DC9 }, /* GL_INT_SAMPLER_1D */ - { 16626, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY */ - { 16650, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY_EXT */ - { 16678, 0x00008DC9 }, /* GL_INT_SAMPLER_1D_EXT */ - { 16700, 0x00008DCA }, /* GL_INT_SAMPLER_2D */ - { 16718, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY */ - { 16742, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY_EXT */ - { 16770, 0x00008DCA }, /* GL_INT_SAMPLER_2D_EXT */ - { 16792, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT */ - { 16815, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT_EXT */ - { 16842, 0x00008DCB }, /* GL_INT_SAMPLER_3D */ - { 16860, 0x00008DCB }, /* GL_INT_SAMPLER_3D_EXT */ - { 16882, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER */ - { 16904, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER_EXT */ - { 16930, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE */ - { 16950, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE_EXT */ - { 16974, 0x00008B53 }, /* GL_INT_VEC2 */ - { 16986, 0x00008B53 }, /* GL_INT_VEC2_ARB */ - { 17002, 0x00008B54 }, /* GL_INT_VEC3 */ - { 17014, 0x00008B54 }, /* GL_INT_VEC3_ARB */ - { 17030, 0x00008B55 }, /* GL_INT_VEC4 */ - { 17042, 0x00008B55 }, /* GL_INT_VEC4_ARB */ - { 17058, 0x00000500 }, /* GL_INVALID_ENUM */ - { 17074, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ - { 17107, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ - { 17144, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_OES */ - { 17181, 0x00000502 }, /* GL_INVALID_OPERATION */ - { 17202, 0x00000501 }, /* GL_INVALID_VALUE */ - { 17219, 0x0000862B }, /* GL_INVERSE_NV */ - { 17233, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ - { 17257, 0x0000150A }, /* GL_INVERT */ - { 17267, 0x00001E00 }, /* GL_KEEP */ - { 17275, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */ - { 17301, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ - { 17331, 0x00000406 }, /* GL_LEFT */ - { 17339, 0x00000203 }, /* GL_LEQUAL */ - { 17349, 0x00000201 }, /* GL_LESS */ - { 17357, 0x00004000 }, /* GL_LIGHT0 */ - { 17367, 0x00004001 }, /* GL_LIGHT1 */ - { 17377, 0x00004002 }, /* GL_LIGHT2 */ - { 17387, 0x00004003 }, /* GL_LIGHT3 */ - { 17397, 0x00004004 }, /* GL_LIGHT4 */ - { 17407, 0x00004005 }, /* GL_LIGHT5 */ - { 17417, 0x00004006 }, /* GL_LIGHT6 */ - { 17427, 0x00004007 }, /* GL_LIGHT7 */ - { 17437, 0x00000B50 }, /* GL_LIGHTING */ - { 17449, 0x00000040 }, /* GL_LIGHTING_BIT */ - { 17465, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ - { 17488, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - { 17517, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ - { 17550, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - { 17578, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ - { 17602, 0x00001B01 }, /* GL_LINE */ - { 17610, 0x00002601 }, /* GL_LINEAR */ - { 17620, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ - { 17642, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - { 17672, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - { 17703, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ - { 17727, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ - { 17752, 0x00000001 }, /* GL_LINES */ - { 17761, 0x0000000A }, /* GL_LINES_ADJACENCY */ - { 17780, 0x0000000A }, /* GL_LINES_ADJACENCY_ARB */ - { 17803, 0x00000004 }, /* GL_LINE_BIT */ - { 17815, 0x00000002 }, /* GL_LINE_LOOP */ - { 17828, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ - { 17848, 0x00000B20 }, /* GL_LINE_SMOOTH */ - { 17863, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ - { 17883, 0x00000B24 }, /* GL_LINE_STIPPLE */ - { 17899, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ - { 17923, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ - { 17946, 0x00000003 }, /* GL_LINE_STRIP */ - { 17960, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY */ - { 17984, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY_ARB */ - { 18012, 0x00000702 }, /* GL_LINE_TOKEN */ - { 18026, 0x00000B21 }, /* GL_LINE_WIDTH */ - { 18040, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ - { 18066, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ - { 18086, 0x00008B82 }, /* GL_LINK_STATUS */ - { 18101, 0x00000B32 }, /* GL_LIST_BASE */ - { 18114, 0x00020000 }, /* GL_LIST_BIT */ - { 18126, 0x00000B33 }, /* GL_LIST_INDEX */ - { 18140, 0x00000B30 }, /* GL_LIST_MODE */ - { 18153, 0x00000101 }, /* GL_LOAD */ - { 18161, 0x00000BF1 }, /* GL_LOGIC_OP */ - { 18173, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ - { 18190, 0x00008CA1 }, /* GL_LOWER_LEFT */ - { 18204, 0x00008DF0 }, /* GL_LOW_FLOAT */ - { 18217, 0x00008DF3 }, /* GL_LOW_INT */ - { 18228, 0x00001909 }, /* GL_LUMINANCE */ - { 18241, 0x00008041 }, /* GL_LUMINANCE12 */ - { 18256, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ - { 18279, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ - { 18306, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ - { 18328, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ - { 18354, 0x00008041 }, /* GL_LUMINANCE12_EXT */ - { 18373, 0x00008042 }, /* GL_LUMINANCE16 */ - { 18388, 0x00008D8C }, /* GL_LUMINANCE16I_EXT */ - { 18408, 0x00008D7A }, /* GL_LUMINANCE16UI_EXT */ - { 18429, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ - { 18452, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ - { 18479, 0x00008042 }, /* GL_LUMINANCE16_EXT */ - { 18498, 0x00008D86 }, /* GL_LUMINANCE32I_EXT */ - { 18518, 0x00008D74 }, /* GL_LUMINANCE32UI_EXT */ - { 18539, 0x0000803F }, /* GL_LUMINANCE4 */ - { 18553, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ - { 18574, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ - { 18599, 0x0000803F }, /* GL_LUMINANCE4_EXT */ - { 18617, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ - { 18638, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ - { 18663, 0x00008040 }, /* GL_LUMINANCE8 */ - { 18677, 0x00008D92 }, /* GL_LUMINANCE8I_EXT */ - { 18696, 0x00008D80 }, /* GL_LUMINANCE8UI_EXT */ - { 18716, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ - { 18737, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ - { 18762, 0x00008040 }, /* GL_LUMINANCE8_EXT */ - { 18780, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ - { 18799, 0x00008D8D }, /* GL_LUMINANCE_ALPHA16I_EXT */ - { 18825, 0x00008D7B }, /* GL_LUMINANCE_ALPHA16UI_EXT */ - { 18852, 0x00008D87 }, /* GL_LUMINANCE_ALPHA32I_EXT */ - { 18878, 0x00008D75 }, /* GL_LUMINANCE_ALPHA32UI_EXT */ - { 18905, 0x00008D93 }, /* GL_LUMINANCE_ALPHA8I_EXT */ - { 18930, 0x00008D81 }, /* GL_LUMINANCE_ALPHA8UI_EXT */ - { 18956, 0x00008D9D }, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */ - { 18987, 0x00008D9C }, /* GL_LUMINANCE_INTEGER_EXT */ - { 19012, 0x0000821B }, /* GL_MAJOR_VERSION */ - { 19029, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ - { 19045, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ - { 19065, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ - { 19087, 0x00000D91 }, /* GL_MAP1_INDEX */ - { 19101, 0x00000D92 }, /* GL_MAP1_NORMAL */ - { 19116, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ - { 19140, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ - { 19164, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ - { 19188, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ - { 19212, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ - { 19229, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ - { 19246, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - { 19274, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - { 19303, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - { 19332, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - { 19361, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - { 19390, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - { 19419, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - { 19448, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - { 19476, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - { 19504, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - { 19532, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - { 19560, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - { 19588, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - { 19616, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - { 19644, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - { 19672, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - { 19700, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ - { 19716, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ - { 19736, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ - { 19758, 0x00000DB1 }, /* GL_MAP2_INDEX */ - { 19772, 0x00000DB2 }, /* GL_MAP2_NORMAL */ - { 19787, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ - { 19811, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ - { 19835, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ - { 19859, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ - { 19883, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ - { 19900, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ - { 19917, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - { 19945, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - { 19974, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - { 20003, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - { 20032, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - { 20061, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - { 20090, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - { 20119, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - { 20147, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - { 20175, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - { 20203, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - { 20231, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - { 20259, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - { 20287, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ - { 20315, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - { 20343, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - { 20371, 0x00000D10 }, /* GL_MAP_COLOR */ - { 20384, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ - { 20410, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ - { 20439, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ - { 20467, 0x00000001 }, /* GL_MAP_READ_BIT */ - { 20483, 0x00000D11 }, /* GL_MAP_STENCIL */ - { 20498, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ - { 20524, 0x00000002 }, /* GL_MAP_WRITE_BIT */ - { 20541, 0x000088C0 }, /* GL_MATRIX0_ARB */ - { 20556, 0x00008630 }, /* GL_MATRIX0_NV */ - { 20570, 0x000088CA }, /* GL_MATRIX10_ARB */ - { 20586, 0x000088CB }, /* GL_MATRIX11_ARB */ - { 20602, 0x000088CC }, /* GL_MATRIX12_ARB */ - { 20618, 0x000088CD }, /* GL_MATRIX13_ARB */ - { 20634, 0x000088CE }, /* GL_MATRIX14_ARB */ - { 20650, 0x000088CF }, /* GL_MATRIX15_ARB */ - { 20666, 0x000088D0 }, /* GL_MATRIX16_ARB */ - { 20682, 0x000088D1 }, /* GL_MATRIX17_ARB */ - { 20698, 0x000088D2 }, /* GL_MATRIX18_ARB */ - { 20714, 0x000088D3 }, /* GL_MATRIX19_ARB */ - { 20730, 0x000088C1 }, /* GL_MATRIX1_ARB */ - { 20745, 0x00008631 }, /* GL_MATRIX1_NV */ - { 20759, 0x000088D4 }, /* GL_MATRIX20_ARB */ - { 20775, 0x000088D5 }, /* GL_MATRIX21_ARB */ - { 20791, 0x000088D6 }, /* GL_MATRIX22_ARB */ - { 20807, 0x000088D7 }, /* GL_MATRIX23_ARB */ - { 20823, 0x000088D8 }, /* GL_MATRIX24_ARB */ - { 20839, 0x000088D9 }, /* GL_MATRIX25_ARB */ - { 20855, 0x000088DA }, /* GL_MATRIX26_ARB */ - { 20871, 0x000088DB }, /* GL_MATRIX27_ARB */ - { 20887, 0x000088DC }, /* GL_MATRIX28_ARB */ - { 20903, 0x000088DD }, /* GL_MATRIX29_ARB */ - { 20919, 0x000088C2 }, /* GL_MATRIX2_ARB */ - { 20934, 0x00008632 }, /* GL_MATRIX2_NV */ - { 20948, 0x000088DE }, /* GL_MATRIX30_ARB */ - { 20964, 0x000088DF }, /* GL_MATRIX31_ARB */ - { 20980, 0x000088C3 }, /* GL_MATRIX3_ARB */ - { 20995, 0x00008633 }, /* GL_MATRIX3_NV */ - { 21009, 0x000088C4 }, /* GL_MATRIX4_ARB */ - { 21024, 0x00008634 }, /* GL_MATRIX4_NV */ - { 21038, 0x000088C5 }, /* GL_MATRIX5_ARB */ - { 21053, 0x00008635 }, /* GL_MATRIX5_NV */ - { 21067, 0x000088C6 }, /* GL_MATRIX6_ARB */ - { 21082, 0x00008636 }, /* GL_MATRIX6_NV */ - { 21096, 0x000088C7 }, /* GL_MATRIX7_ARB */ - { 21111, 0x00008637 }, /* GL_MATRIX7_NV */ - { 21125, 0x000088C8 }, /* GL_MATRIX8_ARB */ - { 21140, 0x000088C9 }, /* GL_MATRIX9_ARB */ - { 21155, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ - { 21181, 0x00008B9E }, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */ - { 21222, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_OES */ - { 21248, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - { 21282, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_OES */ - { 21316, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - { 21347, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_OES */ - { 21378, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - { 21411, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_OES */ - { 21444, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - { 21475, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_OES */ - { 21506, 0x00000BA0 }, /* GL_MATRIX_MODE */ - { 21521, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ - { 21543, 0x00008840 }, /* GL_MATRIX_PALETTE_OES */ - { 21565, 0x00008008 }, /* GL_MAX */ - { 21572, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ - { 21595, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE_OES */ - { 21622, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS */ - { 21650, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - { 21682, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ - { 21708, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - { 21741, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - { 21767, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 21801, 0x00000D32 }, /* GL_MAX_CLIP_DISTANCES */ - { 21823, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ - { 21842, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */ - { 21867, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ - { 21896, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - { 21928, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 21964, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - { 22000, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ - { 22040, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ - { 22066, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ - { 22096, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ - { 22121, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ - { 22150, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - { 22179, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ - { 22212, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES */ - { 22245, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ - { 22265, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ - { 22289, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ - { 22313, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ - { 22337, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ - { 22362, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ - { 22380, 0x00008008 }, /* GL_MAX_EXT */ - { 22391, 0x00009125 }, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */ - { 22424, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - { 22459, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ - { 22498, 0x00008DFD }, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */ - { 22530, 0x00009123 }, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */ - { 22563, 0x00009124 }, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */ - { 22597, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */ - { 22629, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB */ - { 22665, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */ - { 22701, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB */ - { 22741, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */ - { 22781, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB */ - { 22825, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */ - { 22860, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB */ - { 22899, 0x00008DDD }, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */ - { 22938, 0x00000D31 }, /* GL_MAX_LIGHTS */ - { 22952, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ - { 22972, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - { 23010, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - { 23039, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ - { 23063, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ - { 23091, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_OES */ - { 23119, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ - { 23142, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 23179, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 23215, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - { 23242, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - { 23271, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - { 23305, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - { 23341, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - { 23368, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - { 23400, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - { 23436, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - { 23465, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - { 23494, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ - { 23522, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - { 23560, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 23604, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 23647, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 23681, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 23720, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 23757, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 23795, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 23838, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 23881, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - { 23911, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - { 23942, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET */ - { 23970, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET_EXT */ - { 24002, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 24038, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 24074, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ - { 24104, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */ - { 24134, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - { 24168, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ - { 24201, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */ - { 24226, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ - { 24255, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_OES */ - { 24284, 0x00008D57 }, /* GL_MAX_SAMPLES */ - { 24299, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */ - { 24318, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */ - { 24345, 0x00008504 }, /* GL_MAX_SHININESS_NV */ - { 24365, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ - { 24389, 0x00008C2B }, /* GL_MAX_TEXTURE_BUFFER_SIZE */ - { 24416, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ - { 24438, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ - { 24464, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - { 24491, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ - { 24522, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ - { 24546, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS_EXT */ - { 24574, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - { 24608, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ - { 24628, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ - { 24655, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ - { 24676, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ - { 24701, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ - { 24726, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ - { 24761, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */ - { 24810, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */ - { 24863, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */ - { 24906, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */ - { 24953, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */ - { 24999, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */ - { 25049, 0x00008B4B }, /* GL_MAX_VARYING_COMPONENTS */ - { 25075, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ - { 25097, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ - { 25123, 0x00008DFC }, /* GL_MAX_VARYING_VECTORS */ - { 25146, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ - { 25168, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ - { 25194, 0x00009122 }, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */ - { 25226, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - { 25260, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ - { 25298, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - { 25331, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ - { 25368, 0x00008DFB }, /* GL_MAX_VERTEX_UNIFORM_VECTORS */ - { 25398, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ - { 25422, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_OES */ - { 25446, 0x00008DDE }, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */ - { 25483, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ - { 25504, 0x00008DF1 }, /* GL_MEDIUM_FLOAT */ - { 25520, 0x00008DF4 }, /* GL_MEDIUM_INT */ - { 25534, 0x00008007 }, /* GL_MIN */ - { 25541, 0x0000802E }, /* GL_MINMAX */ - { 25551, 0x0000802E }, /* GL_MINMAX_EXT */ - { 25565, 0x0000802F }, /* GL_MINMAX_FORMAT */ - { 25582, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ - { 25603, 0x00008030 }, /* GL_MINMAX_SINK */ - { 25618, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ - { 25637, 0x0000821C }, /* GL_MINOR_VERSION */ - { 25654, 0x00008007 }, /* GL_MIN_EXT */ - { 25665, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET */ - { 25693, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET_EXT */ - { 25725, 0x00008370 }, /* GL_MIRRORED_REPEAT */ - { 25744, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ - { 25767, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ - { 25790, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ - { 25810, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ - { 25830, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - { 25860, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ - { 25888, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - { 25916, 0x00001700 }, /* GL_MODELVIEW */ - { 25929, 0x00001700 }, /* GL_MODELVIEW0_ARB */ - { 25947, 0x0000872A }, /* GL_MODELVIEW10_ARB */ - { 25966, 0x0000872B }, /* GL_MODELVIEW11_ARB */ - { 25985, 0x0000872C }, /* GL_MODELVIEW12_ARB */ - { 26004, 0x0000872D }, /* GL_MODELVIEW13_ARB */ - { 26023, 0x0000872E }, /* GL_MODELVIEW14_ARB */ - { 26042, 0x0000872F }, /* GL_MODELVIEW15_ARB */ - { 26061, 0x00008730 }, /* GL_MODELVIEW16_ARB */ - { 26080, 0x00008731 }, /* GL_MODELVIEW17_ARB */ - { 26099, 0x00008732 }, /* GL_MODELVIEW18_ARB */ - { 26118, 0x00008733 }, /* GL_MODELVIEW19_ARB */ - { 26137, 0x0000850A }, /* GL_MODELVIEW1_ARB */ - { 26155, 0x00008734 }, /* GL_MODELVIEW20_ARB */ - { 26174, 0x00008735 }, /* GL_MODELVIEW21_ARB */ - { 26193, 0x00008736 }, /* GL_MODELVIEW22_ARB */ - { 26212, 0x00008737 }, /* GL_MODELVIEW23_ARB */ - { 26231, 0x00008738 }, /* GL_MODELVIEW24_ARB */ - { 26250, 0x00008739 }, /* GL_MODELVIEW25_ARB */ - { 26269, 0x0000873A }, /* GL_MODELVIEW26_ARB */ - { 26288, 0x0000873B }, /* GL_MODELVIEW27_ARB */ - { 26307, 0x0000873C }, /* GL_MODELVIEW28_ARB */ - { 26326, 0x0000873D }, /* GL_MODELVIEW29_ARB */ - { 26345, 0x00008722 }, /* GL_MODELVIEW2_ARB */ - { 26363, 0x0000873E }, /* GL_MODELVIEW30_ARB */ - { 26382, 0x0000873F }, /* GL_MODELVIEW31_ARB */ - { 26401, 0x00008723 }, /* GL_MODELVIEW3_ARB */ - { 26419, 0x00008724 }, /* GL_MODELVIEW4_ARB */ - { 26437, 0x00008725 }, /* GL_MODELVIEW5_ARB */ - { 26455, 0x00008726 }, /* GL_MODELVIEW6_ARB */ - { 26473, 0x00008727 }, /* GL_MODELVIEW7_ARB */ - { 26491, 0x00008728 }, /* GL_MODELVIEW8_ARB */ - { 26509, 0x00008729 }, /* GL_MODELVIEW9_ARB */ - { 26527, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ - { 26547, 0x0000898D }, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */ - { 26589, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ - { 26616, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ - { 26641, 0x00002100 }, /* GL_MODULATE */ - { 26653, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ - { 26673, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ - { 26700, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ - { 26725, 0x00000103 }, /* GL_MULT */ - { 26733, 0x0000809D }, /* GL_MULTISAMPLE */ - { 26748, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ - { 26768, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ - { 26787, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ - { 26806, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ - { 26830, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ - { 26853, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - { 26883, 0x00002A25 }, /* GL_N3F_V3F */ - { 26894, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ - { 26914, 0x0000150E }, /* GL_NAND */ - { 26922, 0x00002600 }, /* GL_NEAREST */ - { 26933, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - { 26964, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - { 26996, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ - { 27021, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ - { 27047, 0x00000200 }, /* GL_NEVER */ - { 27056, 0x00001102 }, /* GL_NICEST */ - { 27066, 0x00000000 }, /* GL_NONE */ - { 27074, 0x00000000 }, /* GL_NONE_OES */ - { 27086, 0x00001505 }, /* GL_NOOP */ - { 27094, 0x00001508 }, /* GL_NOR */ - { 27101, 0x00000BA1 }, /* GL_NORMALIZE */ - { 27114, 0x00008075 }, /* GL_NORMAL_ARRAY */ - { 27130, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - { 27161, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ - { 27196, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ - { 27220, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ - { 27243, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ - { 27264, 0x00008511 }, /* GL_NORMAL_MAP */ - { 27278, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ - { 27296, 0x00008511 }, /* GL_NORMAL_MAP_NV */ - { 27313, 0x00008511 }, /* GL_NORMAL_MAP_OES */ - { 27331, 0x00000205 }, /* GL_NOTEQUAL */ - { 27343, 0x00000000 }, /* GL_NO_ERROR */ - { 27355, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - { 27389, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ - { 27427, 0x0000821D }, /* GL_NUM_EXTENSIONS */ - { 27445, 0x000087FE }, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */ - { 27479, 0x00008DF9 }, /* GL_NUM_SHADER_BINARY_FORMATS */ - { 27508, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ - { 27540, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ - { 27582, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ - { 27612, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ - { 27652, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ - { 27683, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ - { 27712, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ - { 27740, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ - { 27770, 0x00002401 }, /* GL_OBJECT_LINEAR */ - { 27787, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ - { 27813, 0x00002501 }, /* GL_OBJECT_PLANE */ - { 27829, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ - { 27864, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ - { 27886, 0x00009112 }, /* GL_OBJECT_TYPE */ - { 27901, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ - { 27920, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ - { 27950, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ - { 27971, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ - { 27999, 0x00000001 }, /* GL_ONE */ - { 28006, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - { 28034, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ - { 28066, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ - { 28094, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ - { 28126, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ - { 28149, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ - { 28172, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ - { 28195, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ - { 28218, 0x00008598 }, /* GL_OPERAND0_ALPHA */ - { 28236, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ - { 28258, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ - { 28280, 0x00008590 }, /* GL_OPERAND0_RGB */ - { 28296, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ - { 28316, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ - { 28336, 0x00008599 }, /* GL_OPERAND1_ALPHA */ - { 28354, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ - { 28376, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ - { 28398, 0x00008591 }, /* GL_OPERAND1_RGB */ - { 28414, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ - { 28434, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ - { 28454, 0x0000859A }, /* GL_OPERAND2_ALPHA */ - { 28472, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ - { 28494, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ - { 28516, 0x00008592 }, /* GL_OPERAND2_RGB */ - { 28532, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ - { 28552, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ - { 28572, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ - { 28593, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ - { 28612, 0x00001507 }, /* GL_OR */ - { 28618, 0x00000A01 }, /* GL_ORDER */ - { 28627, 0x0000150D }, /* GL_OR_INVERTED */ - { 28642, 0x0000150B }, /* GL_OR_REVERSE */ - { 28656, 0x00000505 }, /* GL_OUT_OF_MEMORY */ - { 28673, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ - { 28691, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ - { 28712, 0x00008758 }, /* GL_PACK_INVERT_MESA */ - { 28732, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ - { 28750, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ - { 28769, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ - { 28789, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ - { 28809, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ - { 28827, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ - { 28846, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ - { 28871, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ - { 28895, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ - { 28916, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ - { 28938, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ - { 28960, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ - { 28985, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ - { 29009, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ - { 29030, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ - { 29052, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ - { 29074, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ - { 29096, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ - { 29127, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ - { 29147, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - { 29172, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ - { 29192, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - { 29217, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ - { 29237, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - { 29262, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ - { 29282, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - { 29307, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ - { 29327, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - { 29352, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ - { 29372, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - { 29397, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ - { 29417, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - { 29442, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ - { 29462, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - { 29487, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ - { 29507, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - { 29532, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ - { 29552, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - { 29577, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ - { 29595, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ - { 29616, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ - { 29645, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ - { 29678, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ - { 29703, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ - { 29726, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - { 29757, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ - { 29792, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ - { 29819, 0x00001B00 }, /* GL_POINT */ - { 29828, 0x00000000 }, /* GL_POINTS */ - { 29838, 0x00000002 }, /* GL_POINT_BIT */ - { 29851, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ - { 29881, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ - { 29915, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ - { 29949, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ - { 29984, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ - { 30013, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ - { 30046, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ - { 30079, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ - { 30113, 0x00000B11 }, /* GL_POINT_SIZE */ - { 30127, 0x00008B9F }, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */ - { 30166, 0x00008B9C }, /* GL_POINT_SIZE_ARRAY_OES */ - { 30190, 0x0000898C }, /* GL_POINT_SIZE_ARRAY_POINTER_OES */ - { 30222, 0x0000898B }, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */ - { 30253, 0x0000898A }, /* GL_POINT_SIZE_ARRAY_TYPE_OES */ - { 30282, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ - { 30308, 0x00008127 }, /* GL_POINT_SIZE_MAX */ - { 30326, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ - { 30348, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ - { 30370, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ - { 30393, 0x00008126 }, /* GL_POINT_SIZE_MIN */ - { 30411, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ - { 30433, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ - { 30455, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ - { 30478, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ - { 30498, 0x00000B10 }, /* GL_POINT_SMOOTH */ - { 30514, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ - { 30535, 0x00008861 }, /* GL_POINT_SPRITE */ - { 30551, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ - { 30571, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ - { 30600, 0x00008861 }, /* GL_POINT_SPRITE_NV */ - { 30619, 0x00008861 }, /* GL_POINT_SPRITE_OES */ - { 30639, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ - { 30665, 0x00000701 }, /* GL_POINT_TOKEN */ - { 30680, 0x00000009 }, /* GL_POLYGON */ - { 30691, 0x00000008 }, /* GL_POLYGON_BIT */ - { 30706, 0x00000B40 }, /* GL_POLYGON_MODE */ - { 30722, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ - { 30745, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ - { 30770, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ - { 30793, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ - { 30816, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ - { 30840, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ - { 30864, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ - { 30882, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ - { 30905, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ - { 30924, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ - { 30947, 0x00000703 }, /* GL_POLYGON_TOKEN */ - { 30964, 0x00001203 }, /* GL_POSITION */ - { 30976, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - { 31008, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ - { 31044, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - { 31077, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ - { 31114, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - { 31145, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ - { 31180, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - { 31212, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ - { 31248, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - { 31281, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - { 31313, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ - { 31349, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - { 31382, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ - { 31419, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - { 31449, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ - { 31483, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - { 31514, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ - { 31549, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - { 31580, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ - { 31615, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - { 31647, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ - { 31683, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - { 31713, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ - { 31747, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - { 31778, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ - { 31813, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - { 31845, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - { 31876, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ - { 31911, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - { 31943, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ - { 31979, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ - { 32008, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ - { 32041, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ - { 32071, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ - { 32105, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - { 32144, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - { 32177, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - { 32217, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - { 32251, 0x00008578 }, /* GL_PREVIOUS */ - { 32263, 0x00008578 }, /* GL_PREVIOUS_ARB */ - { 32279, 0x00008578 }, /* GL_PREVIOUS_EXT */ - { 32295, 0x00008577 }, /* GL_PRIMARY_COLOR */ - { 32312, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ - { 32333, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ - { 32354, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED */ - { 32378, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED_EXT */ - { 32406, 0x00008F9D }, /* GL_PRIMITIVE_RESTART */ - { 32427, 0x00008F9E }, /* GL_PRIMITIVE_RESTART_INDEX */ - { 32454, 0x00008559 }, /* GL_PRIMITIVE_RESTART_INDEX_NV */ - { 32484, 0x00008558 }, /* GL_PRIMITIVE_RESTART_NV */ - { 32508, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 32541, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 32573, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ - { 32596, 0x000087FF }, /* GL_PROGRAM_BINARY_FORMATS_OES */ - { 32626, 0x00008741 }, /* GL_PROGRAM_BINARY_LENGTH_OES */ - { 32655, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ - { 32678, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ - { 32708, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ - { 32737, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ - { 32765, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ - { 32787, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - { 32815, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - { 32843, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ - { 32865, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ - { 32886, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 32926, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 32965, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 32995, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 33030, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 33063, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 33097, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 33136, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 33175, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ - { 33197, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ - { 33223, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ - { 33247, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE */ - { 33269, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE_ARB */ - { 33295, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ - { 33318, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ - { 33340, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ - { 33361, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ - { 33382, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ - { 33409, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 33441, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 33473, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - { 33508, 0x00001701 }, /* GL_PROJECTION */ - { 33522, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ - { 33543, 0x0000898E }, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */ - { 33586, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ - { 33612, 0x00008E4F }, /* GL_PROVOKING_VERTEX */ - { 33632, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ - { 33656, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ - { 33677, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ - { 33696, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ - { 33719, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - { 33758, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - { 33796, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ - { 33816, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY */ - { 33842, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - { 33872, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ - { 33896, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ - { 33916, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY */ - { 33942, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - { 33972, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ - { 33996, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ - { 34016, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - { 34049, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ - { 34075, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ - { 34105, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE */ - { 34132, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - { 34163, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ - { 34193, 0x00008A1D }, /* GL_PURGEABLE_APPLE */ - { 34212, 0x00002003 }, /* GL_Q */ - { 34217, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ - { 34242, 0x00000007 }, /* GL_QUADS */ - { 34251, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ - { 34295, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ - { 34343, 0x00008614 }, /* GL_QUAD_MESH_SUN */ - { 34360, 0x00000008 }, /* GL_QUAD_STRIP */ - { 34374, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT */ - { 34401, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */ - { 34431, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT */ - { 34455, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */ - { 34482, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ - { 34504, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ - { 34530, 0x00008E14 }, /* GL_QUERY_NO_WAIT */ - { 34547, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */ - { 34567, 0x00008866 }, /* GL_QUERY_RESULT */ - { 34583, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ - { 34603, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ - { 34629, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ - { 34659, 0x00008E13 }, /* GL_QUERY_WAIT */ - { 34673, 0x00008E13 }, /* GL_QUERY_WAIT_NV */ - { 34690, 0x00002002 }, /* GL_R */ - { 34695, 0x00008C3A }, /* GL_R11F_G11F_B10F */ - { 34713, 0x00008F98 }, /* GL_R16_SNORM */ - { 34726, 0x00002A10 }, /* GL_R3_G3_B2 */ - { 34738, 0x00008F94 }, /* GL_R8_SNORM */ - { 34750, 0x00008C89 }, /* GL_RASTERIZER_DISCARD */ - { 34772, 0x00008C89 }, /* GL_RASTERIZER_DISCARD_EXT */ - { 34798, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - { 34831, 0x00000C02 }, /* GL_READ_BUFFER */ - { 34846, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ - { 34866, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */ - { 34894, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - { 34926, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ - { 34950, 0x000088B8 }, /* GL_READ_ONLY */ - { 34963, 0x000088B8 }, /* GL_READ_ONLY_ARB */ - { 34980, 0x000088BA }, /* GL_READ_WRITE */ - { 34994, 0x000088BA }, /* GL_READ_WRITE_ARB */ - { 35012, 0x00001903 }, /* GL_RED */ - { 35019, 0x00008016 }, /* GL_REDUCE */ - { 35029, 0x00008016 }, /* GL_REDUCE_EXT */ - { 35043, 0x00000D15 }, /* GL_RED_BIAS */ - { 35055, 0x00000D52 }, /* GL_RED_BITS */ - { 35067, 0x00008D94 }, /* GL_RED_INTEGER */ - { 35082, 0x00008D94 }, /* GL_RED_INTEGER_EXT */ - { 35101, 0x00000D14 }, /* GL_RED_SCALE */ - { 35114, 0x00008F90 }, /* GL_RED_SNORM */ - { 35127, 0x00008512 }, /* GL_REFLECTION_MAP */ - { 35145, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ - { 35167, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ - { 35188, 0x00008512 }, /* GL_REFLECTION_MAP_OES */ - { 35210, 0x00008A19 }, /* GL_RELEASED_APPLE */ - { 35228, 0x00001C00 }, /* GL_RENDER */ - { 35238, 0x00008D41 }, /* GL_RENDERBUFFER */ - { 35254, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ - { 35281, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE_OES */ - { 35312, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */ - { 35336, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ - { 35364, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_OES */ - { 35392, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ - { 35418, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE_OES */ - { 35448, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ - { 35475, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE_OES */ - { 35506, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ - { 35526, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ - { 35553, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE_OES */ - { 35584, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ - { 35607, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ - { 35634, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_OES */ - { 35661, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - { 35693, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - { 35729, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_OES */ - { 35765, 0x00008D41 }, /* GL_RENDERBUFFER_OES */ - { 35785, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ - { 35810, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE_OES */ - { 35839, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ - { 35863, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */ - { 35891, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ - { 35920, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE_OES */ - { 35953, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ - { 35975, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ - { 36001, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_OES */ - { 36027, 0x00001F01 }, /* GL_RENDERER */ - { 36039, 0x00000C40 }, /* GL_RENDER_MODE */ - { 36054, 0x00002901 }, /* GL_REPEAT */ - { 36064, 0x00001E01 }, /* GL_REPLACE */ - { 36075, 0x00008062 }, /* GL_REPLACE_EXT */ - { 36090, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ - { 36113, 0x0000803A }, /* GL_RESCALE_NORMAL */ - { 36131, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ - { 36153, 0x00008A1B }, /* GL_RETAINED_APPLE */ - { 36171, 0x00000102 }, /* GL_RETURN */ - { 36181, 0x00008F99 }, /* GL_RG16_SNORM */ - { 36195, 0x00008F95 }, /* GL_RG8_SNORM */ - { 36208, 0x00001907 }, /* GL_RGB */ - { 36215, 0x00008052 }, /* GL_RGB10 */ - { 36224, 0x00008059 }, /* GL_RGB10_A2 */ - { 36236, 0x00008059 }, /* GL_RGB10_A2_EXT */ - { 36252, 0x00008052 }, /* GL_RGB10_EXT */ - { 36265, 0x00008053 }, /* GL_RGB12 */ - { 36274, 0x00008053 }, /* GL_RGB12_EXT */ - { 36287, 0x00008054 }, /* GL_RGB16 */ - { 36296, 0x0000881B }, /* GL_RGB16F */ - { 36306, 0x00008D89 }, /* GL_RGB16I */ - { 36316, 0x00008D89 }, /* GL_RGB16I_EXT */ - { 36330, 0x00008D77 }, /* GL_RGB16UI */ - { 36341, 0x00008D77 }, /* GL_RGB16UI_EXT */ - { 36356, 0x00008054 }, /* GL_RGB16_EXT */ - { 36369, 0x00008F9A }, /* GL_RGB16_SNORM */ - { 36384, 0x0000804E }, /* GL_RGB2_EXT */ - { 36396, 0x00008815 }, /* GL_RGB32F */ - { 36406, 0x00008D83 }, /* GL_RGB32I */ - { 36416, 0x00008D83 }, /* GL_RGB32I_EXT */ - { 36430, 0x00008D71 }, /* GL_RGB32UI */ - { 36441, 0x00008D71 }, /* GL_RGB32UI_EXT */ - { 36456, 0x0000804F }, /* GL_RGB4 */ - { 36464, 0x0000804F }, /* GL_RGB4_EXT */ - { 36476, 0x000083A1 }, /* GL_RGB4_S3TC */ - { 36489, 0x00008050 }, /* GL_RGB5 */ - { 36497, 0x00008D62 }, /* GL_RGB565 */ - { 36507, 0x00008D62 }, /* GL_RGB565_OES */ - { 36521, 0x00008057 }, /* GL_RGB5_A1 */ - { 36532, 0x00008057 }, /* GL_RGB5_A1_EXT */ - { 36547, 0x00008057 }, /* GL_RGB5_A1_OES */ - { 36562, 0x00008050 }, /* GL_RGB5_EXT */ - { 36574, 0x00008051 }, /* GL_RGB8 */ - { 36582, 0x00008D8F }, /* GL_RGB8I */ - { 36591, 0x00008D8F }, /* GL_RGB8I_EXT */ - { 36604, 0x00008D7D }, /* GL_RGB8UI */ - { 36614, 0x00008D7D }, /* GL_RGB8UI_EXT */ - { 36628, 0x00008051 }, /* GL_RGB8_EXT */ - { 36640, 0x00008051 }, /* GL_RGB8_OES */ - { 36652, 0x00008F96 }, /* GL_RGB8_SNORM */ - { 36666, 0x00008C3D }, /* GL_RGB9_E5 */ - { 36677, 0x00001908 }, /* GL_RGBA */ - { 36685, 0x0000805A }, /* GL_RGBA12 */ - { 36695, 0x0000805A }, /* GL_RGBA12_EXT */ - { 36709, 0x0000805B }, /* GL_RGBA16 */ - { 36719, 0x0000881A }, /* GL_RGBA16F */ - { 36730, 0x00008D88 }, /* GL_RGBA16I */ - { 36741, 0x00008D88 }, /* GL_RGBA16I_EXT */ - { 36756, 0x00008D76 }, /* GL_RGBA16UI */ - { 36768, 0x00008D76 }, /* GL_RGBA16UI_EXT */ - { 36784, 0x0000805B }, /* GL_RGBA16_EXT */ - { 36798, 0x00008F9B }, /* GL_RGBA16_SNORM */ - { 36814, 0x00008055 }, /* GL_RGBA2 */ - { 36823, 0x00008055 }, /* GL_RGBA2_EXT */ - { 36836, 0x00008814 }, /* GL_RGBA32F */ - { 36847, 0x00008D82 }, /* GL_RGBA32I */ - { 36858, 0x00008D82 }, /* GL_RGBA32I_EXT */ - { 36873, 0x00008D70 }, /* GL_RGBA32UI */ - { 36885, 0x00008D70 }, /* GL_RGBA32UI_EXT */ - { 36901, 0x00008056 }, /* GL_RGBA4 */ - { 36910, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ - { 36929, 0x00008056 }, /* GL_RGBA4_EXT */ - { 36942, 0x00008056 }, /* GL_RGBA4_OES */ - { 36955, 0x000083A3 }, /* GL_RGBA4_S3TC */ - { 36969, 0x00008058 }, /* GL_RGBA8 */ - { 36978, 0x00008D8E }, /* GL_RGBA8I */ - { 36988, 0x00008D8E }, /* GL_RGBA8I_EXT */ - { 37002, 0x00008D7C }, /* GL_RGBA8UI */ - { 37013, 0x00008D7C }, /* GL_RGBA8UI_EXT */ - { 37028, 0x00008058 }, /* GL_RGBA8_EXT */ - { 37041, 0x00008058 }, /* GL_RGBA8_OES */ - { 37054, 0x00008F97 }, /* GL_RGBA8_SNORM */ - { 37069, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ - { 37087, 0x00008D99 }, /* GL_RGBA_INTEGER */ - { 37103, 0x00008D99 }, /* GL_RGBA_INTEGER_EXT */ - { 37123, 0x00008D9E }, /* GL_RGBA_INTEGER_MODE_EXT */ - { 37148, 0x00000C31 }, /* GL_RGBA_MODE */ - { 37161, 0x000083A2 }, /* GL_RGBA_S3TC */ - { 37174, 0x00008F93 }, /* GL_RGBA_SNORM */ - { 37188, 0x00008D98 }, /* GL_RGB_INTEGER */ - { 37203, 0x00008D98 }, /* GL_RGB_INTEGER_EXT */ - { 37222, 0x000083A0 }, /* GL_RGB_S3TC */ - { 37234, 0x00008573 }, /* GL_RGB_SCALE */ - { 37247, 0x00008573 }, /* GL_RGB_SCALE_ARB */ - { 37264, 0x00008573 }, /* GL_RGB_SCALE_EXT */ - { 37281, 0x00008F92 }, /* GL_RGB_SNORM */ - { 37294, 0x00008F91 }, /* GL_RG_SNORM */ - { 37306, 0x00000407 }, /* GL_RIGHT */ - { 37315, 0x00002000 }, /* GL_S */ - { 37320, 0x00008B5D }, /* GL_SAMPLER_1D */ - { 37334, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY */ - { 37354, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY_EXT */ - { 37378, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW */ - { 37405, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW_EXT */ - { 37436, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ - { 37457, 0x00008B5E }, /* GL_SAMPLER_2D */ - { 37471, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY */ - { 37491, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY_EXT */ - { 37515, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW */ - { 37542, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW_EXT */ - { 37573, 0x00008B63 }, /* GL_SAMPLER_2D_RECT */ - { 37592, 0x00008B64 }, /* GL_SAMPLER_2D_RECT_SHADOW */ - { 37618, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ - { 37639, 0x00008B5F }, /* GL_SAMPLER_3D */ - { 37653, 0x00008B5F }, /* GL_SAMPLER_3D_OES */ - { 37671, 0x00008DC2 }, /* GL_SAMPLER_BUFFER */ - { 37689, 0x00008DC2 }, /* GL_SAMPLER_BUFFER_EXT */ - { 37711, 0x00008B60 }, /* GL_SAMPLER_CUBE */ - { 37727, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW */ - { 37750, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW_EXT */ - { 37777, 0x000080A9 }, /* GL_SAMPLES */ - { 37788, 0x000086B4 }, /* GL_SAMPLES_3DFX */ - { 37804, 0x000080A9 }, /* GL_SAMPLES_ARB */ - { 37819, 0x00008914 }, /* GL_SAMPLES_PASSED */ - { 37837, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ - { 37859, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - { 37887, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ - { 37919, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ - { 37942, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ - { 37969, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ - { 37987, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ - { 38010, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ - { 38032, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ - { 38051, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ - { 38074, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ - { 38100, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ - { 38130, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ - { 38155, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ - { 38184, 0x00080000 }, /* GL_SCISSOR_BIT */ - { 38199, 0x00000C10 }, /* GL_SCISSOR_BOX */ - { 38214, 0x00000C11 }, /* GL_SCISSOR_TEST */ - { 38230, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ - { 38255, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - { 38295, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 38339, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - { 38372, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - { 38402, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - { 38434, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - { 38464, 0x00001C02 }, /* GL_SELECT */ - { 38474, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ - { 38502, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ - { 38527, 0x00008012 }, /* GL_SEPARABLE_2D */ - { 38543, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS */ - { 38563, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS_EXT */ - { 38587, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ - { 38614, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ - { 38645, 0x0000150F }, /* GL_SET */ - { 38652, 0x00008DF8 }, /* GL_SHADER_BINARY_FORMATS */ - { 38677, 0x00008DFA }, /* GL_SHADER_COMPILER */ - { 38696, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ - { 38717, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ - { 38741, 0x00008B4F }, /* GL_SHADER_TYPE */ - { 38756, 0x00000B54 }, /* GL_SHADE_MODEL */ - { 38771, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ - { 38799, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ - { 38822, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - { 38852, 0x00001601 }, /* GL_SHININESS */ - { 38865, 0x00001402 }, /* GL_SHORT */ - { 38874, 0x00009119 }, /* GL_SIGNALED */ - { 38886, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ - { 38907, 0x000081F9 }, /* GL_SINGLE_COLOR */ - { 38923, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ - { 38943, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ - { 38962, 0x00008C46 }, /* GL_SLUMINANCE */ - { 38976, 0x00008C47 }, /* GL_SLUMINANCE8 */ - { 38991, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ - { 39013, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ - { 39033, 0x00001D01 }, /* GL_SMOOTH */ - { 39043, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ - { 39076, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ - { 39103, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ - { 39136, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ - { 39163, 0x00008588 }, /* GL_SOURCE0_ALPHA */ - { 39180, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ - { 39201, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ - { 39222, 0x00008580 }, /* GL_SOURCE0_RGB */ - { 39237, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ - { 39256, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ - { 39275, 0x00008589 }, /* GL_SOURCE1_ALPHA */ - { 39292, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ - { 39313, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ - { 39334, 0x00008581 }, /* GL_SOURCE1_RGB */ - { 39349, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ - { 39368, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ - { 39387, 0x0000858A }, /* GL_SOURCE2_ALPHA */ - { 39404, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ - { 39425, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ - { 39446, 0x00008582 }, /* GL_SOURCE2_RGB */ - { 39461, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ - { 39480, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ - { 39499, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ - { 39519, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ - { 39537, 0x00001202 }, /* GL_SPECULAR */ - { 39549, 0x00002402 }, /* GL_SPHERE_MAP */ - { 39563, 0x00001206 }, /* GL_SPOT_CUTOFF */ - { 39578, 0x00001204 }, /* GL_SPOT_DIRECTION */ - { 39596, 0x00001205 }, /* GL_SPOT_EXPONENT */ - { 39613, 0x00008588 }, /* GL_SRC0_ALPHA */ - { 39627, 0x00008580 }, /* GL_SRC0_RGB */ - { 39639, 0x00008589 }, /* GL_SRC1_ALPHA */ - { 39653, 0x00008581 }, /* GL_SRC1_RGB */ - { 39665, 0x0000858A }, /* GL_SRC2_ALPHA */ - { 39679, 0x00008582 }, /* GL_SRC2_RGB */ - { 39691, 0x00000302 }, /* GL_SRC_ALPHA */ - { 39704, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ - { 39726, 0x00000300 }, /* GL_SRC_COLOR */ - { 39739, 0x00008C40 }, /* GL_SRGB */ - { 39747, 0x00008C41 }, /* GL_SRGB8 */ - { 39756, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ - { 39772, 0x00008C42 }, /* GL_SRGB_ALPHA */ - { 39786, 0x00000503 }, /* GL_STACK_OVERFLOW */ - { 39804, 0x00000504 }, /* GL_STACK_UNDERFLOW */ - { 39823, 0x000088E6 }, /* GL_STATIC_COPY */ - { 39838, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ - { 39857, 0x000088E4 }, /* GL_STATIC_DRAW */ - { 39872, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ - { 39891, 0x000088E5 }, /* GL_STATIC_READ */ - { 39906, 0x000088E5 }, /* GL_STATIC_READ_ARB */ - { 39925, 0x00001802 }, /* GL_STENCIL */ - { 39936, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ - { 39958, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ - { 39984, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_OES */ - { 40010, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 40031, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ - { 40056, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 40077, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ - { 40102, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 40134, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ - { 40170, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 40202, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ - { 40238, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 40258, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 40285, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 40311, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 40327, 0x00008224 }, /* GL_STENCIL_BUFFER */ - { 40345, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 40367, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 40390, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 40406, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 40422, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 40439, 0x00008D46 }, /* GL_STENCIL_INDEX1 */ - { 40457, 0x00008D49 }, /* GL_STENCIL_INDEX16 */ - { 40476, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 40499, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 40521, 0x00008D46 }, /* GL_STENCIL_INDEX1_OES */ - { 40543, 0x00008D47 }, /* GL_STENCIL_INDEX4 */ - { 40561, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 40583, 0x00008D47 }, /* GL_STENCIL_INDEX4_OES */ - { 40605, 0x00008D48 }, /* GL_STENCIL_INDEX8 */ - { 40623, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 40645, 0x00008D48 }, /* GL_STENCIL_INDEX8_OES */ - { 40667, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 40688, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 40715, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 40742, 0x00000B97 }, /* GL_STENCIL_REF */ - { 40757, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 40773, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 40802, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 40824, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 40845, 0x00000C33 }, /* GL_STEREO */ - { 40855, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */ - { 40879, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */ - { 40904, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */ - { 40928, 0x000088E2 }, /* GL_STREAM_COPY */ - { 40943, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 40962, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 40977, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 40996, 0x000088E1 }, /* GL_STREAM_READ */ - { 41011, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 41030, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 41047, 0x000084E7 }, /* GL_SUBTRACT */ - { 41059, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 41075, 0x00009113 }, /* GL_SYNC_CONDITION */ - { 41093, 0x00009116 }, /* GL_SYNC_FENCE */ - { 41107, 0x00009115 }, /* GL_SYNC_FLAGS */ - { 41121, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */ - { 41148, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ - { 41178, 0x00009114 }, /* GL_SYNC_STATUS */ - { 41193, 0x00002001 }, /* GL_T */ - { 41198, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 41213, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 41232, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 41248, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 41263, 0x00002A27 }, /* GL_T2F_V3F */ - { 41274, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 41293, 0x00002A28 }, /* GL_T4F_V4F */ - { 41304, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 41327, 0x00001702 }, /* GL_TEXTURE */ - { 41338, 0x000084C0 }, /* GL_TEXTURE0 */ - { 41350, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 41366, 0x000084C1 }, /* GL_TEXTURE1 */ - { 41378, 0x000084CA }, /* GL_TEXTURE10 */ - { 41391, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 41408, 0x000084CB }, /* GL_TEXTURE11 */ - { 41421, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 41438, 0x000084CC }, /* GL_TEXTURE12 */ - { 41451, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 41468, 0x000084CD }, /* GL_TEXTURE13 */ - { 41481, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 41498, 0x000084CE }, /* GL_TEXTURE14 */ - { 41511, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 41528, 0x000084CF }, /* GL_TEXTURE15 */ - { 41541, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 41558, 0x000084D0 }, /* GL_TEXTURE16 */ - { 41571, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 41588, 0x000084D1 }, /* GL_TEXTURE17 */ - { 41601, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 41618, 0x000084D2 }, /* GL_TEXTURE18 */ - { 41631, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 41648, 0x000084D3 }, /* GL_TEXTURE19 */ - { 41661, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 41678, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 41694, 0x000084C2 }, /* GL_TEXTURE2 */ - { 41706, 0x000084D4 }, /* GL_TEXTURE20 */ - { 41719, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 41736, 0x000084D5 }, /* GL_TEXTURE21 */ - { 41749, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 41766, 0x000084D6 }, /* GL_TEXTURE22 */ - { 41779, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 41796, 0x000084D7 }, /* GL_TEXTURE23 */ - { 41809, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 41826, 0x000084D8 }, /* GL_TEXTURE24 */ - { 41839, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 41856, 0x000084D9 }, /* GL_TEXTURE25 */ - { 41869, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 41886, 0x000084DA }, /* GL_TEXTURE26 */ - { 41899, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 41916, 0x000084DB }, /* GL_TEXTURE27 */ - { 41929, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 41946, 0x000084DC }, /* GL_TEXTURE28 */ - { 41959, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 41976, 0x000084DD }, /* GL_TEXTURE29 */ - { 41989, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 42006, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 42022, 0x000084C3 }, /* GL_TEXTURE3 */ - { 42034, 0x000084DE }, /* GL_TEXTURE30 */ - { 42047, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 42064, 0x000084DF }, /* GL_TEXTURE31 */ - { 42077, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 42094, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 42110, 0x000084C4 }, /* GL_TEXTURE4 */ - { 42122, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 42138, 0x000084C5 }, /* GL_TEXTURE5 */ - { 42150, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 42166, 0x000084C6 }, /* GL_TEXTURE6 */ - { 42178, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 42194, 0x000084C7 }, /* GL_TEXTURE7 */ - { 42206, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 42222, 0x000084C8 }, /* GL_TEXTURE8 */ - { 42234, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 42250, 0x000084C9 }, /* GL_TEXTURE9 */ - { 42262, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 42278, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 42292, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY */ - { 42312, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 42336, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 42350, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY */ - { 42370, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 42394, 0x0000806F }, /* GL_TEXTURE_3D */ - { 42408, 0x0000806F }, /* GL_TEXTURE_3D_OES */ - { 42426, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 42448, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 42474, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 42496, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 42518, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY */ - { 42546, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 42578, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 42600, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY */ - { 42628, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 42660, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 42682, 0x0000806A }, /* GL_TEXTURE_BINDING_3D_OES */ - { 42708, 0x00008C2C }, /* GL_TEXTURE_BINDING_BUFFER */ - { 42734, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 42762, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 42794, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_OES */ - { 42826, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE */ - { 42855, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 42888, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 42920, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 42935, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 42956, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 42981, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 42999, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 43023, 0x00008C2A }, /* GL_TEXTURE_BUFFER */ - { 43041, 0x00008C2D }, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */ - { 43078, 0x00008C2E }, /* GL_TEXTURE_BUFFER_FORMAT */ - { 43103, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 43134, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 43164, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 43194, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 43229, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 43260, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 43298, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 43325, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 43357, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 43391, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 43415, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 43443, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 43467, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 43495, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 43528, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 43552, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 43574, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 43596, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 43622, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 43656, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 43689, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 43726, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 43754, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 43786, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 43809, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 43847, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 43889, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 43920, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 43948, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 43978, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 44006, 0x00008B9D }, /* GL_TEXTURE_CROP_RECT_OES */ - { 44031, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 44051, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 44075, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 44106, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 44141, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES */ - { 44176, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 44207, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 44242, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES */ - { 44277, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 44308, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 44343, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES */ - { 44378, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_OES */ - { 44402, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 44433, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 44468, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES */ - { 44503, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 44534, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 44569, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES */ - { 44604, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 44635, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 44670, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */ - { 44705, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ - { 44734, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 44751, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 44773, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 44799, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 44814, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 44835, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 44855, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 44881, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL_EXT */ - { 44911, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 44931, 0x00002500 }, /* GL_TEXTURE_GEN_MODE_OES */ - { 44955, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 44972, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 44989, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 45006, 0x00008D60 }, /* GL_TEXTURE_GEN_STR_OES */ - { 45029, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 45046, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 45071, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 45093, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 45119, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 45137, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 45163, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 45189, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 45219, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 45246, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 45271, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 45291, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 45315, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 45342, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 45369, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 45396, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 45422, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 45452, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 45474, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 45492, 0x0000898F }, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */ - { 45532, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 45562, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 45590, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 45618, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 45646, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 45667, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 45686, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 45708, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 45727, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 45747, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ - { 45777, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */ - { 45808, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE */ - { 45829, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 45854, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 45878, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 45898, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 45922, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 45942, 0x00008C3F }, /* GL_TEXTURE_SHARED_SIZE */ - { 45965, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 45988, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ - { 46012, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */ - { 46040, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */ - { 46070, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 46095, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 46129, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 46146, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 46164, 0x00008072 }, /* GL_TEXTURE_WRAP_R_OES */ - { 46186, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 46204, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 46222, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */ - { 46241, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 46261, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 46280, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 46309, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 46326, 0x00008E22 }, /* GL_TRANSFORM_FEEDBACK */ - { 46348, 0x00008E25 }, /* GL_TRANSFORM_FEEDBACK_BINDING */ - { 46378, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER */ - { 46407, 0x00008E24 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ - { 46443, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */ - { 46480, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */ - { 46521, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */ - { 46554, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */ - { 46588, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */ - { 46626, 0x00008E23 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ - { 46662, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */ - { 46696, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */ - { 46734, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */ - { 46769, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */ - { 46808, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */ - { 46849, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */ - { 46894, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS */ - { 46925, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */ - { 46960, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */ - { 47001, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */ - { 47046, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 47072, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 47102, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 47134, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 47164, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 47198, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 47214, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 47245, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 47280, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 47308, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 47340, 0x00000004 }, /* GL_TRIANGLES */ - { 47353, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY */ - { 47376, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY_ARB */ - { 47403, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 47419, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 47440, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 47458, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY */ - { 47486, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY_ARB */ - { 47518, 0x00000001 }, /* GL_TRUE */ - { 47526, 0x00008A1C }, /* GL_UNDEFINED_APPLE */ - { 47545, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 47565, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 47588, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 47608, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 47629, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 47651, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 47673, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 47693, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 47714, 0x00009118 }, /* GL_UNSIGNALED */ - { 47728, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 47745, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 47772, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 47795, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 47811, 0x00008C3B }, /* GL_UNSIGNED_INT_10F_11F_11F_REV */ - { 47843, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 47870, 0x00008DF6 }, /* GL_UNSIGNED_INT_10_10_10_2_OES */ - { 47901, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ - { 47922, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */ - { 47947, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 47971, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_OES */ - { 47996, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 48027, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV_EXT */ - { 48062, 0x00008C3E }, /* GL_UNSIGNED_INT_5_9_9_9_REV */ - { 48090, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 48114, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 48142, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D */ - { 48169, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */ - { 48202, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT */ - { 48239, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D_EXT */ - { 48270, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D */ - { 48297, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */ - { 48330, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT */ - { 48367, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D_EXT */ - { 48398, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */ - { 48430, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT */ - { 48466, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D */ - { 48493, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D_EXT */ - { 48524, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */ - { 48555, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT */ - { 48590, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE */ - { 48619, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE_EXT */ - { 48652, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2 */ - { 48673, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2_EXT */ - { 48698, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3 */ - { 48719, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3_EXT */ - { 48744, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4 */ - { 48765, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4_EXT */ - { 48790, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ - { 48813, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 48831, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 48861, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT */ - { 48895, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 48921, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 48951, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT */ - { 48985, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 49011, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 49035, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 49063, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 49091, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 49118, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 49150, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 49181, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 49195, 0x00002A20 }, /* GL_V2F */ - { 49202, 0x00002A21 }, /* GL_V3F */ - { 49209, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 49228, 0x00001F00 }, /* GL_VENDOR */ - { 49238, 0x00001F02 }, /* GL_VERSION */ - { 49249, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 49265, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ - { 49289, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 49319, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 49350, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 49385, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 49409, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 49430, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 49453, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 49474, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 49501, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 49529, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 49557, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 49585, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 49613, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 49641, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 49669, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 49696, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 49723, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 49750, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 49777, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 49804, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 49831, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 49858, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 49885, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 49912, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 49950, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 49992, 0x000088FE }, /* GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB */ - { 50027, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 50058, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 50093, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */ - { 50124, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT */ - { 50159, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 50193, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 50231, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 50262, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 50297, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 50325, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 50357, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 50387, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 50421, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 50449, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 50481, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 50501, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 50523, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 50552, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 50573, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 50602, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 50635, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 50667, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 50694, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 50725, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 50755, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 50772, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 50793, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 50820, 0x00000BA2 }, /* GL_VIEWPORT */ - { 50832, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 50848, 0x00008A1A }, /* GL_VOLATILE_APPLE */ - { 50866, 0x0000911D }, /* GL_WAIT_FAILED */ - { 50881, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 50901, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 50932, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 50967, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_OES */ - { 51002, 0x000086AD }, /* GL_WEIGHT_ARRAY_OES */ - { 51022, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 51050, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_OES */ - { 51078, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 51103, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_OES */ - { 51128, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 51155, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_OES */ - { 51182, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 51207, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_OES */ - { 51232, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 51256, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 51275, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 51289, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 51307, 0x000088B9 }, /* GL_WRITE_ONLY_OES */ - { 51325, 0x00001506 }, /* GL_XOR */ - { 51332, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 51351, 0x00008757 }, /* GL_YCBCR_MESA */ - { 51365, 0x00000000 }, /* GL_ZERO */ - { 51373, 0x00000D16 }, /* GL_ZOOM_X */ - { 51383, 0x00000D17 }, /* GL_ZOOM_Y */ -}; - -static const unsigned reduced_enums[1552] = -{ - 535, /* GL_FALSE */ - 827, /* GL_LINES */ - 831, /* GL_LINE_LOOP */ - 838, /* GL_LINE_STRIP */ - 2135, /* GL_TRIANGLES */ - 2140, /* GL_TRIANGLE_STRIP */ - 2138, /* GL_TRIANGLE_FAN */ - 1507, /* GL_QUADS */ - 1511, /* GL_QUAD_STRIP */ - 1378, /* GL_POLYGON */ - 828, /* GL_LINES_ADJACENCY */ - 839, /* GL_LINE_STRIP_ADJACENCY */ - 2136, /* GL_TRIANGLES_ADJACENCY */ - 2141, /* GL_TRIANGLE_STRIP_ADJACENCY */ - 1390, /* GL_POLYGON_STIPPLE_BIT */ - 1333, /* GL_PIXEL_MODE_BIT */ - 814, /* GL_LIGHTING_BIT */ - 568, /* GL_FOG_BIT */ - 8, /* GL_ACCUM */ - 850, /* GL_LOAD */ - 1596, /* GL_RETURN */ - 1200, /* GL_MULT */ - 24, /* GL_ADD */ - 1216, /* GL_NEVER */ - 804, /* GL_LESS */ - 525, /* GL_EQUAL */ - 803, /* GL_LEQUAL */ - 691, /* GL_GREATER */ - 1233, /* GL_NOTEQUAL */ - 690, /* GL_GEQUAL */ - 55, /* GL_ALWAYS */ - 1803, /* GL_SRC_COLOR */ - 1266, /* GL_ONE_MINUS_SRC_COLOR */ - 1801, /* GL_SRC_ALPHA */ - 1265, /* GL_ONE_MINUS_SRC_ALPHA */ - 504, /* GL_DST_ALPHA */ - 1263, /* GL_ONE_MINUS_DST_ALPHA */ - 505, /* GL_DST_COLOR */ - 1264, /* GL_ONE_MINUS_DST_COLOR */ - 1802, /* GL_SRC_ALPHA_SATURATE */ - 667, /* GL_FRONT_LEFT */ - 668, /* GL_FRONT_RIGHT */ - 77, /* GL_BACK_LEFT */ - 78, /* GL_BACK_RIGHT */ - 664, /* GL_FRONT */ - 76, /* GL_BACK */ - 802, /* GL_LEFT */ - 1685, /* GL_RIGHT */ - 665, /* GL_FRONT_AND_BACK */ - 71, /* GL_AUX0 */ - 72, /* GL_AUX1 */ - 73, /* GL_AUX2 */ - 74, /* GL_AUX3 */ - 790, /* GL_INVALID_ENUM */ - 795, /* GL_INVALID_VALUE */ - 794, /* GL_INVALID_OPERATION */ - 1808, /* GL_STACK_OVERFLOW */ - 1809, /* GL_STACK_UNDERFLOW */ - 1291, /* GL_OUT_OF_MEMORY */ - 791, /* GL_INVALID_FRAMEBUFFER_OPERATION */ - 0, /* GL_2D */ - 2, /* GL_3D */ - 3, /* GL_3D_COLOR */ - 4, /* GL_3D_COLOR_TEXTURE */ - 6, /* GL_4D_COLOR_TEXTURE */ - 1311, /* GL_PASS_THROUGH_TOKEN */ - 1377, /* GL_POINT_TOKEN */ - 841, /* GL_LINE_TOKEN */ - 1391, /* GL_POLYGON_TOKEN */ - 87, /* GL_BITMAP_TOKEN */ - 503, /* GL_DRAW_PIXEL_TOKEN */ - 349, /* GL_COPY_PIXEL_TOKEN */ - 832, /* GL_LINE_RESET_TOKEN */ - 528, /* GL_EXP */ - 529, /* GL_EXP2 */ - 386, /* GL_CW */ - 154, /* GL_CCW */ - 184, /* GL_COEFF */ - 1288, /* GL_ORDER */ - 440, /* GL_DOMAIN */ - 359, /* GL_CURRENT_COLOR */ - 362, /* GL_CURRENT_INDEX */ - 368, /* GL_CURRENT_NORMAL */ - 382, /* GL_CURRENT_TEXTURE_COORDS */ - 374, /* GL_CURRENT_RASTER_COLOR */ - 376, /* GL_CURRENT_RASTER_INDEX */ - 380, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ - 377, /* GL_CURRENT_RASTER_POSITION */ - 378, /* GL_CURRENT_RASTER_POSITION_VALID */ - 375, /* GL_CURRENT_RASTER_DISTANCE */ - 1369, /* GL_POINT_SMOOTH */ - 1353, /* GL_POINT_SIZE */ - 1368, /* GL_POINT_SIZE_RANGE */ - 1359, /* GL_POINT_SIZE_GRANULARITY */ - 833, /* GL_LINE_SMOOTH */ - 842, /* GL_LINE_WIDTH */ - 844, /* GL_LINE_WIDTH_RANGE */ - 843, /* GL_LINE_WIDTH_GRANULARITY */ - 835, /* GL_LINE_STIPPLE */ - 836, /* GL_LINE_STIPPLE_PATTERN */ - 837, /* GL_LINE_STIPPLE_REPEAT */ - 849, /* GL_LIST_MODE */ - 1056, /* GL_MAX_LIST_NESTING */ - 846, /* GL_LIST_BASE */ - 848, /* GL_LIST_INDEX */ - 1380, /* GL_POLYGON_MODE */ - 1387, /* GL_POLYGON_SMOOTH */ - 1389, /* GL_POLYGON_STIPPLE */ - 514, /* GL_EDGE_FLAG */ - 352, /* GL_CULL_FACE */ - 353, /* GL_CULL_FACE_MODE */ - 666, /* GL_FRONT_FACE */ - 813, /* GL_LIGHTING */ - 818, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - 819, /* GL_LIGHT_MODEL_TWO_SIDE */ - 815, /* GL_LIGHT_MODEL_AMBIENT */ - 1750, /* GL_SHADE_MODEL */ - 232, /* GL_COLOR_MATERIAL_FACE */ - 233, /* GL_COLOR_MATERIAL_PARAMETER */ - 231, /* GL_COLOR_MATERIAL */ - 567, /* GL_FOG */ - 589, /* GL_FOG_INDEX */ - 585, /* GL_FOG_DENSITY */ - 593, /* GL_FOG_START */ - 587, /* GL_FOG_END */ - 590, /* GL_FOG_MODE */ - 569, /* GL_FOG_COLOR */ - 425, /* GL_DEPTH_RANGE */ - 434, /* GL_DEPTH_TEST */ - 437, /* GL_DEPTH_WRITEMASK */ - 410, /* GL_DEPTH_CLEAR_VALUE */ - 424, /* GL_DEPTH_FUNC */ - 12, /* GL_ACCUM_CLEAR_VALUE */ - 1853, /* GL_STENCIL_TEST */ - 1834, /* GL_STENCIL_CLEAR_VALUE */ - 1836, /* GL_STENCIL_FUNC */ - 1855, /* GL_STENCIL_VALUE_MASK */ - 1835, /* GL_STENCIL_FAIL */ - 1850, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1851, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1852, /* GL_STENCIL_REF */ - 1856, /* GL_STENCIL_WRITEMASK */ - 1006, /* GL_MATRIX_MODE */ - 1222, /* GL_NORMALIZE */ - 2267, /* GL_VIEWPORT */ - 1195, /* GL_MODELVIEW_STACK_DEPTH */ - 1481, /* GL_PROJECTION_STACK_DEPTH */ - 2089, /* GL_TEXTURE_STACK_DEPTH */ - 1192, /* GL_MODELVIEW_MATRIX */ - 1479, /* GL_PROJECTION_MATRIX */ - 2069, /* GL_TEXTURE_MATRIX */ - 69, /* GL_ATTRIB_STACK_DEPTH */ - 166, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ - 51, /* GL_ALPHA_TEST */ - 52, /* GL_ALPHA_TEST_FUNC */ - 53, /* GL_ALPHA_TEST_REF */ - 439, /* GL_DITHER */ - 91, /* GL_BLEND_DST */ - 105, /* GL_BLEND_SRC */ - 88, /* GL_BLEND */ - 852, /* GL_LOGIC_OP_MODE */ - 739, /* GL_INDEX_LOGIC_OP */ - 230, /* GL_COLOR_LOGIC_OP */ - 75, /* GL_AUX_BUFFERS */ - 450, /* GL_DRAW_BUFFER */ - 1534, /* GL_READ_BUFFER */ - 1727, /* GL_SCISSOR_BOX */ - 1728, /* GL_SCISSOR_TEST */ - 738, /* GL_INDEX_CLEAR_VALUE */ - 743, /* GL_INDEX_WRITEMASK */ - 227, /* GL_COLOR_CLEAR_VALUE */ - 269, /* GL_COLOR_WRITEMASK */ - 740, /* GL_INDEX_MODE */ - 1674, /* GL_RGBA_MODE */ - 449, /* GL_DOUBLEBUFFER */ - 1857, /* GL_STEREO */ - 1588, /* GL_RENDER_MODE */ - 1312, /* GL_PERSPECTIVE_CORRECTION_HINT */ - 1370, /* GL_POINT_SMOOTH_HINT */ - 834, /* GL_LINE_SMOOTH_HINT */ - 1388, /* GL_POLYGON_SMOOTH_HINT */ - 588, /* GL_FOG_HINT */ - 2049, /* GL_TEXTURE_GEN_S */ - 2051, /* GL_TEXTURE_GEN_T */ - 2048, /* GL_TEXTURE_GEN_R */ - 2047, /* GL_TEXTURE_GEN_Q */ - 1325, /* GL_PIXEL_MAP_I_TO_I */ - 1331, /* GL_PIXEL_MAP_S_TO_S */ - 1327, /* GL_PIXEL_MAP_I_TO_R */ - 1323, /* GL_PIXEL_MAP_I_TO_G */ - 1321, /* GL_PIXEL_MAP_I_TO_B */ - 1319, /* GL_PIXEL_MAP_I_TO_A */ - 1329, /* GL_PIXEL_MAP_R_TO_R */ - 1317, /* GL_PIXEL_MAP_G_TO_G */ - 1315, /* GL_PIXEL_MAP_B_TO_B */ - 1313, /* GL_PIXEL_MAP_A_TO_A */ - 1326, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - 1332, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - 1328, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - 1324, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - 1322, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - 1320, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - 1330, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - 1318, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - 1316, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - 1314, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 2152, /* GL_UNPACK_SWAP_BYTES */ - 2147, /* GL_UNPACK_LSB_FIRST */ - 2148, /* GL_UNPACK_ROW_LENGTH */ - 2151, /* GL_UNPACK_SKIP_ROWS */ - 2150, /* GL_UNPACK_SKIP_PIXELS */ - 2145, /* GL_UNPACK_ALIGNMENT */ - 1300, /* GL_PACK_SWAP_BYTES */ - 1295, /* GL_PACK_LSB_FIRST */ - 1296, /* GL_PACK_ROW_LENGTH */ - 1299, /* GL_PACK_SKIP_ROWS */ - 1298, /* GL_PACK_SKIP_PIXELS */ - 1292, /* GL_PACK_ALIGNMENT */ - 947, /* GL_MAP_COLOR */ - 952, /* GL_MAP_STENCIL */ - 742, /* GL_INDEX_SHIFT */ - 741, /* GL_INDEX_OFFSET */ - 1550, /* GL_RED_SCALE */ - 1546, /* GL_RED_BIAS */ - 2293, /* GL_ZOOM_X */ - 2294, /* GL_ZOOM_Y */ - 697, /* GL_GREEN_SCALE */ - 693, /* GL_GREEN_BIAS */ - 115, /* GL_BLUE_SCALE */ - 111, /* GL_BLUE_BIAS */ - 50, /* GL_ALPHA_SCALE */ - 47, /* GL_ALPHA_BIAS */ - 426, /* GL_DEPTH_SCALE */ - 402, /* GL_DEPTH_BIAS */ - 1038, /* GL_MAX_EVAL_ORDER */ - 1055, /* GL_MAX_LIGHTS */ - 1018, /* GL_MAX_CLIP_DISTANCES */ - 1110, /* GL_MAX_TEXTURE_SIZE */ - 1062, /* GL_MAX_PIXEL_MAP_TABLE */ - 1014, /* GL_MAX_ATTRIB_STACK_DEPTH */ - 1058, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - 1059, /* GL_MAX_NAME_STACK_DEPTH */ - 1090, /* GL_MAX_PROJECTION_STACK_DEPTH */ - 1111, /* GL_MAX_TEXTURE_STACK_DEPTH */ - 1137, /* GL_MAX_VIEWPORT_DIMS */ - 1015, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1867, /* GL_SUBPIXEL_BITS */ - 737, /* GL_INDEX_BITS */ - 1547, /* GL_RED_BITS */ - 694, /* GL_GREEN_BITS */ - 112, /* GL_BLUE_BITS */ - 48, /* GL_ALPHA_BITS */ - 403, /* GL_DEPTH_BITS */ - 1831, /* GL_STENCIL_BITS */ - 14, /* GL_ACCUM_RED_BITS */ - 13, /* GL_ACCUM_GREEN_BITS */ - 10, /* GL_ACCUM_BLUE_BITS */ - 9, /* GL_ACCUM_ALPHA_BITS */ - 1209, /* GL_NAME_STACK_DEPTH */ - 70, /* GL_AUTO_NORMAL */ - 893, /* GL_MAP1_COLOR_4 */ - 896, /* GL_MAP1_INDEX */ - 897, /* GL_MAP1_NORMAL */ - 898, /* GL_MAP1_TEXTURE_COORD_1 */ - 899, /* GL_MAP1_TEXTURE_COORD_2 */ - 900, /* GL_MAP1_TEXTURE_COORD_3 */ - 901, /* GL_MAP1_TEXTURE_COORD_4 */ - 902, /* GL_MAP1_VERTEX_3 */ - 903, /* GL_MAP1_VERTEX_4 */ - 920, /* GL_MAP2_COLOR_4 */ - 923, /* GL_MAP2_INDEX */ - 924, /* GL_MAP2_NORMAL */ - 925, /* GL_MAP2_TEXTURE_COORD_1 */ - 926, /* GL_MAP2_TEXTURE_COORD_2 */ - 927, /* GL_MAP2_TEXTURE_COORD_3 */ - 928, /* GL_MAP2_TEXTURE_COORD_4 */ - 929, /* GL_MAP2_VERTEX_3 */ - 930, /* GL_MAP2_VERTEX_4 */ - 894, /* GL_MAP1_GRID_DOMAIN */ - 895, /* GL_MAP1_GRID_SEGMENTS */ - 921, /* GL_MAP2_GRID_DOMAIN */ - 922, /* GL_MAP2_GRID_SEGMENTS */ - 1950, /* GL_TEXTURE_1D */ - 1953, /* GL_TEXTURE_2D */ - 538, /* GL_FEEDBACK_BUFFER_POINTER */ - 539, /* GL_FEEDBACK_BUFFER_SIZE */ - 540, /* GL_FEEDBACK_BUFFER_TYPE */ - 1737, /* GL_SELECTION_BUFFER_POINTER */ - 1738, /* GL_SELECTION_BUFFER_SIZE */ - 2095, /* GL_TEXTURE_WIDTH */ - 2055, /* GL_TEXTURE_HEIGHT */ - 1999, /* GL_TEXTURE_COMPONENTS */ - 1980, /* GL_TEXTURE_BORDER_COLOR */ - 1979, /* GL_TEXTURE_BORDER */ - 441, /* GL_DONT_CARE */ - 536, /* GL_FASTEST */ - 1217, /* GL_NICEST */ - 56, /* GL_AMBIENT */ - 438, /* GL_DIFFUSE */ - 1790, /* GL_SPECULAR */ - 1392, /* GL_POSITION */ - 1793, /* GL_SPOT_DIRECTION */ - 1794, /* GL_SPOT_EXPONENT */ - 1792, /* GL_SPOT_CUTOFF */ - 317, /* GL_CONSTANT_ATTENUATION */ - 822, /* GL_LINEAR_ATTENUATION */ - 1506, /* GL_QUADRATIC_ATTENUATION */ - 284, /* GL_COMPILE */ - 285, /* GL_COMPILE_AND_EXECUTE */ - 149, /* GL_BYTE */ - 2154, /* GL_UNSIGNED_BYTE */ - 1755, /* GL_SHORT */ - 2193, /* GL_UNSIGNED_SHORT */ - 745, /* GL_INT */ - 2157, /* GL_UNSIGNED_INT */ - 548, /* GL_FLOAT */ - 1, /* GL_2_BYTES */ - 5, /* GL_3_BYTES */ - 7, /* GL_4_BYTES */ - 448, /* GL_DOUBLE */ - 698, /* GL_HALF_FLOAT */ - 544, /* GL_FIXED */ - 162, /* GL_CLEAR */ - 58, /* GL_AND */ - 60, /* GL_AND_REVERSE */ - 347, /* GL_COPY */ - 59, /* GL_AND_INVERTED */ - 1220, /* GL_NOOP */ - 2289, /* GL_XOR */ - 1287, /* GL_OR */ - 1221, /* GL_NOR */ - 526, /* GL_EQUIV */ - 798, /* GL_INVERT */ - 1290, /* GL_OR_REVERSE */ - 348, /* GL_COPY_INVERTED */ - 1289, /* GL_OR_INVERTED */ - 1210, /* GL_NAND */ - 1744, /* GL_SET */ - 523, /* GL_EMISSION */ - 1754, /* GL_SHININESS */ - 57, /* GL_AMBIENT_AND_DIFFUSE */ - 229, /* GL_COLOR_INDEXES */ - 1159, /* GL_MODELVIEW */ - 1478, /* GL_PROJECTION */ - 1885, /* GL_TEXTURE */ - 185, /* GL_COLOR */ - 395, /* GL_DEPTH */ - 1816, /* GL_STENCIL */ - 228, /* GL_COLOR_INDEX */ - 1837, /* GL_STENCIL_INDEX */ - 411, /* GL_DEPTH_COMPONENT */ - 1543, /* GL_RED */ - 692, /* GL_GREEN */ - 110, /* GL_BLUE */ - 32, /* GL_ALPHA */ - 1599, /* GL_RGB */ - 1639, /* GL_RGBA */ - 856, /* GL_LUMINANCE */ - 883, /* GL_LUMINANCE_ALPHA */ - 86, /* GL_BITMAP */ - 1342, /* GL_POINT */ - 820, /* GL_LINE */ - 541, /* GL_FILL */ - 1557, /* GL_RENDER */ - 537, /* GL_FEEDBACK */ - 1736, /* GL_SELECT */ - 547, /* GL_FLAT */ - 1765, /* GL_SMOOTH */ - 799, /* GL_KEEP */ - 1590, /* GL_REPLACE */ - 727, /* GL_INCR */ - 391, /* GL_DECR */ - 2210, /* GL_VENDOR */ - 1587, /* GL_RENDERER */ - 2211, /* GL_VERSION */ - 530, /* GL_EXTENSIONS */ - 1686, /* GL_S */ - 1876, /* GL_T */ - 1526, /* GL_R */ - 1505, /* GL_Q */ - 1196, /* GL_MODULATE */ - 390, /* GL_DECAL */ - 2042, /* GL_TEXTURE_ENV_MODE */ - 2041, /* GL_TEXTURE_ENV_COLOR */ - 2040, /* GL_TEXTURE_ENV */ - 531, /* GL_EYE_LINEAR */ - 1248, /* GL_OBJECT_LINEAR */ - 1791, /* GL_SPHERE_MAP */ - 2045, /* GL_TEXTURE_GEN_MODE */ - 1250, /* GL_OBJECT_PLANE */ - 532, /* GL_EYE_PLANE */ - 1211, /* GL_NEAREST */ - 821, /* GL_LINEAR */ - 1215, /* GL_NEAREST_MIPMAP_NEAREST */ - 826, /* GL_LINEAR_MIPMAP_NEAREST */ - 1214, /* GL_NEAREST_MIPMAP_LINEAR */ - 825, /* GL_LINEAR_MIPMAP_LINEAR */ - 2068, /* GL_TEXTURE_MAG_FILTER */ - 2077, /* GL_TEXTURE_MIN_FILTER */ - 2098, /* GL_TEXTURE_WRAP_S */ - 2099, /* GL_TEXTURE_WRAP_T */ - 155, /* GL_CLAMP */ - 1589, /* GL_REPEAT */ - 1386, /* GL_POLYGON_OFFSET_UNITS */ - 1385, /* GL_POLYGON_OFFSET_POINT */ - 1384, /* GL_POLYGON_OFFSET_LINE */ - 1529, /* GL_R3_G3_B2 */ - 2207, /* GL_V2F */ - 2208, /* GL_V3F */ - 152, /* GL_C4UB_V2F */ - 153, /* GL_C4UB_V3F */ - 150, /* GL_C3F_V3F */ - 1208, /* GL_N3F_V3F */ - 151, /* GL_C4F_N3F_V3F */ - 1881, /* GL_T2F_V3F */ - 1883, /* GL_T4F_V4F */ - 1879, /* GL_T2F_C4UB_V3F */ - 1877, /* GL_T2F_C3F_V3F */ - 1880, /* GL_T2F_N3F_V3F */ - 1878, /* GL_T2F_C4F_N3F_V3F */ - 1882, /* GL_T4F_C4F_N3F_V4F */ - 169, /* GL_CLIP_DISTANCE0 */ - 170, /* GL_CLIP_DISTANCE1 */ - 171, /* GL_CLIP_DISTANCE2 */ - 172, /* GL_CLIP_DISTANCE3 */ - 173, /* GL_CLIP_DISTANCE4 */ - 174, /* GL_CLIP_DISTANCE5 */ - 175, /* GL_CLIP_DISTANCE6 */ - 176, /* GL_CLIP_DISTANCE7 */ - 805, /* GL_LIGHT0 */ - 806, /* GL_LIGHT1 */ - 807, /* GL_LIGHT2 */ - 808, /* GL_LIGHT3 */ - 809, /* GL_LIGHT4 */ - 810, /* GL_LIGHT5 */ - 811, /* GL_LIGHT6 */ - 812, /* GL_LIGHT7 */ - 702, /* GL_HINT_BIT */ - 319, /* GL_CONSTANT_COLOR */ - 1261, /* GL_ONE_MINUS_CONSTANT_COLOR */ - 314, /* GL_CONSTANT_ALPHA */ - 1259, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - 89, /* GL_BLEND_COLOR */ - 669, /* GL_FUNC_ADD */ - 1140, /* GL_MIN */ - 1009, /* GL_MAX */ - 96, /* GL_BLEND_EQUATION */ - 675, /* GL_FUNC_SUBTRACT */ - 672, /* GL_FUNC_REVERSE_SUBTRACT */ - 327, /* GL_CONVOLUTION_1D */ - 328, /* GL_CONVOLUTION_2D */ - 1739, /* GL_SEPARABLE_2D */ - 331, /* GL_CONVOLUTION_BORDER_MODE */ - 335, /* GL_CONVOLUTION_FILTER_SCALE */ - 333, /* GL_CONVOLUTION_FILTER_BIAS */ - 1544, /* GL_REDUCE */ - 337, /* GL_CONVOLUTION_FORMAT */ - 341, /* GL_CONVOLUTION_WIDTH */ - 339, /* GL_CONVOLUTION_HEIGHT */ - 1028, /* GL_MAX_CONVOLUTION_WIDTH */ - 1026, /* GL_MAX_CONVOLUTION_HEIGHT */ - 1425, /* GL_POST_CONVOLUTION_RED_SCALE */ - 1421, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - 1416, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - 1412, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - 1423, /* GL_POST_CONVOLUTION_RED_BIAS */ - 1419, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - 1414, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - 1410, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - 703, /* GL_HISTOGRAM */ - 1485, /* GL_PROXY_HISTOGRAM */ - 719, /* GL_HISTOGRAM_WIDTH */ - 709, /* GL_HISTOGRAM_FORMAT */ - 715, /* GL_HISTOGRAM_RED_SIZE */ - 711, /* GL_HISTOGRAM_GREEN_SIZE */ - 706, /* GL_HISTOGRAM_BLUE_SIZE */ - 704, /* GL_HISTOGRAM_ALPHA_SIZE */ - 713, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - 717, /* GL_HISTOGRAM_SINK */ - 1141, /* GL_MINMAX */ - 1143, /* GL_MINMAX_FORMAT */ - 1145, /* GL_MINMAX_SINK */ - 1884, /* GL_TABLE_TOO_LARGE_EXT */ - 2156, /* GL_UNSIGNED_BYTE_3_3_2 */ - 2196, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 2199, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 2168, /* GL_UNSIGNED_INT_8_8_8_8 */ - 2159, /* GL_UNSIGNED_INT_10_10_10_2 */ - 1383, /* GL_POLYGON_OFFSET_FILL */ - 1382, /* GL_POLYGON_OFFSET_FACTOR */ - 1381, /* GL_POLYGON_OFFSET_BIAS */ - 1593, /* GL_RESCALE_NORMAL */ - 41, /* GL_ALPHA4 */ - 43, /* GL_ALPHA8 */ - 33, /* GL_ALPHA12 */ - 35, /* GL_ALPHA16 */ - 871, /* GL_LUMINANCE4 */ - 877, /* GL_LUMINANCE8 */ - 857, /* GL_LUMINANCE12 */ - 863, /* GL_LUMINANCE16 */ - 872, /* GL_LUMINANCE4_ALPHA4 */ - 875, /* GL_LUMINANCE6_ALPHA2 */ - 880, /* GL_LUMINANCE8_ALPHA8 */ - 860, /* GL_LUMINANCE12_ALPHA4 */ - 858, /* GL_LUMINANCE12_ALPHA12 */ - 866, /* GL_LUMINANCE16_ALPHA16 */ - 746, /* GL_INTENSITY */ - 755, /* GL_INTENSITY4 */ - 757, /* GL_INTENSITY8 */ - 747, /* GL_INTENSITY12 */ - 749, /* GL_INTENSITY16 */ - 1614, /* GL_RGB2_EXT */ - 1620, /* GL_RGB4 */ - 1623, /* GL_RGB5 */ - 1630, /* GL_RGB8 */ - 1600, /* GL_RGB10 */ - 1604, /* GL_RGB12 */ - 1606, /* GL_RGB16 */ - 1650, /* GL_RGBA2 */ - 1657, /* GL_RGBA4 */ - 1626, /* GL_RGB5_A1 */ - 1662, /* GL_RGBA8 */ - 1601, /* GL_RGB10_A2 */ - 1640, /* GL_RGBA12 */ - 1642, /* GL_RGBA16 */ - 2085, /* GL_TEXTURE_RED_SIZE */ - 2053, /* GL_TEXTURE_GREEN_SIZE */ - 1977, /* GL_TEXTURE_BLUE_SIZE */ - 1958, /* GL_TEXTURE_ALPHA_SIZE */ - 2066, /* GL_TEXTURE_LUMINANCE_SIZE */ - 2057, /* GL_TEXTURE_INTENSITY_SIZE */ - 1591, /* GL_REPLACE_EXT */ - 1489, /* GL_PROXY_TEXTURE_1D */ - 1493, /* GL_PROXY_TEXTURE_2D */ - 2093, /* GL_TEXTURE_TOO_LARGE_EXT */ - 2079, /* GL_TEXTURE_PRIORITY */ - 2087, /* GL_TEXTURE_RESIDENT */ - 1961, /* GL_TEXTURE_BINDING_1D */ - 1964, /* GL_TEXTURE_BINDING_2D */ - 1967, /* GL_TEXTURE_BINDING_3D */ - 1297, /* GL_PACK_SKIP_IMAGES */ - 1293, /* GL_PACK_IMAGE_HEIGHT */ - 2149, /* GL_UNPACK_SKIP_IMAGES */ - 2146, /* GL_UNPACK_IMAGE_HEIGHT */ - 1956, /* GL_TEXTURE_3D */ - 1497, /* GL_PROXY_TEXTURE_3D */ - 2037, /* GL_TEXTURE_DEPTH */ - 2096, /* GL_TEXTURE_WRAP_R */ - 1010, /* GL_MAX_3D_TEXTURE_SIZE */ - 2212, /* GL_VERTEX_ARRAY */ - 1223, /* GL_NORMAL_ARRAY */ - 186, /* GL_COLOR_ARRAY */ - 731, /* GL_INDEX_ARRAY */ - 2007, /* GL_TEXTURE_COORD_ARRAY */ - 515, /* GL_EDGE_FLAG_ARRAY */ - 2218, /* GL_VERTEX_ARRAY_SIZE */ - 2220, /* GL_VERTEX_ARRAY_TYPE */ - 2219, /* GL_VERTEX_ARRAY_STRIDE */ - 1228, /* GL_NORMAL_ARRAY_TYPE */ - 1227, /* GL_NORMAL_ARRAY_STRIDE */ - 190, /* GL_COLOR_ARRAY_SIZE */ - 192, /* GL_COLOR_ARRAY_TYPE */ - 191, /* GL_COLOR_ARRAY_STRIDE */ - 736, /* GL_INDEX_ARRAY_TYPE */ - 735, /* GL_INDEX_ARRAY_STRIDE */ - 2011, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 2013, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 2012, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - 519, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 2217, /* GL_VERTEX_ARRAY_POINTER */ - 1226, /* GL_NORMAL_ARRAY_POINTER */ - 189, /* GL_COLOR_ARRAY_POINTER */ - 734, /* GL_INDEX_ARRAY_POINTER */ - 2010, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - 518, /* GL_EDGE_FLAG_ARRAY_POINTER */ - 1201, /* GL_MULTISAMPLE */ - 1713, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - 1715, /* GL_SAMPLE_ALPHA_TO_ONE */ - 1720, /* GL_SAMPLE_COVERAGE */ - 1717, /* GL_SAMPLE_BUFFERS */ - 1708, /* GL_SAMPLES */ - 1724, /* GL_SAMPLE_COVERAGE_VALUE */ - 1722, /* GL_SAMPLE_COVERAGE_INVERT */ - 234, /* GL_COLOR_MATRIX */ - 236, /* GL_COLOR_MATRIX_STACK_DEPTH */ - 1022, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - 1408, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - 1404, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - 1399, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - 1395, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - 1406, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - 1402, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - 1397, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - 1393, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1990, /* GL_TEXTURE_COLOR_TABLE_SGI */ - 1498, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1992, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - 94, /* GL_BLEND_DST_RGB */ - 108, /* GL_BLEND_SRC_RGB */ - 92, /* GL_BLEND_DST_ALPHA */ - 106, /* GL_BLEND_SRC_ALPHA */ - 240, /* GL_COLOR_TABLE */ - 1418, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - 1401, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - 1484, /* GL_PROXY_COLOR_TABLE */ - 1488, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - 1487, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - 264, /* GL_COLOR_TABLE_SCALE */ - 244, /* GL_COLOR_TABLE_BIAS */ - 249, /* GL_COLOR_TABLE_FORMAT */ - 266, /* GL_COLOR_TABLE_WIDTH */ - 261, /* GL_COLOR_TABLE_RED_SIZE */ - 252, /* GL_COLOR_TABLE_GREEN_SIZE */ - 246, /* GL_COLOR_TABLE_BLUE_SIZE */ - 241, /* GL_COLOR_TABLE_ALPHA_SIZE */ - 258, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ - 255, /* GL_COLOR_TABLE_INTENSITY_SIZE */ - 79, /* GL_BGR */ - 80, /* GL_BGRA */ - 1037, /* GL_MAX_ELEMENTS_VERTICES */ - 1036, /* GL_MAX_ELEMENTS_INDICES */ - 2056, /* GL_TEXTURE_INDEX_SIZE_EXT */ - 183, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - 1364, /* GL_POINT_SIZE_MIN */ - 1360, /* GL_POINT_SIZE_MAX */ - 1349, /* GL_POINT_FADE_THRESHOLD_SIZE */ - 1345, /* GL_POINT_DISTANCE_ATTENUATION */ - 157, /* GL_CLAMP_TO_BORDER */ - 160, /* GL_CLAMP_TO_EDGE */ - 2078, /* GL_TEXTURE_MIN_LOD */ - 2076, /* GL_TEXTURE_MAX_LOD */ - 1960, /* GL_TEXTURE_BASE_LEVEL */ - 2075, /* GL_TEXTURE_MAX_LEVEL */ - 722, /* GL_IGNORE_BORDER_HP */ - 318, /* GL_CONSTANT_BORDER_HP */ - 1592, /* GL_REPLICATE_BORDER_HP */ - 329, /* GL_CONVOLUTION_BORDER_COLOR */ - 1256, /* GL_OCCLUSION_TEST_HP */ - 1257, /* GL_OCCLUSION_TEST_RESULT_HP */ - 823, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1984, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1986, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1988, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1989, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1987, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1985, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - 1016, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - 1017, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1428, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - 1430, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - 1427, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - 1429, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 2064, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 2065, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 2063, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - 678, /* GL_GENERATE_MIPMAP */ - 679, /* GL_GENERATE_MIPMAP_HINT */ - 591, /* GL_FOG_OFFSET_SGIX */ - 592, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1998, /* GL_TEXTURE_COMPARE_SGIX */ - 1997, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 2060, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 2052, /* GL_TEXTURE_GEQUAL_R_SGIX */ - 412, /* GL_DEPTH_COMPONENT16 */ - 416, /* GL_DEPTH_COMPONENT24 */ - 420, /* GL_DEPTH_COMPONENT32 */ - 354, /* GL_CULL_VERTEX_EXT */ - 356, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ - 355, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 2285, /* GL_WRAP_BORDER_SUN */ - 1991, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - 816, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - 1758, /* GL_SINGLE_COLOR */ - 1742, /* GL_SEPARATE_SPECULAR_COLOR */ - 1753, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 603, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - 604, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - 615, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - 606, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - 602, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - 601, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - 605, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - 616, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - 633, /* GL_FRAMEBUFFER_DEFAULT */ - 660, /* GL_FRAMEBUFFER_UNDEFINED */ - 428, /* GL_DEPTH_STENCIL_ATTACHMENT */ - 892, /* GL_MAJOR_VERSION */ - 1147, /* GL_MINOR_VERSION */ - 1237, /* GL_NUM_EXTENSIONS */ - 324, /* GL_CONTEXT_FLAGS */ - 730, /* GL_INDEX */ - 406, /* GL_DEPTH_BUFFER */ - 1832, /* GL_STENCIL_BUFFER */ - 295, /* GL_COMPRESSED_RED */ - 296, /* GL_COMPRESSED_RG */ - 2155, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 2200, /* GL_UNSIGNED_SHORT_5_6_5 */ - 2201, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 2197, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 2194, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 2169, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 2165, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 2073, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 2074, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 2072, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - 1151, /* GL_MIRRORED_REPEAT */ - 1679, /* GL_RGB_S3TC */ - 1622, /* GL_RGB4_S3TC */ - 1675, /* GL_RGBA_S3TC */ - 1661, /* GL_RGBA4_S3TC */ - 1670, /* GL_RGBA_DXT5_S3TC */ - 1658, /* GL_RGBA4_DXT5_S3TC */ - 306, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ - 301, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ - 302, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ - 303, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - 1213, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - 1212, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - 824, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - 578, /* GL_FOG_COORDINATE_SOURCE */ - 570, /* GL_FOG_COORD */ - 594, /* GL_FRAGMENT_DEPTH */ - 360, /* GL_CURRENT_FOG_COORD */ - 577, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - 576, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - 575, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - 572, /* GL_FOG_COORDINATE_ARRAY */ - 238, /* GL_COLOR_SUM */ - 381, /* GL_CURRENT_SECONDARY_COLOR */ - 1733, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - 1735, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - 1734, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - 1732, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - 1729, /* GL_SECONDARY_COLOR_ARRAY */ - 379, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ - 29, /* GL_ALIASED_POINT_SIZE_RANGE */ - 28, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1886, /* GL_TEXTURE0 */ - 1888, /* GL_TEXTURE1 */ - 1910, /* GL_TEXTURE2 */ - 1932, /* GL_TEXTURE3 */ - 1938, /* GL_TEXTURE4 */ - 1940, /* GL_TEXTURE5 */ - 1942, /* GL_TEXTURE6 */ - 1944, /* GL_TEXTURE7 */ - 1946, /* GL_TEXTURE8 */ - 1948, /* GL_TEXTURE9 */ - 1889, /* GL_TEXTURE10 */ - 1891, /* GL_TEXTURE11 */ - 1893, /* GL_TEXTURE12 */ - 1895, /* GL_TEXTURE13 */ - 1897, /* GL_TEXTURE14 */ - 1899, /* GL_TEXTURE15 */ - 1901, /* GL_TEXTURE16 */ - 1903, /* GL_TEXTURE17 */ - 1905, /* GL_TEXTURE18 */ - 1907, /* GL_TEXTURE19 */ - 1911, /* GL_TEXTURE20 */ - 1913, /* GL_TEXTURE21 */ - 1915, /* GL_TEXTURE22 */ - 1917, /* GL_TEXTURE23 */ - 1919, /* GL_TEXTURE24 */ - 1921, /* GL_TEXTURE25 */ - 1923, /* GL_TEXTURE26 */ - 1925, /* GL_TEXTURE27 */ - 1927, /* GL_TEXTURE28 */ - 1929, /* GL_TEXTURE29 */ - 1933, /* GL_TEXTURE30 */ - 1935, /* GL_TEXTURE31 */ - 19, /* GL_ACTIVE_TEXTURE */ - 163, /* GL_CLIENT_ACTIVE_TEXTURE */ - 1112, /* GL_MAX_TEXTURE_UNITS */ - 2128, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 2131, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 2133, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 2125, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1868, /* GL_SUBTRACT */ - 1094, /* GL_MAX_RENDERBUFFER_SIZE */ - 287, /* GL_COMPRESSED_ALPHA */ - 291, /* GL_COMPRESSED_LUMINANCE */ - 292, /* GL_COMPRESSED_LUMINANCE_ALPHA */ - 289, /* GL_COMPRESSED_INTENSITY */ - 297, /* GL_COMPRESSED_RGB */ - 298, /* GL_COMPRESSED_RGBA */ - 2005, /* GL_TEXTURE_COMPRESSION_HINT */ - 2082, /* GL_TEXTURE_RECTANGLE */ - 1973, /* GL_TEXTURE_BINDING_RECTANGLE */ - 1501, /* GL_PROXY_TEXTURE_RECTANGLE */ - 1091, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */ - 427, /* GL_DEPTH_STENCIL */ - 2161, /* GL_UNSIGNED_INT_24_8 */ - 1107, /* GL_MAX_TEXTURE_LOD_BIAS */ - 2071, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - 1109, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 2043, /* GL_TEXTURE_FILTER_CONTROL */ - 2061, /* GL_TEXTURE_LOD_BIAS */ - 271, /* GL_COMBINE4 */ - 1100, /* GL_MAX_SHININESS_NV */ - 1101, /* GL_MAX_SPOT_EXPONENT_NV */ - 728, /* GL_INCR_WRAP */ - 392, /* GL_DECR_WRAP */ - 1171, /* GL_MODELVIEW1_ARB */ - 1229, /* GL_NORMAL_MAP */ - 1552, /* GL_REFLECTION_MAP */ - 2015, /* GL_TEXTURE_CUBE_MAP */ - 1970, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 2027, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 2017, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 2030, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 2020, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 2033, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 2023, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - 1499, /* GL_PROXY_TEXTURE_CUBE_MAP */ - 1030, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - 1207, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - 1442, /* GL_PRIMITIVE_RESTART_NV */ - 1441, /* GL_PRIMITIVE_RESTART_INDEX_NV */ - 586, /* GL_FOG_DISTANCE_MODE_NV */ - 534, /* GL_EYE_RADIAL_NV */ - 533, /* GL_EYE_PLANE_ABSOLUTE_NV */ - 270, /* GL_COMBINE */ - 277, /* GL_COMBINE_RGB */ - 272, /* GL_COMBINE_ALPHA */ - 1680, /* GL_RGB_SCALE */ - 25, /* GL_ADD_SIGNED */ - 764, /* GL_INTERPOLATE */ - 313, /* GL_CONSTANT */ - 1434, /* GL_PRIMARY_COLOR */ - 1431, /* GL_PREVIOUS */ - 1773, /* GL_SOURCE0_RGB */ - 1779, /* GL_SOURCE1_RGB */ - 1785, /* GL_SOURCE2_RGB */ - 1789, /* GL_SOURCE3_RGB_NV */ - 1770, /* GL_SOURCE0_ALPHA */ - 1776, /* GL_SOURCE1_ALPHA */ - 1782, /* GL_SOURCE2_ALPHA */ - 1788, /* GL_SOURCE3_ALPHA_NV */ - 1270, /* GL_OPERAND0_RGB */ - 1276, /* GL_OPERAND1_RGB */ - 1282, /* GL_OPERAND2_RGB */ - 1286, /* GL_OPERAND3_RGB_NV */ - 1267, /* GL_OPERAND0_ALPHA */ - 1273, /* GL_OPERAND1_ALPHA */ - 1279, /* GL_OPERAND2_ALPHA */ - 1285, /* GL_OPERAND3_ALPHA_NV */ - 137, /* GL_BUFFER_OBJECT_APPLE */ - 2213, /* GL_VERTEX_ARRAY_BINDING */ - 2080, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ - 2081, /* GL_TEXTURE_RANGE_POINTER_APPLE */ - 2290, /* GL_YCBCR_422_APPLE */ - 2202, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 2204, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - 2092, /* GL_TEXTURE_STORAGE_HINT_APPLE */ - 1859, /* GL_STORAGE_PRIVATE_APPLE */ - 1858, /* GL_STORAGE_CACHED_APPLE */ - 1860, /* GL_STORAGE_SHARED_APPLE */ - 1760, /* GL_SLICE_ACCUM_SUN */ - 1510, /* GL_QUAD_MESH_SUN */ - 2139, /* GL_TRIANGLE_MESH_SUN */ - 2255, /* GL_VERTEX_PROGRAM_ARB */ - 2266, /* GL_VERTEX_STATE_PROGRAM_NV */ - 2240, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 2248, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 2250, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 2252, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - 383, /* GL_CURRENT_VERTEX_ATTRIB */ - 1455, /* GL_PROGRAM_LENGTH_ARB */ - 1471, /* GL_PROGRAM_STRING_ARB */ - 1194, /* GL_MODELVIEW_PROJECTION_NV */ - 721, /* GL_IDENTITY_NV */ - 796, /* GL_INVERSE_NV */ - 2130, /* GL_TRANSPOSE_NV */ - 797, /* GL_INVERSE_TRANSPOSE_NV */ - 1075, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - 1074, /* GL_MAX_PROGRAM_MATRICES_ARB */ - 956, /* GL_MATRIX0_NV */ - 968, /* GL_MATRIX1_NV */ - 980, /* GL_MATRIX2_NV */ - 984, /* GL_MATRIX3_NV */ - 986, /* GL_MATRIX4_NV */ - 988, /* GL_MATRIX5_NV */ - 990, /* GL_MATRIX6_NV */ - 992, /* GL_MATRIX7_NV */ - 366, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ - 363, /* GL_CURRENT_MATRIX_ARB */ - 1468, /* GL_PROGRAM_POINT_SIZE */ - 2261, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - 1467, /* GL_PROGRAM_PARAMETER_NV */ - 2246, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - 1473, /* GL_PROGRAM_TARGET_NV */ - 1470, /* GL_PROGRAM_RESIDENT_NV */ - 2102, /* GL_TRACK_MATRIX_NV */ - 2103, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 2256, /* GL_VERTEX_PROGRAM_BINDING_NV */ - 1449, /* GL_PROGRAM_ERROR_POSITION_ARB */ - 408, /* GL_DEPTH_CLAMP */ - 2221, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 2228, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 2229, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 2230, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 2231, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 2232, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 2233, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 2234, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 2235, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 2236, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 2222, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 2223, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 2224, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 2225, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 2226, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 2227, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - 904, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - 911, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - 912, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - 913, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - 914, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - 915, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - 916, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - 917, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - 918, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - 919, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - 905, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - 906, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - 907, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - 908, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - 909, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - 910, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - 931, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - 938, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - 939, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - 940, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - 941, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - 942, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - 943, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - 1448, /* GL_PROGRAM_BINDING_ARB */ - 945, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - 946, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - 932, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - 933, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - 934, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - 935, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - 936, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - 937, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 2003, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 2000, /* GL_TEXTURE_COMPRESSED */ - 1235, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - 311, /* GL_COMPRESSED_TEXTURE_FORMATS */ - 1134, /* GL_MAX_VERTEX_UNITS_ARB */ - 23, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 2284, /* GL_WEIGHT_SUM_UNITY_ARB */ - 2254, /* GL_VERTEX_BLEND_ARB */ - 385, /* GL_CURRENT_WEIGHT_ARB */ - 2282, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 2280, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 2278, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 2276, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 2271, /* GL_WEIGHT_ARRAY_ARB */ - 442, /* GL_DOT3_RGB */ - 443, /* GL_DOT3_RGBA */ - 305, /* GL_COMPRESSED_RGB_FXT1_3DFX */ - 300, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - 1202, /* GL_MULTISAMPLE_3DFX */ - 1718, /* GL_SAMPLE_BUFFERS_3DFX */ - 1709, /* GL_SAMPLES_3DFX */ - 1182, /* GL_MODELVIEW2_ARB */ - 1185, /* GL_MODELVIEW3_ARB */ - 1186, /* GL_MODELVIEW4_ARB */ - 1187, /* GL_MODELVIEW5_ARB */ - 1188, /* GL_MODELVIEW6_ARB */ - 1189, /* GL_MODELVIEW7_ARB */ - 1190, /* GL_MODELVIEW8_ARB */ - 1191, /* GL_MODELVIEW9_ARB */ - 1161, /* GL_MODELVIEW10_ARB */ - 1162, /* GL_MODELVIEW11_ARB */ - 1163, /* GL_MODELVIEW12_ARB */ - 1164, /* GL_MODELVIEW13_ARB */ - 1165, /* GL_MODELVIEW14_ARB */ - 1166, /* GL_MODELVIEW15_ARB */ - 1167, /* GL_MODELVIEW16_ARB */ - 1168, /* GL_MODELVIEW17_ARB */ - 1169, /* GL_MODELVIEW18_ARB */ - 1170, /* GL_MODELVIEW19_ARB */ - 1172, /* GL_MODELVIEW20_ARB */ - 1173, /* GL_MODELVIEW21_ARB */ - 1174, /* GL_MODELVIEW22_ARB */ - 1175, /* GL_MODELVIEW23_ARB */ - 1176, /* GL_MODELVIEW24_ARB */ - 1177, /* GL_MODELVIEW25_ARB */ - 1178, /* GL_MODELVIEW26_ARB */ - 1179, /* GL_MODELVIEW27_ARB */ - 1180, /* GL_MODELVIEW28_ARB */ - 1181, /* GL_MODELVIEW29_ARB */ - 1183, /* GL_MODELVIEW30_ARB */ - 1184, /* GL_MODELVIEW31_ARB */ - 447, /* GL_DOT3_RGB_EXT */ - 445, /* GL_DOT3_RGBA_EXT */ - 1155, /* GL_MIRROR_CLAMP_EXT */ - 1158, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - 1197, /* GL_MODULATE_ADD_ATI */ - 1198, /* GL_MODULATE_SIGNED_ADD_ATI */ - 1199, /* GL_MODULATE_SUBTRACT_ATI */ - 2291, /* GL_YCBCR_MESA */ - 1294, /* GL_PACK_INVERT_MESA */ - 388, /* GL_DEBUG_OBJECT_MESA */ - 389, /* GL_DEBUG_PRINT_MESA */ - 387, /* GL_DEBUG_ASSERT_MESA */ - 139, /* GL_BUFFER_SIZE */ - 141, /* GL_BUFFER_USAGE */ - 145, /* GL_BUMP_ROT_MATRIX_ATI */ - 146, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ - 144, /* GL_BUMP_NUM_TEX_UNITS_ATI */ - 148, /* GL_BUMP_TEX_UNITS_ATI */ - 507, /* GL_DUDV_ATI */ - 506, /* GL_DU8DV8_ATI */ - 143, /* GL_BUMP_ENVMAP_ATI */ - 147, /* GL_BUMP_TARGET_ATI */ - 1238, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */ - 1446, /* GL_PROGRAM_BINARY_FORMATS_OES */ - 1822, /* GL_STENCIL_BACK_FUNC */ - 1820, /* GL_STENCIL_BACK_FAIL */ - 1824, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1826, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - 595, /* GL_FRAGMENT_PROGRAM_ARB */ - 1444, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 1476, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 1475, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - 1458, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 1464, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 1463, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 1064, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 1089, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 1088, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - 1077, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 1083, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 1082, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 1652, /* GL_RGBA32F */ - 1615, /* GL_RGB32F */ - 1643, /* GL_RGBA16F */ - 1607, /* GL_RGB16F */ - 1033, /* GL_MAX_DRAW_BUFFERS */ - 451, /* GL_DRAW_BUFFER0 */ - 454, /* GL_DRAW_BUFFER1 */ - 475, /* GL_DRAW_BUFFER2 */ - 478, /* GL_DRAW_BUFFER3 */ - 481, /* GL_DRAW_BUFFER4 */ - 484, /* GL_DRAW_BUFFER5 */ - 487, /* GL_DRAW_BUFFER6 */ - 490, /* GL_DRAW_BUFFER7 */ - 493, /* GL_DRAW_BUFFER8 */ - 496, /* GL_DRAW_BUFFER9 */ - 455, /* GL_DRAW_BUFFER10 */ - 458, /* GL_DRAW_BUFFER11 */ - 461, /* GL_DRAW_BUFFER12 */ - 464, /* GL_DRAW_BUFFER13 */ - 467, /* GL_DRAW_BUFFER14 */ - 470, /* GL_DRAW_BUFFER15 */ - 97, /* GL_BLEND_EQUATION_ALPHA */ - 1007, /* GL_MATRIX_PALETTE_ARB */ - 1057, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - 1060, /* GL_MAX_PALETTE_MATRICES_ARB */ - 369, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - 995, /* GL_MATRIX_INDEX_ARRAY_ARB */ - 364, /* GL_CURRENT_MATRIX_INDEX_ARB */ - 1000, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - 1004, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - 1002, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - 998, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 2038, /* GL_TEXTURE_DEPTH_SIZE */ - 435, /* GL_DEPTH_TEXTURE_MODE */ - 1995, /* GL_TEXTURE_COMPARE_MODE */ - 1993, /* GL_TEXTURE_COMPARE_FUNC */ - 281, /* GL_COMPARE_REF_TO_TEXTURE */ - 1371, /* GL_POINT_SPRITE */ - 343, /* GL_COORD_REPLACE */ - 1376, /* GL_POINT_SPRITE_R_MODE_NV */ - 1516, /* GL_QUERY_COUNTER_BITS */ - 372, /* GL_CURRENT_QUERY */ - 1520, /* GL_QUERY_RESULT */ - 1522, /* GL_QUERY_RESULT_AVAILABLE */ - 1126, /* GL_MAX_VERTEX_ATTRIBS */ - 2244, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - 433, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - 432, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - 1103, /* GL_MAX_TEXTURE_COORDS */ - 1105, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - 1451, /* GL_PROGRAM_ERROR_STRING_ARB */ - 1453, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - 1452, /* GL_PROGRAM_FORMAT_ARB */ - 2094, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - 405, /* GL_DEPTH_BOUNDS_TEST_EXT */ - 404, /* GL_DEPTH_BOUNDS_EXT */ - 61, /* GL_ARRAY_BUFFER */ - 520, /* GL_ELEMENT_ARRAY_BUFFER */ - 62, /* GL_ARRAY_BUFFER_BINDING */ - 521, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 2215, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - 1224, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - 187, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - 732, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 2008, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - 516, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - 1730, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - 573, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 2272, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 2237, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - 1454, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - 1070, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - 1460, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 1079, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 1474, /* GL_PROGRAM_TEMPORARIES_ARB */ - 1085, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - 1462, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 1081, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 1466, /* GL_PROGRAM_PARAMETERS_ARB */ - 1084, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - 1461, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - 1080, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - 1445, /* GL_PROGRAM_ATTRIBS_ARB */ - 1065, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - 1459, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - 1078, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - 1443, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - 1063, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - 1457, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 1076, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 1071, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - 1067, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - 1477, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 2127, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - 1539, /* GL_READ_ONLY */ - 2286, /* GL_WRITE_ONLY */ - 1541, /* GL_READ_WRITE */ - 124, /* GL_BUFFER_ACCESS */ - 129, /* GL_BUFFER_MAPPED */ - 134, /* GL_BUFFER_MAP_POINTER */ - 2101, /* GL_TIME_ELAPSED_EXT */ - 955, /* GL_MATRIX0_ARB */ - 967, /* GL_MATRIX1_ARB */ - 979, /* GL_MATRIX2_ARB */ - 983, /* GL_MATRIX3_ARB */ - 985, /* GL_MATRIX4_ARB */ - 987, /* GL_MATRIX5_ARB */ - 989, /* GL_MATRIX6_ARB */ - 991, /* GL_MATRIX7_ARB */ - 993, /* GL_MATRIX8_ARB */ - 994, /* GL_MATRIX9_ARB */ - 957, /* GL_MATRIX10_ARB */ - 958, /* GL_MATRIX11_ARB */ - 959, /* GL_MATRIX12_ARB */ - 960, /* GL_MATRIX13_ARB */ - 961, /* GL_MATRIX14_ARB */ - 962, /* GL_MATRIX15_ARB */ - 963, /* GL_MATRIX16_ARB */ - 964, /* GL_MATRIX17_ARB */ - 965, /* GL_MATRIX18_ARB */ - 966, /* GL_MATRIX19_ARB */ - 969, /* GL_MATRIX20_ARB */ - 970, /* GL_MATRIX21_ARB */ - 971, /* GL_MATRIX22_ARB */ - 972, /* GL_MATRIX23_ARB */ - 973, /* GL_MATRIX24_ARB */ - 974, /* GL_MATRIX25_ARB */ - 975, /* GL_MATRIX26_ARB */ - 976, /* GL_MATRIX27_ARB */ - 977, /* GL_MATRIX28_ARB */ - 978, /* GL_MATRIX29_ARB */ - 981, /* GL_MATRIX30_ARB */ - 982, /* GL_MATRIX31_ARB */ - 1863, /* GL_STREAM_DRAW */ - 1865, /* GL_STREAM_READ */ - 1861, /* GL_STREAM_COPY */ - 1812, /* GL_STATIC_DRAW */ - 1814, /* GL_STATIC_READ */ - 1810, /* GL_STATIC_COPY */ - 510, /* GL_DYNAMIC_DRAW */ - 512, /* GL_DYNAMIC_READ */ - 508, /* GL_DYNAMIC_COPY */ - 1334, /* GL_PIXEL_PACK_BUFFER */ - 1338, /* GL_PIXEL_UNPACK_BUFFER */ - 1335, /* GL_PIXEL_PACK_BUFFER_BINDING */ - 1339, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - 396, /* GL_DEPTH24_STENCIL8 */ - 2090, /* GL_TEXTURE_STENCIL_SIZE */ - 2036, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ - 1066, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - 1069, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - 1073, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - 1072, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - 2242, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */ - 2239, /* GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB */ - 1012, /* GL_MAX_ARRAY_TEXTURE_LAYERS */ - 1149, /* GL_MIN_PROGRAM_TEXEL_OFFSET */ - 1086, /* GL_MAX_PROGRAM_TEXEL_OFFSET */ - 1854, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - 18, /* GL_ACTIVE_STENCIL_FACE_EXT */ - 1156, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - 1711, /* GL_SAMPLES_PASSED */ - 688, /* GL_GEOMETRY_VERTICES_OUT */ - 682, /* GL_GEOMETRY_INPUT_TYPE */ - 684, /* GL_GEOMETRY_OUTPUT_TYPE */ - 156, /* GL_CLAMP_READ_COLOR */ - 546, /* GL_FIXED_ONLY */ - 1358, /* GL_POINT_SIZE_ARRAY_TYPE_OES */ - 1357, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */ - 1356, /* GL_POINT_SIZE_ARRAY_POINTER_OES */ - 1193, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */ - 1480, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */ - 2070, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */ - 138, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ - 128, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ - 1556, /* GL_RELEASED_APPLE */ - 2269, /* GL_VOLATILE_APPLE */ - 1595, /* GL_RETAINED_APPLE */ - 2144, /* GL_UNDEFINED_APPLE */ - 1504, /* GL_PURGEABLE_APPLE */ - 596, /* GL_FRAGMENT_SHADER */ - 2264, /* GL_VERTEX_SHADER */ - 1465, /* GL_PROGRAM_OBJECT_ARB */ - 1747, /* GL_SHADER_OBJECT_ARB */ - 1041, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - 1131, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - 1122, /* GL_MAX_VARYING_COMPONENTS */ - 1129, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - 1024, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - 1254, /* GL_OBJECT_TYPE_ARB */ - 1749, /* GL_SHADER_TYPE */ - 561, /* GL_FLOAT_VEC2 */ - 563, /* GL_FLOAT_VEC3 */ - 565, /* GL_FLOAT_VEC4 */ - 784, /* GL_INT_VEC2 */ - 786, /* GL_INT_VEC3 */ - 788, /* GL_INT_VEC4 */ - 116, /* GL_BOOL */ - 118, /* GL_BOOL_VEC2 */ - 120, /* GL_BOOL_VEC3 */ - 122, /* GL_BOOL_VEC4 */ - 549, /* GL_FLOAT_MAT2 */ - 553, /* GL_FLOAT_MAT3 */ - 557, /* GL_FLOAT_MAT4 */ - 1687, /* GL_SAMPLER_1D */ - 1693, /* GL_SAMPLER_2D */ - 1701, /* GL_SAMPLER_3D */ - 1705, /* GL_SAMPLER_CUBE */ - 1692, /* GL_SAMPLER_1D_SHADOW */ - 1700, /* GL_SAMPLER_2D_SHADOW */ - 1698, /* GL_SAMPLER_2D_RECT */ - 1699, /* GL_SAMPLER_2D_RECT_SHADOW */ - 551, /* GL_FLOAT_MAT2x3 */ - 552, /* GL_FLOAT_MAT2x4 */ - 555, /* GL_FLOAT_MAT3x2 */ - 556, /* GL_FLOAT_MAT3x4 */ - 559, /* GL_FLOAT_MAT4x2 */ - 560, /* GL_FLOAT_MAT4x3 */ - 394, /* GL_DELETE_STATUS */ - 286, /* GL_COMPILE_STATUS */ - 845, /* GL_LINK_STATUS */ - 2209, /* GL_VALIDATE_STATUS */ - 744, /* GL_INFO_LOG_LENGTH */ - 64, /* GL_ATTACHED_SHADERS */ - 21, /* GL_ACTIVE_UNIFORMS */ - 22, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ - 1748, /* GL_SHADER_SOURCE_LENGTH */ - 15, /* GL_ACTIVE_ATTRIBUTES */ - 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ - 598, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - 1751, /* GL_SHADING_LANGUAGE_VERSION */ - 371, /* GL_CURRENT_PROGRAM */ - 1303, /* GL_PALETTE4_RGB8_OES */ - 1305, /* GL_PALETTE4_RGBA8_OES */ - 1301, /* GL_PALETTE4_R5_G6_B5_OES */ - 1304, /* GL_PALETTE4_RGBA4_OES */ - 1302, /* GL_PALETTE4_RGB5_A1_OES */ - 1308, /* GL_PALETTE8_RGB8_OES */ - 1310, /* GL_PALETTE8_RGBA8_OES */ - 1306, /* GL_PALETTE8_R5_G6_B5_OES */ - 1309, /* GL_PALETTE8_RGBA4_OES */ - 1307, /* GL_PALETTE8_RGB5_A1_OES */ - 725, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */ - 723, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */ - 1355, /* GL_POINT_SIZE_ARRAY_OES */ - 2014, /* GL_TEXTURE_CROP_RECT_OES */ - 996, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */ - 1354, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */ - 2192, /* GL_UNSIGNED_NORMALIZED */ - 1951, /* GL_TEXTURE_1D_ARRAY */ - 1490, /* GL_PROXY_TEXTURE_1D_ARRAY */ - 1954, /* GL_TEXTURE_2D_ARRAY */ - 1494, /* GL_PROXY_TEXTURE_2D_ARRAY */ - 1962, /* GL_TEXTURE_BINDING_1D_ARRAY */ - 1965, /* GL_TEXTURE_BINDING_2D_ARRAY */ - 1048, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */ - 1981, /* GL_TEXTURE_BUFFER */ - 1102, /* GL_MAX_TEXTURE_BUFFER_SIZE */ - 1969, /* GL_TEXTURE_BINDING_BUFFER */ - 1982, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */ - 1983, /* GL_TEXTURE_BUFFER_FORMAT */ - 1527, /* GL_R11F_G11F_B10F */ - 2158, /* GL_UNSIGNED_INT_10F_11F_11F_REV */ - 1638, /* GL_RGB9_E5 */ - 2167, /* GL_UNSIGNED_INT_5_9_9_9_REV */ - 2088, /* GL_TEXTURE_SHARED_SIZE */ - 1804, /* GL_SRGB */ - 1805, /* GL_SRGB8 */ - 1807, /* GL_SRGB_ALPHA */ - 1806, /* GL_SRGB8_ALPHA8 */ - 1764, /* GL_SLUMINANCE_ALPHA */ - 1763, /* GL_SLUMINANCE8_ALPHA8 */ - 1761, /* GL_SLUMINANCE */ - 1762, /* GL_SLUMINANCE8 */ - 309, /* GL_COMPRESSED_SRGB */ - 310, /* GL_COMPRESSED_SRGB_ALPHA */ - 307, /* GL_COMPRESSED_SLUMINANCE */ - 308, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ - 2123, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */ - 2112, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */ - 1120, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */ - 2121, /* GL_TRANSFORM_FEEDBACK_VARYINGS */ - 2117, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */ - 2115, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */ - 1437, /* GL_PRIMITIVES_GENERATED */ - 2119, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */ - 1531, /* GL_RASTERIZER_DISCARD */ - 1116, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */ - 1118, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */ - 762, /* GL_INTERLEAVED_ATTRIBS */ - 1740, /* GL_SEPARATE_ATTRIBS */ - 2107, /* GL_TRANSFORM_FEEDBACK_BUFFER */ - 2109, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */ - 1373, /* GL_POINT_SPRITE_COORD_ORIGIN */ - 853, /* GL_LOWER_LEFT */ - 2206, /* GL_UPPER_LEFT */ - 1828, /* GL_STENCIL_BACK_REF */ - 1829, /* GL_STENCIL_BACK_VALUE_MASK */ - 1830, /* GL_STENCIL_BACK_WRITEMASK */ - 500, /* GL_DRAW_FRAMEBUFFER_BINDING */ - 1561, /* GL_RENDERBUFFER_BINDING */ - 1535, /* GL_READ_FRAMEBUFFER */ - 499, /* GL_DRAW_FRAMEBUFFER */ - 1536, /* GL_READ_FRAMEBUFFER_BINDING */ - 1580, /* GL_RENDERBUFFER_SAMPLES */ - 612, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - 609, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - 624, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - 619, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - 622, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - 630, /* GL_FRAMEBUFFER_COMPLETE */ - 635, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - 650, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - 644, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - 639, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - 645, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - 641, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ - 655, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ - 661, /* GL_FRAMEBUFFER_UNSUPPORTED */ - 659, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - 1020, /* GL_MAX_COLOR_ATTACHMENTS */ - 193, /* GL_COLOR_ATTACHMENT0 */ - 196, /* GL_COLOR_ATTACHMENT1 */ - 210, /* GL_COLOR_ATTACHMENT2 */ - 212, /* GL_COLOR_ATTACHMENT3 */ - 214, /* GL_COLOR_ATTACHMENT4 */ - 216, /* GL_COLOR_ATTACHMENT5 */ - 218, /* GL_COLOR_ATTACHMENT6 */ - 220, /* GL_COLOR_ATTACHMENT7 */ - 222, /* GL_COLOR_ATTACHMENT8 */ - 224, /* GL_COLOR_ATTACHMENT9 */ - 197, /* GL_COLOR_ATTACHMENT10 */ - 199, /* GL_COLOR_ATTACHMENT11 */ - 201, /* GL_COLOR_ATTACHMENT12 */ - 203, /* GL_COLOR_ATTACHMENT13 */ - 205, /* GL_COLOR_ATTACHMENT14 */ - 207, /* GL_COLOR_ATTACHMENT15 */ - 399, /* GL_DEPTH_ATTACHMENT */ - 1817, /* GL_STENCIL_ATTACHMENT */ - 600, /* GL_FRAMEBUFFER */ - 1558, /* GL_RENDERBUFFER */ - 1584, /* GL_RENDERBUFFER_WIDTH */ - 1571, /* GL_RENDERBUFFER_HEIGHT */ - 1574, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - 1849, /* GL_STENCIL_INDEX_EXT */ - 1838, /* GL_STENCIL_INDEX1 */ - 1843, /* GL_STENCIL_INDEX4 */ - 1846, /* GL_STENCIL_INDEX8 */ - 1839, /* GL_STENCIL_INDEX16 */ - 1578, /* GL_RENDERBUFFER_RED_SIZE */ - 1569, /* GL_RENDERBUFFER_GREEN_SIZE */ - 1564, /* GL_RENDERBUFFER_BLUE_SIZE */ - 1559, /* GL_RENDERBUFFER_ALPHA_SIZE */ - 1566, /* GL_RENDERBUFFER_DEPTH_SIZE */ - 1582, /* GL_RENDERBUFFER_STENCIL_SIZE */ - 653, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - 1097, /* GL_MAX_SAMPLES */ - 2050, /* GL_TEXTURE_GEN_STR_OES */ - 699, /* GL_HALF_FLOAT_OES */ - 1625, /* GL_RGB565_OES */ - 1655, /* GL_RGBA32UI */ - 1618, /* GL_RGB32UI */ - 40, /* GL_ALPHA32UI_EXT */ - 754, /* GL_INTENSITY32UI_EXT */ - 870, /* GL_LUMINANCE32UI_EXT */ - 887, /* GL_LUMINANCE_ALPHA32UI_EXT */ - 1646, /* GL_RGBA16UI */ - 1610, /* GL_RGB16UI */ - 37, /* GL_ALPHA16UI_EXT */ - 751, /* GL_INTENSITY16UI_EXT */ - 865, /* GL_LUMINANCE16UI_EXT */ - 885, /* GL_LUMINANCE_ALPHA16UI_EXT */ - 1665, /* GL_RGBA8UI */ - 1633, /* GL_RGB8UI */ - 45, /* GL_ALPHA8UI_EXT */ - 759, /* GL_INTENSITY8UI_EXT */ - 879, /* GL_LUMINANCE8UI_EXT */ - 889, /* GL_LUMINANCE_ALPHA8UI_EXT */ - 1653, /* GL_RGBA32I */ - 1616, /* GL_RGB32I */ - 39, /* GL_ALPHA32I_EXT */ - 753, /* GL_INTENSITY32I_EXT */ - 869, /* GL_LUMINANCE32I_EXT */ - 886, /* GL_LUMINANCE_ALPHA32I_EXT */ - 1644, /* GL_RGBA16I */ - 1608, /* GL_RGB16I */ - 36, /* GL_ALPHA16I_EXT */ - 750, /* GL_INTENSITY16I_EXT */ - 864, /* GL_LUMINANCE16I_EXT */ - 884, /* GL_LUMINANCE_ALPHA16I_EXT */ - 1663, /* GL_RGBA8I */ - 1631, /* GL_RGB8I */ - 44, /* GL_ALPHA8I_EXT */ - 758, /* GL_INTENSITY8I_EXT */ - 878, /* GL_LUMINANCE8I_EXT */ - 888, /* GL_LUMINANCE_ALPHA8I_EXT */ - 1548, /* GL_RED_INTEGER */ - 695, /* GL_GREEN_INTEGER */ - 113, /* GL_BLUE_INTEGER */ - 49, /* GL_ALPHA_INTEGER_EXT */ - 1677, /* GL_RGB_INTEGER */ - 1671, /* GL_RGBA_INTEGER */ - 84, /* GL_BGR_INTEGER */ - 82, /* GL_BGRA_INTEGER */ - 891, /* GL_LUMINANCE_INTEGER_EXT */ - 890, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */ - 1673, /* GL_RGBA_INTEGER_MODE_EXT */ - 607, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */ - 648, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */ - 647, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */ - 1688, /* GL_SAMPLER_1D_ARRAY */ - 1694, /* GL_SAMPLER_2D_ARRAY */ - 1703, /* GL_SAMPLER_BUFFER */ - 1690, /* GL_SAMPLER_1D_ARRAY_SHADOW */ - 1696, /* GL_SAMPLER_2D_ARRAY_SHADOW */ - 1706, /* GL_SAMPLER_CUBE_SHADOW */ - 2186, /* GL_UNSIGNED_INT_VEC2 */ - 2188, /* GL_UNSIGNED_INT_VEC3 */ - 2190, /* GL_UNSIGNED_INT_VEC4 */ - 768, /* GL_INT_SAMPLER_1D */ - 772, /* GL_INT_SAMPLER_2D */ - 778, /* GL_INT_SAMPLER_3D */ - 782, /* GL_INT_SAMPLER_CUBE */ - 776, /* GL_INT_SAMPLER_2D_RECT */ - 769, /* GL_INT_SAMPLER_1D_ARRAY */ - 773, /* GL_INT_SAMPLER_2D_ARRAY */ - 780, /* GL_INT_SAMPLER_BUFFER */ - 2170, /* GL_UNSIGNED_INT_SAMPLER_1D */ - 2174, /* GL_UNSIGNED_INT_SAMPLER_2D */ - 2180, /* GL_UNSIGNED_INT_SAMPLER_3D */ - 2184, /* GL_UNSIGNED_INT_SAMPLER_CUBE */ - 2178, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */ - 2171, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */ - 2175, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */ - 2182, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */ - 686, /* GL_GEOMETRY_SHADER */ - 689, /* GL_GEOMETRY_VERTICES_OUT_ARB */ - 683, /* GL_GEOMETRY_INPUT_TYPE_ARB */ - 685, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */ - 1054, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */ - 1136, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */ - 1052, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */ - 1046, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */ - 1050, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */ - 854, /* GL_LOW_FLOAT */ - 1138, /* GL_MEDIUM_FLOAT */ - 700, /* GL_HIGH_FLOAT */ - 855, /* GL_LOW_INT */ - 1139, /* GL_MEDIUM_INT */ - 701, /* GL_HIGH_INT */ - 2160, /* GL_UNSIGNED_INT_10_10_10_2_OES */ - 767, /* GL_INT_10_10_10_2_OES */ - 1745, /* GL_SHADER_BINARY_FORMATS */ - 1239, /* GL_NUM_SHADER_BINARY_FORMATS */ - 1746, /* GL_SHADER_COMPILER */ - 1133, /* GL_MAX_VERTEX_UNIFORM_VECTORS */ - 1125, /* GL_MAX_VARYING_VECTORS */ - 1043, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */ - 1524, /* GL_QUERY_WAIT */ - 1518, /* GL_QUERY_NO_WAIT */ - 1514, /* GL_QUERY_BY_REGION_WAIT */ - 1512, /* GL_QUERY_BY_REGION_NO_WAIT */ - 2105, /* GL_TRANSFORM_FEEDBACK */ - 2114, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ - 2108, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ - 2106, /* GL_TRANSFORM_FEEDBACK_BINDING */ - 1508, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ - 542, /* GL_FIRST_VERTEX_CONVENTION */ - 800, /* GL_LAST_VERTEX_CONVENTION */ - 1482, /* GL_PROVOKING_VERTEX */ - 350, /* GL_COPY_READ_BUFFER */ - 351, /* GL_COPY_WRITE_BUFFER */ - 1551, /* GL_RED_SNORM */ - 1684, /* GL_RG_SNORM */ - 1683, /* GL_RGB_SNORM */ - 1676, /* GL_RGBA_SNORM */ - 1530, /* GL_R8_SNORM */ - 1598, /* GL_RG8_SNORM */ - 1637, /* GL_RGB8_SNORM */ - 1669, /* GL_RGBA8_SNORM */ - 1528, /* GL_R16_SNORM */ - 1597, /* GL_RG16_SNORM */ - 1613, /* GL_RGB16_SNORM */ - 1649, /* GL_RGBA16_SNORM */ - 1757, /* GL_SIGNED_NORMALIZED */ - 1439, /* GL_PRIMITIVE_RESTART */ - 1440, /* GL_PRIMITIVE_RESTART_INDEX */ - 1099, /* GL_MAX_SERVER_WAIT_TIMEOUT */ - 1253, /* GL_OBJECT_TYPE */ - 1870, /* GL_SYNC_CONDITION */ - 1875, /* GL_SYNC_STATUS */ - 1872, /* GL_SYNC_FLAGS */ - 1871, /* GL_SYNC_FENCE */ - 1874, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ - 2153, /* GL_UNSIGNALED */ - 1756, /* GL_SIGNALED */ - 54, /* GL_ALREADY_SIGNALED */ - 2100, /* GL_TIMEOUT_EXPIRED */ - 312, /* GL_CONDITION_SATISFIED */ - 2270, /* GL_WAIT_FAILED */ - 126, /* GL_BUFFER_ACCESS_FLAGS */ - 132, /* GL_BUFFER_MAP_LENGTH */ - 133, /* GL_BUFFER_MAP_OFFSET */ - 1128, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */ - 1044, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */ - 1045, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */ - 1040, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */ - 326, /* GL_CONTEXT_PROFILE_MASK */ - 527, /* GL_EVAL_BIT */ - 1533, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - 847, /* GL_LIST_BIT */ - 1976, /* GL_TEXTURE_BIT */ - 1726, /* GL_SCISSOR_BIT */ - 30, /* GL_ALL_ATTRIB_BITS */ - 1204, /* GL_MULTISAMPLE_BIT */ - 31, /* GL_ALL_CLIENT_ATTRIB_BITS */ -}; - -typedef int (*cfunc)(const void *, const void *); - -/** - * Compare a key name to an element in the \c all_enums array. - * - * \c bsearch always passes the key as the first parameter and the pointer - * to the array element as the second parameter. We can elimiate some - * extra work by taking advantage of that fact. - * - * \param a Pointer to the desired enum name. - * \param b Pointer to an element of the \c all_enums array. - */ -static int compar_name( const char *a, const enum_elt *b ) -{ - return strcmp( a, & enum_string_table[ b->offset ] ); -} - -/** - * Compare a key enum value to an element in the \c all_enums array. - * - * \c bsearch always passes the key as the first parameter and the pointer - * to the array element as the second parameter. We can elimiate some - * extra work by taking advantage of that fact. - * - * \param a Pointer to the desired enum name. - * \param b Pointer to an index into the \c all_enums array. - */ -static int compar_nr( const int *a, const unsigned *b ) -{ - return a[0] - all_enums[*b].n; -} - - -static char token_tmp[20]; - -const char *_mesa_lookup_enum_by_nr( int nr ) -{ - unsigned * i; - - i = (unsigned *) _mesa_bsearch(& nr, reduced_enums, - Elements(reduced_enums), - sizeof(reduced_enums[0]), - (cfunc) compar_nr); - - if ( i != NULL ) { - return & enum_string_table[ all_enums[ *i ].offset ]; - } - else { - /* this is not re-entrant safe, no big deal here */ - _mesa_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr); - token_tmp[sizeof(token_tmp) - 1] = '\0'; - return token_tmp; - } -} - -/* Get the name of an enum given that it is a primitive type. Avoids - * GL_FALSE/GL_POINTS ambiguity and others. - */ -const char *_mesa_lookup_prim_by_nr( int nr ) -{ - switch (nr) { - case GL_POINTS: return "GL_POINTS"; - case GL_LINES: return "GL_LINES"; - case GL_LINE_STRIP: return "GL_LINE_STRIP"; - case GL_LINE_LOOP: return "GL_LINE_LOOP"; - case GL_TRIANGLES: return "GL_TRIANGLES"; - case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP"; - case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN"; - case GL_QUADS: return "GL_QUADS"; - case GL_QUAD_STRIP: return "GL_QUAD_STRIP"; - case GL_POLYGON: return "GL_POLYGON"; - case GL_POLYGON+1: return "OUTSIDE_BEGIN_END"; - default: return ""; - } -} - - - -int _mesa_lookup_enum_by_name( const char *symbol ) -{ - enum_elt * f = NULL; - - if ( symbol != NULL ) { - f = (enum_elt *) _mesa_bsearch(symbol, all_enums, - Elements(all_enums), - sizeof( enum_elt ), - (cfunc) compar_name); - } - - return (f != NULL) ? f->n : -1; -} - - +/* DO NOT EDIT - This file generated automatically by gl_enums.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "main/glheader.h" +#include "main/mfeatures.h" +#include "main/enums.h" +#include "main/imports.h" +#include "main/mtypes.h" + +typedef struct { + size_t offset; + int n; +} enum_elt; + +LONGSTRING static const char enum_string_table[] = + "GL_2D\0" + "GL_2_BYTES\0" + "GL_3D\0" + "GL_3D_COLOR\0" + "GL_3D_COLOR_TEXTURE\0" + "GL_3_BYTES\0" + "GL_4D_COLOR_TEXTURE\0" + "GL_4_BYTES\0" + "GL_ACCUM\0" + "GL_ACCUM_ALPHA_BITS\0" + "GL_ACCUM_BLUE_BITS\0" + "GL_ACCUM_BUFFER_BIT\0" + "GL_ACCUM_CLEAR_VALUE\0" + "GL_ACCUM_GREEN_BITS\0" + "GL_ACCUM_RED_BITS\0" + "GL_ACTIVE_ATTRIBUTES\0" + "GL_ACTIVE_ATTRIBUTE_MAX_LENGTH\0" + "GL_ACTIVE_PROGRAM_EXT\0" + "GL_ACTIVE_STENCIL_FACE_EXT\0" + "GL_ACTIVE_TEXTURE\0" + "GL_ACTIVE_TEXTURE_ARB\0" + "GL_ACTIVE_UNIFORMS\0" + "GL_ACTIVE_UNIFORM_MAX_LENGTH\0" + "GL_ACTIVE_VERTEX_UNITS_ARB\0" + "GL_ADD\0" + "GL_ADD_SIGNED\0" + "GL_ADD_SIGNED_ARB\0" + "GL_ADD_SIGNED_EXT\0" + "GL_ALIASED_LINE_WIDTH_RANGE\0" + "GL_ALIASED_POINT_SIZE_RANGE\0" + "GL_ALL_ATTRIB_BITS\0" + "GL_ALL_CLIENT_ATTRIB_BITS\0" + "GL_ALPHA\0" + "GL_ALPHA12\0" + "GL_ALPHA12_EXT\0" + "GL_ALPHA16\0" + "GL_ALPHA16I_EXT\0" + "GL_ALPHA16UI_EXT\0" + "GL_ALPHA16_EXT\0" + "GL_ALPHA32I_EXT\0" + "GL_ALPHA32UI_EXT\0" + "GL_ALPHA4\0" + "GL_ALPHA4_EXT\0" + "GL_ALPHA8\0" + "GL_ALPHA8I_EXT\0" + "GL_ALPHA8UI_EXT\0" + "GL_ALPHA8_EXT\0" + "GL_ALPHA_BIAS\0" + "GL_ALPHA_BITS\0" + "GL_ALPHA_INTEGER_EXT\0" + "GL_ALPHA_SCALE\0" + "GL_ALPHA_TEST\0" + "GL_ALPHA_TEST_FUNC\0" + "GL_ALPHA_TEST_REF\0" + "GL_ALREADY_SIGNALED\0" + "GL_ALWAYS\0" + "GL_AMBIENT\0" + "GL_AMBIENT_AND_DIFFUSE\0" + "GL_AND\0" + "GL_AND_INVERTED\0" + "GL_AND_REVERSE\0" + "GL_ARRAY_BUFFER\0" + "GL_ARRAY_BUFFER_BINDING\0" + "GL_ARRAY_BUFFER_BINDING_ARB\0" + "GL_ATTACHED_SHADERS\0" + "GL_ATTRIB_ARRAY_POINTER_NV\0" + "GL_ATTRIB_ARRAY_SIZE_NV\0" + "GL_ATTRIB_ARRAY_STRIDE_NV\0" + "GL_ATTRIB_ARRAY_TYPE_NV\0" + "GL_ATTRIB_STACK_DEPTH\0" + "GL_AUTO_NORMAL\0" + "GL_AUX0\0" + "GL_AUX1\0" + "GL_AUX2\0" + "GL_AUX3\0" + "GL_AUX_BUFFERS\0" + "GL_BACK\0" + "GL_BACK_LEFT\0" + "GL_BACK_RIGHT\0" + "GL_BGR\0" + "GL_BGRA\0" + "GL_BGRA_EXT\0" + "GL_BGRA_INTEGER\0" + "GL_BGRA_INTEGER_EXT\0" + "GL_BGR_INTEGER\0" + "GL_BGR_INTEGER_EXT\0" + "GL_BITMAP\0" + "GL_BITMAP_TOKEN\0" + "GL_BLEND\0" + "GL_BLEND_COLOR\0" + "GL_BLEND_COLOR_EXT\0" + "GL_BLEND_DST\0" + "GL_BLEND_DST_ALPHA\0" + "GL_BLEND_DST_ALPHA_OES\0" + "GL_BLEND_DST_RGB\0" + "GL_BLEND_DST_RGB_OES\0" + "GL_BLEND_EQUATION\0" + "GL_BLEND_EQUATION_ALPHA\0" + "GL_BLEND_EQUATION_ALPHA_EXT\0" + "GL_BLEND_EQUATION_ALPHA_OES\0" + "GL_BLEND_EQUATION_EXT\0" + "GL_BLEND_EQUATION_OES\0" + "GL_BLEND_EQUATION_RGB\0" + "GL_BLEND_EQUATION_RGB_EXT\0" + "GL_BLEND_EQUATION_RGB_OES\0" + "GL_BLEND_SRC\0" + "GL_BLEND_SRC_ALPHA\0" + "GL_BLEND_SRC_ALPHA_OES\0" + "GL_BLEND_SRC_RGB\0" + "GL_BLEND_SRC_RGB_OES\0" + "GL_BLUE\0" + "GL_BLUE_BIAS\0" + "GL_BLUE_BITS\0" + "GL_BLUE_INTEGER\0" + "GL_BLUE_INTEGER_EXT\0" + "GL_BLUE_SCALE\0" + "GL_BOOL\0" + "GL_BOOL_ARB\0" + "GL_BOOL_VEC2\0" + "GL_BOOL_VEC2_ARB\0" + "GL_BOOL_VEC3\0" + "GL_BOOL_VEC3_ARB\0" + "GL_BOOL_VEC4\0" + "GL_BOOL_VEC4_ARB\0" + "GL_BUFFER_ACCESS\0" + "GL_BUFFER_ACCESS_ARB\0" + "GL_BUFFER_ACCESS_FLAGS\0" + "GL_BUFFER_ACCESS_OES\0" + "GL_BUFFER_FLUSHING_UNMAP_APPLE\0" + "GL_BUFFER_MAPPED\0" + "GL_BUFFER_MAPPED_ARB\0" + "GL_BUFFER_MAPPED_OES\0" + "GL_BUFFER_MAP_LENGTH\0" + "GL_BUFFER_MAP_OFFSET\0" + "GL_BUFFER_MAP_POINTER\0" + "GL_BUFFER_MAP_POINTER_ARB\0" + "GL_BUFFER_MAP_POINTER_OES\0" + "GL_BUFFER_OBJECT_APPLE\0" + "GL_BUFFER_SERIALIZED_MODIFY_APPLE\0" + "GL_BUFFER_SIZE\0" + "GL_BUFFER_SIZE_ARB\0" + "GL_BUFFER_USAGE\0" + "GL_BUFFER_USAGE_ARB\0" + "GL_BUMP_ENVMAP_ATI\0" + "GL_BUMP_NUM_TEX_UNITS_ATI\0" + "GL_BUMP_ROT_MATRIX_ATI\0" + "GL_BUMP_ROT_MATRIX_SIZE_ATI\0" + "GL_BUMP_TARGET_ATI\0" + "GL_BUMP_TEX_UNITS_ATI\0" + "GL_BYTE\0" + "GL_C3F_V3F\0" + "GL_C4F_N3F_V3F\0" + "GL_C4UB_V2F\0" + "GL_C4UB_V3F\0" + "GL_CCW\0" + "GL_CLAMP\0" + "GL_CLAMP_READ_COLOR\0" + "GL_CLAMP_TO_BORDER\0" + "GL_CLAMP_TO_BORDER_ARB\0" + "GL_CLAMP_TO_BORDER_SGIS\0" + "GL_CLAMP_TO_EDGE\0" + "GL_CLAMP_TO_EDGE_SGIS\0" + "GL_CLEAR\0" + "GL_CLIENT_ACTIVE_TEXTURE\0" + "GL_CLIENT_ACTIVE_TEXTURE_ARB\0" + "GL_CLIENT_ALL_ATTRIB_BITS\0" + "GL_CLIENT_ATTRIB_STACK_DEPTH\0" + "GL_CLIENT_PIXEL_STORE_BIT\0" + "GL_CLIENT_VERTEX_ARRAY_BIT\0" + "GL_CLIP_DISTANCE0\0" + "GL_CLIP_DISTANCE1\0" + "GL_CLIP_DISTANCE2\0" + "GL_CLIP_DISTANCE3\0" + "GL_CLIP_DISTANCE4\0" + "GL_CLIP_DISTANCE5\0" + "GL_CLIP_DISTANCE6\0" + "GL_CLIP_DISTANCE7\0" + "GL_CLIP_PLANE0\0" + "GL_CLIP_PLANE1\0" + "GL_CLIP_PLANE2\0" + "GL_CLIP_PLANE3\0" + "GL_CLIP_PLANE4\0" + "GL_CLIP_PLANE5\0" + "GL_CLIP_VOLUME_CLIPPING_HINT_EXT\0" + "GL_COEFF\0" + "GL_COLOR\0" + "GL_COLOR_ARRAY\0" + "GL_COLOR_ARRAY_BUFFER_BINDING\0" + "GL_COLOR_ARRAY_BUFFER_BINDING_ARB\0" + "GL_COLOR_ARRAY_POINTER\0" + "GL_COLOR_ARRAY_SIZE\0" + "GL_COLOR_ARRAY_STRIDE\0" + "GL_COLOR_ARRAY_TYPE\0" + "GL_COLOR_ATTACHMENT0\0" + "GL_COLOR_ATTACHMENT0_EXT\0" + "GL_COLOR_ATTACHMENT0_OES\0" + "GL_COLOR_ATTACHMENT1\0" + "GL_COLOR_ATTACHMENT10\0" + "GL_COLOR_ATTACHMENT10_EXT\0" + "GL_COLOR_ATTACHMENT11\0" + "GL_COLOR_ATTACHMENT11_EXT\0" + "GL_COLOR_ATTACHMENT12\0" + "GL_COLOR_ATTACHMENT12_EXT\0" + "GL_COLOR_ATTACHMENT13\0" + "GL_COLOR_ATTACHMENT13_EXT\0" + "GL_COLOR_ATTACHMENT14\0" + "GL_COLOR_ATTACHMENT14_EXT\0" + "GL_COLOR_ATTACHMENT15\0" + "GL_COLOR_ATTACHMENT15_EXT\0" + "GL_COLOR_ATTACHMENT1_EXT\0" + "GL_COLOR_ATTACHMENT2\0" + "GL_COLOR_ATTACHMENT2_EXT\0" + "GL_COLOR_ATTACHMENT3\0" + "GL_COLOR_ATTACHMENT3_EXT\0" + "GL_COLOR_ATTACHMENT4\0" + "GL_COLOR_ATTACHMENT4_EXT\0" + "GL_COLOR_ATTACHMENT5\0" + "GL_COLOR_ATTACHMENT5_EXT\0" + "GL_COLOR_ATTACHMENT6\0" + "GL_COLOR_ATTACHMENT6_EXT\0" + "GL_COLOR_ATTACHMENT7\0" + "GL_COLOR_ATTACHMENT7_EXT\0" + "GL_COLOR_ATTACHMENT8\0" + "GL_COLOR_ATTACHMENT8_EXT\0" + "GL_COLOR_ATTACHMENT9\0" + "GL_COLOR_ATTACHMENT9_EXT\0" + "GL_COLOR_BUFFER_BIT\0" + "GL_COLOR_CLEAR_VALUE\0" + "GL_COLOR_INDEX\0" + "GL_COLOR_INDEXES\0" + "GL_COLOR_LOGIC_OP\0" + "GL_COLOR_MATERIAL\0" + "GL_COLOR_MATERIAL_FACE\0" + "GL_COLOR_MATERIAL_PARAMETER\0" + "GL_COLOR_MATRIX\0" + "GL_COLOR_MATRIX_SGI\0" + "GL_COLOR_MATRIX_STACK_DEPTH\0" + "GL_COLOR_MATRIX_STACK_DEPTH_SGI\0" + "GL_COLOR_SUM\0" + "GL_COLOR_SUM_ARB\0" + "GL_COLOR_TABLE\0" + "GL_COLOR_TABLE_ALPHA_SIZE\0" + "GL_COLOR_TABLE_ALPHA_SIZE_EXT\0" + "GL_COLOR_TABLE_ALPHA_SIZE_SGI\0" + "GL_COLOR_TABLE_BIAS\0" + "GL_COLOR_TABLE_BIAS_SGI\0" + "GL_COLOR_TABLE_BLUE_SIZE\0" + "GL_COLOR_TABLE_BLUE_SIZE_EXT\0" + "GL_COLOR_TABLE_BLUE_SIZE_SGI\0" + "GL_COLOR_TABLE_FORMAT\0" + "GL_COLOR_TABLE_FORMAT_EXT\0" + "GL_COLOR_TABLE_FORMAT_SGI\0" + "GL_COLOR_TABLE_GREEN_SIZE\0" + "GL_COLOR_TABLE_GREEN_SIZE_EXT\0" + "GL_COLOR_TABLE_GREEN_SIZE_SGI\0" + "GL_COLOR_TABLE_INTENSITY_SIZE\0" + "GL_COLOR_TABLE_INTENSITY_SIZE_EXT\0" + "GL_COLOR_TABLE_INTENSITY_SIZE_SGI\0" + "GL_COLOR_TABLE_LUMINANCE_SIZE\0" + "GL_COLOR_TABLE_LUMINANCE_SIZE_EXT\0" + "GL_COLOR_TABLE_LUMINANCE_SIZE_SGI\0" + "GL_COLOR_TABLE_RED_SIZE\0" + "GL_COLOR_TABLE_RED_SIZE_EXT\0" + "GL_COLOR_TABLE_RED_SIZE_SGI\0" + "GL_COLOR_TABLE_SCALE\0" + "GL_COLOR_TABLE_SCALE_SGI\0" + "GL_COLOR_TABLE_WIDTH\0" + "GL_COLOR_TABLE_WIDTH_EXT\0" + "GL_COLOR_TABLE_WIDTH_SGI\0" + "GL_COLOR_WRITEMASK\0" + "GL_COMBINE\0" + "GL_COMBINE4\0" + "GL_COMBINE_ALPHA\0" + "GL_COMBINE_ALPHA_ARB\0" + "GL_COMBINE_ALPHA_EXT\0" + "GL_COMBINE_ARB\0" + "GL_COMBINE_EXT\0" + "GL_COMBINE_RGB\0" + "GL_COMBINE_RGB_ARB\0" + "GL_COMBINE_RGB_EXT\0" + "GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT\0" + "GL_COMPARE_REF_TO_TEXTURE\0" + "GL_COMPARE_R_TO_TEXTURE\0" + "GL_COMPARE_R_TO_TEXTURE_ARB\0" + "GL_COMPILE\0" + "GL_COMPILE_AND_EXECUTE\0" + "GL_COMPILE_STATUS\0" + "GL_COMPRESSED_ALPHA\0" + "GL_COMPRESSED_ALPHA_ARB\0" + "GL_COMPRESSED_INTENSITY\0" + "GL_COMPRESSED_INTENSITY_ARB\0" + "GL_COMPRESSED_LUMINANCE\0" + "GL_COMPRESSED_LUMINANCE_ALPHA\0" + "GL_COMPRESSED_LUMINANCE_ALPHA_ARB\0" + "GL_COMPRESSED_LUMINANCE_ARB\0" + "GL_COMPRESSED_RED\0" + "GL_COMPRESSED_RG\0" + "GL_COMPRESSED_RGB\0" + "GL_COMPRESSED_RGBA\0" + "GL_COMPRESSED_RGBA_ARB\0" + "GL_COMPRESSED_RGBA_FXT1_3DFX\0" + "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT\0" + "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT\0" + "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT\0" + "GL_COMPRESSED_RGB_ARB\0" + "GL_COMPRESSED_RGB_FXT1_3DFX\0" + "GL_COMPRESSED_RGB_S3TC_DXT1_EXT\0" + "GL_COMPRESSED_SLUMINANCE\0" + "GL_COMPRESSED_SLUMINANCE_ALPHA\0" + "GL_COMPRESSED_SRGB\0" + "GL_COMPRESSED_SRGB_ALPHA\0" + "GL_COMPRESSED_TEXTURE_FORMATS\0" + "GL_CONDITION_SATISFIED\0" + "GL_CONSTANT\0" + "GL_CONSTANT_ALPHA\0" + "GL_CONSTANT_ALPHA_EXT\0" + "GL_CONSTANT_ARB\0" + "GL_CONSTANT_ATTENUATION\0" + "GL_CONSTANT_BORDER_HP\0" + "GL_CONSTANT_COLOR\0" + "GL_CONSTANT_COLOR_EXT\0" + "GL_CONSTANT_EXT\0" + "GL_CONTEXT_COMPATIBILITY_PROFILE_BIT\0" + "GL_CONTEXT_CORE_PROFILE_BIT\0" + "GL_CONTEXT_FLAGS\0" + "GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT\0" + "GL_CONTEXT_PROFILE_MASK\0" + "GL_CONVOLUTION_1D\0" + "GL_CONVOLUTION_2D\0" + "GL_CONVOLUTION_BORDER_COLOR\0" + "GL_CONVOLUTION_BORDER_COLOR_HP\0" + "GL_CONVOLUTION_BORDER_MODE\0" + "GL_CONVOLUTION_BORDER_MODE_EXT\0" + "GL_CONVOLUTION_FILTER_BIAS\0" + "GL_CONVOLUTION_FILTER_BIAS_EXT\0" + "GL_CONVOLUTION_FILTER_SCALE\0" + "GL_CONVOLUTION_FILTER_SCALE_EXT\0" + "GL_CONVOLUTION_FORMAT\0" + "GL_CONVOLUTION_FORMAT_EXT\0" + "GL_CONVOLUTION_HEIGHT\0" + "GL_CONVOLUTION_HEIGHT_EXT\0" + "GL_CONVOLUTION_WIDTH\0" + "GL_CONVOLUTION_WIDTH_EXT\0" + "GL_COORD_REPLACE\0" + "GL_COORD_REPLACE_ARB\0" + "GL_COORD_REPLACE_NV\0" + "GL_COORD_REPLACE_OES\0" + "GL_COPY\0" + "GL_COPY_INVERTED\0" + "GL_COPY_PIXEL_TOKEN\0" + "GL_COPY_READ_BUFFER\0" + "GL_COPY_WRITE_BUFFER\0" + "GL_CULL_FACE\0" + "GL_CULL_FACE_MODE\0" + "GL_CULL_VERTEX_EXT\0" + "GL_CULL_VERTEX_EYE_POSITION_EXT\0" + "GL_CULL_VERTEX_OBJECT_POSITION_EXT\0" + "GL_CURRENT_ATTRIB_NV\0" + "GL_CURRENT_BIT\0" + "GL_CURRENT_COLOR\0" + "GL_CURRENT_FOG_COORD\0" + "GL_CURRENT_FOG_COORDINATE\0" + "GL_CURRENT_INDEX\0" + "GL_CURRENT_MATRIX_ARB\0" + "GL_CURRENT_MATRIX_INDEX_ARB\0" + "GL_CURRENT_MATRIX_NV\0" + "GL_CURRENT_MATRIX_STACK_DEPTH_ARB\0" + "GL_CURRENT_MATRIX_STACK_DEPTH_NV\0" + "GL_CURRENT_NORMAL\0" + "GL_CURRENT_PALETTE_MATRIX_ARB\0" + "GL_CURRENT_PALETTE_MATRIX_OES\0" + "GL_CURRENT_PROGRAM\0" + "GL_CURRENT_QUERY\0" + "GL_CURRENT_QUERY_ARB\0" + "GL_CURRENT_RASTER_COLOR\0" + "GL_CURRENT_RASTER_DISTANCE\0" + "GL_CURRENT_RASTER_INDEX\0" + "GL_CURRENT_RASTER_POSITION\0" + "GL_CURRENT_RASTER_POSITION_VALID\0" + "GL_CURRENT_RASTER_SECONDARY_COLOR\0" + "GL_CURRENT_RASTER_TEXTURE_COORDS\0" + "GL_CURRENT_SECONDARY_COLOR\0" + "GL_CURRENT_TEXTURE_COORDS\0" + "GL_CURRENT_VERTEX_ATTRIB\0" + "GL_CURRENT_VERTEX_ATTRIB_ARB\0" + "GL_CURRENT_WEIGHT_ARB\0" + "GL_CW\0" + "GL_DEBUG_ASSERT_MESA\0" + "GL_DEBUG_OBJECT_MESA\0" + "GL_DEBUG_PRINT_MESA\0" + "GL_DECAL\0" + "GL_DECR\0" + "GL_DECR_WRAP\0" + "GL_DECR_WRAP_EXT\0" + "GL_DELETE_STATUS\0" + "GL_DEPTH\0" + "GL_DEPTH24_STENCIL8\0" + "GL_DEPTH24_STENCIL8_EXT\0" + "GL_DEPTH24_STENCIL8_OES\0" + "GL_DEPTH_ATTACHMENT\0" + "GL_DEPTH_ATTACHMENT_EXT\0" + "GL_DEPTH_ATTACHMENT_OES\0" + "GL_DEPTH_BIAS\0" + "GL_DEPTH_BITS\0" + "GL_DEPTH_BOUNDS_EXT\0" + "GL_DEPTH_BOUNDS_TEST_EXT\0" + "GL_DEPTH_BUFFER\0" + "GL_DEPTH_BUFFER_BIT\0" + "GL_DEPTH_CLAMP\0" + "GL_DEPTH_CLAMP_NV\0" + "GL_DEPTH_CLEAR_VALUE\0" + "GL_DEPTH_COMPONENT\0" + "GL_DEPTH_COMPONENT16\0" + "GL_DEPTH_COMPONENT16_ARB\0" + "GL_DEPTH_COMPONENT16_OES\0" + "GL_DEPTH_COMPONENT16_SGIX\0" + "GL_DEPTH_COMPONENT24\0" + "GL_DEPTH_COMPONENT24_ARB\0" + "GL_DEPTH_COMPONENT24_OES\0" + "GL_DEPTH_COMPONENT24_SGIX\0" + "GL_DEPTH_COMPONENT32\0" + "GL_DEPTH_COMPONENT32_ARB\0" + "GL_DEPTH_COMPONENT32_OES\0" + "GL_DEPTH_COMPONENT32_SGIX\0" + "GL_DEPTH_FUNC\0" + "GL_DEPTH_RANGE\0" + "GL_DEPTH_SCALE\0" + "GL_DEPTH_STENCIL\0" + "GL_DEPTH_STENCIL_ATTACHMENT\0" + "GL_DEPTH_STENCIL_EXT\0" + "GL_DEPTH_STENCIL_NV\0" + "GL_DEPTH_STENCIL_OES\0" + "GL_DEPTH_STENCIL_TO_BGRA_NV\0" + "GL_DEPTH_STENCIL_TO_RGBA_NV\0" + "GL_DEPTH_TEST\0" + "GL_DEPTH_TEXTURE_MODE\0" + "GL_DEPTH_TEXTURE_MODE_ARB\0" + "GL_DEPTH_WRITEMASK\0" + "GL_DIFFUSE\0" + "GL_DITHER\0" + "GL_DOMAIN\0" + "GL_DONT_CARE\0" + "GL_DOT3_RGB\0" + "GL_DOT3_RGBA\0" + "GL_DOT3_RGBA_ARB\0" + "GL_DOT3_RGBA_EXT\0" + "GL_DOT3_RGB_ARB\0" + "GL_DOT3_RGB_EXT\0" + "GL_DOUBLE\0" + "GL_DOUBLEBUFFER\0" + "GL_DRAW_BUFFER\0" + "GL_DRAW_BUFFER0\0" + "GL_DRAW_BUFFER0_ARB\0" + "GL_DRAW_BUFFER0_ATI\0" + "GL_DRAW_BUFFER1\0" + "GL_DRAW_BUFFER10\0" + "GL_DRAW_BUFFER10_ARB\0" + "GL_DRAW_BUFFER10_ATI\0" + "GL_DRAW_BUFFER11\0" + "GL_DRAW_BUFFER11_ARB\0" + "GL_DRAW_BUFFER11_ATI\0" + "GL_DRAW_BUFFER12\0" + "GL_DRAW_BUFFER12_ARB\0" + "GL_DRAW_BUFFER12_ATI\0" + "GL_DRAW_BUFFER13\0" + "GL_DRAW_BUFFER13_ARB\0" + "GL_DRAW_BUFFER13_ATI\0" + "GL_DRAW_BUFFER14\0" + "GL_DRAW_BUFFER14_ARB\0" + "GL_DRAW_BUFFER14_ATI\0" + "GL_DRAW_BUFFER15\0" + "GL_DRAW_BUFFER15_ARB\0" + "GL_DRAW_BUFFER15_ATI\0" + "GL_DRAW_BUFFER1_ARB\0" + "GL_DRAW_BUFFER1_ATI\0" + "GL_DRAW_BUFFER2\0" + "GL_DRAW_BUFFER2_ARB\0" + "GL_DRAW_BUFFER2_ATI\0" + "GL_DRAW_BUFFER3\0" + "GL_DRAW_BUFFER3_ARB\0" + "GL_DRAW_BUFFER3_ATI\0" + "GL_DRAW_BUFFER4\0" + "GL_DRAW_BUFFER4_ARB\0" + "GL_DRAW_BUFFER4_ATI\0" + "GL_DRAW_BUFFER5\0" + "GL_DRAW_BUFFER5_ARB\0" + "GL_DRAW_BUFFER5_ATI\0" + "GL_DRAW_BUFFER6\0" + "GL_DRAW_BUFFER6_ARB\0" + "GL_DRAW_BUFFER6_ATI\0" + "GL_DRAW_BUFFER7\0" + "GL_DRAW_BUFFER7_ARB\0" + "GL_DRAW_BUFFER7_ATI\0" + "GL_DRAW_BUFFER8\0" + "GL_DRAW_BUFFER8_ARB\0" + "GL_DRAW_BUFFER8_ATI\0" + "GL_DRAW_BUFFER9\0" + "GL_DRAW_BUFFER9_ARB\0" + "GL_DRAW_BUFFER9_ATI\0" + "GL_DRAW_FRAMEBUFFER\0" + "GL_DRAW_FRAMEBUFFER_BINDING\0" + "GL_DRAW_FRAMEBUFFER_BINDING_EXT\0" + "GL_DRAW_FRAMEBUFFER_EXT\0" + "GL_DRAW_PIXEL_TOKEN\0" + "GL_DST_ALPHA\0" + "GL_DST_COLOR\0" + "GL_DU8DV8_ATI\0" + "GL_DUDV_ATI\0" + "GL_DYNAMIC_COPY\0" + "GL_DYNAMIC_COPY_ARB\0" + "GL_DYNAMIC_DRAW\0" + "GL_DYNAMIC_DRAW_ARB\0" + "GL_DYNAMIC_READ\0" + "GL_DYNAMIC_READ_ARB\0" + "GL_EDGE_FLAG\0" + "GL_EDGE_FLAG_ARRAY\0" + "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING\0" + "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB\0" + "GL_EDGE_FLAG_ARRAY_POINTER\0" + "GL_EDGE_FLAG_ARRAY_STRIDE\0" + "GL_ELEMENT_ARRAY_BUFFER\0" + "GL_ELEMENT_ARRAY_BUFFER_BINDING\0" + "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB\0" + "GL_EMISSION\0" + "GL_ENABLE_BIT\0" + "GL_EQUAL\0" + "GL_EQUIV\0" + "GL_EVAL_BIT\0" + "GL_EXP\0" + "GL_EXP2\0" + "GL_EXTENSIONS\0" + "GL_EYE_LINEAR\0" + "GL_EYE_PLANE\0" + "GL_EYE_PLANE_ABSOLUTE_NV\0" + "GL_EYE_RADIAL_NV\0" + "GL_FALSE\0" + "GL_FASTEST\0" + "GL_FEEDBACK\0" + "GL_FEEDBACK_BUFFER_POINTER\0" + "GL_FEEDBACK_BUFFER_SIZE\0" + "GL_FEEDBACK_BUFFER_TYPE\0" + "GL_FILL\0" + "GL_FIRST_VERTEX_CONVENTION\0" + "GL_FIRST_VERTEX_CONVENTION_EXT\0" + "GL_FIXED\0" + "GL_FIXED_OES\0" + "GL_FIXED_ONLY\0" + "GL_FLAT\0" + "GL_FLOAT\0" + "GL_FLOAT_MAT2\0" + "GL_FLOAT_MAT2_ARB\0" + "GL_FLOAT_MAT2x3\0" + "GL_FLOAT_MAT2x4\0" + "GL_FLOAT_MAT3\0" + "GL_FLOAT_MAT3_ARB\0" + "GL_FLOAT_MAT3x2\0" + "GL_FLOAT_MAT3x4\0" + "GL_FLOAT_MAT4\0" + "GL_FLOAT_MAT4_ARB\0" + "GL_FLOAT_MAT4x2\0" + "GL_FLOAT_MAT4x3\0" + "GL_FLOAT_VEC2\0" + "GL_FLOAT_VEC2_ARB\0" + "GL_FLOAT_VEC3\0" + "GL_FLOAT_VEC3_ARB\0" + "GL_FLOAT_VEC4\0" + "GL_FLOAT_VEC4_ARB\0" + "GL_FOG\0" + "GL_FOG_BIT\0" + "GL_FOG_COLOR\0" + "GL_FOG_COORD\0" + "GL_FOG_COORDINATE\0" + "GL_FOG_COORDINATE_ARRAY\0" + "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING\0" + "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB\0" + "GL_FOG_COORDINATE_ARRAY_POINTER\0" + "GL_FOG_COORDINATE_ARRAY_STRIDE\0" + "GL_FOG_COORDINATE_ARRAY_TYPE\0" + "GL_FOG_COORDINATE_SOURCE\0" + "GL_FOG_COORD_ARRAY\0" + "GL_FOG_COORD_ARRAY_BUFFER_BINDING\0" + "GL_FOG_COORD_ARRAY_POINTER\0" + "GL_FOG_COORD_ARRAY_STRIDE\0" + "GL_FOG_COORD_ARRAY_TYPE\0" + "GL_FOG_COORD_SRC\0" + "GL_FOG_DENSITY\0" + "GL_FOG_DISTANCE_MODE_NV\0" + "GL_FOG_END\0" + "GL_FOG_HINT\0" + "GL_FOG_INDEX\0" + "GL_FOG_MODE\0" + "GL_FOG_OFFSET_SGIX\0" + "GL_FOG_OFFSET_VALUE_SGIX\0" + "GL_FOG_START\0" + "GL_FRAGMENT_DEPTH\0" + "GL_FRAGMENT_PROGRAM_ARB\0" + "GL_FRAGMENT_SHADER\0" + "GL_FRAGMENT_SHADER_ARB\0" + "GL_FRAGMENT_SHADER_DERIVATIVE_HINT\0" + "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES\0" + "GL_FRAMEBUFFER\0" + "GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE\0" + "GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE\0" + "GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING\0" + "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE\0" + "GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE\0" + "GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE\0" + "GL_FRAMEBUFFER_ATTACHMENT_LAYERED\0" + "GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES\0" + "GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE\0" + "GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES\0" + "GL_FRAMEBUFFER_BINDING\0" + "GL_FRAMEBUFFER_BINDING_EXT\0" + "GL_FRAMEBUFFER_BINDING_OES\0" + "GL_FRAMEBUFFER_COMPLETE\0" + "GL_FRAMEBUFFER_COMPLETE_EXT\0" + "GL_FRAMEBUFFER_COMPLETE_OES\0" + "GL_FRAMEBUFFER_DEFAULT\0" + "GL_FRAMEBUFFER_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\0" + "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES\0" + "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS\0" + "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES\0" + "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\0" + "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES\0" + "GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES\0" + "GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB\0" + "GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS\0" + "GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB\0" + "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\0" + "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES\0" + "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\0" + "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\0" + "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES\0" + "GL_FRAMEBUFFER_OES\0" + "GL_FRAMEBUFFER_STATUS_ERROR_EXT\0" + "GL_FRAMEBUFFER_UNDEFINED\0" + "GL_FRAMEBUFFER_UNSUPPORTED\0" + "GL_FRAMEBUFFER_UNSUPPORTED_EXT\0" + "GL_FRAMEBUFFER_UNSUPPORTED_OES\0" + "GL_FRONT\0" + "GL_FRONT_AND_BACK\0" + "GL_FRONT_FACE\0" + "GL_FRONT_LEFT\0" + "GL_FRONT_RIGHT\0" + "GL_FUNC_ADD\0" + "GL_FUNC_ADD_EXT\0" + "GL_FUNC_ADD_OES\0" + "GL_FUNC_REVERSE_SUBTRACT\0" + "GL_FUNC_REVERSE_SUBTRACT_EXT\0" + "GL_FUNC_REVERSE_SUBTRACT_OES\0" + "GL_FUNC_SUBTRACT\0" + "GL_FUNC_SUBTRACT_EXT\0" + "GL_FUNC_SUBTRACT_OES\0" + "GL_GENERATE_MIPMAP\0" + "GL_GENERATE_MIPMAP_HINT\0" + "GL_GENERATE_MIPMAP_HINT_SGIS\0" + "GL_GENERATE_MIPMAP_SGIS\0" + "GL_GEOMETRY_INPUT_TYPE\0" + "GL_GEOMETRY_INPUT_TYPE_ARB\0" + "GL_GEOMETRY_OUTPUT_TYPE\0" + "GL_GEOMETRY_OUTPUT_TYPE_ARB\0" + "GL_GEOMETRY_SHADER\0" + "GL_GEOMETRY_SHADER_ARB\0" + "GL_GEOMETRY_VERTICES_OUT\0" + "GL_GEOMETRY_VERTICES_OUT_ARB\0" + "GL_GEQUAL\0" + "GL_GREATER\0" + "GL_GREEN\0" + "GL_GREEN_BIAS\0" + "GL_GREEN_BITS\0" + "GL_GREEN_INTEGER\0" + "GL_GREEN_INTEGER_EXT\0" + "GL_GREEN_SCALE\0" + "GL_HALF_FLOAT\0" + "GL_HALF_FLOAT_OES\0" + "GL_HIGH_FLOAT\0" + "GL_HIGH_INT\0" + "GL_HINT_BIT\0" + "GL_HISTOGRAM\0" + "GL_HISTOGRAM_ALPHA_SIZE\0" + "GL_HISTOGRAM_ALPHA_SIZE_EXT\0" + "GL_HISTOGRAM_BLUE_SIZE\0" + "GL_HISTOGRAM_BLUE_SIZE_EXT\0" + "GL_HISTOGRAM_EXT\0" + "GL_HISTOGRAM_FORMAT\0" + "GL_HISTOGRAM_FORMAT_EXT\0" + "GL_HISTOGRAM_GREEN_SIZE\0" + "GL_HISTOGRAM_GREEN_SIZE_EXT\0" + "GL_HISTOGRAM_LUMINANCE_SIZE\0" + "GL_HISTOGRAM_LUMINANCE_SIZE_EXT\0" + "GL_HISTOGRAM_RED_SIZE\0" + "GL_HISTOGRAM_RED_SIZE_EXT\0" + "GL_HISTOGRAM_SINK\0" + "GL_HISTOGRAM_SINK_EXT\0" + "GL_HISTOGRAM_WIDTH\0" + "GL_HISTOGRAM_WIDTH_EXT\0" + "GL_IDENTITY_NV\0" + "GL_IGNORE_BORDER_HP\0" + "GL_IMPLEMENTATION_COLOR_READ_FORMAT\0" + "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES\0" + "GL_IMPLEMENTATION_COLOR_READ_TYPE\0" + "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES\0" + "GL_INCR\0" + "GL_INCR_WRAP\0" + "GL_INCR_WRAP_EXT\0" + "GL_INDEX\0" + "GL_INDEX_ARRAY\0" + "GL_INDEX_ARRAY_BUFFER_BINDING\0" + "GL_INDEX_ARRAY_BUFFER_BINDING_ARB\0" + "GL_INDEX_ARRAY_POINTER\0" + "GL_INDEX_ARRAY_STRIDE\0" + "GL_INDEX_ARRAY_TYPE\0" + "GL_INDEX_BITS\0" + "GL_INDEX_CLEAR_VALUE\0" + "GL_INDEX_LOGIC_OP\0" + "GL_INDEX_MODE\0" + "GL_INDEX_OFFSET\0" + "GL_INDEX_SHIFT\0" + "GL_INDEX_WRITEMASK\0" + "GL_INFO_LOG_LENGTH\0" + "GL_INT\0" + "GL_INTENSITY\0" + "GL_INTENSITY12\0" + "GL_INTENSITY12_EXT\0" + "GL_INTENSITY16\0" + "GL_INTENSITY16I_EXT\0" + "GL_INTENSITY16UI_EXT\0" + "GL_INTENSITY16_EXT\0" + "GL_INTENSITY32I_EXT\0" + "GL_INTENSITY32UI_EXT\0" + "GL_INTENSITY4\0" + "GL_INTENSITY4_EXT\0" + "GL_INTENSITY8\0" + "GL_INTENSITY8I_EXT\0" + "GL_INTENSITY8UI_EXT\0" + "GL_INTENSITY8_EXT\0" + "GL_INTENSITY_EXT\0" + "GL_INTERLEAVED_ATTRIBS\0" + "GL_INTERLEAVED_ATTRIBS_EXT\0" + "GL_INTERPOLATE\0" + "GL_INTERPOLATE_ARB\0" + "GL_INTERPOLATE_EXT\0" + "GL_INT_10_10_10_2_OES\0" + "GL_INT_SAMPLER_1D\0" + "GL_INT_SAMPLER_1D_ARRAY\0" + "GL_INT_SAMPLER_1D_ARRAY_EXT\0" + "GL_INT_SAMPLER_1D_EXT\0" + "GL_INT_SAMPLER_2D\0" + "GL_INT_SAMPLER_2D_ARRAY\0" + "GL_INT_SAMPLER_2D_ARRAY_EXT\0" + "GL_INT_SAMPLER_2D_EXT\0" + "GL_INT_SAMPLER_2D_RECT\0" + "GL_INT_SAMPLER_2D_RECT_EXT\0" + "GL_INT_SAMPLER_3D\0" + "GL_INT_SAMPLER_3D_EXT\0" + "GL_INT_SAMPLER_BUFFER\0" + "GL_INT_SAMPLER_BUFFER_EXT\0" + "GL_INT_SAMPLER_CUBE\0" + "GL_INT_SAMPLER_CUBE_EXT\0" + "GL_INT_VEC2\0" + "GL_INT_VEC2_ARB\0" + "GL_INT_VEC3\0" + "GL_INT_VEC3_ARB\0" + "GL_INT_VEC4\0" + "GL_INT_VEC4_ARB\0" + "GL_INVALID_ENUM\0" + "GL_INVALID_FRAMEBUFFER_OPERATION\0" + "GL_INVALID_FRAMEBUFFER_OPERATION_EXT\0" + "GL_INVALID_FRAMEBUFFER_OPERATION_OES\0" + "GL_INVALID_OPERATION\0" + "GL_INVALID_VALUE\0" + "GL_INVERSE_NV\0" + "GL_INVERSE_TRANSPOSE_NV\0" + "GL_INVERT\0" + "GL_KEEP\0" + "GL_LAST_VERTEX_CONVENTION\0" + "GL_LAST_VERTEX_CONVENTION_EXT\0" + "GL_LEFT\0" + "GL_LEQUAL\0" + "GL_LESS\0" + "GL_LIGHT0\0" + "GL_LIGHT1\0" + "GL_LIGHT2\0" + "GL_LIGHT3\0" + "GL_LIGHT4\0" + "GL_LIGHT5\0" + "GL_LIGHT6\0" + "GL_LIGHT7\0" + "GL_LIGHTING\0" + "GL_LIGHTING_BIT\0" + "GL_LIGHT_MODEL_AMBIENT\0" + "GL_LIGHT_MODEL_COLOR_CONTROL\0" + "GL_LIGHT_MODEL_COLOR_CONTROL_EXT\0" + "GL_LIGHT_MODEL_LOCAL_VIEWER\0" + "GL_LIGHT_MODEL_TWO_SIDE\0" + "GL_LINE\0" + "GL_LINEAR\0" + "GL_LINEAR_ATTENUATION\0" + "GL_LINEAR_CLIPMAP_LINEAR_SGIX\0" + "GL_LINEAR_CLIPMAP_NEAREST_SGIX\0" + "GL_LINEAR_MIPMAP_LINEAR\0" + "GL_LINEAR_MIPMAP_NEAREST\0" + "GL_LINES\0" + "GL_LINES_ADJACENCY\0" + "GL_LINES_ADJACENCY_ARB\0" + "GL_LINE_BIT\0" + "GL_LINE_LOOP\0" + "GL_LINE_RESET_TOKEN\0" + "GL_LINE_SMOOTH\0" + "GL_LINE_SMOOTH_HINT\0" + "GL_LINE_STIPPLE\0" + "GL_LINE_STIPPLE_PATTERN\0" + "GL_LINE_STIPPLE_REPEAT\0" + "GL_LINE_STRIP\0" + "GL_LINE_STRIP_ADJACENCY\0" + "GL_LINE_STRIP_ADJACENCY_ARB\0" + "GL_LINE_TOKEN\0" + "GL_LINE_WIDTH\0" + "GL_LINE_WIDTH_GRANULARITY\0" + "GL_LINE_WIDTH_RANGE\0" + "GL_LINK_STATUS\0" + "GL_LIST_BASE\0" + "GL_LIST_BIT\0" + "GL_LIST_INDEX\0" + "GL_LIST_MODE\0" + "GL_LOAD\0" + "GL_LOGIC_OP\0" + "GL_LOGIC_OP_MODE\0" + "GL_LOWER_LEFT\0" + "GL_LOW_FLOAT\0" + "GL_LOW_INT\0" + "GL_LUMINANCE\0" + "GL_LUMINANCE12\0" + "GL_LUMINANCE12_ALPHA12\0" + "GL_LUMINANCE12_ALPHA12_EXT\0" + "GL_LUMINANCE12_ALPHA4\0" + "GL_LUMINANCE12_ALPHA4_EXT\0" + "GL_LUMINANCE12_EXT\0" + "GL_LUMINANCE16\0" + "GL_LUMINANCE16I_EXT\0" + "GL_LUMINANCE16UI_EXT\0" + "GL_LUMINANCE16_ALPHA16\0" + "GL_LUMINANCE16_ALPHA16_EXT\0" + "GL_LUMINANCE16_EXT\0" + "GL_LUMINANCE32I_EXT\0" + "GL_LUMINANCE32UI_EXT\0" + "GL_LUMINANCE4\0" + "GL_LUMINANCE4_ALPHA4\0" + "GL_LUMINANCE4_ALPHA4_EXT\0" + "GL_LUMINANCE4_EXT\0" + "GL_LUMINANCE6_ALPHA2\0" + "GL_LUMINANCE6_ALPHA2_EXT\0" + "GL_LUMINANCE8\0" + "GL_LUMINANCE8I_EXT\0" + "GL_LUMINANCE8UI_EXT\0" + "GL_LUMINANCE8_ALPHA8\0" + "GL_LUMINANCE8_ALPHA8_EXT\0" + "GL_LUMINANCE8_EXT\0" + "GL_LUMINANCE_ALPHA\0" + "GL_LUMINANCE_ALPHA16I_EXT\0" + "GL_LUMINANCE_ALPHA16UI_EXT\0" + "GL_LUMINANCE_ALPHA32I_EXT\0" + "GL_LUMINANCE_ALPHA32UI_EXT\0" + "GL_LUMINANCE_ALPHA8I_EXT\0" + "GL_LUMINANCE_ALPHA8UI_EXT\0" + "GL_LUMINANCE_ALPHA_INTEGER_EXT\0" + "GL_LUMINANCE_INTEGER_EXT\0" + "GL_MAJOR_VERSION\0" + "GL_MAP1_COLOR_4\0" + "GL_MAP1_GRID_DOMAIN\0" + "GL_MAP1_GRID_SEGMENTS\0" + "GL_MAP1_INDEX\0" + "GL_MAP1_NORMAL\0" + "GL_MAP1_TEXTURE_COORD_1\0" + "GL_MAP1_TEXTURE_COORD_2\0" + "GL_MAP1_TEXTURE_COORD_3\0" + "GL_MAP1_TEXTURE_COORD_4\0" + "GL_MAP1_VERTEX_3\0" + "GL_MAP1_VERTEX_4\0" + "GL_MAP1_VERTEX_ATTRIB0_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB10_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB11_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB12_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB13_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB14_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB15_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB1_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB2_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB3_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB4_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB5_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB6_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB7_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB8_4_NV\0" + "GL_MAP1_VERTEX_ATTRIB9_4_NV\0" + "GL_MAP2_COLOR_4\0" + "GL_MAP2_GRID_DOMAIN\0" + "GL_MAP2_GRID_SEGMENTS\0" + "GL_MAP2_INDEX\0" + "GL_MAP2_NORMAL\0" + "GL_MAP2_TEXTURE_COORD_1\0" + "GL_MAP2_TEXTURE_COORD_2\0" + "GL_MAP2_TEXTURE_COORD_3\0" + "GL_MAP2_TEXTURE_COORD_4\0" + "GL_MAP2_VERTEX_3\0" + "GL_MAP2_VERTEX_4\0" + "GL_MAP2_VERTEX_ATTRIB0_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB10_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB11_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB12_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB13_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB14_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB15_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB1_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB2_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB3_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB4_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB5_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB6_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB7_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB8_4_NV\0" + "GL_MAP2_VERTEX_ATTRIB9_4_NV\0" + "GL_MAP_COLOR\0" + "GL_MAP_FLUSH_EXPLICIT_BIT\0" + "GL_MAP_INVALIDATE_BUFFER_BIT\0" + "GL_MAP_INVALIDATE_RANGE_BIT\0" + "GL_MAP_READ_BIT\0" + "GL_MAP_STENCIL\0" + "GL_MAP_UNSYNCHRONIZED_BIT\0" + "GL_MAP_WRITE_BIT\0" + "GL_MATRIX0_ARB\0" + "GL_MATRIX0_NV\0" + "GL_MATRIX10_ARB\0" + "GL_MATRIX11_ARB\0" + "GL_MATRIX12_ARB\0" + "GL_MATRIX13_ARB\0" + "GL_MATRIX14_ARB\0" + "GL_MATRIX15_ARB\0" + "GL_MATRIX16_ARB\0" + "GL_MATRIX17_ARB\0" + "GL_MATRIX18_ARB\0" + "GL_MATRIX19_ARB\0" + "GL_MATRIX1_ARB\0" + "GL_MATRIX1_NV\0" + "GL_MATRIX20_ARB\0" + "GL_MATRIX21_ARB\0" + "GL_MATRIX22_ARB\0" + "GL_MATRIX23_ARB\0" + "GL_MATRIX24_ARB\0" + "GL_MATRIX25_ARB\0" + "GL_MATRIX26_ARB\0" + "GL_MATRIX27_ARB\0" + "GL_MATRIX28_ARB\0" + "GL_MATRIX29_ARB\0" + "GL_MATRIX2_ARB\0" + "GL_MATRIX2_NV\0" + "GL_MATRIX30_ARB\0" + "GL_MATRIX31_ARB\0" + "GL_MATRIX3_ARB\0" + "GL_MATRIX3_NV\0" + "GL_MATRIX4_ARB\0" + "GL_MATRIX4_NV\0" + "GL_MATRIX5_ARB\0" + "GL_MATRIX5_NV\0" + "GL_MATRIX6_ARB\0" + "GL_MATRIX6_NV\0" + "GL_MATRIX7_ARB\0" + "GL_MATRIX7_NV\0" + "GL_MATRIX8_ARB\0" + "GL_MATRIX9_ARB\0" + "GL_MATRIX_INDEX_ARRAY_ARB\0" + "GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES\0" + "GL_MATRIX_INDEX_ARRAY_OES\0" + "GL_MATRIX_INDEX_ARRAY_POINTER_ARB\0" + "GL_MATRIX_INDEX_ARRAY_POINTER_OES\0" + "GL_MATRIX_INDEX_ARRAY_SIZE_ARB\0" + "GL_MATRIX_INDEX_ARRAY_SIZE_OES\0" + "GL_MATRIX_INDEX_ARRAY_STRIDE_ARB\0" + "GL_MATRIX_INDEX_ARRAY_STRIDE_OES\0" + "GL_MATRIX_INDEX_ARRAY_TYPE_ARB\0" + "GL_MATRIX_INDEX_ARRAY_TYPE_OES\0" + "GL_MATRIX_MODE\0" + "GL_MATRIX_PALETTE_ARB\0" + "GL_MATRIX_PALETTE_OES\0" + "GL_MAX\0" + "GL_MAX_3D_TEXTURE_SIZE\0" + "GL_MAX_3D_TEXTURE_SIZE_OES\0" + "GL_MAX_ARRAY_TEXTURE_LAYERS\0" + "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT\0" + "GL_MAX_ATTRIB_STACK_DEPTH\0" + "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH\0" + "GL_MAX_CLIPMAP_DEPTH_SGIX\0" + "GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX\0" + "GL_MAX_CLIP_DISTANCES\0" + "GL_MAX_CLIP_PLANES\0" + "GL_MAX_COLOR_ATTACHMENTS\0" + "GL_MAX_COLOR_ATTACHMENTS_EXT\0" + "GL_MAX_COLOR_MATRIX_STACK_DEPTH\0" + "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI\0" + "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS\0" + "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB\0" + "GL_MAX_CONVOLUTION_HEIGHT\0" + "GL_MAX_CONVOLUTION_HEIGHT_EXT\0" + "GL_MAX_CONVOLUTION_WIDTH\0" + "GL_MAX_CONVOLUTION_WIDTH_EXT\0" + "GL_MAX_CUBE_MAP_TEXTURE_SIZE\0" + "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB\0" + "GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES\0" + "GL_MAX_DRAW_BUFFERS\0" + "GL_MAX_DRAW_BUFFERS_ARB\0" + "GL_MAX_DRAW_BUFFERS_ATI\0" + "GL_MAX_ELEMENTS_INDICES\0" + "GL_MAX_ELEMENTS_VERTICES\0" + "GL_MAX_EVAL_ORDER\0" + "GL_MAX_EXT\0" + "GL_MAX_FRAGMENT_INPUT_COMPONENTS\0" + "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS\0" + "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB\0" + "GL_MAX_FRAGMENT_UNIFORM_VECTORS\0" + "GL_MAX_GEOMETRY_INPUT_COMPONENTS\0" + "GL_MAX_GEOMETRY_OUTPUT_COMPONENTS\0" + "GL_MAX_GEOMETRY_OUTPUT_VERTICES\0" + "GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB\0" + "GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS\0" + "GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB\0" + "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS\0" + "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB\0" + "GL_MAX_GEOMETRY_UNIFORM_COMPONENTS\0" + "GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB\0" + "GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB\0" + "GL_MAX_LIGHTS\0" + "GL_MAX_LIST_NESTING\0" + "GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB\0" + "GL_MAX_MODELVIEW_STACK_DEPTH\0" + "GL_MAX_NAME_STACK_DEPTH\0" + "GL_MAX_PALETTE_MATRICES_ARB\0" + "GL_MAX_PALETTE_MATRICES_OES\0" + "GL_MAX_PIXEL_MAP_TABLE\0" + "GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB\0" + "GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB\0" + "GL_MAX_PROGRAM_ATTRIBS_ARB\0" + "GL_MAX_PROGRAM_CALL_DEPTH_NV\0" + "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB\0" + "GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV\0" + "GL_MAX_PROGRAM_IF_DEPTH_NV\0" + "GL_MAX_PROGRAM_INSTRUCTIONS_ARB\0" + "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB\0" + "GL_MAX_PROGRAM_LOOP_COUNT_NV\0" + "GL_MAX_PROGRAM_LOOP_DEPTH_NV\0" + "GL_MAX_PROGRAM_MATRICES_ARB\0" + "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB\0" + "GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB\0" + "GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB\0" + "GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB\0" + "GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB\0" + "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB\0" + "GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB\0" + "GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB\0" + "GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB\0" + "GL_MAX_PROGRAM_PARAMETERS_ARB\0" + "GL_MAX_PROGRAM_TEMPORARIES_ARB\0" + "GL_MAX_PROGRAM_TEXEL_OFFSET\0" + "GL_MAX_PROGRAM_TEXEL_OFFSET_EXT\0" + "GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB\0" + "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB\0" + "GL_MAX_PROJECTION_STACK_DEPTH\0" + "GL_MAX_RECTANGLE_TEXTURE_SIZE\0" + "GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\0" + "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV\0" + "GL_MAX_RENDERBUFFER_SIZE\0" + "GL_MAX_RENDERBUFFER_SIZE_EXT\0" + "GL_MAX_RENDERBUFFER_SIZE_OES\0" + "GL_MAX_SAMPLES\0" + "GL_MAX_SAMPLES_EXT\0" + "GL_MAX_SERVER_WAIT_TIMEOUT\0" + "GL_MAX_SHININESS_NV\0" + "GL_MAX_SPOT_EXPONENT_NV\0" + "GL_MAX_TEXTURE_BUFFER_SIZE\0" + "GL_MAX_TEXTURE_COORDS\0" + "GL_MAX_TEXTURE_COORDS_ARB\0" + "GL_MAX_TEXTURE_IMAGE_UNITS\0" + "GL_MAX_TEXTURE_IMAGE_UNITS_ARB\0" + "GL_MAX_TEXTURE_LOD_BIAS\0" + "GL_MAX_TEXTURE_LOD_BIAS_EXT\0" + "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT\0" + "GL_MAX_TEXTURE_SIZE\0" + "GL_MAX_TEXTURE_STACK_DEPTH\0" + "GL_MAX_TEXTURE_UNITS\0" + "GL_MAX_TEXTURE_UNITS_ARB\0" + "GL_MAX_TRACK_MATRICES_NV\0" + "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0" + "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS\0" + "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT\0" + "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS\0" + "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT\0" + "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS\0" + "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT\0" + "GL_MAX_VARYING_COMPONENTS\0" + "GL_MAX_VARYING_FLOATS\0" + "GL_MAX_VARYING_FLOATS_ARB\0" + "GL_MAX_VARYING_VECTORS\0" + "GL_MAX_VERTEX_ATTRIBS\0" + "GL_MAX_VERTEX_ATTRIBS_ARB\0" + "GL_MAX_VERTEX_OUTPUT_COMPONENTS\0" + "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS\0" + "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0" + "GL_MAX_VERTEX_UNIFORM_COMPONENTS\0" + "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB\0" + "GL_MAX_VERTEX_UNIFORM_VECTORS\0" + "GL_MAX_VERTEX_UNITS_ARB\0" + "GL_MAX_VERTEX_UNITS_OES\0" + "GL_MAX_VERTEX_VARYING_COMPONENTS_ARB\0" + "GL_MAX_VIEWPORT_DIMS\0" + "GL_MEDIUM_FLOAT\0" + "GL_MEDIUM_INT\0" + "GL_MIN\0" + "GL_MINMAX\0" + "GL_MINMAX_EXT\0" + "GL_MINMAX_FORMAT\0" + "GL_MINMAX_FORMAT_EXT\0" + "GL_MINMAX_SINK\0" + "GL_MINMAX_SINK_EXT\0" + "GL_MINOR_VERSION\0" + "GL_MIN_EXT\0" + "GL_MIN_PROGRAM_TEXEL_OFFSET\0" + "GL_MIN_PROGRAM_TEXEL_OFFSET_EXT\0" + "GL_MIRRORED_REPEAT\0" + "GL_MIRRORED_REPEAT_ARB\0" + "GL_MIRRORED_REPEAT_IBM\0" + "GL_MIRROR_CLAMP_ATI\0" + "GL_MIRROR_CLAMP_EXT\0" + "GL_MIRROR_CLAMP_TO_BORDER_EXT\0" + "GL_MIRROR_CLAMP_TO_EDGE_ATI\0" + "GL_MIRROR_CLAMP_TO_EDGE_EXT\0" + "GL_MODELVIEW\0" + "GL_MODELVIEW0_ARB\0" + "GL_MODELVIEW10_ARB\0" + "GL_MODELVIEW11_ARB\0" + "GL_MODELVIEW12_ARB\0" + "GL_MODELVIEW13_ARB\0" + "GL_MODELVIEW14_ARB\0" + "GL_MODELVIEW15_ARB\0" + "GL_MODELVIEW16_ARB\0" + "GL_MODELVIEW17_ARB\0" + "GL_MODELVIEW18_ARB\0" + "GL_MODELVIEW19_ARB\0" + "GL_MODELVIEW1_ARB\0" + "GL_MODELVIEW20_ARB\0" + "GL_MODELVIEW21_ARB\0" + "GL_MODELVIEW22_ARB\0" + "GL_MODELVIEW23_ARB\0" + "GL_MODELVIEW24_ARB\0" + "GL_MODELVIEW25_ARB\0" + "GL_MODELVIEW26_ARB\0" + "GL_MODELVIEW27_ARB\0" + "GL_MODELVIEW28_ARB\0" + "GL_MODELVIEW29_ARB\0" + "GL_MODELVIEW2_ARB\0" + "GL_MODELVIEW30_ARB\0" + "GL_MODELVIEW31_ARB\0" + "GL_MODELVIEW3_ARB\0" + "GL_MODELVIEW4_ARB\0" + "GL_MODELVIEW5_ARB\0" + "GL_MODELVIEW6_ARB\0" + "GL_MODELVIEW7_ARB\0" + "GL_MODELVIEW8_ARB\0" + "GL_MODELVIEW9_ARB\0" + "GL_MODELVIEW_MATRIX\0" + "GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES\0" + "GL_MODELVIEW_PROJECTION_NV\0" + "GL_MODELVIEW_STACK_DEPTH\0" + "GL_MODULATE\0" + "GL_MODULATE_ADD_ATI\0" + "GL_MODULATE_SIGNED_ADD_ATI\0" + "GL_MODULATE_SUBTRACT_ATI\0" + "GL_MULT\0" + "GL_MULTISAMPLE\0" + "GL_MULTISAMPLE_3DFX\0" + "GL_MULTISAMPLE_ARB\0" + "GL_MULTISAMPLE_BIT\0" + "GL_MULTISAMPLE_BIT_3DFX\0" + "GL_MULTISAMPLE_BIT_ARB\0" + "GL_MULTISAMPLE_FILTER_HINT_NV\0" + "GL_N3F_V3F\0" + "GL_NAME_STACK_DEPTH\0" + "GL_NAND\0" + "GL_NEAREST\0" + "GL_NEAREST_CLIPMAP_LINEAR_SGIX\0" + "GL_NEAREST_CLIPMAP_NEAREST_SGIX\0" + "GL_NEAREST_MIPMAP_LINEAR\0" + "GL_NEAREST_MIPMAP_NEAREST\0" + "GL_NEVER\0" + "GL_NICEST\0" + "GL_NONE\0" + "GL_NONE_OES\0" + "GL_NOOP\0" + "GL_NOR\0" + "GL_NORMALIZE\0" + "GL_NORMAL_ARRAY\0" + "GL_NORMAL_ARRAY_BUFFER_BINDING\0" + "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB\0" + "GL_NORMAL_ARRAY_POINTER\0" + "GL_NORMAL_ARRAY_STRIDE\0" + "GL_NORMAL_ARRAY_TYPE\0" + "GL_NORMAL_MAP\0" + "GL_NORMAL_MAP_ARB\0" + "GL_NORMAL_MAP_NV\0" + "GL_NORMAL_MAP_OES\0" + "GL_NOTEQUAL\0" + "GL_NO_ERROR\0" + "GL_NUM_COMPRESSED_TEXTURE_FORMATS\0" + "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB\0" + "GL_NUM_EXTENSIONS\0" + "GL_NUM_PROGRAM_BINARY_FORMATS_OES\0" + "GL_NUM_SHADER_BINARY_FORMATS\0" + "GL_OBJECT_ACTIVE_ATTRIBUTES_ARB\0" + "GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB\0" + "GL_OBJECT_ACTIVE_UNIFORMS_ARB\0" + "GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB\0" + "GL_OBJECT_ATTACHED_OBJECTS_ARB\0" + "GL_OBJECT_COMPILE_STATUS_ARB\0" + "GL_OBJECT_DELETE_STATUS_ARB\0" + "GL_OBJECT_INFO_LOG_LENGTH_ARB\0" + "GL_OBJECT_LINEAR\0" + "GL_OBJECT_LINK_STATUS_ARB\0" + "GL_OBJECT_PLANE\0" + "GL_OBJECT_SHADER_SOURCE_LENGTH_ARB\0" + "GL_OBJECT_SUBTYPE_ARB\0" + "GL_OBJECT_TYPE\0" + "GL_OBJECT_TYPE_ARB\0" + "GL_OBJECT_VALIDATE_STATUS_ARB\0" + "GL_OCCLUSION_TEST_HP\0" + "GL_OCCLUSION_TEST_RESULT_HP\0" + "GL_ONE\0" + "GL_ONE_MINUS_CONSTANT_ALPHA\0" + "GL_ONE_MINUS_CONSTANT_ALPHA_EXT\0" + "GL_ONE_MINUS_CONSTANT_COLOR\0" + "GL_ONE_MINUS_CONSTANT_COLOR_EXT\0" + "GL_ONE_MINUS_DST_ALPHA\0" + "GL_ONE_MINUS_DST_COLOR\0" + "GL_ONE_MINUS_SRC_ALPHA\0" + "GL_ONE_MINUS_SRC_COLOR\0" + "GL_OPERAND0_ALPHA\0" + "GL_OPERAND0_ALPHA_ARB\0" + "GL_OPERAND0_ALPHA_EXT\0" + "GL_OPERAND0_RGB\0" + "GL_OPERAND0_RGB_ARB\0" + "GL_OPERAND0_RGB_EXT\0" + "GL_OPERAND1_ALPHA\0" + "GL_OPERAND1_ALPHA_ARB\0" + "GL_OPERAND1_ALPHA_EXT\0" + "GL_OPERAND1_RGB\0" + "GL_OPERAND1_RGB_ARB\0" + "GL_OPERAND1_RGB_EXT\0" + "GL_OPERAND2_ALPHA\0" + "GL_OPERAND2_ALPHA_ARB\0" + "GL_OPERAND2_ALPHA_EXT\0" + "GL_OPERAND2_RGB\0" + "GL_OPERAND2_RGB_ARB\0" + "GL_OPERAND2_RGB_EXT\0" + "GL_OPERAND3_ALPHA_NV\0" + "GL_OPERAND3_RGB_NV\0" + "GL_OR\0" + "GL_ORDER\0" + "GL_OR_INVERTED\0" + "GL_OR_REVERSE\0" + "GL_OUT_OF_MEMORY\0" + "GL_PACK_ALIGNMENT\0" + "GL_PACK_IMAGE_HEIGHT\0" + "GL_PACK_INVERT_MESA\0" + "GL_PACK_LSB_FIRST\0" + "GL_PACK_ROW_LENGTH\0" + "GL_PACK_SKIP_IMAGES\0" + "GL_PACK_SKIP_PIXELS\0" + "GL_PACK_SKIP_ROWS\0" + "GL_PACK_SWAP_BYTES\0" + "GL_PALETTE4_R5_G6_B5_OES\0" + "GL_PALETTE4_RGB5_A1_OES\0" + "GL_PALETTE4_RGB8_OES\0" + "GL_PALETTE4_RGBA4_OES\0" + "GL_PALETTE4_RGBA8_OES\0" + "GL_PALETTE8_R5_G6_B5_OES\0" + "GL_PALETTE8_RGB5_A1_OES\0" + "GL_PALETTE8_RGB8_OES\0" + "GL_PALETTE8_RGBA4_OES\0" + "GL_PALETTE8_RGBA8_OES\0" + "GL_PASS_THROUGH_TOKEN\0" + "GL_PERSPECTIVE_CORRECTION_HINT\0" + "GL_PIXEL_MAP_A_TO_A\0" + "GL_PIXEL_MAP_A_TO_A_SIZE\0" + "GL_PIXEL_MAP_B_TO_B\0" + "GL_PIXEL_MAP_B_TO_B_SIZE\0" + "GL_PIXEL_MAP_G_TO_G\0" + "GL_PIXEL_MAP_G_TO_G_SIZE\0" + "GL_PIXEL_MAP_I_TO_A\0" + "GL_PIXEL_MAP_I_TO_A_SIZE\0" + "GL_PIXEL_MAP_I_TO_B\0" + "GL_PIXEL_MAP_I_TO_B_SIZE\0" + "GL_PIXEL_MAP_I_TO_G\0" + "GL_PIXEL_MAP_I_TO_G_SIZE\0" + "GL_PIXEL_MAP_I_TO_I\0" + "GL_PIXEL_MAP_I_TO_I_SIZE\0" + "GL_PIXEL_MAP_I_TO_R\0" + "GL_PIXEL_MAP_I_TO_R_SIZE\0" + "GL_PIXEL_MAP_R_TO_R\0" + "GL_PIXEL_MAP_R_TO_R_SIZE\0" + "GL_PIXEL_MAP_S_TO_S\0" + "GL_PIXEL_MAP_S_TO_S_SIZE\0" + "GL_PIXEL_MODE_BIT\0" + "GL_PIXEL_PACK_BUFFER\0" + "GL_PIXEL_PACK_BUFFER_BINDING\0" + "GL_PIXEL_PACK_BUFFER_BINDING_EXT\0" + "GL_PIXEL_PACK_BUFFER_EXT\0" + "GL_PIXEL_UNPACK_BUFFER\0" + "GL_PIXEL_UNPACK_BUFFER_BINDING\0" + "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT\0" + "GL_PIXEL_UNPACK_BUFFER_EXT\0" + "GL_POINT\0" + "GL_POINTS\0" + "GL_POINT_BIT\0" + "GL_POINT_DISTANCE_ATTENUATION\0" + "GL_POINT_DISTANCE_ATTENUATION_ARB\0" + "GL_POINT_DISTANCE_ATTENUATION_EXT\0" + "GL_POINT_DISTANCE_ATTENUATION_SGIS\0" + "GL_POINT_FADE_THRESHOLD_SIZE\0" + "GL_POINT_FADE_THRESHOLD_SIZE_ARB\0" + "GL_POINT_FADE_THRESHOLD_SIZE_EXT\0" + "GL_POINT_FADE_THRESHOLD_SIZE_SGIS\0" + "GL_POINT_SIZE\0" + "GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES\0" + "GL_POINT_SIZE_ARRAY_OES\0" + "GL_POINT_SIZE_ARRAY_POINTER_OES\0" + "GL_POINT_SIZE_ARRAY_STRIDE_OES\0" + "GL_POINT_SIZE_ARRAY_TYPE_OES\0" + "GL_POINT_SIZE_GRANULARITY\0" + "GL_POINT_SIZE_MAX\0" + "GL_POINT_SIZE_MAX_ARB\0" + "GL_POINT_SIZE_MAX_EXT\0" + "GL_POINT_SIZE_MAX_SGIS\0" + "GL_POINT_SIZE_MIN\0" + "GL_POINT_SIZE_MIN_ARB\0" + "GL_POINT_SIZE_MIN_EXT\0" + "GL_POINT_SIZE_MIN_SGIS\0" + "GL_POINT_SIZE_RANGE\0" + "GL_POINT_SMOOTH\0" + "GL_POINT_SMOOTH_HINT\0" + "GL_POINT_SPRITE\0" + "GL_POINT_SPRITE_ARB\0" + "GL_POINT_SPRITE_COORD_ORIGIN\0" + "GL_POINT_SPRITE_NV\0" + "GL_POINT_SPRITE_OES\0" + "GL_POINT_SPRITE_R_MODE_NV\0" + "GL_POINT_TOKEN\0" + "GL_POLYGON\0" + "GL_POLYGON_BIT\0" + "GL_POLYGON_MODE\0" + "GL_POLYGON_OFFSET_BIAS\0" + "GL_POLYGON_OFFSET_FACTOR\0" + "GL_POLYGON_OFFSET_FILL\0" + "GL_POLYGON_OFFSET_LINE\0" + "GL_POLYGON_OFFSET_POINT\0" + "GL_POLYGON_OFFSET_UNITS\0" + "GL_POLYGON_SMOOTH\0" + "GL_POLYGON_SMOOTH_HINT\0" + "GL_POLYGON_STIPPLE\0" + "GL_POLYGON_STIPPLE_BIT\0" + "GL_POLYGON_TOKEN\0" + "GL_POSITION\0" + "GL_POST_COLOR_MATRIX_ALPHA_BIAS\0" + "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI\0" + "GL_POST_COLOR_MATRIX_ALPHA_SCALE\0" + "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI\0" + "GL_POST_COLOR_MATRIX_BLUE_BIAS\0" + "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI\0" + "GL_POST_COLOR_MATRIX_BLUE_SCALE\0" + "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI\0" + "GL_POST_COLOR_MATRIX_COLOR_TABLE\0" + "GL_POST_COLOR_MATRIX_GREEN_BIAS\0" + "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI\0" + "GL_POST_COLOR_MATRIX_GREEN_SCALE\0" + "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI\0" + "GL_POST_COLOR_MATRIX_RED_BIAS\0" + "GL_POST_COLOR_MATRIX_RED_BIAS_SGI\0" + "GL_POST_COLOR_MATRIX_RED_SCALE\0" + "GL_POST_COLOR_MATRIX_RED_SCALE_SGI\0" + "GL_POST_CONVOLUTION_ALPHA_BIAS\0" + "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT\0" + "GL_POST_CONVOLUTION_ALPHA_SCALE\0" + "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT\0" + "GL_POST_CONVOLUTION_BLUE_BIAS\0" + "GL_POST_CONVOLUTION_BLUE_BIAS_EXT\0" + "GL_POST_CONVOLUTION_BLUE_SCALE\0" + "GL_POST_CONVOLUTION_BLUE_SCALE_EXT\0" + "GL_POST_CONVOLUTION_COLOR_TABLE\0" + "GL_POST_CONVOLUTION_GREEN_BIAS\0" + "GL_POST_CONVOLUTION_GREEN_BIAS_EXT\0" + "GL_POST_CONVOLUTION_GREEN_SCALE\0" + "GL_POST_CONVOLUTION_GREEN_SCALE_EXT\0" + "GL_POST_CONVOLUTION_RED_BIAS\0" + "GL_POST_CONVOLUTION_RED_BIAS_EXT\0" + "GL_POST_CONVOLUTION_RED_SCALE\0" + "GL_POST_CONVOLUTION_RED_SCALE_EXT\0" + "GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX\0" + "GL_POST_TEXTURE_FILTER_BIAS_SGIX\0" + "GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX\0" + "GL_POST_TEXTURE_FILTER_SCALE_SGIX\0" + "GL_PREVIOUS\0" + "GL_PREVIOUS_ARB\0" + "GL_PREVIOUS_EXT\0" + "GL_PRIMARY_COLOR\0" + "GL_PRIMARY_COLOR_ARB\0" + "GL_PRIMARY_COLOR_EXT\0" + "GL_PRIMITIVES_GENERATED\0" + "GL_PRIMITIVES_GENERATED_EXT\0" + "GL_PRIMITIVE_RESTART\0" + "GL_PRIMITIVE_RESTART_INDEX\0" + "GL_PRIMITIVE_RESTART_INDEX_NV\0" + "GL_PRIMITIVE_RESTART_NV\0" + "GL_PROGRAM_ADDRESS_REGISTERS_ARB\0" + "GL_PROGRAM_ALU_INSTRUCTIONS_ARB\0" + "GL_PROGRAM_ATTRIBS_ARB\0" + "GL_PROGRAM_BINARY_FORMATS_OES\0" + "GL_PROGRAM_BINARY_LENGTH_OES\0" + "GL_PROGRAM_BINDING_ARB\0" + "GL_PROGRAM_ERROR_POSITION_ARB\0" + "GL_PROGRAM_ERROR_POSITION_NV\0" + "GL_PROGRAM_ERROR_STRING_ARB\0" + "GL_PROGRAM_FORMAT_ARB\0" + "GL_PROGRAM_FORMAT_ASCII_ARB\0" + "GL_PROGRAM_INSTRUCTIONS_ARB\0" + "GL_PROGRAM_LENGTH_ARB\0" + "GL_PROGRAM_LENGTH_NV\0" + "GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB\0" + "GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB\0" + "GL_PROGRAM_NATIVE_ATTRIBS_ARB\0" + "GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB\0" + "GL_PROGRAM_NATIVE_PARAMETERS_ARB\0" + "GL_PROGRAM_NATIVE_TEMPORARIES_ARB\0" + "GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB\0" + "GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB\0" + "GL_PROGRAM_OBJECT_ARB\0" + "GL_PROGRAM_PARAMETERS_ARB\0" + "GL_PROGRAM_PARAMETER_NV\0" + "GL_PROGRAM_POINT_SIZE\0" + "GL_PROGRAM_POINT_SIZE_ARB\0" + "GL_PROGRAM_RESIDENT_NV\0" + "GL_PROGRAM_STRING_ARB\0" + "GL_PROGRAM_STRING_NV\0" + "GL_PROGRAM_TARGET_NV\0" + "GL_PROGRAM_TEMPORARIES_ARB\0" + "GL_PROGRAM_TEX_INDIRECTIONS_ARB\0" + "GL_PROGRAM_TEX_INSTRUCTIONS_ARB\0" + "GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB\0" + "GL_PROJECTION\0" + "GL_PROJECTION_MATRIX\0" + "GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES\0" + "GL_PROJECTION_STACK_DEPTH\0" + "GL_PROVOKING_VERTEX\0" + "GL_PROVOKING_VERTEX_EXT\0" + "GL_PROXY_COLOR_TABLE\0" + "GL_PROXY_HISTOGRAM\0" + "GL_PROXY_HISTOGRAM_EXT\0" + "GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE\0" + "GL_PROXY_POST_CONVOLUTION_COLOR_TABLE\0" + "GL_PROXY_TEXTURE_1D\0" + "GL_PROXY_TEXTURE_1D_ARRAY\0" + "GL_PROXY_TEXTURE_1D_ARRAY_EXT\0" + "GL_PROXY_TEXTURE_1D_EXT\0" + "GL_PROXY_TEXTURE_2D\0" + "GL_PROXY_TEXTURE_2D_ARRAY\0" + "GL_PROXY_TEXTURE_2D_ARRAY_EXT\0" + "GL_PROXY_TEXTURE_2D_EXT\0" + "GL_PROXY_TEXTURE_3D\0" + "GL_PROXY_TEXTURE_COLOR_TABLE_SGI\0" + "GL_PROXY_TEXTURE_CUBE_MAP\0" + "GL_PROXY_TEXTURE_CUBE_MAP_ARB\0" + "GL_PROXY_TEXTURE_RECTANGLE\0" + "GL_PROXY_TEXTURE_RECTANGLE_ARB\0" + "GL_PROXY_TEXTURE_RECTANGLE_NV\0" + "GL_PURGEABLE_APPLE\0" + "GL_Q\0" + "GL_QUADRATIC_ATTENUATION\0" + "GL_QUADS\0" + "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION\0" + "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT\0" + "GL_QUAD_MESH_SUN\0" + "GL_QUAD_STRIP\0" + "GL_QUERY_BY_REGION_NO_WAIT\0" + "GL_QUERY_BY_REGION_NO_WAIT_NV\0" + "GL_QUERY_BY_REGION_WAIT\0" + "GL_QUERY_BY_REGION_WAIT_NV\0" + "GL_QUERY_COUNTER_BITS\0" + "GL_QUERY_COUNTER_BITS_ARB\0" + "GL_QUERY_NO_WAIT\0" + "GL_QUERY_NO_WAIT_NV\0" + "GL_QUERY_RESULT\0" + "GL_QUERY_RESULT_ARB\0" + "GL_QUERY_RESULT_AVAILABLE\0" + "GL_QUERY_RESULT_AVAILABLE_ARB\0" + "GL_QUERY_WAIT\0" + "GL_QUERY_WAIT_NV\0" + "GL_R\0" + "GL_R11F_G11F_B10F\0" + "GL_R16_SNORM\0" + "GL_R3_G3_B2\0" + "GL_R8_SNORM\0" + "GL_RASTERIZER_DISCARD\0" + "GL_RASTERIZER_DISCARD_EXT\0" + "GL_RASTER_POSITION_UNCLIPPED_IBM\0" + "GL_READ_BUFFER\0" + "GL_READ_FRAMEBUFFER\0" + "GL_READ_FRAMEBUFFER_BINDING\0" + "GL_READ_FRAMEBUFFER_BINDING_EXT\0" + "GL_READ_FRAMEBUFFER_EXT\0" + "GL_READ_ONLY\0" + "GL_READ_ONLY_ARB\0" + "GL_READ_WRITE\0" + "GL_READ_WRITE_ARB\0" + "GL_RED\0" + "GL_REDUCE\0" + "GL_REDUCE_EXT\0" + "GL_RED_BIAS\0" + "GL_RED_BITS\0" + "GL_RED_INTEGER\0" + "GL_RED_INTEGER_EXT\0" + "GL_RED_SCALE\0" + "GL_RED_SNORM\0" + "GL_REFLECTION_MAP\0" + "GL_REFLECTION_MAP_ARB\0" + "GL_REFLECTION_MAP_NV\0" + "GL_REFLECTION_MAP_OES\0" + "GL_RELEASED_APPLE\0" + "GL_RENDER\0" + "GL_RENDERBUFFER\0" + "GL_RENDERBUFFER_ALPHA_SIZE\0" + "GL_RENDERBUFFER_ALPHA_SIZE_OES\0" + "GL_RENDERBUFFER_BINDING\0" + "GL_RENDERBUFFER_BINDING_EXT\0" + "GL_RENDERBUFFER_BINDING_OES\0" + "GL_RENDERBUFFER_BLUE_SIZE\0" + "GL_RENDERBUFFER_BLUE_SIZE_OES\0" + "GL_RENDERBUFFER_DEPTH_SIZE\0" + "GL_RENDERBUFFER_DEPTH_SIZE_OES\0" + "GL_RENDERBUFFER_EXT\0" + "GL_RENDERBUFFER_GREEN_SIZE\0" + "GL_RENDERBUFFER_GREEN_SIZE_OES\0" + "GL_RENDERBUFFER_HEIGHT\0" + "GL_RENDERBUFFER_HEIGHT_EXT\0" + "GL_RENDERBUFFER_HEIGHT_OES\0" + "GL_RENDERBUFFER_INTERNAL_FORMAT\0" + "GL_RENDERBUFFER_INTERNAL_FORMAT_EXT\0" + "GL_RENDERBUFFER_INTERNAL_FORMAT_OES\0" + "GL_RENDERBUFFER_OES\0" + "GL_RENDERBUFFER_RED_SIZE\0" + "GL_RENDERBUFFER_RED_SIZE_OES\0" + "GL_RENDERBUFFER_SAMPLES\0" + "GL_RENDERBUFFER_SAMPLES_EXT\0" + "GL_RENDERBUFFER_STENCIL_SIZE\0" + "GL_RENDERBUFFER_STENCIL_SIZE_OES\0" + "GL_RENDERBUFFER_WIDTH\0" + "GL_RENDERBUFFER_WIDTH_EXT\0" + "GL_RENDERBUFFER_WIDTH_OES\0" + "GL_RENDERER\0" + "GL_RENDER_MODE\0" + "GL_REPEAT\0" + "GL_REPLACE\0" + "GL_REPLACE_EXT\0" + "GL_REPLICATE_BORDER_HP\0" + "GL_RESCALE_NORMAL\0" + "GL_RESCALE_NORMAL_EXT\0" + "GL_RETAINED_APPLE\0" + "GL_RETURN\0" + "GL_RG16_SNORM\0" + "GL_RG8_SNORM\0" + "GL_RGB\0" + "GL_RGB10\0" + "GL_RGB10_A2\0" + "GL_RGB10_A2_EXT\0" + "GL_RGB10_EXT\0" + "GL_RGB12\0" + "GL_RGB12_EXT\0" + "GL_RGB16\0" + "GL_RGB16F\0" + "GL_RGB16I\0" + "GL_RGB16I_EXT\0" + "GL_RGB16UI\0" + "GL_RGB16UI_EXT\0" + "GL_RGB16_EXT\0" + "GL_RGB16_SNORM\0" + "GL_RGB2_EXT\0" + "GL_RGB32F\0" + "GL_RGB32I\0" + "GL_RGB32I_EXT\0" + "GL_RGB32UI\0" + "GL_RGB32UI_EXT\0" + "GL_RGB4\0" + "GL_RGB4_EXT\0" + "GL_RGB4_S3TC\0" + "GL_RGB5\0" + "GL_RGB565\0" + "GL_RGB565_OES\0" + "GL_RGB5_A1\0" + "GL_RGB5_A1_EXT\0" + "GL_RGB5_A1_OES\0" + "GL_RGB5_EXT\0" + "GL_RGB8\0" + "GL_RGB8I\0" + "GL_RGB8I_EXT\0" + "GL_RGB8UI\0" + "GL_RGB8UI_EXT\0" + "GL_RGB8_EXT\0" + "GL_RGB8_OES\0" + "GL_RGB8_SNORM\0" + "GL_RGB9_E5\0" + "GL_RGBA\0" + "GL_RGBA12\0" + "GL_RGBA12_EXT\0" + "GL_RGBA16\0" + "GL_RGBA16F\0" + "GL_RGBA16I\0" + "GL_RGBA16I_EXT\0" + "GL_RGBA16UI\0" + "GL_RGBA16UI_EXT\0" + "GL_RGBA16_EXT\0" + "GL_RGBA16_SNORM\0" + "GL_RGBA2\0" + "GL_RGBA2_EXT\0" + "GL_RGBA32F\0" + "GL_RGBA32I\0" + "GL_RGBA32I_EXT\0" + "GL_RGBA32UI\0" + "GL_RGBA32UI_EXT\0" + "GL_RGBA4\0" + "GL_RGBA4_DXT5_S3TC\0" + "GL_RGBA4_EXT\0" + "GL_RGBA4_OES\0" + "GL_RGBA4_S3TC\0" + "GL_RGBA8\0" + "GL_RGBA8I\0" + "GL_RGBA8I_EXT\0" + "GL_RGBA8UI\0" + "GL_RGBA8UI_EXT\0" + "GL_RGBA8_EXT\0" + "GL_RGBA8_OES\0" + "GL_RGBA8_SNORM\0" + "GL_RGBA_DXT5_S3TC\0" + "GL_RGBA_INTEGER\0" + "GL_RGBA_INTEGER_EXT\0" + "GL_RGBA_INTEGER_MODE_EXT\0" + "GL_RGBA_MODE\0" + "GL_RGBA_S3TC\0" + "GL_RGBA_SNORM\0" + "GL_RGB_INTEGER\0" + "GL_RGB_INTEGER_EXT\0" + "GL_RGB_S3TC\0" + "GL_RGB_SCALE\0" + "GL_RGB_SCALE_ARB\0" + "GL_RGB_SCALE_EXT\0" + "GL_RGB_SNORM\0" + "GL_RG_SNORM\0" + "GL_RIGHT\0" + "GL_S\0" + "GL_SAMPLER_1D\0" + "GL_SAMPLER_1D_ARRAY\0" + "GL_SAMPLER_1D_ARRAY_EXT\0" + "GL_SAMPLER_1D_ARRAY_SHADOW\0" + "GL_SAMPLER_1D_ARRAY_SHADOW_EXT\0" + "GL_SAMPLER_1D_SHADOW\0" + "GL_SAMPLER_2D\0" + "GL_SAMPLER_2D_ARRAY\0" + "GL_SAMPLER_2D_ARRAY_EXT\0" + "GL_SAMPLER_2D_ARRAY_SHADOW\0" + "GL_SAMPLER_2D_ARRAY_SHADOW_EXT\0" + "GL_SAMPLER_2D_RECT\0" + "GL_SAMPLER_2D_RECT_SHADOW\0" + "GL_SAMPLER_2D_SHADOW\0" + "GL_SAMPLER_3D\0" + "GL_SAMPLER_3D_OES\0" + "GL_SAMPLER_BUFFER\0" + "GL_SAMPLER_BUFFER_EXT\0" + "GL_SAMPLER_CUBE\0" + "GL_SAMPLER_CUBE_SHADOW\0" + "GL_SAMPLER_CUBE_SHADOW_EXT\0" + "GL_SAMPLES\0" + "GL_SAMPLES_3DFX\0" + "GL_SAMPLES_ARB\0" + "GL_SAMPLES_PASSED\0" + "GL_SAMPLES_PASSED_ARB\0" + "GL_SAMPLE_ALPHA_TO_COVERAGE\0" + "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB\0" + "GL_SAMPLE_ALPHA_TO_ONE\0" + "GL_SAMPLE_ALPHA_TO_ONE_ARB\0" + "GL_SAMPLE_BUFFERS\0" + "GL_SAMPLE_BUFFERS_3DFX\0" + "GL_SAMPLE_BUFFERS_ARB\0" + "GL_SAMPLE_COVERAGE\0" + "GL_SAMPLE_COVERAGE_ARB\0" + "GL_SAMPLE_COVERAGE_INVERT\0" + "GL_SAMPLE_COVERAGE_INVERT_ARB\0" + "GL_SAMPLE_COVERAGE_VALUE\0" + "GL_SAMPLE_COVERAGE_VALUE_ARB\0" + "GL_SCISSOR_BIT\0" + "GL_SCISSOR_BOX\0" + "GL_SCISSOR_TEST\0" + "GL_SECONDARY_COLOR_ARRAY\0" + "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING\0" + "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB\0" + "GL_SECONDARY_COLOR_ARRAY_POINTER\0" + "GL_SECONDARY_COLOR_ARRAY_SIZE\0" + "GL_SECONDARY_COLOR_ARRAY_STRIDE\0" + "GL_SECONDARY_COLOR_ARRAY_TYPE\0" + "GL_SELECT\0" + "GL_SELECTION_BUFFER_POINTER\0" + "GL_SELECTION_BUFFER_SIZE\0" + "GL_SEPARABLE_2D\0" + "GL_SEPARATE_ATTRIBS\0" + "GL_SEPARATE_ATTRIBS_EXT\0" + "GL_SEPARATE_SPECULAR_COLOR\0" + "GL_SEPARATE_SPECULAR_COLOR_EXT\0" + "GL_SET\0" + "GL_SHADER_BINARY_FORMATS\0" + "GL_SHADER_COMPILER\0" + "GL_SHADER_OBJECT_ARB\0" + "GL_SHADER_SOURCE_LENGTH\0" + "GL_SHADER_TYPE\0" + "GL_SHADE_MODEL\0" + "GL_SHADING_LANGUAGE_VERSION\0" + "GL_SHADOW_AMBIENT_SGIX\0" + "GL_SHARED_TEXTURE_PALETTE_EXT\0" + "GL_SHININESS\0" + "GL_SHORT\0" + "GL_SIGNALED\0" + "GL_SIGNED_NORMALIZED\0" + "GL_SINGLE_COLOR\0" + "GL_SINGLE_COLOR_EXT\0" + "GL_SLICE_ACCUM_SUN\0" + "GL_SLUMINANCE\0" + "GL_SLUMINANCE8\0" + "GL_SLUMINANCE8_ALPHA8\0" + "GL_SLUMINANCE_ALPHA\0" + "GL_SMOOTH\0" + "GL_SMOOTH_LINE_WIDTH_GRANULARITY\0" + "GL_SMOOTH_LINE_WIDTH_RANGE\0" + "GL_SMOOTH_POINT_SIZE_GRANULARITY\0" + "GL_SMOOTH_POINT_SIZE_RANGE\0" + "GL_SOURCE0_ALPHA\0" + "GL_SOURCE0_ALPHA_ARB\0" + "GL_SOURCE0_ALPHA_EXT\0" + "GL_SOURCE0_RGB\0" + "GL_SOURCE0_RGB_ARB\0" + "GL_SOURCE0_RGB_EXT\0" + "GL_SOURCE1_ALPHA\0" + "GL_SOURCE1_ALPHA_ARB\0" + "GL_SOURCE1_ALPHA_EXT\0" + "GL_SOURCE1_RGB\0" + "GL_SOURCE1_RGB_ARB\0" + "GL_SOURCE1_RGB_EXT\0" + "GL_SOURCE2_ALPHA\0" + "GL_SOURCE2_ALPHA_ARB\0" + "GL_SOURCE2_ALPHA_EXT\0" + "GL_SOURCE2_RGB\0" + "GL_SOURCE2_RGB_ARB\0" + "GL_SOURCE2_RGB_EXT\0" + "GL_SOURCE3_ALPHA_NV\0" + "GL_SOURCE3_RGB_NV\0" + "GL_SPECULAR\0" + "GL_SPHERE_MAP\0" + "GL_SPOT_CUTOFF\0" + "GL_SPOT_DIRECTION\0" + "GL_SPOT_EXPONENT\0" + "GL_SRC0_ALPHA\0" + "GL_SRC0_RGB\0" + "GL_SRC1_ALPHA\0" + "GL_SRC1_RGB\0" + "GL_SRC2_ALPHA\0" + "GL_SRC2_RGB\0" + "GL_SRC_ALPHA\0" + "GL_SRC_ALPHA_SATURATE\0" + "GL_SRC_COLOR\0" + "GL_SRGB\0" + "GL_SRGB8\0" + "GL_SRGB8_ALPHA8\0" + "GL_SRGB_ALPHA\0" + "GL_STACK_OVERFLOW\0" + "GL_STACK_UNDERFLOW\0" + "GL_STATIC_COPY\0" + "GL_STATIC_COPY_ARB\0" + "GL_STATIC_DRAW\0" + "GL_STATIC_DRAW_ARB\0" + "GL_STATIC_READ\0" + "GL_STATIC_READ_ARB\0" + "GL_STENCIL\0" + "GL_STENCIL_ATTACHMENT\0" + "GL_STENCIL_ATTACHMENT_EXT\0" + "GL_STENCIL_ATTACHMENT_OES\0" + "GL_STENCIL_BACK_FAIL\0" + "GL_STENCIL_BACK_FAIL_ATI\0" + "GL_STENCIL_BACK_FUNC\0" + "GL_STENCIL_BACK_FUNC_ATI\0" + "GL_STENCIL_BACK_PASS_DEPTH_FAIL\0" + "GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI\0" + "GL_STENCIL_BACK_PASS_DEPTH_PASS\0" + "GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI\0" + "GL_STENCIL_BACK_REF\0" + "GL_STENCIL_BACK_VALUE_MASK\0" + "GL_STENCIL_BACK_WRITEMASK\0" + "GL_STENCIL_BITS\0" + "GL_STENCIL_BUFFER\0" + "GL_STENCIL_BUFFER_BIT\0" + "GL_STENCIL_CLEAR_VALUE\0" + "GL_STENCIL_FAIL\0" + "GL_STENCIL_FUNC\0" + "GL_STENCIL_INDEX\0" + "GL_STENCIL_INDEX1\0" + "GL_STENCIL_INDEX16\0" + "GL_STENCIL_INDEX16_EXT\0" + "GL_STENCIL_INDEX1_EXT\0" + "GL_STENCIL_INDEX1_OES\0" + "GL_STENCIL_INDEX4\0" + "GL_STENCIL_INDEX4_EXT\0" + "GL_STENCIL_INDEX4_OES\0" + "GL_STENCIL_INDEX8\0" + "GL_STENCIL_INDEX8_EXT\0" + "GL_STENCIL_INDEX8_OES\0" + "GL_STENCIL_INDEX_EXT\0" + "GL_STENCIL_PASS_DEPTH_FAIL\0" + "GL_STENCIL_PASS_DEPTH_PASS\0" + "GL_STENCIL_REF\0" + "GL_STENCIL_TEST\0" + "GL_STENCIL_TEST_TWO_SIDE_EXT\0" + "GL_STENCIL_VALUE_MASK\0" + "GL_STENCIL_WRITEMASK\0" + "GL_STEREO\0" + "GL_STORAGE_CACHED_APPLE\0" + "GL_STORAGE_PRIVATE_APPLE\0" + "GL_STORAGE_SHARED_APPLE\0" + "GL_STREAM_COPY\0" + "GL_STREAM_COPY_ARB\0" + "GL_STREAM_DRAW\0" + "GL_STREAM_DRAW_ARB\0" + "GL_STREAM_READ\0" + "GL_STREAM_READ_ARB\0" + "GL_SUBPIXEL_BITS\0" + "GL_SUBTRACT\0" + "GL_SUBTRACT_ARB\0" + "GL_SYNC_CONDITION\0" + "GL_SYNC_FENCE\0" + "GL_SYNC_FLAGS\0" + "GL_SYNC_FLUSH_COMMANDS_BIT\0" + "GL_SYNC_GPU_COMMANDS_COMPLETE\0" + "GL_SYNC_STATUS\0" + "GL_T\0" + "GL_T2F_C3F_V3F\0" + "GL_T2F_C4F_N3F_V3F\0" + "GL_T2F_C4UB_V3F\0" + "GL_T2F_N3F_V3F\0" + "GL_T2F_V3F\0" + "GL_T4F_C4F_N3F_V4F\0" + "GL_T4F_V4F\0" + "GL_TABLE_TOO_LARGE_EXT\0" + "GL_TEXTURE\0" + "GL_TEXTURE0\0" + "GL_TEXTURE0_ARB\0" + "GL_TEXTURE1\0" + "GL_TEXTURE10\0" + "GL_TEXTURE10_ARB\0" + "GL_TEXTURE11\0" + "GL_TEXTURE11_ARB\0" + "GL_TEXTURE12\0" + "GL_TEXTURE12_ARB\0" + "GL_TEXTURE13\0" + "GL_TEXTURE13_ARB\0" + "GL_TEXTURE14\0" + "GL_TEXTURE14_ARB\0" + "GL_TEXTURE15\0" + "GL_TEXTURE15_ARB\0" + "GL_TEXTURE16\0" + "GL_TEXTURE16_ARB\0" + "GL_TEXTURE17\0" + "GL_TEXTURE17_ARB\0" + "GL_TEXTURE18\0" + "GL_TEXTURE18_ARB\0" + "GL_TEXTURE19\0" + "GL_TEXTURE19_ARB\0" + "GL_TEXTURE1_ARB\0" + "GL_TEXTURE2\0" + "GL_TEXTURE20\0" + "GL_TEXTURE20_ARB\0" + "GL_TEXTURE21\0" + "GL_TEXTURE21_ARB\0" + "GL_TEXTURE22\0" + "GL_TEXTURE22_ARB\0" + "GL_TEXTURE23\0" + "GL_TEXTURE23_ARB\0" + "GL_TEXTURE24\0" + "GL_TEXTURE24_ARB\0" + "GL_TEXTURE25\0" + "GL_TEXTURE25_ARB\0" + "GL_TEXTURE26\0" + "GL_TEXTURE26_ARB\0" + "GL_TEXTURE27\0" + "GL_TEXTURE27_ARB\0" + "GL_TEXTURE28\0" + "GL_TEXTURE28_ARB\0" + "GL_TEXTURE29\0" + "GL_TEXTURE29_ARB\0" + "GL_TEXTURE2_ARB\0" + "GL_TEXTURE3\0" + "GL_TEXTURE30\0" + "GL_TEXTURE30_ARB\0" + "GL_TEXTURE31\0" + "GL_TEXTURE31_ARB\0" + "GL_TEXTURE3_ARB\0" + "GL_TEXTURE4\0" + "GL_TEXTURE4_ARB\0" + "GL_TEXTURE5\0" + "GL_TEXTURE5_ARB\0" + "GL_TEXTURE6\0" + "GL_TEXTURE6_ARB\0" + "GL_TEXTURE7\0" + "GL_TEXTURE7_ARB\0" + "GL_TEXTURE8\0" + "GL_TEXTURE8_ARB\0" + "GL_TEXTURE9\0" + "GL_TEXTURE9_ARB\0" + "GL_TEXTURE_1D\0" + "GL_TEXTURE_1D_ARRAY\0" + "GL_TEXTURE_1D_ARRAY_EXT\0" + "GL_TEXTURE_2D\0" + "GL_TEXTURE_2D_ARRAY\0" + "GL_TEXTURE_2D_ARRAY_EXT\0" + "GL_TEXTURE_3D\0" + "GL_TEXTURE_3D_OES\0" + "GL_TEXTURE_ALPHA_SIZE\0" + "GL_TEXTURE_ALPHA_SIZE_EXT\0" + "GL_TEXTURE_BASE_LEVEL\0" + "GL_TEXTURE_BINDING_1D\0" + "GL_TEXTURE_BINDING_1D_ARRAY\0" + "GL_TEXTURE_BINDING_1D_ARRAY_EXT\0" + "GL_TEXTURE_BINDING_2D\0" + "GL_TEXTURE_BINDING_2D_ARRAY\0" + "GL_TEXTURE_BINDING_2D_ARRAY_EXT\0" + "GL_TEXTURE_BINDING_3D\0" + "GL_TEXTURE_BINDING_3D_OES\0" + "GL_TEXTURE_BINDING_BUFFER\0" + "GL_TEXTURE_BINDING_CUBE_MAP\0" + "GL_TEXTURE_BINDING_CUBE_MAP_ARB\0" + "GL_TEXTURE_BINDING_CUBE_MAP_OES\0" + "GL_TEXTURE_BINDING_RECTANGLE\0" + "GL_TEXTURE_BINDING_RECTANGLE_ARB\0" + "GL_TEXTURE_BINDING_RECTANGLE_NV\0" + "GL_TEXTURE_BIT\0" + "GL_TEXTURE_BLUE_SIZE\0" + "GL_TEXTURE_BLUE_SIZE_EXT\0" + "GL_TEXTURE_BORDER\0" + "GL_TEXTURE_BORDER_COLOR\0" + "GL_TEXTURE_BUFFER\0" + "GL_TEXTURE_BUFFER_DATA_STORE_BINDING\0" + "GL_TEXTURE_BUFFER_FORMAT\0" + "GL_TEXTURE_CLIPMAP_CENTER_SGIX\0" + "GL_TEXTURE_CLIPMAP_DEPTH_SGIX\0" + "GL_TEXTURE_CLIPMAP_FRAME_SGIX\0" + "GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX\0" + "GL_TEXTURE_CLIPMAP_OFFSET_SGIX\0" + "GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX\0" + "GL_TEXTURE_COLOR_TABLE_SGI\0" + "GL_TEXTURE_COLOR_WRITEMASK_SGIS\0" + "GL_TEXTURE_COMPARE_FAIL_VALUE_ARB\0" + "GL_TEXTURE_COMPARE_FUNC\0" + "GL_TEXTURE_COMPARE_FUNC_ARB\0" + "GL_TEXTURE_COMPARE_MODE\0" + "GL_TEXTURE_COMPARE_MODE_ARB\0" + "GL_TEXTURE_COMPARE_OPERATOR_SGIX\0" + "GL_TEXTURE_COMPARE_SGIX\0" + "GL_TEXTURE_COMPONENTS\0" + "GL_TEXTURE_COMPRESSED\0" + "GL_TEXTURE_COMPRESSED_ARB\0" + "GL_TEXTURE_COMPRESSED_FORMATS_ARB\0" + "GL_TEXTURE_COMPRESSED_IMAGE_SIZE\0" + "GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB\0" + "GL_TEXTURE_COMPRESSION_HINT\0" + "GL_TEXTURE_COMPRESSION_HINT_ARB\0" + "GL_TEXTURE_COORD_ARRAY\0" + "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING\0" + "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB\0" + "GL_TEXTURE_COORD_ARRAY_POINTER\0" + "GL_TEXTURE_COORD_ARRAY_SIZE\0" + "GL_TEXTURE_COORD_ARRAY_STRIDE\0" + "GL_TEXTURE_COORD_ARRAY_TYPE\0" + "GL_TEXTURE_CROP_RECT_OES\0" + "GL_TEXTURE_CUBE_MAP\0" + "GL_TEXTURE_CUBE_MAP_ARB\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_X\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES\0" + "GL_TEXTURE_CUBE_MAP_OES\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_X\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Y\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Z\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES\0" + "GL_TEXTURE_CUBE_MAP_SEAMLESS\0" + "GL_TEXTURE_DEPTH\0" + "GL_TEXTURE_DEPTH_SIZE\0" + "GL_TEXTURE_DEPTH_SIZE_ARB\0" + "GL_TEXTURE_ENV\0" + "GL_TEXTURE_ENV_COLOR\0" + "GL_TEXTURE_ENV_MODE\0" + "GL_TEXTURE_FILTER_CONTROL\0" + "GL_TEXTURE_FILTER_CONTROL_EXT\0" + "GL_TEXTURE_GEN_MODE\0" + "GL_TEXTURE_GEN_MODE_OES\0" + "GL_TEXTURE_GEN_Q\0" + "GL_TEXTURE_GEN_R\0" + "GL_TEXTURE_GEN_S\0" + "GL_TEXTURE_GEN_STR_OES\0" + "GL_TEXTURE_GEN_T\0" + "GL_TEXTURE_GEQUAL_R_SGIX\0" + "GL_TEXTURE_GREEN_SIZE\0" + "GL_TEXTURE_GREEN_SIZE_EXT\0" + "GL_TEXTURE_HEIGHT\0" + "GL_TEXTURE_INDEX_SIZE_EXT\0" + "GL_TEXTURE_INTENSITY_SIZE\0" + "GL_TEXTURE_INTENSITY_SIZE_EXT\0" + "GL_TEXTURE_INTERNAL_FORMAT\0" + "GL_TEXTURE_LEQUAL_R_SGIX\0" + "GL_TEXTURE_LOD_BIAS\0" + "GL_TEXTURE_LOD_BIAS_EXT\0" + "GL_TEXTURE_LOD_BIAS_R_SGIX\0" + "GL_TEXTURE_LOD_BIAS_S_SGIX\0" + "GL_TEXTURE_LOD_BIAS_T_SGIX\0" + "GL_TEXTURE_LUMINANCE_SIZE\0" + "GL_TEXTURE_LUMINANCE_SIZE_EXT\0" + "GL_TEXTURE_MAG_FILTER\0" + "GL_TEXTURE_MATRIX\0" + "GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES\0" + "GL_TEXTURE_MAX_ANISOTROPY_EXT\0" + "GL_TEXTURE_MAX_CLAMP_R_SGIX\0" + "GL_TEXTURE_MAX_CLAMP_S_SGIX\0" + "GL_TEXTURE_MAX_CLAMP_T_SGIX\0" + "GL_TEXTURE_MAX_LEVEL\0" + "GL_TEXTURE_MAX_LOD\0" + "GL_TEXTURE_MIN_FILTER\0" + "GL_TEXTURE_MIN_LOD\0" + "GL_TEXTURE_PRIORITY\0" + "GL_TEXTURE_RANGE_LENGTH_APPLE\0" + "GL_TEXTURE_RANGE_POINTER_APPLE\0" + "GL_TEXTURE_RECTANGLE\0" + "GL_TEXTURE_RECTANGLE_ARB\0" + "GL_TEXTURE_RECTANGLE_NV\0" + "GL_TEXTURE_RED_SIZE\0" + "GL_TEXTURE_RED_SIZE_EXT\0" + "GL_TEXTURE_RESIDENT\0" + "GL_TEXTURE_SHARED_SIZE\0" + "GL_TEXTURE_STACK_DEPTH\0" + "GL_TEXTURE_STENCIL_SIZE\0" + "GL_TEXTURE_STENCIL_SIZE_EXT\0" + "GL_TEXTURE_STORAGE_HINT_APPLE\0" + "GL_TEXTURE_TOO_LARGE_EXT\0" + "GL_TEXTURE_UNSIGNED_REMAP_MODE_NV\0" + "GL_TEXTURE_WIDTH\0" + "GL_TEXTURE_WRAP_R\0" + "GL_TEXTURE_WRAP_R_OES\0" + "GL_TEXTURE_WRAP_S\0" + "GL_TEXTURE_WRAP_T\0" + "GL_TIMEOUT_EXPIRED\0" + "GL_TIME_ELAPSED_EXT\0" + "GL_TRACK_MATRIX_NV\0" + "GL_TRACK_MATRIX_TRANSFORM_NV\0" + "GL_TRANSFORM_BIT\0" + "GL_TRANSFORM_FEEDBACK\0" + "GL_TRANSFORM_FEEDBACK_BINDING\0" + "GL_TRANSFORM_FEEDBACK_BUFFER\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_EXT\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_MODE\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_START\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT\0" + "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN\0" + "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT\0" + "GL_TRANSFORM_FEEDBACK_VARYINGS\0" + "GL_TRANSFORM_FEEDBACK_VARYINGS_EXT\0" + "GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH\0" + "GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT\0" + "GL_TRANSPOSE_COLOR_MATRIX\0" + "GL_TRANSPOSE_COLOR_MATRIX_ARB\0" + "GL_TRANSPOSE_CURRENT_MATRIX_ARB\0" + "GL_TRANSPOSE_MODELVIEW_MATRIX\0" + "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB\0" + "GL_TRANSPOSE_NV\0" + "GL_TRANSPOSE_PROJECTION_MATRIX\0" + "GL_TRANSPOSE_PROJECTION_MATRIX_ARB\0" + "GL_TRANSPOSE_TEXTURE_MATRIX\0" + "GL_TRANSPOSE_TEXTURE_MATRIX_ARB\0" + "GL_TRIANGLES\0" + "GL_TRIANGLES_ADJACENCY\0" + "GL_TRIANGLES_ADJACENCY_ARB\0" + "GL_TRIANGLE_FAN\0" + "GL_TRIANGLE_MESH_SUN\0" + "GL_TRIANGLE_STRIP\0" + "GL_TRIANGLE_STRIP_ADJACENCY\0" + "GL_TRIANGLE_STRIP_ADJACENCY_ARB\0" + "GL_TRUE\0" + "GL_UNDEFINED_APPLE\0" + "GL_UNPACK_ALIGNMENT\0" + "GL_UNPACK_IMAGE_HEIGHT\0" + "GL_UNPACK_LSB_FIRST\0" + "GL_UNPACK_ROW_LENGTH\0" + "GL_UNPACK_SKIP_IMAGES\0" + "GL_UNPACK_SKIP_PIXELS\0" + "GL_UNPACK_SKIP_ROWS\0" + "GL_UNPACK_SWAP_BYTES\0" + "GL_UNSIGNALED\0" + "GL_UNSIGNED_BYTE\0" + "GL_UNSIGNED_BYTE_2_3_3_REV\0" + "GL_UNSIGNED_BYTE_3_3_2\0" + "GL_UNSIGNED_INT\0" + "GL_UNSIGNED_INT_10F_11F_11F_REV\0" + "GL_UNSIGNED_INT_10_10_10_2\0" + "GL_UNSIGNED_INT_10_10_10_2_OES\0" + "GL_UNSIGNED_INT_24_8\0" + "GL_UNSIGNED_INT_24_8_EXT\0" + "GL_UNSIGNED_INT_24_8_NV\0" + "GL_UNSIGNED_INT_24_8_OES\0" + "GL_UNSIGNED_INT_2_10_10_10_REV\0" + "GL_UNSIGNED_INT_2_10_10_10_REV_EXT\0" + "GL_UNSIGNED_INT_5_9_9_9_REV\0" + "GL_UNSIGNED_INT_8_8_8_8\0" + "GL_UNSIGNED_INT_8_8_8_8_REV\0" + "GL_UNSIGNED_INT_SAMPLER_1D\0" + "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY\0" + "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT\0" + "GL_UNSIGNED_INT_SAMPLER_1D_EXT\0" + "GL_UNSIGNED_INT_SAMPLER_2D\0" + "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY\0" + "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT\0" + "GL_UNSIGNED_INT_SAMPLER_2D_EXT\0" + "GL_UNSIGNED_INT_SAMPLER_2D_RECT\0" + "GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT\0" + "GL_UNSIGNED_INT_SAMPLER_3D\0" + "GL_UNSIGNED_INT_SAMPLER_3D_EXT\0" + "GL_UNSIGNED_INT_SAMPLER_BUFFER\0" + "GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT\0" + "GL_UNSIGNED_INT_SAMPLER_CUBE\0" + "GL_UNSIGNED_INT_SAMPLER_CUBE_EXT\0" + "GL_UNSIGNED_INT_VEC2\0" + "GL_UNSIGNED_INT_VEC2_EXT\0" + "GL_UNSIGNED_INT_VEC3\0" + "GL_UNSIGNED_INT_VEC3_EXT\0" + "GL_UNSIGNED_INT_VEC4\0" + "GL_UNSIGNED_INT_VEC4_EXT\0" + "GL_UNSIGNED_NORMALIZED\0" + "GL_UNSIGNED_SHORT\0" + "GL_UNSIGNED_SHORT_1_5_5_5_REV\0" + "GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT\0" + "GL_UNSIGNED_SHORT_4_4_4_4\0" + "GL_UNSIGNED_SHORT_4_4_4_4_REV\0" + "GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT\0" + "GL_UNSIGNED_SHORT_5_5_5_1\0" + "GL_UNSIGNED_SHORT_5_6_5\0" + "GL_UNSIGNED_SHORT_5_6_5_REV\0" + "GL_UNSIGNED_SHORT_8_8_APPLE\0" + "GL_UNSIGNED_SHORT_8_8_MESA\0" + "GL_UNSIGNED_SHORT_8_8_REV_APPLE\0" + "GL_UNSIGNED_SHORT_8_8_REV_MESA\0" + "GL_UPPER_LEFT\0" + "GL_V2F\0" + "GL_V3F\0" + "GL_VALIDATE_STATUS\0" + "GL_VENDOR\0" + "GL_VERSION\0" + "GL_VERTEX_ARRAY\0" + "GL_VERTEX_ARRAY_BINDING\0" + "GL_VERTEX_ARRAY_BINDING_APPLE\0" + "GL_VERTEX_ARRAY_BUFFER_BINDING\0" + "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB\0" + "GL_VERTEX_ARRAY_POINTER\0" + "GL_VERTEX_ARRAY_SIZE\0" + "GL_VERTEX_ARRAY_STRIDE\0" + "GL_VERTEX_ARRAY_TYPE\0" + "GL_VERTEX_ATTRIB_ARRAY0_NV\0" + "GL_VERTEX_ATTRIB_ARRAY10_NV\0" + "GL_VERTEX_ATTRIB_ARRAY11_NV\0" + "GL_VERTEX_ATTRIB_ARRAY12_NV\0" + "GL_VERTEX_ATTRIB_ARRAY13_NV\0" + "GL_VERTEX_ATTRIB_ARRAY14_NV\0" + "GL_VERTEX_ATTRIB_ARRAY15_NV\0" + "GL_VERTEX_ATTRIB_ARRAY1_NV\0" + "GL_VERTEX_ATTRIB_ARRAY2_NV\0" + "GL_VERTEX_ATTRIB_ARRAY3_NV\0" + "GL_VERTEX_ATTRIB_ARRAY4_NV\0" + "GL_VERTEX_ATTRIB_ARRAY5_NV\0" + "GL_VERTEX_ATTRIB_ARRAY6_NV\0" + "GL_VERTEX_ATTRIB_ARRAY7_NV\0" + "GL_VERTEX_ATTRIB_ARRAY8_NV\0" + "GL_VERTEX_ATTRIB_ARRAY9_NV\0" + "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING\0" + "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_ENABLED\0" + "GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_INTEGER\0" + "GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT\0" + "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED\0" + "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_POINTER\0" + "GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_SIZE\0" + "GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_STRIDE\0" + "GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB\0" + "GL_VERTEX_ATTRIB_ARRAY_TYPE\0" + "GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB\0" + "GL_VERTEX_BLEND_ARB\0" + "GL_VERTEX_PROGRAM_ARB\0" + "GL_VERTEX_PROGRAM_BINDING_NV\0" + "GL_VERTEX_PROGRAM_NV\0" + "GL_VERTEX_PROGRAM_POINT_SIZE\0" + "GL_VERTEX_PROGRAM_POINT_SIZE_ARB\0" + "GL_VERTEX_PROGRAM_POINT_SIZE_NV\0" + "GL_VERTEX_PROGRAM_TWO_SIDE\0" + "GL_VERTEX_PROGRAM_TWO_SIDE_ARB\0" + "GL_VERTEX_PROGRAM_TWO_SIDE_NV\0" + "GL_VERTEX_SHADER\0" + "GL_VERTEX_SHADER_ARB\0" + "GL_VERTEX_STATE_PROGRAM_NV\0" + "GL_VIEWPORT\0" + "GL_VIEWPORT_BIT\0" + "GL_VOLATILE_APPLE\0" + "GL_WAIT_FAILED\0" + "GL_WEIGHT_ARRAY_ARB\0" + "GL_WEIGHT_ARRAY_BUFFER_BINDING\0" + "GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB\0" + "GL_WEIGHT_ARRAY_BUFFER_BINDING_OES\0" + "GL_WEIGHT_ARRAY_OES\0" + "GL_WEIGHT_ARRAY_POINTER_ARB\0" + "GL_WEIGHT_ARRAY_POINTER_OES\0" + "GL_WEIGHT_ARRAY_SIZE_ARB\0" + "GL_WEIGHT_ARRAY_SIZE_OES\0" + "GL_WEIGHT_ARRAY_STRIDE_ARB\0" + "GL_WEIGHT_ARRAY_STRIDE_OES\0" + "GL_WEIGHT_ARRAY_TYPE_ARB\0" + "GL_WEIGHT_ARRAY_TYPE_OES\0" + "GL_WEIGHT_SUM_UNITY_ARB\0" + "GL_WRAP_BORDER_SUN\0" + "GL_WRITE_ONLY\0" + "GL_WRITE_ONLY_ARB\0" + "GL_WRITE_ONLY_OES\0" + "GL_XOR\0" + "GL_YCBCR_422_APPLE\0" + "GL_YCBCR_MESA\0" + "GL_ZERO\0" + "GL_ZOOM_X\0" + "GL_ZOOM_Y\0" + ; + +static const enum_elt all_enums[2295] = +{ + { 0, 0x00000600 }, /* GL_2D */ + { 6, 0x00001407 }, /* GL_2_BYTES */ + { 17, 0x00000601 }, /* GL_3D */ + { 23, 0x00000602 }, /* GL_3D_COLOR */ + { 35, 0x00000603 }, /* GL_3D_COLOR_TEXTURE */ + { 55, 0x00001408 }, /* GL_3_BYTES */ + { 66, 0x00000604 }, /* GL_4D_COLOR_TEXTURE */ + { 86, 0x00001409 }, /* GL_4_BYTES */ + { 97, 0x00000100 }, /* GL_ACCUM */ + { 106, 0x00000D5B }, /* GL_ACCUM_ALPHA_BITS */ + { 126, 0x00000D5A }, /* GL_ACCUM_BLUE_BITS */ + { 145, 0x00000200 }, /* GL_ACCUM_BUFFER_BIT */ + { 165, 0x00000B80 }, /* GL_ACCUM_CLEAR_VALUE */ + { 186, 0x00000D59 }, /* GL_ACCUM_GREEN_BITS */ + { 206, 0x00000D58 }, /* GL_ACCUM_RED_BITS */ + { 224, 0x00008B89 }, /* GL_ACTIVE_ATTRIBUTES */ + { 245, 0x00008B8A }, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ + { 276, 0x00008B8D }, /* GL_ACTIVE_PROGRAM_EXT */ + { 298, 0x00008911 }, /* GL_ACTIVE_STENCIL_FACE_EXT */ + { 325, 0x000084E0 }, /* GL_ACTIVE_TEXTURE */ + { 343, 0x000084E0 }, /* GL_ACTIVE_TEXTURE_ARB */ + { 365, 0x00008B86 }, /* GL_ACTIVE_UNIFORMS */ + { 384, 0x00008B87 }, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ + { 413, 0x000086A5 }, /* GL_ACTIVE_VERTEX_UNITS_ARB */ + { 440, 0x00000104 }, /* GL_ADD */ + { 447, 0x00008574 }, /* GL_ADD_SIGNED */ + { 461, 0x00008574 }, /* GL_ADD_SIGNED_ARB */ + { 479, 0x00008574 }, /* GL_ADD_SIGNED_EXT */ + { 497, 0x0000846E }, /* GL_ALIASED_LINE_WIDTH_RANGE */ + { 525, 0x0000846D }, /* GL_ALIASED_POINT_SIZE_RANGE */ + { 553, 0x000FFFFF }, /* GL_ALL_ATTRIB_BITS */ + { 572, 0xFFFFFFFF }, /* GL_ALL_CLIENT_ATTRIB_BITS */ + { 598, 0x00001906 }, /* GL_ALPHA */ + { 607, 0x0000803D }, /* GL_ALPHA12 */ + { 618, 0x0000803D }, /* GL_ALPHA12_EXT */ + { 633, 0x0000803E }, /* GL_ALPHA16 */ + { 644, 0x00008D8A }, /* GL_ALPHA16I_EXT */ + { 660, 0x00008D78 }, /* GL_ALPHA16UI_EXT */ + { 677, 0x0000803E }, /* GL_ALPHA16_EXT */ + { 692, 0x00008D84 }, /* GL_ALPHA32I_EXT */ + { 708, 0x00008D72 }, /* GL_ALPHA32UI_EXT */ + { 725, 0x0000803B }, /* GL_ALPHA4 */ + { 735, 0x0000803B }, /* GL_ALPHA4_EXT */ + { 749, 0x0000803C }, /* GL_ALPHA8 */ + { 759, 0x00008D90 }, /* GL_ALPHA8I_EXT */ + { 774, 0x00008D7E }, /* GL_ALPHA8UI_EXT */ + { 790, 0x0000803C }, /* GL_ALPHA8_EXT */ + { 804, 0x00000D1D }, /* GL_ALPHA_BIAS */ + { 818, 0x00000D55 }, /* GL_ALPHA_BITS */ + { 832, 0x00008D97 }, /* GL_ALPHA_INTEGER_EXT */ + { 853, 0x00000D1C }, /* GL_ALPHA_SCALE */ + { 868, 0x00000BC0 }, /* GL_ALPHA_TEST */ + { 882, 0x00000BC1 }, /* GL_ALPHA_TEST_FUNC */ + { 901, 0x00000BC2 }, /* GL_ALPHA_TEST_REF */ + { 919, 0x0000911A }, /* GL_ALREADY_SIGNALED */ + { 939, 0x00000207 }, /* GL_ALWAYS */ + { 949, 0x00001200 }, /* GL_AMBIENT */ + { 960, 0x00001602 }, /* GL_AMBIENT_AND_DIFFUSE */ + { 983, 0x00001501 }, /* GL_AND */ + { 990, 0x00001504 }, /* GL_AND_INVERTED */ + { 1006, 0x00001502 }, /* GL_AND_REVERSE */ + { 1021, 0x00008892 }, /* GL_ARRAY_BUFFER */ + { 1037, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING */ + { 1061, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING_ARB */ + { 1089, 0x00008B85 }, /* GL_ATTACHED_SHADERS */ + { 1109, 0x00008645 }, /* GL_ATTRIB_ARRAY_POINTER_NV */ + { 1136, 0x00008623 }, /* GL_ATTRIB_ARRAY_SIZE_NV */ + { 1160, 0x00008624 }, /* GL_ATTRIB_ARRAY_STRIDE_NV */ + { 1186, 0x00008625 }, /* GL_ATTRIB_ARRAY_TYPE_NV */ + { 1210, 0x00000BB0 }, /* GL_ATTRIB_STACK_DEPTH */ + { 1232, 0x00000D80 }, /* GL_AUTO_NORMAL */ + { 1247, 0x00000409 }, /* GL_AUX0 */ + { 1255, 0x0000040A }, /* GL_AUX1 */ + { 1263, 0x0000040B }, /* GL_AUX2 */ + { 1271, 0x0000040C }, /* GL_AUX3 */ + { 1279, 0x00000C00 }, /* GL_AUX_BUFFERS */ + { 1294, 0x00000405 }, /* GL_BACK */ + { 1302, 0x00000402 }, /* GL_BACK_LEFT */ + { 1315, 0x00000403 }, /* GL_BACK_RIGHT */ + { 1329, 0x000080E0 }, /* GL_BGR */ + { 1336, 0x000080E1 }, /* GL_BGRA */ + { 1344, 0x000080E1 }, /* GL_BGRA_EXT */ + { 1356, 0x00008D9B }, /* GL_BGRA_INTEGER */ + { 1372, 0x00008D9B }, /* GL_BGRA_INTEGER_EXT */ + { 1392, 0x00008D9A }, /* GL_BGR_INTEGER */ + { 1407, 0x00008D9A }, /* GL_BGR_INTEGER_EXT */ + { 1426, 0x00001A00 }, /* GL_BITMAP */ + { 1436, 0x00000704 }, /* GL_BITMAP_TOKEN */ + { 1452, 0x00000BE2 }, /* GL_BLEND */ + { 1461, 0x00008005 }, /* GL_BLEND_COLOR */ + { 1476, 0x00008005 }, /* GL_BLEND_COLOR_EXT */ + { 1495, 0x00000BE0 }, /* GL_BLEND_DST */ + { 1508, 0x000080CA }, /* GL_BLEND_DST_ALPHA */ + { 1527, 0x000080CA }, /* GL_BLEND_DST_ALPHA_OES */ + { 1550, 0x000080C8 }, /* GL_BLEND_DST_RGB */ + { 1567, 0x000080C8 }, /* GL_BLEND_DST_RGB_OES */ + { 1588, 0x00008009 }, /* GL_BLEND_EQUATION */ + { 1606, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA */ + { 1630, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */ + { 1658, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_OES */ + { 1686, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */ + { 1708, 0x00008009 }, /* GL_BLEND_EQUATION_OES */ + { 1730, 0x00008009 }, /* GL_BLEND_EQUATION_RGB */ + { 1752, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */ + { 1778, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_OES */ + { 1804, 0x00000BE1 }, /* GL_BLEND_SRC */ + { 1817, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */ + { 1836, 0x000080CB }, /* GL_BLEND_SRC_ALPHA_OES */ + { 1859, 0x000080C9 }, /* GL_BLEND_SRC_RGB */ + { 1876, 0x000080C9 }, /* GL_BLEND_SRC_RGB_OES */ + { 1897, 0x00001905 }, /* GL_BLUE */ + { 1905, 0x00000D1B }, /* GL_BLUE_BIAS */ + { 1918, 0x00000D54 }, /* GL_BLUE_BITS */ + { 1931, 0x00008D96 }, /* GL_BLUE_INTEGER */ + { 1947, 0x00008D96 }, /* GL_BLUE_INTEGER_EXT */ + { 1967, 0x00000D1A }, /* GL_BLUE_SCALE */ + { 1981, 0x00008B56 }, /* GL_BOOL */ + { 1989, 0x00008B56 }, /* GL_BOOL_ARB */ + { 2001, 0x00008B57 }, /* GL_BOOL_VEC2 */ + { 2014, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */ + { 2031, 0x00008B58 }, /* GL_BOOL_VEC3 */ + { 2044, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */ + { 2061, 0x00008B59 }, /* GL_BOOL_VEC4 */ + { 2074, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */ + { 2091, 0x000088BB }, /* GL_BUFFER_ACCESS */ + { 2108, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */ + { 2129, 0x0000911F }, /* GL_BUFFER_ACCESS_FLAGS */ + { 2152, 0x000088BB }, /* GL_BUFFER_ACCESS_OES */ + { 2173, 0x00008A13 }, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ + { 2204, 0x000088BC }, /* GL_BUFFER_MAPPED */ + { 2221, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */ + { 2242, 0x000088BC }, /* GL_BUFFER_MAPPED_OES */ + { 2263, 0x00009120 }, /* GL_BUFFER_MAP_LENGTH */ + { 2284, 0x00009121 }, /* GL_BUFFER_MAP_OFFSET */ + { 2305, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */ + { 2327, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */ + { 2353, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_OES */ + { 2379, 0x000085B3 }, /* GL_BUFFER_OBJECT_APPLE */ + { 2402, 0x00008A12 }, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ + { 2436, 0x00008764 }, /* GL_BUFFER_SIZE */ + { 2451, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */ + { 2470, 0x00008765 }, /* GL_BUFFER_USAGE */ + { 2486, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */ + { 2506, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */ + { 2525, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */ + { 2551, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */ + { 2574, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ + { 2602, 0x0000877C }, /* GL_BUMP_TARGET_ATI */ + { 2621, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */ + { 2643, 0x00001400 }, /* GL_BYTE */ + { 2651, 0x00002A24 }, /* GL_C3F_V3F */ + { 2662, 0x00002A26 }, /* GL_C4F_N3F_V3F */ + { 2677, 0x00002A22 }, /* GL_C4UB_V2F */ + { 2689, 0x00002A23 }, /* GL_C4UB_V3F */ + { 2701, 0x00000901 }, /* GL_CCW */ + { 2708, 0x00002900 }, /* GL_CLAMP */ + { 2717, 0x0000891C }, /* GL_CLAMP_READ_COLOR */ + { 2737, 0x0000812D }, /* GL_CLAMP_TO_BORDER */ + { 2756, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */ + { 2779, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */ + { 2803, 0x0000812F }, /* GL_CLAMP_TO_EDGE */ + { 2820, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */ + { 2842, 0x00001500 }, /* GL_CLEAR */ + { 2851, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */ + { 2876, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */ + { 2905, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */ + { 2931, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ + { 2960, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */ + { 2986, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */ + { 3013, 0x00003000 }, /* GL_CLIP_DISTANCE0 */ + { 3031, 0x00003001 }, /* GL_CLIP_DISTANCE1 */ + { 3049, 0x00003002 }, /* GL_CLIP_DISTANCE2 */ + { 3067, 0x00003003 }, /* GL_CLIP_DISTANCE3 */ + { 3085, 0x00003004 }, /* GL_CLIP_DISTANCE4 */ + { 3103, 0x00003005 }, /* GL_CLIP_DISTANCE5 */ + { 3121, 0x00003006 }, /* GL_CLIP_DISTANCE6 */ + { 3139, 0x00003007 }, /* GL_CLIP_DISTANCE7 */ + { 3157, 0x00003000 }, /* GL_CLIP_PLANE0 */ + { 3172, 0x00003001 }, /* GL_CLIP_PLANE1 */ + { 3187, 0x00003002 }, /* GL_CLIP_PLANE2 */ + { 3202, 0x00003003 }, /* GL_CLIP_PLANE3 */ + { 3217, 0x00003004 }, /* GL_CLIP_PLANE4 */ + { 3232, 0x00003005 }, /* GL_CLIP_PLANE5 */ + { 3247, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ + { 3280, 0x00000A00 }, /* GL_COEFF */ + { 3289, 0x00001800 }, /* GL_COLOR */ + { 3298, 0x00008076 }, /* GL_COLOR_ARRAY */ + { 3313, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */ + { 3343, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 3377, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */ + { 3400, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */ + { 3420, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */ + { 3442, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */ + { 3462, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */ + { 3483, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */ + { 3508, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_OES */ + { 3533, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */ + { 3554, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */ + { 3576, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */ + { 3602, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */ + { 3624, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */ + { 3650, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */ + { 3672, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */ + { 3698, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */ + { 3720, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */ + { 3746, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */ + { 3768, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */ + { 3794, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */ + { 3816, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */ + { 3842, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */ + { 3867, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */ + { 3888, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */ + { 3913, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */ + { 3934, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */ + { 3959, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */ + { 3980, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */ + { 4005, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */ + { 4026, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */ + { 4051, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */ + { 4072, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */ + { 4097, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */ + { 4118, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */ + { 4143, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */ + { 4164, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */ + { 4189, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */ + { 4210, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */ + { 4235, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */ + { 4255, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */ + { 4276, 0x00001900 }, /* GL_COLOR_INDEX */ + { 4291, 0x00001603 }, /* GL_COLOR_INDEXES */ + { 4308, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */ + { 4326, 0x00000B57 }, /* GL_COLOR_MATERIAL */ + { 4344, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */ + { 4367, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */ + { 4395, 0x000080B1 }, /* GL_COLOR_MATRIX */ + { 4411, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */ + { 4431, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */ + { 4459, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 4491, 0x00008458 }, /* GL_COLOR_SUM */ + { 4504, 0x00008458 }, /* GL_COLOR_SUM_ARB */ + { 4521, 0x000080D0 }, /* GL_COLOR_TABLE */ + { 4536, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */ + { 4562, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */ + { 4592, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */ + { 4622, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */ + { 4642, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */ + { 4666, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */ + { 4691, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */ + { 4720, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */ + { 4749, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */ + { 4771, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */ + { 4797, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */ + { 4823, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */ + { 4849, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */ + { 4879, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */ + { 4909, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */ + { 4939, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */ + { 4973, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */ + { 5007, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ + { 5037, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */ + { 5071, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */ + { 5105, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */ + { 5129, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */ + { 5157, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */ + { 5185, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */ + { 5206, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */ + { 5231, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */ + { 5252, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */ + { 5277, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */ + { 5302, 0x00000C23 }, /* GL_COLOR_WRITEMASK */ + { 5321, 0x00008570 }, /* GL_COMBINE */ + { 5332, 0x00008503 }, /* GL_COMBINE4 */ + { 5344, 0x00008572 }, /* GL_COMBINE_ALPHA */ + { 5361, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */ + { 5382, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */ + { 5403, 0x00008570 }, /* GL_COMBINE_ARB */ + { 5418, 0x00008570 }, /* GL_COMBINE_EXT */ + { 5433, 0x00008571 }, /* GL_COMBINE_RGB */ + { 5448, 0x00008571 }, /* GL_COMBINE_RGB_ARB */ + { 5467, 0x00008571 }, /* GL_COMBINE_RGB_EXT */ + { 5486, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */ + { 5522, 0x0000884E }, /* GL_COMPARE_REF_TO_TEXTURE */ + { 5548, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */ + { 5572, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */ + { 5600, 0x00001300 }, /* GL_COMPILE */ + { 5611, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */ + { 5634, 0x00008B81 }, /* GL_COMPILE_STATUS */ + { 5652, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */ + { 5672, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */ + { 5696, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */ + { 5720, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */ + { 5748, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */ + { 5772, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */ + { 5802, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */ + { 5836, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */ + { 5864, 0x00008225 }, /* GL_COMPRESSED_RED */ + { 5882, 0x00008226 }, /* GL_COMPRESSED_RG */ + { 5899, 0x000084ED }, /* GL_COMPRESSED_RGB */ + { 5917, 0x000084EE }, /* GL_COMPRESSED_RGBA */ + { 5936, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */ + { 5959, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ + { 5988, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ + { 6021, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ + { 6054, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ + { 6087, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */ + { 6109, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */ + { 6137, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ + { 6169, 0x00008C4A }, /* GL_COMPRESSED_SLUMINANCE */ + { 6194, 0x00008C4B }, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ + { 6225, 0x00008C48 }, /* GL_COMPRESSED_SRGB */ + { 6244, 0x00008C49 }, /* GL_COMPRESSED_SRGB_ALPHA */ + { 6269, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */ + { 6299, 0x0000911C }, /* GL_CONDITION_SATISFIED */ + { 6322, 0x00008576 }, /* GL_CONSTANT */ + { 6334, 0x00008003 }, /* GL_CONSTANT_ALPHA */ + { 6352, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */ + { 6374, 0x00008576 }, /* GL_CONSTANT_ARB */ + { 6390, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */ + { 6414, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */ + { 6436, 0x00008001 }, /* GL_CONSTANT_COLOR */ + { 6454, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */ + { 6476, 0x00008576 }, /* GL_CONSTANT_EXT */ + { 6492, 0x00000002 }, /* GL_CONTEXT_COMPATIBILITY_PROFILE_BIT */ + { 6529, 0x00000001 }, /* GL_CONTEXT_CORE_PROFILE_BIT */ + { 6557, 0x0000821E }, /* GL_CONTEXT_FLAGS */ + { 6574, 0x00000001 }, /* GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ + { 6613, 0x00009126 }, /* GL_CONTEXT_PROFILE_MASK */ + { 6637, 0x00008010 }, /* GL_CONVOLUTION_1D */ + { 6655, 0x00008011 }, /* GL_CONVOLUTION_2D */ + { 6673, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */ + { 6701, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */ + { 6732, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */ + { 6759, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */ + { 6790, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */ + { 6817, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */ + { 6848, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */ + { 6876, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */ + { 6908, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */ + { 6930, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */ + { 6956, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */ + { 6978, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */ + { 7004, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */ + { 7025, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */ + { 7050, 0x00008862 }, /* GL_COORD_REPLACE */ + { 7067, 0x00008862 }, /* GL_COORD_REPLACE_ARB */ + { 7088, 0x00008862 }, /* GL_COORD_REPLACE_NV */ + { 7108, 0x00008862 }, /* GL_COORD_REPLACE_OES */ + { 7129, 0x00001503 }, /* GL_COPY */ + { 7137, 0x0000150C }, /* GL_COPY_INVERTED */ + { 7154, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ + { 7174, 0x00008F36 }, /* GL_COPY_READ_BUFFER */ + { 7194, 0x00008F37 }, /* GL_COPY_WRITE_BUFFER */ + { 7215, 0x00000B44 }, /* GL_CULL_FACE */ + { 7228, 0x00000B45 }, /* GL_CULL_FACE_MODE */ + { 7246, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ + { 7265, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + { 7297, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + { 7332, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ + { 7353, 0x00000001 }, /* GL_CURRENT_BIT */ + { 7368, 0x00000B00 }, /* GL_CURRENT_COLOR */ + { 7385, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ + { 7406, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ + { 7432, 0x00000B01 }, /* GL_CURRENT_INDEX */ + { 7449, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ + { 7471, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ + { 7499, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ + { 7520, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + { 7554, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ + { 7587, 0x00000B02 }, /* GL_CURRENT_NORMAL */ + { 7605, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + { 7635, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_OES */ + { 7665, 0x00008B8D }, /* GL_CURRENT_PROGRAM */ + { 7684, 0x00008865 }, /* GL_CURRENT_QUERY */ + { 7701, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ + { 7722, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ + { 7746, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ + { 7773, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ + { 7797, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ + { 7824, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ + { 7857, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ + { 7891, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + { 7924, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ + { 7951, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ + { 7977, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */ + { 8002, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ + { 8031, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ + { 8053, 0x00000900 }, /* GL_CW */ + { 8059, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */ + { 8080, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */ + { 8101, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */ + { 8121, 0x00002101 }, /* GL_DECAL */ + { 8130, 0x00001E03 }, /* GL_DECR */ + { 8138, 0x00008508 }, /* GL_DECR_WRAP */ + { 8151, 0x00008508 }, /* GL_DECR_WRAP_EXT */ + { 8168, 0x00008B80 }, /* GL_DELETE_STATUS */ + { 8185, 0x00001801 }, /* GL_DEPTH */ + { 8194, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ + { 8214, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */ + { 8238, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_OES */ + { 8262, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ + { 8282, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ + { 8306, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_OES */ + { 8330, 0x00000D1F }, /* GL_DEPTH_BIAS */ + { 8344, 0x00000D56 }, /* GL_DEPTH_BITS */ + { 8358, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ + { 8378, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ + { 8403, 0x00008223 }, /* GL_DEPTH_BUFFER */ + { 8419, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ + { 8439, 0x0000864F }, /* GL_DEPTH_CLAMP */ + { 8454, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ + { 8472, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ + { 8493, 0x00001902 }, /* GL_DEPTH_COMPONENT */ + { 8512, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ + { 8533, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ + { 8558, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_OES */ + { 8583, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ + { 8609, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ + { 8630, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ + { 8655, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_OES */ + { 8680, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ + { 8706, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ + { 8727, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ + { 8752, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_OES */ + { 8777, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ + { 8803, 0x00000B74 }, /* GL_DEPTH_FUNC */ + { 8817, 0x00000B70 }, /* GL_DEPTH_RANGE */ + { 8832, 0x00000D1E }, /* GL_DEPTH_SCALE */ + { 8847, 0x000084F9 }, /* GL_DEPTH_STENCIL */ + { 8864, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ + { 8892, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */ + { 8913, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ + { 8933, 0x000084F9 }, /* GL_DEPTH_STENCIL_OES */ + { 8954, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + { 8982, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + { 9010, 0x00000B71 }, /* GL_DEPTH_TEST */ + { 9024, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ + { 9046, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ + { 9072, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ + { 9091, 0x00001201 }, /* GL_DIFFUSE */ + { 9102, 0x00000BD0 }, /* GL_DITHER */ + { 9112, 0x00000A02 }, /* GL_DOMAIN */ + { 9122, 0x00001100 }, /* GL_DONT_CARE */ + { 9135, 0x000086AE }, /* GL_DOT3_RGB */ + { 9147, 0x000086AF }, /* GL_DOT3_RGBA */ + { 9160, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ + { 9177, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ + { 9194, 0x000086AE }, /* GL_DOT3_RGB_ARB */ + { 9210, 0x00008740 }, /* GL_DOT3_RGB_EXT */ + { 9226, 0x0000140A }, /* GL_DOUBLE */ + { 9236, 0x00000C32 }, /* GL_DOUBLEBUFFER */ + { 9252, 0x00000C01 }, /* GL_DRAW_BUFFER */ + { 9267, 0x00008825 }, /* GL_DRAW_BUFFER0 */ + { 9283, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ + { 9303, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ + { 9323, 0x00008826 }, /* GL_DRAW_BUFFER1 */ + { 9339, 0x0000882F }, /* GL_DRAW_BUFFER10 */ + { 9356, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ + { 9377, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ + { 9398, 0x00008830 }, /* GL_DRAW_BUFFER11 */ + { 9415, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ + { 9436, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ + { 9457, 0x00008831 }, /* GL_DRAW_BUFFER12 */ + { 9474, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ + { 9495, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ + { 9516, 0x00008832 }, /* GL_DRAW_BUFFER13 */ + { 9533, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ + { 9554, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ + { 9575, 0x00008833 }, /* GL_DRAW_BUFFER14 */ + { 9592, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ + { 9613, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ + { 9634, 0x00008834 }, /* GL_DRAW_BUFFER15 */ + { 9651, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ + { 9672, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ + { 9693, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ + { 9713, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ + { 9733, 0x00008827 }, /* GL_DRAW_BUFFER2 */ + { 9749, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ + { 9769, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ + { 9789, 0x00008828 }, /* GL_DRAW_BUFFER3 */ + { 9805, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ + { 9825, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ + { 9845, 0x00008829 }, /* GL_DRAW_BUFFER4 */ + { 9861, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ + { 9881, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ + { 9901, 0x0000882A }, /* GL_DRAW_BUFFER5 */ + { 9917, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ + { 9937, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ + { 9957, 0x0000882B }, /* GL_DRAW_BUFFER6 */ + { 9973, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ + { 9993, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ + { 10013, 0x0000882C }, /* GL_DRAW_BUFFER7 */ + { 10029, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ + { 10049, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ + { 10069, 0x0000882D }, /* GL_DRAW_BUFFER8 */ + { 10085, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ + { 10105, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ + { 10125, 0x0000882E }, /* GL_DRAW_BUFFER9 */ + { 10141, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ + { 10161, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ + { 10181, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ + { 10201, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */ + { 10229, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ + { 10261, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ + { 10285, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ + { 10305, 0x00000304 }, /* GL_DST_ALPHA */ + { 10318, 0x00000306 }, /* GL_DST_COLOR */ + { 10331, 0x0000877A }, /* GL_DU8DV8_ATI */ + { 10345, 0x00008779 }, /* GL_DUDV_ATI */ + { 10357, 0x000088EA }, /* GL_DYNAMIC_COPY */ + { 10373, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ + { 10393, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ + { 10409, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ + { 10429, 0x000088E9 }, /* GL_DYNAMIC_READ */ + { 10445, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ + { 10465, 0x00000B43 }, /* GL_EDGE_FLAG */ + { 10478, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ + { 10497, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + { 10531, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ + { 10569, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ + { 10596, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + { 10622, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ + { 10646, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + { 10678, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ + { 10714, 0x00001600 }, /* GL_EMISSION */ + { 10726, 0x00002000 }, /* GL_ENABLE_BIT */ + { 10740, 0x00000202 }, /* GL_EQUAL */ + { 10749, 0x00001509 }, /* GL_EQUIV */ + { 10758, 0x00010000 }, /* GL_EVAL_BIT */ + { 10770, 0x00000800 }, /* GL_EXP */ + { 10777, 0x00000801 }, /* GL_EXP2 */ + { 10785, 0x00001F03 }, /* GL_EXTENSIONS */ + { 10799, 0x00002400 }, /* GL_EYE_LINEAR */ + { 10813, 0x00002502 }, /* GL_EYE_PLANE */ + { 10826, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ + { 10851, 0x0000855B }, /* GL_EYE_RADIAL_NV */ + { 10868, 0x00000000 }, /* GL_FALSE */ + { 10877, 0x00001101 }, /* GL_FASTEST */ + { 10888, 0x00001C01 }, /* GL_FEEDBACK */ + { 10900, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ + { 10927, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ + { 10951, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ + { 10975, 0x00001B02 }, /* GL_FILL */ + { 10983, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */ + { 11010, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ + { 11041, 0x0000140C }, /* GL_FIXED */ + { 11050, 0x0000140C }, /* GL_FIXED_OES */ + { 11063, 0x0000891D }, /* GL_FIXED_ONLY */ + { 11077, 0x00001D00 }, /* GL_FLAT */ + { 11085, 0x00001406 }, /* GL_FLOAT */ + { 11094, 0x00008B5A }, /* GL_FLOAT_MAT2 */ + { 11108, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ + { 11126, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ + { 11142, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ + { 11158, 0x00008B5B }, /* GL_FLOAT_MAT3 */ + { 11172, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ + { 11190, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ + { 11206, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ + { 11222, 0x00008B5C }, /* GL_FLOAT_MAT4 */ + { 11236, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ + { 11254, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ + { 11270, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ + { 11286, 0x00008B50 }, /* GL_FLOAT_VEC2 */ + { 11300, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ + { 11318, 0x00008B51 }, /* GL_FLOAT_VEC3 */ + { 11332, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ + { 11350, 0x00008B52 }, /* GL_FLOAT_VEC4 */ + { 11364, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ + { 11382, 0x00000B60 }, /* GL_FOG */ + { 11389, 0x00000080 }, /* GL_FOG_BIT */ + { 11400, 0x00000B66 }, /* GL_FOG_COLOR */ + { 11413, 0x00008451 }, /* GL_FOG_COORD */ + { 11426, 0x00008451 }, /* GL_FOG_COORDINATE */ + { 11444, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ + { 11468, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + { 11507, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ + { 11550, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + { 11582, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + { 11613, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + { 11642, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ + { 11667, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ + { 11686, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ + { 11720, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ + { 11747, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ + { 11773, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ + { 11797, 0x00008450 }, /* GL_FOG_COORD_SRC */ + { 11814, 0x00000B62 }, /* GL_FOG_DENSITY */ + { 11829, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ + { 11853, 0x00000B64 }, /* GL_FOG_END */ + { 11864, 0x00000C54 }, /* GL_FOG_HINT */ + { 11876, 0x00000B61 }, /* GL_FOG_INDEX */ + { 11889, 0x00000B65 }, /* GL_FOG_MODE */ + { 11901, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ + { 11920, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ + { 11945, 0x00000B63 }, /* GL_FOG_START */ + { 11958, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ + { 11976, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ + { 12000, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ + { 12019, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ + { 12042, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + { 12077, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES */ + { 12116, 0x00008D40 }, /* GL_FRAMEBUFFER */ + { 12131, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + { 12168, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + { 12204, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + { 12245, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + { 12286, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + { 12323, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + { 12360, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */ + { 12394, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB */ + { 12432, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + { 12470, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + { 12512, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES */ + { 12554, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + { 12592, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + { 12634, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES */ + { 12676, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + { 12711, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + { 12750, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + { 12799, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES */ + { 12848, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + { 12896, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + { 12948, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES */ + { 13000, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + { 13040, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ + { 13084, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + { 13124, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + { 13168, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES */ + { 13212, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */ + { 13235, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ + { 13262, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_OES */ + { 13289, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ + { 13313, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + { 13341, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_OES */ + { 13369, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ + { 13392, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ + { 13411, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + { 13448, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + { 13489, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES */ + { 13530, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS */ + { 13567, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + { 13608, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES */ + { 13649, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ + { 13687, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + { 13729, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES */ + { 13771, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + { 13822, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + { 13860, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES */ + { 13898, 0x00008DA9 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */ + { 13940, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */ + { 13980, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB */ + { 14024, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + { 14069, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + { 14118, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES */ + { 14167, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + { 14205, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */ + { 14247, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ + { 14285, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + { 14327, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES */ + { 14369, 0x00008D40 }, /* GL_FRAMEBUFFER_OES */ + { 14388, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + { 14420, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ + { 14445, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ + { 14472, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + { 14503, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_OES */ + { 14534, 0x00000404 }, /* GL_FRONT */ + { 14543, 0x00000408 }, /* GL_FRONT_AND_BACK */ + { 14561, 0x00000B46 }, /* GL_FRONT_FACE */ + { 14575, 0x00000400 }, /* GL_FRONT_LEFT */ + { 14589, 0x00000401 }, /* GL_FRONT_RIGHT */ + { 14604, 0x00008006 }, /* GL_FUNC_ADD */ + { 14616, 0x00008006 }, /* GL_FUNC_ADD_EXT */ + { 14632, 0x00008006 }, /* GL_FUNC_ADD_OES */ + { 14648, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ + { 14673, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ + { 14702, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_OES */ + { 14731, 0x0000800A }, /* GL_FUNC_SUBTRACT */ + { 14748, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ + { 14769, 0x0000800A }, /* GL_FUNC_SUBTRACT_OES */ + { 14790, 0x00008191 }, /* GL_GENERATE_MIPMAP */ + { 14809, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ + { 14833, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ + { 14862, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ + { 14886, 0x00008917 }, /* GL_GEOMETRY_INPUT_TYPE */ + { 14909, 0x00008DDB }, /* GL_GEOMETRY_INPUT_TYPE_ARB */ + { 14936, 0x00008918 }, /* GL_GEOMETRY_OUTPUT_TYPE */ + { 14960, 0x00008DDC }, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */ + { 14988, 0x00008DD9 }, /* GL_GEOMETRY_SHADER */ + { 15007, 0x00008DD9 }, /* GL_GEOMETRY_SHADER_ARB */ + { 15030, 0x00008916 }, /* GL_GEOMETRY_VERTICES_OUT */ + { 15055, 0x00008DDA }, /* GL_GEOMETRY_VERTICES_OUT_ARB */ + { 15084, 0x00000206 }, /* GL_GEQUAL */ + { 15094, 0x00000204 }, /* GL_GREATER */ + { 15105, 0x00001904 }, /* GL_GREEN */ + { 15114, 0x00000D19 }, /* GL_GREEN_BIAS */ + { 15128, 0x00000D53 }, /* GL_GREEN_BITS */ + { 15142, 0x00008D95 }, /* GL_GREEN_INTEGER */ + { 15159, 0x00008D95 }, /* GL_GREEN_INTEGER_EXT */ + { 15180, 0x00000D18 }, /* GL_GREEN_SCALE */ + { 15195, 0x0000140B }, /* GL_HALF_FLOAT */ + { 15209, 0x00008D61 }, /* GL_HALF_FLOAT_OES */ + { 15227, 0x00008DF2 }, /* GL_HIGH_FLOAT */ + { 15241, 0x00008DF5 }, /* GL_HIGH_INT */ + { 15253, 0x00008000 }, /* GL_HINT_BIT */ + { 15265, 0x00008024 }, /* GL_HISTOGRAM */ + { 15278, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ + { 15302, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ + { 15330, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ + { 15353, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ + { 15380, 0x00008024 }, /* GL_HISTOGRAM_EXT */ + { 15397, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ + { 15417, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ + { 15441, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ + { 15465, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ + { 15493, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + { 15521, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ + { 15553, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ + { 15575, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ + { 15601, 0x0000802D }, /* GL_HISTOGRAM_SINK */ + { 15619, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ + { 15641, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ + { 15660, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ + { 15683, 0x0000862A }, /* GL_IDENTITY_NV */ + { 15698, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ + { 15718, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */ + { 15754, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + { 15794, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */ + { 15828, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + { 15866, 0x00001E02 }, /* GL_INCR */ + { 15874, 0x00008507 }, /* GL_INCR_WRAP */ + { 15887, 0x00008507 }, /* GL_INCR_WRAP_EXT */ + { 15904, 0x00008222 }, /* GL_INDEX */ + { 15913, 0x00008077 }, /* GL_INDEX_ARRAY */ + { 15928, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + { 15958, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ + { 15992, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ + { 16015, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ + { 16037, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ + { 16057, 0x00000D51 }, /* GL_INDEX_BITS */ + { 16071, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ + { 16092, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ + { 16110, 0x00000C30 }, /* GL_INDEX_MODE */ + { 16124, 0x00000D13 }, /* GL_INDEX_OFFSET */ + { 16140, 0x00000D12 }, /* GL_INDEX_SHIFT */ + { 16155, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ + { 16174, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ + { 16193, 0x00001404 }, /* GL_INT */ + { 16200, 0x00008049 }, /* GL_INTENSITY */ + { 16213, 0x0000804C }, /* GL_INTENSITY12 */ + { 16228, 0x0000804C }, /* GL_INTENSITY12_EXT */ + { 16247, 0x0000804D }, /* GL_INTENSITY16 */ + { 16262, 0x00008D8B }, /* GL_INTENSITY16I_EXT */ + { 16282, 0x00008D79 }, /* GL_INTENSITY16UI_EXT */ + { 16303, 0x0000804D }, /* GL_INTENSITY16_EXT */ + { 16322, 0x00008D85 }, /* GL_INTENSITY32I_EXT */ + { 16342, 0x00008D73 }, /* GL_INTENSITY32UI_EXT */ + { 16363, 0x0000804A }, /* GL_INTENSITY4 */ + { 16377, 0x0000804A }, /* GL_INTENSITY4_EXT */ + { 16395, 0x0000804B }, /* GL_INTENSITY8 */ + { 16409, 0x00008D91 }, /* GL_INTENSITY8I_EXT */ + { 16428, 0x00008D7F }, /* GL_INTENSITY8UI_EXT */ + { 16448, 0x0000804B }, /* GL_INTENSITY8_EXT */ + { 16466, 0x00008049 }, /* GL_INTENSITY_EXT */ + { 16483, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS */ + { 16506, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS_EXT */ + { 16533, 0x00008575 }, /* GL_INTERPOLATE */ + { 16548, 0x00008575 }, /* GL_INTERPOLATE_ARB */ + { 16567, 0x00008575 }, /* GL_INTERPOLATE_EXT */ + { 16586, 0x00008DF7 }, /* GL_INT_10_10_10_2_OES */ + { 16608, 0x00008DC9 }, /* GL_INT_SAMPLER_1D */ + { 16626, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY */ + { 16650, 0x00008DCE }, /* GL_INT_SAMPLER_1D_ARRAY_EXT */ + { 16678, 0x00008DC9 }, /* GL_INT_SAMPLER_1D_EXT */ + { 16700, 0x00008DCA }, /* GL_INT_SAMPLER_2D */ + { 16718, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY */ + { 16742, 0x00008DCF }, /* GL_INT_SAMPLER_2D_ARRAY_EXT */ + { 16770, 0x00008DCA }, /* GL_INT_SAMPLER_2D_EXT */ + { 16792, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT */ + { 16815, 0x00008DCD }, /* GL_INT_SAMPLER_2D_RECT_EXT */ + { 16842, 0x00008DCB }, /* GL_INT_SAMPLER_3D */ + { 16860, 0x00008DCB }, /* GL_INT_SAMPLER_3D_EXT */ + { 16882, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER */ + { 16904, 0x00008DD0 }, /* GL_INT_SAMPLER_BUFFER_EXT */ + { 16930, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE */ + { 16950, 0x00008DCC }, /* GL_INT_SAMPLER_CUBE_EXT */ + { 16974, 0x00008B53 }, /* GL_INT_VEC2 */ + { 16986, 0x00008B53 }, /* GL_INT_VEC2_ARB */ + { 17002, 0x00008B54 }, /* GL_INT_VEC3 */ + { 17014, 0x00008B54 }, /* GL_INT_VEC3_ARB */ + { 17030, 0x00008B55 }, /* GL_INT_VEC4 */ + { 17042, 0x00008B55 }, /* GL_INT_VEC4_ARB */ + { 17058, 0x00000500 }, /* GL_INVALID_ENUM */ + { 17074, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + { 17107, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + { 17144, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_OES */ + { 17181, 0x00000502 }, /* GL_INVALID_OPERATION */ + { 17202, 0x00000501 }, /* GL_INVALID_VALUE */ + { 17219, 0x0000862B }, /* GL_INVERSE_NV */ + { 17233, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ + { 17257, 0x0000150A }, /* GL_INVERT */ + { 17267, 0x00001E00 }, /* GL_KEEP */ + { 17275, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */ + { 17301, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ + { 17331, 0x00000406 }, /* GL_LEFT */ + { 17339, 0x00000203 }, /* GL_LEQUAL */ + { 17349, 0x00000201 }, /* GL_LESS */ + { 17357, 0x00004000 }, /* GL_LIGHT0 */ + { 17367, 0x00004001 }, /* GL_LIGHT1 */ + { 17377, 0x00004002 }, /* GL_LIGHT2 */ + { 17387, 0x00004003 }, /* GL_LIGHT3 */ + { 17397, 0x00004004 }, /* GL_LIGHT4 */ + { 17407, 0x00004005 }, /* GL_LIGHT5 */ + { 17417, 0x00004006 }, /* GL_LIGHT6 */ + { 17427, 0x00004007 }, /* GL_LIGHT7 */ + { 17437, 0x00000B50 }, /* GL_LIGHTING */ + { 17449, 0x00000040 }, /* GL_LIGHTING_BIT */ + { 17465, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ + { 17488, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + { 17517, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ + { 17550, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + { 17578, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ + { 17602, 0x00001B01 }, /* GL_LINE */ + { 17610, 0x00002601 }, /* GL_LINEAR */ + { 17620, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ + { 17642, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + { 17672, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + { 17703, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ + { 17727, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ + { 17752, 0x00000001 }, /* GL_LINES */ + { 17761, 0x0000000A }, /* GL_LINES_ADJACENCY */ + { 17780, 0x0000000A }, /* GL_LINES_ADJACENCY_ARB */ + { 17803, 0x00000004 }, /* GL_LINE_BIT */ + { 17815, 0x00000002 }, /* GL_LINE_LOOP */ + { 17828, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ + { 17848, 0x00000B20 }, /* GL_LINE_SMOOTH */ + { 17863, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ + { 17883, 0x00000B24 }, /* GL_LINE_STIPPLE */ + { 17899, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ + { 17923, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ + { 17946, 0x00000003 }, /* GL_LINE_STRIP */ + { 17960, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY */ + { 17984, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY_ARB */ + { 18012, 0x00000702 }, /* GL_LINE_TOKEN */ + { 18026, 0x00000B21 }, /* GL_LINE_WIDTH */ + { 18040, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ + { 18066, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ + { 18086, 0x00008B82 }, /* GL_LINK_STATUS */ + { 18101, 0x00000B32 }, /* GL_LIST_BASE */ + { 18114, 0x00020000 }, /* GL_LIST_BIT */ + { 18126, 0x00000B33 }, /* GL_LIST_INDEX */ + { 18140, 0x00000B30 }, /* GL_LIST_MODE */ + { 18153, 0x00000101 }, /* GL_LOAD */ + { 18161, 0x00000BF1 }, /* GL_LOGIC_OP */ + { 18173, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ + { 18190, 0x00008CA1 }, /* GL_LOWER_LEFT */ + { 18204, 0x00008DF0 }, /* GL_LOW_FLOAT */ + { 18217, 0x00008DF3 }, /* GL_LOW_INT */ + { 18228, 0x00001909 }, /* GL_LUMINANCE */ + { 18241, 0x00008041 }, /* GL_LUMINANCE12 */ + { 18256, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ + { 18279, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ + { 18306, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ + { 18328, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ + { 18354, 0x00008041 }, /* GL_LUMINANCE12_EXT */ + { 18373, 0x00008042 }, /* GL_LUMINANCE16 */ + { 18388, 0x00008D8C }, /* GL_LUMINANCE16I_EXT */ + { 18408, 0x00008D7A }, /* GL_LUMINANCE16UI_EXT */ + { 18429, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ + { 18452, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ + { 18479, 0x00008042 }, /* GL_LUMINANCE16_EXT */ + { 18498, 0x00008D86 }, /* GL_LUMINANCE32I_EXT */ + { 18518, 0x00008D74 }, /* GL_LUMINANCE32UI_EXT */ + { 18539, 0x0000803F }, /* GL_LUMINANCE4 */ + { 18553, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ + { 18574, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ + { 18599, 0x0000803F }, /* GL_LUMINANCE4_EXT */ + { 18617, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ + { 18638, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ + { 18663, 0x00008040 }, /* GL_LUMINANCE8 */ + { 18677, 0x00008D92 }, /* GL_LUMINANCE8I_EXT */ + { 18696, 0x00008D80 }, /* GL_LUMINANCE8UI_EXT */ + { 18716, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ + { 18737, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ + { 18762, 0x00008040 }, /* GL_LUMINANCE8_EXT */ + { 18780, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ + { 18799, 0x00008D8D }, /* GL_LUMINANCE_ALPHA16I_EXT */ + { 18825, 0x00008D7B }, /* GL_LUMINANCE_ALPHA16UI_EXT */ + { 18852, 0x00008D87 }, /* GL_LUMINANCE_ALPHA32I_EXT */ + { 18878, 0x00008D75 }, /* GL_LUMINANCE_ALPHA32UI_EXT */ + { 18905, 0x00008D93 }, /* GL_LUMINANCE_ALPHA8I_EXT */ + { 18930, 0x00008D81 }, /* GL_LUMINANCE_ALPHA8UI_EXT */ + { 18956, 0x00008D9D }, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */ + { 18987, 0x00008D9C }, /* GL_LUMINANCE_INTEGER_EXT */ + { 19012, 0x0000821B }, /* GL_MAJOR_VERSION */ + { 19029, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ + { 19045, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ + { 19065, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ + { 19087, 0x00000D91 }, /* GL_MAP1_INDEX */ + { 19101, 0x00000D92 }, /* GL_MAP1_NORMAL */ + { 19116, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ + { 19140, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ + { 19164, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ + { 19188, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ + { 19212, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ + { 19229, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ + { 19246, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + { 19274, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + { 19303, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + { 19332, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + { 19361, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + { 19390, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + { 19419, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + { 19448, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + { 19476, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + { 19504, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + { 19532, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + { 19560, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + { 19588, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + { 19616, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + { 19644, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + { 19672, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + { 19700, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ + { 19716, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ + { 19736, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ + { 19758, 0x00000DB1 }, /* GL_MAP2_INDEX */ + { 19772, 0x00000DB2 }, /* GL_MAP2_NORMAL */ + { 19787, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ + { 19811, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ + { 19835, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ + { 19859, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ + { 19883, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ + { 19900, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ + { 19917, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + { 19945, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + { 19974, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + { 20003, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + { 20032, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + { 20061, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + { 20090, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + { 20119, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + { 20147, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + { 20175, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + { 20203, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + { 20231, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + { 20259, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + { 20287, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ + { 20315, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + { 20343, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + { 20371, 0x00000D10 }, /* GL_MAP_COLOR */ + { 20384, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ + { 20410, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ + { 20439, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ + { 20467, 0x00000001 }, /* GL_MAP_READ_BIT */ + { 20483, 0x00000D11 }, /* GL_MAP_STENCIL */ + { 20498, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ + { 20524, 0x00000002 }, /* GL_MAP_WRITE_BIT */ + { 20541, 0x000088C0 }, /* GL_MATRIX0_ARB */ + { 20556, 0x00008630 }, /* GL_MATRIX0_NV */ + { 20570, 0x000088CA }, /* GL_MATRIX10_ARB */ + { 20586, 0x000088CB }, /* GL_MATRIX11_ARB */ + { 20602, 0x000088CC }, /* GL_MATRIX12_ARB */ + { 20618, 0x000088CD }, /* GL_MATRIX13_ARB */ + { 20634, 0x000088CE }, /* GL_MATRIX14_ARB */ + { 20650, 0x000088CF }, /* GL_MATRIX15_ARB */ + { 20666, 0x000088D0 }, /* GL_MATRIX16_ARB */ + { 20682, 0x000088D1 }, /* GL_MATRIX17_ARB */ + { 20698, 0x000088D2 }, /* GL_MATRIX18_ARB */ + { 20714, 0x000088D3 }, /* GL_MATRIX19_ARB */ + { 20730, 0x000088C1 }, /* GL_MATRIX1_ARB */ + { 20745, 0x00008631 }, /* GL_MATRIX1_NV */ + { 20759, 0x000088D4 }, /* GL_MATRIX20_ARB */ + { 20775, 0x000088D5 }, /* GL_MATRIX21_ARB */ + { 20791, 0x000088D6 }, /* GL_MATRIX22_ARB */ + { 20807, 0x000088D7 }, /* GL_MATRIX23_ARB */ + { 20823, 0x000088D8 }, /* GL_MATRIX24_ARB */ + { 20839, 0x000088D9 }, /* GL_MATRIX25_ARB */ + { 20855, 0x000088DA }, /* GL_MATRIX26_ARB */ + { 20871, 0x000088DB }, /* GL_MATRIX27_ARB */ + { 20887, 0x000088DC }, /* GL_MATRIX28_ARB */ + { 20903, 0x000088DD }, /* GL_MATRIX29_ARB */ + { 20919, 0x000088C2 }, /* GL_MATRIX2_ARB */ + { 20934, 0x00008632 }, /* GL_MATRIX2_NV */ + { 20948, 0x000088DE }, /* GL_MATRIX30_ARB */ + { 20964, 0x000088DF }, /* GL_MATRIX31_ARB */ + { 20980, 0x000088C3 }, /* GL_MATRIX3_ARB */ + { 20995, 0x00008633 }, /* GL_MATRIX3_NV */ + { 21009, 0x000088C4 }, /* GL_MATRIX4_ARB */ + { 21024, 0x00008634 }, /* GL_MATRIX4_NV */ + { 21038, 0x000088C5 }, /* GL_MATRIX5_ARB */ + { 21053, 0x00008635 }, /* GL_MATRIX5_NV */ + { 21067, 0x000088C6 }, /* GL_MATRIX6_ARB */ + { 21082, 0x00008636 }, /* GL_MATRIX6_NV */ + { 21096, 0x000088C7 }, /* GL_MATRIX7_ARB */ + { 21111, 0x00008637 }, /* GL_MATRIX7_NV */ + { 21125, 0x000088C8 }, /* GL_MATRIX8_ARB */ + { 21140, 0x000088C9 }, /* GL_MATRIX9_ARB */ + { 21155, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ + { 21181, 0x00008B9E }, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */ + { 21222, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_OES */ + { 21248, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + { 21282, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_OES */ + { 21316, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + { 21347, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_OES */ + { 21378, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + { 21411, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_OES */ + { 21444, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + { 21475, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_OES */ + { 21506, 0x00000BA0 }, /* GL_MATRIX_MODE */ + { 21521, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ + { 21543, 0x00008840 }, /* GL_MATRIX_PALETTE_OES */ + { 21565, 0x00008008 }, /* GL_MAX */ + { 21572, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ + { 21595, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE_OES */ + { 21622, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS */ + { 21650, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + { 21682, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ + { 21708, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + { 21741, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + { 21767, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 21801, 0x00000D32 }, /* GL_MAX_CLIP_DISTANCES */ + { 21823, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ + { 21842, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */ + { 21867, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + { 21896, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + { 21928, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 21964, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + { 22000, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + { 22040, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ + { 22066, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ + { 22096, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ + { 22121, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ + { 22150, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + { 22179, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ + { 22212, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES */ + { 22245, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ + { 22265, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ + { 22289, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ + { 22313, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ + { 22337, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ + { 22362, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ + { 22380, 0x00008008 }, /* GL_MAX_EXT */ + { 22391, 0x00009125 }, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */ + { 22424, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + { 22459, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + { 22498, 0x00008DFD }, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */ + { 22530, 0x00009123 }, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */ + { 22563, 0x00009124 }, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */ + { 22597, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */ + { 22629, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB */ + { 22665, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */ + { 22701, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB */ + { 22741, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */ + { 22781, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB */ + { 22825, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */ + { 22860, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB */ + { 22899, 0x00008DDD }, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */ + { 22938, 0x00000D31 }, /* GL_MAX_LIGHTS */ + { 22952, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ + { 22972, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + { 23010, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + { 23039, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ + { 23063, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ + { 23091, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_OES */ + { 23119, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ + { 23142, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 23179, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 23215, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + { 23242, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + { 23271, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + { 23305, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + { 23341, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + { 23368, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + { 23400, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + { 23436, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + { 23465, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + { 23494, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ + { 23522, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + { 23560, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 23604, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 23647, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 23681, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 23720, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 23757, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 23795, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 23838, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 23881, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + { 23911, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + { 23942, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET */ + { 23970, 0x00008905 }, /* GL_MAX_PROGRAM_TEXEL_OFFSET_EXT */ + { 24002, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 24038, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 24074, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ + { 24104, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */ + { 24134, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + { 24168, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ + { 24201, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */ + { 24226, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + { 24255, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_OES */ + { 24284, 0x00008D57 }, /* GL_MAX_SAMPLES */ + { 24299, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */ + { 24318, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */ + { 24345, 0x00008504 }, /* GL_MAX_SHININESS_NV */ + { 24365, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ + { 24389, 0x00008C2B }, /* GL_MAX_TEXTURE_BUFFER_SIZE */ + { 24416, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ + { 24438, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ + { 24464, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + { 24491, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + { 24522, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ + { 24546, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS_EXT */ + { 24574, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + { 24608, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ + { 24628, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ + { 24655, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ + { 24676, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ + { 24701, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ + { 24726, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + { 24761, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */ + { 24810, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */ + { 24863, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */ + { 24906, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */ + { 24953, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */ + { 24999, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */ + { 25049, 0x00008B4B }, /* GL_MAX_VARYING_COMPONENTS */ + { 25075, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ + { 25097, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ + { 25123, 0x00008DFC }, /* GL_MAX_VARYING_VECTORS */ + { 25146, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ + { 25168, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 25194, 0x00009122 }, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */ + { 25226, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + { 25260, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + { 25298, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + { 25331, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + { 25368, 0x00008DFB }, /* GL_MAX_VERTEX_UNIFORM_VECTORS */ + { 25398, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ + { 25422, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_OES */ + { 25446, 0x00008DDE }, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */ + { 25483, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ + { 25504, 0x00008DF1 }, /* GL_MEDIUM_FLOAT */ + { 25520, 0x00008DF4 }, /* GL_MEDIUM_INT */ + { 25534, 0x00008007 }, /* GL_MIN */ + { 25541, 0x0000802E }, /* GL_MINMAX */ + { 25551, 0x0000802E }, /* GL_MINMAX_EXT */ + { 25565, 0x0000802F }, /* GL_MINMAX_FORMAT */ + { 25582, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ + { 25603, 0x00008030 }, /* GL_MINMAX_SINK */ + { 25618, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ + { 25637, 0x0000821C }, /* GL_MINOR_VERSION */ + { 25654, 0x00008007 }, /* GL_MIN_EXT */ + { 25665, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET */ + { 25693, 0x00008904 }, /* GL_MIN_PROGRAM_TEXEL_OFFSET_EXT */ + { 25725, 0x00008370 }, /* GL_MIRRORED_REPEAT */ + { 25744, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ + { 25767, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ + { 25790, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ + { 25810, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ + { 25830, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + { 25860, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ + { 25888, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + { 25916, 0x00001700 }, /* GL_MODELVIEW */ + { 25929, 0x00001700 }, /* GL_MODELVIEW0_ARB */ + { 25947, 0x0000872A }, /* GL_MODELVIEW10_ARB */ + { 25966, 0x0000872B }, /* GL_MODELVIEW11_ARB */ + { 25985, 0x0000872C }, /* GL_MODELVIEW12_ARB */ + { 26004, 0x0000872D }, /* GL_MODELVIEW13_ARB */ + { 26023, 0x0000872E }, /* GL_MODELVIEW14_ARB */ + { 26042, 0x0000872F }, /* GL_MODELVIEW15_ARB */ + { 26061, 0x00008730 }, /* GL_MODELVIEW16_ARB */ + { 26080, 0x00008731 }, /* GL_MODELVIEW17_ARB */ + { 26099, 0x00008732 }, /* GL_MODELVIEW18_ARB */ + { 26118, 0x00008733 }, /* GL_MODELVIEW19_ARB */ + { 26137, 0x0000850A }, /* GL_MODELVIEW1_ARB */ + { 26155, 0x00008734 }, /* GL_MODELVIEW20_ARB */ + { 26174, 0x00008735 }, /* GL_MODELVIEW21_ARB */ + { 26193, 0x00008736 }, /* GL_MODELVIEW22_ARB */ + { 26212, 0x00008737 }, /* GL_MODELVIEW23_ARB */ + { 26231, 0x00008738 }, /* GL_MODELVIEW24_ARB */ + { 26250, 0x00008739 }, /* GL_MODELVIEW25_ARB */ + { 26269, 0x0000873A }, /* GL_MODELVIEW26_ARB */ + { 26288, 0x0000873B }, /* GL_MODELVIEW27_ARB */ + { 26307, 0x0000873C }, /* GL_MODELVIEW28_ARB */ + { 26326, 0x0000873D }, /* GL_MODELVIEW29_ARB */ + { 26345, 0x00008722 }, /* GL_MODELVIEW2_ARB */ + { 26363, 0x0000873E }, /* GL_MODELVIEW30_ARB */ + { 26382, 0x0000873F }, /* GL_MODELVIEW31_ARB */ + { 26401, 0x00008723 }, /* GL_MODELVIEW3_ARB */ + { 26419, 0x00008724 }, /* GL_MODELVIEW4_ARB */ + { 26437, 0x00008725 }, /* GL_MODELVIEW5_ARB */ + { 26455, 0x00008726 }, /* GL_MODELVIEW6_ARB */ + { 26473, 0x00008727 }, /* GL_MODELVIEW7_ARB */ + { 26491, 0x00008728 }, /* GL_MODELVIEW8_ARB */ + { 26509, 0x00008729 }, /* GL_MODELVIEW9_ARB */ + { 26527, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ + { 26547, 0x0000898D }, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */ + { 26589, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ + { 26616, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ + { 26641, 0x00002100 }, /* GL_MODULATE */ + { 26653, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ + { 26673, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ + { 26700, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ + { 26725, 0x00000103 }, /* GL_MULT */ + { 26733, 0x0000809D }, /* GL_MULTISAMPLE */ + { 26748, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ + { 26768, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ + { 26787, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ + { 26806, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ + { 26830, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ + { 26853, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + { 26883, 0x00002A25 }, /* GL_N3F_V3F */ + { 26894, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ + { 26914, 0x0000150E }, /* GL_NAND */ + { 26922, 0x00002600 }, /* GL_NEAREST */ + { 26933, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + { 26964, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + { 26996, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ + { 27021, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ + { 27047, 0x00000200 }, /* GL_NEVER */ + { 27056, 0x00001102 }, /* GL_NICEST */ + { 27066, 0x00000000 }, /* GL_NONE */ + { 27074, 0x00000000 }, /* GL_NONE_OES */ + { 27086, 0x00001505 }, /* GL_NOOP */ + { 27094, 0x00001508 }, /* GL_NOR */ + { 27101, 0x00000BA1 }, /* GL_NORMALIZE */ + { 27114, 0x00008075 }, /* GL_NORMAL_ARRAY */ + { 27130, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + { 27161, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ + { 27196, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ + { 27220, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ + { 27243, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ + { 27264, 0x00008511 }, /* GL_NORMAL_MAP */ + { 27278, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ + { 27296, 0x00008511 }, /* GL_NORMAL_MAP_NV */ + { 27313, 0x00008511 }, /* GL_NORMAL_MAP_OES */ + { 27331, 0x00000205 }, /* GL_NOTEQUAL */ + { 27343, 0x00000000 }, /* GL_NO_ERROR */ + { 27355, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + { 27389, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ + { 27427, 0x0000821D }, /* GL_NUM_EXTENSIONS */ + { 27445, 0x000087FE }, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */ + { 27479, 0x00008DF9 }, /* GL_NUM_SHADER_BINARY_FORMATS */ + { 27508, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + { 27540, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + { 27582, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + { 27612, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + { 27652, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + { 27683, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ + { 27712, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ + { 27740, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + { 27770, 0x00002401 }, /* GL_OBJECT_LINEAR */ + { 27787, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ + { 27813, 0x00002501 }, /* GL_OBJECT_PLANE */ + { 27829, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + { 27864, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ + { 27886, 0x00009112 }, /* GL_OBJECT_TYPE */ + { 27901, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ + { 27920, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + { 27950, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ + { 27971, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ + { 27999, 0x00000001 }, /* GL_ONE */ + { 28006, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + { 28034, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ + { 28066, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ + { 28094, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ + { 28126, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ + { 28149, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ + { 28172, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ + { 28195, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ + { 28218, 0x00008598 }, /* GL_OPERAND0_ALPHA */ + { 28236, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ + { 28258, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ + { 28280, 0x00008590 }, /* GL_OPERAND0_RGB */ + { 28296, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ + { 28316, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ + { 28336, 0x00008599 }, /* GL_OPERAND1_ALPHA */ + { 28354, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ + { 28376, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ + { 28398, 0x00008591 }, /* GL_OPERAND1_RGB */ + { 28414, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ + { 28434, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ + { 28454, 0x0000859A }, /* GL_OPERAND2_ALPHA */ + { 28472, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ + { 28494, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ + { 28516, 0x00008592 }, /* GL_OPERAND2_RGB */ + { 28532, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ + { 28552, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ + { 28572, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ + { 28593, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ + { 28612, 0x00001507 }, /* GL_OR */ + { 28618, 0x00000A01 }, /* GL_ORDER */ + { 28627, 0x0000150D }, /* GL_OR_INVERTED */ + { 28642, 0x0000150B }, /* GL_OR_REVERSE */ + { 28656, 0x00000505 }, /* GL_OUT_OF_MEMORY */ + { 28673, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ + { 28691, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ + { 28712, 0x00008758 }, /* GL_PACK_INVERT_MESA */ + { 28732, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ + { 28750, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ + { 28769, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ + { 28789, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ + { 28809, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ + { 28827, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ + { 28846, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ + { 28871, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ + { 28895, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ + { 28916, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ + { 28938, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ + { 28960, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ + { 28985, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ + { 29009, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ + { 29030, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ + { 29052, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ + { 29074, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ + { 29096, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ + { 29127, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ + { 29147, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + { 29172, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ + { 29192, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + { 29217, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ + { 29237, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + { 29262, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ + { 29282, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + { 29307, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ + { 29327, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + { 29352, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ + { 29372, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + { 29397, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ + { 29417, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + { 29442, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ + { 29462, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + { 29487, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ + { 29507, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + { 29532, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ + { 29552, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + { 29577, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ + { 29595, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ + { 29616, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ + { 29645, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + { 29678, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ + { 29703, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ + { 29726, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + { 29757, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + { 29792, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + { 29819, 0x00001B00 }, /* GL_POINT */ + { 29828, 0x00000000 }, /* GL_POINTS */ + { 29838, 0x00000002 }, /* GL_POINT_BIT */ + { 29851, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ + { 29881, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ + { 29915, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ + { 29949, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ + { 29984, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ + { 30013, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ + { 30046, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ + { 30079, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ + { 30113, 0x00000B11 }, /* GL_POINT_SIZE */ + { 30127, 0x00008B9F }, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */ + { 30166, 0x00008B9C }, /* GL_POINT_SIZE_ARRAY_OES */ + { 30190, 0x0000898C }, /* GL_POINT_SIZE_ARRAY_POINTER_OES */ + { 30222, 0x0000898B }, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */ + { 30253, 0x0000898A }, /* GL_POINT_SIZE_ARRAY_TYPE_OES */ + { 30282, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ + { 30308, 0x00008127 }, /* GL_POINT_SIZE_MAX */ + { 30326, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ + { 30348, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ + { 30370, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ + { 30393, 0x00008126 }, /* GL_POINT_SIZE_MIN */ + { 30411, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ + { 30433, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ + { 30455, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ + { 30478, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ + { 30498, 0x00000B10 }, /* GL_POINT_SMOOTH */ + { 30514, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ + { 30535, 0x00008861 }, /* GL_POINT_SPRITE */ + { 30551, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ + { 30571, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ + { 30600, 0x00008861 }, /* GL_POINT_SPRITE_NV */ + { 30619, 0x00008861 }, /* GL_POINT_SPRITE_OES */ + { 30639, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ + { 30665, 0x00000701 }, /* GL_POINT_TOKEN */ + { 30680, 0x00000009 }, /* GL_POLYGON */ + { 30691, 0x00000008 }, /* GL_POLYGON_BIT */ + { 30706, 0x00000B40 }, /* GL_POLYGON_MODE */ + { 30722, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ + { 30745, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ + { 30770, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ + { 30793, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ + { 30816, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ + { 30840, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ + { 30864, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ + { 30882, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ + { 30905, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ + { 30924, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ + { 30947, 0x00000703 }, /* GL_POLYGON_TOKEN */ + { 30964, 0x00001203 }, /* GL_POSITION */ + { 30976, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + { 31008, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ + { 31044, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + { 31077, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ + { 31114, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + { 31145, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ + { 31180, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + { 31212, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ + { 31248, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + { 31281, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + { 31313, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ + { 31349, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + { 31382, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ + { 31419, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + { 31449, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ + { 31483, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + { 31514, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ + { 31549, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + { 31580, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ + { 31615, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + { 31647, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ + { 31683, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + { 31713, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ + { 31747, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + { 31778, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ + { 31813, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + { 31845, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + { 31876, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ + { 31911, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + { 31943, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ + { 31979, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ + { 32008, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ + { 32041, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ + { 32071, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ + { 32105, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + { 32144, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + { 32177, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + { 32217, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + { 32251, 0x00008578 }, /* GL_PREVIOUS */ + { 32263, 0x00008578 }, /* GL_PREVIOUS_ARB */ + { 32279, 0x00008578 }, /* GL_PREVIOUS_EXT */ + { 32295, 0x00008577 }, /* GL_PRIMARY_COLOR */ + { 32312, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ + { 32333, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ + { 32354, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED */ + { 32378, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED_EXT */ + { 32406, 0x00008F9D }, /* GL_PRIMITIVE_RESTART */ + { 32427, 0x00008F9E }, /* GL_PRIMITIVE_RESTART_INDEX */ + { 32454, 0x00008559 }, /* GL_PRIMITIVE_RESTART_INDEX_NV */ + { 32484, 0x00008558 }, /* GL_PRIMITIVE_RESTART_NV */ + { 32508, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 32541, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 32573, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ + { 32596, 0x000087FF }, /* GL_PROGRAM_BINARY_FORMATS_OES */ + { 32626, 0x00008741 }, /* GL_PROGRAM_BINARY_LENGTH_OES */ + { 32655, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ + { 32678, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ + { 32708, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ + { 32737, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ + { 32765, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ + { 32787, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + { 32815, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + { 32843, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ + { 32865, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ + { 32886, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 32926, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 32965, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 32995, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 33030, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 33063, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 33097, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 33136, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 33175, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ + { 33197, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ + { 33223, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ + { 33247, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE */ + { 33269, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE_ARB */ + { 33295, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ + { 33318, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ + { 33340, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ + { 33361, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ + { 33382, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ + { 33409, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 33441, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 33473, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + { 33508, 0x00001701 }, /* GL_PROJECTION */ + { 33522, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ + { 33543, 0x0000898E }, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */ + { 33586, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ + { 33612, 0x00008E4F }, /* GL_PROVOKING_VERTEX */ + { 33632, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ + { 33656, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ + { 33677, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ + { 33696, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ + { 33719, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + { 33758, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + { 33796, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ + { 33816, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY */ + { 33842, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + { 33872, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ + { 33896, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ + { 33916, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY */ + { 33942, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + { 33972, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ + { 33996, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ + { 34016, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + { 34049, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ + { 34075, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ + { 34105, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE */ + { 34132, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + { 34163, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ + { 34193, 0x00008A1D }, /* GL_PURGEABLE_APPLE */ + { 34212, 0x00002003 }, /* GL_Q */ + { 34217, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ + { 34242, 0x00000007 }, /* GL_QUADS */ + { 34251, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ + { 34295, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ + { 34343, 0x00008614 }, /* GL_QUAD_MESH_SUN */ + { 34360, 0x00000008 }, /* GL_QUAD_STRIP */ + { 34374, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT */ + { 34401, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */ + { 34431, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT */ + { 34455, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */ + { 34482, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ + { 34504, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ + { 34530, 0x00008E14 }, /* GL_QUERY_NO_WAIT */ + { 34547, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */ + { 34567, 0x00008866 }, /* GL_QUERY_RESULT */ + { 34583, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ + { 34603, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ + { 34629, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ + { 34659, 0x00008E13 }, /* GL_QUERY_WAIT */ + { 34673, 0x00008E13 }, /* GL_QUERY_WAIT_NV */ + { 34690, 0x00002002 }, /* GL_R */ + { 34695, 0x00008C3A }, /* GL_R11F_G11F_B10F */ + { 34713, 0x00008F98 }, /* GL_R16_SNORM */ + { 34726, 0x00002A10 }, /* GL_R3_G3_B2 */ + { 34738, 0x00008F94 }, /* GL_R8_SNORM */ + { 34750, 0x00008C89 }, /* GL_RASTERIZER_DISCARD */ + { 34772, 0x00008C89 }, /* GL_RASTERIZER_DISCARD_EXT */ + { 34798, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + { 34831, 0x00000C02 }, /* GL_READ_BUFFER */ + { 34846, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ + { 34866, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */ + { 34894, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + { 34926, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ + { 34950, 0x000088B8 }, /* GL_READ_ONLY */ + { 34963, 0x000088B8 }, /* GL_READ_ONLY_ARB */ + { 34980, 0x000088BA }, /* GL_READ_WRITE */ + { 34994, 0x000088BA }, /* GL_READ_WRITE_ARB */ + { 35012, 0x00001903 }, /* GL_RED */ + { 35019, 0x00008016 }, /* GL_REDUCE */ + { 35029, 0x00008016 }, /* GL_REDUCE_EXT */ + { 35043, 0x00000D15 }, /* GL_RED_BIAS */ + { 35055, 0x00000D52 }, /* GL_RED_BITS */ + { 35067, 0x00008D94 }, /* GL_RED_INTEGER */ + { 35082, 0x00008D94 }, /* GL_RED_INTEGER_EXT */ + { 35101, 0x00000D14 }, /* GL_RED_SCALE */ + { 35114, 0x00008F90 }, /* GL_RED_SNORM */ + { 35127, 0x00008512 }, /* GL_REFLECTION_MAP */ + { 35145, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ + { 35167, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ + { 35188, 0x00008512 }, /* GL_REFLECTION_MAP_OES */ + { 35210, 0x00008A19 }, /* GL_RELEASED_APPLE */ + { 35228, 0x00001C00 }, /* GL_RENDER */ + { 35238, 0x00008D41 }, /* GL_RENDERBUFFER */ + { 35254, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ + { 35281, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE_OES */ + { 35312, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */ + { 35336, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ + { 35364, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_OES */ + { 35392, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ + { 35418, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE_OES */ + { 35448, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ + { 35475, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE_OES */ + { 35506, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ + { 35526, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ + { 35553, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE_OES */ + { 35584, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ + { 35607, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ + { 35634, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_OES */ + { 35661, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + { 35693, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + { 35729, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_OES */ + { 35765, 0x00008D41 }, /* GL_RENDERBUFFER_OES */ + { 35785, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ + { 35810, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE_OES */ + { 35839, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ + { 35863, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */ + { 35891, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ + { 35920, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE_OES */ + { 35953, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ + { 35975, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ + { 36001, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_OES */ + { 36027, 0x00001F01 }, /* GL_RENDERER */ + { 36039, 0x00000C40 }, /* GL_RENDER_MODE */ + { 36054, 0x00002901 }, /* GL_REPEAT */ + { 36064, 0x00001E01 }, /* GL_REPLACE */ + { 36075, 0x00008062 }, /* GL_REPLACE_EXT */ + { 36090, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ + { 36113, 0x0000803A }, /* GL_RESCALE_NORMAL */ + { 36131, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ + { 36153, 0x00008A1B }, /* GL_RETAINED_APPLE */ + { 36171, 0x00000102 }, /* GL_RETURN */ + { 36181, 0x00008F99 }, /* GL_RG16_SNORM */ + { 36195, 0x00008F95 }, /* GL_RG8_SNORM */ + { 36208, 0x00001907 }, /* GL_RGB */ + { 36215, 0x00008052 }, /* GL_RGB10 */ + { 36224, 0x00008059 }, /* GL_RGB10_A2 */ + { 36236, 0x00008059 }, /* GL_RGB10_A2_EXT */ + { 36252, 0x00008052 }, /* GL_RGB10_EXT */ + { 36265, 0x00008053 }, /* GL_RGB12 */ + { 36274, 0x00008053 }, /* GL_RGB12_EXT */ + { 36287, 0x00008054 }, /* GL_RGB16 */ + { 36296, 0x0000881B }, /* GL_RGB16F */ + { 36306, 0x00008D89 }, /* GL_RGB16I */ + { 36316, 0x00008D89 }, /* GL_RGB16I_EXT */ + { 36330, 0x00008D77 }, /* GL_RGB16UI */ + { 36341, 0x00008D77 }, /* GL_RGB16UI_EXT */ + { 36356, 0x00008054 }, /* GL_RGB16_EXT */ + { 36369, 0x00008F9A }, /* GL_RGB16_SNORM */ + { 36384, 0x0000804E }, /* GL_RGB2_EXT */ + { 36396, 0x00008815 }, /* GL_RGB32F */ + { 36406, 0x00008D83 }, /* GL_RGB32I */ + { 36416, 0x00008D83 }, /* GL_RGB32I_EXT */ + { 36430, 0x00008D71 }, /* GL_RGB32UI */ + { 36441, 0x00008D71 }, /* GL_RGB32UI_EXT */ + { 36456, 0x0000804F }, /* GL_RGB4 */ + { 36464, 0x0000804F }, /* GL_RGB4_EXT */ + { 36476, 0x000083A1 }, /* GL_RGB4_S3TC */ + { 36489, 0x00008050 }, /* GL_RGB5 */ + { 36497, 0x00008D62 }, /* GL_RGB565 */ + { 36507, 0x00008D62 }, /* GL_RGB565_OES */ + { 36521, 0x00008057 }, /* GL_RGB5_A1 */ + { 36532, 0x00008057 }, /* GL_RGB5_A1_EXT */ + { 36547, 0x00008057 }, /* GL_RGB5_A1_OES */ + { 36562, 0x00008050 }, /* GL_RGB5_EXT */ + { 36574, 0x00008051 }, /* GL_RGB8 */ + { 36582, 0x00008D8F }, /* GL_RGB8I */ + { 36591, 0x00008D8F }, /* GL_RGB8I_EXT */ + { 36604, 0x00008D7D }, /* GL_RGB8UI */ + { 36614, 0x00008D7D }, /* GL_RGB8UI_EXT */ + { 36628, 0x00008051 }, /* GL_RGB8_EXT */ + { 36640, 0x00008051 }, /* GL_RGB8_OES */ + { 36652, 0x00008F96 }, /* GL_RGB8_SNORM */ + { 36666, 0x00008C3D }, /* GL_RGB9_E5 */ + { 36677, 0x00001908 }, /* GL_RGBA */ + { 36685, 0x0000805A }, /* GL_RGBA12 */ + { 36695, 0x0000805A }, /* GL_RGBA12_EXT */ + { 36709, 0x0000805B }, /* GL_RGBA16 */ + { 36719, 0x0000881A }, /* GL_RGBA16F */ + { 36730, 0x00008D88 }, /* GL_RGBA16I */ + { 36741, 0x00008D88 }, /* GL_RGBA16I_EXT */ + { 36756, 0x00008D76 }, /* GL_RGBA16UI */ + { 36768, 0x00008D76 }, /* GL_RGBA16UI_EXT */ + { 36784, 0x0000805B }, /* GL_RGBA16_EXT */ + { 36798, 0x00008F9B }, /* GL_RGBA16_SNORM */ + { 36814, 0x00008055 }, /* GL_RGBA2 */ + { 36823, 0x00008055 }, /* GL_RGBA2_EXT */ + { 36836, 0x00008814 }, /* GL_RGBA32F */ + { 36847, 0x00008D82 }, /* GL_RGBA32I */ + { 36858, 0x00008D82 }, /* GL_RGBA32I_EXT */ + { 36873, 0x00008D70 }, /* GL_RGBA32UI */ + { 36885, 0x00008D70 }, /* GL_RGBA32UI_EXT */ + { 36901, 0x00008056 }, /* GL_RGBA4 */ + { 36910, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ + { 36929, 0x00008056 }, /* GL_RGBA4_EXT */ + { 36942, 0x00008056 }, /* GL_RGBA4_OES */ + { 36955, 0x000083A3 }, /* GL_RGBA4_S3TC */ + { 36969, 0x00008058 }, /* GL_RGBA8 */ + { 36978, 0x00008D8E }, /* GL_RGBA8I */ + { 36988, 0x00008D8E }, /* GL_RGBA8I_EXT */ + { 37002, 0x00008D7C }, /* GL_RGBA8UI */ + { 37013, 0x00008D7C }, /* GL_RGBA8UI_EXT */ + { 37028, 0x00008058 }, /* GL_RGBA8_EXT */ + { 37041, 0x00008058 }, /* GL_RGBA8_OES */ + { 37054, 0x00008F97 }, /* GL_RGBA8_SNORM */ + { 37069, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ + { 37087, 0x00008D99 }, /* GL_RGBA_INTEGER */ + { 37103, 0x00008D99 }, /* GL_RGBA_INTEGER_EXT */ + { 37123, 0x00008D9E }, /* GL_RGBA_INTEGER_MODE_EXT */ + { 37148, 0x00000C31 }, /* GL_RGBA_MODE */ + { 37161, 0x000083A2 }, /* GL_RGBA_S3TC */ + { 37174, 0x00008F93 }, /* GL_RGBA_SNORM */ + { 37188, 0x00008D98 }, /* GL_RGB_INTEGER */ + { 37203, 0x00008D98 }, /* GL_RGB_INTEGER_EXT */ + { 37222, 0x000083A0 }, /* GL_RGB_S3TC */ + { 37234, 0x00008573 }, /* GL_RGB_SCALE */ + { 37247, 0x00008573 }, /* GL_RGB_SCALE_ARB */ + { 37264, 0x00008573 }, /* GL_RGB_SCALE_EXT */ + { 37281, 0x00008F92 }, /* GL_RGB_SNORM */ + { 37294, 0x00008F91 }, /* GL_RG_SNORM */ + { 37306, 0x00000407 }, /* GL_RIGHT */ + { 37315, 0x00002000 }, /* GL_S */ + { 37320, 0x00008B5D }, /* GL_SAMPLER_1D */ + { 37334, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY */ + { 37354, 0x00008DC0 }, /* GL_SAMPLER_1D_ARRAY_EXT */ + { 37378, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW */ + { 37405, 0x00008DC3 }, /* GL_SAMPLER_1D_ARRAY_SHADOW_EXT */ + { 37436, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ + { 37457, 0x00008B5E }, /* GL_SAMPLER_2D */ + { 37471, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY */ + { 37491, 0x00008DC1 }, /* GL_SAMPLER_2D_ARRAY_EXT */ + { 37515, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW */ + { 37542, 0x00008DC4 }, /* GL_SAMPLER_2D_ARRAY_SHADOW_EXT */ + { 37573, 0x00008B63 }, /* GL_SAMPLER_2D_RECT */ + { 37592, 0x00008B64 }, /* GL_SAMPLER_2D_RECT_SHADOW */ + { 37618, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ + { 37639, 0x00008B5F }, /* GL_SAMPLER_3D */ + { 37653, 0x00008B5F }, /* GL_SAMPLER_3D_OES */ + { 37671, 0x00008DC2 }, /* GL_SAMPLER_BUFFER */ + { 37689, 0x00008DC2 }, /* GL_SAMPLER_BUFFER_EXT */ + { 37711, 0x00008B60 }, /* GL_SAMPLER_CUBE */ + { 37727, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW */ + { 37750, 0x00008DC5 }, /* GL_SAMPLER_CUBE_SHADOW_EXT */ + { 37777, 0x000080A9 }, /* GL_SAMPLES */ + { 37788, 0x000086B4 }, /* GL_SAMPLES_3DFX */ + { 37804, 0x000080A9 }, /* GL_SAMPLES_ARB */ + { 37819, 0x00008914 }, /* GL_SAMPLES_PASSED */ + { 37837, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ + { 37859, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + { 37887, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ + { 37919, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ + { 37942, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ + { 37969, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ + { 37987, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ + { 38010, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ + { 38032, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ + { 38051, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ + { 38074, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ + { 38100, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ + { 38130, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ + { 38155, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ + { 38184, 0x00080000 }, /* GL_SCISSOR_BIT */ + { 38199, 0x00000C10 }, /* GL_SCISSOR_BOX */ + { 38214, 0x00000C11 }, /* GL_SCISSOR_TEST */ + { 38230, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ + { 38255, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + { 38295, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 38339, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + { 38372, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + { 38402, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + { 38434, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + { 38464, 0x00001C02 }, /* GL_SELECT */ + { 38474, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ + { 38502, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ + { 38527, 0x00008012 }, /* GL_SEPARABLE_2D */ + { 38543, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS */ + { 38563, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS_EXT */ + { 38587, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ + { 38614, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ + { 38645, 0x0000150F }, /* GL_SET */ + { 38652, 0x00008DF8 }, /* GL_SHADER_BINARY_FORMATS */ + { 38677, 0x00008DFA }, /* GL_SHADER_COMPILER */ + { 38696, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ + { 38717, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ + { 38741, 0x00008B4F }, /* GL_SHADER_TYPE */ + { 38756, 0x00000B54 }, /* GL_SHADE_MODEL */ + { 38771, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ + { 38799, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ + { 38822, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + { 38852, 0x00001601 }, /* GL_SHININESS */ + { 38865, 0x00001402 }, /* GL_SHORT */ + { 38874, 0x00009119 }, /* GL_SIGNALED */ + { 38886, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ + { 38907, 0x000081F9 }, /* GL_SINGLE_COLOR */ + { 38923, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ + { 38943, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ + { 38962, 0x00008C46 }, /* GL_SLUMINANCE */ + { 38976, 0x00008C47 }, /* GL_SLUMINANCE8 */ + { 38991, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ + { 39013, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ + { 39033, 0x00001D01 }, /* GL_SMOOTH */ + { 39043, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ + { 39076, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ + { 39103, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ + { 39136, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ + { 39163, 0x00008588 }, /* GL_SOURCE0_ALPHA */ + { 39180, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ + { 39201, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ + { 39222, 0x00008580 }, /* GL_SOURCE0_RGB */ + { 39237, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ + { 39256, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ + { 39275, 0x00008589 }, /* GL_SOURCE1_ALPHA */ + { 39292, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ + { 39313, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ + { 39334, 0x00008581 }, /* GL_SOURCE1_RGB */ + { 39349, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ + { 39368, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ + { 39387, 0x0000858A }, /* GL_SOURCE2_ALPHA */ + { 39404, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ + { 39425, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ + { 39446, 0x00008582 }, /* GL_SOURCE2_RGB */ + { 39461, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ + { 39480, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ + { 39499, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ + { 39519, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ + { 39537, 0x00001202 }, /* GL_SPECULAR */ + { 39549, 0x00002402 }, /* GL_SPHERE_MAP */ + { 39563, 0x00001206 }, /* GL_SPOT_CUTOFF */ + { 39578, 0x00001204 }, /* GL_SPOT_DIRECTION */ + { 39596, 0x00001205 }, /* GL_SPOT_EXPONENT */ + { 39613, 0x00008588 }, /* GL_SRC0_ALPHA */ + { 39627, 0x00008580 }, /* GL_SRC0_RGB */ + { 39639, 0x00008589 }, /* GL_SRC1_ALPHA */ + { 39653, 0x00008581 }, /* GL_SRC1_RGB */ + { 39665, 0x0000858A }, /* GL_SRC2_ALPHA */ + { 39679, 0x00008582 }, /* GL_SRC2_RGB */ + { 39691, 0x00000302 }, /* GL_SRC_ALPHA */ + { 39704, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ + { 39726, 0x00000300 }, /* GL_SRC_COLOR */ + { 39739, 0x00008C40 }, /* GL_SRGB */ + { 39747, 0x00008C41 }, /* GL_SRGB8 */ + { 39756, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ + { 39772, 0x00008C42 }, /* GL_SRGB_ALPHA */ + { 39786, 0x00000503 }, /* GL_STACK_OVERFLOW */ + { 39804, 0x00000504 }, /* GL_STACK_UNDERFLOW */ + { 39823, 0x000088E6 }, /* GL_STATIC_COPY */ + { 39838, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ + { 39857, 0x000088E4 }, /* GL_STATIC_DRAW */ + { 39872, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ + { 39891, 0x000088E5 }, /* GL_STATIC_READ */ + { 39906, 0x000088E5 }, /* GL_STATIC_READ_ARB */ + { 39925, 0x00001802 }, /* GL_STENCIL */ + { 39936, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ + { 39958, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ + { 39984, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_OES */ + { 40010, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ + { 40031, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 40056, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 40077, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 40102, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 40134, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 40170, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 40202, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 40238, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 40258, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 40285, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 40311, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 40327, 0x00008224 }, /* GL_STENCIL_BUFFER */ + { 40345, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 40367, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 40390, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 40406, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 40422, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 40439, 0x00008D46 }, /* GL_STENCIL_INDEX1 */ + { 40457, 0x00008D49 }, /* GL_STENCIL_INDEX16 */ + { 40476, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 40499, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 40521, 0x00008D46 }, /* GL_STENCIL_INDEX1_OES */ + { 40543, 0x00008D47 }, /* GL_STENCIL_INDEX4 */ + { 40561, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 40583, 0x00008D47 }, /* GL_STENCIL_INDEX4_OES */ + { 40605, 0x00008D48 }, /* GL_STENCIL_INDEX8 */ + { 40623, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 40645, 0x00008D48 }, /* GL_STENCIL_INDEX8_OES */ + { 40667, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 40688, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 40715, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 40742, 0x00000B97 }, /* GL_STENCIL_REF */ + { 40757, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 40773, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 40802, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 40824, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 40845, 0x00000C33 }, /* GL_STEREO */ + { 40855, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */ + { 40879, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */ + { 40904, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */ + { 40928, 0x000088E2 }, /* GL_STREAM_COPY */ + { 40943, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 40962, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 40977, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 40996, 0x000088E1 }, /* GL_STREAM_READ */ + { 41011, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 41030, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 41047, 0x000084E7 }, /* GL_SUBTRACT */ + { 41059, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 41075, 0x00009113 }, /* GL_SYNC_CONDITION */ + { 41093, 0x00009116 }, /* GL_SYNC_FENCE */ + { 41107, 0x00009115 }, /* GL_SYNC_FLAGS */ + { 41121, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */ + { 41148, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ + { 41178, 0x00009114 }, /* GL_SYNC_STATUS */ + { 41193, 0x00002001 }, /* GL_T */ + { 41198, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 41213, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 41232, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 41248, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 41263, 0x00002A27 }, /* GL_T2F_V3F */ + { 41274, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 41293, 0x00002A28 }, /* GL_T4F_V4F */ + { 41304, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 41327, 0x00001702 }, /* GL_TEXTURE */ + { 41338, 0x000084C0 }, /* GL_TEXTURE0 */ + { 41350, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 41366, 0x000084C1 }, /* GL_TEXTURE1 */ + { 41378, 0x000084CA }, /* GL_TEXTURE10 */ + { 41391, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 41408, 0x000084CB }, /* GL_TEXTURE11 */ + { 41421, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 41438, 0x000084CC }, /* GL_TEXTURE12 */ + { 41451, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 41468, 0x000084CD }, /* GL_TEXTURE13 */ + { 41481, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 41498, 0x000084CE }, /* GL_TEXTURE14 */ + { 41511, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 41528, 0x000084CF }, /* GL_TEXTURE15 */ + { 41541, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 41558, 0x000084D0 }, /* GL_TEXTURE16 */ + { 41571, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 41588, 0x000084D1 }, /* GL_TEXTURE17 */ + { 41601, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 41618, 0x000084D2 }, /* GL_TEXTURE18 */ + { 41631, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 41648, 0x000084D3 }, /* GL_TEXTURE19 */ + { 41661, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 41678, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 41694, 0x000084C2 }, /* GL_TEXTURE2 */ + { 41706, 0x000084D4 }, /* GL_TEXTURE20 */ + { 41719, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 41736, 0x000084D5 }, /* GL_TEXTURE21 */ + { 41749, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 41766, 0x000084D6 }, /* GL_TEXTURE22 */ + { 41779, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 41796, 0x000084D7 }, /* GL_TEXTURE23 */ + { 41809, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 41826, 0x000084D8 }, /* GL_TEXTURE24 */ + { 41839, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 41856, 0x000084D9 }, /* GL_TEXTURE25 */ + { 41869, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 41886, 0x000084DA }, /* GL_TEXTURE26 */ + { 41899, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 41916, 0x000084DB }, /* GL_TEXTURE27 */ + { 41929, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 41946, 0x000084DC }, /* GL_TEXTURE28 */ + { 41959, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 41976, 0x000084DD }, /* GL_TEXTURE29 */ + { 41989, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 42006, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 42022, 0x000084C3 }, /* GL_TEXTURE3 */ + { 42034, 0x000084DE }, /* GL_TEXTURE30 */ + { 42047, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 42064, 0x000084DF }, /* GL_TEXTURE31 */ + { 42077, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 42094, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 42110, 0x000084C4 }, /* GL_TEXTURE4 */ + { 42122, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 42138, 0x000084C5 }, /* GL_TEXTURE5 */ + { 42150, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 42166, 0x000084C6 }, /* GL_TEXTURE6 */ + { 42178, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 42194, 0x000084C7 }, /* GL_TEXTURE7 */ + { 42206, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 42222, 0x000084C8 }, /* GL_TEXTURE8 */ + { 42234, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 42250, 0x000084C9 }, /* GL_TEXTURE9 */ + { 42262, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 42278, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 42292, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY */ + { 42312, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 42336, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 42350, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY */ + { 42370, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 42394, 0x0000806F }, /* GL_TEXTURE_3D */ + { 42408, 0x0000806F }, /* GL_TEXTURE_3D_OES */ + { 42426, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 42448, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 42474, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 42496, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 42518, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY */ + { 42546, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 42578, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 42600, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY */ + { 42628, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 42660, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 42682, 0x0000806A }, /* GL_TEXTURE_BINDING_3D_OES */ + { 42708, 0x00008C2C }, /* GL_TEXTURE_BINDING_BUFFER */ + { 42734, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 42762, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 42794, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_OES */ + { 42826, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE */ + { 42855, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 42888, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 42920, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 42935, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 42956, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 42981, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 42999, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 43023, 0x00008C2A }, /* GL_TEXTURE_BUFFER */ + { 43041, 0x00008C2D }, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */ + { 43078, 0x00008C2E }, /* GL_TEXTURE_BUFFER_FORMAT */ + { 43103, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 43134, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 43164, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 43194, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 43229, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 43260, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 43298, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 43325, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 43357, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 43391, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 43415, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 43443, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 43467, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 43495, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 43528, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 43552, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 43574, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 43596, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 43622, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 43656, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 43689, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 43726, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 43754, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 43786, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 43809, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 43847, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 43889, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 43920, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 43948, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 43978, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 44006, 0x00008B9D }, /* GL_TEXTURE_CROP_RECT_OES */ + { 44031, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 44051, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 44075, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 44106, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 44141, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES */ + { 44176, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 44207, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 44242, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES */ + { 44277, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 44308, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 44343, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES */ + { 44378, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_OES */ + { 44402, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 44433, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 44468, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES */ + { 44503, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 44534, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 44569, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES */ + { 44604, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 44635, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 44670, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */ + { 44705, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + { 44734, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 44751, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 44773, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 44799, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 44814, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 44835, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 44855, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 44881, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL_EXT */ + { 44911, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 44931, 0x00002500 }, /* GL_TEXTURE_GEN_MODE_OES */ + { 44955, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 44972, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 44989, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 45006, 0x00008D60 }, /* GL_TEXTURE_GEN_STR_OES */ + { 45029, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 45046, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 45071, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 45093, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 45119, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 45137, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 45163, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 45189, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 45219, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 45246, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 45271, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 45291, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 45315, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 45342, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 45369, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 45396, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 45422, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 45452, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 45474, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 45492, 0x0000898F }, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */ + { 45532, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 45562, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 45590, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 45618, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 45646, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 45667, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 45686, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 45708, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 45727, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 45747, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ + { 45777, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */ + { 45808, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE */ + { 45829, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 45854, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 45878, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 45898, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 45922, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 45942, 0x00008C3F }, /* GL_TEXTURE_SHARED_SIZE */ + { 45965, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 45988, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ + { 46012, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */ + { 46040, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */ + { 46070, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 46095, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 46129, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 46146, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 46164, 0x00008072 }, /* GL_TEXTURE_WRAP_R_OES */ + { 46186, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 46204, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 46222, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */ + { 46241, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 46261, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 46280, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 46309, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 46326, 0x00008E22 }, /* GL_TRANSFORM_FEEDBACK */ + { 46348, 0x00008E25 }, /* GL_TRANSFORM_FEEDBACK_BINDING */ + { 46378, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER */ + { 46407, 0x00008E24 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ + { 46443, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */ + { 46480, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */ + { 46521, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */ + { 46554, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */ + { 46588, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */ + { 46626, 0x00008E23 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ + { 46662, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */ + { 46696, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */ + { 46734, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */ + { 46769, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */ + { 46808, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */ + { 46849, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */ + { 46894, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS */ + { 46925, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */ + { 46960, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */ + { 47001, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */ + { 47046, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 47072, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 47102, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 47134, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 47164, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 47198, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 47214, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 47245, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 47280, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 47308, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 47340, 0x00000004 }, /* GL_TRIANGLES */ + { 47353, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY */ + { 47376, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY_ARB */ + { 47403, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 47419, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 47440, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 47458, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY */ + { 47486, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY_ARB */ + { 47518, 0x00000001 }, /* GL_TRUE */ + { 47526, 0x00008A1C }, /* GL_UNDEFINED_APPLE */ + { 47545, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 47565, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 47588, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 47608, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 47629, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 47651, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 47673, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 47693, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 47714, 0x00009118 }, /* GL_UNSIGNALED */ + { 47728, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 47745, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 47772, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 47795, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 47811, 0x00008C3B }, /* GL_UNSIGNED_INT_10F_11F_11F_REV */ + { 47843, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 47870, 0x00008DF6 }, /* GL_UNSIGNED_INT_10_10_10_2_OES */ + { 47901, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ + { 47922, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */ + { 47947, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 47971, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_OES */ + { 47996, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 48027, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV_EXT */ + { 48062, 0x00008C3E }, /* GL_UNSIGNED_INT_5_9_9_9_REV */ + { 48090, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 48114, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 48142, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D */ + { 48169, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */ + { 48202, 0x00008DD6 }, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT */ + { 48239, 0x00008DD1 }, /* GL_UNSIGNED_INT_SAMPLER_1D_EXT */ + { 48270, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D */ + { 48297, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */ + { 48330, 0x00008DD7 }, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT */ + { 48367, 0x00008DD2 }, /* GL_UNSIGNED_INT_SAMPLER_2D_EXT */ + { 48398, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */ + { 48430, 0x00008DD5 }, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT */ + { 48466, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D */ + { 48493, 0x00008DD3 }, /* GL_UNSIGNED_INT_SAMPLER_3D_EXT */ + { 48524, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */ + { 48555, 0x00008DD8 }, /* GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT */ + { 48590, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE */ + { 48619, 0x00008DD4 }, /* GL_UNSIGNED_INT_SAMPLER_CUBE_EXT */ + { 48652, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2 */ + { 48673, 0x00008DC6 }, /* GL_UNSIGNED_INT_VEC2_EXT */ + { 48698, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3 */ + { 48719, 0x00008DC7 }, /* GL_UNSIGNED_INT_VEC3_EXT */ + { 48744, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4 */ + { 48765, 0x00008DC8 }, /* GL_UNSIGNED_INT_VEC4_EXT */ + { 48790, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ + { 48813, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 48831, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 48861, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT */ + { 48895, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 48921, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 48951, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT */ + { 48985, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 49011, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 49035, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 49063, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 49091, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 49118, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 49150, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 49181, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 49195, 0x00002A20 }, /* GL_V2F */ + { 49202, 0x00002A21 }, /* GL_V3F */ + { 49209, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 49228, 0x00001F00 }, /* GL_VENDOR */ + { 49238, 0x00001F02 }, /* GL_VERSION */ + { 49249, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 49265, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ + { 49289, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 49319, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 49350, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 49385, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 49409, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 49430, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 49453, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 49474, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 49501, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 49529, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 49557, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 49585, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 49613, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 49641, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 49669, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 49696, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 49723, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 49750, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 49777, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 49804, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 49831, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 49858, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 49885, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 49912, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 49950, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 49992, 0x000088FE }, /* GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB */ + { 50027, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 50058, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 50093, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */ + { 50124, 0x000088FD }, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT */ + { 50159, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 50193, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 50231, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 50262, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 50297, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 50325, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 50357, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 50387, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 50421, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 50449, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 50481, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 50501, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 50523, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 50552, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 50573, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 50602, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 50635, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 50667, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 50694, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 50725, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 50755, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 50772, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 50793, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 50820, 0x00000BA2 }, /* GL_VIEWPORT */ + { 50832, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 50848, 0x00008A1A }, /* GL_VOLATILE_APPLE */ + { 50866, 0x0000911D }, /* GL_WAIT_FAILED */ + { 50881, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 50901, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 50932, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 50967, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_OES */ + { 51002, 0x000086AD }, /* GL_WEIGHT_ARRAY_OES */ + { 51022, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 51050, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_OES */ + { 51078, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 51103, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_OES */ + { 51128, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 51155, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_OES */ + { 51182, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 51207, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_OES */ + { 51232, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 51256, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 51275, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 51289, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 51307, 0x000088B9 }, /* GL_WRITE_ONLY_OES */ + { 51325, 0x00001506 }, /* GL_XOR */ + { 51332, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 51351, 0x00008757 }, /* GL_YCBCR_MESA */ + { 51365, 0x00000000 }, /* GL_ZERO */ + { 51373, 0x00000D16 }, /* GL_ZOOM_X */ + { 51383, 0x00000D17 }, /* GL_ZOOM_Y */ +}; + +static const unsigned reduced_enums[1552] = +{ + 535, /* GL_FALSE */ + 827, /* GL_LINES */ + 831, /* GL_LINE_LOOP */ + 838, /* GL_LINE_STRIP */ + 2135, /* GL_TRIANGLES */ + 2140, /* GL_TRIANGLE_STRIP */ + 2138, /* GL_TRIANGLE_FAN */ + 1507, /* GL_QUADS */ + 1511, /* GL_QUAD_STRIP */ + 1378, /* GL_POLYGON */ + 828, /* GL_LINES_ADJACENCY */ + 839, /* GL_LINE_STRIP_ADJACENCY */ + 2136, /* GL_TRIANGLES_ADJACENCY */ + 2141, /* GL_TRIANGLE_STRIP_ADJACENCY */ + 1390, /* GL_POLYGON_STIPPLE_BIT */ + 1333, /* GL_PIXEL_MODE_BIT */ + 814, /* GL_LIGHTING_BIT */ + 568, /* GL_FOG_BIT */ + 8, /* GL_ACCUM */ + 850, /* GL_LOAD */ + 1596, /* GL_RETURN */ + 1200, /* GL_MULT */ + 24, /* GL_ADD */ + 1216, /* GL_NEVER */ + 804, /* GL_LESS */ + 525, /* GL_EQUAL */ + 803, /* GL_LEQUAL */ + 691, /* GL_GREATER */ + 1233, /* GL_NOTEQUAL */ + 690, /* GL_GEQUAL */ + 55, /* GL_ALWAYS */ + 1803, /* GL_SRC_COLOR */ + 1266, /* GL_ONE_MINUS_SRC_COLOR */ + 1801, /* GL_SRC_ALPHA */ + 1265, /* GL_ONE_MINUS_SRC_ALPHA */ + 504, /* GL_DST_ALPHA */ + 1263, /* GL_ONE_MINUS_DST_ALPHA */ + 505, /* GL_DST_COLOR */ + 1264, /* GL_ONE_MINUS_DST_COLOR */ + 1802, /* GL_SRC_ALPHA_SATURATE */ + 667, /* GL_FRONT_LEFT */ + 668, /* GL_FRONT_RIGHT */ + 77, /* GL_BACK_LEFT */ + 78, /* GL_BACK_RIGHT */ + 664, /* GL_FRONT */ + 76, /* GL_BACK */ + 802, /* GL_LEFT */ + 1685, /* GL_RIGHT */ + 665, /* GL_FRONT_AND_BACK */ + 71, /* GL_AUX0 */ + 72, /* GL_AUX1 */ + 73, /* GL_AUX2 */ + 74, /* GL_AUX3 */ + 790, /* GL_INVALID_ENUM */ + 795, /* GL_INVALID_VALUE */ + 794, /* GL_INVALID_OPERATION */ + 1808, /* GL_STACK_OVERFLOW */ + 1809, /* GL_STACK_UNDERFLOW */ + 1291, /* GL_OUT_OF_MEMORY */ + 791, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + 0, /* GL_2D */ + 2, /* GL_3D */ + 3, /* GL_3D_COLOR */ + 4, /* GL_3D_COLOR_TEXTURE */ + 6, /* GL_4D_COLOR_TEXTURE */ + 1311, /* GL_PASS_THROUGH_TOKEN */ + 1377, /* GL_POINT_TOKEN */ + 841, /* GL_LINE_TOKEN */ + 1391, /* GL_POLYGON_TOKEN */ + 87, /* GL_BITMAP_TOKEN */ + 503, /* GL_DRAW_PIXEL_TOKEN */ + 349, /* GL_COPY_PIXEL_TOKEN */ + 832, /* GL_LINE_RESET_TOKEN */ + 528, /* GL_EXP */ + 529, /* GL_EXP2 */ + 386, /* GL_CW */ + 154, /* GL_CCW */ + 184, /* GL_COEFF */ + 1288, /* GL_ORDER */ + 440, /* GL_DOMAIN */ + 359, /* GL_CURRENT_COLOR */ + 362, /* GL_CURRENT_INDEX */ + 368, /* GL_CURRENT_NORMAL */ + 382, /* GL_CURRENT_TEXTURE_COORDS */ + 374, /* GL_CURRENT_RASTER_COLOR */ + 376, /* GL_CURRENT_RASTER_INDEX */ + 380, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + 377, /* GL_CURRENT_RASTER_POSITION */ + 378, /* GL_CURRENT_RASTER_POSITION_VALID */ + 375, /* GL_CURRENT_RASTER_DISTANCE */ + 1369, /* GL_POINT_SMOOTH */ + 1353, /* GL_POINT_SIZE */ + 1368, /* GL_POINT_SIZE_RANGE */ + 1359, /* GL_POINT_SIZE_GRANULARITY */ + 833, /* GL_LINE_SMOOTH */ + 842, /* GL_LINE_WIDTH */ + 844, /* GL_LINE_WIDTH_RANGE */ + 843, /* GL_LINE_WIDTH_GRANULARITY */ + 835, /* GL_LINE_STIPPLE */ + 836, /* GL_LINE_STIPPLE_PATTERN */ + 837, /* GL_LINE_STIPPLE_REPEAT */ + 849, /* GL_LIST_MODE */ + 1056, /* GL_MAX_LIST_NESTING */ + 846, /* GL_LIST_BASE */ + 848, /* GL_LIST_INDEX */ + 1380, /* GL_POLYGON_MODE */ + 1387, /* GL_POLYGON_SMOOTH */ + 1389, /* GL_POLYGON_STIPPLE */ + 514, /* GL_EDGE_FLAG */ + 352, /* GL_CULL_FACE */ + 353, /* GL_CULL_FACE_MODE */ + 666, /* GL_FRONT_FACE */ + 813, /* GL_LIGHTING */ + 818, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + 819, /* GL_LIGHT_MODEL_TWO_SIDE */ + 815, /* GL_LIGHT_MODEL_AMBIENT */ + 1750, /* GL_SHADE_MODEL */ + 232, /* GL_COLOR_MATERIAL_FACE */ + 233, /* GL_COLOR_MATERIAL_PARAMETER */ + 231, /* GL_COLOR_MATERIAL */ + 567, /* GL_FOG */ + 589, /* GL_FOG_INDEX */ + 585, /* GL_FOG_DENSITY */ + 593, /* GL_FOG_START */ + 587, /* GL_FOG_END */ + 590, /* GL_FOG_MODE */ + 569, /* GL_FOG_COLOR */ + 425, /* GL_DEPTH_RANGE */ + 434, /* GL_DEPTH_TEST */ + 437, /* GL_DEPTH_WRITEMASK */ + 410, /* GL_DEPTH_CLEAR_VALUE */ + 424, /* GL_DEPTH_FUNC */ + 12, /* GL_ACCUM_CLEAR_VALUE */ + 1853, /* GL_STENCIL_TEST */ + 1834, /* GL_STENCIL_CLEAR_VALUE */ + 1836, /* GL_STENCIL_FUNC */ + 1855, /* GL_STENCIL_VALUE_MASK */ + 1835, /* GL_STENCIL_FAIL */ + 1850, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1851, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1852, /* GL_STENCIL_REF */ + 1856, /* GL_STENCIL_WRITEMASK */ + 1006, /* GL_MATRIX_MODE */ + 1222, /* GL_NORMALIZE */ + 2267, /* GL_VIEWPORT */ + 1195, /* GL_MODELVIEW_STACK_DEPTH */ + 1481, /* GL_PROJECTION_STACK_DEPTH */ + 2089, /* GL_TEXTURE_STACK_DEPTH */ + 1192, /* GL_MODELVIEW_MATRIX */ + 1479, /* GL_PROJECTION_MATRIX */ + 2069, /* GL_TEXTURE_MATRIX */ + 69, /* GL_ATTRIB_STACK_DEPTH */ + 166, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ + 51, /* GL_ALPHA_TEST */ + 52, /* GL_ALPHA_TEST_FUNC */ + 53, /* GL_ALPHA_TEST_REF */ + 439, /* GL_DITHER */ + 91, /* GL_BLEND_DST */ + 105, /* GL_BLEND_SRC */ + 88, /* GL_BLEND */ + 852, /* GL_LOGIC_OP_MODE */ + 739, /* GL_INDEX_LOGIC_OP */ + 230, /* GL_COLOR_LOGIC_OP */ + 75, /* GL_AUX_BUFFERS */ + 450, /* GL_DRAW_BUFFER */ + 1534, /* GL_READ_BUFFER */ + 1727, /* GL_SCISSOR_BOX */ + 1728, /* GL_SCISSOR_TEST */ + 738, /* GL_INDEX_CLEAR_VALUE */ + 743, /* GL_INDEX_WRITEMASK */ + 227, /* GL_COLOR_CLEAR_VALUE */ + 269, /* GL_COLOR_WRITEMASK */ + 740, /* GL_INDEX_MODE */ + 1674, /* GL_RGBA_MODE */ + 449, /* GL_DOUBLEBUFFER */ + 1857, /* GL_STEREO */ + 1588, /* GL_RENDER_MODE */ + 1312, /* GL_PERSPECTIVE_CORRECTION_HINT */ + 1370, /* GL_POINT_SMOOTH_HINT */ + 834, /* GL_LINE_SMOOTH_HINT */ + 1388, /* GL_POLYGON_SMOOTH_HINT */ + 588, /* GL_FOG_HINT */ + 2049, /* GL_TEXTURE_GEN_S */ + 2051, /* GL_TEXTURE_GEN_T */ + 2048, /* GL_TEXTURE_GEN_R */ + 2047, /* GL_TEXTURE_GEN_Q */ + 1325, /* GL_PIXEL_MAP_I_TO_I */ + 1331, /* GL_PIXEL_MAP_S_TO_S */ + 1327, /* GL_PIXEL_MAP_I_TO_R */ + 1323, /* GL_PIXEL_MAP_I_TO_G */ + 1321, /* GL_PIXEL_MAP_I_TO_B */ + 1319, /* GL_PIXEL_MAP_I_TO_A */ + 1329, /* GL_PIXEL_MAP_R_TO_R */ + 1317, /* GL_PIXEL_MAP_G_TO_G */ + 1315, /* GL_PIXEL_MAP_B_TO_B */ + 1313, /* GL_PIXEL_MAP_A_TO_A */ + 1326, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + 1332, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + 1328, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + 1324, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + 1322, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + 1320, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + 1330, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + 1318, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + 1316, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + 1314, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + 2152, /* GL_UNPACK_SWAP_BYTES */ + 2147, /* GL_UNPACK_LSB_FIRST */ + 2148, /* GL_UNPACK_ROW_LENGTH */ + 2151, /* GL_UNPACK_SKIP_ROWS */ + 2150, /* GL_UNPACK_SKIP_PIXELS */ + 2145, /* GL_UNPACK_ALIGNMENT */ + 1300, /* GL_PACK_SWAP_BYTES */ + 1295, /* GL_PACK_LSB_FIRST */ + 1296, /* GL_PACK_ROW_LENGTH */ + 1299, /* GL_PACK_SKIP_ROWS */ + 1298, /* GL_PACK_SKIP_PIXELS */ + 1292, /* GL_PACK_ALIGNMENT */ + 947, /* GL_MAP_COLOR */ + 952, /* GL_MAP_STENCIL */ + 742, /* GL_INDEX_SHIFT */ + 741, /* GL_INDEX_OFFSET */ + 1550, /* GL_RED_SCALE */ + 1546, /* GL_RED_BIAS */ + 2293, /* GL_ZOOM_X */ + 2294, /* GL_ZOOM_Y */ + 697, /* GL_GREEN_SCALE */ + 693, /* GL_GREEN_BIAS */ + 115, /* GL_BLUE_SCALE */ + 111, /* GL_BLUE_BIAS */ + 50, /* GL_ALPHA_SCALE */ + 47, /* GL_ALPHA_BIAS */ + 426, /* GL_DEPTH_SCALE */ + 402, /* GL_DEPTH_BIAS */ + 1038, /* GL_MAX_EVAL_ORDER */ + 1055, /* GL_MAX_LIGHTS */ + 1018, /* GL_MAX_CLIP_DISTANCES */ + 1110, /* GL_MAX_TEXTURE_SIZE */ + 1062, /* GL_MAX_PIXEL_MAP_TABLE */ + 1014, /* GL_MAX_ATTRIB_STACK_DEPTH */ + 1058, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + 1059, /* GL_MAX_NAME_STACK_DEPTH */ + 1090, /* GL_MAX_PROJECTION_STACK_DEPTH */ + 1111, /* GL_MAX_TEXTURE_STACK_DEPTH */ + 1137, /* GL_MAX_VIEWPORT_DIMS */ + 1015, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + 1867, /* GL_SUBPIXEL_BITS */ + 737, /* GL_INDEX_BITS */ + 1547, /* GL_RED_BITS */ + 694, /* GL_GREEN_BITS */ + 112, /* GL_BLUE_BITS */ + 48, /* GL_ALPHA_BITS */ + 403, /* GL_DEPTH_BITS */ + 1831, /* GL_STENCIL_BITS */ + 14, /* GL_ACCUM_RED_BITS */ + 13, /* GL_ACCUM_GREEN_BITS */ + 10, /* GL_ACCUM_BLUE_BITS */ + 9, /* GL_ACCUM_ALPHA_BITS */ + 1209, /* GL_NAME_STACK_DEPTH */ + 70, /* GL_AUTO_NORMAL */ + 893, /* GL_MAP1_COLOR_4 */ + 896, /* GL_MAP1_INDEX */ + 897, /* GL_MAP1_NORMAL */ + 898, /* GL_MAP1_TEXTURE_COORD_1 */ + 899, /* GL_MAP1_TEXTURE_COORD_2 */ + 900, /* GL_MAP1_TEXTURE_COORD_3 */ + 901, /* GL_MAP1_TEXTURE_COORD_4 */ + 902, /* GL_MAP1_VERTEX_3 */ + 903, /* GL_MAP1_VERTEX_4 */ + 920, /* GL_MAP2_COLOR_4 */ + 923, /* GL_MAP2_INDEX */ + 924, /* GL_MAP2_NORMAL */ + 925, /* GL_MAP2_TEXTURE_COORD_1 */ + 926, /* GL_MAP2_TEXTURE_COORD_2 */ + 927, /* GL_MAP2_TEXTURE_COORD_3 */ + 928, /* GL_MAP2_TEXTURE_COORD_4 */ + 929, /* GL_MAP2_VERTEX_3 */ + 930, /* GL_MAP2_VERTEX_4 */ + 894, /* GL_MAP1_GRID_DOMAIN */ + 895, /* GL_MAP1_GRID_SEGMENTS */ + 921, /* GL_MAP2_GRID_DOMAIN */ + 922, /* GL_MAP2_GRID_SEGMENTS */ + 1950, /* GL_TEXTURE_1D */ + 1953, /* GL_TEXTURE_2D */ + 538, /* GL_FEEDBACK_BUFFER_POINTER */ + 539, /* GL_FEEDBACK_BUFFER_SIZE */ + 540, /* GL_FEEDBACK_BUFFER_TYPE */ + 1737, /* GL_SELECTION_BUFFER_POINTER */ + 1738, /* GL_SELECTION_BUFFER_SIZE */ + 2095, /* GL_TEXTURE_WIDTH */ + 2055, /* GL_TEXTURE_HEIGHT */ + 1999, /* GL_TEXTURE_COMPONENTS */ + 1980, /* GL_TEXTURE_BORDER_COLOR */ + 1979, /* GL_TEXTURE_BORDER */ + 441, /* GL_DONT_CARE */ + 536, /* GL_FASTEST */ + 1217, /* GL_NICEST */ + 56, /* GL_AMBIENT */ + 438, /* GL_DIFFUSE */ + 1790, /* GL_SPECULAR */ + 1392, /* GL_POSITION */ + 1793, /* GL_SPOT_DIRECTION */ + 1794, /* GL_SPOT_EXPONENT */ + 1792, /* GL_SPOT_CUTOFF */ + 317, /* GL_CONSTANT_ATTENUATION */ + 822, /* GL_LINEAR_ATTENUATION */ + 1506, /* GL_QUADRATIC_ATTENUATION */ + 284, /* GL_COMPILE */ + 285, /* GL_COMPILE_AND_EXECUTE */ + 149, /* GL_BYTE */ + 2154, /* GL_UNSIGNED_BYTE */ + 1755, /* GL_SHORT */ + 2193, /* GL_UNSIGNED_SHORT */ + 745, /* GL_INT */ + 2157, /* GL_UNSIGNED_INT */ + 548, /* GL_FLOAT */ + 1, /* GL_2_BYTES */ + 5, /* GL_3_BYTES */ + 7, /* GL_4_BYTES */ + 448, /* GL_DOUBLE */ + 698, /* GL_HALF_FLOAT */ + 544, /* GL_FIXED */ + 162, /* GL_CLEAR */ + 58, /* GL_AND */ + 60, /* GL_AND_REVERSE */ + 347, /* GL_COPY */ + 59, /* GL_AND_INVERTED */ + 1220, /* GL_NOOP */ + 2289, /* GL_XOR */ + 1287, /* GL_OR */ + 1221, /* GL_NOR */ + 526, /* GL_EQUIV */ + 798, /* GL_INVERT */ + 1290, /* GL_OR_REVERSE */ + 348, /* GL_COPY_INVERTED */ + 1289, /* GL_OR_INVERTED */ + 1210, /* GL_NAND */ + 1744, /* GL_SET */ + 523, /* GL_EMISSION */ + 1754, /* GL_SHININESS */ + 57, /* GL_AMBIENT_AND_DIFFUSE */ + 229, /* GL_COLOR_INDEXES */ + 1159, /* GL_MODELVIEW */ + 1478, /* GL_PROJECTION */ + 1885, /* GL_TEXTURE */ + 185, /* GL_COLOR */ + 395, /* GL_DEPTH */ + 1816, /* GL_STENCIL */ + 228, /* GL_COLOR_INDEX */ + 1837, /* GL_STENCIL_INDEX */ + 411, /* GL_DEPTH_COMPONENT */ + 1543, /* GL_RED */ + 692, /* GL_GREEN */ + 110, /* GL_BLUE */ + 32, /* GL_ALPHA */ + 1599, /* GL_RGB */ + 1639, /* GL_RGBA */ + 856, /* GL_LUMINANCE */ + 883, /* GL_LUMINANCE_ALPHA */ + 86, /* GL_BITMAP */ + 1342, /* GL_POINT */ + 820, /* GL_LINE */ + 541, /* GL_FILL */ + 1557, /* GL_RENDER */ + 537, /* GL_FEEDBACK */ + 1736, /* GL_SELECT */ + 547, /* GL_FLAT */ + 1765, /* GL_SMOOTH */ + 799, /* GL_KEEP */ + 1590, /* GL_REPLACE */ + 727, /* GL_INCR */ + 391, /* GL_DECR */ + 2210, /* GL_VENDOR */ + 1587, /* GL_RENDERER */ + 2211, /* GL_VERSION */ + 530, /* GL_EXTENSIONS */ + 1686, /* GL_S */ + 1876, /* GL_T */ + 1526, /* GL_R */ + 1505, /* GL_Q */ + 1196, /* GL_MODULATE */ + 390, /* GL_DECAL */ + 2042, /* GL_TEXTURE_ENV_MODE */ + 2041, /* GL_TEXTURE_ENV_COLOR */ + 2040, /* GL_TEXTURE_ENV */ + 531, /* GL_EYE_LINEAR */ + 1248, /* GL_OBJECT_LINEAR */ + 1791, /* GL_SPHERE_MAP */ + 2045, /* GL_TEXTURE_GEN_MODE */ + 1250, /* GL_OBJECT_PLANE */ + 532, /* GL_EYE_PLANE */ + 1211, /* GL_NEAREST */ + 821, /* GL_LINEAR */ + 1215, /* GL_NEAREST_MIPMAP_NEAREST */ + 826, /* GL_LINEAR_MIPMAP_NEAREST */ + 1214, /* GL_NEAREST_MIPMAP_LINEAR */ + 825, /* GL_LINEAR_MIPMAP_LINEAR */ + 2068, /* GL_TEXTURE_MAG_FILTER */ + 2077, /* GL_TEXTURE_MIN_FILTER */ + 2098, /* GL_TEXTURE_WRAP_S */ + 2099, /* GL_TEXTURE_WRAP_T */ + 155, /* GL_CLAMP */ + 1589, /* GL_REPEAT */ + 1386, /* GL_POLYGON_OFFSET_UNITS */ + 1385, /* GL_POLYGON_OFFSET_POINT */ + 1384, /* GL_POLYGON_OFFSET_LINE */ + 1529, /* GL_R3_G3_B2 */ + 2207, /* GL_V2F */ + 2208, /* GL_V3F */ + 152, /* GL_C4UB_V2F */ + 153, /* GL_C4UB_V3F */ + 150, /* GL_C3F_V3F */ + 1208, /* GL_N3F_V3F */ + 151, /* GL_C4F_N3F_V3F */ + 1881, /* GL_T2F_V3F */ + 1883, /* GL_T4F_V4F */ + 1879, /* GL_T2F_C4UB_V3F */ + 1877, /* GL_T2F_C3F_V3F */ + 1880, /* GL_T2F_N3F_V3F */ + 1878, /* GL_T2F_C4F_N3F_V3F */ + 1882, /* GL_T4F_C4F_N3F_V4F */ + 169, /* GL_CLIP_DISTANCE0 */ + 170, /* GL_CLIP_DISTANCE1 */ + 171, /* GL_CLIP_DISTANCE2 */ + 172, /* GL_CLIP_DISTANCE3 */ + 173, /* GL_CLIP_DISTANCE4 */ + 174, /* GL_CLIP_DISTANCE5 */ + 175, /* GL_CLIP_DISTANCE6 */ + 176, /* GL_CLIP_DISTANCE7 */ + 805, /* GL_LIGHT0 */ + 806, /* GL_LIGHT1 */ + 807, /* GL_LIGHT2 */ + 808, /* GL_LIGHT3 */ + 809, /* GL_LIGHT4 */ + 810, /* GL_LIGHT5 */ + 811, /* GL_LIGHT6 */ + 812, /* GL_LIGHT7 */ + 702, /* GL_HINT_BIT */ + 319, /* GL_CONSTANT_COLOR */ + 1261, /* GL_ONE_MINUS_CONSTANT_COLOR */ + 314, /* GL_CONSTANT_ALPHA */ + 1259, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + 89, /* GL_BLEND_COLOR */ + 669, /* GL_FUNC_ADD */ + 1140, /* GL_MIN */ + 1009, /* GL_MAX */ + 96, /* GL_BLEND_EQUATION */ + 675, /* GL_FUNC_SUBTRACT */ + 672, /* GL_FUNC_REVERSE_SUBTRACT */ + 327, /* GL_CONVOLUTION_1D */ + 328, /* GL_CONVOLUTION_2D */ + 1739, /* GL_SEPARABLE_2D */ + 331, /* GL_CONVOLUTION_BORDER_MODE */ + 335, /* GL_CONVOLUTION_FILTER_SCALE */ + 333, /* GL_CONVOLUTION_FILTER_BIAS */ + 1544, /* GL_REDUCE */ + 337, /* GL_CONVOLUTION_FORMAT */ + 341, /* GL_CONVOLUTION_WIDTH */ + 339, /* GL_CONVOLUTION_HEIGHT */ + 1028, /* GL_MAX_CONVOLUTION_WIDTH */ + 1026, /* GL_MAX_CONVOLUTION_HEIGHT */ + 1425, /* GL_POST_CONVOLUTION_RED_SCALE */ + 1421, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + 1416, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + 1412, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + 1423, /* GL_POST_CONVOLUTION_RED_BIAS */ + 1419, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + 1414, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + 1410, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + 703, /* GL_HISTOGRAM */ + 1485, /* GL_PROXY_HISTOGRAM */ + 719, /* GL_HISTOGRAM_WIDTH */ + 709, /* GL_HISTOGRAM_FORMAT */ + 715, /* GL_HISTOGRAM_RED_SIZE */ + 711, /* GL_HISTOGRAM_GREEN_SIZE */ + 706, /* GL_HISTOGRAM_BLUE_SIZE */ + 704, /* GL_HISTOGRAM_ALPHA_SIZE */ + 713, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + 717, /* GL_HISTOGRAM_SINK */ + 1141, /* GL_MINMAX */ + 1143, /* GL_MINMAX_FORMAT */ + 1145, /* GL_MINMAX_SINK */ + 1884, /* GL_TABLE_TOO_LARGE_EXT */ + 2156, /* GL_UNSIGNED_BYTE_3_3_2 */ + 2196, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 2199, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 2168, /* GL_UNSIGNED_INT_8_8_8_8 */ + 2159, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1383, /* GL_POLYGON_OFFSET_FILL */ + 1382, /* GL_POLYGON_OFFSET_FACTOR */ + 1381, /* GL_POLYGON_OFFSET_BIAS */ + 1593, /* GL_RESCALE_NORMAL */ + 41, /* GL_ALPHA4 */ + 43, /* GL_ALPHA8 */ + 33, /* GL_ALPHA12 */ + 35, /* GL_ALPHA16 */ + 871, /* GL_LUMINANCE4 */ + 877, /* GL_LUMINANCE8 */ + 857, /* GL_LUMINANCE12 */ + 863, /* GL_LUMINANCE16 */ + 872, /* GL_LUMINANCE4_ALPHA4 */ + 875, /* GL_LUMINANCE6_ALPHA2 */ + 880, /* GL_LUMINANCE8_ALPHA8 */ + 860, /* GL_LUMINANCE12_ALPHA4 */ + 858, /* GL_LUMINANCE12_ALPHA12 */ + 866, /* GL_LUMINANCE16_ALPHA16 */ + 746, /* GL_INTENSITY */ + 755, /* GL_INTENSITY4 */ + 757, /* GL_INTENSITY8 */ + 747, /* GL_INTENSITY12 */ + 749, /* GL_INTENSITY16 */ + 1614, /* GL_RGB2_EXT */ + 1620, /* GL_RGB4 */ + 1623, /* GL_RGB5 */ + 1630, /* GL_RGB8 */ + 1600, /* GL_RGB10 */ + 1604, /* GL_RGB12 */ + 1606, /* GL_RGB16 */ + 1650, /* GL_RGBA2 */ + 1657, /* GL_RGBA4 */ + 1626, /* GL_RGB5_A1 */ + 1662, /* GL_RGBA8 */ + 1601, /* GL_RGB10_A2 */ + 1640, /* GL_RGBA12 */ + 1642, /* GL_RGBA16 */ + 2085, /* GL_TEXTURE_RED_SIZE */ + 2053, /* GL_TEXTURE_GREEN_SIZE */ + 1977, /* GL_TEXTURE_BLUE_SIZE */ + 1958, /* GL_TEXTURE_ALPHA_SIZE */ + 2066, /* GL_TEXTURE_LUMINANCE_SIZE */ + 2057, /* GL_TEXTURE_INTENSITY_SIZE */ + 1591, /* GL_REPLACE_EXT */ + 1489, /* GL_PROXY_TEXTURE_1D */ + 1493, /* GL_PROXY_TEXTURE_2D */ + 2093, /* GL_TEXTURE_TOO_LARGE_EXT */ + 2079, /* GL_TEXTURE_PRIORITY */ + 2087, /* GL_TEXTURE_RESIDENT */ + 1961, /* GL_TEXTURE_BINDING_1D */ + 1964, /* GL_TEXTURE_BINDING_2D */ + 1967, /* GL_TEXTURE_BINDING_3D */ + 1297, /* GL_PACK_SKIP_IMAGES */ + 1293, /* GL_PACK_IMAGE_HEIGHT */ + 2149, /* GL_UNPACK_SKIP_IMAGES */ + 2146, /* GL_UNPACK_IMAGE_HEIGHT */ + 1956, /* GL_TEXTURE_3D */ + 1497, /* GL_PROXY_TEXTURE_3D */ + 2037, /* GL_TEXTURE_DEPTH */ + 2096, /* GL_TEXTURE_WRAP_R */ + 1010, /* GL_MAX_3D_TEXTURE_SIZE */ + 2212, /* GL_VERTEX_ARRAY */ + 1223, /* GL_NORMAL_ARRAY */ + 186, /* GL_COLOR_ARRAY */ + 731, /* GL_INDEX_ARRAY */ + 2007, /* GL_TEXTURE_COORD_ARRAY */ + 515, /* GL_EDGE_FLAG_ARRAY */ + 2218, /* GL_VERTEX_ARRAY_SIZE */ + 2220, /* GL_VERTEX_ARRAY_TYPE */ + 2219, /* GL_VERTEX_ARRAY_STRIDE */ + 1228, /* GL_NORMAL_ARRAY_TYPE */ + 1227, /* GL_NORMAL_ARRAY_STRIDE */ + 190, /* GL_COLOR_ARRAY_SIZE */ + 192, /* GL_COLOR_ARRAY_TYPE */ + 191, /* GL_COLOR_ARRAY_STRIDE */ + 736, /* GL_INDEX_ARRAY_TYPE */ + 735, /* GL_INDEX_ARRAY_STRIDE */ + 2011, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 2013, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 2012, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 519, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + 2217, /* GL_VERTEX_ARRAY_POINTER */ + 1226, /* GL_NORMAL_ARRAY_POINTER */ + 189, /* GL_COLOR_ARRAY_POINTER */ + 734, /* GL_INDEX_ARRAY_POINTER */ + 2010, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 518, /* GL_EDGE_FLAG_ARRAY_POINTER */ + 1201, /* GL_MULTISAMPLE */ + 1713, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + 1715, /* GL_SAMPLE_ALPHA_TO_ONE */ + 1720, /* GL_SAMPLE_COVERAGE */ + 1717, /* GL_SAMPLE_BUFFERS */ + 1708, /* GL_SAMPLES */ + 1724, /* GL_SAMPLE_COVERAGE_VALUE */ + 1722, /* GL_SAMPLE_COVERAGE_INVERT */ + 234, /* GL_COLOR_MATRIX */ + 236, /* GL_COLOR_MATRIX_STACK_DEPTH */ + 1022, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + 1408, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + 1404, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + 1399, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + 1395, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + 1406, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + 1402, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + 1397, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + 1393, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + 1990, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1498, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + 1992, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 94, /* GL_BLEND_DST_RGB */ + 108, /* GL_BLEND_SRC_RGB */ + 92, /* GL_BLEND_DST_ALPHA */ + 106, /* GL_BLEND_SRC_ALPHA */ + 240, /* GL_COLOR_TABLE */ + 1418, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + 1401, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + 1484, /* GL_PROXY_COLOR_TABLE */ + 1488, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + 1487, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + 264, /* GL_COLOR_TABLE_SCALE */ + 244, /* GL_COLOR_TABLE_BIAS */ + 249, /* GL_COLOR_TABLE_FORMAT */ + 266, /* GL_COLOR_TABLE_WIDTH */ + 261, /* GL_COLOR_TABLE_RED_SIZE */ + 252, /* GL_COLOR_TABLE_GREEN_SIZE */ + 246, /* GL_COLOR_TABLE_BLUE_SIZE */ + 241, /* GL_COLOR_TABLE_ALPHA_SIZE */ + 258, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ + 255, /* GL_COLOR_TABLE_INTENSITY_SIZE */ + 79, /* GL_BGR */ + 80, /* GL_BGRA */ + 1037, /* GL_MAX_ELEMENTS_VERTICES */ + 1036, /* GL_MAX_ELEMENTS_INDICES */ + 2056, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 183, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ + 1364, /* GL_POINT_SIZE_MIN */ + 1360, /* GL_POINT_SIZE_MAX */ + 1349, /* GL_POINT_FADE_THRESHOLD_SIZE */ + 1345, /* GL_POINT_DISTANCE_ATTENUATION */ + 157, /* GL_CLAMP_TO_BORDER */ + 160, /* GL_CLAMP_TO_EDGE */ + 2078, /* GL_TEXTURE_MIN_LOD */ + 2076, /* GL_TEXTURE_MAX_LOD */ + 1960, /* GL_TEXTURE_BASE_LEVEL */ + 2075, /* GL_TEXTURE_MAX_LEVEL */ + 722, /* GL_IGNORE_BORDER_HP */ + 318, /* GL_CONSTANT_BORDER_HP */ + 1592, /* GL_REPLICATE_BORDER_HP */ + 329, /* GL_CONVOLUTION_BORDER_COLOR */ + 1256, /* GL_OCCLUSION_TEST_HP */ + 1257, /* GL_OCCLUSION_TEST_RESULT_HP */ + 823, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + 1984, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1986, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1988, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1989, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1987, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1985, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 1016, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + 1017, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1428, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + 1430, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + 1427, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + 1429, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + 2064, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 2065, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 2063, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 678, /* GL_GENERATE_MIPMAP */ + 679, /* GL_GENERATE_MIPMAP_HINT */ + 591, /* GL_FOG_OFFSET_SGIX */ + 592, /* GL_FOG_OFFSET_VALUE_SGIX */ + 1998, /* GL_TEXTURE_COMPARE_SGIX */ + 1997, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 2060, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 2052, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 412, /* GL_DEPTH_COMPONENT16 */ + 416, /* GL_DEPTH_COMPONENT24 */ + 420, /* GL_DEPTH_COMPONENT32 */ + 354, /* GL_CULL_VERTEX_EXT */ + 356, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + 355, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + 2285, /* GL_WRAP_BORDER_SUN */ + 1991, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 816, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + 1758, /* GL_SINGLE_COLOR */ + 1742, /* GL_SEPARATE_SPECULAR_COLOR */ + 1753, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + 603, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + 604, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + 615, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + 606, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + 602, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + 601, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + 605, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + 616, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + 633, /* GL_FRAMEBUFFER_DEFAULT */ + 660, /* GL_FRAMEBUFFER_UNDEFINED */ + 428, /* GL_DEPTH_STENCIL_ATTACHMENT */ + 892, /* GL_MAJOR_VERSION */ + 1147, /* GL_MINOR_VERSION */ + 1237, /* GL_NUM_EXTENSIONS */ + 324, /* GL_CONTEXT_FLAGS */ + 730, /* GL_INDEX */ + 406, /* GL_DEPTH_BUFFER */ + 1832, /* GL_STENCIL_BUFFER */ + 295, /* GL_COMPRESSED_RED */ + 296, /* GL_COMPRESSED_RG */ + 2155, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 2200, /* GL_UNSIGNED_SHORT_5_6_5 */ + 2201, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 2197, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 2194, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 2169, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 2165, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 2073, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 2074, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 2072, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 1151, /* GL_MIRRORED_REPEAT */ + 1679, /* GL_RGB_S3TC */ + 1622, /* GL_RGB4_S3TC */ + 1675, /* GL_RGBA_S3TC */ + 1661, /* GL_RGBA4_S3TC */ + 1670, /* GL_RGBA_DXT5_S3TC */ + 1658, /* GL_RGBA4_DXT5_S3TC */ + 306, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ + 301, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ + 302, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ + 303, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ + 1213, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + 1212, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + 824, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + 578, /* GL_FOG_COORDINATE_SOURCE */ + 570, /* GL_FOG_COORD */ + 594, /* GL_FRAGMENT_DEPTH */ + 360, /* GL_CURRENT_FOG_COORD */ + 577, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + 576, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + 575, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + 572, /* GL_FOG_COORDINATE_ARRAY */ + 238, /* GL_COLOR_SUM */ + 381, /* GL_CURRENT_SECONDARY_COLOR */ + 1733, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + 1735, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + 1734, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + 1732, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + 1729, /* GL_SECONDARY_COLOR_ARRAY */ + 379, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ + 29, /* GL_ALIASED_POINT_SIZE_RANGE */ + 28, /* GL_ALIASED_LINE_WIDTH_RANGE */ + 1886, /* GL_TEXTURE0 */ + 1888, /* GL_TEXTURE1 */ + 1910, /* GL_TEXTURE2 */ + 1932, /* GL_TEXTURE3 */ + 1938, /* GL_TEXTURE4 */ + 1940, /* GL_TEXTURE5 */ + 1942, /* GL_TEXTURE6 */ + 1944, /* GL_TEXTURE7 */ + 1946, /* GL_TEXTURE8 */ + 1948, /* GL_TEXTURE9 */ + 1889, /* GL_TEXTURE10 */ + 1891, /* GL_TEXTURE11 */ + 1893, /* GL_TEXTURE12 */ + 1895, /* GL_TEXTURE13 */ + 1897, /* GL_TEXTURE14 */ + 1899, /* GL_TEXTURE15 */ + 1901, /* GL_TEXTURE16 */ + 1903, /* GL_TEXTURE17 */ + 1905, /* GL_TEXTURE18 */ + 1907, /* GL_TEXTURE19 */ + 1911, /* GL_TEXTURE20 */ + 1913, /* GL_TEXTURE21 */ + 1915, /* GL_TEXTURE22 */ + 1917, /* GL_TEXTURE23 */ + 1919, /* GL_TEXTURE24 */ + 1921, /* GL_TEXTURE25 */ + 1923, /* GL_TEXTURE26 */ + 1925, /* GL_TEXTURE27 */ + 1927, /* GL_TEXTURE28 */ + 1929, /* GL_TEXTURE29 */ + 1933, /* GL_TEXTURE30 */ + 1935, /* GL_TEXTURE31 */ + 19, /* GL_ACTIVE_TEXTURE */ + 163, /* GL_CLIENT_ACTIVE_TEXTURE */ + 1112, /* GL_MAX_TEXTURE_UNITS */ + 2128, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 2131, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 2133, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 2125, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1868, /* GL_SUBTRACT */ + 1094, /* GL_MAX_RENDERBUFFER_SIZE */ + 287, /* GL_COMPRESSED_ALPHA */ + 291, /* GL_COMPRESSED_LUMINANCE */ + 292, /* GL_COMPRESSED_LUMINANCE_ALPHA */ + 289, /* GL_COMPRESSED_INTENSITY */ + 297, /* GL_COMPRESSED_RGB */ + 298, /* GL_COMPRESSED_RGBA */ + 2005, /* GL_TEXTURE_COMPRESSION_HINT */ + 2082, /* GL_TEXTURE_RECTANGLE */ + 1973, /* GL_TEXTURE_BINDING_RECTANGLE */ + 1501, /* GL_PROXY_TEXTURE_RECTANGLE */ + 1091, /* GL_MAX_RECTANGLE_TEXTURE_SIZE */ + 427, /* GL_DEPTH_STENCIL */ + 2161, /* GL_UNSIGNED_INT_24_8 */ + 1107, /* GL_MAX_TEXTURE_LOD_BIAS */ + 2071, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 1109, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + 2043, /* GL_TEXTURE_FILTER_CONTROL */ + 2061, /* GL_TEXTURE_LOD_BIAS */ + 271, /* GL_COMBINE4 */ + 1100, /* GL_MAX_SHININESS_NV */ + 1101, /* GL_MAX_SPOT_EXPONENT_NV */ + 728, /* GL_INCR_WRAP */ + 392, /* GL_DECR_WRAP */ + 1171, /* GL_MODELVIEW1_ARB */ + 1229, /* GL_NORMAL_MAP */ + 1552, /* GL_REFLECTION_MAP */ + 2015, /* GL_TEXTURE_CUBE_MAP */ + 1970, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 2027, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 2017, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 2030, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 2020, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 2033, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 2023, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1499, /* GL_PROXY_TEXTURE_CUBE_MAP */ + 1030, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + 1207, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + 1442, /* GL_PRIMITIVE_RESTART_NV */ + 1441, /* GL_PRIMITIVE_RESTART_INDEX_NV */ + 586, /* GL_FOG_DISTANCE_MODE_NV */ + 534, /* GL_EYE_RADIAL_NV */ + 533, /* GL_EYE_PLANE_ABSOLUTE_NV */ + 270, /* GL_COMBINE */ + 277, /* GL_COMBINE_RGB */ + 272, /* GL_COMBINE_ALPHA */ + 1680, /* GL_RGB_SCALE */ + 25, /* GL_ADD_SIGNED */ + 764, /* GL_INTERPOLATE */ + 313, /* GL_CONSTANT */ + 1434, /* GL_PRIMARY_COLOR */ + 1431, /* GL_PREVIOUS */ + 1773, /* GL_SOURCE0_RGB */ + 1779, /* GL_SOURCE1_RGB */ + 1785, /* GL_SOURCE2_RGB */ + 1789, /* GL_SOURCE3_RGB_NV */ + 1770, /* GL_SOURCE0_ALPHA */ + 1776, /* GL_SOURCE1_ALPHA */ + 1782, /* GL_SOURCE2_ALPHA */ + 1788, /* GL_SOURCE3_ALPHA_NV */ + 1270, /* GL_OPERAND0_RGB */ + 1276, /* GL_OPERAND1_RGB */ + 1282, /* GL_OPERAND2_RGB */ + 1286, /* GL_OPERAND3_RGB_NV */ + 1267, /* GL_OPERAND0_ALPHA */ + 1273, /* GL_OPERAND1_ALPHA */ + 1279, /* GL_OPERAND2_ALPHA */ + 1285, /* GL_OPERAND3_ALPHA_NV */ + 137, /* GL_BUFFER_OBJECT_APPLE */ + 2213, /* GL_VERTEX_ARRAY_BINDING */ + 2080, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ + 2081, /* GL_TEXTURE_RANGE_POINTER_APPLE */ + 2290, /* GL_YCBCR_422_APPLE */ + 2202, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 2204, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 2092, /* GL_TEXTURE_STORAGE_HINT_APPLE */ + 1859, /* GL_STORAGE_PRIVATE_APPLE */ + 1858, /* GL_STORAGE_CACHED_APPLE */ + 1860, /* GL_STORAGE_SHARED_APPLE */ + 1760, /* GL_SLICE_ACCUM_SUN */ + 1510, /* GL_QUAD_MESH_SUN */ + 2139, /* GL_TRIANGLE_MESH_SUN */ + 2255, /* GL_VERTEX_PROGRAM_ARB */ + 2266, /* GL_VERTEX_STATE_PROGRAM_NV */ + 2240, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 2248, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 2250, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 2252, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 383, /* GL_CURRENT_VERTEX_ATTRIB */ + 1455, /* GL_PROGRAM_LENGTH_ARB */ + 1471, /* GL_PROGRAM_STRING_ARB */ + 1194, /* GL_MODELVIEW_PROJECTION_NV */ + 721, /* GL_IDENTITY_NV */ + 796, /* GL_INVERSE_NV */ + 2130, /* GL_TRANSPOSE_NV */ + 797, /* GL_INVERSE_TRANSPOSE_NV */ + 1075, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + 1074, /* GL_MAX_PROGRAM_MATRICES_ARB */ + 956, /* GL_MATRIX0_NV */ + 968, /* GL_MATRIX1_NV */ + 980, /* GL_MATRIX2_NV */ + 984, /* GL_MATRIX3_NV */ + 986, /* GL_MATRIX4_NV */ + 988, /* GL_MATRIX5_NV */ + 990, /* GL_MATRIX6_NV */ + 992, /* GL_MATRIX7_NV */ + 366, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + 363, /* GL_CURRENT_MATRIX_ARB */ + 1468, /* GL_PROGRAM_POINT_SIZE */ + 2261, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1467, /* GL_PROGRAM_PARAMETER_NV */ + 2246, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1473, /* GL_PROGRAM_TARGET_NV */ + 1470, /* GL_PROGRAM_RESIDENT_NV */ + 2102, /* GL_TRACK_MATRIX_NV */ + 2103, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 2256, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1449, /* GL_PROGRAM_ERROR_POSITION_ARB */ + 408, /* GL_DEPTH_CLAMP */ + 2221, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 2228, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 2229, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 2230, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 2231, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 2232, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 2233, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 2234, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 2235, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 2236, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 2222, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 2223, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 2224, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 2225, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 2226, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 2227, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 904, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + 911, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + 912, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + 913, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + 914, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + 915, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + 916, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + 917, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + 918, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + 919, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + 905, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + 906, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + 907, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + 908, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + 909, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + 910, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + 931, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + 938, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + 939, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + 940, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + 941, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + 942, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + 943, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + 1448, /* GL_PROGRAM_BINDING_ARB */ + 945, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + 946, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + 932, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + 933, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + 934, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + 935, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + 936, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + 937, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + 2003, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 2000, /* GL_TEXTURE_COMPRESSED */ + 1235, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + 311, /* GL_COMPRESSED_TEXTURE_FORMATS */ + 1134, /* GL_MAX_VERTEX_UNITS_ARB */ + 23, /* GL_ACTIVE_VERTEX_UNITS_ARB */ + 2284, /* GL_WEIGHT_SUM_UNITY_ARB */ + 2254, /* GL_VERTEX_BLEND_ARB */ + 385, /* GL_CURRENT_WEIGHT_ARB */ + 2282, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 2280, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 2278, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 2276, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 2271, /* GL_WEIGHT_ARRAY_ARB */ + 442, /* GL_DOT3_RGB */ + 443, /* GL_DOT3_RGBA */ + 305, /* GL_COMPRESSED_RGB_FXT1_3DFX */ + 300, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ + 1202, /* GL_MULTISAMPLE_3DFX */ + 1718, /* GL_SAMPLE_BUFFERS_3DFX */ + 1709, /* GL_SAMPLES_3DFX */ + 1182, /* GL_MODELVIEW2_ARB */ + 1185, /* GL_MODELVIEW3_ARB */ + 1186, /* GL_MODELVIEW4_ARB */ + 1187, /* GL_MODELVIEW5_ARB */ + 1188, /* GL_MODELVIEW6_ARB */ + 1189, /* GL_MODELVIEW7_ARB */ + 1190, /* GL_MODELVIEW8_ARB */ + 1191, /* GL_MODELVIEW9_ARB */ + 1161, /* GL_MODELVIEW10_ARB */ + 1162, /* GL_MODELVIEW11_ARB */ + 1163, /* GL_MODELVIEW12_ARB */ + 1164, /* GL_MODELVIEW13_ARB */ + 1165, /* GL_MODELVIEW14_ARB */ + 1166, /* GL_MODELVIEW15_ARB */ + 1167, /* GL_MODELVIEW16_ARB */ + 1168, /* GL_MODELVIEW17_ARB */ + 1169, /* GL_MODELVIEW18_ARB */ + 1170, /* GL_MODELVIEW19_ARB */ + 1172, /* GL_MODELVIEW20_ARB */ + 1173, /* GL_MODELVIEW21_ARB */ + 1174, /* GL_MODELVIEW22_ARB */ + 1175, /* GL_MODELVIEW23_ARB */ + 1176, /* GL_MODELVIEW24_ARB */ + 1177, /* GL_MODELVIEW25_ARB */ + 1178, /* GL_MODELVIEW26_ARB */ + 1179, /* GL_MODELVIEW27_ARB */ + 1180, /* GL_MODELVIEW28_ARB */ + 1181, /* GL_MODELVIEW29_ARB */ + 1183, /* GL_MODELVIEW30_ARB */ + 1184, /* GL_MODELVIEW31_ARB */ + 447, /* GL_DOT3_RGB_EXT */ + 445, /* GL_DOT3_RGBA_EXT */ + 1155, /* GL_MIRROR_CLAMP_EXT */ + 1158, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + 1197, /* GL_MODULATE_ADD_ATI */ + 1198, /* GL_MODULATE_SIGNED_ADD_ATI */ + 1199, /* GL_MODULATE_SUBTRACT_ATI */ + 2291, /* GL_YCBCR_MESA */ + 1294, /* GL_PACK_INVERT_MESA */ + 388, /* GL_DEBUG_OBJECT_MESA */ + 389, /* GL_DEBUG_PRINT_MESA */ + 387, /* GL_DEBUG_ASSERT_MESA */ + 139, /* GL_BUFFER_SIZE */ + 141, /* GL_BUFFER_USAGE */ + 145, /* GL_BUMP_ROT_MATRIX_ATI */ + 146, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ + 144, /* GL_BUMP_NUM_TEX_UNITS_ATI */ + 148, /* GL_BUMP_TEX_UNITS_ATI */ + 507, /* GL_DUDV_ATI */ + 506, /* GL_DU8DV8_ATI */ + 143, /* GL_BUMP_ENVMAP_ATI */ + 147, /* GL_BUMP_TARGET_ATI */ + 1238, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */ + 1446, /* GL_PROGRAM_BINARY_FORMATS_OES */ + 1822, /* GL_STENCIL_BACK_FUNC */ + 1820, /* GL_STENCIL_BACK_FAIL */ + 1824, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1826, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 595, /* GL_FRAGMENT_PROGRAM_ARB */ + 1444, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1476, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1475, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1458, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1464, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1463, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 1064, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1089, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1088, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1077, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1083, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1082, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 1652, /* GL_RGBA32F */ + 1615, /* GL_RGB32F */ + 1643, /* GL_RGBA16F */ + 1607, /* GL_RGB16F */ + 1033, /* GL_MAX_DRAW_BUFFERS */ + 451, /* GL_DRAW_BUFFER0 */ + 454, /* GL_DRAW_BUFFER1 */ + 475, /* GL_DRAW_BUFFER2 */ + 478, /* GL_DRAW_BUFFER3 */ + 481, /* GL_DRAW_BUFFER4 */ + 484, /* GL_DRAW_BUFFER5 */ + 487, /* GL_DRAW_BUFFER6 */ + 490, /* GL_DRAW_BUFFER7 */ + 493, /* GL_DRAW_BUFFER8 */ + 496, /* GL_DRAW_BUFFER9 */ + 455, /* GL_DRAW_BUFFER10 */ + 458, /* GL_DRAW_BUFFER11 */ + 461, /* GL_DRAW_BUFFER12 */ + 464, /* GL_DRAW_BUFFER13 */ + 467, /* GL_DRAW_BUFFER14 */ + 470, /* GL_DRAW_BUFFER15 */ + 97, /* GL_BLEND_EQUATION_ALPHA */ + 1007, /* GL_MATRIX_PALETTE_ARB */ + 1057, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + 1060, /* GL_MAX_PALETTE_MATRICES_ARB */ + 369, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + 995, /* GL_MATRIX_INDEX_ARRAY_ARB */ + 364, /* GL_CURRENT_MATRIX_INDEX_ARB */ + 1000, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + 1004, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + 1002, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + 998, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + 2038, /* GL_TEXTURE_DEPTH_SIZE */ + 435, /* GL_DEPTH_TEXTURE_MODE */ + 1995, /* GL_TEXTURE_COMPARE_MODE */ + 1993, /* GL_TEXTURE_COMPARE_FUNC */ + 281, /* GL_COMPARE_REF_TO_TEXTURE */ + 1371, /* GL_POINT_SPRITE */ + 343, /* GL_COORD_REPLACE */ + 1376, /* GL_POINT_SPRITE_R_MODE_NV */ + 1516, /* GL_QUERY_COUNTER_BITS */ + 372, /* GL_CURRENT_QUERY */ + 1520, /* GL_QUERY_RESULT */ + 1522, /* GL_QUERY_RESULT_AVAILABLE */ + 1126, /* GL_MAX_VERTEX_ATTRIBS */ + 2244, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 433, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + 432, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + 1103, /* GL_MAX_TEXTURE_COORDS */ + 1105, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + 1451, /* GL_PROGRAM_ERROR_STRING_ARB */ + 1453, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + 1452, /* GL_PROGRAM_FORMAT_ARB */ + 2094, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 405, /* GL_DEPTH_BOUNDS_TEST_EXT */ + 404, /* GL_DEPTH_BOUNDS_EXT */ + 61, /* GL_ARRAY_BUFFER */ + 520, /* GL_ELEMENT_ARRAY_BUFFER */ + 62, /* GL_ARRAY_BUFFER_BINDING */ + 521, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + 2215, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 1224, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + 187, /* GL_COLOR_ARRAY_BUFFER_BINDING */ + 732, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + 2008, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 516, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + 1730, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + 573, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + 2272, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 2237, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1454, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + 1070, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + 1460, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1079, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1474, /* GL_PROGRAM_TEMPORARIES_ARB */ + 1085, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + 1462, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1081, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1466, /* GL_PROGRAM_PARAMETERS_ARB */ + 1084, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + 1461, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1080, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1445, /* GL_PROGRAM_ATTRIBS_ARB */ + 1065, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + 1459, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1078, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1443, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1063, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1457, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 1076, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 1071, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + 1067, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + 1477, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + 2127, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1539, /* GL_READ_ONLY */ + 2286, /* GL_WRITE_ONLY */ + 1541, /* GL_READ_WRITE */ + 124, /* GL_BUFFER_ACCESS */ + 129, /* GL_BUFFER_MAPPED */ + 134, /* GL_BUFFER_MAP_POINTER */ + 2101, /* GL_TIME_ELAPSED_EXT */ + 955, /* GL_MATRIX0_ARB */ + 967, /* GL_MATRIX1_ARB */ + 979, /* GL_MATRIX2_ARB */ + 983, /* GL_MATRIX3_ARB */ + 985, /* GL_MATRIX4_ARB */ + 987, /* GL_MATRIX5_ARB */ + 989, /* GL_MATRIX6_ARB */ + 991, /* GL_MATRIX7_ARB */ + 993, /* GL_MATRIX8_ARB */ + 994, /* GL_MATRIX9_ARB */ + 957, /* GL_MATRIX10_ARB */ + 958, /* GL_MATRIX11_ARB */ + 959, /* GL_MATRIX12_ARB */ + 960, /* GL_MATRIX13_ARB */ + 961, /* GL_MATRIX14_ARB */ + 962, /* GL_MATRIX15_ARB */ + 963, /* GL_MATRIX16_ARB */ + 964, /* GL_MATRIX17_ARB */ + 965, /* GL_MATRIX18_ARB */ + 966, /* GL_MATRIX19_ARB */ + 969, /* GL_MATRIX20_ARB */ + 970, /* GL_MATRIX21_ARB */ + 971, /* GL_MATRIX22_ARB */ + 972, /* GL_MATRIX23_ARB */ + 973, /* GL_MATRIX24_ARB */ + 974, /* GL_MATRIX25_ARB */ + 975, /* GL_MATRIX26_ARB */ + 976, /* GL_MATRIX27_ARB */ + 977, /* GL_MATRIX28_ARB */ + 978, /* GL_MATRIX29_ARB */ + 981, /* GL_MATRIX30_ARB */ + 982, /* GL_MATRIX31_ARB */ + 1863, /* GL_STREAM_DRAW */ + 1865, /* GL_STREAM_READ */ + 1861, /* GL_STREAM_COPY */ + 1812, /* GL_STATIC_DRAW */ + 1814, /* GL_STATIC_READ */ + 1810, /* GL_STATIC_COPY */ + 510, /* GL_DYNAMIC_DRAW */ + 512, /* GL_DYNAMIC_READ */ + 508, /* GL_DYNAMIC_COPY */ + 1334, /* GL_PIXEL_PACK_BUFFER */ + 1338, /* GL_PIXEL_UNPACK_BUFFER */ + 1335, /* GL_PIXEL_PACK_BUFFER_BINDING */ + 1339, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + 396, /* GL_DEPTH24_STENCIL8 */ + 2090, /* GL_TEXTURE_STENCIL_SIZE */ + 2036, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + 1066, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + 1069, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + 1073, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + 1072, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + 2242, /* GL_VERTEX_ATTRIB_ARRAY_INTEGER */ + 2239, /* GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB */ + 1012, /* GL_MAX_ARRAY_TEXTURE_LAYERS */ + 1149, /* GL_MIN_PROGRAM_TEXEL_OFFSET */ + 1086, /* GL_MAX_PROGRAM_TEXEL_OFFSET */ + 1854, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 18, /* GL_ACTIVE_STENCIL_FACE_EXT */ + 1156, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + 1711, /* GL_SAMPLES_PASSED */ + 688, /* GL_GEOMETRY_VERTICES_OUT */ + 682, /* GL_GEOMETRY_INPUT_TYPE */ + 684, /* GL_GEOMETRY_OUTPUT_TYPE */ + 156, /* GL_CLAMP_READ_COLOR */ + 546, /* GL_FIXED_ONLY */ + 1358, /* GL_POINT_SIZE_ARRAY_TYPE_OES */ + 1357, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */ + 1356, /* GL_POINT_SIZE_ARRAY_POINTER_OES */ + 1193, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */ + 1480, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */ + 2070, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */ + 138, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ + 128, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ + 1556, /* GL_RELEASED_APPLE */ + 2269, /* GL_VOLATILE_APPLE */ + 1595, /* GL_RETAINED_APPLE */ + 2144, /* GL_UNDEFINED_APPLE */ + 1504, /* GL_PURGEABLE_APPLE */ + 596, /* GL_FRAGMENT_SHADER */ + 2264, /* GL_VERTEX_SHADER */ + 1465, /* GL_PROGRAM_OBJECT_ARB */ + 1747, /* GL_SHADER_OBJECT_ARB */ + 1041, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + 1131, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + 1122, /* GL_MAX_VARYING_COMPONENTS */ + 1129, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + 1024, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + 1254, /* GL_OBJECT_TYPE_ARB */ + 1749, /* GL_SHADER_TYPE */ + 561, /* GL_FLOAT_VEC2 */ + 563, /* GL_FLOAT_VEC3 */ + 565, /* GL_FLOAT_VEC4 */ + 784, /* GL_INT_VEC2 */ + 786, /* GL_INT_VEC3 */ + 788, /* GL_INT_VEC4 */ + 116, /* GL_BOOL */ + 118, /* GL_BOOL_VEC2 */ + 120, /* GL_BOOL_VEC3 */ + 122, /* GL_BOOL_VEC4 */ + 549, /* GL_FLOAT_MAT2 */ + 553, /* GL_FLOAT_MAT3 */ + 557, /* GL_FLOAT_MAT4 */ + 1687, /* GL_SAMPLER_1D */ + 1693, /* GL_SAMPLER_2D */ + 1701, /* GL_SAMPLER_3D */ + 1705, /* GL_SAMPLER_CUBE */ + 1692, /* GL_SAMPLER_1D_SHADOW */ + 1700, /* GL_SAMPLER_2D_SHADOW */ + 1698, /* GL_SAMPLER_2D_RECT */ + 1699, /* GL_SAMPLER_2D_RECT_SHADOW */ + 551, /* GL_FLOAT_MAT2x3 */ + 552, /* GL_FLOAT_MAT2x4 */ + 555, /* GL_FLOAT_MAT3x2 */ + 556, /* GL_FLOAT_MAT3x4 */ + 559, /* GL_FLOAT_MAT4x2 */ + 560, /* GL_FLOAT_MAT4x3 */ + 394, /* GL_DELETE_STATUS */ + 286, /* GL_COMPILE_STATUS */ + 845, /* GL_LINK_STATUS */ + 2209, /* GL_VALIDATE_STATUS */ + 744, /* GL_INFO_LOG_LENGTH */ + 64, /* GL_ATTACHED_SHADERS */ + 21, /* GL_ACTIVE_UNIFORMS */ + 22, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ + 1748, /* GL_SHADER_SOURCE_LENGTH */ + 15, /* GL_ACTIVE_ATTRIBUTES */ + 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ + 598, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + 1751, /* GL_SHADING_LANGUAGE_VERSION */ + 371, /* GL_CURRENT_PROGRAM */ + 1303, /* GL_PALETTE4_RGB8_OES */ + 1305, /* GL_PALETTE4_RGBA8_OES */ + 1301, /* GL_PALETTE4_R5_G6_B5_OES */ + 1304, /* GL_PALETTE4_RGBA4_OES */ + 1302, /* GL_PALETTE4_RGB5_A1_OES */ + 1308, /* GL_PALETTE8_RGB8_OES */ + 1310, /* GL_PALETTE8_RGBA8_OES */ + 1306, /* GL_PALETTE8_R5_G6_B5_OES */ + 1309, /* GL_PALETTE8_RGBA4_OES */ + 1307, /* GL_PALETTE8_RGB5_A1_OES */ + 725, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */ + 723, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */ + 1355, /* GL_POINT_SIZE_ARRAY_OES */ + 2014, /* GL_TEXTURE_CROP_RECT_OES */ + 996, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */ + 1354, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */ + 2192, /* GL_UNSIGNED_NORMALIZED */ + 1951, /* GL_TEXTURE_1D_ARRAY */ + 1490, /* GL_PROXY_TEXTURE_1D_ARRAY */ + 1954, /* GL_TEXTURE_2D_ARRAY */ + 1494, /* GL_PROXY_TEXTURE_2D_ARRAY */ + 1962, /* GL_TEXTURE_BINDING_1D_ARRAY */ + 1965, /* GL_TEXTURE_BINDING_2D_ARRAY */ + 1048, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS */ + 1981, /* GL_TEXTURE_BUFFER */ + 1102, /* GL_MAX_TEXTURE_BUFFER_SIZE */ + 1969, /* GL_TEXTURE_BINDING_BUFFER */ + 1982, /* GL_TEXTURE_BUFFER_DATA_STORE_BINDING */ + 1983, /* GL_TEXTURE_BUFFER_FORMAT */ + 1527, /* GL_R11F_G11F_B10F */ + 2158, /* GL_UNSIGNED_INT_10F_11F_11F_REV */ + 1638, /* GL_RGB9_E5 */ + 2167, /* GL_UNSIGNED_INT_5_9_9_9_REV */ + 2088, /* GL_TEXTURE_SHARED_SIZE */ + 1804, /* GL_SRGB */ + 1805, /* GL_SRGB8 */ + 1807, /* GL_SRGB_ALPHA */ + 1806, /* GL_SRGB8_ALPHA8 */ + 1764, /* GL_SLUMINANCE_ALPHA */ + 1763, /* GL_SLUMINANCE8_ALPHA8 */ + 1761, /* GL_SLUMINANCE */ + 1762, /* GL_SLUMINANCE8 */ + 309, /* GL_COMPRESSED_SRGB */ + 310, /* GL_COMPRESSED_SRGB_ALPHA */ + 307, /* GL_COMPRESSED_SLUMINANCE */ + 308, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ + 2123, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH */ + 2112, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE */ + 1120, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS */ + 2121, /* GL_TRANSFORM_FEEDBACK_VARYINGS */ + 2117, /* GL_TRANSFORM_FEEDBACK_BUFFER_START */ + 2115, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE */ + 1437, /* GL_PRIMITIVES_GENERATED */ + 2119, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN */ + 1531, /* GL_RASTERIZER_DISCARD */ + 1116, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS */ + 1118, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS */ + 762, /* GL_INTERLEAVED_ATTRIBS */ + 1740, /* GL_SEPARATE_ATTRIBS */ + 2107, /* GL_TRANSFORM_FEEDBACK_BUFFER */ + 2109, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING */ + 1373, /* GL_POINT_SPRITE_COORD_ORIGIN */ + 853, /* GL_LOWER_LEFT */ + 2206, /* GL_UPPER_LEFT */ + 1828, /* GL_STENCIL_BACK_REF */ + 1829, /* GL_STENCIL_BACK_VALUE_MASK */ + 1830, /* GL_STENCIL_BACK_WRITEMASK */ + 500, /* GL_DRAW_FRAMEBUFFER_BINDING */ + 1561, /* GL_RENDERBUFFER_BINDING */ + 1535, /* GL_READ_FRAMEBUFFER */ + 499, /* GL_DRAW_FRAMEBUFFER */ + 1536, /* GL_READ_FRAMEBUFFER_BINDING */ + 1580, /* GL_RENDERBUFFER_SAMPLES */ + 612, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + 609, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + 624, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + 619, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + 622, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + 630, /* GL_FRAMEBUFFER_COMPLETE */ + 635, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + 650, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + 644, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + 639, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + 645, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + 641, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ + 655, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ + 661, /* GL_FRAMEBUFFER_UNSUPPORTED */ + 659, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + 1020, /* GL_MAX_COLOR_ATTACHMENTS */ + 193, /* GL_COLOR_ATTACHMENT0 */ + 196, /* GL_COLOR_ATTACHMENT1 */ + 210, /* GL_COLOR_ATTACHMENT2 */ + 212, /* GL_COLOR_ATTACHMENT3 */ + 214, /* GL_COLOR_ATTACHMENT4 */ + 216, /* GL_COLOR_ATTACHMENT5 */ + 218, /* GL_COLOR_ATTACHMENT6 */ + 220, /* GL_COLOR_ATTACHMENT7 */ + 222, /* GL_COLOR_ATTACHMENT8 */ + 224, /* GL_COLOR_ATTACHMENT9 */ + 197, /* GL_COLOR_ATTACHMENT10 */ + 199, /* GL_COLOR_ATTACHMENT11 */ + 201, /* GL_COLOR_ATTACHMENT12 */ + 203, /* GL_COLOR_ATTACHMENT13 */ + 205, /* GL_COLOR_ATTACHMENT14 */ + 207, /* GL_COLOR_ATTACHMENT15 */ + 399, /* GL_DEPTH_ATTACHMENT */ + 1817, /* GL_STENCIL_ATTACHMENT */ + 600, /* GL_FRAMEBUFFER */ + 1558, /* GL_RENDERBUFFER */ + 1584, /* GL_RENDERBUFFER_WIDTH */ + 1571, /* GL_RENDERBUFFER_HEIGHT */ + 1574, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + 1849, /* GL_STENCIL_INDEX_EXT */ + 1838, /* GL_STENCIL_INDEX1 */ + 1843, /* GL_STENCIL_INDEX4 */ + 1846, /* GL_STENCIL_INDEX8 */ + 1839, /* GL_STENCIL_INDEX16 */ + 1578, /* GL_RENDERBUFFER_RED_SIZE */ + 1569, /* GL_RENDERBUFFER_GREEN_SIZE */ + 1564, /* GL_RENDERBUFFER_BLUE_SIZE */ + 1559, /* GL_RENDERBUFFER_ALPHA_SIZE */ + 1566, /* GL_RENDERBUFFER_DEPTH_SIZE */ + 1582, /* GL_RENDERBUFFER_STENCIL_SIZE */ + 653, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + 1097, /* GL_MAX_SAMPLES */ + 2050, /* GL_TEXTURE_GEN_STR_OES */ + 699, /* GL_HALF_FLOAT_OES */ + 1625, /* GL_RGB565_OES */ + 1655, /* GL_RGBA32UI */ + 1618, /* GL_RGB32UI */ + 40, /* GL_ALPHA32UI_EXT */ + 754, /* GL_INTENSITY32UI_EXT */ + 870, /* GL_LUMINANCE32UI_EXT */ + 887, /* GL_LUMINANCE_ALPHA32UI_EXT */ + 1646, /* GL_RGBA16UI */ + 1610, /* GL_RGB16UI */ + 37, /* GL_ALPHA16UI_EXT */ + 751, /* GL_INTENSITY16UI_EXT */ + 865, /* GL_LUMINANCE16UI_EXT */ + 885, /* GL_LUMINANCE_ALPHA16UI_EXT */ + 1665, /* GL_RGBA8UI */ + 1633, /* GL_RGB8UI */ + 45, /* GL_ALPHA8UI_EXT */ + 759, /* GL_INTENSITY8UI_EXT */ + 879, /* GL_LUMINANCE8UI_EXT */ + 889, /* GL_LUMINANCE_ALPHA8UI_EXT */ + 1653, /* GL_RGBA32I */ + 1616, /* GL_RGB32I */ + 39, /* GL_ALPHA32I_EXT */ + 753, /* GL_INTENSITY32I_EXT */ + 869, /* GL_LUMINANCE32I_EXT */ + 886, /* GL_LUMINANCE_ALPHA32I_EXT */ + 1644, /* GL_RGBA16I */ + 1608, /* GL_RGB16I */ + 36, /* GL_ALPHA16I_EXT */ + 750, /* GL_INTENSITY16I_EXT */ + 864, /* GL_LUMINANCE16I_EXT */ + 884, /* GL_LUMINANCE_ALPHA16I_EXT */ + 1663, /* GL_RGBA8I */ + 1631, /* GL_RGB8I */ + 44, /* GL_ALPHA8I_EXT */ + 758, /* GL_INTENSITY8I_EXT */ + 878, /* GL_LUMINANCE8I_EXT */ + 888, /* GL_LUMINANCE_ALPHA8I_EXT */ + 1548, /* GL_RED_INTEGER */ + 695, /* GL_GREEN_INTEGER */ + 113, /* GL_BLUE_INTEGER */ + 49, /* GL_ALPHA_INTEGER_EXT */ + 1677, /* GL_RGB_INTEGER */ + 1671, /* GL_RGBA_INTEGER */ + 84, /* GL_BGR_INTEGER */ + 82, /* GL_BGRA_INTEGER */ + 891, /* GL_LUMINANCE_INTEGER_EXT */ + 890, /* GL_LUMINANCE_ALPHA_INTEGER_EXT */ + 1673, /* GL_RGBA_INTEGER_MODE_EXT */ + 607, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED */ + 648, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS */ + 647, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */ + 1688, /* GL_SAMPLER_1D_ARRAY */ + 1694, /* GL_SAMPLER_2D_ARRAY */ + 1703, /* GL_SAMPLER_BUFFER */ + 1690, /* GL_SAMPLER_1D_ARRAY_SHADOW */ + 1696, /* GL_SAMPLER_2D_ARRAY_SHADOW */ + 1706, /* GL_SAMPLER_CUBE_SHADOW */ + 2186, /* GL_UNSIGNED_INT_VEC2 */ + 2188, /* GL_UNSIGNED_INT_VEC3 */ + 2190, /* GL_UNSIGNED_INT_VEC4 */ + 768, /* GL_INT_SAMPLER_1D */ + 772, /* GL_INT_SAMPLER_2D */ + 778, /* GL_INT_SAMPLER_3D */ + 782, /* GL_INT_SAMPLER_CUBE */ + 776, /* GL_INT_SAMPLER_2D_RECT */ + 769, /* GL_INT_SAMPLER_1D_ARRAY */ + 773, /* GL_INT_SAMPLER_2D_ARRAY */ + 780, /* GL_INT_SAMPLER_BUFFER */ + 2170, /* GL_UNSIGNED_INT_SAMPLER_1D */ + 2174, /* GL_UNSIGNED_INT_SAMPLER_2D */ + 2180, /* GL_UNSIGNED_INT_SAMPLER_3D */ + 2184, /* GL_UNSIGNED_INT_SAMPLER_CUBE */ + 2178, /* GL_UNSIGNED_INT_SAMPLER_2D_RECT */ + 2171, /* GL_UNSIGNED_INT_SAMPLER_1D_ARRAY */ + 2175, /* GL_UNSIGNED_INT_SAMPLER_2D_ARRAY */ + 2182, /* GL_UNSIGNED_INT_SAMPLER_BUFFER */ + 686, /* GL_GEOMETRY_SHADER */ + 689, /* GL_GEOMETRY_VERTICES_OUT_ARB */ + 683, /* GL_GEOMETRY_INPUT_TYPE_ARB */ + 685, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */ + 1054, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */ + 1136, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */ + 1052, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS */ + 1046, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES */ + 1050, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS */ + 854, /* GL_LOW_FLOAT */ + 1138, /* GL_MEDIUM_FLOAT */ + 700, /* GL_HIGH_FLOAT */ + 855, /* GL_LOW_INT */ + 1139, /* GL_MEDIUM_INT */ + 701, /* GL_HIGH_INT */ + 2160, /* GL_UNSIGNED_INT_10_10_10_2_OES */ + 767, /* GL_INT_10_10_10_2_OES */ + 1745, /* GL_SHADER_BINARY_FORMATS */ + 1239, /* GL_NUM_SHADER_BINARY_FORMATS */ + 1746, /* GL_SHADER_COMPILER */ + 1133, /* GL_MAX_VERTEX_UNIFORM_VECTORS */ + 1125, /* GL_MAX_VARYING_VECTORS */ + 1043, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */ + 1524, /* GL_QUERY_WAIT */ + 1518, /* GL_QUERY_NO_WAIT */ + 1514, /* GL_QUERY_BY_REGION_WAIT */ + 1512, /* GL_QUERY_BY_REGION_NO_WAIT */ + 2105, /* GL_TRANSFORM_FEEDBACK */ + 2114, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ + 2108, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ + 2106, /* GL_TRANSFORM_FEEDBACK_BINDING */ + 1508, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ + 542, /* GL_FIRST_VERTEX_CONVENTION */ + 800, /* GL_LAST_VERTEX_CONVENTION */ + 1482, /* GL_PROVOKING_VERTEX */ + 350, /* GL_COPY_READ_BUFFER */ + 351, /* GL_COPY_WRITE_BUFFER */ + 1551, /* GL_RED_SNORM */ + 1684, /* GL_RG_SNORM */ + 1683, /* GL_RGB_SNORM */ + 1676, /* GL_RGBA_SNORM */ + 1530, /* GL_R8_SNORM */ + 1598, /* GL_RG8_SNORM */ + 1637, /* GL_RGB8_SNORM */ + 1669, /* GL_RGBA8_SNORM */ + 1528, /* GL_R16_SNORM */ + 1597, /* GL_RG16_SNORM */ + 1613, /* GL_RGB16_SNORM */ + 1649, /* GL_RGBA16_SNORM */ + 1757, /* GL_SIGNED_NORMALIZED */ + 1439, /* GL_PRIMITIVE_RESTART */ + 1440, /* GL_PRIMITIVE_RESTART_INDEX */ + 1099, /* GL_MAX_SERVER_WAIT_TIMEOUT */ + 1253, /* GL_OBJECT_TYPE */ + 1870, /* GL_SYNC_CONDITION */ + 1875, /* GL_SYNC_STATUS */ + 1872, /* GL_SYNC_FLAGS */ + 1871, /* GL_SYNC_FENCE */ + 1874, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ + 2153, /* GL_UNSIGNALED */ + 1756, /* GL_SIGNALED */ + 54, /* GL_ALREADY_SIGNALED */ + 2100, /* GL_TIMEOUT_EXPIRED */ + 312, /* GL_CONDITION_SATISFIED */ + 2270, /* GL_WAIT_FAILED */ + 126, /* GL_BUFFER_ACCESS_FLAGS */ + 132, /* GL_BUFFER_MAP_LENGTH */ + 133, /* GL_BUFFER_MAP_OFFSET */ + 1128, /* GL_MAX_VERTEX_OUTPUT_COMPONENTS */ + 1044, /* GL_MAX_GEOMETRY_INPUT_COMPONENTS */ + 1045, /* GL_MAX_GEOMETRY_OUTPUT_COMPONENTS */ + 1040, /* GL_MAX_FRAGMENT_INPUT_COMPONENTS */ + 326, /* GL_CONTEXT_PROFILE_MASK */ + 527, /* GL_EVAL_BIT */ + 1533, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + 847, /* GL_LIST_BIT */ + 1976, /* GL_TEXTURE_BIT */ + 1726, /* GL_SCISSOR_BIT */ + 30, /* GL_ALL_ATTRIB_BITS */ + 1204, /* GL_MULTISAMPLE_BIT */ + 31, /* GL_ALL_CLIENT_ATTRIB_BITS */ +}; + +typedef int (*cfunc)(const void *, const void *); + +/** + * Compare a key name to an element in the \c all_enums array. + * + * \c bsearch always passes the key as the first parameter and the pointer + * to the array element as the second parameter. We can elimiate some + * extra work by taking advantage of that fact. + * + * \param a Pointer to the desired enum name. + * \param b Pointer to an element of the \c all_enums array. + */ +static int compar_name( const char *a, const enum_elt *b ) +{ + return strcmp( a, & enum_string_table[ b->offset ] ); +} + +/** + * Compare a key enum value to an element in the \c all_enums array. + * + * \c bsearch always passes the key as the first parameter and the pointer + * to the array element as the second parameter. We can elimiate some + * extra work by taking advantage of that fact. + * + * \param a Pointer to the desired enum name. + * \param b Pointer to an index into the \c all_enums array. + */ +static int compar_nr( const int *a, const unsigned *b ) +{ + return a[0] - all_enums[*b].n; +} + + +static char token_tmp[20]; + +const char *_mesa_lookup_enum_by_nr( int nr ) +{ + unsigned * i; + + i = (unsigned *) _mesa_bsearch(& nr, reduced_enums, + Elements(reduced_enums), + sizeof(reduced_enums[0]), + (cfunc) compar_nr); + + if ( i != NULL ) { + return & enum_string_table[ all_enums[ *i ].offset ]; + } + else { + /* this is not re-entrant safe, no big deal here */ + _mesa_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr); + token_tmp[sizeof(token_tmp) - 1] = '\0'; + return token_tmp; + } +} + +/** + * Primitive names + */ +static const char *prim_names[PRIM_UNKNOWN + 1] = { + "GL_POINTS", + "GL_LINES", + "GL_LINE_LOOP", + "GL_LINE_STRIP", + "GL_TRIANGLES", + "GL_TRIANGLE_STRIP", + "GL_TRIANGLE_FAN", + "GL_QUADS", + "GL_QUAD_STRIP", + "GL_POLYGON", + "outside begin/end", + "inside unknown primitive", + "unknown state" +}; + + +/* Get the name of an enum given that it is a primitive type. Avoids + * GL_FALSE/GL_POINTS ambiguity and others. + */ +const char * +_mesa_lookup_prim_by_nr(unsigned nr) +{ + if (nr < Elements(prim_names)) + return prim_names[nr]; + else + return "invalid mode"; +} + + +int _mesa_lookup_enum_by_name( const char *symbol ) +{ + enum_elt * f = NULL; + + if ( symbol != NULL ) { + f = (enum_elt *) _mesa_bsearch(symbol, all_enums, + Elements(all_enums), + sizeof( enum_elt ), + (cfunc) compar_name); + } + + return (f != NULL) ? f->n : -1; +} + + diff --git a/mesalib/src/mesa/main/enums.h b/mesalib/src/mesa/main/enums.h index b3ad3f92c..7733df22f 100644 --- a/mesalib/src/mesa/main/enums.h +++ b/mesalib/src/mesa/main/enums.h @@ -1,62 +1,62 @@ -/** - * \file enums.h - * Enumeration name/number lookup functions. - * - * \if subset - * (No-op) - * - * \endif - */ - -/* - * Mesa 3-D graphics library - * Version: 6.5.1 - * - * Copyright (C) 1999-2006 Brian Paul 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 - * BRIAN PAUL 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. - */ - - -#ifndef _ENUMS_H_ -#define _ENUMS_H_ - -#include "mfeatures.h" - -#if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL - -extern const char *_mesa_lookup_enum_by_nr( int nr ); - -/* Get the name of an enum given that it is a primitive type. Avoids - * GL_FALSE/GL_POINTS ambiguity and others. - */ -const char *_mesa_lookup_prim_by_nr( int nr ); - -extern int _mesa_lookup_enum_by_name( const char *symbol ); - -#else - -/** No-op */ -#define _mesa_lookup_enum_by_name( s ) 0 - -/** No-op */ -#define _mesa_lookup_enum_by_nr( n ) "unknown" - -#endif - -#endif +/** + * \file enums.h + * Enumeration name/number lookup functions. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * Mesa 3-D graphics library + * Version: 6.5.1 + * + * Copyright (C) 1999-2006 Brian Paul 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 + * BRIAN PAUL 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. + */ + + +#ifndef _ENUMS_H_ +#define _ENUMS_H_ + +#include "mfeatures.h" + +#if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL + +extern const char *_mesa_lookup_enum_by_nr( int nr ); + +/* Get the name of an enum given that it is a primitive type. Avoids + * GL_FALSE/GL_POINTS ambiguity and others. + */ +const char *_mesa_lookup_prim_by_nr( unsigned nr ); + +extern int _mesa_lookup_enum_by_name( const char *symbol ); + +#else + +/** No-op */ +#define _mesa_lookup_enum_by_name( s ) 0 + +/** No-op */ +#define _mesa_lookup_enum_by_nr( n ) "unknown" + +#endif + +#endif diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index ac2957ac8..49dad4d40 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -121,6 +121,11 @@ struct st_context; /*@}*/ +/** Extra draw modes beyond GL_POINTS, GL_TRIANGLE_FAN, etc */ +#define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1) +#define PRIM_INSIDE_UNKNOWN_PRIM (GL_POLYGON+2) +#define PRIM_UNKNOWN (GL_POLYGON+3) + /** * Shader stages. Note that these will become 5 with tessellation. @@ -296,8 +301,8 @@ typedef enum /** * Indexes for geometry program result attributes */ -/*@{*/ -typedef enum { +typedef enum +{ GEOM_RESULT_POS = 0, GEOM_RESULT_COL0 = 1, GEOM_RESULT_COL1 = 2, @@ -320,7 +325,7 @@ typedef enum { /* ### we need to -2 because var0 is 18 instead 16 like in the others */ GEOM_RESULT_MAX = (GEOM_RESULT_VAR0 + MAX_VARYING - 2) } gl_geom_result; -/*@}*/ + /** * Indexes for fragment program input attributes. @@ -1322,7 +1327,7 @@ struct gl_texture_object GLboolean _Complete; /**< Is texture object complete? */ GLboolean _RenderToTexture; /**< Any rendering to this texture? */ GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */ - GLenum sRGBDecode; + GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */ /** Actual texture images, indexed by [cube face] and [mipmap level] */ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; @@ -3088,15 +3093,18 @@ struct gl_dlist_state } Current; }; + /** * Enum for the OpenGL APIs we know about and may support. */ -typedef enum { +typedef enum +{ API_OPENGL, API_OPENGLES, API_OPENGLES2 } gl_api; + /** * Mesa rendering context. * @@ -3309,10 +3317,6 @@ struct gl_context }; -/** The string names for GL_POINT, GL_LINE_LOOP, etc */ -extern const char *_mesa_prim_name[GL_POLYGON+4]; - - #ifdef DEBUG extern int MESA_VERBOSE; extern int MESA_DEBUG_FLAGS; diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index e83117523..a5e90d7cb 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -1924,6 +1924,7 @@ _mesa_init_shader_dispatch(struct _glapi_table *exec) /* GL_ARB_ES2_compatibility */ SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler); + SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat); #endif /* FEATURE_GL */ } diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index b98953b7b..fd03669e6 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -1,312 +1,324 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Keith Whitwell - * Brian Paul - */ - - -#include "main/macros.h" -#include "program/prog_instruction.h" - -#include "st_context.h" -#include "st_atom.h" -#include "st_texture.h" -#include "st_format.h" -#include "st_cb_texture.h" -#include "pipe/p_context.h" -#include "util/u_format.h" -#include "util/u_inlines.h" -#include "cso_cache/cso_context.h" - -/** - * Combine depth texture mode with "swizzle" so that depth mode swizzling - * takes place before texture swizzling, and return the resulting swizzle. - * If the format is not a depth format, return "swizzle" unchanged. - * - * \param format PIPE_FORMAT_*. - * \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4. - * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA, GL_RED. - */ -static GLuint apply_depthmode(enum pipe_format format, - GLuint swizzle, GLenum depthmode) -{ - const struct util_format_description *desc = - util_format_description(format); - unsigned char swiz[4]; - unsigned i; - - if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS || - desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_NONE) { - /* Not a depth format. */ - return swizzle; - } - - for (i = 0; i < 4; i++) - swiz[i] = GET_SWZ(swizzle, i); - - switch (depthmode) { - case GL_LUMINANCE: - /* Rewrite reads from W to ONE, and reads from XYZ to XXX. */ - for (i = 0; i < 4; i++) - if (swiz[i] == SWIZZLE_W) - swiz[i] = SWIZZLE_ONE; - else if (swiz[i] < SWIZZLE_W) - swiz[i] = SWIZZLE_X; - break; - - case GL_INTENSITY: - /* Rewrite reads from XYZW to XXXX. */ - for (i = 0; i < 4; i++) - if (swiz[i] <= SWIZZLE_W) - swiz[i] = SWIZZLE_X; - break; - - case GL_ALPHA: - /* Rewrite reads from W to X, and reads from XYZ to 000. */ - for (i = 0; i < 4; i++) - if (swiz[i] == SWIZZLE_W) - swiz[i] = SWIZZLE_X; - else if (swiz[i] < SWIZZLE_W) - swiz[i] = SWIZZLE_ZERO; - break; - case GL_RED: - /* Rewrite reads W to 1, XYZ to X00 */ - for (i = 0; i < 4; i++) - if (swiz[i] == SWIZZLE_W) - swiz[i] = SWIZZLE_ONE; - else if (swiz[i] == SWIZZLE_Y || swiz[i] == SWIZZLE_Z) - swiz[i] = SWIZZLE_ZERO; - break; - } - - return MAKE_SWIZZLE4(swiz[0], swiz[1], swiz[2], swiz[3]); -} - -/** - * Return TRUE if the swizzling described by "swizzle" and - * "depthmode" (for depth textures only) is different from the swizzling - * set in the given sampler view. - * - * \param sv A sampler view. - * \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4. - * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA. - */ -static boolean check_sampler_swizzle(struct pipe_sampler_view *sv, - GLuint swizzle, GLenum depthmode) -{ - swizzle = apply_depthmode(sv->texture->format, swizzle, depthmode); - - if ((sv->swizzle_r != GET_SWZ(swizzle, 0)) || - (sv->swizzle_g != GET_SWZ(swizzle, 1)) || - (sv->swizzle_b != GET_SWZ(swizzle, 2)) || - (sv->swizzle_a != GET_SWZ(swizzle, 3))) - return true; - return false; -} - -static INLINE struct pipe_sampler_view * -st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, - struct st_texture_object *stObj, - enum pipe_format format) - -{ - struct pipe_sampler_view templ; - GLuint swizzle = apply_depthmode(stObj->pt->format, - stObj->base._Swizzle, - stObj->base.DepthMode); - - u_sampler_view_default_template(&templ, - stObj->pt, - format); - - if (swizzle != SWIZZLE_NOOP) { - templ.swizzle_r = GET_SWZ(swizzle, 0); - templ.swizzle_g = GET_SWZ(swizzle, 1); - templ.swizzle_b = GET_SWZ(swizzle, 2); - templ.swizzle_a = GET_SWZ(swizzle, 3); - } - - return pipe->create_sampler_view(pipe, stObj->pt, &templ); -} - - -static INLINE struct pipe_sampler_view * -st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, - struct pipe_context *pipe, - enum pipe_format format) - -{ - if (!stObj || !stObj->pt) { - return NULL; - } - - if (!stObj->sampler_view) { - stObj->sampler_view = st_create_texture_sampler_view_from_stobj(pipe, stObj, format); - } - - return stObj->sampler_view; -} - -static void -update_textures(struct st_context *st) -{ - struct pipe_context *pipe = st->pipe; - struct gl_vertex_program *vprog = st->ctx->VertexProgram._Current; - struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current; - const GLbitfield samplersUsed = (vprog->Base.SamplersUsed | - fprog->Base.SamplersUsed); - GLuint su; - - st->state.num_textures = 0; - - /* loop over sampler units (aka tex image units) */ - for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) { - struct pipe_sampler_view *sampler_view = NULL; - enum pipe_format st_view_format; - if (samplersUsed & (1 << su)) { - struct gl_texture_object *texObj; - struct st_texture_object *stObj; - GLboolean retval; - GLuint texUnit; - - if (fprog->Base.SamplersUsed & (1 << su)) - texUnit = fprog->Base.SamplerUnits[su]; - else - texUnit = vprog->Base.SamplerUnits[su]; - - texObj = st->ctx->Texture.Unit[texUnit]._Current; - - if (!texObj) { - texObj = st_get_default_texture(st); - } - stObj = st_texture_object(texObj); - - retval = st_finalize_texture(st->ctx, st->pipe, texObj); - if (!retval) { - /* out of mem */ - continue; - } - - st_view_format = stObj->pt->format; - { - struct st_texture_image *firstImage; - enum pipe_format firstImageFormat; - firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]); - - firstImageFormat = st_mesa_format_to_pipe_format(firstImage->base.TexFormat); - if ((stObj->base.sRGBDecode == GL_SKIP_DECODE_EXT) && (_mesa_get_format_color_encoding(firstImage->base.TexFormat) == GL_SRGB)) { - firstImageFormat = st_mesa_format_to_pipe_format(_mesa_get_srgb_format_linear(firstImage->base.TexFormat)); - } - - if (firstImageFormat != stObj->pt->format) - st_view_format = firstImageFormat; - - } - st->state.num_textures = su + 1; - - /* if sampler view has changed dereference it */ - if (stObj->sampler_view) - if (check_sampler_swizzle(stObj->sampler_view, - stObj->base._Swizzle, - stObj->base.DepthMode) || - (st_view_format != stObj->sampler_view->format)) - pipe_sampler_view_reference(&stObj->sampler_view, NULL); - - sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, st_view_format); - } - pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view); - } - - cso_set_fragment_sampler_views(st->cso_context, - st->state.num_textures, - st->state.sampler_views); - if (st->ctx->Const.MaxVertexTextureImageUnits > 0) { - cso_set_vertex_sampler_views(st->cso_context, - MIN2(st->state.num_textures, - st->ctx->Const.MaxVertexTextureImageUnits), - st->state.sampler_views); - } -} - - -const struct st_tracked_state st_update_texture = { - "st_update_texture", /* name */ - { /* dirty */ - _NEW_TEXTURE, /* mesa */ - ST_NEW_FRAGMENT_PROGRAM, /* st */ - }, - update_textures /* update */ -}; - - - - -static void -finalize_textures(struct st_context *st) -{ - struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current; - const GLboolean prev_missing_textures = st->missing_textures; - GLuint su; - - st->missing_textures = GL_FALSE; - - for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) { - if (fprog->Base.SamplersUsed & (1 << su)) { - const GLuint texUnit = fprog->Base.SamplerUnits[su]; - struct gl_texture_object *texObj - = st->ctx->Texture.Unit[texUnit]._Current; - - if (texObj) { - GLboolean retval; - - retval = st_finalize_texture(st->ctx, st->pipe, texObj); - if (!retval) { - /* out of mem */ - st->missing_textures = GL_TRUE; - continue; - } - } - } - } - - if (prev_missing_textures != st->missing_textures) - st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM; -} - - - -const struct st_tracked_state st_finalize_textures = { - "st_finalize_textures", /* name */ - { /* dirty */ - _NEW_TEXTURE, /* mesa */ - 0, /* st */ - }, - finalize_textures /* update */ -}; +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + * Brian Paul + */ + + +#include "main/macros.h" +#include "program/prog_instruction.h" + +#include "st_context.h" +#include "st_atom.h" +#include "st_texture.h" +#include "st_format.h" +#include "st_cb_texture.h" +#include "pipe/p_context.h" +#include "util/u_format.h" +#include "util/u_inlines.h" +#include "cso_cache/cso_context.h" + + +/** + * Combine depth texture mode with "swizzle" so that depth mode swizzling + * takes place before texture swizzling, and return the resulting swizzle. + * If the format is not a depth format, return "swizzle" unchanged. + * + * \param format PIPE_FORMAT_*. + * \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4. + * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA, GL_RED. + */ +static GLuint +apply_depthmode(enum pipe_format format, GLuint swizzle, GLenum depthmode) +{ + const struct util_format_description *desc = + util_format_description(format); + unsigned char swiz[4]; + unsigned i; + + if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS || + desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_NONE) { + /* Not a depth format. */ + return swizzle; + } + + for (i = 0; i < 4; i++) + swiz[i] = GET_SWZ(swizzle, i); + + switch (depthmode) { + case GL_LUMINANCE: + /* Rewrite reads from W to ONE, and reads from XYZ to XXX. */ + for (i = 0; i < 4; i++) + if (swiz[i] == SWIZZLE_W) + swiz[i] = SWIZZLE_ONE; + else if (swiz[i] < SWIZZLE_W) + swiz[i] = SWIZZLE_X; + break; + + case GL_INTENSITY: + /* Rewrite reads from XYZW to XXXX. */ + for (i = 0; i < 4; i++) + if (swiz[i] <= SWIZZLE_W) + swiz[i] = SWIZZLE_X; + break; + + case GL_ALPHA: + /* Rewrite reads from W to X, and reads from XYZ to 000. */ + for (i = 0; i < 4; i++) + if (swiz[i] == SWIZZLE_W) + swiz[i] = SWIZZLE_X; + else if (swiz[i] < SWIZZLE_W) + swiz[i] = SWIZZLE_ZERO; + break; + case GL_RED: + /* Rewrite reads W to 1, XYZ to X00 */ + for (i = 0; i < 4; i++) + if (swiz[i] == SWIZZLE_W) + swiz[i] = SWIZZLE_ONE; + else if (swiz[i] == SWIZZLE_Y || swiz[i] == SWIZZLE_Z) + swiz[i] = SWIZZLE_ZERO; + break; + } + + return MAKE_SWIZZLE4(swiz[0], swiz[1], swiz[2], swiz[3]); +} + + +/** + * Return TRUE if the swizzling described by "swizzle" and + * "depthmode" (for depth textures only) is different from the swizzling + * set in the given sampler view. + * + * \param sv A sampler view. + * \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4. + * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA. + */ +static boolean +check_sampler_swizzle(struct pipe_sampler_view *sv, + GLuint swizzle, GLenum depthmode) +{ + swizzle = apply_depthmode(sv->texture->format, swizzle, depthmode); + + if ((sv->swizzle_r != GET_SWZ(swizzle, 0)) || + (sv->swizzle_g != GET_SWZ(swizzle, 1)) || + (sv->swizzle_b != GET_SWZ(swizzle, 2)) || + (sv->swizzle_a != GET_SWZ(swizzle, 3))) + return TRUE; + return FALSE; +} + + +static INLINE struct pipe_sampler_view * +st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, + struct st_texture_object *stObj, + enum pipe_format format) +{ + struct pipe_sampler_view templ; + GLuint swizzle = apply_depthmode(stObj->pt->format, + stObj->base._Swizzle, + stObj->base.DepthMode); + + u_sampler_view_default_template(&templ, + stObj->pt, + format); + + if (swizzle != SWIZZLE_NOOP) { + templ.swizzle_r = GET_SWZ(swizzle, 0); + templ.swizzle_g = GET_SWZ(swizzle, 1); + templ.swizzle_b = GET_SWZ(swizzle, 2); + templ.swizzle_a = GET_SWZ(swizzle, 3); + } + + return pipe->create_sampler_view(pipe, stObj->pt, &templ); +} + + +static INLINE struct pipe_sampler_view * +st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, + struct pipe_context *pipe, + enum pipe_format format) +{ + if (!stObj || !stObj->pt) { + return NULL; + } + + if (!stObj->sampler_view) { + stObj->sampler_view = + st_create_texture_sampler_view_from_stobj(pipe, stObj, format); + } + + return stObj->sampler_view; +} + + +static void +update_textures(struct st_context *st) +{ + struct pipe_context *pipe = st->pipe; + struct gl_vertex_program *vprog = st->ctx->VertexProgram._Current; + struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current; + const GLbitfield samplersUsed = (vprog->Base.SamplersUsed | + fprog->Base.SamplersUsed); + GLuint su; + + st->state.num_textures = 0; + + /* loop over sampler units (aka tex image units) */ + for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) { + struct pipe_sampler_view *sampler_view = NULL; + enum pipe_format st_view_format; + if (samplersUsed & (1 << su)) { + struct gl_texture_object *texObj; + struct st_texture_object *stObj; + GLboolean retval; + GLuint texUnit; + + if (fprog->Base.SamplersUsed & (1 << su)) + texUnit = fprog->Base.SamplerUnits[su]; + else + texUnit = vprog->Base.SamplerUnits[su]; + + texObj = st->ctx->Texture.Unit[texUnit]._Current; + + if (!texObj) { + texObj = st_get_default_texture(st); + } + stObj = st_texture_object(texObj); + + retval = st_finalize_texture(st->ctx, st->pipe, texObj); + if (!retval) { + /* out of mem */ + continue; + } + + /* Determine the format of the texture sampler view */ + st_view_format = stObj->pt->format; + { + const struct st_texture_image *firstImage = + st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]); + const gl_format texFormat = firstImage->base.TexFormat; + enum pipe_format firstImageFormat = + st_mesa_format_to_pipe_format(texFormat); + + if ((stObj->base.sRGBDecode == GL_SKIP_DECODE_EXT) && + (_mesa_get_format_color_encoding(texFormat) == GL_SRGB)) { + /* don't do sRGB->RGB conversion. Interpret the texture + * texture data as linear values. + */ + const gl_format linearFormat = + _mesa_get_srgb_format_linear(texFormat); + firstImageFormat = st_mesa_format_to_pipe_format(linearFormat); + } + + if (firstImageFormat != stObj->pt->format) + st_view_format = firstImageFormat; + } + + st->state.num_textures = su + 1; + + /* if sampler view has changed dereference it */ + if (stObj->sampler_view) + if (check_sampler_swizzle(stObj->sampler_view, + stObj->base._Swizzle, + stObj->base.DepthMode) || + (st_view_format != stObj->sampler_view->format)) + pipe_sampler_view_reference(&stObj->sampler_view, NULL); + + sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, st_view_format); + } + pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view); + } + + cso_set_fragment_sampler_views(st->cso_context, + st->state.num_textures, + st->state.sampler_views); + if (st->ctx->Const.MaxVertexTextureImageUnits > 0) { + cso_set_vertex_sampler_views(st->cso_context, + MIN2(st->state.num_textures, + st->ctx->Const.MaxVertexTextureImageUnits), + st->state.sampler_views); + } +} + + +const struct st_tracked_state st_update_texture = { + "st_update_texture", /* name */ + { /* dirty */ + _NEW_TEXTURE, /* mesa */ + ST_NEW_FRAGMENT_PROGRAM, /* st */ + }, + update_textures /* update */ +}; + + + + +static void +finalize_textures(struct st_context *st) +{ + struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current; + const GLboolean prev_missing_textures = st->missing_textures; + GLuint su; + + st->missing_textures = GL_FALSE; + + for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) { + if (fprog->Base.SamplersUsed & (1 << su)) { + const GLuint texUnit = fprog->Base.SamplerUnits[su]; + struct gl_texture_object *texObj + = st->ctx->Texture.Unit[texUnit]._Current; + + if (texObj) { + GLboolean retval; + + retval = st_finalize_texture(st->ctx, st->pipe, texObj); + if (!retval) { + /* out of mem */ + st->missing_textures = GL_TRUE; + continue; + } + } + } + } + + if (prev_missing_textures != st->missing_textures) + st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM; +} + + + +const struct st_tracked_state st_finalize_textures = { + "st_finalize_textures", /* name */ + { /* dirty */ + _NEW_TEXTURE, /* mesa */ + 0, /* st */ + }, + finalize_textures /* update */ +}; diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h index 53d97101d..bca856d71 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.h +++ b/mesalib/src/mesa/state_tracker/st_texture.h @@ -1,225 +1,221 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_TEXTURE_H -#define ST_TEXTURE_H - - -#include "pipe/p_context.h" -#include "util/u_sampler.h" - -#include "main/mtypes.h" - - -struct pipe_resource; - - -/** - * Subclass of gl_texure_image. - */ -struct st_texture_image -{ - struct gl_texture_image base; - - /* These aren't stored in gl_texture_image - */ - GLuint level; - GLuint face; - - /* If stImage->pt != NULL, image data is stored here. - * Else if stImage->base.Data != NULL, image is stored there. - * Else there is no image data. - */ - struct pipe_resource *pt; - - struct pipe_transfer *transfer; -}; - - -/** - * Subclass of gl_texure_object. - */ -struct st_texture_object -{ - struct gl_texture_object base; /* The "parent" object */ - - /* The texture must include at levels [0..lastLevel] once validated: - */ - GLuint lastLevel; - - /** The size of the level=0 mipmap image */ - GLuint width0, height0, depth0; - - /* On validation any active images held in main memory or in other - * textures will be copied to this texture and the old storage freed. - */ - struct pipe_resource *pt; - - /* Default sampler view attached to this texture object. Created lazily - * on first binding. - */ - struct pipe_sampler_view *sampler_view; - - /* True if there is/was a surface bound to this texture object. It helps - * track whether the texture object is surface based or not. - */ - GLboolean surface_based; -}; - - -static INLINE struct st_texture_image * -st_texture_image(struct gl_texture_image *img) -{ - return (struct st_texture_image *) img; -} - -static INLINE struct st_texture_object * -st_texture_object(struct gl_texture_object *obj) -{ - return (struct st_texture_object *) obj; -} - - -static INLINE struct pipe_resource * -st_get_texobj_resource(struct gl_texture_object *texObj) -{ - struct st_texture_object *stObj = st_texture_object(texObj); - return stObj ? stObj->pt : NULL; -} - - -static INLINE struct pipe_resource * -st_get_stobj_resource(struct st_texture_object *stObj) -{ - return stObj ? stObj->pt : NULL; -} - - -static INLINE struct pipe_sampler_view * -st_create_texture_sampler_view(struct pipe_context *pipe, - struct pipe_resource *texture) -{ - struct pipe_sampler_view templ; - - u_sampler_view_default_template(&templ, - texture, - texture->format); - - return pipe->create_sampler_view(pipe, texture, &templ); -} - - -static INLINE struct pipe_sampler_view * -st_create_texture_sampler_view_format(struct pipe_context *pipe, - struct pipe_resource *texture, - enum pipe_format format) -{ - struct pipe_sampler_view templ; - - u_sampler_view_default_template(&templ, - texture, - format); - - return pipe->create_sampler_view(pipe, texture, &templ); -} - -static INLINE struct pipe_sampler_view * -st_get_texture_sampler_view(struct st_texture_object *stObj, - struct pipe_context *pipe) - -{ - if (!stObj || !stObj->pt) { - return NULL; - } - - if (!stObj->sampler_view) { - stObj->sampler_view = st_create_texture_sampler_view(pipe, stObj->pt); - } - - return stObj->sampler_view; -} - - -extern struct pipe_resource * -st_texture_create(struct st_context *st, - enum pipe_texture_target target, - enum pipe_format format, - GLuint last_level, - GLuint width0, - GLuint height0, - GLuint depth0, - GLuint tex_usage ); - - -/* Check if an image fits into an existing texture object. - */ -extern GLboolean -st_texture_match_image(const struct pipe_resource *pt, - const struct gl_texture_image *image, - GLuint face, GLuint level); - -/* Return a pointer to an image within a texture. Return image stride as - * well. - */ -extern GLubyte * -st_texture_image_map(struct st_context *st, - struct st_texture_image *stImage, - GLuint zoffset, - enum pipe_transfer_usage usage, - unsigned x, unsigned y, - unsigned w, unsigned h); - -extern void -st_texture_image_unmap(struct st_context *st, - struct st_texture_image *stImage); - - -/* Return pointers to each 2d slice within an image. Indexed by depth - * value. - */ -extern const GLuint * -st_texture_depth_offsets(struct pipe_resource *pt, GLuint level); - - -/* Upload an image into a texture - */ -extern void -st_texture_image_data(struct st_context *st, - struct pipe_resource *dst, - GLuint face, GLuint level, void *src, - GLuint src_row_pitch, GLuint src_image_pitch); - - -/* Copy an image between two textures - */ -extern void -st_texture_image_copy(struct pipe_context *pipe, - struct pipe_resource *dst, GLuint dstLevel, - struct pipe_resource *src, GLuint srcLevel, - GLuint face); - -#endif +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef ST_TEXTURE_H +#define ST_TEXTURE_H + + +#include "pipe/p_context.h" +#include "util/u_sampler.h" + +#include "main/mtypes.h" + + +struct pipe_resource; + + +/** + * Subclass of gl_texure_image. + */ +struct st_texture_image +{ + struct gl_texture_image base; + + /* These aren't stored in gl_texture_image + */ + GLuint level; + GLuint face; + + /* If stImage->pt != NULL, image data is stored here. + * Else if stImage->base.Data != NULL, image is stored there. + * Else there is no image data. + */ + struct pipe_resource *pt; + + struct pipe_transfer *transfer; +}; + + +/** + * Subclass of gl_texure_object. + */ +struct st_texture_object +{ + struct gl_texture_object base; /* The "parent" object */ + + /* The texture must include at levels [0..lastLevel] once validated: + */ + GLuint lastLevel; + + /** The size of the level=0 mipmap image */ + GLuint width0, height0, depth0; + + /* On validation any active images held in main memory or in other + * textures will be copied to this texture and the old storage freed. + */ + struct pipe_resource *pt; + + /* Default sampler view attached to this texture object. Created lazily + * on first binding. + */ + struct pipe_sampler_view *sampler_view; + + /* True if there is/was a surface bound to this texture object. It helps + * track whether the texture object is surface based or not. + */ + GLboolean surface_based; +}; + + +static INLINE struct st_texture_image * +st_texture_image(struct gl_texture_image *img) +{ + return (struct st_texture_image *) img; +} + +static INLINE struct st_texture_object * +st_texture_object(struct gl_texture_object *obj) +{ + return (struct st_texture_object *) obj; +} + + +static INLINE struct pipe_resource * +st_get_texobj_resource(struct gl_texture_object *texObj) +{ + struct st_texture_object *stObj = st_texture_object(texObj); + return stObj ? stObj->pt : NULL; +} + + +static INLINE struct pipe_resource * +st_get_stobj_resource(struct st_texture_object *stObj) +{ + return stObj ? stObj->pt : NULL; +} + + +static INLINE struct pipe_sampler_view * +st_create_texture_sampler_view(struct pipe_context *pipe, + struct pipe_resource *texture) +{ + struct pipe_sampler_view templ; + + u_sampler_view_default_template(&templ, texture, texture->format); + + return pipe->create_sampler_view(pipe, texture, &templ); +} + + +static INLINE struct pipe_sampler_view * +st_create_texture_sampler_view_format(struct pipe_context *pipe, + struct pipe_resource *texture, + enum pipe_format format) +{ + struct pipe_sampler_view templ; + + u_sampler_view_default_template(&templ, texture, format); + + return pipe->create_sampler_view(pipe, texture, &templ); +} + + +static INLINE struct pipe_sampler_view * +st_get_texture_sampler_view(struct st_texture_object *stObj, + struct pipe_context *pipe) +{ + if (!stObj || !stObj->pt) { + return NULL; + } + + if (!stObj->sampler_view) { + stObj->sampler_view = st_create_texture_sampler_view(pipe, stObj->pt); + } + + return stObj->sampler_view; +} + + +extern struct pipe_resource * +st_texture_create(struct st_context *st, + enum pipe_texture_target target, + enum pipe_format format, + GLuint last_level, + GLuint width0, + GLuint height0, + GLuint depth0, + GLuint tex_usage ); + + +/* Check if an image fits into an existing texture object. + */ +extern GLboolean +st_texture_match_image(const struct pipe_resource *pt, + const struct gl_texture_image *image, + GLuint face, GLuint level); + +/* Return a pointer to an image within a texture. Return image stride as + * well. + */ +extern GLubyte * +st_texture_image_map(struct st_context *st, + struct st_texture_image *stImage, + GLuint zoffset, + enum pipe_transfer_usage usage, + unsigned x, unsigned y, + unsigned w, unsigned h); + +extern void +st_texture_image_unmap(struct st_context *st, + struct st_texture_image *stImage); + + +/* Return pointers to each 2d slice within an image. Indexed by depth + * value. + */ +extern const GLuint * +st_texture_depth_offsets(struct pipe_resource *pt, GLuint level); + + +/* Upload an image into a texture + */ +extern void +st_texture_image_data(struct st_context *st, + struct pipe_resource *dst, + GLuint face, GLuint level, void *src, + GLuint src_row_pitch, GLuint src_image_pitch); + + +/* Copy an image between two textures + */ +extern void +st_texture_image_copy(struct pipe_context *pipe, + struct pipe_resource *dst, GLuint dstLevel, + struct pipe_resource *src, GLuint srcLevel, + GLuint face); + +#endif diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h index 20c7429da..37940efdc 100644 --- a/mesalib/src/mesa/vbo/vbo.h +++ b/mesalib/src/mesa/vbo/vbo.h @@ -1,173 +1,173 @@ -/* - * mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 Brian Paul 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 - * BRIAN PAUL 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. - */ - -/** - * \file vbo_context.h - * \brief VBO builder module datatypes and definitions. - * \author Keith Whitwell - */ - - -#ifndef _VBO_H -#define _VBO_H - -#include "main/glheader.h" - -struct gl_client_array; -struct gl_context; - -struct _mesa_prim { - GLuint mode:8; - GLuint indexed:1; - GLuint begin:1; - GLuint end:1; - GLuint weak:1; - GLuint no_current_update:1; - GLuint pad:19; - - GLuint start; - GLuint count; - GLint basevertex; - GLsizei num_instances; -}; - -/* Would like to call this a "vbo_index_buffer", but this would be - * confusing as the indices are not neccessarily yet in a non-null - * buffer object. - */ -struct _mesa_index_buffer { - GLuint count; - GLenum type; - struct gl_buffer_object *obj; - const void *ptr; -}; - - - -GLboolean _vbo_CreateContext( struct gl_context *ctx ); -void _vbo_DestroyContext( struct gl_context *ctx ); -void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state ); - - -typedef void (*vbo_draw_func)( struct gl_context *ctx, - const struct gl_client_array **arrays, - const struct _mesa_prim *prims, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLboolean index_bounds_valid, - GLuint min_index, - GLuint max_index ); - - - - -/* Utility function to cope with various constraints on tnl modules or - * hardware. This can be used to split an incoming set of arrays and - * primitives against the following constraints: - * - Maximum number of indices in index buffer. - * - Maximum number of vertices referenced by index buffer. - * - Maximum hardware vertex buffer size. - */ -struct split_limits { - GLuint max_verts; - GLuint max_indices; - GLuint max_vb_size; /* bytes */ -}; - - -void vbo_split_prims( struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLuint min_index, - GLuint max_index, - vbo_draw_func draw, - const struct split_limits *limits ); - - -/* Helpers for dealing translating away non-zero min_index. - */ -GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] ); -GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] ); - -void vbo_rebase_prims( struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLuint min_index, - GLuint max_index, - vbo_draw_func draw ); -void -vbo_get_minmax_index(struct gl_context *ctx, const struct _mesa_prim *prim, - const struct _mesa_index_buffer *ib, - GLuint *min_index, GLuint *max_index); - -void vbo_use_buffer_objects(struct gl_context *ctx); - - -void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func); - - -void GLAPIENTRY -_es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); - -void GLAPIENTRY -_es_Normal3f(GLfloat x, GLfloat y, GLfloat z); - -void GLAPIENTRY -_es_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); - -void GLAPIENTRY -_es_Materialfv(GLenum face, GLenum pname, const GLfloat *params); - -void GLAPIENTRY -_es_Materialf(GLenum face, GLenum pname, GLfloat param); - -void GLAPIENTRY -_es_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - -void GLAPIENTRY -_es_VertexAttrib1f(GLuint indx, GLfloat x); - -void GLAPIENTRY -_es_VertexAttrib1fv(GLuint indx, const GLfloat* values); - -void GLAPIENTRY -_es_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); - -void GLAPIENTRY -_es_VertexAttrib2fv(GLuint indx, const GLfloat* values); - -void GLAPIENTRY -_es_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); - -void GLAPIENTRY -_es_VertexAttrib3fv(GLuint indx, const GLfloat* values); - -void GLAPIENTRY -_es_VertexAttrib4fv(GLuint indx, const GLfloat* values); - -#endif +/* + * mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 Brian Paul 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 + * BRIAN PAUL 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. + */ + +/** + * \file vbo_context.h + * \brief VBO builder module datatypes and definitions. + * \author Keith Whitwell + */ + + +#ifndef _VBO_H +#define _VBO_H + +#include "main/glheader.h" + +struct gl_client_array; +struct gl_context; + +struct _mesa_prim { + GLuint mode:8; /**< GL_POINTS, GL_LINES, GL_QUAD_STRIP, etc */ + GLuint indexed:1; + GLuint begin:1; + GLuint end:1; + GLuint weak:1; + GLuint no_current_update:1; + GLuint pad:19; + + GLuint start; + GLuint count; + GLint basevertex; + GLsizei num_instances; +}; + +/* Would like to call this a "vbo_index_buffer", but this would be + * confusing as the indices are not neccessarily yet in a non-null + * buffer object. + */ +struct _mesa_index_buffer { + GLuint count; + GLenum type; + struct gl_buffer_object *obj; + const void *ptr; +}; + + + +GLboolean _vbo_CreateContext( struct gl_context *ctx ); +void _vbo_DestroyContext( struct gl_context *ctx ); +void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state ); + + +typedef void (*vbo_draw_func)( struct gl_context *ctx, + const struct gl_client_array **arrays, + const struct _mesa_prim *prims, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLboolean index_bounds_valid, + GLuint min_index, + GLuint max_index ); + + + + +/* Utility function to cope with various constraints on tnl modules or + * hardware. This can be used to split an incoming set of arrays and + * primitives against the following constraints: + * - Maximum number of indices in index buffer. + * - Maximum number of vertices referenced by index buffer. + * - Maximum hardware vertex buffer size. + */ +struct split_limits { + GLuint max_verts; + GLuint max_indices; + GLuint max_vb_size; /* bytes */ +}; + + +void vbo_split_prims( struct gl_context *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index, + vbo_draw_func draw, + const struct split_limits *limits ); + + +/* Helpers for dealing translating away non-zero min_index. + */ +GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] ); +GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] ); + +void vbo_rebase_prims( struct gl_context *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index, + vbo_draw_func draw ); +void +vbo_get_minmax_index(struct gl_context *ctx, const struct _mesa_prim *prim, + const struct _mesa_index_buffer *ib, + GLuint *min_index, GLuint *max_index); + +void vbo_use_buffer_objects(struct gl_context *ctx); + + +void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func); + + +void GLAPIENTRY +_es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); + +void GLAPIENTRY +_es_Normal3f(GLfloat x, GLfloat y, GLfloat z); + +void GLAPIENTRY +_es_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); + +void GLAPIENTRY +_es_Materialfv(GLenum face, GLenum pname, const GLfloat *params); + +void GLAPIENTRY +_es_Materialf(GLenum face, GLenum pname, GLfloat param); + +void GLAPIENTRY +_es_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + +void GLAPIENTRY +_es_VertexAttrib1f(GLuint indx, GLfloat x); + +void GLAPIENTRY +_es_VertexAttrib1fv(GLuint indx, const GLfloat* values); + +void GLAPIENTRY +_es_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); + +void GLAPIENTRY +_es_VertexAttrib2fv(GLuint indx, const GLfloat* values); + +void GLAPIENTRY +_es_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + +void GLAPIENTRY +_es_VertexAttrib3fv(GLuint indx, const GLfloat* values); + +void GLAPIENTRY +_es_VertexAttrib4fv(GLuint indx, const GLfloat* values); + +#endif diff --git a/xkbcomp/Makefile.am b/xkbcomp/Makefile.am index 707433742..9a41b8873 100644 --- a/xkbcomp/Makefile.am +++ b/xkbcomp/Makefile.am @@ -1,90 +1,75 @@ -# -# Copyright 2005 Red Hat, Inc. -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of Red Hat not be used in -# advertising or publicity pertaining to distribution of the software without -# specific, written prior permission. Red Hat makes no -# representations about the suitability of this software for any purpose. It -# is provided "as is" without express or implied warranty. -# -# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR -# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -bin_PROGRAMS = xkbcomp - -AM_CFLAGS = $(XKBCOMP_CFLAGS) -DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"' $(CWARNFLAGS) -xkbcomp_LDADD = $(XKBCOMP_LIBS) - -xkbcomp_SOURCES = \ - action.c \ - action.h \ - alias.c \ - alias.h \ - compat.c \ - compat.h \ - expr.c \ - expr.h \ - geometry.c \ - indicators.c \ - indicators.h \ - keycodes.c \ - keycodes.h \ - keymap.c \ - keytypes.c \ - listing.c \ - misc.c \ - misc.h \ - parseutils.c \ - parseutils.h \ - symbols.c \ - tokens.h \ - utils.c \ - utils.h \ - vmod.c \ - vmod.h \ - xkbcomp.c \ - xkbcomp.h \ - xkbparse.y \ - xkbpath.c \ - xkbpath.h \ - xkbscan.c - -appman_PRE = \ - xkbcomp.man - -BUILT_SOURCES = xkbparse.c -MAINTAINERCLEANFILES = ChangeLog INSTALL -MAINTAINERCLEANFILES += $(BUILT_SOURCES) - -appmandir = $(APP_MAN_DIR) - -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -EXTRA_DIST = $(appman_PRE) -CLEANFILES = $(appman_DATA) - -SUFFIXES = .$(APP_MAN_SUFFIX) .man - -# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure -.man.$(APP_MAN_SUFFIX): - $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ - - -.PHONY: ChangeLog INSTALL - -INSTALL: - $(INSTALL_CMD) - -ChangeLog: - $(CHANGELOG_CMD) - -dist-hook: ChangeLog INSTALL +# +# Copyright 2005 Red Hat, Inc. +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Red Hat not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Red Hat makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +SUBDIRS = man +bin_PROGRAMS = xkbcomp + +AM_CFLAGS = $(XKBCOMP_CFLAGS) -DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"' $(CWARNFLAGS) +xkbcomp_LDADD = $(XKBCOMP_LIBS) + +xkbcomp_SOURCES = \ + action.c \ + action.h \ + alias.c \ + alias.h \ + compat.c \ + compat.h \ + expr.c \ + expr.h \ + geometry.c \ + indicators.c \ + indicators.h \ + keycodes.c \ + keycodes.h \ + keymap.c \ + keytypes.c \ + listing.c \ + misc.c \ + misc.h \ + parseutils.c \ + parseutils.h \ + symbols.c \ + tokens.h \ + utils.c \ + utils.h \ + vmod.c \ + vmod.h \ + xkbcomp.c \ + xkbcomp.h \ + xkbparse.y \ + xkbpath.c \ + xkbpath.h \ + xkbscan.c + + +BUILT_SOURCES = xkbparse.c +MAINTAINERCLEANFILES = ChangeLog INSTALL +MAINTAINERCLEANFILES += $(BUILT_SOURCES) + +.PHONY: ChangeLog INSTALL + +INSTALL: + $(INSTALL_CMD) + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog INSTALL diff --git a/xkbcomp/configure.ac b/xkbcomp/configure.ac index 9ac84f682..f438c072f 100644 --- a/xkbcomp/configure.ac +++ b/xkbcomp/configure.ac @@ -1,59 +1,62 @@ -dnl Copyright 2005 Red Hat, Inc. -dnl -dnl Permission to use, copy, modify, distribute, and sell this software and its -dnl documentation for any purpose is hereby granted without fee, provided that -dnl the above copyright notice appear in all copies and that both that -dnl copyright notice and this permission notice appear in supporting -dnl documentation, and that the name of Red Hat not be used in -dnl advertising or publicity pertaining to distribution of the software without -dnl specific, written prior permission. Red Hat makes no -dnl representations about the suitability of this software for any purpose. It -dnl is provided "as is" without express or implied warranty. -dnl -dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR -dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -dnl PERFORMANCE OF THIS SOFTWARE. -dnl -dnl Process this file with autoconf to create configure. - -AC_PREREQ([2.60]) -AC_INIT([xkbcomp], [1.2.0], - [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xkbcomp]) -AM_INIT_AUTOMAKE([foreign dist-bzip2]) -AM_MAINTAINER_MODE - -# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS -m4_ifndef([XORG_MACROS_VERSION], - [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) -XORG_MACROS_VERSION(1.8) -XORG_DEFAULT_OPTIONS - -AC_CONFIG_HEADERS([config.h]) - -# If both the C file and YACC are missing, the package cannot be build. -AC_PROG_YACC -AC_PATH_PROG([YACC_INST], $YACC) -if test ! -f "$srcdir/xkbparse.c"; then - if test -z "$YACC_INST"; then - AC_MSG_ERROR([yacc not found - unable to compile xkbparse.y]) - fi -fi - -AC_CHECK_FUNCS([strdup strcasecmp]) - -# Checks for pkg-config packages -PKG_CHECK_MODULES(XKBCOMP, x11 xkbfile) - -AC_ARG_WITH([xkb_config_root], - [AS_HELP_STRING([--with-xkb-config-root=], - [Set default XKB config root (default: ${datadir}/X11/xkb)])], - [XKBCONFIGROOT="$withval"], - [XKBCONFIGROOT='${datadir}/X11/xkb']) -AC_SUBST([XKBCONFIGROOT]) - - -AC_OUTPUT([Makefile]) +dnl Copyright 2005 Red Hat, Inc. +dnl +dnl Permission to use, copy, modify, distribute, and sell this software and its +dnl documentation for any purpose is hereby granted without fee, provided that +dnl the above copyright notice appear in all copies and that both that +dnl copyright notice and this permission notice appear in supporting +dnl documentation, and that the name of Red Hat not be used in +dnl advertising or publicity pertaining to distribution of the software without +dnl specific, written prior permission. Red Hat makes no +dnl representations about the suitability of this software for any purpose. It +dnl is provided "as is" without express or implied warranty. +dnl +dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR +dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +dnl PERFORMANCE OF THIS SOFTWARE. +dnl +dnl Process this file with autoconf to create configure. + +AC_PREREQ([2.60]) +AC_INIT([xkbcomp], [1.2.0], + [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xkbcomp]) +AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_MAINTAINER_MODE + +# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS +m4_ifndef([XORG_MACROS_VERSION], + [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.8) +XORG_DEFAULT_OPTIONS + +AC_CONFIG_HEADERS([config.h]) + +# If both the C file and YACC are missing, the package cannot be build. +AC_PROG_YACC +AC_PATH_PROG([YACC_INST], $YACC) +if test ! -f "$srcdir/xkbparse.c"; then + if test -z "$YACC_INST"; then + AC_MSG_ERROR([yacc not found - unable to compile xkbparse.y]) + fi +fi + +AC_CHECK_FUNCS([strdup strcasecmp]) + +# Checks for pkg-config packages +PKG_CHECK_MODULES(XKBCOMP, x11 xkbfile) + +AC_ARG_WITH([xkb_config_root], + [AS_HELP_STRING([--with-xkb-config-root=], + [Set default XKB config root (default: ${datadir}/X11/xkb)])], + [XKBCONFIGROOT="$withval"], + [XKBCONFIGROOT='${datadir}/X11/xkb']) +AC_SUBST([XKBCONFIGROOT]) + + +AC_CONFIG_FILES([ + Makefile + man/Makefile]) +AC_OUTPUT diff --git a/xkbcomp/man/Makefile.am b/xkbcomp/man/Makefile.am new file mode 100644 index 000000000..f17336a0f --- /dev/null +++ b/xkbcomp/man/Makefile.am @@ -0,0 +1,12 @@ + +appmandir = $(APP_MAN_DIR) +appman_PRE = xkbcomp.man +appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) + +EXTRA_DIST = $(appman_PRE) +CLEANFILES = $(appman_DATA) +SUFFIXES = .$(APP_MAN_SUFFIX) .man + +# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure +.man.$(APP_MAN_SUFFIX): + $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ diff --git a/xkbcomp/man/xkbcomp.man b/xkbcomp/man/xkbcomp.man new file mode 100644 index 000000000..9b380a0fd --- /dev/null +++ b/xkbcomp/man/xkbcomp.man @@ -0,0 +1,107 @@ +.\" +.TH XKBCOMP 1 __xorgversion__ +.SH NAME +xkbcomp \- compile XKB keyboard description +.SH SYNOPSIS +.B xkbcomp +[option] source [ destination ] +.SH DESCRIPTION +.PP +The +.I xkbcomp +keymap compiler converts a description of an XKB keymap into one of several +output formats. The most common use for xkbcomp is to create a compiled +keymap file (.xkm extension) which can be read directly by XKB-capable X +servers or utilities. The keymap compiler can also produce C header +files or XKB source files. The C header files produced by xkbcomp can be +included by X servers or utilities that need a built-in default keymap. +The XKB source files produced by \fIxkbcomp\fP are fully resolved and can be +used to verify that the files which typically make up an XKB keymap +are merged correctly or to create a single file which contains a complete +description of the keymap. +.PP +The \fIsource\fP may specify an X display, or an \fI.xkb\fP or \fI.xkm\fP +file; unless explicitly specified, the format of \fIdestination\fP +depends on the format of the source. Compiling a \fI.xkb\fP (keymap source) +file generates a \fI.xkm\fP (compiled keymap file) by default. If the +source is a \fI.xkm\fP file or an X display, \fIxkbcomp\fP generates a +keymap source file by default. +.PP +If the \fIdestination\fP is an X display, the keymap for the display +is updated with the compiled keymap. +.PP +The name of the \fIdestination\fP is usually computed from the name +of the source, with the extension replaced as appropriate. When compiling +a single map from a file which contains several maps, \fIxkbcomp\fP constructs +the destination file name by appending an appropriate extension to the +name of the map to be used. +.SH OPTIONS +.TP 8 +.B \-a +Show all keyboard information, reporting implicit or derived information +as a comment. Only affects \fI.xkb\fP format output. +.TP 8 +.B \-C +Produce a C header file as output (.h extension). +.TP 8 +.B \-dflts +Compute defaults for any missing components, such as key names. +.TP 8 +.B \-I\fIdir\fP +Specifies top-level directories to be searched for files included by the +keymap description. After all directories specified by \-I options +have been searched, the current directory and finally, the default +xkb directory (usually __projectroot__/lib/X11/xkb) will be searched. +.sp +To prevent the current and default directories from being searched, +use the \-I option alone (i.e. without a directory), before any \-I +options that specify the directories you do want searched. +.TP 8 +.B \-i\ \fIdeviceid\fP +If \fIsource\fP or \fIdestination\fP is a valid X display, load the keymap +from/into the device with the specified ID (not name). +.TP 8 +.B \-l +List maps that specify the \fImap\fP pattern in any files listed on the +command line (not implemented yet). +.TP 8 +.B \-m\ \fIname\fP +Specifies a map to be compiled from an file with multiple entries. +.TP 8 +.B \-merge +Merge the compiled information with the map from the server (not implemented +yet). +.TP 8 +.B \-o\ \fIname\fP +Specifies a name for the generated output file. The default is the name of +the source file with an appropriate extension for the output format. +.TP 8 +.B \-opt\ \fIparts\fP +Specifies a list of optional parts. Compilation errors in any optional parts +are not fatal. Parts may consist of any combination of the letters \fIc\fP, +\fIg\fP,\fIk\fP,\fIs\fP,\fIt\fP which specify the compatibility map, geometry, +keycodes, symbols and types, respectively. +.TP 8 +.B -R\fIdir\fP +Specifies the root directory for relative path names. +.TP 8 +.B -synch +Force synchronization for X requests. +.TP 8 +.B \-w\ \fIlvl\fP +Controls the reporting of warnings during compilation. A warning level +of 0 disables all warnings; a warning level of 10 enables them all. +.TP 8 +.B \-xkb +Generate a source description of the keyboard as output (.xkb extension). +.TP 8 +.B \-xkm +Generate a compiled keymap file as output (.xkm extension). +.SH "SEE ALSO" +X(__miscmansuffix__) +.SH COPYRIGHT +Copyright 1994, Silicon Graphics Computer Systems and X Consortium, Inc. +.br +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. +.SH AUTHOR +Erik Fortune, Silicon Graphics diff --git a/xkbcomp/xkbcomp.man b/xkbcomp/xkbcomp.man deleted file mode 100644 index 7bfe3a21c..000000000 --- a/xkbcomp/xkbcomp.man +++ /dev/null @@ -1,107 +0,0 @@ -.\" -.TH XKBCOMP 1 __xorgversion__ -.SH NAME -xkbcomp \- compile XKB keyboard description -.SH SYNOPSIS -.B xkbcomp -[option] source [ destination ] -.SH DESCRIPTION -.PP -The -.I xkbcomp -keymap compiler converts a description of an XKB keymap into one of several -output formats. The most common use for xkbcomp is to create a compiled -keymap file (.xkm extension) which can be read directly by XKB-capable X -servers or utilities. The keymap compiler can also produce C header -files or XKB source files. The C header files produced by xkbcomp can be -included by X servers or utilities that need a built-in default keymap. -The XKB source files produced by \fIxkbcomp\fP are fully resolved and can be -used to verify that the files which typically make up an XKB keymap -are merged correctly or to create a single file which contains a complete -description of the keymap. -.PP -The \fIsource\fP may specify an X display, or an \fI.xkb\fP or \fI.xkm\fP -file; unless explicitly specified, the format of \fIdestination\fP -depends on the format of the source. Compiling a \fI.xkb\fP (keymap source) -file generates a \fI.xkm\fP (compiled keymap file) by default. If the -source is a \fI.xkm\fP file or an X display, \fIxkbcomp\fP generates a -keymap source file by default. -.PP -If the \fIdestination\fP is an X display, the keymap for the display -is updated with the compiled keymap. -.PP -The name of the \fIdestination\fP is usually computed from the name -of the source, with the extension replaced as appropriate. When compiling -a single map from a file which contains several maps, \fIxkbcomp\fP constructs -the destination file name by appending an appropriate extension to the -name of the map to be used. -.SH OPTIONS -.TP 8 -.B \-a -Show all keyboard information, reporting implicit or derived information -as a comment. Only affects \fI.xkb\fP format output. -.TP 8 -.B \-C -Produce a C header file as output (.h extension). -.TP 8 -.B \-dflts -Compute defaults for any missing components, such as key names. -.TP 8 -.B \-I\fIdir\fP -Specifies top-level directories to be searched for files included by the -keymap description. After all directories specified by \-I options -have been searched, the current directory and finally, the default -xkb directory (usually __projectroot__/lib/X11/xkb) will be searched. -.sp -To prevent the current and default directories from being searched, -use the \-I option alone (i.e. without a directory), before any \-I -options that specify the directories you do want searched. -.TP 8 -.B \-i\ \fIdeviceid\fP -If \fIsource\fP or \fIdestination\fP is a valid X display, load the keymap -from/into the device with the specified ID (not name). -.TP 8 -.B \-l -List maps that specify the \fImap\fP pattern in any files listed on the -command line (not implemented yet). -.TP 8 -.B \-m\ \fIname\fP -Specifies a map to be compiled from an file with multiple entries. -.TP 8 -.B \-merge -Merge the compiled information with the map from the server (not implemented -yet). -.TP 8 -.B \-o\ \fIname\fP -Specifies a name for the generated output file. The default is the name of -the source file with an appropriate extension for the output format. -.TP 8 -.B \-opt\ \fIparts\fP -Specifies a list of optional parts. Compilation errors in any optional parts -are not fatal. Parts may consist of any combination of the letters \fIc\fP, -\fIg\fP,\fIk\fP,\fIs\fP,\fIt\fP which specify the compatibility map, geometry, -keycodes, symbols and types, respectively. -.TP 8 -.B -R\fIdir\fP -Specifies the root directory for relative path names. -.TP 8 -.B -synch -Force synchronization for X requests. -.TP 8 -.B \-w\ \fIlvl\fP -Controls the reporting of warnings during compilation. A warning level -of 0 disables all warnings; a warning level of 10 enables them all. -.TP 8 -.B \-xkb -Generate a source description of the keyboard as output (.xkb extension). -.TP 8 -.B \-xkm -Generate a compiled keymap file as output (.xkm extension). -.SH "SEE ALSO" -X(__miscmansuffix__) -.SH COPYRIGHT -Copyright 1994, Silicon Graphics Computer Systems and X Consortium, Inc. -.br -See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. -.SH AUTHOR -Erik Fortune, Silicon Graphics diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c index 40e03337d..327873e29 100644 --- a/xorg-server/Xi/exevents.c +++ b/xorg-server/Xi/exevents.c @@ -1,2176 +1,2177 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Hewlett-Packard not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -********************************************************/ - -/******************************************************************** - * - * Routines to register and initialize extension input devices. - * This also contains ProcessOtherEvent, the routine called from DDX - * to route extension events. - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "inputstr.h" -#include -#include -#include -#include -#include -#include -#include "windowstr.h" -#include "miscstruct.h" -#include "region.h" -#include "exevents.h" -#include "extnsionst.h" -#include "exglobals.h" -#include "dixevents.h" /* DeliverFocusedEvent */ -#include "dixgrabs.h" /* CreateGrab() */ -#include "scrnintstr.h" -#include "listdev.h" /* for CopySwapXXXClass */ -#include "xace.h" -#include "xiquerydevice.h" /* For List*Info */ -#include "eventconvert.h" -#include "eventstr.h" - -#include -#include "xkbsrv.h" - -#define WID(w) ((w) ? ((w)->drawable.id) : 0) -#define AllModifiersMask ( \ - ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ - Mod3Mask | Mod4Mask | Mod5Mask ) -#define AllButtonsMask ( \ - Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) - -Bool ShouldFreeInputMasks(WindowPtr /* pWin */ , - Bool /* ignoreSelectedEvents */ - ); -static Bool MakeInputMasks(WindowPtr /* pWin */ - ); - -/* - * Only let the given client know of core events which will affect its - * interpretation of input events, if the client's ClientPointer (or the - * paired keyboard) is the current device. - */ -int -XIShouldNotify(ClientPtr client, DeviceIntPtr dev) -{ - DeviceIntPtr current_ptr = PickPointer(client); - DeviceIntPtr current_kbd = GetPairedDevice(current_ptr); - - if (dev == current_kbd || dev == current_ptr) - return 1; - - return 0; -} - -Bool -IsPointerEvent(InternalEvent* event) -{ - switch(event->any.type) - { - case ET_ButtonPress: - case ET_ButtonRelease: - case ET_Motion: - /* XXX: enter/leave ?? */ - return TRUE; - default: - break; - } - return FALSE; -} - -/** - * @return the device matching the deviceid of the device set in the event, or - * NULL if the event is not an XInput event. - */ -DeviceIntPtr -XIGetDevice(xEvent* xE) -{ - DeviceIntPtr pDev = NULL; - - if (xE->u.u.type == DeviceButtonPress || - xE->u.u.type == DeviceButtonRelease || - xE->u.u.type == DeviceMotionNotify || - xE->u.u.type == ProximityIn || - xE->u.u.type == ProximityOut || - xE->u.u.type == DevicePropertyNotify) - { - int rc; - int id; - - id = ((deviceKeyButtonPointer*)xE)->deviceid & ~MORE_EVENTS; - - rc = dixLookupDevice(&pDev, id, serverClient, DixUnknownAccess); - if (rc != Success) - ErrorF("[dix] XIGetDevice failed on XACE restrictions (%d)\n", rc); - } - return pDev; -} - - -/** - * Copy the device->key into master->key and send a mapping notify to the - * clients if appropriate. - * master->key needs to be allocated by the caller. - * - * Device is the slave device. If it is attached to a master device, we may - * need to send a mapping notify to the client because it causes the MD - * to change state. - * - * Mapping notify needs to be sent in the following cases: - * - different slave device on same master - * - different master - * - * XXX: They way how the code is we also send a map notify if the slave device - * stays the same, but the master changes. This isn't really necessary though. - * - * XXX: this gives you funny behaviour with the ClientPointer. When a - * MappingNotify is sent to the client, the client usually responds with a - * GetKeyboardMapping. This will retrieve the ClientPointer's keyboard - * mapping, regardless of which keyboard sent the last mapping notify request. - * So depending on the CP setting, your keyboard may change layout in each - * app... - * - * This code is basically the old SwitchCoreKeyboard. - */ - -void -CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master) -{ - KeyClassPtr mk = master->key; - - if (device == master) - return; - - mk->sourceid = device->id; - - - if (!XkbCopyDeviceKeymap(master, device)) - FatalError("Couldn't pivot keymap from device to core!\n"); -} - -/** - * Copies the feedback classes from device "from" into device "to". Classes - * are duplicated (not just flipping the pointers). All feedback classes are - * linked lists, the full list is duplicated. - */ -static void -DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) -{ - ClassesPtr classes; - - - if (from->intfeed) - { - IntegerFeedbackPtr *i, it; - - if (!to->intfeed) - { - classes = to->unused_classes; - to->intfeed = classes->intfeed; - classes->intfeed = NULL; - } - - i = &to->intfeed; - for (it = from->intfeed; it; it = it->next) - { - if (!(*i)) - { - *i = calloc(1, sizeof(IntegerFeedbackClassRec)); - if (!(*i)) - { - ErrorF("[Xi] Cannot alloc memory for class copy."); - return; - } - } - (*i)->CtrlProc = it->CtrlProc; - (*i)->ctrl = it->ctrl; - - i = &(*i)->next; - } - } else if (to->intfeed && !from->intfeed) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->intfeed = to->intfeed; - to->intfeed = NULL; - } - - if (from->stringfeed) - { - StringFeedbackPtr *s, it; - - if (!to->stringfeed) - { - classes = to->unused_classes; - to->stringfeed = classes->stringfeed; - classes->stringfeed = NULL; - } - - s = &to->stringfeed; - for (it = from->stringfeed; it; it = it->next) - { - if (!(*s)) - { - *s = calloc(1, sizeof(StringFeedbackClassRec)); - if (!(*s)) - { - ErrorF("[Xi] Cannot alloc memory for class copy."); - return; - } - } - (*s)->CtrlProc = it->CtrlProc; - (*s)->ctrl = it->ctrl; - - s = &(*s)->next; - } - } else if (to->stringfeed && !from->stringfeed) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->stringfeed = to->stringfeed; - to->stringfeed = NULL; - } - - if (from->bell) - { - BellFeedbackPtr *b, it; - - if (!to->bell) - { - classes = to->unused_classes; - to->bell = classes->bell; - classes->bell = NULL; - } - - b = &to->bell; - for (it = from->bell; it; it = it->next) - { - if (!(*b)) - { - *b = calloc(1, sizeof(BellFeedbackClassRec)); - if (!(*b)) - { - ErrorF("[Xi] Cannot alloc memory for class copy."); - return; - } - } - (*b)->BellProc = it->BellProc; - (*b)->CtrlProc = it->CtrlProc; - (*b)->ctrl = it->ctrl; - - b = &(*b)->next; - } - } else if (to->bell && !from->bell) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->bell = to->bell; - to->bell = NULL; - } - - if (from->leds) - { - LedFeedbackPtr *l, it; - - if (!to->leds) - { - classes = to->unused_classes; - to->leds = classes->leds; - classes->leds = NULL; - } - - l = &to->leds; - for (it = from->leds; it; it = it->next) - { - if (!(*l)) - { - *l = calloc(1, sizeof(LedFeedbackClassRec)); - if (!(*l)) - { - ErrorF("[Xi] Cannot alloc memory for class copy."); - return; - } - } - (*l)->CtrlProc = it->CtrlProc; - (*l)->ctrl = it->ctrl; - if ((*l)->xkb_sli) - XkbFreeSrvLedInfo((*l)->xkb_sli); - (*l)->xkb_sli = XkbCopySrvLedInfo(from, it->xkb_sli, NULL, *l); - - l = &(*l)->next; - } - } else if (to->leds && !from->leds) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->leds = to->leds; - to->leds = NULL; - } -} - -static void -DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to) -{ - ClassesPtr classes; - - /* XkbInitDevice (->XkbInitIndicatorMap->XkbFindSrvLedInfo) relies on the - * kbdfeed to be set up properly, so let's do the feedback classes first. - */ - if (from->kbdfeed) - { - KbdFeedbackPtr *k, it; - - if (!to->kbdfeed) - { - classes = to->unused_classes; - - to->kbdfeed = classes->kbdfeed; - if (!to->kbdfeed) - InitKeyboardDeviceStruct(to, NULL, NULL, NULL); - classes->kbdfeed = NULL; - } - - k = &to->kbdfeed; - for(it = from->kbdfeed; it; it = it->next) - { - if (!(*k)) - { - *k = calloc(1, sizeof(KbdFeedbackClassRec)); - if (!*k) - { - ErrorF("[Xi] Cannot alloc memory for class copy."); - return; - } - } - (*k)->BellProc = it->BellProc; - (*k)->CtrlProc = it->CtrlProc; - (*k)->ctrl = it->ctrl; - if ((*k)->xkb_sli) - XkbFreeSrvLedInfo((*k)->xkb_sli); - (*k)->xkb_sli = XkbCopySrvLedInfo(from, it->xkb_sli, *k, NULL); - - k = &(*k)->next; - } - } else if (to->kbdfeed && !from->kbdfeed) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->kbdfeed = to->kbdfeed; - to->kbdfeed = NULL; - } - - if (from->key) - { - if (!to->key) - { - classes = to->unused_classes; - to->key = classes->key; - if (!to->key) - InitKeyboardDeviceStruct(to, NULL, NULL, NULL); - else - classes->key = NULL; - } - - CopyKeyClass(from, to); - } else if (to->key && !from->key) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->key = to->key; - to->key = NULL; - } - - /* If a SrvLedInfoPtr's flags are XkbSLI_IsDefault, the names and maps - * pointer point into the xkbInfo->desc struct. XkbCopySrvLedInfo - * didn't update the pointers so we need to do it manually here. - */ - if (to->kbdfeed) - { - KbdFeedbackPtr k; - - for (k = to->kbdfeed; k; k = k->next) - { - if (!k->xkb_sli) - continue; - if (k->xkb_sli->flags & XkbSLI_IsDefault) - { - k->xkb_sli->names = to->key->xkbInfo->desc->names->indicators; - k->xkb_sli->maps = to->key->xkbInfo->desc->indicators->maps; - } - } - } - - /* We can't just copy over the focus class. When an app sets the focus, - * it'll do so on the master device. Copying the SDs focus means losing - * the focus. - * So we only copy the focus class if the device didn't have one, - * otherwise we leave it as it is. - */ - if (from->focus) - { - if (!to->focus) - { - WindowPtr *oldTrace; - - classes = to->unused_classes; - to->focus = classes->focus; - if (!to->focus) - { - to->focus = calloc(1, sizeof(FocusClassRec)); - if (!to->focus) - FatalError("[Xi] no memory for class shift.\n"); - } else - classes->focus = NULL; - - oldTrace = to->focus->trace; - memcpy(to->focus, from->focus, sizeof(FocusClassRec)); - to->focus->trace = realloc(oldTrace, - to->focus->traceSize * sizeof(WindowPtr)); - if (!to->focus->trace && to->focus->traceSize) - FatalError("[Xi] no memory for trace.\n"); - memcpy(to->focus->trace, from->focus->trace, - from->focus->traceSize * sizeof(WindowPtr)); - to->focus->sourceid = from->id; - } - } else if (to->focus) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->focus = to->focus; - to->focus = NULL; - } - -} - -static void -DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) -{ - ClassesPtr classes; - - /* Feedback classes must be copied first */ - if (from->ptrfeed) - { - PtrFeedbackPtr *p, it; - if (!to->ptrfeed) - { - classes = to->unused_classes; - to->ptrfeed = classes->ptrfeed; - classes->ptrfeed = NULL; - } - - p = &to->ptrfeed; - for (it = from->ptrfeed; it; it = it->next) - { - if (!(*p)) - { - *p = calloc(1, sizeof(PtrFeedbackClassRec)); - if (!*p) - { - ErrorF("[Xi] Cannot alloc memory for class copy."); - return; - } - } - (*p)->CtrlProc = it->CtrlProc; - (*p)->ctrl = it->ctrl; - - p = &(*p)->next; - } - } else if (to->ptrfeed && !from->ptrfeed) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->ptrfeed = to->ptrfeed; - to->ptrfeed = NULL; - } - - if (from->valuator) - { - ValuatorClassPtr v; - if (!to->valuator) - { - classes = to->unused_classes; - to->valuator = classes->valuator; - if (to->valuator) - classes->valuator = NULL; - } - - to->valuator = realloc(to->valuator, sizeof(ValuatorClassRec) + - from->valuator->numAxes * sizeof(AxisInfo) + - from->valuator->numAxes * sizeof(double)); - v = to->valuator; - if (!v) - FatalError("[Xi] no memory for class shift.\n"); - - v->numAxes = from->valuator->numAxes; - v->axes = (AxisInfoPtr)&v[1]; - memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo)); - - v->axisVal = (double*)(v->axes + from->valuator->numAxes); - v->sourceid = from->id; - } else if (to->valuator && !from->valuator) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->valuator = to->valuator; - to->valuator = NULL; - } - - if (from->button) - { - if (!to->button) - { - classes = to->unused_classes; - to->button = classes->button; - if (!to->button) - { - to->button = calloc(1, sizeof(ButtonClassRec)); - if (!to->button) - FatalError("[Xi] no memory for class shift.\n"); - } else - classes->button = NULL; - } - - if (from->button->xkb_acts) - { - if (!to->button->xkb_acts) - { - to->button->xkb_acts = calloc(1, sizeof(XkbAction)); - if (!to->button->xkb_acts) - FatalError("[Xi] not enough memory for xkb_acts.\n"); - } - memcpy(to->button->xkb_acts, from->button->xkb_acts, - sizeof(XkbAction)); - } else - free(to->button->xkb_acts); - - memcpy(to->button->labels, from->button->labels, - from->button->numButtons * sizeof(Atom)); - to->button->sourceid = from->id; - } else if (to->button && !from->button) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->button = to->button; - to->button = NULL; - } - - if (from->proximity) - { - if (!to->proximity) - { - classes = to->unused_classes; - to->proximity = classes->proximity; - if (!to->proximity) - { - to->proximity = calloc(1, sizeof(ProximityClassRec)); - if (!to->proximity) - FatalError("[Xi] no memory for class shift.\n"); - } else - classes->proximity = NULL; - } - memcpy(to->proximity, from->proximity, sizeof(ProximityClassRec)); - to->proximity->sourceid = from->id; - } else if (to->proximity) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->proximity = to->proximity; - to->proximity = NULL; - } - - if (from->absolute) - { - if (!to->absolute) - { - classes = to->unused_classes; - to->absolute = classes->absolute; - if (!to->absolute) - { - to->absolute = calloc(1, sizeof(AbsoluteClassRec)); - if (!to->absolute) - FatalError("[Xi] no memory for class shift.\n"); - } else - classes->absolute = NULL; - } - memcpy(to->absolute, from->absolute, sizeof(AbsoluteClassRec)); - to->absolute->sourceid = from->id; - } else if (to->absolute) - { - ClassesPtr classes; - classes = to->unused_classes; - classes->absolute = to->absolute; - to->absolute = NULL; - } -} - -/** - * Copies the CONTENT of the classes of device from into the classes in device - * to. From and to are identical after finishing. - * - * If to does not have classes from currenly has, the classes are stored in - * to's devPrivates system. Later, we recover it again from there if needed. - * Saves a few memory allocations. - */ -void -DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to, DeviceChangedEvent *dce) -{ - /* generic feedback classes, not tied to pointer and/or keyboard */ - DeepCopyFeedbackClasses(from, to); - - if ((dce->flags & DEVCHANGE_KEYBOARD_EVENT)) - DeepCopyKeyboardClasses(from, to); - if ((dce->flags & DEVCHANGE_POINTER_EVENT)) - DeepCopyPointerClasses(from, to); -} - - -/** - * Send an XI2 DeviceChangedEvent to all interested clients. - */ -void -XISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master, DeviceChangedEvent *dce) -{ - xXIDeviceChangedEvent *dcce; - int rc; - - rc = EventToXI2((InternalEvent*)dce, (xEvent**)&dcce); - if (rc != Success) - { - ErrorF("[Xi] event conversion from DCE failed with code %d\n", rc); - return; - } - - /* we don't actually swap if there's a NullClient, swapping is done - * later when event is delivered. */ - SendEventToAllWindows(master, XI_DeviceChangedMask, (xEvent*)dcce, 1); - free(dcce); -} - -static void -ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce) -{ - DeviceIntPtr slave; - int rc; - - /* For now, we don't have devices that change physically. */ - if (!IsMaster(device)) - return; - - rc = dixLookupDevice(&slave, dce->sourceid, serverClient, DixReadAccess); - - if (rc != Success) - return; /* Device has disappeared */ - - if (!slave->u.master) - return; /* set floating since the event */ - - if (slave->u.master->id != dce->masterid) - return; /* not our slave anymore, don't care */ - - /* FIXME: we probably need to send a DCE for the new slave now */ - - device->public.devicePrivate = slave->public.devicePrivate; - - /* FIXME: the classes may have changed since we generated the event. */ - DeepCopyDeviceClasses(slave, device, dce); - XISendDeviceChangedEvent(slave, device, dce); -} - -/** - * Update the device state according to the data in the event. - * - * return values are - * DEFAULT ... process as normal - * DONT_PROCESS ... return immediately from caller - */ -#define DEFAULT 0 -#define DONT_PROCESS 1 -int -UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event) -{ - int i; - int key = 0, - bit = 0, - last_valuator; - - KeyClassPtr k = NULL; - ButtonClassPtr b = NULL; - ValuatorClassPtr v = NULL; - - /* This event is always the first we get, before the actual events with - * the data. However, the way how the DDX is set up, "device" will - * actually be the slave device that caused the event. - */ - switch(event->type) - { - case ET_DeviceChanged: - ChangeMasterDeviceClasses(device, (DeviceChangedEvent*)event); - return DONT_PROCESS; /* event has been sent already */ - case ET_Motion: - case ET_ButtonPress: - case ET_ButtonRelease: - case ET_KeyPress: - case ET_KeyRelease: - case ET_ProximityIn: - case ET_ProximityOut: - break; - default: - /* other events don't update the device */ - return DEFAULT; - } - - k = device->key; - v = device->valuator; - b = device->button; - - key = event->detail.key; - bit = 1 << (key & 7); - - /* Update device axis */ - /* Check valuators first */ - last_valuator = -1; - for (i = 0; i < MAX_VALUATORS; i++) - { - if (BitIsOn(&event->valuators.mask, i)) - { - if (!v) - { - ErrorF("[Xi] Valuators reported for non-valuator device '%s'. " - "Ignoring event.\n", device->name); - return DONT_PROCESS; - } else if (v->numAxes < i) - { - ErrorF("[Xi] Too many valuators reported for device '%s'. " - "Ignoring event.\n", device->name); - return DONT_PROCESS; - } - last_valuator = i; - } - } - - for (i = 0; i <= last_valuator && i < v->numAxes; i++) - { - if (BitIsOn(&event->valuators.mask, i)) - { - /* XXX: Relative/Absolute mode */ - v->axisVal[i] = event->valuators.data[i]; - v->axisVal[i] += (event->valuators.data_frac[i] * 1.0f / (1 << 16) / (1 << 16)); - } - } - - if (event->type == ET_KeyPress) { - if (!k) - return DONT_PROCESS; - - /* don't allow ddx to generate multiple downs, but repeats are okay */ - if (key_is_down(device, key, KEY_PROCESSED) && !event->key_repeat) - return DONT_PROCESS; - - if (device->valuator) - device->valuator->motionHintWindow = NullWindow; - set_key_down(device, key, KEY_PROCESSED); - } else if (event->type == ET_KeyRelease) { - if (!k) - return DONT_PROCESS; - - if (!key_is_down(device, key, KEY_PROCESSED)) /* guard against duplicates */ - return DONT_PROCESS; - if (device->valuator) - device->valuator->motionHintWindow = NullWindow; - set_key_up(device, key, KEY_PROCESSED); - } else if (event->type == ET_ButtonPress) { - Mask mask; - if (!b) - return DONT_PROCESS; - - if (button_is_down(device, key, BUTTON_PROCESSED)) - return DONT_PROCESS; - - set_button_down(device, key, BUTTON_PROCESSED); - if (device->valuator) - device->valuator->motionHintWindow = NullWindow; - if (!b->map[key]) - return DONT_PROCESS; - b->buttonsDown++; - b->motionMask = DeviceButtonMotionMask; - if (b->map[key] <= 5) - b->state |= (Button1Mask >> 1) << b->map[key]; - - /* Add state and motionMask to the filter for this event */ - mask = DevicePointerMotionMask | b->state | b->motionMask; - SetMaskForEvent(device->id, mask, DeviceMotionNotify); - mask = PointerMotionMask | b->state | b->motionMask; - SetMaskForEvent(device->id, mask, MotionNotify); - } else if (event->type == ET_ButtonRelease) { - Mask mask; - if (!b) - return DONT_PROCESS; - - if (!button_is_down(device, key, BUTTON_PROCESSED)) - return DONT_PROCESS; - if (IsMaster(device)) { - DeviceIntPtr sd; - - /* - * Leave the button down if any slave has the - * button still down. Note that this depends on the - * event being delivered through the slave first - */ - for (sd = inputInfo.devices; sd; sd = sd->next) { - if (IsMaster(sd) || sd->u.master != device) - continue; - if (!sd->button) - continue; - for (i = 1; i <= sd->button->numButtons; i++) - if (sd->button->map[i] == key && - button_is_down(sd, i, BUTTON_PROCESSED)) - return DONT_PROCESS; - } - } - set_button_up(device, key, BUTTON_PROCESSED); - if (device->valuator) - device->valuator->motionHintWindow = NullWindow; - if (!b->map[key]) - return DONT_PROCESS; - if (b->buttonsDown >= 1 && !--b->buttonsDown) - b->motionMask = 0; - if (b->map[key] <= 5) - b->state &= ~((Button1Mask >> 1) << b->map[key]); - - /* Add state and motionMask to the filter for this event */ - mask = DevicePointerMotionMask | b->state | b->motionMask; - SetMaskForEvent(device->id, mask, DeviceMotionNotify); - mask = PointerMotionMask | b->state | b->motionMask; - SetMaskForEvent(device->id, mask, MotionNotify); - } else if (event->type == ET_ProximityIn) - device->proximity->in_proximity = TRUE; - else if (event->type == ET_ProximityOut) - device->proximity->in_proximity = FALSE; - - return DEFAULT; -} - -static void -ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device) -{ - GrabPtr grab = device->deviceGrab.grab; - - if (grab) - DeliverGrabbedEvent((InternalEvent*)ev, device, FALSE); - else { /* deliver to all root windows */ - xEvent *xi; - int i; - - i = EventToXI2((InternalEvent*)ev, (xEvent**)&xi); - if (i != Success) - { - ErrorF("[Xi] %s: XI2 conversion failed in ProcessRawEvent (%d)\n", - device->name, i); - return; - } - - for (i = 0; i < screenInfo.numScreens; i++) - DeliverEventsToWindow(device, screenInfo.screens[i]->root, xi, 1, - GetEventFilter(device, xi), NULL); - free(xi); - } -} - -/** - * Main device event processing function. - * Called from when processing the events from the event queue. - * - */ -void -ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) -{ - GrabPtr grab; - Bool deactivateDeviceGrab = FALSE; - int key = 0, rootX, rootY; - ButtonClassPtr b; - KeyClassPtr k; - ValuatorClassPtr v; - int ret = 0; - int state, i; - DeviceIntPtr mouse = NULL, kbd = NULL; - DeviceEvent *event = &ev->device_event; - - CHECKEVENT(ev); - - if (ev->any.type == ET_RawKeyPress || - ev->any.type == ET_RawKeyRelease || - ev->any.type == ET_RawButtonPress || - ev->any.type == ET_RawButtonRelease || - ev->any.type == ET_RawMotion) - { - ProcessRawEvent(&ev->raw_event, device); - return; - } - - if (IsPointerDevice(device)) - { - kbd = GetPairedDevice(device); - mouse = device; - if (!kbd->key) /* can happen with floating SDs */ - kbd = NULL; - } else - { - mouse = GetPairedDevice(device); - kbd = device; - if (!mouse->valuator || !mouse->button) /* may be float. SDs */ - mouse = NULL; - } - - /* State needs to be assembled BEFORE the device is updated. */ - state = (kbd && kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0; - state |= (mouse && mouse->button) ? (mouse->button->state) : 0; - - for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) - if (BitIsOn(mouse->button->down, i)) - SetBit(event->buttons, i); - - if (kbd && kbd->key) - { - XkbStatePtr state; - /* we need the state before the event happens */ - if (event->type == ET_KeyPress || event->type == ET_KeyRelease) - state = &kbd->key->xkbInfo->prev_state; - else - state = &kbd->key->xkbInfo->state; - - event->mods.base = state->base_mods; - event->mods.latched = state->latched_mods; - event->mods.locked = state->locked_mods; - event->mods.effective = state->mods; - - event->group.base = state->base_group; - event->group.latched = state->latched_group; - event->group.locked = state->locked_group; - event->group.effective = state->group; - } - - ret = UpdateDeviceState(device, event); - if (ret == DONT_PROCESS) - return; - - v = device->valuator; - b = device->button; - k = device->key; - - if (IsMaster(device) || !device->u.master) - CheckMotion(event, device); - - switch (event->type) - { - case ET_Motion: - case ET_ButtonPress: - case ET_ButtonRelease: - case ET_KeyPress: - case ET_KeyRelease: - case ET_ProximityIn: - case ET_ProximityOut: - GetSpritePosition(device, &rootX, &rootY); - event->root_x = rootX; - event->root_y = rootY; - NoticeEventTime((InternalEvent*)event); - event->corestate = state; - key = event->detail.key; - break; - default: - break; - } - - if (DeviceEventCallback && !syncEvents.playingEvents) { - DeviceEventInfoRec eventinfo; - SpritePtr pSprite = device->spriteInfo->sprite; - - /* see comment in EnqueueEvents regarding the next three lines */ - if (ev->any.type == ET_Motion) - ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id; - - eventinfo.device = device; - eventinfo.event = ev; - CallCallbacks(&DeviceEventCallback, (pointer) & eventinfo); - } - - grab = device->deviceGrab.grab; - - switch(event->type) - { - case ET_KeyPress: - if (!grab && CheckDeviceGrabs(device, event, 0)) { - device->deviceGrab.activatingKey = key; - return; - } - break; - case ET_KeyRelease: - if (grab && device->deviceGrab.fromPassiveGrab && - (key == device->deviceGrab.activatingKey) && - (device->deviceGrab.grab->type == KeyPress || - device->deviceGrab.grab->type == DeviceKeyPress || - device->deviceGrab.grab->type == XI_KeyPress)) - deactivateDeviceGrab = TRUE; - break; - case ET_ButtonPress: - event->detail.button = b->map[key]; - if (!event->detail.button) { /* there's no button 0 */ - event->detail.button = key; - return; - } - if (!grab && CheckDeviceGrabs(device, event, 0)) - { - /* if a passive grab was activated, the event has been sent - * already */ - return; - } - break; - case ET_ButtonRelease: - event->detail.button = b->map[key]; - if (!event->detail.button) { /* there's no button 0 */ - event->detail.button = key; - return; - } - if (grab && !b->buttonsDown && - device->deviceGrab.fromPassiveGrab && - (device->deviceGrab.grab->type == ButtonPress || - device->deviceGrab.grab->type == DeviceButtonPress || - device->deviceGrab.grab->type == XI_ButtonPress)) - deactivateDeviceGrab = TRUE; - default: - break; - } - - - if (grab) - DeliverGrabbedEvent((InternalEvent*)event, device, deactivateDeviceGrab); - else if (device->focus && !IsPointerEvent((InternalEvent*)ev)) - DeliverFocusedEvent(device, (InternalEvent*)event, - GetSpriteWindow(device)); - else - DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent*)event, - NullGrab, NullWindow, device); - - if (deactivateDeviceGrab == TRUE) - (*device->deviceGrab.DeactivateGrab) (device); - event->detail.key = key; -} - -int -InitProximityClassDeviceStruct(DeviceIntPtr dev) -{ - ProximityClassPtr proxc; - - proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec)); - if (!proxc) - return FALSE; - proxc->sourceid = dev->id; - proxc->in_proximity = TRUE; - dev->proximity = proxc; - return TRUE; -} - -/** - * Initialise the device's valuators. The memory must already be allocated, - * this function merely inits the matching axis (specified through axnum) to - * sane values. - * - * It is a condition that (minval < maxval). - * - * @see InitValuatorClassDeviceStruct - */ -void -InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval, - int resolution, int min_res, int max_res, int mode) -{ - AxisInfoPtr ax; - - if (!dev || !dev->valuator || minval > maxval) - return; - if (axnum >= dev->valuator->numAxes) - return; - - ax = dev->valuator->axes + axnum; - - ax->min_value = minval; - ax->max_value = maxval; - ax->resolution = resolution; - ax->min_resolution = min_res; - ax->max_resolution = max_res; - ax->label = label; - ax->mode = mode; - - if (mode & OutOfProximity) - dev->proximity->in_proximity = FALSE; -} - -static void -FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, - ButtonClassPtr b, ValuatorClassPtr v, int first) -{ - ev->type = DeviceStateNotify; - ev->deviceid = dev->id; - ev->time = currentTime.milliseconds; - ev->classes_reported = 0; - ev->num_keys = 0; - ev->num_buttons = 0; - ev->num_valuators = 0; - - if (b) { - ev->classes_reported |= (1 << ButtonClass); - ev->num_buttons = b->numButtons; - memcpy((char*)ev->buttons, (char*)b->down, 4); - } else if (k) { - ev->classes_reported |= (1 << KeyClass); - ev->num_keys = k->xkbInfo->desc->max_key_code - - k->xkbInfo->desc->min_key_code; - memmove((char *)&ev->keys[0], (char *)k->down, 4); - } - if (v) { - int nval = v->numAxes - first; - - ev->classes_reported |= (1 << ValuatorClass); - ev->classes_reported |= valuator_get_mode(dev, 0) << ModeBitsShift; - ev->num_valuators = nval < 3 ? nval : 3; - switch (ev->num_valuators) { - case 3: - ev->valuator2 = v->axisVal[first + 2]; - case 2: - ev->valuator1 = v->axisVal[first + 1]; - case 1: - ev->valuator0 = v->axisVal[first]; - break; - } - } -} - -static void -FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, - int first) -{ - int nval = v->numAxes - first; - - ev->type = DeviceValuator; - ev->deviceid = dev->id; - ev->num_valuators = nval < 3 ? nval : 3; - ev->first_valuator = first; - switch (ev->num_valuators) { - case 3: - ev->valuator2 = v->axisVal[first + 2]; - case 2: - ev->valuator1 = v->axisVal[first + 1]; - case 1: - ev->valuator0 = v->axisVal[first]; - break; - } - first += ev->num_valuators; -} - -void -DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, - WindowPtr pWin) -{ - deviceFocus event; - xXIFocusInEvent *xi2event; - DeviceIntPtr mouse; - int btlen, len, i; - - mouse = (IsMaster(dev) || dev->u.master) ? GetMaster(dev, MASTER_POINTER) : dev; - - /* XI 2 event */ - btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; - btlen = bytes_to_int32(btlen); - len = sizeof(xXIFocusInEvent) + btlen * 4; - - xi2event = calloc(1, len); - xi2event->type = GenericEvent; - xi2event->extension = IReqCode; - xi2event->evtype = type; - xi2event->length = bytes_to_int32(len - sizeof(xEvent)); - xi2event->buttons_len = btlen; - xi2event->detail = detail; - xi2event->time = currentTime.milliseconds; - xi2event->deviceid = dev->id; - xi2event->sourceid = dev->id; /* a device doesn't change focus by itself */ - xi2event->mode = mode; - xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0); - xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0); - - for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) - if (BitIsOn(mouse->button->down, i)) - SetBit(&xi2event[1], i); - - if (dev->key) - { - xi2event->mods.base_mods = dev->key->xkbInfo->state.base_mods; - xi2event->mods.latched_mods = dev->key->xkbInfo->state.latched_mods; - xi2event->mods.locked_mods = dev->key->xkbInfo->state.locked_mods; - xi2event->mods.effective_mods = dev->key->xkbInfo->state.mods; - - xi2event->group.base_group = dev->key->xkbInfo->state.base_group; - xi2event->group.latched_group = dev->key->xkbInfo->state.latched_group; - xi2event->group.locked_group = dev->key->xkbInfo->state.locked_group; - xi2event->group.effective_group = dev->key->xkbInfo->state.group; - } - - FixUpEventFromWindow(dev, (xEvent*)xi2event, pWin, None, FALSE); - - DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1, - GetEventFilter(dev, (xEvent*)xi2event), NullGrab); - - free(xi2event); - - /* XI 1.x event */ - event.deviceid = dev->id; - event.mode = mode; - event.type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut; - event.detail = detail; - event.window = pWin->drawable.id; - event.time = currentTime.milliseconds; - - DeliverEventsToWindow(dev, pWin, (xEvent *) & event, 1, - DeviceFocusChangeMask, NullGrab); - - if ((type == DeviceFocusIn) && - (wOtherInputMasks(pWin)) && - (wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask)) - { - int evcount = 1; - deviceStateNotify *ev, *sev; - deviceKeyStateNotify *kev; - deviceButtonStateNotify *bev; - - KeyClassPtr k; - ButtonClassPtr b; - ValuatorClassPtr v; - int nval = 0, nkeys = 0, nbuttons = 0, first = 0; - - if ((b = dev->button) != NULL) { - nbuttons = b->numButtons; - if (nbuttons > 32) - evcount++; - } - if ((k = dev->key) != NULL) { - nkeys = k->xkbInfo->desc->max_key_code - - k->xkbInfo->desc->min_key_code; - if (nkeys > 32) - evcount++; - if (nbuttons > 0) { - evcount++; - } - } - if ((v = dev->valuator) != NULL) { - nval = v->numAxes; - - if (nval > 3) - evcount++; - if (nval > 6) { - if (!(k && b)) - evcount++; - if (nval > 9) - evcount += ((nval - 7) / 3); - } - } - - sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent)); - FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first); - - if (b != NULL) { - FixDeviceStateNotify(dev, ev++, NULL, b, v, first); - first += 3; - nval -= 3; - if (nbuttons > 32) { - (ev - 1)->deviceid |= MORE_EVENTS; - bev = (deviceButtonStateNotify *) ev++; - bev->type = DeviceButtonStateNotify; - bev->deviceid = dev->id; - memcpy((char*)&bev->buttons[4], (char*)&b->down[4], DOWN_LENGTH - 4); - } - if (nval > 0) { - (ev - 1)->deviceid |= MORE_EVENTS; - FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); - first += 3; - nval -= 3; - } - } - - if (k != NULL) { - FixDeviceStateNotify(dev, ev++, k, NULL, v, first); - first += 3; - nval -= 3; - if (nkeys > 32) { - (ev - 1)->deviceid |= MORE_EVENTS; - kev = (deviceKeyStateNotify *) ev++; - kev->type = DeviceKeyStateNotify; - kev->deviceid = dev->id; - memmove((char *)&kev->keys[0], (char *)&k->down[4], 28); - } - if (nval > 0) { - (ev - 1)->deviceid |= MORE_EVENTS; - FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); - first += 3; - nval -= 3; - } - } - - while (nval > 0) { - FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first); - first += 3; - nval -= 3; - if (nval > 0) { - (ev - 1)->deviceid |= MORE_EVENTS; - FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); - first += 3; - nval -= 3; - } - } - - DeliverEventsToWindow(dev, pWin, (xEvent *) sev, evcount, - DeviceStateNotifyMask, NullGrab); - free(sev); - } -} - -int -CheckGrabValues(ClientPtr client, GrabParameters* param) -{ - if (param->grabtype != GRABTYPE_CORE && - param->grabtype != GRABTYPE_XI && - param->grabtype != GRABTYPE_XI2) - { - ErrorF("[Xi] grabtype is invalid. This is a bug.\n"); - return BadImplementation; - } - - if ((param->this_device_mode != GrabModeSync) && - (param->this_device_mode != GrabModeAsync)) { - client->errorValue = param->this_device_mode; - return BadValue; - } - if ((param->other_devices_mode != GrabModeSync) && - (param->other_devices_mode != GrabModeAsync)) { - client->errorValue = param->other_devices_mode; - return BadValue; - } - - if (param->grabtype != GRABTYPE_XI2 && (param->modifiers != AnyModifier) && - (param->modifiers & ~AllModifiersMask)) { - client->errorValue = param->modifiers; - return BadValue; - } - - if ((param->ownerEvents != xFalse) && (param->ownerEvents != xTrue)) { - client->errorValue = param->ownerEvents; - return BadValue; - } - return Success; -} - -int -GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, - int button, GrabParameters *param, GrabType grabtype, - GrabMask *mask) -{ - WindowPtr pWin, confineTo; - CursorPtr cursor; - GrabPtr grab; - int rc, type = -1; - Mask access_mode = DixGrabAccess; - - rc = CheckGrabValues(client, param); - if (rc != Success) - return rc; - if (param->confineTo == None) - confineTo = NullWindow; - else { - rc = dixLookupWindow(&confineTo, param->confineTo, client, DixSetAttrAccess); - if (rc != Success) - return rc; - } - if (param->cursor == None) - cursor = NullCursor; - else { - rc = dixLookupResourceByType((pointer *)&cursor, param->cursor, - RT_CURSOR, client, DixUseAccess); - if (rc != Success) - { - client->errorValue = param->cursor; - return rc; - } - access_mode |= DixForceAccess; - } - if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync) - access_mode |= DixFreezeAccess; - rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); - if (rc != Success) - return rc; - rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess); - if (rc != Success) - return rc; - - if (grabtype == GRABTYPE_XI) - type = DeviceButtonPress; - else if (grabtype == GRABTYPE_XI2) - type = XI_ButtonPress; - - grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype, - mask, param, type, button, confineTo, cursor); - if (!grab) - return BadAlloc; - return AddPassiveGrabToList(client, grab); -} - -/** - * Grab the given key. If grabtype is GRABTYPE_XI, the key is a keycode. If - * grabtype is GRABTYPE_XI2, the key is a keysym. - */ -int -GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, - int key, GrabParameters *param, GrabType grabtype, GrabMask *mask) -{ - WindowPtr pWin; - GrabPtr grab; - KeyClassPtr k = dev->key; - Mask access_mode = DixGrabAccess; - int rc, type = -1; - - rc = CheckGrabValues(client, param); - if (rc != Success) - return rc; - if (k == NULL) - return BadMatch; - if (grabtype == GRABTYPE_XI) - { - if ((key > k->xkbInfo->desc->max_key_code || - key < k->xkbInfo->desc->min_key_code) - && (key != AnyKey)) { - client->errorValue = key; - return BadValue; - } - type = DeviceKeyPress; - } else if (grabtype == GRABTYPE_XI2) - type = XI_KeyPress; - - rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess); - if (rc != Success) - return rc; - if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync) - access_mode |= DixFreezeAccess; - rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); - if (rc != Success) - return rc; - - grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype, - mask, param, type, key, NULL, NULL); - if (!grab) - return BadAlloc; - return AddPassiveGrabToList(client, grab); -} - -/* Enter/FocusIn grab */ -int -GrabWindow(ClientPtr client, DeviceIntPtr dev, int type, - GrabParameters *param, GrabMask *mask) -{ - WindowPtr pWin; - CursorPtr cursor; - GrabPtr grab; - Mask access_mode = DixGrabAccess; - int rc; - - rc = CheckGrabValues(client, param); - if (rc != Success) - return rc; - - rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess); - if (rc != Success) - return rc; - if (param->cursor == None) - cursor = NullCursor; - else { - rc = dixLookupResourceByType((pointer *)&cursor, param->cursor, - RT_CURSOR, client, DixUseAccess); - if (rc != Success) - { - client->errorValue = param->cursor; - return rc; - } - access_mode |= DixForceAccess; - } - if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync) - access_mode |= DixFreezeAccess; - rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); - if (rc != Success) - return rc; - - grab = CreateGrab(client->index, dev, dev, pWin, GRABTYPE_XI2, - mask, param, (type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn, - 0, NULL, cursor); - - if (!grab) - return BadAlloc; - - return AddPassiveGrabToList(client, grab); -} - -int -SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client, - Mask mask, Mask exclusivemasks) -{ - int mskidx = dev->id; - int i, ret; - Mask check; - InputClientsPtr others; - - check = (mask & exclusivemasks); - if (wOtherInputMasks(pWin)) { - if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) { /* It is illegal for two different - * clients to select on any of the - * events for maskcheck. However, - * it is OK, for some client to - * continue selecting on one of those - * events. */ - for (others = wOtherInputMasks(pWin)->inputClients; others; - others = others->next) { - if (!SameClient(others, client) && (check & - others->mask[mskidx])) - return BadAccess; - } - } - for (others = wOtherInputMasks(pWin)->inputClients; others; - others = others->next) { - if (SameClient(others, client)) { - check = others->mask[mskidx]; - others->mask[mskidx] = mask; - if (mask == 0) { - for (i = 0; i < EMASKSIZE; i++) - if (i != mskidx && others->mask[i] != 0) - break; - if (i == EMASKSIZE) { - RecalculateDeviceDeliverableEvents(pWin); - if (ShouldFreeInputMasks(pWin, FALSE)) - FreeResource(others->resource, RT_NONE); - return Success; - } - } - goto maskSet; - } - } - } - check = 0; - if ((ret = AddExtensionClient(pWin, client, mask, mskidx)) != Success) - return ret; - maskSet: - if (dev->valuator) - if ((dev->valuator->motionHintWindow == pWin) && - (mask & DevicePointerMotionHintMask) && - !(check & DevicePointerMotionHintMask) && !dev->deviceGrab.grab) - dev->valuator->motionHintWindow = NullWindow; - RecalculateDeviceDeliverableEvents(pWin); - return Success; -} - -int -AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx) -{ - InputClientsPtr others; - - if (!pWin->optional && !MakeWindowOptional(pWin)) - return BadAlloc; - others = calloc(1, sizeof(InputClients)); - if (!others) - return BadAlloc; - if (!pWin->optional->inputMasks && !MakeInputMasks(pWin)) - return BadAlloc; - others->mask[mskidx] = mask; - others->resource = FakeClientID(client->index); - others->next = pWin->optional->inputMasks->inputClients; - pWin->optional->inputMasks->inputClients = others; - if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer) pWin)) - return BadAlloc; - return Success; -} - -static Bool -MakeInputMasks(WindowPtr pWin) -{ - struct _OtherInputMasks *imasks; - - imasks = calloc(1, sizeof(struct _OtherInputMasks)); - if (!imasks) - return FALSE; - pWin->optional->inputMasks = imasks; - return TRUE; -} - -void -RecalculateDeviceDeliverableEvents(WindowPtr pWin) -{ - InputClientsPtr others; - struct _OtherInputMasks *inputMasks; /* default: NULL */ - WindowPtr pChild, tmp; - int i, j; - - pChild = pWin; - while (1) { - if ((inputMasks = wOtherInputMasks(pChild)) != 0) { - for (i = 0; i < EMASKSIZE; i++) - memset(inputMasks->xi2mask[i], 0, sizeof(inputMasks->xi2mask[i])); - for (others = inputMasks->inputClients; others; - others = others->next) { - for (i = 0; i < EMASKSIZE; i++) - inputMasks->inputEvents[i] |= others->mask[i]; - for (i = 0; i < EMASKSIZE; i++) - for (j = 0; j < XI2MASKSIZE; j++) - inputMasks->xi2mask[i][j] |= others->xi2mask[i][j]; - } - for (i = 0; i < EMASKSIZE; i++) - inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i]; - for (tmp = pChild->parent; tmp; tmp = tmp->parent) - if (wOtherInputMasks(tmp)) - for (i = 0; i < EMASKSIZE; i++) - inputMasks->deliverableEvents[i] |= - (wOtherInputMasks(tmp)->deliverableEvents[i] - & ~inputMasks-> - dontPropagateMask[i] & PropagateMask[i]); - } - if (pChild->firstChild) { - pChild = pChild->firstChild; - continue; - } - while (!pChild->nextSib && (pChild != pWin)) - pChild = pChild->parent; - if (pChild == pWin) - break; - pChild = pChild->nextSib; - } -} - -int -InputClientGone(WindowPtr pWin, XID id) -{ - InputClientsPtr other, prev; - - if (!wOtherInputMasks(pWin)) - return Success; - prev = 0; - for (other = wOtherInputMasks(pWin)->inputClients; other; - other = other->next) { - if (other->resource == id) { - if (prev) { - prev->next = other->next; - free(other); - } else if (!(other->next)) { - if (ShouldFreeInputMasks(pWin, TRUE)) { - wOtherInputMasks(pWin)->inputClients = other->next; - free(wOtherInputMasks(pWin)); - pWin->optional->inputMasks = (OtherInputMasks *) NULL; - CheckWindowOptionalNeed(pWin); - free(other); - } else { - other->resource = FakeClientID(0); - if (!AddResource(other->resource, RT_INPUTCLIENT, - (pointer) pWin)) - return BadAlloc; - } - } else { - wOtherInputMasks(pWin)->inputClients = other->next; - free(other); - } - RecalculateDeviceDeliverableEvents(pWin); - return Success; - } - prev = other; - } - FatalError("client not on device event list"); -} - -int -SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, - xEvent * ev, Mask mask, int count) -{ - WindowPtr pWin; - WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ - WindowPtr spriteWin = GetSpriteWindow(d); - - if (dest == PointerWindow) - pWin = spriteWin; - else if (dest == InputFocus) { - WindowPtr inputFocus; - - if (!d->focus) - inputFocus = spriteWin; - else - inputFocus = d->focus->win; - - if (inputFocus == FollowKeyboardWin) - inputFocus = inputInfo.keyboard->focus->win; - - if (inputFocus == NoneWin) - return Success; - - /* If the input focus is PointerRootWin, send the event to where - * the pointer is if possible, then perhaps propogate up to root. */ - if (inputFocus == PointerRootWin) - inputFocus = GetCurrentRootWindow(d); - - if (IsParent(inputFocus, spriteWin)) { - effectiveFocus = inputFocus; - pWin = spriteWin; - } else - effectiveFocus = pWin = inputFocus; - } else - dixLookupWindow(&pWin, dest, client, DixSendAccess); - if (!pWin) - return BadWindow; - if ((propagate != xFalse) && (propagate != xTrue)) { - client->errorValue = propagate; - return BadValue; - } - ev->u.u.type |= 0x80; - if (propagate) { - for (; pWin; pWin = pWin->parent) { - if (DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab)) - return Success; - if (pWin == effectiveFocus) - return Success; - if (wOtherInputMasks(pWin)) - mask &= ~wOtherInputMasks(pWin)->dontPropagateMask[d->id]; - if (!mask) - break; - } - } else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count)) - DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab); - return Success; -} - -int -SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map) -{ - int i; - ButtonClassPtr b = dev->button; - - if (b == NULL) - return BadMatch; - - if (nElts != b->numButtons) { - client->errorValue = nElts; - return BadValue; - } - if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue)) - return BadValue; - for (i = 0; i < nElts; i++) - if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1)) - return MappingBusy; - for (i = 0; i < nElts; i++) - b->map[i + 1] = map[i]; - return Success; -} - -int -ChangeKeyMapping(ClientPtr client, - DeviceIntPtr dev, - unsigned len, - int type, - KeyCode firstKeyCode, - CARD8 keyCodes, CARD8 keySymsPerKeyCode, KeySym * map) -{ - KeySymsRec keysyms; - KeyClassPtr k = dev->key; - - if (k == NULL) - return BadMatch; - - if (len != (keyCodes * keySymsPerKeyCode)) - return BadLength; - - if ((firstKeyCode < k->xkbInfo->desc->min_key_code) || - (firstKeyCode + keyCodes - 1 > k->xkbInfo->desc->max_key_code)) { - client->errorValue = firstKeyCode; - return BadValue; - } - if (keySymsPerKeyCode == 0) { - client->errorValue = 0; - return BadValue; - } - keysyms.minKeyCode = firstKeyCode; - keysyms.maxKeyCode = firstKeyCode + keyCodes - 1; - keysyms.mapWidth = keySymsPerKeyCode; - keysyms.map = map; - - XkbApplyMappingChange(dev, &keysyms, firstKeyCode, keyCodes, NULL, - serverClient); - - return Success; -} - -static void -DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) -{ - WindowPtr parent; - - /* Deactivate any grabs performed on this window, before making - * any input focus changes. - * Deactivating a device grab should cause focus events. */ - - if (dev->deviceGrab.grab && (dev->deviceGrab.grab->window == pWin)) - (*dev->deviceGrab.DeactivateGrab) (dev); - - /* If the focus window is a root window (ie. has no parent) - * then don't delete the focus from it. */ - - if (dev->focus && (pWin == dev->focus->win) && (pWin->parent != NullWindow)) { - int focusEventMode = NotifyNormal; - - /* If a grab is in progress, then alter the mode of focus events. */ - - if (dev->deviceGrab.grab) - focusEventMode = NotifyWhileGrabbed; - - switch (dev->focus->revert) { - case RevertToNone: - if (!ActivateFocusInGrab(dev, pWin, NoneWin)) - DoFocusEvents(dev, pWin, NoneWin, focusEventMode); - dev->focus->win = NoneWin; - dev->focus->traceGood = 0; - break; - case RevertToParent: - parent = pWin; - do { - parent = parent->parent; - dev->focus->traceGood--; - } - while (!parent->realized); - if (!ActivateFocusInGrab(dev, pWin, parent)) - DoFocusEvents(dev, pWin, parent, focusEventMode); - dev->focus->win = parent; - dev->focus->revert = RevertToNone; - break; - case RevertToPointerRoot: - if (!ActivateFocusInGrab(dev, pWin, PointerRootWin)) - DoFocusEvents(dev, pWin, PointerRootWin, focusEventMode); - dev->focus->win = PointerRootWin; - dev->focus->traceGood = 0; - break; - case RevertToFollowKeyboard: - { - DeviceIntPtr kbd = GetMaster(dev, MASTER_KEYBOARD); - if (!kbd || (kbd == dev && kbd != inputInfo.keyboard)) - kbd = inputInfo.keyboard; - if (kbd->focus->win) { - if (!ActivateFocusInGrab(dev, pWin, kbd->focus->win)) - DoFocusEvents(dev, pWin, kbd->focus->win, focusEventMode); - dev->focus->win = FollowKeyboardWin; - dev->focus->traceGood = 0; - } else { - if (!ActivateFocusInGrab(dev, pWin, NoneWin)) - DoFocusEvents(dev, pWin, NoneWin, focusEventMode); - dev->focus->win = NoneWin; - dev->focus->traceGood = 0; - } - } - break; - } - } - - if (dev->valuator) - if (dev->valuator->motionHintWindow == pWin) - dev->valuator->motionHintWindow = NullWindow; -} - -void -DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) -{ - int i; - DeviceIntPtr dev; - InputClientsPtr ic; - struct _OtherInputMasks *inputMasks; - - for (dev = inputInfo.devices; dev; dev = dev->next) { - DeleteDeviceFromAnyExtEvents(pWin, dev); - } - - for (dev = inputInfo.off_devices; dev; dev = dev->next) - DeleteDeviceFromAnyExtEvents(pWin, dev); - - if (freeResources) - while ((inputMasks = wOtherInputMasks(pWin)) != 0) { - ic = inputMasks->inputClients; - for (i = 0; i < EMASKSIZE; i++) - inputMasks->dontPropagateMask[i] = 0; - FreeResource(ic->resource, RT_NONE); - } -} - -int -MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) -{ - DeviceIntPtr dev; - - dixLookupDevice(&dev, pEvents->deviceid & DEVICE_BITS, serverClient, - DixReadAccess); - if (!dev) - return 0; - - if (pEvents->type == DeviceMotionNotify) { - if (mask & DevicePointerMotionHintMask) { - if (WID(dev->valuator->motionHintWindow) == pEvents->event) { - return 1; /* don't send, but pretend we did */ - } - pEvents->detail = NotifyHint; - } else { - pEvents->detail = NotifyNormal; - } - } - return 0; -} - -void -CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, - deviceKeyButtonPointer * xE, GrabPtr grab, - ClientPtr client, Mask deliveryMask) -{ - DeviceIntPtr dev; - - dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient, - DixGrabAccess); - if (!dev) - return; - - if (type == DeviceMotionNotify) - dev->valuator->motionHintWindow = pWin; - else if ((type == DeviceButtonPress) && (!grab) && - (deliveryMask & DeviceButtonGrabMask)) { - GrabRec tempGrab; - - tempGrab.device = dev; - tempGrab.resource = client->clientAsMask; - tempGrab.window = pWin; - tempGrab.ownerEvents = - (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE; - tempGrab.eventMask = deliveryMask; - tempGrab.keyboardMode = GrabModeAsync; - tempGrab.pointerMode = GrabModeAsync; - tempGrab.confineTo = NullWindow; - tempGrab.cursor = NullCursor; - tempGrab.next = NULL; - (*dev->deviceGrab.ActivateGrab) (dev, &tempGrab, currentTime, TRUE); - } -} - -static Mask -DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) -{ - InputClientsPtr other; - - if (!wOtherInputMasks(pWin)) - return 0; - for (other = wOtherInputMasks(pWin)->inputClients; other; - other = other->next) { - if (SameClient(other, client)) - return other->mask[dev->id]; - } - return 0; -} - -void -MaybeStopDeviceHint(DeviceIntPtr dev, ClientPtr client) -{ - WindowPtr pWin; - GrabPtr grab = dev->deviceGrab.grab; - - pWin = dev->valuator->motionHintWindow; - - if ((grab && SameClient(grab, client) && - ((grab->eventMask & DevicePointerMotionHintMask) || - (grab->ownerEvents && - (DeviceEventMaskForClient(dev, pWin, client) & - DevicePointerMotionHintMask)))) || - (!grab && - (DeviceEventMaskForClient(dev, pWin, client) & - DevicePointerMotionHintMask))) - dev->valuator->motionHintWindow = NullWindow; -} - -int -DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, - int maskndx) -{ - struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin); - - if (mask & ~PropagateMask[maskndx]) { - client->errorValue = mask; - return BadValue; - } - - if (mask == 0) { - if (inputMasks) - inputMasks->dontPropagateMask[maskndx] = mask; - } else { - if (!inputMasks) - AddExtensionClient(pWin, client, 0, 0); - inputMasks = wOtherInputMasks(pWin); - inputMasks->dontPropagateMask[maskndx] = mask; - } - RecalculateDeviceDeliverableEvents(pWin); - if (ShouldFreeInputMasks(pWin, FALSE)) - FreeResource(inputMasks->inputClients->resource, RT_NONE); - return Success; -} - -Bool -ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents) -{ - int i; - Mask allInputEventMasks = 0; - struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin); - - for (i = 0; i < EMASKSIZE; i++) - allInputEventMasks |= inputMasks->dontPropagateMask[i]; - if (!ignoreSelectedEvents) - for (i = 0; i < EMASKSIZE; i++) - allInputEventMasks |= inputMasks->inputEvents[i]; - if (allInputEventMasks == 0) - return TRUE; - else - return FALSE; -} - -/*********************************************************************** - * - * Walk through the window tree, finding all clients that want to know - * about the Event. - * - */ - -static void -FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, - xEvent * ev, int count) -{ - WindowPtr p2; - - while (p1) { - p2 = p1->firstChild; - DeliverEventsToWindow(dev, p1, ev, count, mask, NullGrab); - FindInterestedChildren(dev, p2, mask, ev, count); - p1 = p1->nextSib; - } -} - -/*********************************************************************** - * - * Send an event to interested clients in all windows on all screens. - * - */ - -void -SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) -{ - int i; - WindowPtr pWin, p1; - - for (i = 0; i < screenInfo.numScreens; i++) { - pWin = screenInfo.screens[i]->root; - if (!pWin) - continue; - DeliverEventsToWindow(dev, pWin, ev, count, mask, NullGrab); - p1 = pWin->firstChild; - FindInterestedChildren(dev, p1, mask, ev, count); - } -} - -/** - * Set the XI2 mask for the given client on the given window. - * @param dev The device to set the mask for. - * @param win The window to set the mask on. - * @param client The client setting the mask. - * @param len Number of bytes in mask. - * @param mask Event mask in the form of (1 << eventtype) - */ -int -XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, - unsigned int len, unsigned char* mask) -{ - OtherInputMasks *masks; - InputClientsPtr others = NULL; - - masks = wOtherInputMasks(win); - if (masks) - { - for (others = wOtherInputMasks(win)->inputClients; others; - others = others->next) { - if (SameClient(others, client)) { - memset(others->xi2mask[dev->id], 0, - sizeof(others->xi2mask[dev->id])); - break; - } - } - } - - len = min(len, sizeof(others->xi2mask[dev->id])); - - if (len && !others) - { - if (AddExtensionClient(win, client, 0, 0) != Success) - return BadAlloc; - others= wOtherInputMasks(win)->inputClients; - } - - if (others) - memset(others->xi2mask[dev->id], 0, sizeof(others->xi2mask[dev->id])); - - if (len) - memcpy(others->xi2mask[dev->id], mask, len); - - RecalculateDeviceDeliverableEvents(win); - - return Success; -} +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/******************************************************************** + * + * Routines to register and initialize extension input devices. + * This also contains ProcessOtherEvent, the routine called from DDX + * to route extension events. + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "inputstr.h" +#include +#include +#include +#include +#include +#include +#include "windowstr.h" +#include "miscstruct.h" +#include "region.h" +#include "exevents.h" +#include "extnsionst.h" +#include "exglobals.h" +#include "dixevents.h" /* DeliverFocusedEvent */ +#include "dixgrabs.h" /* CreateGrab() */ +#include "scrnintstr.h" +#include "listdev.h" /* for CopySwapXXXClass */ +#include "xace.h" +#include "xiquerydevice.h" /* For List*Info */ +#include "eventconvert.h" +#include "eventstr.h" + +#include +#include "xkbsrv.h" + +#define WID(w) ((w) ? ((w)->drawable.id) : 0) +#define AllModifiersMask ( \ + ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ + Mod3Mask | Mod4Mask | Mod5Mask ) +#define AllButtonsMask ( \ + Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) + +Bool ShouldFreeInputMasks(WindowPtr /* pWin */ , + Bool /* ignoreSelectedEvents */ + ); +static Bool MakeInputMasks(WindowPtr /* pWin */ + ); + +/* + * Only let the given client know of core events which will affect its + * interpretation of input events, if the client's ClientPointer (or the + * paired keyboard) is the current device. + */ +int +XIShouldNotify(ClientPtr client, DeviceIntPtr dev) +{ + DeviceIntPtr current_ptr = PickPointer(client); + DeviceIntPtr current_kbd = GetPairedDevice(current_ptr); + + if (dev == current_kbd || dev == current_ptr) + return 1; + + return 0; +} + +Bool +IsPointerEvent(InternalEvent* event) +{ + switch(event->any.type) + { + case ET_ButtonPress: + case ET_ButtonRelease: + case ET_Motion: + /* XXX: enter/leave ?? */ + return TRUE; + default: + break; + } + return FALSE; +} + +/** + * @return the device matching the deviceid of the device set in the event, or + * NULL if the event is not an XInput event. + */ +DeviceIntPtr +XIGetDevice(xEvent* xE) +{ + DeviceIntPtr pDev = NULL; + + if (xE->u.u.type == DeviceButtonPress || + xE->u.u.type == DeviceButtonRelease || + xE->u.u.type == DeviceMotionNotify || + xE->u.u.type == ProximityIn || + xE->u.u.type == ProximityOut || + xE->u.u.type == DevicePropertyNotify) + { + int rc; + int id; + + id = ((deviceKeyButtonPointer*)xE)->deviceid & ~MORE_EVENTS; + + rc = dixLookupDevice(&pDev, id, serverClient, DixUnknownAccess); + if (rc != Success) + ErrorF("[dix] XIGetDevice failed on XACE restrictions (%d)\n", rc); + } + return pDev; +} + + +/** + * Copy the device->key into master->key and send a mapping notify to the + * clients if appropriate. + * master->key needs to be allocated by the caller. + * + * Device is the slave device. If it is attached to a master device, we may + * need to send a mapping notify to the client because it causes the MD + * to change state. + * + * Mapping notify needs to be sent in the following cases: + * - different slave device on same master + * - different master + * + * XXX: They way how the code is we also send a map notify if the slave device + * stays the same, but the master changes. This isn't really necessary though. + * + * XXX: this gives you funny behaviour with the ClientPointer. When a + * MappingNotify is sent to the client, the client usually responds with a + * GetKeyboardMapping. This will retrieve the ClientPointer's keyboard + * mapping, regardless of which keyboard sent the last mapping notify request. + * So depending on the CP setting, your keyboard may change layout in each + * app... + * + * This code is basically the old SwitchCoreKeyboard. + */ + +void +CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master) +{ + KeyClassPtr mk = master->key; + + if (device == master) + return; + + mk->sourceid = device->id; + + + if (!XkbCopyDeviceKeymap(master, device)) + FatalError("Couldn't pivot keymap from device to core!\n"); +} + +/** + * Copies the feedback classes from device "from" into device "to". Classes + * are duplicated (not just flipping the pointers). All feedback classes are + * linked lists, the full list is duplicated. + */ +static void +DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) +{ + ClassesPtr classes; + + + if (from->intfeed) + { + IntegerFeedbackPtr *i, it; + + if (!to->intfeed) + { + classes = to->unused_classes; + to->intfeed = classes->intfeed; + classes->intfeed = NULL; + } + + i = &to->intfeed; + for (it = from->intfeed; it; it = it->next) + { + if (!(*i)) + { + *i = calloc(1, sizeof(IntegerFeedbackClassRec)); + if (!(*i)) + { + ErrorF("[Xi] Cannot alloc memory for class copy."); + return; + } + } + (*i)->CtrlProc = it->CtrlProc; + (*i)->ctrl = it->ctrl; + + i = &(*i)->next; + } + } else if (to->intfeed && !from->intfeed) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->intfeed = to->intfeed; + to->intfeed = NULL; + } + + if (from->stringfeed) + { + StringFeedbackPtr *s, it; + + if (!to->stringfeed) + { + classes = to->unused_classes; + to->stringfeed = classes->stringfeed; + classes->stringfeed = NULL; + } + + s = &to->stringfeed; + for (it = from->stringfeed; it; it = it->next) + { + if (!(*s)) + { + *s = calloc(1, sizeof(StringFeedbackClassRec)); + if (!(*s)) + { + ErrorF("[Xi] Cannot alloc memory for class copy."); + return; + } + } + (*s)->CtrlProc = it->CtrlProc; + (*s)->ctrl = it->ctrl; + + s = &(*s)->next; + } + } else if (to->stringfeed && !from->stringfeed) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->stringfeed = to->stringfeed; + to->stringfeed = NULL; + } + + if (from->bell) + { + BellFeedbackPtr *b, it; + + if (!to->bell) + { + classes = to->unused_classes; + to->bell = classes->bell; + classes->bell = NULL; + } + + b = &to->bell; + for (it = from->bell; it; it = it->next) + { + if (!(*b)) + { + *b = calloc(1, sizeof(BellFeedbackClassRec)); + if (!(*b)) + { + ErrorF("[Xi] Cannot alloc memory for class copy."); + return; + } + } + (*b)->BellProc = it->BellProc; + (*b)->CtrlProc = it->CtrlProc; + (*b)->ctrl = it->ctrl; + + b = &(*b)->next; + } + } else if (to->bell && !from->bell) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->bell = to->bell; + to->bell = NULL; + } + + if (from->leds) + { + LedFeedbackPtr *l, it; + + if (!to->leds) + { + classes = to->unused_classes; + to->leds = classes->leds; + classes->leds = NULL; + } + + l = &to->leds; + for (it = from->leds; it; it = it->next) + { + if (!(*l)) + { + *l = calloc(1, sizeof(LedFeedbackClassRec)); + if (!(*l)) + { + ErrorF("[Xi] Cannot alloc memory for class copy."); + return; + } + } + (*l)->CtrlProc = it->CtrlProc; + (*l)->ctrl = it->ctrl; + if ((*l)->xkb_sli) + XkbFreeSrvLedInfo((*l)->xkb_sli); + (*l)->xkb_sli = XkbCopySrvLedInfo(from, it->xkb_sli, NULL, *l); + + l = &(*l)->next; + } + } else if (to->leds && !from->leds) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->leds = to->leds; + to->leds = NULL; + } +} + +static void +DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to) +{ + ClassesPtr classes; + + /* XkbInitDevice (->XkbInitIndicatorMap->XkbFindSrvLedInfo) relies on the + * kbdfeed to be set up properly, so let's do the feedback classes first. + */ + if (from->kbdfeed) + { + KbdFeedbackPtr *k, it; + + if (!to->kbdfeed) + { + classes = to->unused_classes; + + to->kbdfeed = classes->kbdfeed; + if (!to->kbdfeed) + InitKeyboardDeviceStruct(to, NULL, NULL, NULL); + classes->kbdfeed = NULL; + } + + k = &to->kbdfeed; + for(it = from->kbdfeed; it; it = it->next) + { + if (!(*k)) + { + *k = calloc(1, sizeof(KbdFeedbackClassRec)); + if (!*k) + { + ErrorF("[Xi] Cannot alloc memory for class copy."); + return; + } + } + (*k)->BellProc = it->BellProc; + (*k)->CtrlProc = it->CtrlProc; + (*k)->ctrl = it->ctrl; + if ((*k)->xkb_sli) + XkbFreeSrvLedInfo((*k)->xkb_sli); + (*k)->xkb_sli = XkbCopySrvLedInfo(from, it->xkb_sli, *k, NULL); + + k = &(*k)->next; + } + } else if (to->kbdfeed && !from->kbdfeed) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->kbdfeed = to->kbdfeed; + to->kbdfeed = NULL; + } + + if (from->key) + { + if (!to->key) + { + classes = to->unused_classes; + to->key = classes->key; + if (!to->key) + InitKeyboardDeviceStruct(to, NULL, NULL, NULL); + else + classes->key = NULL; + } + + CopyKeyClass(from, to); + } else if (to->key && !from->key) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->key = to->key; + to->key = NULL; + } + + /* If a SrvLedInfoPtr's flags are XkbSLI_IsDefault, the names and maps + * pointer point into the xkbInfo->desc struct. XkbCopySrvLedInfo + * didn't update the pointers so we need to do it manually here. + */ + if (to->kbdfeed) + { + KbdFeedbackPtr k; + + for (k = to->kbdfeed; k; k = k->next) + { + if (!k->xkb_sli) + continue; + if (k->xkb_sli->flags & XkbSLI_IsDefault) + { + k->xkb_sli->names = to->key->xkbInfo->desc->names->indicators; + k->xkb_sli->maps = to->key->xkbInfo->desc->indicators->maps; + } + } + } + + /* We can't just copy over the focus class. When an app sets the focus, + * it'll do so on the master device. Copying the SDs focus means losing + * the focus. + * So we only copy the focus class if the device didn't have one, + * otherwise we leave it as it is. + */ + if (from->focus) + { + if (!to->focus) + { + WindowPtr *oldTrace; + + classes = to->unused_classes; + to->focus = classes->focus; + if (!to->focus) + { + to->focus = calloc(1, sizeof(FocusClassRec)); + if (!to->focus) + FatalError("[Xi] no memory for class shift.\n"); + } else + classes->focus = NULL; + + oldTrace = to->focus->trace; + memcpy(to->focus, from->focus, sizeof(FocusClassRec)); + to->focus->trace = realloc(oldTrace, + to->focus->traceSize * sizeof(WindowPtr)); + if (!to->focus->trace && to->focus->traceSize) + FatalError("[Xi] no memory for trace.\n"); + memcpy(to->focus->trace, from->focus->trace, + from->focus->traceSize * sizeof(WindowPtr)); + to->focus->sourceid = from->id; + } + } else if (to->focus) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->focus = to->focus; + to->focus = NULL; + } + +} + +static void +DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) +{ + ClassesPtr classes; + + /* Feedback classes must be copied first */ + if (from->ptrfeed) + { + PtrFeedbackPtr *p, it; + if (!to->ptrfeed) + { + classes = to->unused_classes; + to->ptrfeed = classes->ptrfeed; + classes->ptrfeed = NULL; + } + + p = &to->ptrfeed; + for (it = from->ptrfeed; it; it = it->next) + { + if (!(*p)) + { + *p = calloc(1, sizeof(PtrFeedbackClassRec)); + if (!*p) + { + ErrorF("[Xi] Cannot alloc memory for class copy."); + return; + } + } + (*p)->CtrlProc = it->CtrlProc; + (*p)->ctrl = it->ctrl; + + p = &(*p)->next; + } + } else if (to->ptrfeed && !from->ptrfeed) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->ptrfeed = to->ptrfeed; + to->ptrfeed = NULL; + } + + if (from->valuator) + { + ValuatorClassPtr v; + if (!to->valuator) + { + classes = to->unused_classes; + to->valuator = classes->valuator; + if (to->valuator) + classes->valuator = NULL; + } + + to->valuator = realloc(to->valuator, sizeof(ValuatorClassRec) + + from->valuator->numAxes * sizeof(AxisInfo) + + from->valuator->numAxes * sizeof(double)); + v = to->valuator; + if (!v) + FatalError("[Xi] no memory for class shift.\n"); + + v->numAxes = from->valuator->numAxes; + v->axes = (AxisInfoPtr)&v[1]; + memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo)); + + v->axisVal = (double*)(v->axes + from->valuator->numAxes); + v->sourceid = from->id; + } else if (to->valuator && !from->valuator) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->valuator = to->valuator; + to->valuator = NULL; + } + + if (from->button) + { + if (!to->button) + { + classes = to->unused_classes; + to->button = classes->button; + if (!to->button) + { + to->button = calloc(1, sizeof(ButtonClassRec)); + if (!to->button) + FatalError("[Xi] no memory for class shift.\n"); + } else + classes->button = NULL; + } + + if (from->button->xkb_acts) + { + if (!to->button->xkb_acts) + { + to->button->xkb_acts = calloc(1, sizeof(XkbAction)); + if (!to->button->xkb_acts) + FatalError("[Xi] not enough memory for xkb_acts.\n"); + } + memcpy(to->button->xkb_acts, from->button->xkb_acts, + sizeof(XkbAction)); + } else + free(to->button->xkb_acts); + + memcpy(to->button->labels, from->button->labels, + from->button->numButtons * sizeof(Atom)); + to->button->sourceid = from->id; + } else if (to->button && !from->button) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->button = to->button; + to->button = NULL; + } + + if (from->proximity) + { + if (!to->proximity) + { + classes = to->unused_classes; + to->proximity = classes->proximity; + if (!to->proximity) + { + to->proximity = calloc(1, sizeof(ProximityClassRec)); + if (!to->proximity) + FatalError("[Xi] no memory for class shift.\n"); + } else + classes->proximity = NULL; + } + memcpy(to->proximity, from->proximity, sizeof(ProximityClassRec)); + to->proximity->sourceid = from->id; + } else if (to->proximity) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->proximity = to->proximity; + to->proximity = NULL; + } + + if (from->absolute) + { + if (!to->absolute) + { + classes = to->unused_classes; + to->absolute = classes->absolute; + if (!to->absolute) + { + to->absolute = calloc(1, sizeof(AbsoluteClassRec)); + if (!to->absolute) + FatalError("[Xi] no memory for class shift.\n"); + } else + classes->absolute = NULL; + } + memcpy(to->absolute, from->absolute, sizeof(AbsoluteClassRec)); + to->absolute->sourceid = from->id; + } else if (to->absolute) + { + ClassesPtr classes; + classes = to->unused_classes; + classes->absolute = to->absolute; + to->absolute = NULL; + } +} + +/** + * Copies the CONTENT of the classes of device from into the classes in device + * to. From and to are identical after finishing. + * + * If to does not have classes from currenly has, the classes are stored in + * to's devPrivates system. Later, we recover it again from there if needed. + * Saves a few memory allocations. + */ +void +DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to, DeviceChangedEvent *dce) +{ + /* generic feedback classes, not tied to pointer and/or keyboard */ + DeepCopyFeedbackClasses(from, to); + + if ((dce->flags & DEVCHANGE_KEYBOARD_EVENT)) + DeepCopyKeyboardClasses(from, to); + if ((dce->flags & DEVCHANGE_POINTER_EVENT)) + DeepCopyPointerClasses(from, to); +} + + +/** + * Send an XI2 DeviceChangedEvent to all interested clients. + */ +void +XISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master, DeviceChangedEvent *dce) +{ + xXIDeviceChangedEvent *dcce; + int rc; + + rc = EventToXI2((InternalEvent*)dce, (xEvent**)&dcce); + if (rc != Success) + { + ErrorF("[Xi] event conversion from DCE failed with code %d\n", rc); + return; + } + + /* we don't actually swap if there's a NullClient, swapping is done + * later when event is delivered. */ + SendEventToAllWindows(master, XI_DeviceChangedMask, (xEvent*)dcce, 1); + free(dcce); +} + +static void +ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce) +{ + DeviceIntPtr slave; + int rc; + + /* For now, we don't have devices that change physically. */ + if (!IsMaster(device)) + return; + + rc = dixLookupDevice(&slave, dce->sourceid, serverClient, DixReadAccess); + + if (rc != Success) + return; /* Device has disappeared */ + + if (!slave->u.master) + return; /* set floating since the event */ + + if (slave->u.master->id != dce->masterid) + return; /* not our slave anymore, don't care */ + + /* FIXME: we probably need to send a DCE for the new slave now */ + + device->public.devicePrivate = slave->public.devicePrivate; + + /* FIXME: the classes may have changed since we generated the event. */ + DeepCopyDeviceClasses(slave, device, dce); + XISendDeviceChangedEvent(slave, device, dce); +} + +/** + * Update the device state according to the data in the event. + * + * return values are + * DEFAULT ... process as normal + * DONT_PROCESS ... return immediately from caller + */ +#define DEFAULT 0 +#define DONT_PROCESS 1 +int +UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event) +{ + int i; + int key = 0, + bit = 0, + last_valuator; + + KeyClassPtr k = NULL; + ButtonClassPtr b = NULL; + ValuatorClassPtr v = NULL; + + /* This event is always the first we get, before the actual events with + * the data. However, the way how the DDX is set up, "device" will + * actually be the slave device that caused the event. + */ + switch(event->type) + { + case ET_DeviceChanged: + ChangeMasterDeviceClasses(device, (DeviceChangedEvent*)event); + return DONT_PROCESS; /* event has been sent already */ + case ET_Motion: + case ET_ButtonPress: + case ET_ButtonRelease: + case ET_KeyPress: + case ET_KeyRelease: + case ET_ProximityIn: + case ET_ProximityOut: + break; + default: + /* other events don't update the device */ + return DEFAULT; + } + + k = device->key; + v = device->valuator; + b = device->button; + + key = event->detail.key; + bit = 1 << (key & 7); + + /* Update device axis */ + /* Check valuators first */ + last_valuator = -1; + for (i = 0; i < MAX_VALUATORS; i++) + { + if (BitIsOn(&event->valuators.mask, i)) + { + if (!v) + { + ErrorF("[Xi] Valuators reported for non-valuator device '%s'. " + "Ignoring event.\n", device->name); + return DONT_PROCESS; + } else if (v->numAxes < i) + { + ErrorF("[Xi] Too many valuators reported for device '%s'. " + "Ignoring event.\n", device->name); + return DONT_PROCESS; + } + last_valuator = i; + } + } + + for (i = 0; i <= last_valuator && i < v->numAxes; i++) + { + if (BitIsOn(&event->valuators.mask, i)) + { + /* XXX: Relative/Absolute mode */ + v->axisVal[i] = event->valuators.data[i]; + v->axisVal[i] += (event->valuators.data_frac[i] * 1.0f / (1 << 16) / (1 << 16)); + } + } + + if (event->type == ET_KeyPress) { + if (!k) + return DONT_PROCESS; + + /* don't allow ddx to generate multiple downs, but repeats are okay */ + if (key_is_down(device, key, KEY_PROCESSED) && !event->key_repeat) + return DONT_PROCESS; + + if (device->valuator) + device->valuator->motionHintWindow = NullWindow; + set_key_down(device, key, KEY_PROCESSED); + } else if (event->type == ET_KeyRelease) { + if (!k) + return DONT_PROCESS; + + if (!key_is_down(device, key, KEY_PROCESSED)) /* guard against duplicates */ + return DONT_PROCESS; + if (device->valuator) + device->valuator->motionHintWindow = NullWindow; + set_key_up(device, key, KEY_PROCESSED); + } else if (event->type == ET_ButtonPress) { + Mask mask; + if (!b) + return DONT_PROCESS; + + if (button_is_down(device, key, BUTTON_PROCESSED)) + return DONT_PROCESS; + + set_button_down(device, key, BUTTON_PROCESSED); + if (device->valuator) + device->valuator->motionHintWindow = NullWindow; + if (!b->map[key]) + return DONT_PROCESS; + b->buttonsDown++; + b->motionMask = DeviceButtonMotionMask; + if (b->map[key] <= 5) + b->state |= (Button1Mask >> 1) << b->map[key]; + + /* Add state and motionMask to the filter for this event */ + mask = DevicePointerMotionMask | b->state | b->motionMask; + SetMaskForEvent(device->id, mask, DeviceMotionNotify); + mask = PointerMotionMask | b->state | b->motionMask; + SetMaskForEvent(device->id, mask, MotionNotify); + } else if (event->type == ET_ButtonRelease) { + Mask mask; + if (!b) + return DONT_PROCESS; + + if (!button_is_down(device, key, BUTTON_PROCESSED)) + return DONT_PROCESS; + if (IsMaster(device)) { + DeviceIntPtr sd; + + /* + * Leave the button down if any slave has the + * button still down. Note that this depends on the + * event being delivered through the slave first + */ + for (sd = inputInfo.devices; sd; sd = sd->next) { + if (IsMaster(sd) || sd->u.master != device) + continue; + if (!sd->button) + continue; + for (i = 1; i <= sd->button->numButtons; i++) + if (sd->button->map[i] == key && + button_is_down(sd, i, BUTTON_PROCESSED)) + return DONT_PROCESS; + } + } + set_button_up(device, key, BUTTON_PROCESSED); + if (device->valuator) + device->valuator->motionHintWindow = NullWindow; + if (!b->map[key]) + return DONT_PROCESS; + if (b->buttonsDown >= 1 && !--b->buttonsDown) + b->motionMask = 0; + if (b->map[key] <= 5) + b->state &= ~((Button1Mask >> 1) << b->map[key]); + + /* Add state and motionMask to the filter for this event */ + mask = DevicePointerMotionMask | b->state | b->motionMask; + SetMaskForEvent(device->id, mask, DeviceMotionNotify); + mask = PointerMotionMask | b->state | b->motionMask; + SetMaskForEvent(device->id, mask, MotionNotify); + } else if (event->type == ET_ProximityIn) + device->proximity->in_proximity = TRUE; + else if (event->type == ET_ProximityOut) + device->proximity->in_proximity = FALSE; + + return DEFAULT; +} + +static void +ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device) +{ + GrabPtr grab = device->deviceGrab.grab; + + if (grab) + DeliverGrabbedEvent((InternalEvent*)ev, device, FALSE); + else { /* deliver to all root windows */ + xEvent *xi; + int i; + + i = EventToXI2((InternalEvent*)ev, (xEvent**)&xi); + if (i != Success) + { + ErrorF("[Xi] %s: XI2 conversion failed in ProcessRawEvent (%d)\n", + device->name, i); + return; + } + + for (i = 0; i < screenInfo.numScreens; i++) + DeliverEventsToWindow(device, screenInfo.screens[i]->root, xi, 1, + GetEventFilter(device, xi), NULL); + free(xi); + } +} + +/** + * Main device event processing function. + * Called from when processing the events from the event queue. + * + */ +void +ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) +{ + GrabPtr grab; + Bool deactivateDeviceGrab = FALSE; + int key = 0, rootX, rootY; + ButtonClassPtr b; + KeyClassPtr k; + ValuatorClassPtr v; + int ret = 0; + int state, i; + DeviceIntPtr mouse = NULL, kbd = NULL; + DeviceEvent *event = &ev->device_event; + + CHECKEVENT(ev); + + if (ev->any.type == ET_RawKeyPress || + ev->any.type == ET_RawKeyRelease || + ev->any.type == ET_RawButtonPress || + ev->any.type == ET_RawButtonRelease || + ev->any.type == ET_RawMotion) + { + ProcessRawEvent(&ev->raw_event, device); + return; + } + + if (IsPointerDevice(device)) + { + kbd = GetPairedDevice(device); + mouse = device; + if (!kbd->key) /* can happen with floating SDs */ + kbd = NULL; + } else + { + mouse = GetPairedDevice(device); + kbd = device; + if (!mouse->valuator || !mouse->button) /* may be float. SDs */ + mouse = NULL; + } + + /* State needs to be assembled BEFORE the device is updated. */ + state = (kbd && kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0; + state |= (mouse && mouse->button) ? (mouse->button->state) : 0; + + for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) + if (BitIsOn(mouse->button->down, i)) + SetBit(event->buttons, i); + + if (kbd && kbd->key) + { + XkbStatePtr state; + /* we need the state before the event happens */ + if (event->type == ET_KeyPress || event->type == ET_KeyRelease) + state = &kbd->key->xkbInfo->prev_state; + else + state = &kbd->key->xkbInfo->state; + + event->mods.base = state->base_mods; + event->mods.latched = state->latched_mods; + event->mods.locked = state->locked_mods; + event->mods.effective = state->mods; + + event->group.base = state->base_group; + event->group.latched = state->latched_group; + event->group.locked = state->locked_group; + event->group.effective = state->group; + } + + ret = UpdateDeviceState(device, event); + if (ret == DONT_PROCESS) + return; + + v = device->valuator; + b = device->button; + k = device->key; + + if (IsMaster(device) || !device->u.master) + CheckMotion(event, device); + + switch (event->type) + { + case ET_Motion: + case ET_ButtonPress: + case ET_ButtonRelease: + case ET_KeyPress: + case ET_KeyRelease: + case ET_ProximityIn: + case ET_ProximityOut: + GetSpritePosition(device, &rootX, &rootY); + event->root_x = rootX; + event->root_y = rootY; + NoticeEventTime((InternalEvent*)event); + event->corestate = state; + key = event->detail.key; + break; + default: + break; + } + + if (DeviceEventCallback && !syncEvents.playingEvents) { + DeviceEventInfoRec eventinfo; + SpritePtr pSprite = device->spriteInfo->sprite; + + /* see comment in EnqueueEvents regarding the next three lines */ + if (ev->any.type == ET_Motion) + ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id; + + eventinfo.device = device; + eventinfo.event = ev; + CallCallbacks(&DeviceEventCallback, (pointer) & eventinfo); + } + + grab = device->deviceGrab.grab; + + switch(event->type) + { + case ET_KeyPress: + if (!grab && CheckDeviceGrabs(device, event, 0)) { + device->deviceGrab.activatingKey = key; + return; + } + break; + case ET_KeyRelease: + if (grab && device->deviceGrab.fromPassiveGrab && + (key == device->deviceGrab.activatingKey) && + (device->deviceGrab.grab->type == KeyPress || + device->deviceGrab.grab->type == DeviceKeyPress || + device->deviceGrab.grab->type == XI_KeyPress)) + deactivateDeviceGrab = TRUE; + break; + case ET_ButtonPress: + event->detail.button = b->map[key]; + if (!event->detail.button) { /* there's no button 0 */ + event->detail.button = key; + return; + } + if (!grab && CheckDeviceGrabs(device, event, 0)) + { + /* if a passive grab was activated, the event has been sent + * already */ + return; + } + break; + case ET_ButtonRelease: + event->detail.button = b->map[key]; + if (!event->detail.button) { /* there's no button 0 */ + event->detail.button = key; + return; + } + if (grab && !b->buttonsDown && + device->deviceGrab.fromPassiveGrab && + (device->deviceGrab.grab->type == ButtonPress || + device->deviceGrab.grab->type == DeviceButtonPress || + device->deviceGrab.grab->type == XI_ButtonPress)) + deactivateDeviceGrab = TRUE; + default: + break; + } + + + if (grab) + DeliverGrabbedEvent((InternalEvent*)event, device, deactivateDeviceGrab); + else if (device->focus && !IsPointerEvent((InternalEvent*)ev)) + DeliverFocusedEvent(device, (InternalEvent*)event, + GetSpriteWindow(device)); + else + DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent*)event, + NullGrab, NullWindow, device); + + if (deactivateDeviceGrab == TRUE) + (*device->deviceGrab.DeactivateGrab) (device); + event->detail.key = key; +} + +int +InitProximityClassDeviceStruct(DeviceIntPtr dev) +{ + ProximityClassPtr proxc; + + proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec)); + if (!proxc) + return FALSE; + proxc->sourceid = dev->id; + proxc->in_proximity = TRUE; + dev->proximity = proxc; + return TRUE; +} + +/** + * Initialise the device's valuators. The memory must already be allocated, + * this function merely inits the matching axis (specified through axnum) to + * sane values. + * + * It is a condition that (minval < maxval). + * + * @see InitValuatorClassDeviceStruct + */ +void +InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval, + int resolution, int min_res, int max_res, int mode) +{ + AxisInfoPtr ax; + + if (!dev || !dev->valuator || minval > maxval) + return; + if (axnum >= dev->valuator->numAxes) + return; + + ax = dev->valuator->axes + axnum; + + ax->min_value = minval; + ax->max_value = maxval; + ax->resolution = resolution; + ax->min_resolution = min_res; + ax->max_resolution = max_res; + ax->label = label; + ax->mode = mode; + + if (mode & OutOfProximity) + dev->proximity->in_proximity = FALSE; +} + +static void +FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, + ButtonClassPtr b, ValuatorClassPtr v, int first) +{ + ev->type = DeviceStateNotify; + ev->deviceid = dev->id; + ev->time = currentTime.milliseconds; + ev->classes_reported = 0; + ev->num_keys = 0; + ev->num_buttons = 0; + ev->num_valuators = 0; + + if (b) { + ev->classes_reported |= (1 << ButtonClass); + ev->num_buttons = b->numButtons; + memcpy((char*)ev->buttons, (char*)b->down, 4); + } else if (k) { + ev->classes_reported |= (1 << KeyClass); + ev->num_keys = k->xkbInfo->desc->max_key_code - + k->xkbInfo->desc->min_key_code; + memmove((char *)&ev->keys[0], (char *)k->down, 4); + } + if (v) { + int nval = v->numAxes - first; + + ev->classes_reported |= (1 << ValuatorClass); + ev->classes_reported |= valuator_get_mode(dev, 0) << ModeBitsShift; + ev->num_valuators = nval < 3 ? nval : 3; + switch (ev->num_valuators) { + case 3: + ev->valuator2 = v->axisVal[first + 2]; + case 2: + ev->valuator1 = v->axisVal[first + 1]; + case 1: + ev->valuator0 = v->axisVal[first]; + break; + } + } +} + +static void +FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, + int first) +{ + int nval = v->numAxes - first; + + ev->type = DeviceValuator; + ev->deviceid = dev->id; + ev->num_valuators = nval < 3 ? nval : 3; + ev->first_valuator = first; + switch (ev->num_valuators) { + case 3: + ev->valuator2 = v->axisVal[first + 2]; + case 2: + ev->valuator1 = v->axisVal[first + 1]; + case 1: + ev->valuator0 = v->axisVal[first]; + break; + } + first += ev->num_valuators; +} + +void +DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, + WindowPtr pWin) +{ + deviceFocus event; + xXIFocusInEvent *xi2event; + DeviceIntPtr mouse; + int btlen, len, i; + + mouse = (IsMaster(dev) || dev->u.master) ? GetMaster(dev, MASTER_POINTER) : dev; + + /* XI 2 event */ + btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; + btlen = bytes_to_int32(btlen); + len = sizeof(xXIFocusInEvent) + btlen * 4; + + xi2event = calloc(1, len); + xi2event->type = GenericEvent; + xi2event->extension = IReqCode; + xi2event->evtype = type; + xi2event->length = bytes_to_int32(len - sizeof(xEvent)); + xi2event->buttons_len = btlen; + xi2event->detail = detail; + xi2event->time = currentTime.milliseconds; + xi2event->deviceid = dev->id; + xi2event->sourceid = dev->id; /* a device doesn't change focus by itself */ + xi2event->mode = mode; + xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0); + xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0); + + for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) + if (BitIsOn(mouse->button->down, i)) + SetBit(&xi2event[1], i); + + if (dev->key) + { + xi2event->mods.base_mods = dev->key->xkbInfo->state.base_mods; + xi2event->mods.latched_mods = dev->key->xkbInfo->state.latched_mods; + xi2event->mods.locked_mods = dev->key->xkbInfo->state.locked_mods; + xi2event->mods.effective_mods = dev->key->xkbInfo->state.mods; + + xi2event->group.base_group = dev->key->xkbInfo->state.base_group; + xi2event->group.latched_group = dev->key->xkbInfo->state.latched_group; + xi2event->group.locked_group = dev->key->xkbInfo->state.locked_group; + xi2event->group.effective_group = dev->key->xkbInfo->state.group; + } + + FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent*)xi2event, pWin, + None, FALSE); + + DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1, + GetEventFilter(dev, (xEvent*)xi2event), NullGrab); + + free(xi2event); + + /* XI 1.x event */ + event.deviceid = dev->id; + event.mode = mode; + event.type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut; + event.detail = detail; + event.window = pWin->drawable.id; + event.time = currentTime.milliseconds; + + DeliverEventsToWindow(dev, pWin, (xEvent *) & event, 1, + DeviceFocusChangeMask, NullGrab); + + if ((type == DeviceFocusIn) && + (wOtherInputMasks(pWin)) && + (wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask)) + { + int evcount = 1; + deviceStateNotify *ev, *sev; + deviceKeyStateNotify *kev; + deviceButtonStateNotify *bev; + + KeyClassPtr k; + ButtonClassPtr b; + ValuatorClassPtr v; + int nval = 0, nkeys = 0, nbuttons = 0, first = 0; + + if ((b = dev->button) != NULL) { + nbuttons = b->numButtons; + if (nbuttons > 32) + evcount++; + } + if ((k = dev->key) != NULL) { + nkeys = k->xkbInfo->desc->max_key_code - + k->xkbInfo->desc->min_key_code; + if (nkeys > 32) + evcount++; + if (nbuttons > 0) { + evcount++; + } + } + if ((v = dev->valuator) != NULL) { + nval = v->numAxes; + + if (nval > 3) + evcount++; + if (nval > 6) { + if (!(k && b)) + evcount++; + if (nval > 9) + evcount += ((nval - 7) / 3); + } + } + + sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent)); + FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first); + + if (b != NULL) { + FixDeviceStateNotify(dev, ev++, NULL, b, v, first); + first += 3; + nval -= 3; + if (nbuttons > 32) { + (ev - 1)->deviceid |= MORE_EVENTS; + bev = (deviceButtonStateNotify *) ev++; + bev->type = DeviceButtonStateNotify; + bev->deviceid = dev->id; + memcpy((char*)&bev->buttons[4], (char*)&b->down[4], DOWN_LENGTH - 4); + } + if (nval > 0) { + (ev - 1)->deviceid |= MORE_EVENTS; + FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); + first += 3; + nval -= 3; + } + } + + if (k != NULL) { + FixDeviceStateNotify(dev, ev++, k, NULL, v, first); + first += 3; + nval -= 3; + if (nkeys > 32) { + (ev - 1)->deviceid |= MORE_EVENTS; + kev = (deviceKeyStateNotify *) ev++; + kev->type = DeviceKeyStateNotify; + kev->deviceid = dev->id; + memmove((char *)&kev->keys[0], (char *)&k->down[4], 28); + } + if (nval > 0) { + (ev - 1)->deviceid |= MORE_EVENTS; + FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); + first += 3; + nval -= 3; + } + } + + while (nval > 0) { + FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first); + first += 3; + nval -= 3; + if (nval > 0) { + (ev - 1)->deviceid |= MORE_EVENTS; + FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); + first += 3; + nval -= 3; + } + } + + DeliverEventsToWindow(dev, pWin, (xEvent *) sev, evcount, + DeviceStateNotifyMask, NullGrab); + free(sev); + } +} + +int +CheckGrabValues(ClientPtr client, GrabParameters* param) +{ + if (param->grabtype != GRABTYPE_CORE && + param->grabtype != GRABTYPE_XI && + param->grabtype != GRABTYPE_XI2) + { + ErrorF("[Xi] grabtype is invalid. This is a bug.\n"); + return BadImplementation; + } + + if ((param->this_device_mode != GrabModeSync) && + (param->this_device_mode != GrabModeAsync)) { + client->errorValue = param->this_device_mode; + return BadValue; + } + if ((param->other_devices_mode != GrabModeSync) && + (param->other_devices_mode != GrabModeAsync)) { + client->errorValue = param->other_devices_mode; + return BadValue; + } + + if (param->grabtype != GRABTYPE_XI2 && (param->modifiers != AnyModifier) && + (param->modifiers & ~AllModifiersMask)) { + client->errorValue = param->modifiers; + return BadValue; + } + + if ((param->ownerEvents != xFalse) && (param->ownerEvents != xTrue)) { + client->errorValue = param->ownerEvents; + return BadValue; + } + return Success; +} + +int +GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, + int button, GrabParameters *param, GrabType grabtype, + GrabMask *mask) +{ + WindowPtr pWin, confineTo; + CursorPtr cursor; + GrabPtr grab; + int rc, type = -1; + Mask access_mode = DixGrabAccess; + + rc = CheckGrabValues(client, param); + if (rc != Success) + return rc; + if (param->confineTo == None) + confineTo = NullWindow; + else { + rc = dixLookupWindow(&confineTo, param->confineTo, client, DixSetAttrAccess); + if (rc != Success) + return rc; + } + if (param->cursor == None) + cursor = NullCursor; + else { + rc = dixLookupResourceByType((pointer *)&cursor, param->cursor, + RT_CURSOR, client, DixUseAccess); + if (rc != Success) + { + client->errorValue = param->cursor; + return rc; + } + access_mode |= DixForceAccess; + } + if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + + if (grabtype == GRABTYPE_XI) + type = DeviceButtonPress; + else if (grabtype == GRABTYPE_XI2) + type = XI_ButtonPress; + + grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype, + mask, param, type, button, confineTo, cursor); + if (!grab) + return BadAlloc; + return AddPassiveGrabToList(client, grab); +} + +/** + * Grab the given key. If grabtype is GRABTYPE_XI, the key is a keycode. If + * grabtype is GRABTYPE_XI2, the key is a keysym. + */ +int +GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, + int key, GrabParameters *param, GrabType grabtype, GrabMask *mask) +{ + WindowPtr pWin; + GrabPtr grab; + KeyClassPtr k = dev->key; + Mask access_mode = DixGrabAccess; + int rc, type = -1; + + rc = CheckGrabValues(client, param); + if (rc != Success) + return rc; + if (k == NULL) + return BadMatch; + if (grabtype == GRABTYPE_XI) + { + if ((key > k->xkbInfo->desc->max_key_code || + key < k->xkbInfo->desc->min_key_code) + && (key != AnyKey)) { + client->errorValue = key; + return BadValue; + } + type = DeviceKeyPress; + } else if (grabtype == GRABTYPE_XI2) + type = XI_KeyPress; + + rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc != Success) + return rc; + + grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype, + mask, param, type, key, NULL, NULL); + if (!grab) + return BadAlloc; + return AddPassiveGrabToList(client, grab); +} + +/* Enter/FocusIn grab */ +int +GrabWindow(ClientPtr client, DeviceIntPtr dev, int type, + GrabParameters *param, GrabMask *mask) +{ + WindowPtr pWin; + CursorPtr cursor; + GrabPtr grab; + Mask access_mode = DixGrabAccess; + int rc; + + rc = CheckGrabValues(client, param); + if (rc != Success) + return rc; + + rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + if (param->cursor == None) + cursor = NullCursor; + else { + rc = dixLookupResourceByType((pointer *)&cursor, param->cursor, + RT_CURSOR, client, DixUseAccess); + if (rc != Success) + { + client->errorValue = param->cursor; + return rc; + } + access_mode |= DixForceAccess; + } + if (param->this_device_mode == GrabModeSync || param->other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc != Success) + return rc; + + grab = CreateGrab(client->index, dev, dev, pWin, GRABTYPE_XI2, + mask, param, (type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn, + 0, NULL, cursor); + + if (!grab) + return BadAlloc; + + return AddPassiveGrabToList(client, grab); +} + +int +SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client, + Mask mask, Mask exclusivemasks) +{ + int mskidx = dev->id; + int i, ret; + Mask check; + InputClientsPtr others; + + check = (mask & exclusivemasks); + if (wOtherInputMasks(pWin)) { + if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) { /* It is illegal for two different + * clients to select on any of the + * events for maskcheck. However, + * it is OK, for some client to + * continue selecting on one of those + * events. */ + for (others = wOtherInputMasks(pWin)->inputClients; others; + others = others->next) { + if (!SameClient(others, client) && (check & + others->mask[mskidx])) + return BadAccess; + } + } + for (others = wOtherInputMasks(pWin)->inputClients; others; + others = others->next) { + if (SameClient(others, client)) { + check = others->mask[mskidx]; + others->mask[mskidx] = mask; + if (mask == 0) { + for (i = 0; i < EMASKSIZE; i++) + if (i != mskidx && others->mask[i] != 0) + break; + if (i == EMASKSIZE) { + RecalculateDeviceDeliverableEvents(pWin); + if (ShouldFreeInputMasks(pWin, FALSE)) + FreeResource(others->resource, RT_NONE); + return Success; + } + } + goto maskSet; + } + } + } + check = 0; + if ((ret = AddExtensionClient(pWin, client, mask, mskidx)) != Success) + return ret; + maskSet: + if (dev->valuator) + if ((dev->valuator->motionHintWindow == pWin) && + (mask & DevicePointerMotionHintMask) && + !(check & DevicePointerMotionHintMask) && !dev->deviceGrab.grab) + dev->valuator->motionHintWindow = NullWindow; + RecalculateDeviceDeliverableEvents(pWin); + return Success; +} + +int +AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx) +{ + InputClientsPtr others; + + if (!pWin->optional && !MakeWindowOptional(pWin)) + return BadAlloc; + others = calloc(1, sizeof(InputClients)); + if (!others) + return BadAlloc; + if (!pWin->optional->inputMasks && !MakeInputMasks(pWin)) + return BadAlloc; + others->mask[mskidx] = mask; + others->resource = FakeClientID(client->index); + others->next = pWin->optional->inputMasks->inputClients; + pWin->optional->inputMasks->inputClients = others; + if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer) pWin)) + return BadAlloc; + return Success; +} + +static Bool +MakeInputMasks(WindowPtr pWin) +{ + struct _OtherInputMasks *imasks; + + imasks = calloc(1, sizeof(struct _OtherInputMasks)); + if (!imasks) + return FALSE; + pWin->optional->inputMasks = imasks; + return TRUE; +} + +void +RecalculateDeviceDeliverableEvents(WindowPtr pWin) +{ + InputClientsPtr others; + struct _OtherInputMasks *inputMasks; /* default: NULL */ + WindowPtr pChild, tmp; + int i, j; + + pChild = pWin; + while (1) { + if ((inputMasks = wOtherInputMasks(pChild)) != 0) { + for (i = 0; i < EMASKSIZE; i++) + memset(inputMasks->xi2mask[i], 0, sizeof(inputMasks->xi2mask[i])); + for (others = inputMasks->inputClients; others; + others = others->next) { + for (i = 0; i < EMASKSIZE; i++) + inputMasks->inputEvents[i] |= others->mask[i]; + for (i = 0; i < EMASKSIZE; i++) + for (j = 0; j < XI2MASKSIZE; j++) + inputMasks->xi2mask[i][j] |= others->xi2mask[i][j]; + } + for (i = 0; i < EMASKSIZE; i++) + inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i]; + for (tmp = pChild->parent; tmp; tmp = tmp->parent) + if (wOtherInputMasks(tmp)) + for (i = 0; i < EMASKSIZE; i++) + inputMasks->deliverableEvents[i] |= + (wOtherInputMasks(tmp)->deliverableEvents[i] + & ~inputMasks-> + dontPropagateMask[i] & PropagateMask[i]); + } + if (pChild->firstChild) { + pChild = pChild->firstChild; + continue; + } + while (!pChild->nextSib && (pChild != pWin)) + pChild = pChild->parent; + if (pChild == pWin) + break; + pChild = pChild->nextSib; + } +} + +int +InputClientGone(WindowPtr pWin, XID id) +{ + InputClientsPtr other, prev; + + if (!wOtherInputMasks(pWin)) + return Success; + prev = 0; + for (other = wOtherInputMasks(pWin)->inputClients; other; + other = other->next) { + if (other->resource == id) { + if (prev) { + prev->next = other->next; + free(other); + } else if (!(other->next)) { + if (ShouldFreeInputMasks(pWin, TRUE)) { + wOtherInputMasks(pWin)->inputClients = other->next; + free(wOtherInputMasks(pWin)); + pWin->optional->inputMasks = (OtherInputMasks *) NULL; + CheckWindowOptionalNeed(pWin); + free(other); + } else { + other->resource = FakeClientID(0); + if (!AddResource(other->resource, RT_INPUTCLIENT, + (pointer) pWin)) + return BadAlloc; + } + } else { + wOtherInputMasks(pWin)->inputClients = other->next; + free(other); + } + RecalculateDeviceDeliverableEvents(pWin); + return Success; + } + prev = other; + } + FatalError("client not on device event list"); +} + +int +SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, + xEvent * ev, Mask mask, int count) +{ + WindowPtr pWin; + WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ + WindowPtr spriteWin = GetSpriteWindow(d); + + if (dest == PointerWindow) + pWin = spriteWin; + else if (dest == InputFocus) { + WindowPtr inputFocus; + + if (!d->focus) + inputFocus = spriteWin; + else + inputFocus = d->focus->win; + + if (inputFocus == FollowKeyboardWin) + inputFocus = inputInfo.keyboard->focus->win; + + if (inputFocus == NoneWin) + return Success; + + /* If the input focus is PointerRootWin, send the event to where + * the pointer is if possible, then perhaps propogate up to root. */ + if (inputFocus == PointerRootWin) + inputFocus = GetCurrentRootWindow(d); + + if (IsParent(inputFocus, spriteWin)) { + effectiveFocus = inputFocus; + pWin = spriteWin; + } else + effectiveFocus = pWin = inputFocus; + } else + dixLookupWindow(&pWin, dest, client, DixSendAccess); + if (!pWin) + return BadWindow; + if ((propagate != xFalse) && (propagate != xTrue)) { + client->errorValue = propagate; + return BadValue; + } + ev->u.u.type |= 0x80; + if (propagate) { + for (; pWin; pWin = pWin->parent) { + if (DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab)) + return Success; + if (pWin == effectiveFocus) + return Success; + if (wOtherInputMasks(pWin)) + mask &= ~wOtherInputMasks(pWin)->dontPropagateMask[d->id]; + if (!mask) + break; + } + } else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count)) + DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab); + return Success; +} + +int +SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map) +{ + int i; + ButtonClassPtr b = dev->button; + + if (b == NULL) + return BadMatch; + + if (nElts != b->numButtons) { + client->errorValue = nElts; + return BadValue; + } + if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue)) + return BadValue; + for (i = 0; i < nElts; i++) + if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1)) + return MappingBusy; + for (i = 0; i < nElts; i++) + b->map[i + 1] = map[i]; + return Success; +} + +int +ChangeKeyMapping(ClientPtr client, + DeviceIntPtr dev, + unsigned len, + int type, + KeyCode firstKeyCode, + CARD8 keyCodes, CARD8 keySymsPerKeyCode, KeySym * map) +{ + KeySymsRec keysyms; + KeyClassPtr k = dev->key; + + if (k == NULL) + return BadMatch; + + if (len != (keyCodes * keySymsPerKeyCode)) + return BadLength; + + if ((firstKeyCode < k->xkbInfo->desc->min_key_code) || + (firstKeyCode + keyCodes - 1 > k->xkbInfo->desc->max_key_code)) { + client->errorValue = firstKeyCode; + return BadValue; + } + if (keySymsPerKeyCode == 0) { + client->errorValue = 0; + return BadValue; + } + keysyms.minKeyCode = firstKeyCode; + keysyms.maxKeyCode = firstKeyCode + keyCodes - 1; + keysyms.mapWidth = keySymsPerKeyCode; + keysyms.map = map; + + XkbApplyMappingChange(dev, &keysyms, firstKeyCode, keyCodes, NULL, + serverClient); + + return Success; +} + +static void +DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) +{ + WindowPtr parent; + + /* Deactivate any grabs performed on this window, before making + * any input focus changes. + * Deactivating a device grab should cause focus events. */ + + if (dev->deviceGrab.grab && (dev->deviceGrab.grab->window == pWin)) + (*dev->deviceGrab.DeactivateGrab) (dev); + + /* If the focus window is a root window (ie. has no parent) + * then don't delete the focus from it. */ + + if (dev->focus && (pWin == dev->focus->win) && (pWin->parent != NullWindow)) { + int focusEventMode = NotifyNormal; + + /* If a grab is in progress, then alter the mode of focus events. */ + + if (dev->deviceGrab.grab) + focusEventMode = NotifyWhileGrabbed; + + switch (dev->focus->revert) { + case RevertToNone: + if (!ActivateFocusInGrab(dev, pWin, NoneWin)) + DoFocusEvents(dev, pWin, NoneWin, focusEventMode); + dev->focus->win = NoneWin; + dev->focus->traceGood = 0; + break; + case RevertToParent: + parent = pWin; + do { + parent = parent->parent; + dev->focus->traceGood--; + } + while (!parent->realized); + if (!ActivateFocusInGrab(dev, pWin, parent)) + DoFocusEvents(dev, pWin, parent, focusEventMode); + dev->focus->win = parent; + dev->focus->revert = RevertToNone; + break; + case RevertToPointerRoot: + if (!ActivateFocusInGrab(dev, pWin, PointerRootWin)) + DoFocusEvents(dev, pWin, PointerRootWin, focusEventMode); + dev->focus->win = PointerRootWin; + dev->focus->traceGood = 0; + break; + case RevertToFollowKeyboard: + { + DeviceIntPtr kbd = GetMaster(dev, MASTER_KEYBOARD); + if (!kbd || (kbd == dev && kbd != inputInfo.keyboard)) + kbd = inputInfo.keyboard; + if (kbd->focus->win) { + if (!ActivateFocusInGrab(dev, pWin, kbd->focus->win)) + DoFocusEvents(dev, pWin, kbd->focus->win, focusEventMode); + dev->focus->win = FollowKeyboardWin; + dev->focus->traceGood = 0; + } else { + if (!ActivateFocusInGrab(dev, pWin, NoneWin)) + DoFocusEvents(dev, pWin, NoneWin, focusEventMode); + dev->focus->win = NoneWin; + dev->focus->traceGood = 0; + } + } + break; + } + } + + if (dev->valuator) + if (dev->valuator->motionHintWindow == pWin) + dev->valuator->motionHintWindow = NullWindow; +} + +void +DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) +{ + int i; + DeviceIntPtr dev; + InputClientsPtr ic; + struct _OtherInputMasks *inputMasks; + + for (dev = inputInfo.devices; dev; dev = dev->next) { + DeleteDeviceFromAnyExtEvents(pWin, dev); + } + + for (dev = inputInfo.off_devices; dev; dev = dev->next) + DeleteDeviceFromAnyExtEvents(pWin, dev); + + if (freeResources) + while ((inputMasks = wOtherInputMasks(pWin)) != 0) { + ic = inputMasks->inputClients; + for (i = 0; i < EMASKSIZE; i++) + inputMasks->dontPropagateMask[i] = 0; + FreeResource(ic->resource, RT_NONE); + } +} + +int +MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) +{ + DeviceIntPtr dev; + + dixLookupDevice(&dev, pEvents->deviceid & DEVICE_BITS, serverClient, + DixReadAccess); + if (!dev) + return 0; + + if (pEvents->type == DeviceMotionNotify) { + if (mask & DevicePointerMotionHintMask) { + if (WID(dev->valuator->motionHintWindow) == pEvents->event) { + return 1; /* don't send, but pretend we did */ + } + pEvents->detail = NotifyHint; + } else { + pEvents->detail = NotifyNormal; + } + } + return 0; +} + +void +CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, + deviceKeyButtonPointer * xE, GrabPtr grab, + ClientPtr client, Mask deliveryMask) +{ + DeviceIntPtr dev; + + dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient, + DixGrabAccess); + if (!dev) + return; + + if (type == DeviceMotionNotify) + dev->valuator->motionHintWindow = pWin; + else if ((type == DeviceButtonPress) && (!grab) && + (deliveryMask & DeviceButtonGrabMask)) { + GrabRec tempGrab; + + tempGrab.device = dev; + tempGrab.resource = client->clientAsMask; + tempGrab.window = pWin; + tempGrab.ownerEvents = + (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE; + tempGrab.eventMask = deliveryMask; + tempGrab.keyboardMode = GrabModeAsync; + tempGrab.pointerMode = GrabModeAsync; + tempGrab.confineTo = NullWindow; + tempGrab.cursor = NullCursor; + tempGrab.next = NULL; + (*dev->deviceGrab.ActivateGrab) (dev, &tempGrab, currentTime, TRUE); + } +} + +static Mask +DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) +{ + InputClientsPtr other; + + if (!wOtherInputMasks(pWin)) + return 0; + for (other = wOtherInputMasks(pWin)->inputClients; other; + other = other->next) { + if (SameClient(other, client)) + return other->mask[dev->id]; + } + return 0; +} + +void +MaybeStopDeviceHint(DeviceIntPtr dev, ClientPtr client) +{ + WindowPtr pWin; + GrabPtr grab = dev->deviceGrab.grab; + + pWin = dev->valuator->motionHintWindow; + + if ((grab && SameClient(grab, client) && + ((grab->eventMask & DevicePointerMotionHintMask) || + (grab->ownerEvents && + (DeviceEventMaskForClient(dev, pWin, client) & + DevicePointerMotionHintMask)))) || + (!grab && + (DeviceEventMaskForClient(dev, pWin, client) & + DevicePointerMotionHintMask))) + dev->valuator->motionHintWindow = NullWindow; +} + +int +DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, + int maskndx) +{ + struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin); + + if (mask & ~PropagateMask[maskndx]) { + client->errorValue = mask; + return BadValue; + } + + if (mask == 0) { + if (inputMasks) + inputMasks->dontPropagateMask[maskndx] = mask; + } else { + if (!inputMasks) + AddExtensionClient(pWin, client, 0, 0); + inputMasks = wOtherInputMasks(pWin); + inputMasks->dontPropagateMask[maskndx] = mask; + } + RecalculateDeviceDeliverableEvents(pWin); + if (ShouldFreeInputMasks(pWin, FALSE)) + FreeResource(inputMasks->inputClients->resource, RT_NONE); + return Success; +} + +Bool +ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents) +{ + int i; + Mask allInputEventMasks = 0; + struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin); + + for (i = 0; i < EMASKSIZE; i++) + allInputEventMasks |= inputMasks->dontPropagateMask[i]; + if (!ignoreSelectedEvents) + for (i = 0; i < EMASKSIZE; i++) + allInputEventMasks |= inputMasks->inputEvents[i]; + if (allInputEventMasks == 0) + return TRUE; + else + return FALSE; +} + +/*********************************************************************** + * + * Walk through the window tree, finding all clients that want to know + * about the Event. + * + */ + +static void +FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, + xEvent * ev, int count) +{ + WindowPtr p2; + + while (p1) { + p2 = p1->firstChild; + DeliverEventsToWindow(dev, p1, ev, count, mask, NullGrab); + FindInterestedChildren(dev, p2, mask, ev, count); + p1 = p1->nextSib; + } +} + +/*********************************************************************** + * + * Send an event to interested clients in all windows on all screens. + * + */ + +void +SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) +{ + int i; + WindowPtr pWin, p1; + + for (i = 0; i < screenInfo.numScreens; i++) { + pWin = screenInfo.screens[i]->root; + if (!pWin) + continue; + DeliverEventsToWindow(dev, pWin, ev, count, mask, NullGrab); + p1 = pWin->firstChild; + FindInterestedChildren(dev, p1, mask, ev, count); + } +} + +/** + * Set the XI2 mask for the given client on the given window. + * @param dev The device to set the mask for. + * @param win The window to set the mask on. + * @param client The client setting the mask. + * @param len Number of bytes in mask. + * @param mask Event mask in the form of (1 << eventtype) + */ +int +XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, + unsigned int len, unsigned char* mask) +{ + OtherInputMasks *masks; + InputClientsPtr others = NULL; + + masks = wOtherInputMasks(win); + if (masks) + { + for (others = wOtherInputMasks(win)->inputClients; others; + others = others->next) { + if (SameClient(others, client)) { + memset(others->xi2mask[dev->id], 0, + sizeof(others->xi2mask[dev->id])); + break; + } + } + } + + len = min(len, sizeof(others->xi2mask[dev->id])); + + if (len && !others) + { + if (AddExtensionClient(win, client, 0, 0) != Success) + return BadAlloc; + others= wOtherInputMasks(win)->inputClients; + } + + if (others) + memset(others->xi2mask[dev->id], 0, sizeof(others->xi2mask[dev->id])); + + if (len) + memcpy(others->xi2mask[dev->id], mask, len); + + RecalculateDeviceDeliverableEvents(win); + + return Success; +} diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c index a6408fbb3..82df7eb02 100644 --- a/xorg-server/Xi/extinit.c +++ b/xorg-server/Xi/extinit.c @@ -1,1308 +1,1309 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Hewlett-Packard not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -********************************************************/ - -/******************************************************************** - * - * Dispatch routines and initialization routines for the X input extension. - * - */ - -#define NUMTYPES 15 - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "inputstr.h" -#include "gcstruct.h" /* pointer for extnsionst.h */ -#include "extnsionst.h" /* extension entry */ -#include -#include -#include -#include -#include "geext.h" /* extension interfaces for ge */ - -#include "dixevents.h" -#include "exevents.h" -#include "extinit.h" -#include "exglobals.h" -#include "swaprep.h" -#include "privates.h" -#include "protocol-versions.h" - -/* modules local to Xi */ -#include "allowev.h" -#include "chgdctl.h" -#include "chgfctl.h" -#include "chgkbd.h" -#include "chgprop.h" -#include "chgptr.h" -#include "closedev.h" -#include "devbell.h" -#include "getbmap.h" -#include "getbmap.h" -#include "getdctl.h" -#include "getfctl.h" -#include "getfocus.h" -#include "getkmap.h" -#include "getmmap.h" -#include "getprop.h" -#include "getselev.h" -#include "getvers.h" -#include "getvers.h" -#include "grabdev.h" -#include "grabdevb.h" -#include "grabdevk.h" -#include "gtmotion.h" -#include "listdev.h" -#include "opendev.h" -#include "queryst.h" -#include "selectev.h" -#include "sendexev.h" -#include "chgkmap.h" -#include "setbmap.h" -#include "setdval.h" -#include "setfocus.h" -#include "setmmap.h" -#include "setmode.h" -#include "ungrdev.h" -#include "ungrdevb.h" -#include "ungrdevk.h" -#include "xiallowev.h" -#include "xiselectev.h" -#include "xigrabdev.h" -#include "xipassivegrab.h" -#include "xisetdevfocus.h" -#include "xiproperty.h" -#include "xichangecursor.h" -#include "xichangehierarchy.h" -#include "xigetclientpointer.h" -#include "xiquerydevice.h" -#include "xiquerypointer.h" -#include "xiqueryversion.h" -#include "xisetclientpointer.h" -#include "xiwarppointer.h" - - -/* Masks for XI events have to be aligned with core event (partially anyway). - * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery - * breaks down. The device needs the dev->button->motionMask. If DBMM is - * the same as BMM, we can ensure that both core and device events can be - * delivered, without the need for extra structures in the DeviceIntRec. */ -const Mask DeviceKeyPressMask = KeyPressMask; -const Mask DeviceKeyReleaseMask = KeyReleaseMask; -const Mask DeviceButtonPressMask = ButtonPressMask; -const Mask DeviceButtonReleaseMask = ButtonReleaseMask; -const Mask DeviceProximityMask = (1L << 4); -const Mask DeviceStateNotifyMask = (1L << 5); -const Mask DevicePointerMotionMask = PointerMotionMask; -const Mask DevicePointerMotionHintMask = PointerMotionHintMask; -const Mask DeviceButton1MotionMask = Button1MotionMask; -const Mask DeviceButton2MotionMask = Button2MotionMask; -const Mask DeviceButton3MotionMask = Button3MotionMask; -const Mask DeviceButton4MotionMask = Button4MotionMask; -const Mask DeviceButton5MotionMask = Button5MotionMask; -const Mask DeviceButtonMotionMask = ButtonMotionMask; -const Mask DeviceFocusChangeMask = (1L << 14); -const Mask DeviceMappingNotifyMask = (1L << 15); -const Mask ChangeDeviceNotifyMask = (1L << 16); -const Mask DeviceButtonGrabMask = (1L << 17); -const Mask DeviceOwnerGrabButtonMask = (1L << 17); -const Mask DevicePresenceNotifyMask = (1L << 18); -const Mask DeviceEnterWindowMask = (1L << 18); -const Mask DeviceLeaveWindowMask = (1L << 19); -const Mask DevicePropertyNotifyMask = (1L << 20); -const Mask XIAllMasks = (1L << 21) - 1; - -int ExtEventIndex; -Mask ExtExclusiveMasks[EMASKSIZE]; - -static struct dev_type -{ - Atom type; - char *name; -} dev_type[] = { - { - 0, XI_KEYBOARD}, { - 0, XI_MOUSE}, { - 0, XI_TABLET}, { - 0, XI_TOUCHSCREEN}, { - 0, XI_TOUCHPAD}, { - 0, XI_BARCODE}, { - 0, XI_BUTTONBOX}, { - 0, XI_KNOB_BOX}, { - 0, XI_ONE_KNOB}, { - 0, XI_NINE_KNOB}, { - 0, XI_TRACKBALL}, { - 0, XI_QUADRATURE}, { - 0, XI_ID_MODULE}, { - 0, XI_SPACEBALL}, { - 0, XI_DATAGLOVE}, { - 0, XI_EYETRACKER}, { - 0, XI_CURSORKEYS}, { -0, XI_FOOTMOUSE}}; - -CARD8 event_base[numInputClasses]; -XExtEventInfo EventInfo[32]; - -static DeviceIntRec xi_all_devices; -static DeviceIntRec xi_all_master_devices; - -/** - * Dispatch vector. Functions defined in here will be called when the matching - * request arrives. - */ -static int (*ProcIVector[])(ClientPtr) = { - NULL, /* 0 */ - ProcXGetExtensionVersion, /* 1 */ - ProcXListInputDevices, /* 2 */ - ProcXOpenDevice, /* 3 */ - ProcXCloseDevice, /* 4 */ - ProcXSetDeviceMode, /* 5 */ - ProcXSelectExtensionEvent, /* 6 */ - ProcXGetSelectedExtensionEvents, /* 7 */ - ProcXChangeDeviceDontPropagateList, /* 8 */ - ProcXGetDeviceDontPropagateList, /* 9 */ - ProcXGetDeviceMotionEvents, /* 10 */ - ProcXChangeKeyboardDevice, /* 11 */ - ProcXChangePointerDevice, /* 12 */ - ProcXGrabDevice, /* 13 */ - ProcXUngrabDevice, /* 14 */ - ProcXGrabDeviceKey, /* 15 */ - ProcXUngrabDeviceKey, /* 16 */ - ProcXGrabDeviceButton, /* 17 */ - ProcXUngrabDeviceButton, /* 18 */ - ProcXAllowDeviceEvents, /* 19 */ - ProcXGetDeviceFocus, /* 20 */ - ProcXSetDeviceFocus, /* 21 */ - ProcXGetFeedbackControl, /* 22 */ - ProcXChangeFeedbackControl, /* 23 */ - ProcXGetDeviceKeyMapping, /* 24 */ - ProcXChangeDeviceKeyMapping, /* 25 */ - ProcXGetDeviceModifierMapping, /* 26 */ - ProcXSetDeviceModifierMapping, /* 27 */ - ProcXGetDeviceButtonMapping, /* 28 */ - ProcXSetDeviceButtonMapping, /* 29 */ - ProcXQueryDeviceState, /* 30 */ - ProcXSendExtensionEvent, /* 31 */ - ProcXDeviceBell, /* 32 */ - ProcXSetDeviceValuators, /* 33 */ - ProcXGetDeviceControl, /* 34 */ - ProcXChangeDeviceControl, /* 35 */ - /* XI 1.5 */ - ProcXListDeviceProperties, /* 36 */ - ProcXChangeDeviceProperty, /* 37 */ - ProcXDeleteDeviceProperty, /* 38 */ - ProcXGetDeviceProperty, /* 39 */ - /* XI 2 */ - ProcXIQueryPointer, /* 40 */ - ProcXIWarpPointer, /* 41 */ - ProcXIChangeCursor, /* 42 */ - ProcXIChangeHierarchy, /* 43 */ - ProcXISetClientPointer, /* 44 */ - ProcXIGetClientPointer, /* 45 */ - ProcXISelectEvents, /* 46 */ - ProcXIQueryVersion, /* 47 */ - ProcXIQueryDevice, /* 48 */ - ProcXISetFocus, /* 49 */ - ProcXIGetFocus, /* 50 */ - ProcXIGrabDevice, /* 51 */ - ProcXIUngrabDevice, /* 52 */ - ProcXIAllowEvents, /* 53 */ - ProcXIPassiveGrabDevice, /* 54 */ - ProcXIPassiveUngrabDevice, /* 55 */ - ProcXIListProperties, /* 56 */ - ProcXIChangeProperty, /* 57 */ - ProcXIDeleteProperty, /* 58 */ - ProcXIGetProperty, /* 59 */ - ProcXIGetSelectedEvents /* 60 */ -}; - -/* For swapped clients */ -static int (*SProcIVector[])(ClientPtr) = { - NULL, /* 0 */ - SProcXGetExtensionVersion, /* 1 */ - SProcXListInputDevices, /* 2 */ - SProcXOpenDevice, /* 3 */ - SProcXCloseDevice, /* 4 */ - SProcXSetDeviceMode, /* 5 */ - SProcXSelectExtensionEvent, /* 6 */ - SProcXGetSelectedExtensionEvents, /* 7 */ - SProcXChangeDeviceDontPropagateList, /* 8 */ - SProcXGetDeviceDontPropagateList, /* 9 */ - SProcXGetDeviceMotionEvents, /* 10 */ - SProcXChangeKeyboardDevice, /* 11 */ - SProcXChangePointerDevice, /* 12 */ - SProcXGrabDevice, /* 13 */ - SProcXUngrabDevice, /* 14 */ - SProcXGrabDeviceKey, /* 15 */ - SProcXUngrabDeviceKey, /* 16 */ - SProcXGrabDeviceButton, /* 17 */ - SProcXUngrabDeviceButton, /* 18 */ - SProcXAllowDeviceEvents, /* 19 */ - SProcXGetDeviceFocus, /* 20 */ - SProcXSetDeviceFocus, /* 21 */ - SProcXGetFeedbackControl, /* 22 */ - SProcXChangeFeedbackControl, /* 23 */ - SProcXGetDeviceKeyMapping, /* 24 */ - SProcXChangeDeviceKeyMapping, /* 25 */ - SProcXGetDeviceModifierMapping, /* 26 */ - SProcXSetDeviceModifierMapping, /* 27 */ - SProcXGetDeviceButtonMapping, /* 28 */ - SProcXSetDeviceButtonMapping, /* 29 */ - SProcXQueryDeviceState, /* 30 */ - SProcXSendExtensionEvent, /* 31 */ - SProcXDeviceBell, /* 32 */ - SProcXSetDeviceValuators, /* 33 */ - SProcXGetDeviceControl, /* 34 */ - SProcXChangeDeviceControl, /* 35 */ - SProcXListDeviceProperties, /* 36 */ - SProcXChangeDeviceProperty, /* 37 */ - SProcXDeleteDeviceProperty, /* 38 */ - SProcXGetDeviceProperty, /* 39 */ - SProcXIQueryPointer, /* 40 */ - SProcXIWarpPointer, /* 41 */ - SProcXIChangeCursor, /* 42 */ - SProcXIChangeHierarchy, /* 43 */ - SProcXISetClientPointer, /* 44 */ - SProcXIGetClientPointer, /* 45 */ - SProcXISelectEvents, /* 46 */ - SProcXIQueryVersion, /* 47 */ - SProcXIQueryDevice, /* 48 */ - SProcXISetFocus, /* 49 */ - SProcXIGetFocus, /* 50 */ - SProcXIGrabDevice, /* 51 */ - SProcXIUngrabDevice, /* 52 */ - SProcXIAllowEvents, /* 53 */ - SProcXIPassiveGrabDevice, /* 54 */ - SProcXIPassiveUngrabDevice, /* 55 */ - SProcXIListProperties, /* 56 */ - SProcXIChangeProperty, /* 57 */ - SProcXIDeleteProperty, /* 58 */ - SProcXIGetProperty, /* 59 */ - SProcXIGetSelectedEvents /* 60 */ -}; - -/***************************************************************** - * - * Globals referenced elsewhere in the server. - * - */ - -int IReqCode = 0; -int IEventBase = 0; -int BadDevice = 0; -static int BadEvent = 1; -int BadMode = 2; -int DeviceBusy = 3; -int BadClass = 4; - -int DeviceValuator; -int DeviceKeyPress; -int DeviceKeyRelease; -int DeviceButtonPress; -int DeviceButtonRelease; -int DeviceMotionNotify; -int DeviceFocusIn; -int DeviceFocusOut; -int ProximityIn; -int ProximityOut; -int DeviceStateNotify; -int DeviceKeyStateNotify; -int DeviceButtonStateNotify; -int DeviceMappingNotify; -int ChangeDeviceNotify; -int DevicePresenceNotify; -int DevicePropertyNotify; - -int RT_INPUTCLIENT; - -/***************************************************************** - * - * Externs defined elsewhere in the X server. - * - */ - -extern XExtensionVersion XIVersion; - - -Mask PropagateMask[MAXDEVICES]; - -/***************************************************************** - * - * Versioning support - * - */ - -DevPrivateKeyRec XIClientPrivateKeyRec; - -/***************************************************************** - * - * Declarations of local routines. - * - */ - -static void -XIClientCallback(CallbackListPtr *list, - pointer closure, - pointer data) -{ - NewClientInfoRec *clientinfo = (NewClientInfoRec*)data; - ClientPtr pClient = clientinfo->client; - XIClientPtr pXIClient; - - pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey); - pXIClient->major_version = 0; - pXIClient->minor_version = 0; -} - -/************************************************************************* - * - * ProcIDispatch - main dispatch routine for requests to this extension. - * This routine is used if server and client have the same byte ordering. - * - */ - -static int -ProcIDispatch(ClientPtr client) -{ - REQUEST(xReq); - if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data]) - return BadRequest; - - return (*ProcIVector[stuff->data])(client); -} - -/******************************************************************************* - * - * SProcXDispatch - * - * Main swapped dispatch routine for requests to this extension. - * This routine is used if server and client do not have the same byte ordering. - * - */ - -static int -SProcIDispatch(ClientPtr client) -{ - REQUEST(xReq); - if (stuff->data > IREQUESTS || !SProcIVector[stuff->data]) - return BadRequest; - - return (*SProcIVector[stuff->data])(client); -} - -/********************************************************************** - * - * SReplyIDispatch - * Swap any replies defined in this extension. - * - */ - -static void -SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) - /* All we look at is the type field */ -{ /* This is common to all replies */ - if (rep->RepType == X_GetExtensionVersion) - SRepXGetExtensionVersion(client, len, - (xGetExtensionVersionReply *) rep); - else if (rep->RepType == X_ListInputDevices) - SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep); - else if (rep->RepType == X_OpenDevice) - SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep); - else if (rep->RepType == X_SetDeviceMode) - SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep); - else if (rep->RepType == X_GetSelectedExtensionEvents) - SRepXGetSelectedExtensionEvents(client, len, - (xGetSelectedExtensionEventsReply *) - rep); - else if (rep->RepType == X_GetDeviceDontPropagateList) - SRepXGetDeviceDontPropagateList(client, len, - (xGetDeviceDontPropagateListReply *) - rep); - else if (rep->RepType == X_GetDeviceMotionEvents) - SRepXGetDeviceMotionEvents(client, len, - (xGetDeviceMotionEventsReply *) rep); - else if (rep->RepType == X_GrabDevice) - SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep); - else if (rep->RepType == X_GetDeviceFocus) - SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep); - else if (rep->RepType == X_GetFeedbackControl) - SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep); - else if (rep->RepType == X_GetDeviceKeyMapping) - SRepXGetDeviceKeyMapping(client, len, - (xGetDeviceKeyMappingReply *) rep); - else if (rep->RepType == X_GetDeviceModifierMapping) - SRepXGetDeviceModifierMapping(client, len, - (xGetDeviceModifierMappingReply *) rep); - else if (rep->RepType == X_SetDeviceModifierMapping) - SRepXSetDeviceModifierMapping(client, len, - (xSetDeviceModifierMappingReply *) rep); - else if (rep->RepType == X_GetDeviceButtonMapping) - SRepXGetDeviceButtonMapping(client, len, - (xGetDeviceButtonMappingReply *) rep); - else if (rep->RepType == X_SetDeviceButtonMapping) - SRepXSetDeviceButtonMapping(client, len, - (xSetDeviceButtonMappingReply *) rep); - else if (rep->RepType == X_QueryDeviceState) - SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep); - else if (rep->RepType == X_SetDeviceValuators) - SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep); - else if (rep->RepType == X_GetDeviceControl) - SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep); - else if (rep->RepType == X_ChangeDeviceControl) - SRepXChangeDeviceControl(client, len, - (xChangeDeviceControlReply *) rep); - else if (rep->RepType == X_ListDeviceProperties) - SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep); - else if (rep->RepType == X_GetDeviceProperty) - SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep); - else if (rep->RepType == X_XIQueryPointer) - SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep); - else if (rep->RepType == X_XIGetClientPointer) - SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep); - else if (rep->RepType == X_XIQueryVersion) - SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep); - else if (rep->RepType == X_XIQueryDevice) - SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep); - else if (rep->RepType == X_XIGrabDevice) - SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep); - else if (rep->RepType == X_XIGrabDevice) - SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep); - else if (rep->RepType == X_XIListProperties) - SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep); - else if (rep->RepType == X_XIGetProperty) - SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep); - else if (rep->RepType == X_XIGetSelectedEvents) - SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep); - else if (rep->RepType == X_XIGetFocus) - SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep); - else { - FatalError("XINPUT confused sending swapped reply"); - } -} - -/************************************************************************ - * - * This function swaps the DeviceValuator event. - * - */ - -static void -SEventDeviceValuator(deviceValuator * from, deviceValuator * to) -{ - char n; - int i; - INT32 *ip B32; - - *to = *from; - swaps(&to->sequenceNumber, n); - swaps(&to->device_state, n); - ip = &to->valuator0; - for (i = 0; i < 6; i++) { - swapl((ip + i), n); /* macro - braces are required */ - } -} - -static void -SEventFocus(deviceFocus * from, deviceFocus * to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber, n); - swapl(&to->time, n); - swapl(&to->window, n); -} - -static void -SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) -{ - int i; - char n; - INT32 *ip B32; - - *to = *from; - swaps(&to->sequenceNumber, n); - swapl(&to->time, n); - ip = &to->valuator0; - for (i = 0; i < 3; i++) { - swapl((ip + i), n); /* macro - braces are required */ - } -} - -static void -SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from, - deviceKeyStateNotify * to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber, n); -} - -static void -SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, - deviceButtonStateNotify * to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber, n); -} - -static void -SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber, n); - swapl(&to->time, n); -} - -static void -SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber, n); - swapl(&to->time, n); -} - -static void -SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber,n); - swapl(&to->time, n); - swaps(&to->control, n); -} - -static void -SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber,n); - swapl(&to->time, n); - swapl(&to->atom, n); -} - -static void -SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber,n); - swapl(&to->length, n); - swaps(&to->evtype, n); - swaps(&to->deviceid, n); - swapl(&to->time, n); - swapl(&to->root, n); - swapl(&to->event, n); - swapl(&to->child, n); - swapl(&to->root_x, n); - swapl(&to->root_y, n); - swapl(&to->event_x, n); - swapl(&to->event_y, n); - swaps(&to->sourceid, n); - swaps(&to->buttons_len, n); - swapl(&to->mods.base_mods, n); - swapl(&to->mods.latched_mods, n); - swapl(&to->mods.locked_mods, n); -} - -static void -SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to) -{ - char n; - int i, j; - xXIAnyInfo *any; - - *to = *from; - memcpy(&to[1], &from[1], from->length * 4); - - any = (xXIAnyInfo*)&to[1]; - for (i = 0; i < to->num_classes; i++) - { - int length = any->length; - - switch(any->type) - { - case KeyClass: - { - xXIKeyInfo *ki = (xXIKeyInfo*)any; - uint32_t *key = (uint32_t*)&ki[1]; - for (j = 0; j < ki->num_keycodes; j++, key++) - swapl(key, n); - swaps(&ki->num_keycodes, n); - } - break; - case ButtonClass: - { - xXIButtonInfo *bi = (xXIButtonInfo*)any; - Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) + - pad_to_int32(bits_to_bytes(bi->num_buttons))); - for (j = 0; j < bi->num_buttons; j++) - swapl(&labels[j], n); - swaps(&bi->num_buttons, n); - } - break; - case ValuatorClass: - { - xXIValuatorInfo* ai = (xXIValuatorInfo*)any; - swapl(&ai->label, n); - swapl(&ai->min.integral, n); - swapl(&ai->min.frac, n); - swapl(&ai->max.integral, n); - swapl(&ai->max.frac, n); - swapl(&ai->resolution, n); - swaps(&ai->number, n); - } - break; - } - - swaps(&any->type, n); - swaps(&any->length, n); - swaps(&any->sourceid, n); - - any = (xXIAnyInfo*)((char*)any + length * 4); - } - - swaps(&to->sequenceNumber, n); - swapl(&to->length, n); - swaps(&to->evtype, n); - swaps(&to->deviceid, n); - swapl(&to->time, n); - swaps(&to->num_classes, n); - swaps(&to->sourceid, n); - -} - -static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to) -{ - int i; - char n; - char *ptr; - char *vmask; - - memcpy(to, from, sizeof(xEvent) + from->length * 4); - - swaps(&to->sequenceNumber, n); - swapl(&to->length, n); - swaps(&to->evtype, n); - swaps(&to->deviceid, n); - swapl(&to->time, n); - swapl(&to->detail, n); - swapl(&to->root, n); - swapl(&to->event, n); - swapl(&to->child, n); - swapl(&to->root_x, n); - swapl(&to->root_y, n); - swapl(&to->event_x, n); - swapl(&to->event_y, n); - swaps(&to->buttons_len, n); - swaps(&to->valuators_len, n); - swaps(&to->sourceid, n); - swapl(&to->mods.base_mods, n); - swapl(&to->mods.latched_mods, n); - swapl(&to->mods.locked_mods, n); - swapl(&to->mods.effective_mods, n); - - ptr = (char*)(&to[1]); - ptr += from->buttons_len * 4; - vmask = ptr; /* valuator mask */ - ptr += from->valuators_len * 4; - for (i = 0; i < from->valuators_len * 32; i++) - { - if (BitIsOn(vmask, i)) - { - swapl(((uint32_t*)ptr), n); - ptr += 4; - swapl(((uint32_t*)ptr), n); - ptr += 4; - } - } -} - -static void SDeviceHierarchyEvent(xXIHierarchyEvent *from, - xXIHierarchyEvent *to) -{ - int i; - char n; - xXIHierarchyInfo *info; - - *to = *from; - memcpy(&to[1], &from[1], from->length * 4); - swaps(&to->sequenceNumber, n); - swapl(&to->length, n); - swaps(&to->evtype, n); - swaps(&to->deviceid, n); - swapl(&to->time, n); - swapl(&to->flags, n); - swaps(&to->num_info, n); - - info = (xXIHierarchyInfo*)&to[1]; - for (i = 0; i< from->num_info; i++) - { - swaps(&info->deviceid, n); - swaps(&info->attachment, n); - info++; - } -} - -static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber, n); - swapl(&to->length, n); - swaps(&to->evtype, n); - swaps(&to->deviceid, n); - swapl(&to->property, n); -} - -static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to) -{ - char n; - int i; - FP3232 *values; - unsigned char *mask; - - memcpy(to, from, sizeof(xEvent) + from->length * 4); - - swaps(&to->sequenceNumber, n); - swapl(&to->length, n); - swaps(&to->evtype, n); - swaps(&to->deviceid, n); - swapl(&to->time, n); - swapl(&to->detail, n); - - - mask = (unsigned char*)&to[1]; - values = (FP3232*)(mask + from->valuators_len * 4); - - for (i = 0; i < from->valuators_len * 4 * 8; i++) - { - if (BitIsOn(mask, i)) - { - /* for each bit set there are two FP3232 values on the wire, in - * the order abcABC for data and data_raw. Here we swap as if - * they were in aAbBcC order because it's easier and really - * doesn't matter. - */ - swapl(&values->integral, n); - swapl(&values->frac, n); - values++; - swapl(&values->integral, n); - swapl(&values->frac, n); - values++; - } - } - - swaps(&to->valuators_len, n); -} - - -/** Event swapping function for XI2 events. */ -void -XI2EventSwap(xGenericEvent *from, xGenericEvent *to) -{ - switch(from->evtype) - { - case XI_Enter: - case XI_Leave: - SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to); - break; - case XI_DeviceChanged: - SDeviceChangedEvent((xXIDeviceChangedEvent*)from, - (xXIDeviceChangedEvent*)to); - break; - case XI_HierarchyChanged: - SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to); - break; - case XI_PropertyEvent: - SXIPropertyEvent((xXIPropertyEvent*)from, - (xXIPropertyEvent*)to); - break; - case XI_Motion: - case XI_KeyPress: - case XI_KeyRelease: - case XI_ButtonPress: - case XI_ButtonRelease: - SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to); - break; - case XI_RawMotion: - case XI_RawKeyPress: - case XI_RawKeyRelease: - case XI_RawButtonPress: - case XI_RawButtonRelease: - SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to); - break; - default: - ErrorF("[Xi] Unknown event type to swap. This is a bug.\n"); - break; - } -} - -/************************************************************************** - * - * Allow the specified event to have its propagation suppressed. - * The default is to not allow suppression of propagation. - * - */ - -static void -AllowPropagateSuppress(Mask mask) -{ - int i; - - for (i = 0; i < MAXDEVICES; i++) - PropagateMask[i] |= mask; -} - -/************************************************************************** - * - * Record an event mask where there is no unique corresponding event type. - * We can't call SetMaskForEvent, since that would clobber the existing - * mask for that event. MotionHint and ButtonMotion are examples. - * - * Since extension event types will never be less than 64, we can use - * 0-63 in the EventInfo array as the "type" to be used to look up this - * mask. This means that the corresponding macros such as - * DevicePointerMotionHint must have access to the same constants. - * - */ - -static void -SetEventInfo(Mask mask, int constant) -{ - EventInfo[ExtEventIndex].mask = mask; - EventInfo[ExtEventIndex++].type = constant; -} - -/************************************************************************** - * - * Allow the specified event to be restricted to being selected by one - * client at a time. - * The default is to allow more than one client to select the event. - * - */ - -static void -SetExclusiveAccess(Mask mask) -{ - int i; - - for (i = 0; i < MAXDEVICES; i++) - ExtExclusiveMasks[i] |= mask; -} - -/************************************************************************** - * - * Assign the specified mask to the specified event. - * - */ - -static void -SetMaskForExtEvent(Mask mask, int event) -{ - int i; - - EventInfo[ExtEventIndex].mask = mask; - EventInfo[ExtEventIndex++].type = event; - - if ((event < LASTEvent) || (event >= 128)) - FatalError("MaskForExtensionEvent: bogus event number"); - - for (i = 0; i < MAXDEVICES; i++) - SetMaskForEvent(i, mask, event); -} - -/************************************************************************ - * - * This function sets up extension event types and masks. - * - */ - -static void -FixExtensionEvents(ExtensionEntry * extEntry) -{ - DeviceValuator = extEntry->eventBase; - DeviceKeyPress = DeviceValuator + 1; - DeviceKeyRelease = DeviceKeyPress + 1; - DeviceButtonPress = DeviceKeyRelease + 1; - DeviceButtonRelease = DeviceButtonPress + 1; - DeviceMotionNotify = DeviceButtonRelease + 1; - DeviceFocusIn = DeviceMotionNotify + 1; - DeviceFocusOut = DeviceFocusIn + 1; - ProximityIn = DeviceFocusOut + 1; - ProximityOut = ProximityIn + 1; - DeviceStateNotify = ProximityOut + 1; - DeviceMappingNotify = DeviceStateNotify + 1; - ChangeDeviceNotify = DeviceMappingNotify + 1; - DeviceKeyStateNotify = ChangeDeviceNotify + 1; - DeviceButtonStateNotify = DeviceKeyStateNotify + 1; - DevicePresenceNotify = DeviceButtonStateNotify + 1; - DevicePropertyNotify = DevicePresenceNotify + 1; - - event_base[KeyClass] = DeviceKeyPress; - event_base[ButtonClass] = DeviceButtonPress; - event_base[ValuatorClass] = DeviceMotionNotify; - event_base[ProximityClass] = ProximityIn; - event_base[FocusClass] = DeviceFocusIn; - event_base[OtherClass] = DeviceStateNotify; - - BadDevice += extEntry->errorBase; - BadEvent += extEntry->errorBase; - BadMode += extEntry->errorBase; - DeviceBusy += extEntry->errorBase; - BadClass += extEntry->errorBase; - - SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress); - AllowPropagateSuppress(DeviceKeyPressMask); - SetCriticalEvent(DeviceKeyPress); - - SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease); - AllowPropagateSuppress(DeviceKeyReleaseMask); - SetCriticalEvent(DeviceKeyRelease); - - SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress); - AllowPropagateSuppress(DeviceButtonPressMask); - SetCriticalEvent(DeviceButtonPress); - - SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease); - AllowPropagateSuppress(DeviceButtonReleaseMask); - SetCriticalEvent(DeviceButtonRelease); - - SetMaskForExtEvent(DeviceProximityMask, ProximityIn); - SetMaskForExtEvent(DeviceProximityMask, ProximityOut); - - SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify); - - SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify); - AllowPropagateSuppress(DevicePointerMotionMask); - SetCriticalEvent(DeviceMotionNotify); - - SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint); - SetEventInfo(DeviceButton1MotionMask, _deviceButton1Motion); - SetEventInfo(DeviceButton2MotionMask, _deviceButton2Motion); - SetEventInfo(DeviceButton3MotionMask, _deviceButton3Motion); - SetEventInfo(DeviceButton4MotionMask, _deviceButton4Motion); - SetEventInfo(DeviceButton5MotionMask, _deviceButton5Motion); - SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion); - - SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn); - SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut); - - SetMaskForExtEvent(DeviceMappingNotifyMask, DeviceMappingNotify); - SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify); - - SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab); - SetExclusiveAccess(DeviceButtonGrabMask); - - SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton); - SetEventInfo(DevicePresenceNotifyMask, _devicePresence); - SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify); - - SetEventInfo(0, _noExtensionEvent); -} - -/************************************************************************ - * - * This function restores extension event types and masks to their - * initial state. - * - */ - -static void -RestoreExtensionEvents(void) -{ - int i, j; - - IReqCode = 0; - IEventBase = 0; - - for (i = 0; i < ExtEventIndex - 1; i++) { - if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128)) - { - for (j = 0; j < MAXDEVICES; j++) - SetMaskForEvent(j, 0, EventInfo[i].type); - } - EventInfo[i].mask = 0; - EventInfo[i].type = 0; - } - ExtEventIndex = 0; - DeviceValuator = 0; - DeviceKeyPress = 1; - DeviceKeyRelease = 2; - DeviceButtonPress = 3; - DeviceButtonRelease = 4; - DeviceMotionNotify = 5; - DeviceFocusIn = 6; - DeviceFocusOut = 7; - ProximityIn = 8; - ProximityOut = 9; - DeviceStateNotify = 10; - DeviceMappingNotify = 11; - ChangeDeviceNotify = 12; - DeviceKeyStateNotify = 13; - DeviceButtonStateNotify = 13; - DevicePresenceNotify = 14; - DevicePropertyNotify = 15; - - BadDevice = 0; - BadEvent = 1; - BadMode = 2; - DeviceBusy = 3; - BadClass = 4; - -} - -/*********************************************************************** - * - * IResetProc. - * Remove reply-swapping routine. - * Remove event-swapping routine. - * - */ - -static void -IResetProc(ExtensionEntry * unused) -{ - ReplySwapVector[IReqCode] = ReplyNotSwappd; - EventSwapVector[DeviceValuator] = NotImplemented; - EventSwapVector[DeviceKeyPress] = NotImplemented; - EventSwapVector[DeviceKeyRelease] = NotImplemented; - EventSwapVector[DeviceButtonPress] = NotImplemented; - EventSwapVector[DeviceButtonRelease] = NotImplemented; - EventSwapVector[DeviceMotionNotify] = NotImplemented; - EventSwapVector[DeviceFocusIn] = NotImplemented; - EventSwapVector[DeviceFocusOut] = NotImplemented; - EventSwapVector[ProximityIn] = NotImplemented; - EventSwapVector[ProximityOut] = NotImplemented; - EventSwapVector[DeviceStateNotify] = NotImplemented; - EventSwapVector[DeviceKeyStateNotify] = NotImplemented; - EventSwapVector[DeviceButtonStateNotify] = NotImplemented; - EventSwapVector[DeviceMappingNotify] = NotImplemented; - EventSwapVector[ChangeDeviceNotify] = NotImplemented; - EventSwapVector[DevicePresenceNotify] = NotImplemented; - EventSwapVector[DevicePropertyNotify] = NotImplemented; - RestoreExtensionEvents(); -} - - -/*********************************************************************** - * - * Assign an id and type to an input device. - * - */ - -void -AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name) -{ - dev->xinput_type = type; - dev->name = strdup(name); -} - -/*********************************************************************** - * - * Make device type atoms. - * - */ - -static void -MakeDeviceTypeAtoms(void) -{ - int i; - - for (i = 0; i < NUMTYPES; i++) - dev_type[i].type = - MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1); -} - -/***************************************************************************** - * - * SEventIDispatch - * - * Swap any events defined in this extension. - */ -#define DO_SWAP(func,type) func ((type *)from, (type *)to) - -static void -SEventIDispatch(xEvent * from, xEvent * to) -{ - int type = from->u.u.type & 0177; - - if (type == DeviceValuator) - DO_SWAP(SEventDeviceValuator, deviceValuator); - else if (type == DeviceKeyPress) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceKeyRelease) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceButtonPress) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceButtonRelease) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceMotionNotify) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceFocusIn) - DO_SWAP(SEventFocus, deviceFocus); - else if (type == DeviceFocusOut) - DO_SWAP(SEventFocus, deviceFocus); - else if (type == ProximityIn) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == ProximityOut) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceStateNotify) - DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); - else if (type == DeviceKeyStateNotify) - DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); - else if (type == DeviceButtonStateNotify) - DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); - else if (type == DeviceMappingNotify) - DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); - else if (type == ChangeDeviceNotify) - DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); - else if (type == DevicePresenceNotify) - DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify); - else if (type == DevicePropertyNotify) - DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify); - else { - FatalError("XInputExtension: Impossible event!\n"); - } -} - -/********************************************************************** - * - * IExtensionInit - initialize the input extension. - * - * Called from InitExtensions in main() or from QueryExtension() if the - * extension is dynamically loaded. - * - * This extension has several events and errors. - * - * XI is mandatory nowadays, so if we fail to init XI, we die. - */ - -void -XInputExtensionInit(void) -{ - ExtensionEntry *extEntry; - XExtensionVersion thisversion = { XI_Present, - SERVER_XI_MAJOR_VERSION, - SERVER_XI_MINOR_VERSION, - }; - - if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec))) - FatalError("Cannot request private for XI.\n"); - - if (!AddCallback(&ClientStateCallback, XIClientCallback, 0)) - FatalError("Failed to add callback to XI.\n"); - - extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, - SProcIDispatch, IResetProc, StandardMinorOpcode); - if (extEntry) { - IReqCode = extEntry->base; - IEventBase = extEntry->eventBase; - XIVersion = thisversion; - MakeDeviceTypeAtoms(); - RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone, - "INPUTCLIENT"); - if (!RT_INPUTCLIENT) - FatalError("Failed to add resource type for XI.\n"); - FixExtensionEvents(extEntry); - ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; - EventSwapVector[DeviceValuator] = SEventIDispatch; - EventSwapVector[DeviceKeyPress] = SEventIDispatch; - EventSwapVector[DeviceKeyRelease] = SEventIDispatch; - EventSwapVector[DeviceButtonPress] = SEventIDispatch; - EventSwapVector[DeviceButtonRelease] = SEventIDispatch; - EventSwapVector[DeviceMotionNotify] = SEventIDispatch; - EventSwapVector[DeviceFocusIn] = SEventIDispatch; - EventSwapVector[DeviceFocusOut] = SEventIDispatch; - EventSwapVector[ProximityIn] = SEventIDispatch; - EventSwapVector[ProximityOut] = SEventIDispatch; - EventSwapVector[DeviceStateNotify] = SEventIDispatch; - EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; - EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; - EventSwapVector[DeviceMappingNotify] = SEventIDispatch; - EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; - EventSwapVector[DevicePresenceNotify] = SEventIDispatch; - - GERegisterExtension(IReqCode, XI2EventSwap); - - - memset(&xi_all_devices, 0, sizeof(xi_all_devices)); - memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices)); - xi_all_devices.id = XIAllDevices; - xi_all_devices.name = "XIAllDevices"; - xi_all_master_devices.id = XIAllMasterDevices; - xi_all_master_devices.name = "XIAllMasterDevices"; - - inputInfo.all_devices = &xi_all_devices; - inputInfo.all_master_devices = &xi_all_master_devices; - - XIResetProperties(); - } else { - FatalError("IExtensionInit: AddExtensions failed\n"); - } -} - +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/******************************************************************** + * + * Dispatch routines and initialization routines for the X input extension. + * + */ + +#define NUMTYPES 15 + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "inputstr.h" +#include "gcstruct.h" /* pointer for extnsionst.h */ +#include "extnsionst.h" /* extension entry */ +#include +#include +#include +#include +#include "geext.h" /* extension interfaces for ge */ + +#include "dixevents.h" +#include "exevents.h" +#include "extinit.h" +#include "exglobals.h" +#include "swaprep.h" +#include "privates.h" +#include "protocol-versions.h" + +/* modules local to Xi */ +#include "allowev.h" +#include "chgdctl.h" +#include "chgfctl.h" +#include "chgkbd.h" +#include "chgprop.h" +#include "chgptr.h" +#include "closedev.h" +#include "devbell.h" +#include "getbmap.h" +#include "getbmap.h" +#include "getdctl.h" +#include "getfctl.h" +#include "getfocus.h" +#include "getkmap.h" +#include "getmmap.h" +#include "getprop.h" +#include "getselev.h" +#include "getvers.h" +#include "getvers.h" +#include "grabdev.h" +#include "grabdevb.h" +#include "grabdevk.h" +#include "gtmotion.h" +#include "listdev.h" +#include "opendev.h" +#include "queryst.h" +#include "selectev.h" +#include "sendexev.h" +#include "chgkmap.h" +#include "setbmap.h" +#include "setdval.h" +#include "setfocus.h" +#include "setmmap.h" +#include "setmode.h" +#include "ungrdev.h" +#include "ungrdevb.h" +#include "ungrdevk.h" +#include "xiallowev.h" +#include "xiselectev.h" +#include "xigrabdev.h" +#include "xipassivegrab.h" +#include "xisetdevfocus.h" +#include "xiproperty.h" +#include "xichangecursor.h" +#include "xichangehierarchy.h" +#include "xigetclientpointer.h" +#include "xiquerydevice.h" +#include "xiquerypointer.h" +#include "xiqueryversion.h" +#include "xisetclientpointer.h" +#include "xiwarppointer.h" + + +/* Masks for XI events have to be aligned with core event (partially anyway). + * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery + * breaks down. The device needs the dev->button->motionMask. If DBMM is + * the same as BMM, we can ensure that both core and device events can be + * delivered, without the need for extra structures in the DeviceIntRec. */ +const Mask DeviceKeyPressMask = KeyPressMask; +const Mask DeviceKeyReleaseMask = KeyReleaseMask; +const Mask DeviceButtonPressMask = ButtonPressMask; +const Mask DeviceButtonReleaseMask = ButtonReleaseMask; +const Mask DeviceProximityMask = (1L << 4); +const Mask DeviceStateNotifyMask = (1L << 5); +const Mask DevicePointerMotionMask = PointerMotionMask; +const Mask DevicePointerMotionHintMask = PointerMotionHintMask; +const Mask DeviceButton1MotionMask = Button1MotionMask; +const Mask DeviceButton2MotionMask = Button2MotionMask; +const Mask DeviceButton3MotionMask = Button3MotionMask; +const Mask DeviceButton4MotionMask = Button4MotionMask; +const Mask DeviceButton5MotionMask = Button5MotionMask; +const Mask DeviceButtonMotionMask = ButtonMotionMask; +const Mask DeviceFocusChangeMask = (1L << 14); +const Mask DeviceMappingNotifyMask = (1L << 15); +const Mask ChangeDeviceNotifyMask = (1L << 16); +const Mask DeviceButtonGrabMask = (1L << 17); +const Mask DeviceOwnerGrabButtonMask = (1L << 17); +const Mask DevicePresenceNotifyMask = (1L << 18); +const Mask DeviceEnterWindowMask = (1L << 18); +const Mask DeviceLeaveWindowMask = (1L << 19); +const Mask DevicePropertyNotifyMask = (1L << 20); +const Mask XIAllMasks = (1L << 21) - 1; + +int ExtEventIndex; +Mask ExtExclusiveMasks[EMASKSIZE]; + +static struct dev_type +{ + Atom type; + char *name; +} dev_type[] = { + { + 0, XI_KEYBOARD}, { + 0, XI_MOUSE}, { + 0, XI_TABLET}, { + 0, XI_TOUCHSCREEN}, { + 0, XI_TOUCHPAD}, { + 0, XI_BARCODE}, { + 0, XI_BUTTONBOX}, { + 0, XI_KNOB_BOX}, { + 0, XI_ONE_KNOB}, { + 0, XI_NINE_KNOB}, { + 0, XI_TRACKBALL}, { + 0, XI_QUADRATURE}, { + 0, XI_ID_MODULE}, { + 0, XI_SPACEBALL}, { + 0, XI_DATAGLOVE}, { + 0, XI_EYETRACKER}, { + 0, XI_CURSORKEYS}, { +0, XI_FOOTMOUSE}}; + +CARD8 event_base[numInputClasses]; +XExtEventInfo EventInfo[32]; + +static DeviceIntRec xi_all_devices; +static DeviceIntRec xi_all_master_devices; + +/** + * Dispatch vector. Functions defined in here will be called when the matching + * request arrives. + */ +static int (*ProcIVector[])(ClientPtr) = { + NULL, /* 0 */ + ProcXGetExtensionVersion, /* 1 */ + ProcXListInputDevices, /* 2 */ + ProcXOpenDevice, /* 3 */ + ProcXCloseDevice, /* 4 */ + ProcXSetDeviceMode, /* 5 */ + ProcXSelectExtensionEvent, /* 6 */ + ProcXGetSelectedExtensionEvents, /* 7 */ + ProcXChangeDeviceDontPropagateList, /* 8 */ + ProcXGetDeviceDontPropagateList, /* 9 */ + ProcXGetDeviceMotionEvents, /* 10 */ + ProcXChangeKeyboardDevice, /* 11 */ + ProcXChangePointerDevice, /* 12 */ + ProcXGrabDevice, /* 13 */ + ProcXUngrabDevice, /* 14 */ + ProcXGrabDeviceKey, /* 15 */ + ProcXUngrabDeviceKey, /* 16 */ + ProcXGrabDeviceButton, /* 17 */ + ProcXUngrabDeviceButton, /* 18 */ + ProcXAllowDeviceEvents, /* 19 */ + ProcXGetDeviceFocus, /* 20 */ + ProcXSetDeviceFocus, /* 21 */ + ProcXGetFeedbackControl, /* 22 */ + ProcXChangeFeedbackControl, /* 23 */ + ProcXGetDeviceKeyMapping, /* 24 */ + ProcXChangeDeviceKeyMapping, /* 25 */ + ProcXGetDeviceModifierMapping, /* 26 */ + ProcXSetDeviceModifierMapping, /* 27 */ + ProcXGetDeviceButtonMapping, /* 28 */ + ProcXSetDeviceButtonMapping, /* 29 */ + ProcXQueryDeviceState, /* 30 */ + ProcXSendExtensionEvent, /* 31 */ + ProcXDeviceBell, /* 32 */ + ProcXSetDeviceValuators, /* 33 */ + ProcXGetDeviceControl, /* 34 */ + ProcXChangeDeviceControl, /* 35 */ + /* XI 1.5 */ + ProcXListDeviceProperties, /* 36 */ + ProcXChangeDeviceProperty, /* 37 */ + ProcXDeleteDeviceProperty, /* 38 */ + ProcXGetDeviceProperty, /* 39 */ + /* XI 2 */ + ProcXIQueryPointer, /* 40 */ + ProcXIWarpPointer, /* 41 */ + ProcXIChangeCursor, /* 42 */ + ProcXIChangeHierarchy, /* 43 */ + ProcXISetClientPointer, /* 44 */ + ProcXIGetClientPointer, /* 45 */ + ProcXISelectEvents, /* 46 */ + ProcXIQueryVersion, /* 47 */ + ProcXIQueryDevice, /* 48 */ + ProcXISetFocus, /* 49 */ + ProcXIGetFocus, /* 50 */ + ProcXIGrabDevice, /* 51 */ + ProcXIUngrabDevice, /* 52 */ + ProcXIAllowEvents, /* 53 */ + ProcXIPassiveGrabDevice, /* 54 */ + ProcXIPassiveUngrabDevice, /* 55 */ + ProcXIListProperties, /* 56 */ + ProcXIChangeProperty, /* 57 */ + ProcXIDeleteProperty, /* 58 */ + ProcXIGetProperty, /* 59 */ + ProcXIGetSelectedEvents /* 60 */ +}; + +/* For swapped clients */ +static int (*SProcIVector[])(ClientPtr) = { + NULL, /* 0 */ + SProcXGetExtensionVersion, /* 1 */ + SProcXListInputDevices, /* 2 */ + SProcXOpenDevice, /* 3 */ + SProcXCloseDevice, /* 4 */ + SProcXSetDeviceMode, /* 5 */ + SProcXSelectExtensionEvent, /* 6 */ + SProcXGetSelectedExtensionEvents, /* 7 */ + SProcXChangeDeviceDontPropagateList, /* 8 */ + SProcXGetDeviceDontPropagateList, /* 9 */ + SProcXGetDeviceMotionEvents, /* 10 */ + SProcXChangeKeyboardDevice, /* 11 */ + SProcXChangePointerDevice, /* 12 */ + SProcXGrabDevice, /* 13 */ + SProcXUngrabDevice, /* 14 */ + SProcXGrabDeviceKey, /* 15 */ + SProcXUngrabDeviceKey, /* 16 */ + SProcXGrabDeviceButton, /* 17 */ + SProcXUngrabDeviceButton, /* 18 */ + SProcXAllowDeviceEvents, /* 19 */ + SProcXGetDeviceFocus, /* 20 */ + SProcXSetDeviceFocus, /* 21 */ + SProcXGetFeedbackControl, /* 22 */ + SProcXChangeFeedbackControl, /* 23 */ + SProcXGetDeviceKeyMapping, /* 24 */ + SProcXChangeDeviceKeyMapping, /* 25 */ + SProcXGetDeviceModifierMapping, /* 26 */ + SProcXSetDeviceModifierMapping, /* 27 */ + SProcXGetDeviceButtonMapping, /* 28 */ + SProcXSetDeviceButtonMapping, /* 29 */ + SProcXQueryDeviceState, /* 30 */ + SProcXSendExtensionEvent, /* 31 */ + SProcXDeviceBell, /* 32 */ + SProcXSetDeviceValuators, /* 33 */ + SProcXGetDeviceControl, /* 34 */ + SProcXChangeDeviceControl, /* 35 */ + SProcXListDeviceProperties, /* 36 */ + SProcXChangeDeviceProperty, /* 37 */ + SProcXDeleteDeviceProperty, /* 38 */ + SProcXGetDeviceProperty, /* 39 */ + SProcXIQueryPointer, /* 40 */ + SProcXIWarpPointer, /* 41 */ + SProcXIChangeCursor, /* 42 */ + SProcXIChangeHierarchy, /* 43 */ + SProcXISetClientPointer, /* 44 */ + SProcXIGetClientPointer, /* 45 */ + SProcXISelectEvents, /* 46 */ + SProcXIQueryVersion, /* 47 */ + SProcXIQueryDevice, /* 48 */ + SProcXISetFocus, /* 49 */ + SProcXIGetFocus, /* 50 */ + SProcXIGrabDevice, /* 51 */ + SProcXIUngrabDevice, /* 52 */ + SProcXIAllowEvents, /* 53 */ + SProcXIPassiveGrabDevice, /* 54 */ + SProcXIPassiveUngrabDevice, /* 55 */ + SProcXIListProperties, /* 56 */ + SProcXIChangeProperty, /* 57 */ + SProcXIDeleteProperty, /* 58 */ + SProcXIGetProperty, /* 59 */ + SProcXIGetSelectedEvents /* 60 */ +}; + +/***************************************************************** + * + * Globals referenced elsewhere in the server. + * + */ + +int IReqCode = 0; +int IEventBase = 0; +int BadDevice = 0; +static int BadEvent = 1; +int BadMode = 2; +int DeviceBusy = 3; +int BadClass = 4; + +int DeviceValuator; +int DeviceKeyPress; +int DeviceKeyRelease; +int DeviceButtonPress; +int DeviceButtonRelease; +int DeviceMotionNotify; +int DeviceFocusIn; +int DeviceFocusOut; +int ProximityIn; +int ProximityOut; +int DeviceStateNotify; +int DeviceKeyStateNotify; +int DeviceButtonStateNotify; +int DeviceMappingNotify; +int ChangeDeviceNotify; +int DevicePresenceNotify; +int DevicePropertyNotify; + +int RT_INPUTCLIENT; + +/***************************************************************** + * + * Externs defined elsewhere in the X server. + * + */ + +extern XExtensionVersion XIVersion; + + +Mask PropagateMask[MAXDEVICES]; + +/***************************************************************** + * + * Versioning support + * + */ + +DevPrivateKeyRec XIClientPrivateKeyRec; + +/***************************************************************** + * + * Declarations of local routines. + * + */ + +static void +XIClientCallback(CallbackListPtr *list, + pointer closure, + pointer data) +{ + NewClientInfoRec *clientinfo = (NewClientInfoRec*)data; + ClientPtr pClient = clientinfo->client; + XIClientPtr pXIClient; + + pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey); + pXIClient->major_version = 0; + pXIClient->minor_version = 0; +} + +/************************************************************************* + * + * ProcIDispatch - main dispatch routine for requests to this extension. + * This routine is used if server and client have the same byte ordering. + * + */ + +static int +ProcIDispatch(ClientPtr client) +{ + REQUEST(xReq); + if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data]) + return BadRequest; + + return (*ProcIVector[stuff->data])(client); +} + +/******************************************************************************* + * + * SProcXDispatch + * + * Main swapped dispatch routine for requests to this extension. + * This routine is used if server and client do not have the same byte ordering. + * + */ + +static int +SProcIDispatch(ClientPtr client) +{ + REQUEST(xReq); + if (stuff->data > IREQUESTS || !SProcIVector[stuff->data]) + return BadRequest; + + return (*SProcIVector[stuff->data])(client); +} + +/********************************************************************** + * + * SReplyIDispatch + * Swap any replies defined in this extension. + * + */ + +static void +SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) + /* All we look at is the type field */ +{ /* This is common to all replies */ + if (rep->RepType == X_GetExtensionVersion) + SRepXGetExtensionVersion(client, len, + (xGetExtensionVersionReply *) rep); + else if (rep->RepType == X_ListInputDevices) + SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep); + else if (rep->RepType == X_OpenDevice) + SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep); + else if (rep->RepType == X_SetDeviceMode) + SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep); + else if (rep->RepType == X_GetSelectedExtensionEvents) + SRepXGetSelectedExtensionEvents(client, len, + (xGetSelectedExtensionEventsReply *) + rep); + else if (rep->RepType == X_GetDeviceDontPropagateList) + SRepXGetDeviceDontPropagateList(client, len, + (xGetDeviceDontPropagateListReply *) + rep); + else if (rep->RepType == X_GetDeviceMotionEvents) + SRepXGetDeviceMotionEvents(client, len, + (xGetDeviceMotionEventsReply *) rep); + else if (rep->RepType == X_GrabDevice) + SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep); + else if (rep->RepType == X_GetDeviceFocus) + SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep); + else if (rep->RepType == X_GetFeedbackControl) + SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep); + else if (rep->RepType == X_GetDeviceKeyMapping) + SRepXGetDeviceKeyMapping(client, len, + (xGetDeviceKeyMappingReply *) rep); + else if (rep->RepType == X_GetDeviceModifierMapping) + SRepXGetDeviceModifierMapping(client, len, + (xGetDeviceModifierMappingReply *) rep); + else if (rep->RepType == X_SetDeviceModifierMapping) + SRepXSetDeviceModifierMapping(client, len, + (xSetDeviceModifierMappingReply *) rep); + else if (rep->RepType == X_GetDeviceButtonMapping) + SRepXGetDeviceButtonMapping(client, len, + (xGetDeviceButtonMappingReply *) rep); + else if (rep->RepType == X_SetDeviceButtonMapping) + SRepXSetDeviceButtonMapping(client, len, + (xSetDeviceButtonMappingReply *) rep); + else if (rep->RepType == X_QueryDeviceState) + SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep); + else if (rep->RepType == X_SetDeviceValuators) + SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep); + else if (rep->RepType == X_GetDeviceControl) + SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep); + else if (rep->RepType == X_ChangeDeviceControl) + SRepXChangeDeviceControl(client, len, + (xChangeDeviceControlReply *) rep); + else if (rep->RepType == X_ListDeviceProperties) + SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep); + else if (rep->RepType == X_GetDeviceProperty) + SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep); + else if (rep->RepType == X_XIQueryPointer) + SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep); + else if (rep->RepType == X_XIGetClientPointer) + SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply*) rep); + else if (rep->RepType == X_XIQueryVersion) + SRepXIQueryVersion(client, len, (xXIQueryVersionReply*)rep); + else if (rep->RepType == X_XIQueryDevice) + SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep); + else if (rep->RepType == X_XIGrabDevice) + SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep); + else if (rep->RepType == X_XIGrabDevice) + SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep); + else if (rep->RepType == X_XIListProperties) + SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep); + else if (rep->RepType == X_XIGetProperty) + SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep); + else if (rep->RepType == X_XIGetSelectedEvents) + SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep); + else if (rep->RepType == X_XIGetFocus) + SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep); + else { + FatalError("XINPUT confused sending swapped reply"); + } +} + +/************************************************************************ + * + * This function swaps the DeviceValuator event. + * + */ + +static void +SEventDeviceValuator(deviceValuator * from, deviceValuator * to) +{ + char n; + int i; + INT32 *ip B32; + + *to = *from; + swaps(&to->sequenceNumber, n); + swaps(&to->device_state, n); + ip = &to->valuator0; + for (i = 0; i < 6; i++) { + swapl((ip + i), n); /* macro - braces are required */ + } +} + +static void +SEventFocus(deviceFocus * from, deviceFocus * to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber, n); + swapl(&to->time, n); + swapl(&to->window, n); +} + +static void +SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) +{ + int i; + char n; + INT32 *ip B32; + + *to = *from; + swaps(&to->sequenceNumber, n); + swapl(&to->time, n); + ip = &to->valuator0; + for (i = 0; i < 3; i++) { + swapl((ip + i), n); /* macro - braces are required */ + } +} + +static void +SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from, + deviceKeyStateNotify * to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber, n); +} + +static void +SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, + deviceButtonStateNotify * to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber, n); +} + +static void +SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber, n); + swapl(&to->time, n); +} + +static void +SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber, n); + swapl(&to->time, n); +} + +static void +SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber,n); + swapl(&to->time, n); + swaps(&to->control, n); +} + +static void +SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber,n); + swapl(&to->time, n); + swapl(&to->atom, n); +} + +static void +SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber,n); + swapl(&to->length, n); + swaps(&to->evtype, n); + swaps(&to->deviceid, n); + swapl(&to->time, n); + swapl(&to->root, n); + swapl(&to->event, n); + swapl(&to->child, n); + swapl(&to->root_x, n); + swapl(&to->root_y, n); + swapl(&to->event_x, n); + swapl(&to->event_y, n); + swaps(&to->sourceid, n); + swaps(&to->buttons_len, n); + swapl(&to->mods.base_mods, n); + swapl(&to->mods.latched_mods, n); + swapl(&to->mods.locked_mods, n); +} + +static void +SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to) +{ + char n; + int i, j; + xXIAnyInfo *any; + + *to = *from; + memcpy(&to[1], &from[1], from->length * 4); + + any = (xXIAnyInfo*)&to[1]; + for (i = 0; i < to->num_classes; i++) + { + int length = any->length; + + switch(any->type) + { + case KeyClass: + { + xXIKeyInfo *ki = (xXIKeyInfo*)any; + uint32_t *key = (uint32_t*)&ki[1]; + for (j = 0; j < ki->num_keycodes; j++, key++) + swapl(key, n); + swaps(&ki->num_keycodes, n); + } + break; + case ButtonClass: + { + xXIButtonInfo *bi = (xXIButtonInfo*)any; + Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) + + pad_to_int32(bits_to_bytes(bi->num_buttons))); + for (j = 0; j < bi->num_buttons; j++) + swapl(&labels[j], n); + swaps(&bi->num_buttons, n); + } + break; + case ValuatorClass: + { + xXIValuatorInfo* ai = (xXIValuatorInfo*)any; + swapl(&ai->label, n); + swapl(&ai->min.integral, n); + swapl(&ai->min.frac, n); + swapl(&ai->max.integral, n); + swapl(&ai->max.frac, n); + swapl(&ai->resolution, n); + swaps(&ai->number, n); + } + break; + } + + swaps(&any->type, n); + swaps(&any->length, n); + swaps(&any->sourceid, n); + + any = (xXIAnyInfo*)((char*)any + length * 4); + } + + swaps(&to->sequenceNumber, n); + swapl(&to->length, n); + swaps(&to->evtype, n); + swaps(&to->deviceid, n); + swapl(&to->time, n); + swaps(&to->num_classes, n); + swaps(&to->sourceid, n); + +} + +static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to) +{ + int i; + char n; + char *ptr; + char *vmask; + + memcpy(to, from, sizeof(xEvent) + from->length * 4); + + swaps(&to->sequenceNumber, n); + swapl(&to->length, n); + swaps(&to->evtype, n); + swaps(&to->deviceid, n); + swapl(&to->time, n); + swapl(&to->detail, n); + swapl(&to->root, n); + swapl(&to->event, n); + swapl(&to->child, n); + swapl(&to->root_x, n); + swapl(&to->root_y, n); + swapl(&to->event_x, n); + swapl(&to->event_y, n); + swaps(&to->buttons_len, n); + swaps(&to->valuators_len, n); + swaps(&to->sourceid, n); + swapl(&to->mods.base_mods, n); + swapl(&to->mods.latched_mods, n); + swapl(&to->mods.locked_mods, n); + swapl(&to->mods.effective_mods, n); + swapl(&to->flags, n); + + ptr = (char*)(&to[1]); + ptr += from->buttons_len * 4; + vmask = ptr; /* valuator mask */ + ptr += from->valuators_len * 4; + for (i = 0; i < from->valuators_len * 32; i++) + { + if (BitIsOn(vmask, i)) + { + swapl(((uint32_t*)ptr), n); + ptr += 4; + swapl(((uint32_t*)ptr), n); + ptr += 4; + } + } +} + +static void SDeviceHierarchyEvent(xXIHierarchyEvent *from, + xXIHierarchyEvent *to) +{ + int i; + char n; + xXIHierarchyInfo *info; + + *to = *from; + memcpy(&to[1], &from[1], from->length * 4); + swaps(&to->sequenceNumber, n); + swapl(&to->length, n); + swaps(&to->evtype, n); + swaps(&to->deviceid, n); + swapl(&to->time, n); + swapl(&to->flags, n); + swaps(&to->num_info, n); + + info = (xXIHierarchyInfo*)&to[1]; + for (i = 0; i< from->num_info; i++) + { + swaps(&info->deviceid, n); + swaps(&info->attachment, n); + info++; + } +} + +static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber, n); + swapl(&to->length, n); + swaps(&to->evtype, n); + swaps(&to->deviceid, n); + swapl(&to->property, n); +} + +static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to) +{ + char n; + int i; + FP3232 *values; + unsigned char *mask; + + memcpy(to, from, sizeof(xEvent) + from->length * 4); + + swaps(&to->sequenceNumber, n); + swapl(&to->length, n); + swaps(&to->evtype, n); + swaps(&to->deviceid, n); + swapl(&to->time, n); + swapl(&to->detail, n); + + + mask = (unsigned char*)&to[1]; + values = (FP3232*)(mask + from->valuators_len * 4); + + for (i = 0; i < from->valuators_len * 4 * 8; i++) + { + if (BitIsOn(mask, i)) + { + /* for each bit set there are two FP3232 values on the wire, in + * the order abcABC for data and data_raw. Here we swap as if + * they were in aAbBcC order because it's easier and really + * doesn't matter. + */ + swapl(&values->integral, n); + swapl(&values->frac, n); + values++; + swapl(&values->integral, n); + swapl(&values->frac, n); + values++; + } + } + + swaps(&to->valuators_len, n); +} + + +/** Event swapping function for XI2 events. */ +void +XI2EventSwap(xGenericEvent *from, xGenericEvent *to) +{ + switch(from->evtype) + { + case XI_Enter: + case XI_Leave: + SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to); + break; + case XI_DeviceChanged: + SDeviceChangedEvent((xXIDeviceChangedEvent*)from, + (xXIDeviceChangedEvent*)to); + break; + case XI_HierarchyChanged: + SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to); + break; + case XI_PropertyEvent: + SXIPropertyEvent((xXIPropertyEvent*)from, + (xXIPropertyEvent*)to); + break; + case XI_Motion: + case XI_KeyPress: + case XI_KeyRelease: + case XI_ButtonPress: + case XI_ButtonRelease: + SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to); + break; + case XI_RawMotion: + case XI_RawKeyPress: + case XI_RawKeyRelease: + case XI_RawButtonPress: + case XI_RawButtonRelease: + SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to); + break; + default: + ErrorF("[Xi] Unknown event type to swap. This is a bug.\n"); + break; + } +} + +/************************************************************************** + * + * Allow the specified event to have its propagation suppressed. + * The default is to not allow suppression of propagation. + * + */ + +static void +AllowPropagateSuppress(Mask mask) +{ + int i; + + for (i = 0; i < MAXDEVICES; i++) + PropagateMask[i] |= mask; +} + +/************************************************************************** + * + * Record an event mask where there is no unique corresponding event type. + * We can't call SetMaskForEvent, since that would clobber the existing + * mask for that event. MotionHint and ButtonMotion are examples. + * + * Since extension event types will never be less than 64, we can use + * 0-63 in the EventInfo array as the "type" to be used to look up this + * mask. This means that the corresponding macros such as + * DevicePointerMotionHint must have access to the same constants. + * + */ + +static void +SetEventInfo(Mask mask, int constant) +{ + EventInfo[ExtEventIndex].mask = mask; + EventInfo[ExtEventIndex++].type = constant; +} + +/************************************************************************** + * + * Allow the specified event to be restricted to being selected by one + * client at a time. + * The default is to allow more than one client to select the event. + * + */ + +static void +SetExclusiveAccess(Mask mask) +{ + int i; + + for (i = 0; i < MAXDEVICES; i++) + ExtExclusiveMasks[i] |= mask; +} + +/************************************************************************** + * + * Assign the specified mask to the specified event. + * + */ + +static void +SetMaskForExtEvent(Mask mask, int event) +{ + int i; + + EventInfo[ExtEventIndex].mask = mask; + EventInfo[ExtEventIndex++].type = event; + + if ((event < LASTEvent) || (event >= 128)) + FatalError("MaskForExtensionEvent: bogus event number"); + + for (i = 0; i < MAXDEVICES; i++) + SetMaskForEvent(i, mask, event); +} + +/************************************************************************ + * + * This function sets up extension event types and masks. + * + */ + +static void +FixExtensionEvents(ExtensionEntry * extEntry) +{ + DeviceValuator = extEntry->eventBase; + DeviceKeyPress = DeviceValuator + 1; + DeviceKeyRelease = DeviceKeyPress + 1; + DeviceButtonPress = DeviceKeyRelease + 1; + DeviceButtonRelease = DeviceButtonPress + 1; + DeviceMotionNotify = DeviceButtonRelease + 1; + DeviceFocusIn = DeviceMotionNotify + 1; + DeviceFocusOut = DeviceFocusIn + 1; + ProximityIn = DeviceFocusOut + 1; + ProximityOut = ProximityIn + 1; + DeviceStateNotify = ProximityOut + 1; + DeviceMappingNotify = DeviceStateNotify + 1; + ChangeDeviceNotify = DeviceMappingNotify + 1; + DeviceKeyStateNotify = ChangeDeviceNotify + 1; + DeviceButtonStateNotify = DeviceKeyStateNotify + 1; + DevicePresenceNotify = DeviceButtonStateNotify + 1; + DevicePropertyNotify = DevicePresenceNotify + 1; + + event_base[KeyClass] = DeviceKeyPress; + event_base[ButtonClass] = DeviceButtonPress; + event_base[ValuatorClass] = DeviceMotionNotify; + event_base[ProximityClass] = ProximityIn; + event_base[FocusClass] = DeviceFocusIn; + event_base[OtherClass] = DeviceStateNotify; + + BadDevice += extEntry->errorBase; + BadEvent += extEntry->errorBase; + BadMode += extEntry->errorBase; + DeviceBusy += extEntry->errorBase; + BadClass += extEntry->errorBase; + + SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress); + AllowPropagateSuppress(DeviceKeyPressMask); + SetCriticalEvent(DeviceKeyPress); + + SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease); + AllowPropagateSuppress(DeviceKeyReleaseMask); + SetCriticalEvent(DeviceKeyRelease); + + SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress); + AllowPropagateSuppress(DeviceButtonPressMask); + SetCriticalEvent(DeviceButtonPress); + + SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease); + AllowPropagateSuppress(DeviceButtonReleaseMask); + SetCriticalEvent(DeviceButtonRelease); + + SetMaskForExtEvent(DeviceProximityMask, ProximityIn); + SetMaskForExtEvent(DeviceProximityMask, ProximityOut); + + SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify); + + SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify); + AllowPropagateSuppress(DevicePointerMotionMask); + SetCriticalEvent(DeviceMotionNotify); + + SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint); + SetEventInfo(DeviceButton1MotionMask, _deviceButton1Motion); + SetEventInfo(DeviceButton2MotionMask, _deviceButton2Motion); + SetEventInfo(DeviceButton3MotionMask, _deviceButton3Motion); + SetEventInfo(DeviceButton4MotionMask, _deviceButton4Motion); + SetEventInfo(DeviceButton5MotionMask, _deviceButton5Motion); + SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion); + + SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn); + SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut); + + SetMaskForExtEvent(DeviceMappingNotifyMask, DeviceMappingNotify); + SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify); + + SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab); + SetExclusiveAccess(DeviceButtonGrabMask); + + SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton); + SetEventInfo(DevicePresenceNotifyMask, _devicePresence); + SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify); + + SetEventInfo(0, _noExtensionEvent); +} + +/************************************************************************ + * + * This function restores extension event types and masks to their + * initial state. + * + */ + +static void +RestoreExtensionEvents(void) +{ + int i, j; + + IReqCode = 0; + IEventBase = 0; + + for (i = 0; i < ExtEventIndex - 1; i++) { + if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128)) + { + for (j = 0; j < MAXDEVICES; j++) + SetMaskForEvent(j, 0, EventInfo[i].type); + } + EventInfo[i].mask = 0; + EventInfo[i].type = 0; + } + ExtEventIndex = 0; + DeviceValuator = 0; + DeviceKeyPress = 1; + DeviceKeyRelease = 2; + DeviceButtonPress = 3; + DeviceButtonRelease = 4; + DeviceMotionNotify = 5; + DeviceFocusIn = 6; + DeviceFocusOut = 7; + ProximityIn = 8; + ProximityOut = 9; + DeviceStateNotify = 10; + DeviceMappingNotify = 11; + ChangeDeviceNotify = 12; + DeviceKeyStateNotify = 13; + DeviceButtonStateNotify = 13; + DevicePresenceNotify = 14; + DevicePropertyNotify = 15; + + BadDevice = 0; + BadEvent = 1; + BadMode = 2; + DeviceBusy = 3; + BadClass = 4; + +} + +/*********************************************************************** + * + * IResetProc. + * Remove reply-swapping routine. + * Remove event-swapping routine. + * + */ + +static void +IResetProc(ExtensionEntry * unused) +{ + ReplySwapVector[IReqCode] = ReplyNotSwappd; + EventSwapVector[DeviceValuator] = NotImplemented; + EventSwapVector[DeviceKeyPress] = NotImplemented; + EventSwapVector[DeviceKeyRelease] = NotImplemented; + EventSwapVector[DeviceButtonPress] = NotImplemented; + EventSwapVector[DeviceButtonRelease] = NotImplemented; + EventSwapVector[DeviceMotionNotify] = NotImplemented; + EventSwapVector[DeviceFocusIn] = NotImplemented; + EventSwapVector[DeviceFocusOut] = NotImplemented; + EventSwapVector[ProximityIn] = NotImplemented; + EventSwapVector[ProximityOut] = NotImplemented; + EventSwapVector[DeviceStateNotify] = NotImplemented; + EventSwapVector[DeviceKeyStateNotify] = NotImplemented; + EventSwapVector[DeviceButtonStateNotify] = NotImplemented; + EventSwapVector[DeviceMappingNotify] = NotImplemented; + EventSwapVector[ChangeDeviceNotify] = NotImplemented; + EventSwapVector[DevicePresenceNotify] = NotImplemented; + EventSwapVector[DevicePropertyNotify] = NotImplemented; + RestoreExtensionEvents(); +} + + +/*********************************************************************** + * + * Assign an id and type to an input device. + * + */ + +void +AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name) +{ + dev->xinput_type = type; + dev->name = strdup(name); +} + +/*********************************************************************** + * + * Make device type atoms. + * + */ + +static void +MakeDeviceTypeAtoms(void) +{ + int i; + + for (i = 0; i < NUMTYPES; i++) + dev_type[i].type = + MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1); +} + +/***************************************************************************** + * + * SEventIDispatch + * + * Swap any events defined in this extension. + */ +#define DO_SWAP(func,type) func ((type *)from, (type *)to) + +static void +SEventIDispatch(xEvent * from, xEvent * to) +{ + int type = from->u.u.type & 0177; + + if (type == DeviceValuator) + DO_SWAP(SEventDeviceValuator, deviceValuator); + else if (type == DeviceKeyPress) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceKeyRelease) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceButtonPress) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceButtonRelease) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceMotionNotify) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceFocusIn) + DO_SWAP(SEventFocus, deviceFocus); + else if (type == DeviceFocusOut) + DO_SWAP(SEventFocus, deviceFocus); + else if (type == ProximityIn) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == ProximityOut) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceStateNotify) + DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); + else if (type == DeviceKeyStateNotify) + DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); + else if (type == DeviceButtonStateNotify) + DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); + else if (type == DeviceMappingNotify) + DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); + else if (type == ChangeDeviceNotify) + DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); + else if (type == DevicePresenceNotify) + DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify); + else if (type == DevicePropertyNotify) + DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify); + else { + FatalError("XInputExtension: Impossible event!\n"); + } +} + +/********************************************************************** + * + * IExtensionInit - initialize the input extension. + * + * Called from InitExtensions in main() or from QueryExtension() if the + * extension is dynamically loaded. + * + * This extension has several events and errors. + * + * XI is mandatory nowadays, so if we fail to init XI, we die. + */ + +void +XInputExtensionInit(void) +{ + ExtensionEntry *extEntry; + XExtensionVersion thisversion = { XI_Present, + SERVER_XI_MAJOR_VERSION, + SERVER_XI_MINOR_VERSION, + }; + + if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec))) + FatalError("Cannot request private for XI.\n"); + + if (!AddCallback(&ClientStateCallback, XIClientCallback, 0)) + FatalError("Failed to add callback to XI.\n"); + + extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, + SProcIDispatch, IResetProc, StandardMinorOpcode); + if (extEntry) { + IReqCode = extEntry->base; + IEventBase = extEntry->eventBase; + XIVersion = thisversion; + MakeDeviceTypeAtoms(); + RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone, + "INPUTCLIENT"); + if (!RT_INPUTCLIENT) + FatalError("Failed to add resource type for XI.\n"); + FixExtensionEvents(extEntry); + ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; + EventSwapVector[DeviceValuator] = SEventIDispatch; + EventSwapVector[DeviceKeyPress] = SEventIDispatch; + EventSwapVector[DeviceKeyRelease] = SEventIDispatch; + EventSwapVector[DeviceButtonPress] = SEventIDispatch; + EventSwapVector[DeviceButtonRelease] = SEventIDispatch; + EventSwapVector[DeviceMotionNotify] = SEventIDispatch; + EventSwapVector[DeviceFocusIn] = SEventIDispatch; + EventSwapVector[DeviceFocusOut] = SEventIDispatch; + EventSwapVector[ProximityIn] = SEventIDispatch; + EventSwapVector[ProximityOut] = SEventIDispatch; + EventSwapVector[DeviceStateNotify] = SEventIDispatch; + EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; + EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; + EventSwapVector[DeviceMappingNotify] = SEventIDispatch; + EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; + EventSwapVector[DevicePresenceNotify] = SEventIDispatch; + + GERegisterExtension(IReqCode, XI2EventSwap); + + + memset(&xi_all_devices, 0, sizeof(xi_all_devices)); + memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices)); + xi_all_devices.id = XIAllDevices; + xi_all_devices.name = "XIAllDevices"; + xi_all_master_devices.id = XIAllMasterDevices; + xi_all_master_devices.name = "XIAllMasterDevices"; + + inputInfo.all_devices = &xi_all_devices; + inputInfo.all_master_devices = &xi_all_master_devices; + + XIResetProperties(); + } else { + FatalError("IExtensionInit: AddExtensions failed\n"); + } +} + diff --git a/xorg-server/Xi/xiwarppointer.c b/xorg-server/Xi/xiwarppointer.c index 7276e6faf..c01b115f3 100644 --- a/xorg-server/Xi/xiwarppointer.c +++ b/xorg-server/Xi/xiwarppointer.c @@ -192,6 +192,8 @@ ProcXIWarpPointer(ClientPtr client) /* if we don't update the device, we get a jump next time it moves */ pDev->last.valuators[0] = x; pDev->last.valuators[1] = y; + pDev->last.remainder[0] = 0; + pDev->last.remainder[1] = 0; miPointerUpdateSprite(pDev); /* FIXME: XWarpPointer is supposed to generate an event. It doesn't do it diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index 45286eaf4..120321e7c 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -1903,8 +1903,8 @@ AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes]) AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && false]) -AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes && false]) -AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false]) +AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes]) +AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes]) diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c index 361d6102a..07f8b05ea 100644 --- a/xorg-server/dix/events.c +++ b/xorg-server/dix/events.c @@ -1,5819 +1,5813 @@ -/************************************************************ - -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. - -********************************************************/ - -/* The panoramix components contained the following notice */ -/***************************************************************** - -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. - -******************************************************************/ - -/* - * Copyright (c) 2003-2005, Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** @file events.c - * This file handles event delivery and a big part of the server-side protocol - * handling (the parts for input devices). - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include "misc.h" -#include "resource.h" -#include -#include "windowstr.h" -#include "inputstr.h" -#include "scrnintstr.h" -#include "cursorstr.h" - -#include "dixstruct.h" -#ifdef PANORAMIX -#include "panoramiX.h" -#include "panoramiXsrv.h" -#endif -#include "globals.h" - -#include -#include "xkbsrv.h" -#include "xace.h" - -#ifdef XSERVER_DTRACE -#include -typedef const char *string; -#include "Xserver-dtrace.h" -#endif - -#include -#include -#include -#include -#include "exglobals.h" -#include "exevents.h" -#include "exglobals.h" -#include "extnsionst.h" - -#include "dixevents.h" -#include "dixgrabs.h" -#include "dispatch.h" - -#include -#include "geext.h" -#include "geint.h" - -#include "eventstr.h" -#include "enterleave.h" -#include "eventconvert.h" - -/* Extension events type numbering starts at EXTENSION_EVENT_BASE. */ -#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ -#define StructureAndSubMask ( StructureNotifyMask | SubstructureNotifyMask ) -#define AllButtonsMask ( \ - Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) -#define MotionMask ( \ - PointerMotionMask | Button1MotionMask | \ - Button2MotionMask | Button3MotionMask | Button4MotionMask | \ - Button5MotionMask | ButtonMotionMask ) -#define PropagateMask ( \ - KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \ - MotionMask ) -#define PointerGrabMask ( \ - ButtonPressMask | ButtonReleaseMask | \ - EnterWindowMask | LeaveWindowMask | \ - PointerMotionHintMask | KeymapStateMask | \ - MotionMask ) -#define AllModifiersMask ( \ - ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ - Mod3Mask | Mod4Mask | Mod5Mask ) -#define LastEventMask OwnerGrabButtonMask -#define AllEventMasks (LastEventMask|(LastEventMask-1)) - - -#define CORE_EVENT(event) \ - (!((event)->u.u.type & EXTENSION_EVENT_BASE) && \ - (event)->u.u.type != GenericEvent) -#define XI2_EVENT(event) \ - (((event)->u.u.type == GenericEvent) && \ - ((xGenericEvent*)(event))->extension == IReqCode) - -/** - * Used to indicate a implicit passive grab created by a ButtonPress event. - * See DeliverEventsToWindow(). - */ -#define ImplicitGrabMask (1 << 7) - -#define WID(w) ((w) ? ((w)->drawable.id) : 0) - -#define XE_KBPTR (xE->u.keyButtonPointer) - - -CallbackListPtr EventCallback; -CallbackListPtr DeviceEventCallback; - -#define DNPMCOUNT 8 - -Mask DontPropagateMasks[DNPMCOUNT]; -static int DontPropagateRefCnts[DNPMCOUNT]; - -static void CheckVirtualMotion( DeviceIntPtr pDev, QdEventPtr qe, WindowPtr pWin); -static void CheckPhysLimits(DeviceIntPtr pDev, - CursorPtr cursor, - Bool generateEvents, - Bool confineToScreen, - ScreenPtr pScreen); -static Bool CheckPassiveGrabsOnWindow(WindowPtr pWin, - DeviceIntPtr device, - DeviceEvent *event, - BOOL checkCore); - -/** Key repeat hack. Do not use but in TryClientEvents */ -extern BOOL EventIsKeyRepeat(xEvent *event); - -/** - * Main input device struct. - * inputInfo.pointer - * is the core pointer. Referred to as "virtual core pointer", "VCP", - * "core pointer" or inputInfo.pointer. The VCP is the first master - * pointer device and cannot be deleted. - * - * inputInfo.keyboard - * is the core keyboard ("virtual core keyboard", "VCK", "core keyboard"). - * See inputInfo.pointer. - * - * inputInfo.devices - * linked list containing all devices including VCP and VCK. - * - * inputInfo.off_devices - * Devices that have not been initialized and are thus turned off. - * - * inputInfo.numDevices - * Total number of devices. - * - * inputInfo.all_devices - * Virtual device used for XIAllDevices passive grabs. This device is - * not part of the inputInfo.devices list and mostly unset except for - * the deviceid. It exists because passivegrabs need a valid device - * reference. - * - * inputInfo.all_master_devices - * Virtual device used for XIAllMasterDevices passive grabs. This device - * is not part of the inputInfo.devices list and mostly unset except for - * the deviceid. It exists because passivegrabs need a valid device - * reference. - */ -InputInfo inputInfo; - -EventSyncInfoRec syncEvents; - -/** - * The root window the given device is currently on. - */ -#define RootWindow(dev) dev->spriteInfo->sprite->spriteTrace[0] - -static xEvent* swapEvent = NULL; -static int swapEventLen = 0; - -void -NotImplemented(xEvent *from, xEvent *to) -{ - FatalError("Not implemented"); -} - -/** - * Convert the given event type from an XI event to a core event. - * @param[in] The XI 1.x event type. - * @return The matching core event type or 0 if there is none. - */ -int -XItoCoreType(int xitype) -{ - int coretype = 0; - if (xitype == DeviceMotionNotify) - coretype = MotionNotify; - else if (xitype == DeviceButtonPress) - coretype = ButtonPress; - else if (xitype == DeviceButtonRelease) - coretype = ButtonRelease; - else if (xitype == DeviceKeyPress) - coretype = KeyPress; - else if (xitype == DeviceKeyRelease) - coretype = KeyRelease; - - return coretype; -} - -/** - * @return true if the device owns a cursor, false if device shares a cursor - * sprite with another device. - */ -Bool -DevHasCursor(DeviceIntPtr pDev) -{ - return pDev->spriteInfo->spriteOwner; -} - -/* - * @return true if a device is a pointer, check is the same as used by XI to - * fill the 'use' field. - */ -Bool -IsPointerDevice(DeviceIntPtr dev) -{ - return (dev->type == MASTER_POINTER) || - (dev->valuator && dev->button) || - (dev->valuator && !dev->key); -} - -/* - * @return true if a device is a keyboard, check is the same as used by XI to - * fill the 'use' field. - * - * Some pointer devices have keys as well (e.g. multimedia keys). Try to not - * count them as keyboard devices. - */ -Bool -IsKeyboardDevice(DeviceIntPtr dev) -{ - return (dev->type == MASTER_KEYBOARD) || - ((dev->key && dev->kbdfeed) && !IsPointerDevice(dev)); -} - -Bool -IsMaster(DeviceIntPtr dev) -{ - return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD; -} - -static WindowPtr XYToWindow( - DeviceIntPtr pDev, - int x, - int y -); - -/** - * Max event opcode. - */ -extern int lastEvent; - -extern int DeviceMotionNotify; - -#define CantBeFiltered NoEventMask -/** - * Event masks for each event type. - * - * One set of filters for each device, but only the first layer - * is initialized. The rest is memcpy'd in InitEvents. - * - * Filters are used whether a given event may be delivered to a client, - * usually in the form of if (window-event-mask & filter); then deliver event. - * - * One notable filter is for PointerMotion/DevicePointerMotion events. Each - * time a button is pressed, the filter is modified to also contain the - * matching ButtonXMotion mask. - */ -static Mask filters[MAXDEVICES][128] = { -{ - NoSuchEvent, /* 0 */ - NoSuchEvent, /* 1 */ - KeyPressMask, /* KeyPress */ - KeyReleaseMask, /* KeyRelease */ - ButtonPressMask, /* ButtonPress */ - ButtonReleaseMask, /* ButtonRelease */ - PointerMotionMask, /* MotionNotify (initial state) */ - EnterWindowMask, /* EnterNotify */ - LeaveWindowMask, /* LeaveNotify */ - FocusChangeMask, /* FocusIn */ - FocusChangeMask, /* FocusOut */ - KeymapStateMask, /* KeymapNotify */ - ExposureMask, /* Expose */ - CantBeFiltered, /* GraphicsExpose */ - CantBeFiltered, /* NoExpose */ - VisibilityChangeMask, /* VisibilityNotify */ - SubstructureNotifyMask, /* CreateNotify */ - StructureAndSubMask, /* DestroyNotify */ - StructureAndSubMask, /* UnmapNotify */ - StructureAndSubMask, /* MapNotify */ - SubstructureRedirectMask, /* MapRequest */ - StructureAndSubMask, /* ReparentNotify */ - StructureAndSubMask, /* ConfigureNotify */ - SubstructureRedirectMask, /* ConfigureRequest */ - StructureAndSubMask, /* GravityNotify */ - ResizeRedirectMask, /* ResizeRequest */ - StructureAndSubMask, /* CirculateNotify */ - SubstructureRedirectMask, /* CirculateRequest */ - PropertyChangeMask, /* PropertyNotify */ - CantBeFiltered, /* SelectionClear */ - CantBeFiltered, /* SelectionRequest */ - CantBeFiltered, /* SelectionNotify */ - ColormapChangeMask, /* ColormapNotify */ - CantBeFiltered, /* ClientMessage */ - CantBeFiltered /* MappingNotify */ -}}; - -/** - * For the given event, return the matching event filter. This filter may then - * be AND'ed with the selected event mask. - * - * For XI2 events, the returned filter is simply the byte containing the event - * mask we're interested in. E.g. for a mask of (1 << 13), this would be - * byte[1]. - * - * @param[in] dev The device the event belongs to, may be NULL. - * @param[in] event The event to get the filter for. Only the type of the - * event matters, or the extension + evtype for GenericEvents. - * @return The filter mask for the given event. - * - * @see GetEventMask - */ -Mask -GetEventFilter(DeviceIntPtr dev, xEvent *event) -{ - if (event->u.u.type != GenericEvent) - return filters[dev ? dev->id : 0][event->u.u.type]; - else if (XI2_EVENT(event)) - return (1 << (((xXIDeviceEvent*)event)->evtype % 8)); - ErrorF("[dix] Unknown device type %d. No filter\n", event->u.u.type); - return 0; -} - -/** - * Return the windows complete XI2 mask for the given XI2 event type. - */ -Mask -GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev) -{ - OtherInputMasks *inputMasks = wOtherInputMasks(win); - int filter; - int evtype; - - if (!inputMasks || !XI2_EVENT(ev)) - return 0; - - evtype = ((xGenericEvent*)ev)->evtype; - filter = GetEventFilter(dev, ev); - - return ((inputMasks->xi2mask[dev->id][evtype/8] & filter) || - inputMasks->xi2mask[XIAllDevices][evtype/8] || - (inputMasks->xi2mask[XIAllMasterDevices][evtype/8] && IsMaster(dev))); -} - -static Mask -GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients* other) -{ - /* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */ - if (XI2_EVENT(event)) - { - int byte = ((xGenericEvent*)event)->evtype / 8; - return (other->xi2mask[dev->id][byte] | - other->xi2mask[XIAllDevices][byte] | - (IsMaster(dev)? other->xi2mask[XIAllMasterDevices][byte] : 0)); - } else if (CORE_EVENT(event)) - return other->mask[XIAllDevices]; - else - return other->mask[dev->id]; -} - - -static CARD8 criticalEvents[32] = -{ - 0x7c, 0x30, 0x40 /* key, button, expose, and configure events */ -}; - -static void -SyntheticMotion(DeviceIntPtr dev, int x, int y) { - int screenno = 0; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - screenno = dev->spriteInfo->sprite->screen->myNum; -#endif - PostSyntheticMotion(dev, x, y, screenno, - (syncEvents.playingEvents) ? syncEvents.time.milliseconds : currentTime.milliseconds); - -} - -#ifdef PANORAMIX -static void PostNewCursor(DeviceIntPtr pDev); - -static Bool -pointOnScreen(ScreenPtr pScreen, int x, int y) -{ - return x >= pScreen->x && x < pScreen->x + pScreen->width && - y >= pScreen->y && y < pScreen->y + pScreen->height; -} - -static Bool -XineramaSetCursorPosition( - DeviceIntPtr pDev, - int x, - int y, - Bool generateEvent -){ - ScreenPtr pScreen; - int i; - SpritePtr pSprite = pDev->spriteInfo->sprite; - - /* x,y are in Screen 0 coordinates. We need to decide what Screen - to send the message too and what the coordinates relative to - that screen are. */ - - pScreen = pSprite->screen; - x += screenInfo.screens[0]->x; - y += screenInfo.screens[0]->y; - - if(!pointOnScreen(pScreen, x, y)) - { - FOR_NSCREENS(i) - { - if(i == pScreen->myNum) - continue; - if(pointOnScreen(screenInfo.screens[i], x, y)) - { - pScreen = screenInfo.screens[i]; - break; - } - } - } - - pSprite->screen = pScreen; - pSprite->hotPhys.x = x - screenInfo.screens[0]->x; - pSprite->hotPhys.y = y - screenInfo.screens[0]->y; - x -= pScreen->x; - y -= pScreen->y; - - return (*pScreen->SetCursorPosition)(pDev, pScreen, x, y, generateEvent); -} - - -static void -XineramaConstrainCursor(DeviceIntPtr pDev) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - ScreenPtr pScreen; - BoxRec newBox; - - pScreen = pSprite->screen; - newBox = pSprite->physLimits; - - /* Translate the constraining box to the screen - the sprite is actually on */ - newBox.x1 += screenInfo.screens[0]->x - pScreen->x; - newBox.x2 += screenInfo.screens[0]->x - pScreen->x; - newBox.y1 += screenInfo.screens[0]->y - pScreen->y; - newBox.y2 += screenInfo.screens[0]->y - pScreen->y; - - (* pScreen->ConstrainCursor)(pDev, pScreen, &newBox); -} - - -static Bool -XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - - if(pWin == screenInfo.screens[0]->root) { - int i; - for (i = 0; i < PanoramiXNumScreens; i++) - pSprite->windows[i] = screenInfo.screens[i]->root; - } else { - PanoramiXRes *win; - int rc, i; - - rc = dixLookupResourceByType((pointer *)&win, pWin->drawable.id, - XRT_WINDOW, serverClient, DixReadAccess); - if (rc != Success) - return FALSE; - - for(i = 0; i < PanoramiXNumScreens; i++) { - rc = dixLookupWindow(pSprite->windows + i, win->info[i].id, - serverClient, DixReadAccess); - if (rc != Success) /* window is being unmapped */ - return FALSE; - } - } - return TRUE; -} - -static void -XineramaConfineCursorToWindow(DeviceIntPtr pDev, - WindowPtr pWin, - Bool generateEvents) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - - int x, y, off_x, off_y, i; - - if(!XineramaSetWindowPntrs(pDev, pWin)) - return; - - i = PanoramiXNumScreens - 1; - - RegionCopy(&pSprite->Reg1, - &pSprite->windows[i]->borderSize); - off_x = screenInfo.screens[i]->x; - off_y = screenInfo.screens[i]->y; - - while(i--) { - x = off_x - screenInfo.screens[i]->x; - y = off_y - screenInfo.screens[i]->y; - - if(x || y) - RegionTranslate(&pSprite->Reg1, x, y); - - RegionUnion(&pSprite->Reg1, &pSprite->Reg1, - &pSprite->windows[i]->borderSize); - - off_x = screenInfo.screens[i]->x; - off_y = screenInfo.screens[i]->y; - } - - pSprite->hotLimits = *RegionExtents(&pSprite->Reg1); - - if(RegionNumRects(&pSprite->Reg1) > 1) - pSprite->hotShape = &pSprite->Reg1; - else - pSprite->hotShape = NullRegion; - - pSprite->confined = FALSE; - pSprite->confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin; - - CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL); -} - -#endif /* PANORAMIX */ - -/** - * Modifies the filter for the given protocol event type to the given masks. - * - * There's only two callers: UpdateDeviceState() and XI's SetMaskForExtEvent(). - * The latter initialises masks for the matching XI events, it's a once-off - * setting. - * UDS however changes the mask for MotionNotify and DeviceMotionNotify each - * time a button is pressed to include the matching ButtonXMotion mask in the - * filter. - * - * @param[in] deviceid The device to modify the filter for. - * @param[in] mask The new filter mask. - * @param[in] event Protocol event type. - */ -void -SetMaskForEvent(int deviceid, Mask mask, int event) -{ - if (deviceid < 0 || deviceid >= MAXDEVICES) - FatalError("SetMaskForEvent: bogus device id"); - filters[deviceid][event] = mask; -} - -void -SetCriticalEvent(int event) -{ - if (event >= 128) - FatalError("SetCriticalEvent: bogus event number"); - criticalEvents[event >> 3] |= 1 << (event & 7); -} - -void -ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py) -{ - BoxRec box; - int x = *px, y = *py; - int incx = 1, incy = 1; - SpritePtr pSprite; - - pSprite = pDev->spriteInfo->sprite; - if (RegionContainsPoint(shape, x, y, &box)) - return; - box = *RegionExtents(shape); - /* this is rather crude */ - do { - x += incx; - if (x >= box.x2) - { - incx = -1; - x = *px - 1; - } - else if (x < box.x1) - { - incx = 1; - x = *px; - y += incy; - if (y >= box.y2) - { - incy = -1; - y = *py - 1; - } - else if (y < box.y1) - return; /* should never get here! */ - } - } while (!RegionContainsPoint(shape, x, y, &box)); - *px = x; - *py = y; -} - -static void -CheckPhysLimits( - DeviceIntPtr pDev, - CursorPtr cursor, - Bool generateEvents, - Bool confineToScreen, /* unused if PanoramiX on */ - ScreenPtr pScreen) /* unused if PanoramiX on */ -{ - HotSpot new; - SpritePtr pSprite = pDev->spriteInfo->sprite; - - if (!cursor) - return; - new = pSprite->hotPhys; -#ifdef PANORAMIX - if (!noPanoramiXExtension) - /* I don't care what the DDX has to say about it */ - pSprite->physLimits = pSprite->hotLimits; - else -#endif - { - if (pScreen) - new.pScreen = pScreen; - else - pScreen = new.pScreen; - (*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits, - &pSprite->physLimits); - pSprite->confined = confineToScreen; - (* pScreen->ConstrainCursor)(pDev, pScreen, &pSprite->physLimits); - } - - /* constrain the pointer to those limits */ - if (new.x < pSprite->physLimits.x1) - new.x = pSprite->physLimits.x1; - else - if (new.x >= pSprite->physLimits.x2) - new.x = pSprite->physLimits.x2 - 1; - if (new.y < pSprite->physLimits.y1) - new.y = pSprite->physLimits.y1; - else - if (new.y >= pSprite->physLimits.y2) - new.y = pSprite->physLimits.y2 - 1; - if (pSprite->hotShape) - ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y); - if (( -#ifdef PANORAMIX - noPanoramiXExtension && -#endif - (pScreen != pSprite->hotPhys.pScreen)) || - (new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)) - { -#ifdef PANORAMIX - if (!noPanoramiXExtension) - XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents); - else -#endif - { - if (pScreen != pSprite->hotPhys.pScreen) - pSprite->hotPhys = new; - (*pScreen->SetCursorPosition) - (pDev, pScreen, new.x, new.y, generateEvents); - } - if (!generateEvents) - SyntheticMotion(pDev, new.x, new.y); - } - -#ifdef PANORAMIX - /* Tell DDX what the limits are */ - if (!noPanoramiXExtension) - XineramaConstrainCursor(pDev); -#endif -} - -static void -CheckVirtualMotion( - DeviceIntPtr pDev, - QdEventPtr qe, - WindowPtr pWin) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - RegionPtr reg = NULL; - DeviceEvent *ev = NULL; - - if (qe) - { - ev = &qe->event->device_event; - switch(ev->type) - { - case ET_Motion: - case ET_ButtonPress: - case ET_ButtonRelease: - case ET_KeyPress: - case ET_KeyRelease: - case ET_ProximityIn: - case ET_ProximityOut: - pSprite->hot.pScreen = qe->pScreen; - pSprite->hot.x = ev->root_x; - pSprite->hot.y = ev->root_y; - pWin = pDev->deviceGrab.grab ? pDev->deviceGrab.grab->confineTo : NullWindow; - break; - default: - break; - } - } - if (pWin) - { - BoxRec lims; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - int x, y, off_x, off_y, i; - - if(!XineramaSetWindowPntrs(pDev, pWin)) - return; - - i = PanoramiXNumScreens - 1; - - RegionCopy(&pSprite->Reg2, - &pSprite->windows[i]->borderSize); - off_x = screenInfo.screens[i]->x; - off_y = screenInfo.screens[i]->y; - - while(i--) { - x = off_x - screenInfo.screens[i]->x; - y = off_y - screenInfo.screens[i]->y; - - if(x || y) - RegionTranslate(&pSprite->Reg2, x, y); - - RegionUnion(&pSprite->Reg2, &pSprite->Reg2, - &pSprite->windows[i]->borderSize); - - off_x = screenInfo.screens[i]->x; - off_y = screenInfo.screens[i]->y; - } - } else -#endif - { - if (pSprite->hot.pScreen != pWin->drawable.pScreen) - { - pSprite->hot.pScreen = pWin->drawable.pScreen; - pSprite->hot.x = pSprite->hot.y = 0; - } - } - - lims = *RegionExtents(&pWin->borderSize); - if (pSprite->hot.x < lims.x1) - pSprite->hot.x = lims.x1; - else if (pSprite->hot.x >= lims.x2) - pSprite->hot.x = lims.x2 - 1; - if (pSprite->hot.y < lims.y1) - pSprite->hot.y = lims.y1; - else if (pSprite->hot.y >= lims.y2) - pSprite->hot.y = lims.y2 - 1; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - { - if (RegionNumRects(&pSprite->Reg2) > 1) - reg = &pSprite->Reg2; - - } else -#endif - { - if (wBoundingShape(pWin)) - reg = &pWin->borderSize; - } - - if (reg) - ConfineToShape(pDev, reg, &pSprite->hot.x, &pSprite->hot.y); - - if (qe && ev) - { - qe->pScreen = pSprite->hot.pScreen; - ev->root_x = pSprite->hot.x; - ev->root_y = pSprite->hot.y; - } - } -#ifdef PANORAMIX - if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */ -#endif - RootWindow(pDev) = pSprite->hot.pScreen->root; -} - -static void -ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bool confineToScreen) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - - if (syncEvents.playingEvents) - { - CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin); - SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y); - } - else - { -#ifdef PANORAMIX - if(!noPanoramiXExtension) { - XineramaConfineCursorToWindow(pDev, pWin, generateEvents); - return; - } -#endif - pSprite->hotLimits = *RegionExtents(&pWin->borderSize); - pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize - : NullRegion; - CheckPhysLimits(pDev, pSprite->current, generateEvents, - confineToScreen, pWin->drawable.pScreen); - } -} - -Bool -PointerConfinedToScreen(DeviceIntPtr pDev) -{ - return pDev->spriteInfo->sprite->confined; -} - -/** - * Update the sprite cursor to the given cursor. - * - * ChangeToCursor() will display the new cursor and free the old cursor (if - * applicable). If the provided cursor is already the updated cursor, nothing - * happens. - */ -static void -ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - ScreenPtr pScreen; - - if (cursor != pSprite->current) - { - if ((pSprite->current->bits->xhot != cursor->bits->xhot) || - (pSprite->current->bits->yhot != cursor->bits->yhot)) - CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined, - (ScreenPtr)NULL); -#ifdef PANORAMIX - /* XXX: is this really necessary?? (whot) */ - if (!noPanoramiXExtension) - pScreen = pSprite->screen; - else -#endif - pScreen = pSprite->hotPhys.pScreen; - - (*pScreen->DisplayCursor)(pDev, pScreen, cursor); - FreeCursor(pSprite->current, (Cursor)0); - pSprite->current = cursor; - pSprite->current->refcnt++; - } -} - -/** - * @returns true if b is a descendent of a - */ -Bool -IsParent(WindowPtr a, WindowPtr b) -{ - for (b = b->parent; b; b = b->parent) - if (b == a) return TRUE; - return FALSE; -} - -/** - * Update the cursor displayed on the screen. - * - * Called whenever a cursor may have changed shape or position. - */ -static void -PostNewCursor(DeviceIntPtr pDev) -{ - WindowPtr win; - GrabPtr grab = pDev->deviceGrab.grab; - SpritePtr pSprite = pDev->spriteInfo->sprite; - CursorPtr pCursor; - - if (syncEvents.playingEvents) - return; - if (grab) - { - if (grab->cursor) - { - ChangeToCursor(pDev, grab->cursor); - return; - } - if (IsParent(grab->window, pSprite->win)) - win = pSprite->win; - else - win = grab->window; - } - else - win = pSprite->win; - for (; win; win = win->parent) - { - if (win->optional) - { - pCursor = WindowGetDeviceCursor(win, pDev); - if (!pCursor && win->optional->cursor != NullCursor) - pCursor = win->optional->cursor; - if (pCursor) - { - ChangeToCursor(pDev, pCursor); - return; - } - } - } -} - - -/** - * @param dev device which you want to know its current root window - * @return root window where dev's sprite is located - */ -WindowPtr -GetCurrentRootWindow(DeviceIntPtr dev) -{ - return RootWindow(dev); -} - -/** - * @return window underneath the cursor sprite. - */ -WindowPtr -GetSpriteWindow(DeviceIntPtr pDev) -{ - return pDev->spriteInfo->sprite->win; -} - -/** - * @return current sprite cursor. - */ -CursorPtr -GetSpriteCursor(DeviceIntPtr pDev) -{ - return pDev->spriteInfo->sprite->current; -} - -/** - * Set x/y current sprite position in screen coordinates. - */ -void -GetSpritePosition(DeviceIntPtr pDev, int *px, int *py) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - *px = pSprite->hotPhys.x; - *py = pSprite->hotPhys.y; -} - -#ifdef PANORAMIX -int -XineramaGetCursorScreen(DeviceIntPtr pDev) -{ - if(!noPanoramiXExtension) { - return pDev->spriteInfo->sprite->screen->myNum; - } else { - return 0; - } -} -#endif /* PANORAMIX */ - -#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */ - -static void -MonthChangedOrBadTime(InternalEvent *ev) -{ - /* If the ddx/OS is careless about not processing timestamped events from - * different sources in sorted order, then it's possible for time to go - * backwards when it should not. Here we ensure a decent time. - */ - if ((currentTime.milliseconds - ev->any.time) > TIMESLOP) - currentTime.months++; - else - ev->any.time = currentTime.milliseconds; -} - -static void -NoticeTime(InternalEvent *ev) -{ - if (ev->any.time < currentTime.milliseconds) - MonthChangedOrBadTime(ev); - currentTime.milliseconds = ev->any.time; - lastDeviceEventTime = currentTime; -} - -void -NoticeEventTime(InternalEvent *ev) -{ - if (!syncEvents.playingEvents) - NoticeTime(ev); -} - -/************************************************************************** - * The following procedures deal with synchronous events * - **************************************************************************/ - -/** - * EnqueueEvent is a device's processInputProc if a device is frozen. - * Instead of delivering the events to the client, the event is tacked onto a - * linked list for later delivery. - */ -void -EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) -{ - QdEventPtr tail = *syncEvents.pendtail; - QdEventPtr qe; - SpritePtr pSprite = device->spriteInfo->sprite; - int eventlen; - DeviceEvent *event = &ev->device_event; - - NoticeTime((InternalEvent*)event); - - /* Fix for key repeating bug. */ - if (device->key != NULL && device->key->xkbInfo != NULL && - event->type == ET_KeyRelease) - AccessXCancelRepeatKey(device->key->xkbInfo, event->detail.key); - - if (DeviceEventCallback) - { - DeviceEventInfoRec eventinfo; - - /* The RECORD spec says that the root window field of motion events - * must be valid. At this point, it hasn't been filled in yet, so - * we do it here. The long expression below is necessary to get - * the current root window; the apparently reasonable alternative - * GetCurrentRootWindow()->drawable.id doesn't give you the right - * answer on the first motion event after a screen change because - * the data that GetCurrentRootWindow relies on hasn't been - * updated yet. - */ - if (ev->any.type == ET_Motion) - ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id; - - eventinfo.event = ev; - eventinfo.device = device; - CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo); - } - - if (event->type == ET_Motion) - { -#ifdef PANORAMIX - if(!noPanoramiXExtension) { - event->root_x += pSprite->screen->x - screenInfo.screens[0]->x; - event->root_y += pSprite->screen->y - screenInfo.screens[0]->y; - } -#endif - pSprite->hotPhys.x = event->root_x; - pSprite->hotPhys.y = event->root_y; - /* do motion compression, but not if from different devices */ - if (tail && - (tail->event->any.type == ET_Motion) && - (tail->device == device) && - (tail->pScreen == pSprite->hotPhys.pScreen)) - { - DeviceEvent *tailev = &tail->event->device_event; - tailev->root_x = pSprite->hotPhys.x; - tailev->root_y = pSprite->hotPhys.y; - tailev->time = event->time; - tail->months = currentTime.months; - return; - } - } - - eventlen = event->length; - - qe = malloc(sizeof(QdEventRec) + eventlen); - if (!qe) - return; - qe->next = (QdEventPtr)NULL; - qe->device = device; - qe->pScreen = pSprite->hotPhys.pScreen; - qe->months = currentTime.months; - qe->event = (InternalEvent *)(qe + 1); - memcpy(qe->event, event, eventlen); - if (tail) - syncEvents.pendtail = &tail->next; - *syncEvents.pendtail = qe; -} - -/** - * Run through the list of events queued up in syncEvents. - * For each event do: - * If the device for this event is not frozen anymore, take it and process it - * as usually. - * After that, check if there's any devices in the list that are not frozen. - * If there is none, we're done. If there is at least one device that is not - * frozen, then re-run from the beginning of the event queue. - */ -static void -PlayReleasedEvents(void) -{ - QdEventPtr *prev, qe; - DeviceIntPtr dev; - DeviceIntPtr pDev; - - prev = &syncEvents.pending; - while ( (qe = *prev) ) - { - if (!qe->device->deviceGrab.sync.frozen) - { - *prev = qe->next; - pDev = qe->device; - if (*syncEvents.pendtail == *prev) - syncEvents.pendtail = prev; - if (qe->event->any.type == ET_Motion) - CheckVirtualMotion(pDev, qe, NullWindow); - syncEvents.time.months = qe->months; - syncEvents.time.milliseconds = qe->event->any.time; -#ifdef PANORAMIX - /* Translate back to the sprite screen since processInputProc - will translate from sprite screen to screen 0 upon reentry - to the DIX layer */ - if(!noPanoramiXExtension) { - DeviceEvent *ev = &qe->event->device_event; - switch(ev->type) - { - case ET_Motion: - case ET_ButtonPress: - case ET_ButtonRelease: - case ET_KeyPress: - case ET_KeyRelease: - case ET_ProximityIn: - case ET_ProximityOut: - ev->root_x += screenInfo.screens[0]->x - - pDev->spriteInfo->sprite->screen->x; - ev->root_y += screenInfo.screens[0]->y - - pDev->spriteInfo->sprite->screen->y; - break; - default: - break; - } - - } -#endif - (*qe->device->public.processInputProc)(qe->event, qe->device); - free(qe); - for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next) - ; - if (!dev) - break; - /* Playing the event may have unfrozen another device. */ - /* So to play it safe, restart at the head of the queue */ - prev = &syncEvents.pending; - } - else - prev = &qe->next; - } -} - -/** - * Freeze or thaw the given devices. The device's processing proc is - * switched to either the real processing proc (in case of thawing) or an - * enqueuing processing proc (usually EnqueueEvent()). - * - * @param dev The device to freeze/thaw - * @param frozen True to freeze or false to thaw. - */ -static void -FreezeThaw(DeviceIntPtr dev, Bool frozen) -{ - dev->deviceGrab.sync.frozen = frozen; - if (frozen) - dev->public.processInputProc = dev->public.enqueueInputProc; - else - dev->public.processInputProc = dev->public.realInputProc; -} - -/** - * Unfreeze devices and replay all events to the respective clients. - * - * ComputeFreezes takes the first event in the device's frozen event queue. It - * runs up the sprite tree (spriteTrace) and searches for the window to replay - * the events from. If it is found, it checks for passive grabs one down from - * the window or delivers the events. - */ -static void -ComputeFreezes(void) -{ - DeviceIntPtr replayDev = syncEvents.replayDev; - WindowPtr w; - GrabPtr grab; - DeviceIntPtr dev; - - for (dev = inputInfo.devices; dev; dev = dev->next) - FreezeThaw(dev, dev->deviceGrab.sync.other || - (dev->deviceGrab.sync.state >= FROZEN)); - if (syncEvents.playingEvents || (!replayDev && !syncEvents.pending)) - return; - syncEvents.playingEvents = TRUE; - if (replayDev) - { - DeviceEvent* event = replayDev->deviceGrab.sync.event; - - syncEvents.replayDev = (DeviceIntPtr)NULL; - - w = XYToWindow(replayDev, event->root_x, event->root_y); - if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) - { - if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) - DeliverFocusedEvent(replayDev, (InternalEvent*)event, w); - else - DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab, - NullWindow, replayDev); - } - } - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (!dev->deviceGrab.sync.frozen) - { - PlayReleasedEvents(); - break; - } - } - syncEvents.playingEvents = FALSE; - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (DevHasCursor(dev)) - { - /* the following may have been skipped during replay, - so do it now */ - if ((grab = dev->deviceGrab.grab) && grab->confineTo) - { - if (grab->confineTo->drawable.pScreen != - dev->spriteInfo->sprite->hotPhys.pScreen) - dev->spriteInfo->sprite->hotPhys.x = - dev->spriteInfo->sprite->hotPhys.y = 0; - ConfineCursorToWindow(dev, grab->confineTo, TRUE, TRUE); - } - else - ConfineCursorToWindow(dev, - dev->spriteInfo->sprite->hotPhys.pScreen->root, - TRUE, FALSE); - PostNewCursor(dev); - } - } -} - -#ifdef RANDR -void -ScreenRestructured (ScreenPtr pScreen) -{ - GrabPtr grab; - DeviceIntPtr pDev; - - for (pDev = inputInfo.devices; pDev; pDev = pDev->next) - { - if (!DevHasCursor(pDev)) - continue; - - /* GrabDevice doesn't have a confineTo field, so we don't need to - * worry about it. */ - if ((grab = pDev->deviceGrab.grab) && grab->confineTo) - { - if (grab->confineTo->drawable.pScreen - != pDev->spriteInfo->sprite->hotPhys.pScreen) - pDev->spriteInfo->sprite->hotPhys.x = pDev->spriteInfo->sprite->hotPhys.y = 0; - ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE); - } - else - ConfineCursorToWindow(pDev, - pDev->spriteInfo->sprite->hotPhys.pScreen->root, - TRUE, FALSE); - } -} -#endif - -static void -CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) -{ - GrabPtr grab = thisDev->deviceGrab.grab; - DeviceIntPtr dev; - - if (thisMode == GrabModeSync) - thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT; - else - { /* free both if same client owns both */ - thisDev->deviceGrab.sync.state = THAWED; - if (thisDev->deviceGrab.sync.other && - (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) == - CLIENT_BITS(grab->resource))) - thisDev->deviceGrab.sync.other = NullGrab; - } - - if (IsMaster(thisDev)) - { - dev = GetPairedDevice(thisDev); - if (otherMode == GrabModeSync) - dev->deviceGrab.sync.other = grab; - else - { /* free both if same client owns both */ - if (dev->deviceGrab.sync.other && - (CLIENT_BITS(dev->deviceGrab.sync.other->resource) == - CLIENT_BITS(grab->resource))) - dev->deviceGrab.sync.other = NullGrab; - } - } - ComputeFreezes(); -} - -/** - * Save the device's master device id. This needs to be done - * if a client directly grabs a slave device that is attached to a master. For - * the duration of the grab, the device is detached, ungrabbing re-attaches it - * though. - * - * We store the ID of the master device only in case the master disappears - * while the device has a grab. - */ -static void -DetachFromMaster(DeviceIntPtr dev) -{ - if (!dev->u.master) - return; - - dev->saved_master_id = dev->u.master->id; - - AttachDevice(NULL, dev, NULL); -} - -static void -ReattachToOldMaster(DeviceIntPtr dev) -{ - DeviceIntPtr master = NULL; - - if (IsMaster(dev)) - return; - - dixLookupDevice(&master, dev->saved_master_id, serverClient, DixUseAccess); - - if (master) - { - AttachDevice(serverClient, dev, master); - dev->saved_master_id = 0; - } -} - -/** - * Activate a pointer grab on the given device. A pointer grab will cause all - * core pointer events of this device to be delivered to the grabbing client only. - * No other device will send core events to the grab client while the grab is - * on, but core events will be sent to other clients. - * Can cause the cursor to change if a grab cursor is set. - * - * Note that parameter autoGrab may be (True & ImplicitGrabMask) if the grab - * is an implicit grab caused by a ButtonPress event. - * - * @param mouse The device to grab. - * @param grab The grab structure, needs to be setup. - * @param autoGrab True if the grab was caused by a button down event and not - * explicitely by a client. - */ -void -ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, - TimeStamp time, Bool autoGrab) -{ - GrabInfoPtr grabinfo = &mouse->deviceGrab; - WindowPtr oldWin = (grabinfo->grab) ? - grabinfo->grab->window - : mouse->spriteInfo->sprite->win; - Bool isPassive = autoGrab & ~ImplicitGrabMask; - - /* slave devices need to float for the duration of the grab. */ - if (grab->grabtype == GRABTYPE_XI2 && - !(autoGrab & ImplicitGrabMask) && !IsMaster(mouse)) - DetachFromMaster(mouse); - - if (grab->confineTo) - { - if (grab->confineTo->drawable.pScreen - != mouse->spriteInfo->sprite->hotPhys.pScreen) - mouse->spriteInfo->sprite->hotPhys.x = - mouse->spriteInfo->sprite->hotPhys.y = 0; - ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE); - } - DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab); - mouse->valuator->motionHintWindow = NullWindow; - if (syncEvents.playingEvents) - grabinfo->grabTime = syncEvents.time; - else - grabinfo->grabTime = time; - if (grab->cursor) - grab->cursor->refcnt++; - grabinfo->activeGrab = *grab; - grabinfo->grab = &grabinfo->activeGrab; - grabinfo->fromPassiveGrab = isPassive; - grabinfo->implicitGrab = autoGrab & ImplicitGrabMask; - PostNewCursor(mouse); - CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); -} - -/** - * Delete grab on given device, update the sprite. - * - * Extension devices are set up for ActivateKeyboardGrab(). - */ -void -DeactivatePointerGrab(DeviceIntPtr mouse) -{ - GrabPtr grab = mouse->deviceGrab.grab; - DeviceIntPtr dev; - Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && - mouse->deviceGrab.implicitGrab); - - mouse->valuator->motionHintWindow = NullWindow; - mouse->deviceGrab.grab = NullGrab; - mouse->deviceGrab.sync.state = NOT_GRABBED; - mouse->deviceGrab.fromPassiveGrab = FALSE; - - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (dev->deviceGrab.sync.other == grab) - dev->deviceGrab.sync.other = NullGrab; - } - DoEnterLeaveEvents(mouse, mouse->id, grab->window, - mouse->spriteInfo->sprite->win, NotifyUngrab); - if (grab->confineTo) - ConfineCursorToWindow(mouse, RootWindow(mouse), FALSE, FALSE); - PostNewCursor(mouse); - if (grab->cursor) - FreeCursor(grab->cursor, (Cursor)0); - - if (!wasImplicit && grab->grabtype == GRABTYPE_XI2) - ReattachToOldMaster(mouse); - - ComputeFreezes(); -} - -/** - * Activate a keyboard grab on the given device. - * - * Extension devices have ActivateKeyboardGrab() set as their grabbing proc. - */ -void -ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) -{ - GrabInfoPtr grabinfo = &keybd->deviceGrab; - WindowPtr oldWin; - - /* slave devices need to float for the duration of the grab. */ - if (grab->grabtype == GRABTYPE_XI2 && - !(passive & ImplicitGrabMask) && - !IsMaster(keybd)) - DetachFromMaster(keybd); - - if (grabinfo->grab) - oldWin = grabinfo->grab->window; - else if (keybd->focus) - oldWin = keybd->focus->win; - else - oldWin = keybd->spriteInfo->sprite->win; - if (oldWin == FollowKeyboardWin) - oldWin = keybd->focus->win; - if (keybd->valuator) - keybd->valuator->motionHintWindow = NullWindow; - DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab); - if (syncEvents.playingEvents) - grabinfo->grabTime = syncEvents.time; - else - grabinfo->grabTime = time; - grabinfo->activeGrab = *grab; - grabinfo->grab = &grabinfo->activeGrab; - grabinfo->fromPassiveGrab = passive; - grabinfo->implicitGrab = passive & ImplicitGrabMask; - CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode); -} - -/** - * Delete keyboard grab for the given device. - */ -void -DeactivateKeyboardGrab(DeviceIntPtr keybd) -{ - GrabPtr grab = keybd->deviceGrab.grab; - DeviceIntPtr dev; - WindowPtr focusWin = keybd->focus ? keybd->focus->win - : keybd->spriteInfo->sprite->win; - Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab && - keybd->deviceGrab.implicitGrab); - - if (focusWin == FollowKeyboardWin) - focusWin = inputInfo.keyboard->focus->win; - if (keybd->valuator) - keybd->valuator->motionHintWindow = NullWindow; - keybd->deviceGrab.grab = NullGrab; - keybd->deviceGrab.sync.state = NOT_GRABBED; - keybd->deviceGrab.fromPassiveGrab = FALSE; - - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (dev->deviceGrab.sync.other == grab) - dev->deviceGrab.sync.other = NullGrab; - } - DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); - - if (!wasImplicit && grab->grabtype == GRABTYPE_XI2) - ReattachToOldMaster(keybd); - - ComputeFreezes(); -} - -void -AllowSome(ClientPtr client, - TimeStamp time, - DeviceIntPtr thisDev, - int newState) -{ - Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced; - TimeStamp grabTime; - DeviceIntPtr dev; - GrabInfoPtr devgrabinfo, - grabinfo = &thisDev->deviceGrab; - - thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client); - thisSynced = FALSE; - otherGrabbed = FALSE; - othersFrozen = FALSE; - grabTime = grabinfo->grabTime; - for (dev = inputInfo.devices; dev; dev = dev->next) - { - devgrabinfo = &dev->deviceGrab; - - if (dev == thisDev) - continue; - if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) - { - if (!(thisGrabbed || otherGrabbed) || - (CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER)) - grabTime = devgrabinfo->grabTime; - otherGrabbed = TRUE; - if (grabinfo->sync.other == devgrabinfo->grab) - thisSynced = TRUE; - if (devgrabinfo->sync.state >= FROZEN) - othersFrozen = TRUE; - } - } - if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced)) - return; - if ((CompareTimeStamps(time, currentTime) == LATER) || - (CompareTimeStamps(time, grabTime) == EARLIER)) - return; - switch (newState) - { - case THAWED: /* Async */ - if (thisGrabbed) - grabinfo->sync.state = THAWED; - if (thisSynced) - grabinfo->sync.other = NullGrab; - ComputeFreezes(); - break; - case FREEZE_NEXT_EVENT: /* Sync */ - if (thisGrabbed) - { - grabinfo->sync.state = FREEZE_NEXT_EVENT; - if (thisSynced) - grabinfo->sync.other = NullGrab; - ComputeFreezes(); - } - break; - case THAWED_BOTH: /* AsyncBoth */ - if (othersFrozen) - { - for (dev = inputInfo.devices; dev; dev = dev->next) - { - devgrabinfo = &dev->deviceGrab; - if (devgrabinfo->grab - && SameClient(devgrabinfo->grab, client)) - devgrabinfo->sync.state = THAWED; - if (devgrabinfo->sync.other && - SameClient(devgrabinfo->sync.other, client)) - devgrabinfo->sync.other = NullGrab; - } - ComputeFreezes(); - } - break; - case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ - if (othersFrozen) - { - for (dev = inputInfo.devices; dev; dev = dev->next) - { - devgrabinfo = &dev->deviceGrab; - if (devgrabinfo->grab - && SameClient(devgrabinfo->grab, client)) - devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT; - if (devgrabinfo->sync.other - && SameClient(devgrabinfo->sync.other, client)) - devgrabinfo->sync.other = NullGrab; - } - ComputeFreezes(); - } - break; - case NOT_GRABBED: /* Replay */ - if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT) - { - if (thisSynced) - grabinfo->sync.other = NullGrab; - syncEvents.replayDev = thisDev; - syncEvents.replayWin = grabinfo->grab->window; - (*grabinfo->DeactivateGrab)(thisDev); - syncEvents.replayDev = (DeviceIntPtr)NULL; - } - break; - case THAW_OTHERS: /* AsyncOthers */ - if (othersFrozen) - { - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (dev == thisDev) - continue; - devgrabinfo = &dev->deviceGrab; - if (devgrabinfo->grab - && SameClient(devgrabinfo->grab, client)) - devgrabinfo->sync.state = THAWED; - if (devgrabinfo->sync.other - && SameClient(devgrabinfo->sync.other, client)) - devgrabinfo->sync.other = NullGrab; - } - ComputeFreezes(); - } - break; - } -} - -/** - * Server-side protocol handling for AllowEvents request. - * - * Release some events from a frozen device. - */ -int -ProcAllowEvents(ClientPtr client) -{ - TimeStamp time; - DeviceIntPtr mouse = NULL; - DeviceIntPtr keybd = NULL; - REQUEST(xAllowEventsReq); - - REQUEST_SIZE_MATCH(xAllowEventsReq); - time = ClientTimeToServerTime(stuff->time); - - mouse = PickPointer(client); - keybd = PickKeyboard(client); - - switch (stuff->mode) - { - case ReplayPointer: - AllowSome(client, time, mouse, NOT_GRABBED); - break; - case SyncPointer: - AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); - break; - case AsyncPointer: - AllowSome(client, time, mouse, THAWED); - break; - case ReplayKeyboard: - AllowSome(client, time, keybd, NOT_GRABBED); - break; - case SyncKeyboard: - AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); - break; - case AsyncKeyboard: - AllowSome(client, time, keybd, THAWED); - break; - case SyncBoth: - AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); - break; - case AsyncBoth: - AllowSome(client, time, keybd, THAWED_BOTH); - break; - default: - client->errorValue = stuff->mode; - return BadValue; - } - return Success; -} - -/** - * Deactivate grabs from any device that has been grabbed by the client. - */ -void -ReleaseActiveGrabs(ClientPtr client) -{ - DeviceIntPtr dev; - Bool done; - - /* XXX CloseDownClient should remove passive grabs before - * releasing active grabs. - */ - do { - done = TRUE; - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) - { - (*dev->deviceGrab.DeactivateGrab)(dev); - done = FALSE; - } - } - } while (!done); -} - -/************************************************************************** - * The following procedures deal with delivering events * - **************************************************************************/ - -/** - * Deliver the given events to the given client. - * - * More than one event may be delivered at a time. This is the case with - * DeviceMotionNotifies which may be followed by DeviceValuator events. - * - * TryClientEvents() is the last station before actually writing the events to - * the socket. Anything that is not filtered here, will get delivered to the - * client. - * An event is only delivered if - * - mask and filter match up. - * - no other client has a grab on the device that caused the event. - * - * - * @param client The target client to deliver to. - * @param dev The device the event came from. May be NULL. - * @param pEvents The events to be delivered. - * @param count Number of elements in pEvents. - * @param mask Event mask as set by the window. - * @param filter Mask based on event type. - * @param grab Possible grab on the device that caused the event. - * - * @return 1 if event was delivered, 0 if not or -1 if grab was not set by the - * client. - */ -int -TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents, - int count, Mask mask, Mask filter, GrabPtr grab) -{ - int type; - -#ifdef DEBUG_EVENTS - ErrorF("[dix] Event([%d, %d], mask=0x%lx), client=%d%s", - pEvents->u.u.type, pEvents->u.u.detail, mask, - client ? client->index : -1, - (client && client->clientGone) ? " (gone)" : ""); -#endif - - if (!client || client == serverClient || client->clientGone) { -#ifdef DEBUG_EVENTS - ErrorF(" not delivered to fake/dead client\n"); -#endif - return 0; - } - - if (filter != CantBeFiltered && !(mask & filter)) - { - #ifdef DEBUG_EVENTS - ErrorF(" filtered\n"); - #endif - return 0; - } - - if (grab && !SameClient(grab, client)) - { -#ifdef DEBUG_EVENTS - ErrorF(" not delivered due to grab\n"); -#endif - return -1; /* don't send, but notify caller */ - } - - type = pEvents->u.u.type; - if (type == MotionNotify) - { - if (mask & PointerMotionHintMask) - { - if (WID(dev->valuator->motionHintWindow) == - pEvents->u.keyButtonPointer.event) - { -#ifdef DEBUG_EVENTS - ErrorF("[dix] \n"); - ErrorF("[dix] motionHintWindow == keyButtonPointer.event\n"); -#endif - return 1; /* don't send, but pretend we did */ - } - pEvents->u.u.detail = NotifyHint; - } - else - { - pEvents->u.u.detail = NotifyNormal; - } - } - else if (type == DeviceMotionNotify) - { - if (MaybeSendDeviceMotionNotifyHint((deviceKeyButtonPointer*)pEvents, - mask) != 0) - return 1; - } else if (type == KeyPress) - { - if (EventIsKeyRepeat(pEvents)) - { - if (!_XkbWantsDetectableAutoRepeat(client)) - { - xEvent release = *pEvents; - release.u.u.type = KeyRelease; - WriteEventsToClient(client, 1, &release); -#ifdef DEBUG_EVENTS - ErrorF(" (plus fake core release for repeat)"); -#endif - } else - { -#ifdef DEBUG_EVENTS - ErrorF(" (detectable autorepeat for core)"); -#endif - } - } - - } else if (type == DeviceKeyPress) - { - if (EventIsKeyRepeat(pEvents)) - { - if (!_XkbWantsDetectableAutoRepeat(client)) - { - deviceKeyButtonPointer release = *(deviceKeyButtonPointer *)pEvents; - release.type = DeviceKeyRelease; -#ifdef DEBUG_EVENTS - ErrorF(" (plus fake xi1 release for repeat)"); -#endif - WriteEventsToClient(client, 1, (xEvent *) &release); - } - else { -#ifdef DEBUG_EVENTS - ErrorF(" (detectable autorepeat for core)"); -#endif - } - } - } - - if (BitIsOn(criticalEvents, type)) - { - if (client->smart_priority < SMART_MAX_PRIORITY) - client->smart_priority++; - SetCriticalOutputPending(); - } - - WriteEventsToClient(client, count, pEvents); -#ifdef DEBUG_EVENTS - ErrorF("[dix] delivered\n"); -#endif - return 1; -} - -/** - * Deliver events to a window. At this point, we do not yet know if the event - * actually needs to be delivered. May activate a grab if the event is a - * button press. - * - * Core events are always delivered to the window owner. If the filter is - * something other than CantBeFiltered, the event is also delivered to other - * clients with the matching mask on the window. - * - * More than one event may be delivered at a time. This is the case with - * DeviceMotionNotifies which may be followed by DeviceValuator events. - * - * @param pWin The window that would get the event. - * @param pEvents The events to be delivered. - * @param count Number of elements in pEvents. - * @param filter Mask based on event type. - * @param grab Possible grab on the device that caused the event. - * - * @return Number of events delivered to various clients. - */ -int -DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent - *pEvents, int count, Mask filter, GrabPtr grab) -{ - int deliveries = 0, nondeliveries = 0; - int attempt; - InputClients *other; - ClientPtr client = NullClient; - Mask deliveryMask = 0; /* If a grab occurs due to a button press, then - this mask is the mask of the grab. */ - int type = pEvents->u.u.type; - - - /* Deliver to window owner */ - if ((filter == CantBeFiltered) || CORE_EVENT(pEvents)) - { - /* if nobody ever wants to see this event, skip some work */ - if (filter != CantBeFiltered && - !((wOtherEventMasks(pWin)|pWin->eventMask) & filter)) - return 0; - - if (IsInterferingGrab(wClient(pWin), pDev, pEvents)) - return 0; - - if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) - /* do nothing */; - else if ( (attempt = TryClientEvents(wClient(pWin), pDev, pEvents, - count, pWin->eventMask, - filter, grab)) ) - { - if (attempt > 0) - { - deliveries++; - client = wClient(pWin); - deliveryMask = pWin->eventMask; - } else - nondeliveries--; - } - } - - /* CantBeFiltered means only window owner gets the event */ - if (filter != CantBeFiltered) - { - if (CORE_EVENT(pEvents)) - other = (InputClients *)wOtherClients(pWin); - else if (XI2_EVENT(pEvents)) - { - OtherInputMasks *inputMasks = wOtherInputMasks(pWin); - /* Has any client selected for the event? */ - if (!GetWindowXI2Mask(pDev, pWin, pEvents)) - return 0; - other = inputMasks->inputClients; - } else { - OtherInputMasks *inputMasks = wOtherInputMasks(pWin); - /* Has any client selected for the event? */ - if (!inputMasks || - !(inputMasks->inputEvents[pDev->id] & filter)) - return 0; - - other = inputMasks->inputClients; - } - - for (; other; other = other->next) - { - Mask mask; - if (IsInterferingGrab(rClient(other), pDev, pEvents)) - continue; - - mask = GetEventMask(pDev, pEvents, other); - - if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, - pEvents, count)) - /* do nothing */; - else if ( (attempt = TryClientEvents(rClient(other), pDev, - pEvents, count, - mask, filter, grab)) ) - { - if (attempt > 0) - { - deliveries++; - client = rClient(other); - deliveryMask = mask; - } else - nondeliveries--; - } - } - } - /* - * Note that since core events are delivered first, an implicit grab may - * be activated on a core grab, stopping the XI events. - */ - if ((type == DeviceButtonPress || type == ButtonPress || - ((XI2_EVENT(pEvents) && ((xGenericEvent*)pEvents)->evtype == XI_ButtonPress))) - && deliveries - && (!grab)) - { - GrabRec tempGrab; - OtherInputMasks *inputMasks; - - memset(&tempGrab, 0, sizeof(GrabRec)); - tempGrab.next = NULL; - tempGrab.device = pDev; - tempGrab.resource = client->clientAsMask; - tempGrab.window = pWin; - tempGrab.ownerEvents = (deliveryMask & OwnerGrabButtonMask) ? TRUE : FALSE; - tempGrab.eventMask = deliveryMask; - tempGrab.keyboardMode = GrabModeAsync; - tempGrab.pointerMode = GrabModeAsync; - tempGrab.confineTo = NullWindow; - tempGrab.cursor = NullCursor; - tempGrab.type = type; - if (type == ButtonPress) - tempGrab.grabtype = GRABTYPE_CORE; - else if (type == DeviceButtonPress) - tempGrab.grabtype = GRABTYPE_XI; - else - { - tempGrab.type = ((xGenericEvent*)pEvents)->evtype; - tempGrab.grabtype = GRABTYPE_XI2; - } - - /* get the XI and XI2 device mask */ - inputMasks = wOtherInputMasks(pWin); - tempGrab.deviceMask = (inputMasks) ? inputMasks->inputEvents[pDev->id]: 0; - - if (inputMasks) - memcpy(tempGrab.xi2mask, inputMasks->xi2mask, - sizeof(tempGrab.xi2mask)); - - (*pDev->deviceGrab.ActivateGrab)(pDev, &tempGrab, - currentTime, TRUE | ImplicitGrabMask); - } - else if ((type == MotionNotify) && deliveries) - pDev->valuator->motionHintWindow = pWin; - else - { - if ((type == DeviceMotionNotify || type == DeviceButtonPress) && - deliveries) - CheckDeviceGrabAndHintWindow (pWin, type, - (deviceKeyButtonPointer*) pEvents, - grab, client, deliveryMask); - } - if (deliveries) - return deliveries; - return nondeliveries; -} - -/* If the event goes to dontClient, don't send it and return 0. if - send works, return 1 or if send didn't work, return 2. - Only works for core events. -*/ - -#ifdef PANORAMIX -static int -XineramaTryClientEventsResult( - ClientPtr client, - GrabPtr grab, - Mask mask, - Mask filter -){ - if ((client) && (client != serverClient) && (!client->clientGone) && - ((filter == CantBeFiltered) || (mask & filter))) - { - if (grab && !SameClient(grab, client)) return -1; - else return 1; - } - return 0; -} -#endif - -/** - * Try to deliver events to the interested parties. - * - * @param pWin The window that would get the event. - * @param pEvents The events to be delivered. - * @param count Number of elements in pEvents. - * @param filter Mask based on event type. - * @param dontClient Don't deliver to the dontClient. - */ -int -MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, - int count, Mask filter, ClientPtr dontClient) -{ - OtherClients *other; - - - if (pWin->eventMask & filter) - { - if (wClient(pWin) == dontClient) - return 0; -#ifdef PANORAMIX - if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) - return XineramaTryClientEventsResult( - wClient(pWin), NullGrab, pWin->eventMask, filter); -#endif - if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) - return 1; /* don't send, but pretend we did */ - return TryClientEvents(wClient(pWin), NULL, pEvents, count, - pWin->eventMask, filter, NullGrab); - } - for (other = wOtherClients(pWin); other; other = other->next) - { - if (other->mask & filter) - { - if (SameClient(other, dontClient)) - return 0; -#ifdef PANORAMIX - if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) - return XineramaTryClientEventsResult( - rClient(other), NullGrab, other->mask, filter); -#endif - if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents, - count)) - return 1; /* don't send, but pretend we did */ - return TryClientEvents(rClient(other), NULL, pEvents, count, - other->mask, filter, NullGrab); - } - } - return 2; -} - -static Window FindChildForEvent(DeviceIntPtr dev, WindowPtr event) -{ - SpritePtr pSprite = dev->spriteInfo->sprite; - WindowPtr w = pSprite->spriteTrace[pSprite->spriteTraceGood-1]; - Window child = None; - - /* If the search ends up past the root should the child field be - set to none or should the value in the argument be passed - through. It probably doesn't matter since everyone calls - this function with child == None anyway. */ - while (w) - { - /* If the source window is same as event window, child should be - none. Don't bother going all all the way back to the root. */ - - if (w == event) - { - child = None; - break; - } - - if (w->parent == event) - { - child = w->drawable.id; - break; - } - w = w->parent; - } - return child; -} - -/** - * Adjust event fields to comply with the window properties. - * - * @param xE Event to be modified in place - * @param pWin The window to get the information from. - * @param child Child window setting for event (if applicable) - * @param calcChild If True, calculate the child window. - */ -void -FixUpEventFromWindow( - DeviceIntPtr pDev, - xEvent *xE, - WindowPtr pWin, - Window child, - Bool calcChild) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - - if (calcChild) - child = FindChildForEvent(pDev, pWin); - - if (XI2_EVENT(xE)) - { - xXIDeviceEvent* event = (xXIDeviceEvent*)xE; - - if (event->evtype == XI_RawKeyPress || - event->evtype == XI_RawKeyRelease || - event->evtype == XI_RawButtonPress || - event->evtype == XI_RawButtonRelease || - event->evtype == XI_RawMotion || - event->evtype == XI_DeviceChanged || - event->evtype == XI_HierarchyChanged || - event->evtype == XI_PropertyEvent) - return; - - event->root = RootWindow(pDev)->drawable.id; - event->event = pWin->drawable.id; - if (pSprite->hot.pScreen == pWin->drawable.pScreen) - { - event->event_x = event->root_x - FP1616(pWin->drawable.x, 0); - event->event_y = event->root_y - FP1616(pWin->drawable.y, 0); - event->child = child; - } else - { - event->event_x = 0; - event->event_y = 0; - event->child = None; - } - - if (event->evtype == XI_Enter || event->evtype == XI_Leave || - event->evtype == XI_FocusIn || event->evtype == XI_FocusOut) - ((xXIEnterEvent*)event)->same_screen = - (pSprite->hot.pScreen == pWin->drawable.pScreen); - - } else - { - XE_KBPTR.root = RootWindow(pDev)->drawable.id; - XE_KBPTR.event = pWin->drawable.id; - if (pSprite->hot.pScreen == pWin->drawable.pScreen) - { - XE_KBPTR.sameScreen = xTrue; - XE_KBPTR.child = child; - XE_KBPTR.eventX = - XE_KBPTR.rootX - pWin->drawable.x; - XE_KBPTR.eventY = - XE_KBPTR.rootY - pWin->drawable.y; - } - else - { - XE_KBPTR.sameScreen = xFalse; - XE_KBPTR.child = None; - XE_KBPTR.eventX = 0; - XE_KBPTR.eventY = 0; - } - } -} - -/** - * Check if a given event is deliverable at all on a given window. - * - * This function only checks if any client wants it, not for a specific - * client. - * - * @param[in] dev The device this event is being sent for. - * @param[in] event The event that is to be sent. - * @param[in] win The current event window. - * - * @return Bitmask of ::XI2_MASK, ::XI_MASK, ::CORE_MASK, and - * ::DONT_PROPAGATE_MASK. - */ -int -EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win) -{ - int rc = 0; - int filter = 0; - int type; - OtherInputMasks *inputMasks = wOtherInputMasks(win); - xEvent ev; - - /* XXX: this makes me gag */ - type = GetXI2Type(event); - ev.u.u.type = GenericEvent; /* GetEventFilter only cares about type and evtype*/ - ((xGenericEvent*)&ev)->extension = IReqCode; - ((xGenericEvent*)&ev)->evtype = type; - filter = GetEventFilter(dev, &ev); - if (type && inputMasks && - ((inputMasks->xi2mask[XIAllDevices][type/8] & filter) || - ((inputMasks->xi2mask[XIAllMasterDevices][type/8] & filter) && IsMaster(dev)) || - (inputMasks->xi2mask[dev->id][type/8] & filter))) - rc |= XI2_MASK; - - type = GetXIType(event); - ev.u.u.type = type; - filter = GetEventFilter(dev, &ev); - - /* Check for XI mask */ - if (type && inputMasks && - (inputMasks->deliverableEvents[dev->id] & filter) && - (inputMasks->inputEvents[dev->id] & filter)) - rc |= XI_MASK; - - /* Check for XI DontPropagate mask */ - if (type && inputMasks && - (inputMasks->dontPropagateMask[dev->id] & filter)) - rc |= DONT_PROPAGATE_MASK; - - /* Check for core mask */ - type = GetCoreType(event); - if (type && (win->deliverableEvents & filter) && - ((wOtherEventMasks(win) | win->eventMask) & filter)) - rc |= CORE_MASK; - - /* Check for core DontPropagate mask */ - if (type && (filter & wDontPropagateMask(win))) - rc |= DONT_PROPAGATE_MASK; - - return rc; -} - -/** - * Deliver events caused by input devices. - * - * For events from a non-grabbed, non-focus device, DeliverDeviceEvents is - * called directly from the processInputProc. - * For grabbed devices, DeliverGrabbedEvent is called first, and _may_ call - * DeliverDeviceEvents. - * For focused events, DeliverFocusedEvent is called first, and _may_ call - * DeliverDeviceEvents. - * - * @param pWin Window to deliver event to. - * @param event The events to deliver, not yet in wire format. - * @param grab Possible grab on a device. - * @param stopAt Don't recurse up to the root window. - * @param dev The device that is responsible for the event. - * - * @see DeliverGrabbedEvent - * @see DeliverFocusedEvent - */ -int -DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, - WindowPtr stopAt, DeviceIntPtr dev) -{ - Window child = None; - Mask filter; - int deliveries = 0; - xEvent core; - xEvent *xE = NULL; - int rc, mask, count = 0; - - CHECKEVENT(event); - - while (pWin) - { - if ((mask = EventIsDeliverable(dev, event, pWin))) - { - /* XI2 events first */ - if (mask & XI2_MASK) - { - xEvent *xi2 = NULL; - rc = EventToXI2(event, &xi2); - if (rc == Success) - { - /* XXX: XACE */ - filter = GetEventFilter(dev, xi2); - FixUpEventFromWindow(dev, xi2, pWin, child, FALSE); - deliveries = DeliverEventsToWindow(dev, pWin, xi2, 1, - filter, grab); - free(xi2); - if (deliveries > 0) - goto unwind; - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI2 conversion failed in DDE (%d).\n", - dev->name, rc); - } - - /* XI events */ - if (mask & XI_MASK) - { - rc = EventToXI(event, &xE, &count); - if (rc == Success) { - if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count) == Success) { - filter = GetEventFilter(dev, xE); - FixUpEventFromWindow(dev, xE, pWin, child, FALSE); - deliveries = DeliverEventsToWindow(dev, pWin, xE, count, - filter, grab); - if (deliveries > 0) - goto unwind; - } - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI conversion failed in DDE (%d, %d). Skipping delivery.\n", - dev->name, event->any.type, rc); - } - - /* Core event */ - if ((mask & CORE_MASK) && IsMaster(dev) && dev->coreEvents) - { - rc = EventToCore(event, &core); - if (rc == Success) { - if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, &core, 1) == Success) { - filter = GetEventFilter(dev, &core); - FixUpEventFromWindow(dev, &core, pWin, child, FALSE); - deliveries = DeliverEventsToWindow(dev, pWin, &core, 1, - filter, grab); - if (deliveries > 0) - goto unwind; - } - } else if (rc != BadMatch) - ErrorF("[dix] %s: Core conversion failed in DDE (%d, %d).\n", - dev->name, event->any.type, rc); - } - - if ((deliveries < 0) || (pWin == stopAt) || - (mask & DONT_PROPAGATE_MASK)) - { - deliveries = 0; - goto unwind; - } - } - - child = pWin->drawable.id; - pWin = pWin->parent; - } - -unwind: - free(xE); - return deliveries; -} - -#undef XI_MASK -#undef CORE_MASK -#undef DONT_PROPAGATE_MASK - -/** - * Deliver event to a window and it's immediate parent. Used for most window - * events (CreateNotify, ConfigureNotify, etc.). Not useful for events that - * propagate up the tree or extension events - * - * In case of a ReparentNotify event, the event will be delivered to the - * otherParent as well. - * - * @param pWin Window to deliver events to. - * @param xE Events to deliver. - * @param count number of events in xE. - * @param otherParent Used for ReparentNotify events. - */ -int -DeliverEvents(WindowPtr pWin, xEvent *xE, int count, - WindowPtr otherParent) -{ - Mask filter; - int deliveries; - DeviceIntRec dummy; - -#ifdef PANORAMIX - if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) - return count; -#endif - - if (!count) - return 0; - - dummy.id = XIAllDevices; - filter = GetEventFilter(&dummy, xE); - if ((filter & SubstructureNotifyMask) && (xE->u.u.type != CreateNotify)) - xE->u.destroyNotify.event = pWin->drawable.id; - if (filter != StructureAndSubMask) - return DeliverEventsToWindow(&dummy, pWin, xE, count, filter, NullGrab); - deliveries = DeliverEventsToWindow(&dummy, pWin, xE, count, - StructureNotifyMask, NullGrab); - if (pWin->parent) - { - xE->u.destroyNotify.event = pWin->parent->drawable.id; - deliveries += DeliverEventsToWindow(&dummy, pWin->parent, xE, count, - SubstructureNotifyMask, NullGrab); - if (xE->u.u.type == ReparentNotify) - { - xE->u.destroyNotify.event = otherParent->drawable.id; - deliveries += DeliverEventsToWindow(&dummy, - otherParent, xE, count, SubstructureNotifyMask, - NullGrab); - } - } - return deliveries; -} - - -static Bool -PointInBorderSize(WindowPtr pWin, int x, int y) -{ - BoxRec box; - - if(RegionContainsPoint(&pWin->borderSize, x, y, &box)) - return TRUE; - -#ifdef PANORAMIX - if(!noPanoramiXExtension && - XineramaSetWindowPntrs(inputInfo.pointer, pWin)) { - SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite; - int i; - - for(i = 1; i < PanoramiXNumScreens; i++) { - if(RegionContainsPoint(&pSprite->windows[i]->borderSize, - x + screenInfo.screens[0]->x - screenInfo.screens[i]->x, - y + screenInfo.screens[0]->y - screenInfo.screens[i]->y, - &box)) - return TRUE; - } - } -#endif - return FALSE; -} - -/** - * Traversed from the root window to the window at the position x/y. While - * traversing, it sets up the traversal history in the spriteTrace array. - * After completing, the spriteTrace history is set in the following way: - * spriteTrace[0] ... root window - * spriteTrace[1] ... top level window that encloses x/y - * ... - * spriteTrace[spriteTraceGood - 1] ... window at x/y - * - * @returns the window at the given coordinates. - */ -static WindowPtr -XYToWindow(DeviceIntPtr pDev, int x, int y) -{ - WindowPtr pWin; - BoxRec box; - SpritePtr pSprite; - - pSprite = pDev->spriteInfo->sprite; - pSprite->spriteTraceGood = 1; /* root window still there */ - pWin = RootWindow(pDev)->firstChild; - while (pWin) - { - if ((pWin->mapped) && - (x >= pWin->drawable.x - wBorderWidth (pWin)) && - (x < pWin->drawable.x + (int)pWin->drawable.width + - wBorderWidth(pWin)) && - (y >= pWin->drawable.y - wBorderWidth (pWin)) && - (y < pWin->drawable.y + (int)pWin->drawable.height + - wBorderWidth (pWin)) - /* When a window is shaped, a further check - * is made to see if the point is inside - * borderSize - */ - && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) - && (!wInputShape(pWin) || - RegionContainsPoint(wInputShape(pWin), - x - pWin->drawable.x, - y - pWin->drawable.y, &box)) -#ifdef ROOTLESS - /* In rootless mode windows may be offscreen, even when - * they're in X's stack. (E.g. if the native window system - * implements some form of virtual desktop system). - */ - && !pWin->rootlessUnhittable -#endif - ) - { - if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) - { - pSprite->spriteTraceSize += 10; - pSprite->spriteTrace = realloc(pSprite->spriteTrace, - pSprite->spriteTraceSize*sizeof(WindowPtr)); - } - pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin; - pWin = pWin->firstChild; - } - else - pWin = pWin->nextSib; - } - return pSprite->spriteTrace[pSprite->spriteTraceGood-1]; -} - -/** - * Ungrab a currently FocusIn grabbed device and grab the device on the - * given window. If the win given is the NoneWin, the device is ungrabbed if - * applicable and FALSE is returned. - * - * @returns TRUE if the device has been grabbed, or FALSE otherwise. - */ -BOOL -ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) -{ - BOOL rc = FALSE; - DeviceEvent event; - - if (dev->deviceGrab.grab) - { - if (!dev->deviceGrab.fromPassiveGrab || - dev->deviceGrab.grab->type != XI_Enter || - dev->deviceGrab.grab->window == win || - IsParent(dev->deviceGrab.grab->window, win)) - return FALSE; - DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); - (*dev->deviceGrab.DeactivateGrab)(dev); - } - - if (win == NoneWin || win == PointerRootWin) - return FALSE; - - memset(&event, 0, sizeof(DeviceEvent)); - event.header = ET_Internal; - event.type = ET_FocusIn; - event.length = sizeof(DeviceEvent); - event.time = GetTimeInMillis(); - event.deviceid = dev->id; - event.sourceid = dev->id; - event.detail.button = 0; - rc = CheckPassiveGrabsOnWindow(win, dev, &event, FALSE); - if (rc) - DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); - return rc; -} - -/** - * Ungrab a currently Enter grabbed device and grab the device for the given - * window. - * - * @returns TRUE if the device has been grabbed, or FALSE otherwise. - */ -static BOOL -ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) -{ - BOOL rc = FALSE; - DeviceEvent event; - - if (dev->deviceGrab.grab) - { - if (!dev->deviceGrab.fromPassiveGrab || - dev->deviceGrab.grab->type != XI_Enter || - dev->deviceGrab.grab->window == win || - IsParent(dev->deviceGrab.grab->window, win)) - return FALSE; - DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); - (*dev->deviceGrab.DeactivateGrab)(dev); - } - - memset(&event, 0, sizeof(DeviceEvent)); - event.header = ET_Internal; - event.type = ET_Enter; - event.length = sizeof(DeviceEvent); - event.time = GetTimeInMillis(); - event.deviceid = dev->id; - event.sourceid = dev->id; - event.detail.button = 0; - rc = CheckPassiveGrabsOnWindow(win, dev, &event, FALSE); - if (rc) - DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab); - - return rc; -} - -/** - * Update the sprite coordinates based on the event. Update the cursor - * position, then update the event with the new coordinates that may have been - * changed. If the window underneath the sprite has changed, change to new - * cursor and send enter/leave events. - * - * CheckMotion() will not do anything and return FALSE if the event is not a - * pointer event. - * - * @return TRUE if the sprite has moved or FALSE otherwise. - */ -Bool -CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) -{ - WindowPtr prevSpriteWin, newSpriteWin; - SpritePtr pSprite = pDev->spriteInfo->sprite; - - CHECKEVENT(ev); - - prevSpriteWin = pSprite->win; - - if (ev && !syncEvents.playingEvents) - { - /* GetPointerEvents() guarantees that pointer events have the correct - rootX/Y set already. */ - switch (ev->type) - { - case ET_ButtonPress: - case ET_ButtonRelease: - case ET_Motion: - break; - default: - /* all other events return FALSE */ - return FALSE; - } - - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - { - /* Motion events entering DIX get translated to Screen 0 - coordinates. Replayed events have already been - translated since they've entered DIX before */ - ev->root_x += pSprite->screen->x - screenInfo.screens[0]->x; - ev->root_y += pSprite->screen->y - screenInfo.screens[0]->y; - } else -#endif - { - if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen) - { - pSprite->hot.pScreen = pSprite->hotPhys.pScreen; - RootWindow(pDev) = pSprite->hot.pScreen->root; - } - } - - pSprite->hot.x = ev->root_x; - pSprite->hot.y = ev->root_y; - if (pSprite->hot.x < pSprite->physLimits.x1) - pSprite->hot.x = pSprite->physLimits.x1; - else if (pSprite->hot.x >= pSprite->physLimits.x2) - pSprite->hot.x = pSprite->physLimits.x2 - 1; - if (pSprite->hot.y < pSprite->physLimits.y1) - pSprite->hot.y = pSprite->physLimits.y1; - else if (pSprite->hot.y >= pSprite->physLimits.y2) - pSprite->hot.y = pSprite->physLimits.y2 - 1; - if (pSprite->hotShape) - ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y); - pSprite->hotPhys = pSprite->hot; - - if ((pSprite->hotPhys.x != ev->root_x) || - (pSprite->hotPhys.y != ev->root_y)) - { -#ifdef PANORAMIX - if (!noPanoramiXExtension) - { - XineramaSetCursorPosition( - pDev, pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE); - } else -#endif - { - (*pSprite->hotPhys.pScreen->SetCursorPosition)( - pDev, pSprite->hotPhys.pScreen, - pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE); - } - } - - ev->root_x = pSprite->hot.x; - ev->root_y = pSprite->hot.y; - } - - newSpriteWin = XYToWindow(pDev, pSprite->hot.x, pSprite->hot.y); - - if (newSpriteWin != prevSpriteWin) - { - int sourceid; - if (!ev) { - UpdateCurrentTimeIf(); - sourceid = pDev->id; /* when from WindowsRestructured */ - } else - sourceid = ev->sourceid; - - if (prevSpriteWin != NullWindow) { - if (!ActivateEnterGrab(pDev, prevSpriteWin, newSpriteWin)) - DoEnterLeaveEvents(pDev, sourceid, prevSpriteWin, - newSpriteWin, NotifyNormal); - } - /* set pSprite->win after ActivateEnterGrab, otherwise - sprite window == grab_window and no enter/leave events are - sent. */ - pSprite->win = newSpriteWin; - PostNewCursor(pDev); - return FALSE; - } - return TRUE; -} - -/** - * Windows have restructured, we need to update the sprite position and the - * sprite's cursor. - */ -void -WindowsRestructured(void) -{ - DeviceIntPtr pDev = inputInfo.devices; - while(pDev) - { - if (IsMaster(pDev) || !pDev->u.master) - CheckMotion(NULL, pDev); - pDev = pDev->next; - } -} - -#ifdef PANORAMIX -/* This was added to support reconfiguration under Xdmx. The problem is - * that if the 0th screen (i.e., screenInfo.screens[0]) is moved to an origin - * other than 0,0, the information in the private sprite structure must - * be updated accordingly, or XYToWindow (and other routines) will not - * compute correctly. */ -void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) -{ - GrabPtr grab; - DeviceIntPtr pDev; - SpritePtr pSprite; - - if (noPanoramiXExtension) return; - - pDev = inputInfo.devices; - while(pDev) - { - if (DevHasCursor(pDev)) - { - pSprite = pDev->spriteInfo->sprite; - pSprite->hot.x -= xoff; - pSprite->hot.y -= yoff; - - pSprite->hotPhys.x -= xoff; - pSprite->hotPhys.y -= yoff; - - pSprite->hotLimits.x1 -= xoff; - pSprite->hotLimits.y1 -= yoff; - pSprite->hotLimits.x2 -= xoff; - pSprite->hotLimits.y2 -= yoff; - - if (RegionNotEmpty(&pSprite->Reg1)) - RegionTranslate(&pSprite->Reg1, xoff, yoff); - if (RegionNotEmpty(&pSprite->Reg2)) - RegionTranslate(&pSprite->Reg2, xoff, yoff); - - /* FIXME: if we call ConfineCursorToWindow, must we do anything else? */ - if ((grab = pDev->deviceGrab.grab) && grab->confineTo) { - if (grab->confineTo->drawable.pScreen - != pSprite->hotPhys.pScreen) - pSprite->hotPhys.x = pSprite->hotPhys.y = 0; - ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE); - } else - ConfineCursorToWindow( - pDev, - pSprite->hotPhys.pScreen->root, - TRUE, FALSE); - - } - pDev = pDev->next; - } -} -#endif - -/** - * Initialize a sprite for the given device and set it to some sane values. If - * the device already has a sprite alloc'd, don't realloc but just reset to - * default values. - * If a window is supplied, the sprite will be initialized with the window's - * cursor and positioned in the center of the window's screen. The root window - * is a good choice to pass in here. - * - * It's a good idea to call it only for pointer devices, unless you have a - * really talented keyboard. - * - * @param pDev The device to initialize. - * @param pWin The window where to generate the sprite in. - * - */ -void -InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) -{ - SpritePtr pSprite; - ScreenPtr pScreen; - CursorPtr pCursor; - - if (!pDev->spriteInfo->sprite) - { - DeviceIntPtr it; - - pDev->spriteInfo->sprite = (SpritePtr)calloc(1, sizeof(SpriteRec)); - if (!pDev->spriteInfo->sprite) - FatalError("InitializeSprite: failed to allocate sprite struct"); - - /* We may have paired another device with this device before our - * device had a actual sprite. We need to check for this and reset the - * sprite field for all paired devices. - * - * The VCK is always paired with the VCP before the VCP has a sprite. - */ - for (it = inputInfo.devices; it; it = it->next) - { - if (it->spriteInfo->paired == pDev) - it->spriteInfo->sprite = pDev->spriteInfo->sprite; - } - if (inputInfo.keyboard->spriteInfo->paired == pDev) - inputInfo.keyboard->spriteInfo->sprite = pDev->spriteInfo->sprite; - } - - pSprite = pDev->spriteInfo->sprite; - pDev->spriteInfo->spriteOwner = TRUE; - - pScreen = (pWin) ? pWin->drawable.pScreen : (ScreenPtr)NULL; - pSprite->hot.pScreen = pScreen; - pSprite->hotPhys.pScreen = pScreen; - if (pScreen) - { - pSprite->hotPhys.x = pScreen->width / 2; - pSprite->hotPhys.y = pScreen->height / 2; - pSprite->hotLimits.x2 = pScreen->width; - pSprite->hotLimits.y2 = pScreen->height; - } - - pSprite->hot = pSprite->hotPhys; - pSprite->win = pWin; - - if (pWin) - { - pCursor = wCursor(pWin); - pSprite->spriteTrace = (WindowPtr *)calloc(1, 32*sizeof(WindowPtr)); - if (!pSprite->spriteTrace) - FatalError("Failed to allocate spriteTrace"); - pSprite->spriteTraceSize = 32; - - RootWindow(pDev) = pWin; - pSprite->spriteTraceGood = 1; - - pSprite->pEnqueueScreen = pScreen; - pSprite->pDequeueScreen = pSprite->pEnqueueScreen; - - } else { - pCursor = NullCursor; - pSprite->spriteTrace = NULL; - pSprite->spriteTraceSize = 0; - pSprite->spriteTraceGood = 0; - pSprite->pEnqueueScreen = screenInfo.screens[0]; - pSprite->pDequeueScreen = pSprite->pEnqueueScreen; - } - if (pCursor) - pCursor->refcnt++; - if (pSprite->current) - FreeCursor(pSprite->current, None); - pSprite->current = pCursor; - - if (pScreen) - { - (*pScreen->RealizeCursor) ( pDev, pScreen, pSprite->current); - (*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current, - &pSprite->hotLimits, &pSprite->physLimits); - pSprite->confined = FALSE; - - (*pScreen->ConstrainCursor) (pDev, pScreen, - &pSprite->physLimits); - (*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x, - pSprite->hot.y, - FALSE); - (*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current); - } -#ifdef PANORAMIX - if(!noPanoramiXExtension) { - pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; - pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; - pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; - pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; - pSprite->physLimits = pSprite->hotLimits; - pSprite->confineWin = NullWindow; - pSprite->hotShape = NullRegion; - pSprite->screen = pScreen; - /* gotta UNINIT these someplace */ - RegionNull(&pSprite->Reg1); - RegionNull(&pSprite->Reg2); - } -#endif -} - -/** - * Update the mouse sprite info when the server switches from a pScreen to another. - * Otherwise, the pScreen of the mouse sprite is never updated when we switch - * from a pScreen to another. Never updating the pScreen of the mouse sprite - * implies that windows that are in pScreen whose pScreen->myNum >0 will never - * get pointer events. This is because in CheckMotion(), sprite.hotPhys.pScreen - * always points to the first pScreen it has been set by - * DefineInitialRootWindow(). - * - * Calling this function is useful for use cases where the server - * has more than one pScreen. - * This function is similar to DefineInitialRootWindow() but it does not - * reset the mouse pointer position. - * @param win must be the new pScreen we are switching to. - */ -void -UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) -{ - SpritePtr pSprite = NULL; - WindowPtr win = NULL; - CursorPtr pCursor; - if (!pScreen) - return ; - - if (!pDev->spriteInfo->sprite) - return; - - pSprite = pDev->spriteInfo->sprite; - - win = pScreen->root; - - pSprite->hotPhys.pScreen = pScreen; - pSprite->hot = pSprite->hotPhys; - pSprite->hotLimits.x2 = pScreen->width; - pSprite->hotLimits.y2 = pScreen->height; - pSprite->win = win; - pCursor = wCursor(win); - if (pCursor) - pCursor->refcnt++; - if (pSprite->current) - FreeCursor(pSprite->current, 0); - pSprite->current = pCursor; - pSprite->spriteTraceGood = 1; - pSprite->spriteTrace[0] = win; - (*pScreen->CursorLimits) (pDev, - pScreen, - pSprite->current, - &pSprite->hotLimits, - &pSprite->physLimits); - pSprite->confined = FALSE; - (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits); - (*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current); - -#ifdef PANORAMIX - if(!noPanoramiXExtension) { - pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; - pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; - pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; - pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; - pSprite->physLimits = pSprite->hotLimits; - pSprite->screen = pScreen; - } -#endif -} - -/* - * This does not take any shortcuts, and even ignores its argument, since - * it does not happen very often, and one has to walk up the tree since - * this might be a newly instantiated cursor for an intermediate window - * between the one the pointer is in and the one that the last cursor was - * instantiated from. - */ -void -WindowHasNewCursor(WindowPtr pWin) -{ - DeviceIntPtr pDev; - - for(pDev = inputInfo.devices; pDev; pDev = pDev->next) - if (DevHasCursor(pDev)) - PostNewCursor(pDev); -} - -void -NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y) -{ - SpritePtr pSprite = pDev->spriteInfo->sprite; - - pSprite->hotPhys.x = x; - pSprite->hotPhys.y = y; -#ifdef PANORAMIX - if(!noPanoramiXExtension) { - pSprite->hotPhys.x += newScreen->x - screenInfo.screens[0]->x; - pSprite->hotPhys.y += newScreen->y - screenInfo.screens[0]->y; - if (newScreen != pSprite->screen) { - pSprite->screen = newScreen; - /* Make sure we tell the DDX to update its copy of the screen */ - if(pSprite->confineWin) - XineramaConfineCursorToWindow(pDev, - pSprite->confineWin, TRUE); - else - XineramaConfineCursorToWindow(pDev, screenInfo.screens[0]->root, TRUE); - /* if the pointer wasn't confined, the DDX won't get - told of the pointer warp so we reposition it here */ - if(!syncEvents.playingEvents) - (*pSprite->screen->SetCursorPosition)( - pDev, - pSprite->screen, - pSprite->hotPhys.x + screenInfo.screens[0]->x - - pSprite->screen->x, - pSprite->hotPhys.y + screenInfo.screens[0]->y - - pSprite->screen->y, FALSE); - } - } else -#endif - if (newScreen != pSprite->hotPhys.pScreen) - ConfineCursorToWindow(pDev, newScreen->root, TRUE, FALSE); -} - -#ifdef PANORAMIX - -static Bool -XineramaPointInWindowIsVisible( - WindowPtr pWin, - int x, - int y -) -{ - BoxRec box; - int i, xoff, yoff; - - if (!pWin->realized) return FALSE; - - if (RegionContainsPoint(&pWin->borderClip, x, y, &box)) - return TRUE; - - if(!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE; - - xoff = x + screenInfo.screens[0]->x; - yoff = y + screenInfo.screens[0]->y; - - for(i = 1; i < PanoramiXNumScreens; i++) { - pWin = inputInfo.pointer->spriteInfo->sprite->windows[i]; - x = xoff - screenInfo.screens[i]->x; - y = yoff - screenInfo.screens[i]->y; - - if(RegionContainsPoint(&pWin->borderClip, x, y, &box) - && (!wInputShape(pWin) || - RegionContainsPoint(wInputShape(pWin), - x - pWin->drawable.x, - y - pWin->drawable.y, &box))) - return TRUE; - - } - - return FALSE; -} - -static int -XineramaWarpPointer(ClientPtr client) -{ - WindowPtr dest = NULL; - int x, y, rc; - SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite; - - REQUEST(xWarpPointerReq); - - - if (stuff->dstWid != None) { - rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); - if (rc != Success) - return rc; - } - x = pSprite->hotPhys.x; - y = pSprite->hotPhys.y; - - if (stuff->srcWid != None) - { - int winX, winY; - XID winID = stuff->srcWid; - WindowPtr source; - - rc = dixLookupWindow(&source, winID, client, DixReadAccess); - if (rc != Success) - return rc; - - winX = source->drawable.x; - winY = source->drawable.y; - if(source == screenInfo.screens[0]->root) { - winX -= screenInfo.screens[0]->x; - winY -= screenInfo.screens[0]->y; - } - if (x < winX + stuff->srcX || - y < winY + stuff->srcY || - (stuff->srcWidth != 0 && - winX + stuff->srcX + (int)stuff->srcWidth < x) || - (stuff->srcHeight != 0 && - winY + stuff->srcY + (int)stuff->srcHeight < y) || - !XineramaPointInWindowIsVisible(source, x, y)) - return Success; - } - if (dest) { - x = dest->drawable.x; - y = dest->drawable.y; - if(dest == screenInfo.screens[0]->root) { - x -= screenInfo.screens[0]->x; - y -= screenInfo.screens[0]->y; - } - } - - x += stuff->dstX; - y += stuff->dstY; - - if (x < pSprite->physLimits.x1) - x = pSprite->physLimits.x1; - else if (x >= pSprite->physLimits.x2) - x = pSprite->physLimits.x2 - 1; - if (y < pSprite->physLimits.y1) - y = pSprite->physLimits.y1; - else if (y >= pSprite->physLimits.y2) - y = pSprite->physLimits.y2 - 1; - if (pSprite->hotShape) - ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y); - - XineramaSetCursorPosition(PickPointer(client), x, y, TRUE); - - return Success; -} - -#endif - - -/** - * Server-side protocol handling for WarpPointer request. - * Warps the cursor position to the coordinates given in the request. - */ -int -ProcWarpPointer(ClientPtr client) -{ - WindowPtr dest = NULL; - int x, y, rc; - ScreenPtr newScreen; - DeviceIntPtr dev, tmp; - SpritePtr pSprite; - - REQUEST(xWarpPointerReq); - REQUEST_SIZE_MATCH(xWarpPointerReq); - - dev = PickPointer(client); - - for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { - if ((tmp == dev) || (!IsMaster(tmp) && tmp->u.master == dev)) { - rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess); - if (rc != Success) - return rc; - } - } - - if (dev->u.lastSlave) - dev = dev->u.lastSlave; - pSprite = dev->spriteInfo->sprite; - -#ifdef PANORAMIX - if(!noPanoramiXExtension) - return XineramaWarpPointer(client); -#endif - - if (stuff->dstWid != None) { - rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess); - if (rc != Success) - return rc; - } - x = pSprite->hotPhys.x; - y = pSprite->hotPhys.y; - - if (stuff->srcWid != None) - { - int winX, winY; - XID winID = stuff->srcWid; - WindowPtr source; - - rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess); - if (rc != Success) - return rc; - - winX = source->drawable.x; - winY = source->drawable.y; - if (source->drawable.pScreen != pSprite->hotPhys.pScreen || - x < winX + stuff->srcX || - y < winY + stuff->srcY || - (stuff->srcWidth != 0 && - winX + stuff->srcX + (int)stuff->srcWidth < x) || - (stuff->srcHeight != 0 && - winY + stuff->srcY + (int)stuff->srcHeight < y) || - !PointInWindowIsVisible(source, x, y)) - return Success; - } - if (dest) - { - x = dest->drawable.x; - y = dest->drawable.y; - newScreen = dest->drawable.pScreen; - } else - newScreen = pSprite->hotPhys.pScreen; - - x += stuff->dstX; - y += stuff->dstY; - - if (x < 0) - x = 0; - else if (x >= newScreen->width) - x = newScreen->width - 1; - if (y < 0) - y = 0; - else if (y >= newScreen->height) - y = newScreen->height - 1; - - if (newScreen == pSprite->hotPhys.pScreen) - { - if (x < pSprite->physLimits.x1) - x = pSprite->physLimits.x1; - else if (x >= pSprite->physLimits.x2) - x = pSprite->physLimits.x2 - 1; - if (y < pSprite->physLimits.y1) - y = pSprite->physLimits.y1; - else if (y >= pSprite->physLimits.y2) - y = pSprite->physLimits.y2 - 1; - if (pSprite->hotShape) - ConfineToShape(dev, pSprite->hotShape, &x, &y); - (*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE); - } - else if (!PointerConfinedToScreen(dev)) - { - NewCurrentScreen(dev, newScreen, x, y); - } - return Success; -} - -static Bool -BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin) -{ - if(RegionNotEmpty(&pWin->borderSize)) - return TRUE; - -#ifdef PANORAMIX - if(!noPanoramiXExtension && XineramaSetWindowPntrs(pDev, pWin)) { - int i; - - for(i = 1; i < PanoramiXNumScreens; i++) { - if(RegionNotEmpty(&pDev->spriteInfo->sprite->windows[i]->borderSize)) - return TRUE; - } - } -#endif - return FALSE; -} - -/** - * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a - * passive grab set on the window to be activated. - * If a passive grab is activated, the event will be delivered to the client. - * - * @param pWin The window that may be subject to a passive grab. - * @param device Device that caused the event. - * @param event The current device event. - * @param checkCore Check for core grabs too. - */ - -static Bool -CheckPassiveGrabsOnWindow( - WindowPtr pWin, - DeviceIntPtr device, - DeviceEvent *event, - BOOL checkCore) -{ - GrabPtr grab = wPassiveGrabs(pWin); - GrabRec tempGrab; - GrabInfoPtr grabinfo; -#define CORE_MATCH 0x1 -#define XI_MATCH 0x2 -#define XI2_MATCH 0x4 - int match = 0; - - if (!grab) - return FALSE; - /* Fill out the grab details, but leave the type for later before - * comparing */ - tempGrab.window = pWin; - tempGrab.device = device; - tempGrab.detail.exact = event->detail.key; - tempGrab.detail.pMask = NULL; - tempGrab.modifiersDetail.pMask = NULL; - tempGrab.next = NULL; - for (; grab; grab = grab->next) - { - DeviceIntPtr gdev; - XkbSrvInfoPtr xkbi = NULL; - - gdev= grab->modifierDevice; - if (grab->grabtype == GRABTYPE_CORE) - { - if (IsPointerDevice(device)) - gdev = GetPairedDevice(device); - else - gdev = device; - } else if (grab->grabtype == GRABTYPE_XI2) - { - /* if the device is an attached slave device, gdev must be the - * attached master keyboard. Since the slave may have been - * reattached after the grab, the modifier device may not be the - * same. */ - if (!IsMaster(grab->device) && device->u.master) - gdev = GetMaster(device, MASTER_KEYBOARD); - } - - - if (gdev && gdev->key) - xkbi= gdev->key->xkbInfo; - tempGrab.modifierDevice = grab->modifierDevice; - tempGrab.modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0; - - /* Check for XI2 and XI grabs first */ - tempGrab.type = GetXI2Type((InternalEvent*)event); - tempGrab.grabtype = GRABTYPE_XI2; - if (GrabMatchesSecond(&tempGrab, grab, FALSE)) - match = XI2_MATCH; - - tempGrab.detail.exact = event->detail.key; - if (!match) - { - tempGrab.type = GetXIType((InternalEvent*)event); - tempGrab.grabtype = GRABTYPE_XI; - if (GrabMatchesSecond(&tempGrab, grab, FALSE)) - match = XI_MATCH; - } - - /* Check for a core grab (ignore the device when comparing) */ - if (!match && checkCore) - { - tempGrab.grabtype = GRABTYPE_CORE; - if ((tempGrab.type = GetCoreType((InternalEvent*)event)) && - (GrabMatchesSecond(&tempGrab, grab, TRUE))) - match = CORE_MATCH; - } - - if (match && (!grab->confineTo || - (grab->confineTo->realized && - BorderSizeNotEmpty(device, grab->confineTo)))) - { - int rc, count = 0; - xEvent *xE = NULL; - xEvent core; - - event->corestate &= 0x1f00; - event->corestate |= tempGrab.modifiersDetail.exact & (~0x1f00); - grabinfo = &device->deviceGrab; - /* In some cases a passive core grab may exist, but the client - * already has a core grab on some other device. In this case we - * must not get the grab, otherwise we may never ungrab the - * device. - */ - - if (grab->grabtype == GRABTYPE_CORE) - { - DeviceIntPtr other; - BOOL interfering = FALSE; - - /* A passive grab may have been created for a different device - than it is assigned to at this point in time. - Update the grab's device and modifier device to reflect the - current state. - Since XGrabDeviceButton requires to specify the - modifierDevice explicitly, we don't override this choice. - */ - if (tempGrab.type < GenericEvent) - { - grab->device = device; - grab->modifierDevice = GetPairedDevice(device); - } - - for (other = inputInfo.devices; other; other = other->next) - { - GrabPtr othergrab = other->deviceGrab.grab; - if (othergrab && othergrab->grabtype == GRABTYPE_CORE && - SameClient(grab, rClient(othergrab)) && - ((IsPointerDevice(grab->device) && - IsPointerDevice(othergrab->device)) || - (IsKeyboardDevice(grab->device) && - IsKeyboardDevice(othergrab->device)))) - { - interfering = TRUE; - break; - } - } - if (interfering) - continue; - } - - - if (match & CORE_MATCH) - { - rc = EventToCore((InternalEvent*)event, &core); - if (rc != Success) - { - if (rc != BadMatch) - ErrorF("[dix] %s: core conversion failed in CPGFW " - "(%d, %d).\n", device->name, event->type, rc); - continue; - } - xE = &core; - count = 1; - } else if (match & XI2_MATCH) - { - rc = EventToXI2((InternalEvent*)event, &xE); - if (rc != Success) - { - if (rc != BadMatch) - ErrorF("[dix] %s: XI2 conversion failed in CPGFW " - "(%d, %d).\n", device->name, event->type, rc); - continue; - } - count = 1; - } else - { - rc = EventToXI((InternalEvent*)event, &xE, &count); - if (rc != Success) - { - if (rc != BadMatch) - ErrorF("[dix] %s: XI conversion failed in CPGFW " - "(%d, %d).\n", device->name, event->type, rc); - continue; - } - } - - (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE); - - if (xE) - { - FixUpEventFromWindow(device, xE, grab->window, None, TRUE); - - TryClientEvents(rClient(grab), device, xE, count, - GetEventFilter(device, xE), - GetEventFilter(device, xE), grab); - } - - if (grabinfo->sync.state == FROZEN_NO_EVENT) - { - if (!grabinfo->sync.event) - grabinfo->sync.event = calloc(1, sizeof(InternalEvent)); - *grabinfo->sync.event = *event; - grabinfo->sync.state = FROZEN_WITH_EVENT; - } - - if (match & (XI_MATCH | XI2_MATCH)) - free(xE); /* on core match xE == &core */ - return TRUE; - } - } - return FALSE; -#undef CORE_MATCH -#undef XI_MATCH -#undef XI2_MATCH -} - -/** - * CheckDeviceGrabs handles both keyboard and pointer events that may cause - * a passive grab to be activated. - * - * If the event is a keyboard event, the ancestors of the focus window are - * traced down and tried to see if they have any passive grabs to be - * activated. If the focus window itself is reached and it's descendants - * contain the pointer, the ancestors of the window that the pointer is in - * are then traced down starting at the focus window, otherwise no grabs are - * activated. - * If the event is a pointer event, the ancestors of the window that the - * pointer is in are traced down starting at the root until CheckPassiveGrabs - * causes a passive grab to activate or all the windows are - * tried. PRH - * - * If a grab is activated, the event has been sent to the client already! - * - * The event we pass in must always be an XI event. From this, we then emulate - * the core event and then check for grabs. - * - * @param device The device that caused the event. - * @param xE The event to handle (Device{Button|Key}Press). - * @param count Number of events in list. - * @return TRUE if a grab has been activated or false otherwise. -*/ - -Bool -CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor) -{ - int i; - WindowPtr pWin = NULL; - FocusClassPtr focus = IsPointerEvent((InternalEvent*)event) ? NULL : device->focus; - BOOL sendCore = (IsMaster(device) && device->coreEvents); - - if (event->type != ET_ButtonPress && - event->type != ET_KeyPress) - return FALSE; - - if (event->type == ET_ButtonPress - && (device->button->buttonsDown != 1)) - return FALSE; - - if (device->deviceGrab.grab) - return FALSE; - - i = 0; - if (ancestor) - { - while (i < device->spriteInfo->sprite->spriteTraceGood) - if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor) - break; - if (i == device->spriteInfo->sprite->spriteTraceGood) - return FALSE; - } - - if (focus) - { - for (; i < focus->traceGood; i++) - { - pWin = focus->trace[i]; - if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore)) - return TRUE; - } - - if ((focus->win == NoneWin) || - (i >= device->spriteInfo->sprite->spriteTraceGood) || - (pWin && pWin != device->spriteInfo->sprite->spriteTrace[i-1])) - return FALSE; - } - - for (; i < device->spriteInfo->sprite->spriteTraceGood; i++) - { - pWin = device->spriteInfo->sprite->spriteTrace[i]; - if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore)) - return TRUE; - } - - return FALSE; -} - -/** - * Called for keyboard events to deliver event to whatever client owns the - * focus. - * - * The event is delivered to the keyboard's focus window, the root window or - * to the window owning the input focus. - * - * @param keybd The keyboard originating the event. - * @param event The event, not yet in wire format. - * @param window Window underneath the sprite. - */ -void -DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) -{ - DeviceIntPtr ptr; - WindowPtr focus = keybd->focus->win; - BOOL sendCore = (IsMaster(keybd) && keybd->coreEvents); - xEvent core; - xEvent *xE = NULL, *xi2 = NULL; - int count, rc; - int deliveries = 0; - - if (focus == FollowKeyboardWin) - focus = inputInfo.keyboard->focus->win; - if (!focus) - return; - if (focus == PointerRootWin) - { - DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd); - return; - } - if ((focus == window) || IsParent(focus, window)) - { - if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd)) - return; - } - - /* just deliver it to the focus window */ - ptr = GetPairedDevice(keybd); - - - rc = EventToXI2(event, &xi2); - if (rc == Success) - { - /* XXX: XACE */ - int filter = GetEventFilter(keybd, xi2); - FixUpEventFromWindow(ptr, xi2, focus, None, FALSE); - deliveries = DeliverEventsToWindow(keybd, focus, xi2, 1, - filter, NullGrab); - if (deliveries > 0) - goto unwind; - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI2 conversion failed in DFE (%d, %d). Skipping delivery.\n", - keybd->name, event->any.type, rc); - - rc = EventToXI(event, &xE, &count); - if (rc == Success && - XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success) - { - FixUpEventFromWindow(ptr, xE, focus, None, FALSE); - deliveries = DeliverEventsToWindow(keybd, focus, xE, count, - GetEventFilter(keybd, xE), - NullGrab); - - if (deliveries > 0) - goto unwind; - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI conversion failed in DFE (%d, %d). Skipping delivery.\n", - keybd->name, event->any.type, rc); - - if (sendCore) - { - rc = EventToCore(event, &core); - if (rc == Success) { - if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, &core, 1) == Success) { - FixUpEventFromWindow(keybd, &core, focus, None, FALSE); - deliveries = DeliverEventsToWindow(keybd, focus, &core, 1, - GetEventFilter(keybd, &core), - NullGrab); - } - } else if (rc != BadMatch) - ErrorF("[dix] %s: core conversion failed DFE (%d, %d). Skipping delivery.\n", - keybd->name, event->any.type, rc); - } - -unwind: - free(xE); - free(xi2); - return; -} - -/** - * Deliver an event from a device that is currently grabbed. Uses - * DeliverDeviceEvents() for further delivery if a ownerEvents is set on the - * grab. If not, TryClientEvents() is used. - * - * @param deactivateGrab True if the device's grab should be deactivated. - */ -void -DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, - Bool deactivateGrab) -{ - GrabPtr grab; - GrabInfoPtr grabinfo; - int deliveries = 0; - DeviceIntPtr dev; - SpritePtr pSprite = thisDev->spriteInfo->sprite; - BOOL sendCore = FALSE; - int rc, count = 0; - xEvent *xi = NULL; - xEvent *xi2 = NULL; - - grabinfo = &thisDev->deviceGrab; - grab = grabinfo->grab; - - if (grab->ownerEvents) - { - WindowPtr focus; - - /* Hack: Some pointer device have a focus class. So we need to check - * for the type of event, to see if we really want to deliver it to - * the focus window. For pointer events, the answer is no. - */ - if (IsPointerEvent(event)) - focus = PointerRootWin; - else if (thisDev->focus) - { - focus = thisDev->focus->win; - if (focus == FollowKeyboardWin) - focus = inputInfo.keyboard->focus->win; - } - else - focus = PointerRootWin; - if (focus == PointerRootWin) - deliveries = DeliverDeviceEvents(pSprite->win, event, grab, - NullWindow, thisDev); - else if (focus && (focus == pSprite->win || - IsParent(focus, pSprite->win))) - deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus, - thisDev); - else if (focus) - deliveries = DeliverDeviceEvents(focus, event, grab, focus, - thisDev); - } - if (!deliveries) - { - Mask mask; - - /* XXX: In theory, we could pass the internal events through to - * everything and only convert just before hitting the wire. We can't - * do that yet, so DGE is the last stop for internal events. From here - * onwards, we deal with core/XI events. - */ - - mask = grab->eventMask; - - sendCore = (IsMaster(thisDev) && thisDev->coreEvents); - /* try core event */ - if (sendCore && grab->grabtype == GRABTYPE_CORE) - { - xEvent core; - - rc = EventToCore(event, &core); - if (rc == Success) - { - FixUpEventFromWindow(thisDev, &core, grab->window, - None, TRUE); - if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, - grab->window, &core, 1) || - XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), - grab->window, &core, 1)) - deliveries = 1; /* don't send, but pretend we did */ - else if (!IsInterferingGrab(rClient(grab), thisDev, &core)) - { - deliveries = TryClientEvents(rClient(grab), thisDev, - &core, 1, mask, - GetEventFilter(thisDev, &core), - grab); - } - } else if (rc != BadMatch) - ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n"); - } - - if (!deliveries) - { - rc = EventToXI2(event, &xi2); - if (rc == Success) - { - int evtype = ((xGenericEvent*)xi2)->evtype; - mask = grab->xi2mask[XIAllDevices][evtype/8] | - grab->xi2mask[XIAllMasterDevices][evtype/8] | - grab->xi2mask[thisDev->id][evtype/8]; - /* try XI2 event */ - FixUpEventFromWindow(thisDev, xi2, grab->window, None, TRUE); - /* XXX: XACE */ - deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask, - GetEventFilter(thisDev, xi2), grab); - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI2 conversion failed in DGE (%d, %d). Skipping delivery.\n", - thisDev->name, event->any.type, rc); - } - - if (!deliveries) - { - rc = EventToXI(event, &xi, &count); - if (rc == Success) - { - /* try XI event */ - if (grabinfo->fromPassiveGrab && - grabinfo->implicitGrab) - mask = grab->deviceMask; - else - mask = grab->eventMask; - - FixUpEventFromWindow(thisDev, xi, grab->window, - None, TRUE); - - if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, - grab->window, xi, count) || - XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), - grab->window, xi, count)) - deliveries = 1; /* don't send, but pretend we did */ - else - { - deliveries = - TryClientEvents(rClient(grab), thisDev, - xi, count, - mask, - GetEventFilter(thisDev, xi), - grab); - } - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI conversion failed in DGE (%d, %d). Skipping delivery.\n", - thisDev->name, event->any.type, rc); - } - - if (deliveries && (event->any.type == ET_Motion)) - thisDev->valuator->motionHintWindow = grab->window; - } - if (deliveries && !deactivateGrab && event->any.type != ET_Motion) - { - switch (grabinfo->sync.state) - { - case FREEZE_BOTH_NEXT_EVENT: - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (dev == thisDev) - continue; - FreezeThaw(dev, TRUE); - if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) && - (CLIENT_BITS(grab->resource) == - CLIENT_BITS(dev->deviceGrab.grab->resource))) - dev->deviceGrab.sync.state = FROZEN_NO_EVENT; - else - dev->deviceGrab.sync.other = grab; - } - /* fall through */ - case FREEZE_NEXT_EVENT: - grabinfo->sync.state = FROZEN_WITH_EVENT; - FreezeThaw(thisDev, TRUE); - if (!grabinfo->sync.event) - grabinfo->sync.event = calloc(1, sizeof(InternalEvent)); - *grabinfo->sync.event = event->device_event; - break; - } - } - - free(xi); - free(xi2); -} - -/* This function is used to set the key pressed or key released state - - this is only used when the pressing of keys does not cause - the device's processInputProc to be called, as in for example Mouse Keys. -*/ -void -FixKeyState (DeviceEvent *event, DeviceIntPtr keybd) -{ - int key = event->detail.key; - - if (event->type == ET_KeyPress) { - DebugF("FixKeyState: Key %d %s\n",key, - ((event->type == ET_KeyPress) ? "down" : "up")); - } - - if (event->type == ET_KeyPress) - set_key_down(keybd, key, KEY_PROCESSED); - else if (event->type == ET_KeyRelease) - set_key_up(keybd, key, KEY_PROCESSED); - else - FatalError("Impossible keyboard event"); -} - -#define AtMostOneClient \ - (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask) -#define ManagerMask \ - (SubstructureRedirectMask | ResizeRedirectMask) - -/** - * Recalculate which events may be deliverable for the given window. - * Recalculated mask is used for quicker determination which events may be - * delivered to a window. - * - * The otherEventMasks on a WindowOptional is the combination of all event - * masks set by all clients on the window. - * deliverableEventMask is the combination of the eventMask and the - * otherEventMask plus the events that may be propagated to the parent. - * - * Traverses to siblings and parents of the window. - */ -void -RecalculateDeliverableEvents(WindowPtr pWin) -{ - OtherClients *others; - WindowPtr pChild; - - pChild = pWin; - while (1) - { - if (pChild->optional) - { - pChild->optional->otherEventMasks = 0; - for (others = wOtherClients(pChild); others; others = others->next) - { - pChild->optional->otherEventMasks |= others->mask; - } - } - pChild->deliverableEvents = pChild->eventMask| - wOtherEventMasks(pChild); - if (pChild->parent) - pChild->deliverableEvents |= - (pChild->parent->deliverableEvents & - ~wDontPropagateMask(pChild) & PropagateMask); - if (pChild->firstChild) - { - pChild = pChild->firstChild; - continue; - } - while (!pChild->nextSib && (pChild != pWin)) - pChild = pChild->parent; - if (pChild == pWin) - break; - pChild = pChild->nextSib; - } -} - -/** - * - * \param value must conform to DeleteType - */ -int -OtherClientGone(pointer value, XID id) -{ - OtherClientsPtr other, prev; - WindowPtr pWin = (WindowPtr)value; - - prev = 0; - for (other = wOtherClients(pWin); other; other = other->next) - { - if (other->resource == id) - { - if (prev) - prev->next = other->next; - else - { - if (!(pWin->optional->otherClients = other->next)) - CheckWindowOptionalNeed (pWin); - } - free(other); - RecalculateDeliverableEvents(pWin); - return Success; - } - prev = other; - } - FatalError("client not on event list"); - /*NOTREACHED*/ - return -1; /* make compiler happy */ -} - -int -EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) -{ - Mask check; - OtherClients * others; - DeviceIntPtr dev; - int rc; - - if (mask & ~AllEventMasks) - { - client->errorValue = mask; - return BadValue; - } - check = (mask & ManagerMask); - if (check) { - rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, - RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess); - if (rc != Success) - return rc; - } - check = (mask & AtMostOneClient); - if (check & (pWin->eventMask|wOtherEventMasks(pWin))) - { /* It is illegal for two different - clients to select on any of the - events for AtMostOneClient. However, - it is OK, for some client to - continue selecting on one of those - events. */ - if ((wClient(pWin) != client) && (check & pWin->eventMask)) - return BadAccess; - for (others = wOtherClients (pWin); others; others = others->next) - { - if (!SameClient(others, client) && (check & others->mask)) - return BadAccess; - } - } - if (wClient (pWin) == client) - { - check = pWin->eventMask; - pWin->eventMask = mask; - } - else - { - for (others = wOtherClients (pWin); others; others = others->next) - { - if (SameClient(others, client)) - { - check = others->mask; - if (mask == 0) - { - FreeResource(others->resource, RT_NONE); - return Success; - } - else - others->mask = mask; - goto maskSet; - } - } - check = 0; - if (!pWin->optional && !MakeWindowOptional (pWin)) - return BadAlloc; - others = malloc(sizeof(OtherClients)); - if (!others) - return BadAlloc; - others->mask = mask; - others->resource = FakeClientID(client->index); - others->next = pWin->optional->otherClients; - pWin->optional->otherClients = others; - if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer)pWin)) - return BadAlloc; - } -maskSet: - if ((mask & PointerMotionHintMask) && !(check & PointerMotionHintMask)) - { - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (dev->valuator && dev->valuator->motionHintWindow == pWin) - dev->valuator->motionHintWindow = NullWindow; - } - } - RecalculateDeliverableEvents(pWin); - return Success; -} - -int -EventSuppressForWindow(WindowPtr pWin, ClientPtr client, - Mask mask, Bool *checkOptional) -{ - int i, free; - - if (mask & ~PropagateMask) - { - client->errorValue = mask; - return BadValue; - } - if (pWin->dontPropagate) - DontPropagateRefCnts[pWin->dontPropagate]--; - if (!mask) - i = 0; - else - { - for (i = DNPMCOUNT, free = 0; --i > 0; ) - { - if (!DontPropagateRefCnts[i]) - free = i; - else if (mask == DontPropagateMasks[i]) - break; - } - if (!i && free) - { - i = free; - DontPropagateMasks[i] = mask; - } - } - if (i || !mask) - { - pWin->dontPropagate = i; - if (i) - DontPropagateRefCnts[i]++; - if (pWin->optional) - { - pWin->optional->dontPropagateMask = mask; - *checkOptional = TRUE; - } - } - else - { - if (!pWin->optional && !MakeWindowOptional (pWin)) - { - if (pWin->dontPropagate) - DontPropagateRefCnts[pWin->dontPropagate]++; - return BadAlloc; - } - pWin->dontPropagate = 0; - pWin->optional->dontPropagateMask = mask; - } - RecalculateDeliverableEvents(pWin); - return Success; -} - -/** - * Assembles an EnterNotify or LeaveNotify and sends it event to the client. - * Uses the paired keyboard to get some additional information. - */ -void -CoreEnterLeaveEvent( - DeviceIntPtr mouse, - int type, - int mode, - int detail, - WindowPtr pWin, - Window child) -{ - xEvent event; - WindowPtr focus; - DeviceIntPtr keybd; - GrabPtr grab = mouse->deviceGrab.grab; - Mask mask; - - keybd = GetPairedDevice(mouse); - - if ((pWin == mouse->valuator->motionHintWindow) && - (detail != NotifyInferior)) - mouse->valuator->motionHintWindow = NullWindow; - if (grab) - { - mask = (pWin == grab->window) ? grab->eventMask : 0; - if (grab->ownerEvents) - mask |= EventMaskForClient(pWin, rClient(grab)); - } - else - { - mask = pWin->eventMask | wOtherEventMasks(pWin); - } - - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = type; - event.u.u.detail = detail; - event.u.enterLeave.time = currentTime.milliseconds; - event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x; - event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y; - /* Counts on the same initial structure of crossing & button events! */ - FixUpEventFromWindow(mouse, &event, pWin, None, FALSE); - /* Enter/Leave events always set child */ - event.u.enterLeave.child = child; - event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ? - ELFlagSameScreen : 0; - event.u.enterLeave.state = mouse->button ? (mouse->button->state & 0x1f00) : 0; - if (keybd) - event.u.enterLeave.state |= - XkbGrabStateFromRec(&keybd->key->xkbInfo->state); - event.u.enterLeave.mode = mode; - focus = (keybd) ? keybd->focus->win : None; - if ((focus != NoneWin) && - ((pWin == focus) || (focus == PointerRootWin) || - IsParent(focus, pWin))) - event.u.enterLeave.flags |= ELFlagFocus; - - if ((mask & GetEventFilter(mouse, &event))) - { - if (grab) - TryClientEvents(rClient(grab), mouse, &event, 1, mask, - GetEventFilter(mouse, &event), grab); - else - DeliverEventsToWindow(mouse, pWin, &event, 1, - GetEventFilter(mouse, &event), - NullGrab); - } - - if ((type == EnterNotify) && (mask & KeymapStateMask)) - { - xKeymapEvent ke; - ClientPtr client = grab ? rClient(grab) : wClient(pWin); - if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess)) - memset((char *)&ke.map[0], 0, 31); - else - memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); - - ke.type = KeymapNotify; - if (grab) - TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1, - mask, KeymapStateMask, grab); - else - DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1, - KeymapStateMask, NullGrab); - } -} - -void -DeviceEnterLeaveEvent( - DeviceIntPtr mouse, - int sourceid, - int type, - int mode, - int detail, - WindowPtr pWin, - Window child) -{ - GrabPtr grab = mouse->deviceGrab.grab; - xXIEnterEvent *event; - int filter; - int btlen, len, i; - DeviceIntPtr kbd; - - if ((mode == XINotifyPassiveGrab && type == XI_Leave) || - (mode == XINotifyPassiveUngrab && type == XI_Enter)) - return; - - btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; - btlen = bytes_to_int32(btlen); - len = sizeof(xXIEnterEvent) + btlen * 4; - - event = calloc(1, len); - event->type = GenericEvent; - event->extension = IReqCode; - event->evtype = type; - event->length = (len - sizeof(xEvent))/4; - event->buttons_len = btlen; - event->detail = detail; - event->time = currentTime.milliseconds; - event->deviceid = mouse->id; - event->sourceid = sourceid; - event->mode = mode; - event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0); - event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0); - - for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) - if (BitIsOn(mouse->button->down, i)) - SetBit(&event[1], i); - - kbd = (IsMaster(mouse) || mouse->u.master) ? GetPairedDevice(mouse) : NULL; - if (kbd && kbd->key) - { - event->mods.base_mods = kbd->key->xkbInfo->state.base_mods; - event->mods.latched_mods = kbd->key->xkbInfo->state.latched_mods; - event->mods.locked_mods = kbd->key->xkbInfo->state.locked_mods; - - event->group.base_group = kbd->key->xkbInfo->state.base_group; - event->group.latched_group = kbd->key->xkbInfo->state.latched_group; - event->group.locked_group = kbd->key->xkbInfo->state.locked_group; - } - - FixUpEventFromWindow(mouse, (xEvent*)event, pWin, None, FALSE); - - filter = GetEventFilter(mouse, (xEvent*)event); - - if (grab) - { - Mask mask; - mask = grab->xi2mask[XIAllDevices][type/8] | - grab->xi2mask[XIAllMasterDevices][type/8] | - grab->xi2mask[mouse->id][type/8]; - TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask, - filter, grab); - } else { - if (!GetWindowXI2Mask(mouse, pWin, (xEvent*)event)) - goto out; - DeliverEventsToWindow(mouse, pWin, (xEvent*)event, 1, filter, - NullGrab); - } - -out: - free(event); -} - -void -CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) -{ - xEvent event; - - memset(&event, 0, sizeof(xEvent)); - event.u.focus.mode = mode; - event.u.u.type = type; - event.u.u.detail = detail; - event.u.focus.window = pWin->drawable.id; - - DeliverEventsToWindow(dev, pWin, &event, 1, - GetEventFilter(dev, &event), NullGrab); - if ((type == FocusIn) && - ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) - { - xKeymapEvent ke; - ClientPtr client = wClient(pWin); - if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess)) - memset((char *)&ke.map[0], 0, 31); - else - memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); - - ke.type = KeymapNotify; - DeliverEventsToWindow(dev, pWin, (xEvent *)&ke, 1, - KeymapStateMask, NullGrab); - } -} - -/** - * Set the input focus to the given window. Subsequent keyboard events will be - * delivered to the given window. - * - * Usually called from ProcSetInputFocus as result of a client request. If so, - * the device is the inputInfo.keyboard. - * If called from ProcXSetInputFocus as result of a client xinput request, the - * device is set to the device specified by the client. - * - * @param client Client that requested input focus change. - * @param dev Focus device. - * @param focusID The window to obtain the focus. Can be PointerRoot or None. - * @param revertTo Specifies where the focus reverts to when window becomes - * unviewable. - * @param ctime Specifies the time. - * @param followOK True if pointer is allowed to follow the keyboard. - */ -int -SetInputFocus( - ClientPtr client, - DeviceIntPtr dev, - Window focusID, - CARD8 revertTo, - Time ctime, - Bool followOK) -{ - FocusClassPtr focus; - WindowPtr focusWin; - int mode, rc; - TimeStamp time; - DeviceIntPtr keybd; /* used for FollowKeyboard or FollowKeyboardWin */ - - - UpdateCurrentTime(); - if ((revertTo != RevertToParent) && - (revertTo != RevertToPointerRoot) && - (revertTo != RevertToNone) && - ((revertTo != RevertToFollowKeyboard) || !followOK)) - { - client->errorValue = revertTo; - return BadValue; - } - time = ClientTimeToServerTime(ctime); - - if (IsKeyboardDevice(dev)) - keybd = dev; - else - keybd = GetPairedDevice(dev); - - if ((focusID == None) || (focusID == PointerRoot)) - focusWin = (WindowPtr)(long)focusID; - else if ((focusID == FollowKeyboard) && followOK) - { - focusWin = keybd->focus->win; - } - else { - rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess); - if (rc != Success) - return rc; - /* It is a match error to try to set the input focus to an - unviewable window. */ - if(!focusWin->realized) - return BadMatch; - } - rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetFocusAccess); - if (rc != Success) - return Success; - - focus = dev->focus; - if ((CompareTimeStamps(time, currentTime) == LATER) || - (CompareTimeStamps(time, focus->time) == EARLIER)) - return Success; - mode = (dev->deviceGrab.grab) ? NotifyWhileGrabbed : NotifyNormal; - if (focus->win == FollowKeyboardWin) - { - if (!ActivateFocusInGrab(dev, keybd->focus->win, focusWin)) - DoFocusEvents(dev, keybd->focus->win, focusWin, mode); - } else - { - if (!ActivateFocusInGrab(dev, focus->win, focusWin)) - DoFocusEvents(dev, focus->win, focusWin, mode); - } - focus->time = time; - focus->revert = revertTo; - if (focusID == FollowKeyboard) - focus->win = FollowKeyboardWin; - else - focus->win = focusWin; - if ((focusWin == NoneWin) || (focusWin == PointerRootWin)) - focus->traceGood = 0; - else - { - int depth = 0; - WindowPtr pWin; - - for (pWin = focusWin; pWin; pWin = pWin->parent) depth++; - if (depth > focus->traceSize) - { - focus->traceSize = depth+1; - focus->trace = realloc(focus->trace, - focus->traceSize * sizeof(WindowPtr)); - } - focus->traceGood = depth; - for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--) - focus->trace[depth] = pWin; - } - return Success; -} - -/** - * Server-side protocol handling for SetInputFocus request. - * - * Sets the input focus for the virtual core keyboard. - */ -int -ProcSetInputFocus(ClientPtr client) -{ - DeviceIntPtr kbd = PickKeyboard(client); - REQUEST(xSetInputFocusReq); - - REQUEST_SIZE_MATCH(xSetInputFocusReq); - - return SetInputFocus(client, kbd, stuff->focus, - stuff->revertTo, stuff->time, FALSE); -} - -/** - * Server-side protocol handling for GetInputFocus request. - * - * Sends the current input focus for the client's keyboard back to the - * client. - */ -int -ProcGetInputFocus(ClientPtr client) -{ - DeviceIntPtr kbd = PickKeyboard(client); - xGetInputFocusReply rep; - FocusClassPtr focus = kbd->focus; - int rc; - /* REQUEST(xReq); */ - REQUEST_SIZE_MATCH(xReq); - - rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetFocusAccess); - if (rc != Success) - return rc; - - memset(&rep, 0, sizeof(xGetInputFocusReply)); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - if (focus->win == NoneWin) - rep.focus = None; - else if (focus->win == PointerRootWin) - rep.focus = PointerRoot; - else rep.focus = focus->win->drawable.id; - rep.revertTo = focus->revert; - WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); - return Success; -} - -/** - * Server-side protocol handling for GrabPointer request. - * - * Sets an active grab on the client's ClientPointer and returns success - * status to client. - */ -int -ProcGrabPointer(ClientPtr client) -{ - xGrabPointerReply rep; - DeviceIntPtr device = PickPointer(client); - GrabPtr grab; - GrabMask mask; - WindowPtr confineTo; - CursorPtr oldCursor; - REQUEST(xGrabPointerReq); - TimeStamp time; - int rc; - - REQUEST_SIZE_MATCH(xGrabPointerReq); - UpdateCurrentTime(); - - if (stuff->eventMask & ~PointerGrabMask) - { - client->errorValue = stuff->eventMask; - return BadValue; - } - - if (stuff->confineTo == None) - confineTo = NullWindow; - else - { - rc = dixLookupWindow(&confineTo, stuff->confineTo, client, - DixSetAttrAccess); - if (rc != Success) - return rc; - } - - memset(&rep, 0, sizeof(xGrabPointerReply)); - oldCursor = NullCursor; - grab = device->deviceGrab.grab; - - if (grab) - { - if (grab->confineTo && !confineTo) - ConfineCursorToWindow(device, RootWindow(device), FALSE, FALSE); - oldCursor = grab->cursor; - } - - mask.core = stuff->eventMask; - - rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode, - stuff->grabWindow, stuff->ownerEvents, stuff->time, - &mask, GRABTYPE_CORE, stuff->cursor, - stuff->confineTo, &rep.status); - if (rc != Success) - return rc; - - if (oldCursor && rep.status == GrabSuccess) - FreeCursor (oldCursor, (Cursor)0); - - time = ClientTimeToServerTime(stuff->time); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep); - return Success; -} - -/** - * Server-side protocol handling for ChangeActivePointerGrab request. - * - * Changes properties of the grab hold by the client. If the client does not - * hold an active grab on the device, nothing happens. - */ -int -ProcChangeActivePointerGrab(ClientPtr client) -{ - DeviceIntPtr device; - GrabPtr grab; - CursorPtr newCursor, oldCursor; - REQUEST(xChangeActivePointerGrabReq); - TimeStamp time; - - REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); - if (stuff->eventMask & ~PointerGrabMask) - { - client->errorValue = stuff->eventMask; - return BadValue; - } - if (stuff->cursor == None) - newCursor = NullCursor; - else - { - int rc = dixLookupResourceByType((pointer *)&newCursor, stuff->cursor, - RT_CURSOR, client, DixUseAccess); - if (rc != Success) - { - client->errorValue = stuff->cursor; - return rc; - } - } - - device = PickPointer(client); - grab = device->deviceGrab.grab; - - if (!grab) - return Success; - if (!SameClient(grab, client)) - return Success; - time = ClientTimeToServerTime(stuff->time); - if ((CompareTimeStamps(time, currentTime) == LATER) || - (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER)) - return Success; - oldCursor = grab->cursor; - grab->cursor = newCursor; - if (newCursor) - newCursor->refcnt++; - PostNewCursor(device); - if (oldCursor) - FreeCursor(oldCursor, (Cursor)0); - grab->eventMask = stuff->eventMask; - return Success; -} - -/** - * Server-side protocol handling for UngrabPointer request. - * - * Deletes a pointer grab on a device the client has grabbed. - */ -int -ProcUngrabPointer(ClientPtr client) -{ - DeviceIntPtr device = PickPointer(client); - GrabPtr grab; - TimeStamp time; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - UpdateCurrentTime(); - grab = device->deviceGrab.grab; - - time = ClientTimeToServerTime(stuff->id); - if ((CompareTimeStamps(time, currentTime) != LATER) && - (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && - (grab) && SameClient(grab, client)) - (*device->deviceGrab.DeactivateGrab)(device); - return Success; -} - -/** - * Sets a grab on the given device. - * - * Called from ProcGrabKeyboard to work on the client's keyboard. - * Called from ProcXGrabDevice to work on the device specified by the client. - * - * The parameters this_mode and other_mode represent the keyboard_mode and - * pointer_mode parameters of XGrabKeyboard(). - * See man page for details on all the parameters - * - * @param client Client that owns the grab. - * @param dev The device to grab. - * @param this_mode GrabModeSync or GrabModeAsync - * @param other_mode GrabModeSync or GrabModeAsync - * @param status Return code to be returned to the caller. - * - * @returns Success or BadValue. - */ -int -GrabDevice(ClientPtr client, DeviceIntPtr dev, - unsigned pointer_mode, unsigned keyboard_mode, Window grabWindow, - unsigned ownerEvents, Time ctime, GrabMask *mask, - int grabtype, Cursor curs, Window confineToWin, CARD8 *status) -{ - WindowPtr pWin, confineTo; - GrabPtr grab; - TimeStamp time; - Mask access_mode = DixGrabAccess; - int rc; - GrabInfoPtr grabInfo = &dev->deviceGrab; - CursorPtr cursor; - - UpdateCurrentTime(); - if ((keyboard_mode != GrabModeSync) && (keyboard_mode != GrabModeAsync)) - { - client->errorValue = keyboard_mode; - return BadValue; - } - if ((pointer_mode != GrabModeSync) && (pointer_mode != GrabModeAsync)) - { - client->errorValue = pointer_mode; - return BadValue; - } - if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) - { - client->errorValue = ownerEvents; - return BadValue; - } - - rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); - if (rc != Success) - return rc; - - if (confineToWin == None) - confineTo = NullWindow; - else - { - rc = dixLookupWindow(&confineTo, confineToWin, client, - DixSetAttrAccess); - if (rc != Success) - return rc; - } - - if (curs == None) - cursor = NullCursor; - else - { - rc = dixLookupResourceByType((pointer *)&cursor, curs, RT_CURSOR, - client, DixUseAccess); - if (rc != Success) - { - client->errorValue = curs; - return rc; - } - access_mode |= DixForceAccess; - } - - if (keyboard_mode == GrabModeSync || pointer_mode == GrabModeSync) - access_mode |= DixFreezeAccess; - rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); - if (rc != Success) - return rc; - - time = ClientTimeToServerTime(ctime); - grab = grabInfo->grab; - if (grab && grab->grabtype != grabtype) - *status = AlreadyGrabbed; - if (grab && !SameClient(grab, client)) - *status = AlreadyGrabbed; - else if ((!pWin->realized) || - (confineTo && - !(confineTo->realized - && BorderSizeNotEmpty(dev, confineTo)))) - *status = GrabNotViewable; - else if ((CompareTimeStamps(time, currentTime) == LATER) || - (CompareTimeStamps(time, grabInfo->grabTime) == EARLIER)) - *status = GrabInvalidTime; - else if (grabInfo->sync.frozen && - grabInfo->sync.other && !SameClient(grabInfo->sync.other, client)) - *status = GrabFrozen; - else - { - GrabRec tempGrab; - - /* Otherwise segfaults happen on grabbed MPX devices */ - memset(&tempGrab, 0, sizeof(GrabRec)); - - tempGrab.next = NULL; - tempGrab.window = pWin; - tempGrab.resource = client->clientAsMask; - tempGrab.ownerEvents = ownerEvents; - tempGrab.keyboardMode = keyboard_mode; - tempGrab.pointerMode = pointer_mode; - if (grabtype == GRABTYPE_CORE) - tempGrab.eventMask = mask->core; - else if (grabtype == GRABTYPE_XI) - tempGrab.eventMask = mask->xi; - else - memcpy(tempGrab.xi2mask, mask->xi2mask, sizeof(tempGrab.xi2mask)); - tempGrab.device = dev; - tempGrab.cursor = cursor; - tempGrab.confineTo = confineTo; - tempGrab.grabtype = grabtype; - (*grabInfo->ActivateGrab)(dev, &tempGrab, time, FALSE); - *status = GrabSuccess; - } - return Success; -} - -/** - * Server-side protocol handling for GrabKeyboard request. - * - * Grabs the client's keyboard and returns success status to client. - */ -int -ProcGrabKeyboard(ClientPtr client) -{ - xGrabKeyboardReply rep; - REQUEST(xGrabKeyboardReq); - int result; - DeviceIntPtr keyboard = PickKeyboard(client); - GrabMask mask; - - REQUEST_SIZE_MATCH(xGrabKeyboardReq); - - memset(&rep, 0, sizeof(xGrabKeyboardReply)); - mask.core = KeyPressMask | KeyReleaseMask; - - result = GrabDevice(client, keyboard, stuff->pointerMode, - stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, - stuff->time, &mask, GRABTYPE_CORE, None, None, - &rep.status); - - if (result != Success) - return result; - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); - return Success; -} - -/** - * Server-side protocol handling for UngrabKeyboard request. - * - * Deletes a possible grab on the client's keyboard. - */ -int -ProcUngrabKeyboard(ClientPtr client) -{ - DeviceIntPtr device = PickKeyboard(client); - GrabPtr grab; - TimeStamp time; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - UpdateCurrentTime(); - - grab = device->deviceGrab.grab; - - time = ClientTimeToServerTime(stuff->id); - if ((CompareTimeStamps(time, currentTime) != LATER) && - (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && - (grab) && SameClient(grab, client) && grab->grabtype == GRABTYPE_CORE) - (*device->deviceGrab.DeactivateGrab)(device); - return Success; -} - -/** - * Server-side protocol handling for QueryPointer request. - * - * Returns the current state and position of the client's ClientPointer to the - * client. - */ -int -ProcQueryPointer(ClientPtr client) -{ - xQueryPointerReply rep; - WindowPtr pWin, t; - DeviceIntPtr mouse = PickPointer(client); - DeviceIntPtr keyboard; - SpritePtr pSprite; - int rc; - REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - - rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); - if (rc != Success) - return rc; - rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); - if (rc != Success && rc != BadAccess) - return rc; - - keyboard = GetPairedDevice(mouse); - - pSprite = mouse->spriteInfo->sprite; - if (mouse->valuator->motionHintWindow) - MaybeStopHint(mouse, client); - memset(&rep, 0, sizeof(xQueryPointerReply)); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.mask = mouse->button ? (mouse->button->state) : 0; - rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state); - rep.length = 0; - rep.root = (RootWindow(mouse))->drawable.id; - rep.rootX = pSprite->hot.x; - rep.rootY = pSprite->hot.y; - rep.child = None; - if (pSprite->hot.pScreen == pWin->drawable.pScreen) - { - rep.sameScreen = xTrue; - rep.winX = pSprite->hot.x - pWin->drawable.x; - rep.winY = pSprite->hot.y - pWin->drawable.y; - for (t = pSprite->win; t; t = t->parent) - if (t->parent == pWin) - { - rep.child = t->drawable.id; - break; - } - } - else - { - rep.sameScreen = xFalse; - rep.winX = 0; - rep.winY = 0; - } - -#ifdef PANORAMIX - if(!noPanoramiXExtension) { - rep.rootX += screenInfo.screens[0]->x; - rep.rootY += screenInfo.screens[0]->y; - if(stuff->id == rep.root) { - rep.winX += screenInfo.screens[0]->x; - rep.winY += screenInfo.screens[0]->y; - } - } -#endif - - if (rc == BadAccess) { - rep.mask = 0; - rep.child = None; - rep.rootX = 0; - rep.rootY = 0; - rep.winX = 0; - rep.winY = 0; - } - - WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep); - - return Success; -} - -/** - * Initializes the device list and the DIX sprite to sane values. Allocates - * trace memory used for quick window traversal. - */ -void -InitEvents(void) -{ - int i; - - inputInfo.numDevices = 0; - inputInfo.devices = (DeviceIntPtr)NULL; - inputInfo.off_devices = (DeviceIntPtr)NULL; - inputInfo.keyboard = (DeviceIntPtr)NULL; - inputInfo.pointer = (DeviceIntPtr)NULL; - /* The mask for pointer motion events may have changed in the last server - * generation. See comment above definition of filters. */ - filters[0][PointerMotionMask] = MotionNotify; - for (i = 1; i < MAXDEVICES; i++) - { - memcpy(&filters[i], filters[0], sizeof(filters[0])); - } - - syncEvents.replayDev = (DeviceIntPtr)NULL; - syncEvents.replayWin = NullWindow; - while (syncEvents.pending) - { - QdEventPtr next = syncEvents.pending->next; - free(syncEvents.pending); - syncEvents.pending = next; - } - syncEvents.pendtail = &syncEvents.pending; - syncEvents.playingEvents = FALSE; - syncEvents.time.months = 0; - syncEvents.time.milliseconds = 0; /* hardly matters */ - currentTime.months = 0; - currentTime.milliseconds = GetTimeInMillis(); - lastDeviceEventTime = currentTime; - for (i = 0; i < DNPMCOUNT; i++) - { - DontPropagateMasks[i] = 0; - DontPropagateRefCnts[i] = 0; - } - - InputEventListLen = GetMaximumEventsNum(); - InputEventList = InitEventList(InputEventListLen); - if (!InputEventList) - FatalError("[dix] Failed to allocate input event list.\n"); -} - -void -CloseDownEvents(void) -{ - FreeEventList(InputEventList, InputEventListLen); - InputEventListLen = 0; - InputEventList = NULL; -} - -/** - * Server-side protocol handling for SendEvent request. - * - * Locates the window to send the event to and forwards the event. - */ -int -ProcSendEvent(ClientPtr client) -{ - WindowPtr pWin; - WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ - DeviceIntPtr dev = PickPointer(client); - DeviceIntPtr keybd = GetPairedDevice(dev); - SpritePtr pSprite = dev->spriteInfo->sprite; - REQUEST(xSendEventReq); - - REQUEST_SIZE_MATCH(xSendEventReq); - - /* The client's event type must be a core event type or one defined by an - extension. */ - - if ( ! ((stuff->event.u.u.type > X_Reply && - stuff->event.u.u.type < LASTEvent) || - (stuff->event.u.u.type >= EXTENSION_EVENT_BASE && - stuff->event.u.u.type < (unsigned)lastEvent))) - { - client->errorValue = stuff->event.u.u.type; - return BadValue; - } - if (stuff->event.u.u.type == ClientMessage && - stuff->event.u.u.detail != 8 && - stuff->event.u.u.detail != 16 && - stuff->event.u.u.detail != 32) - { - client->errorValue = stuff->event.u.u.detail; - return BadValue; - } - if (stuff->eventMask & ~AllEventMasks) - { - client->errorValue = stuff->eventMask; - return BadValue; - } - - if (stuff->destination == PointerWindow) - pWin = pSprite->win; - else if (stuff->destination == InputFocus) - { - WindowPtr inputFocus = (keybd) ? keybd->focus->win : NoneWin; - - if (inputFocus == NoneWin) - return Success; - - /* If the input focus is PointerRootWin, send the event to where - the pointer is if possible, then perhaps propogate up to root. */ - if (inputFocus == PointerRootWin) - inputFocus = RootWindow(dev); - - if (IsParent(inputFocus, pSprite->win)) - { - effectiveFocus = inputFocus; - pWin = pSprite->win; - } - else - effectiveFocus = pWin = inputFocus; - } - else - dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess); - - if (!pWin) - return BadWindow; - if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) - { - client->errorValue = stuff->propagate; - return BadValue; - } - stuff->event.u.u.type |= 0x80; - if (stuff->propagate) - { - for (;pWin; pWin = pWin->parent) - { - if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, - &stuff->event, 1)) - return Success; - if (DeliverEventsToWindow(dev, pWin, - &stuff->event, 1, stuff->eventMask, NullGrab)) - return Success; - if (pWin == effectiveFocus) - return Success; - stuff->eventMask &= ~wDontPropagateMask(pWin); - if (!stuff->eventMask) - break; - } - } - else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1)) - DeliverEventsToWindow(dev, pWin, &stuff->event, - 1, stuff->eventMask, NullGrab); - return Success; -} - -/** - * Server-side protocol handling for UngrabKey request. - * - * Deletes a passive grab for the given key. Works on the - * client's keyboard. - */ -int -ProcUngrabKey(ClientPtr client) -{ - REQUEST(xUngrabKeyReq); - WindowPtr pWin; - GrabRec tempGrab; - DeviceIntPtr keybd = PickKeyboard(client); - int rc; - - REQUEST_SIZE_MATCH(xUngrabKeyReq); - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixGetAttrAccess); - if (rc != Success) - return rc; - - if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) || - (stuff->key < keybd->key->xkbInfo->desc->min_key_code)) - && (stuff->key != AnyKey)) - { - client->errorValue = stuff->key; - return BadValue; - } - if ((stuff->modifiers != AnyModifier) && - (stuff->modifiers & ~AllModifiersMask)) - { - client->errorValue = stuff->modifiers; - return BadValue; - } - tempGrab.resource = client->clientAsMask; - tempGrab.device = keybd; - tempGrab.window = pWin; - tempGrab.modifiersDetail.exact = stuff->modifiers; - tempGrab.modifiersDetail.pMask = NULL; - tempGrab.modifierDevice = GetPairedDevice(keybd); - tempGrab.type = KeyPress; - tempGrab.grabtype = GRABTYPE_CORE; - tempGrab.detail.exact = stuff->key; - tempGrab.detail.pMask = NULL; - tempGrab.next = NULL; - - if (!DeletePassiveGrabFromList(&tempGrab)) - return BadAlloc; - return Success; -} - -/** - * Server-side protocol handling for GrabKey request. - * - * Creates a grab for the client's keyboard and adds it to the list of passive - * grabs. - */ -int -ProcGrabKey(ClientPtr client) -{ - WindowPtr pWin; - REQUEST(xGrabKeyReq); - GrabPtr grab; - DeviceIntPtr keybd = PickKeyboard(client); - int rc; - GrabParameters param; - GrabMask mask; - - REQUEST_SIZE_MATCH(xGrabKeyReq); - - memset(¶m, 0, sizeof(param)); - param.grabtype = GRABTYPE_CORE; - param.ownerEvents = stuff->ownerEvents; - param.this_device_mode = stuff->keyboardMode; - param.other_devices_mode = stuff->pointerMode; - param.modifiers = stuff->modifiers; - - rc = CheckGrabValues(client, ¶m); - if (rc != Success) - return rc; - - if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) || - (stuff->key < keybd->key->xkbInfo->desc->min_key_code)) - && (stuff->key != AnyKey)) - { - client->errorValue = stuff->key; - return BadValue; - } - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); - if (rc != Success) - return rc; - - - mask.core = (KeyPressMask | KeyReleaseMask); - - grab = CreateGrab(client->index, keybd, keybd, pWin, GRABTYPE_CORE, &mask, - ¶m, KeyPress, stuff->key, NullWindow, NullCursor); - if (!grab) - return BadAlloc; - return AddPassiveGrabToList(client, grab); -} - - -/** - * Server-side protocol handling for GrabButton request. - * - * Creates a grab for the client's ClientPointer and adds it as a passive grab - * to the list. - */ -int -ProcGrabButton(ClientPtr client) -{ - WindowPtr pWin, confineTo; - REQUEST(xGrabButtonReq); - CursorPtr cursor; - GrabPtr grab; - DeviceIntPtr ptr, modifierDevice; - Mask access_mode = DixGrabAccess; - GrabMask mask; - GrabParameters param; - int rc; - - REQUEST_SIZE_MATCH(xGrabButtonReq); - if ((stuff->pointerMode != GrabModeSync) && - (stuff->pointerMode != GrabModeAsync)) - { - client->errorValue = stuff->pointerMode; - return BadValue; - } - if ((stuff->keyboardMode != GrabModeSync) && - (stuff->keyboardMode != GrabModeAsync)) - { - client->errorValue = stuff->keyboardMode; - return BadValue; - } - if ((stuff->modifiers != AnyModifier) && - (stuff->modifiers & ~AllModifiersMask)) - { - client->errorValue = stuff->modifiers; - return BadValue; - } - if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) - { - client->errorValue = stuff->ownerEvents; - return BadValue; - } - if (stuff->eventMask & ~PointerGrabMask) - { - client->errorValue = stuff->eventMask; - return BadValue; - } - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); - if (rc != Success) - return rc; - if (stuff->confineTo == None) - confineTo = NullWindow; - else { - rc = dixLookupWindow(&confineTo, stuff->confineTo, client, - DixSetAttrAccess); - if (rc != Success) - return rc; - } - if (stuff->cursor == None) - cursor = NullCursor; - else - { - rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR, - client, DixUseAccess); - if (rc != Success) - { - client->errorValue = stuff->cursor; - return rc; - } - access_mode |= DixForceAccess; - } - - ptr = PickPointer(client); - modifierDevice = GetPairedDevice(ptr); - if (stuff->pointerMode == GrabModeSync || - stuff->keyboardMode == GrabModeSync) - access_mode |= DixFreezeAccess; - rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, access_mode); - if (rc != Success) - return rc; - - memset(¶m, 0, sizeof(param)); - param.grabtype = GRABTYPE_CORE; - param.ownerEvents = stuff->ownerEvents; - param.this_device_mode = stuff->keyboardMode; - param.other_devices_mode = stuff->pointerMode; - param.modifiers = stuff->modifiers; - - mask.core = stuff->eventMask; - - grab = CreateGrab(client->index, ptr, modifierDevice, pWin, - GRABTYPE_CORE, &mask, ¶m, ButtonPress, - stuff->button, confineTo, cursor); - if (!grab) - return BadAlloc; - return AddPassiveGrabToList(client, grab); -} - -/** - * Server-side protocol handling for UngrabButton request. - * - * Deletes a passive grab on the client's ClientPointer from the list. - */ -int -ProcUngrabButton(ClientPtr client) -{ - REQUEST(xUngrabButtonReq); - WindowPtr pWin; - GrabRec tempGrab; - int rc; - DeviceIntPtr ptr; - - REQUEST_SIZE_MATCH(xUngrabButtonReq); - if ((stuff->modifiers != AnyModifier) && - (stuff->modifiers & ~AllModifiersMask)) - { - client->errorValue = stuff->modifiers; - return BadValue; - } - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); - if (rc != Success) - return rc; - - ptr = PickPointer(client); - - tempGrab.resource = client->clientAsMask; - tempGrab.device = ptr; - tempGrab.window = pWin; - tempGrab.modifiersDetail.exact = stuff->modifiers; - tempGrab.modifiersDetail.pMask = NULL; - tempGrab.modifierDevice = GetPairedDevice(ptr); - tempGrab.type = ButtonPress; - tempGrab.detail.exact = stuff->button; - tempGrab.grabtype = GRABTYPE_CORE; - tempGrab.detail.pMask = NULL; - tempGrab.next = NULL; - - if (!DeletePassiveGrabFromList(&tempGrab)) - return BadAlloc; - return Success; -} - -/** - * Deactivate any grab that may be on the window, remove the focus. - * Delete any XInput extension events from the window too. Does not change the - * window mask. Use just before the window is deleted. - * - * If freeResources is set, passive grabs on the window are deleted. - * - * @param pWin The window to delete events from. - * @param freeResources True if resources associated with the window should be - * deleted. - */ -void -DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) -{ - WindowPtr parent; - DeviceIntPtr mouse = inputInfo.pointer; - DeviceIntPtr keybd = inputInfo.keyboard; - FocusClassPtr focus; - OtherClientsPtr oc; - GrabPtr passive; - GrabPtr grab; - - - /* Deactivate any grabs performed on this window, before making any - input focus changes. */ - grab = mouse->deviceGrab.grab; - if (grab && - ((grab->window == pWin) || (grab->confineTo == pWin))) - (*mouse->deviceGrab.DeactivateGrab)(mouse); - - - /* Deactivating a keyboard grab should cause focus events. */ - grab = keybd->deviceGrab.grab; - if (grab && (grab->window == pWin)) - (*keybd->deviceGrab.DeactivateGrab)(keybd); - - /* And now the real devices */ - for (mouse = inputInfo.devices; mouse; mouse = mouse->next) - { - grab = mouse->deviceGrab.grab; - if (grab && ((grab->window == pWin) || (grab->confineTo == pWin))) - (*mouse->deviceGrab.DeactivateGrab)(mouse); - } - - - for (keybd = inputInfo.devices; keybd; keybd = keybd->next) - { - if (IsKeyboardDevice(keybd)) - { - focus = keybd->focus; - - /* If the focus window is a root window (ie. has no parent) then don't - delete the focus from it. */ - - if ((pWin == focus->win) && (pWin->parent != NullWindow)) - { - int focusEventMode = NotifyNormal; - - /* If a grab is in progress, then alter the mode of focus events. */ - - if (keybd->deviceGrab.grab) - focusEventMode = NotifyWhileGrabbed; - - switch (focus->revert) - { - case RevertToNone: - DoFocusEvents(keybd, pWin, NoneWin, focusEventMode); - focus->win = NoneWin; - focus->traceGood = 0; - break; - case RevertToParent: - parent = pWin; - do - { - parent = parent->parent; - focus->traceGood--; - } while (!parent->realized - /* This would be a good protocol change -- windows being reparented - during SaveSet processing would cause the focus to revert to the - nearest enclosing window which will survive the death of the exiting - client, instead of ending up reverting to a dying window and thence - to None - */ -#ifdef NOTDEF - || wClient(parent)->clientGone -#endif - ); - if (!ActivateFocusInGrab(keybd, pWin, parent)) - DoFocusEvents(keybd, pWin, parent, focusEventMode); - focus->win = parent; - focus->revert = RevertToNone; - break; - case RevertToPointerRoot: - if (!ActivateFocusInGrab(keybd, pWin, PointerRootWin)) - DoFocusEvents(keybd, pWin, PointerRootWin, focusEventMode); - focus->win = PointerRootWin; - focus->traceGood = 0; - break; - } - } - } - - if (IsPointerDevice(keybd)) - { - if (keybd->valuator->motionHintWindow == pWin) - keybd->valuator->motionHintWindow = NullWindow; - } - } - - if (freeResources) - { - if (pWin->dontPropagate) - DontPropagateRefCnts[pWin->dontPropagate]--; - while ( (oc = wOtherClients(pWin)) ) - FreeResource(oc->resource, RT_NONE); - while ( (passive = wPassiveGrabs(pWin)) ) - FreeResource(passive->resource, RT_NONE); - } - - DeleteWindowFromAnyExtEvents(pWin, freeResources); -} - -/** - * Call this whenever some window at or below pWin has changed geometry. If - * there is a grab on the window, the cursor will be re-confined into the - * window. - */ -void -CheckCursorConfinement(WindowPtr pWin) -{ - GrabPtr grab; - WindowPtr confineTo; - DeviceIntPtr pDev; - -#ifdef PANORAMIX - if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return; -#endif - - for (pDev = inputInfo.devices; pDev; pDev = pDev->next) - { - if (DevHasCursor(pDev)) - { - grab = pDev->deviceGrab.grab; - if (grab && (confineTo = grab->confineTo)) - { - if (!BorderSizeNotEmpty(pDev, confineTo)) - (*pDev->deviceGrab.DeactivateGrab)(pDev); - else if ((pWin == confineTo) || IsParent(pWin, confineTo)) - ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE); - } - } - } -} - -Mask -EventMaskForClient(WindowPtr pWin, ClientPtr client) -{ - OtherClientsPtr other; - - if (wClient (pWin) == client) - return pWin->eventMask; - for (other = wOtherClients(pWin); other; other = other->next) - { - if (SameClient(other, client)) - return other->mask; - } - return 0; -} - -/** - * Server-side protocol handling for RecolorCursor request. - */ -int -ProcRecolorCursor(ClientPtr client) -{ - CursorPtr pCursor; - int rc, nscr; - ScreenPtr pscr; - Bool displayed; - SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite; - REQUEST(xRecolorCursorReq); - - REQUEST_SIZE_MATCH(xRecolorCursorReq); - rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR, - client, DixWriteAccess); - if (rc != Success) - { - client->errorValue = stuff->cursor; - return rc; - } - - pCursor->foreRed = stuff->foreRed; - pCursor->foreGreen = stuff->foreGreen; - pCursor->foreBlue = stuff->foreBlue; - - pCursor->backRed = stuff->backRed; - pCursor->backGreen = stuff->backGreen; - pCursor->backBlue = stuff->backBlue; - - for (nscr = 0; nscr < screenInfo.numScreens; nscr++) - { - pscr = screenInfo.screens[nscr]; -#ifdef PANORAMIX - if(!noPanoramiXExtension) - displayed = (pscr == pSprite->screen); - else -#endif - displayed = (pscr == pSprite->hotPhys.pScreen); - ( *pscr->RecolorCursor)(PickPointer(client), pscr, pCursor, - (pCursor == pSprite->current) && displayed); - } - return Success; -} - -/** - * Write the given events to a client, swapping the byte order if necessary. - * To swap the byte ordering, a callback is called that has to be set up for - * the given event type. - * - * In the case of DeviceMotionNotify trailed by DeviceValuators, the events - * can be more than one. Usually it's just one event. - * - * Do not modify the event structure passed in. See comment below. - * - * @param pClient Client to send events to. - * @param count Number of events. - * @param events The event list. - */ -void -WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) -{ -#ifdef PANORAMIX - xEvent eventCopy; -#endif - xEvent *eventTo, *eventFrom; - int i, - eventlength = sizeof(xEvent); - - if (!pClient || pClient == serverClient || pClient->clientGone) - return; - - for (i = 0; i < count; i++) - if ((events[i].u.u.type & 0x7f) != KeymapNotify) - events[i].u.u.sequenceNumber = pClient->sequence; - - /* Let XKB rewrite the state, as it depends on client preferences. */ - XkbFilterEvents(pClient, count, events); - -#ifdef PANORAMIX - if(!noPanoramiXExtension && - (screenInfo.screens[0]->x || screenInfo.screens[0]->y)) - { - switch(events->u.u.type) { - case MotionNotify: - case ButtonPress: - case ButtonRelease: - case KeyPress: - case KeyRelease: - case EnterNotify: - case LeaveNotify: - /* - When multiple clients want the same event DeliverEventsToWindow - passes the same event structure multiple times so we can't - modify the one passed to us - */ - count = 1; /* should always be 1 */ - memcpy(&eventCopy, events, sizeof(xEvent)); - eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x; - eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y; - if(eventCopy.u.keyButtonPointer.event == - eventCopy.u.keyButtonPointer.root) - { - eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x; - eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y; - } - events = &eventCopy; - break; - default: break; - } - } -#endif - - if (EventCallback) - { - EventInfoRec eventinfo; - eventinfo.client = pClient; - eventinfo.events = events; - eventinfo.count = count; - CallCallbacks(&EventCallback, (pointer)&eventinfo); - } -#ifdef XSERVER_DTRACE - if (XSERVER_SEND_EVENT_ENABLED()) { - for (i = 0; i < count; i++) - { - XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]); - } - } -#endif - /* Just a safety check to make sure we only have one GenericEvent, it just - * makes things easier for me right now. (whot) */ - for (i = 1; i < count; i++) - { - if (events[i].u.u.type == GenericEvent) - { - ErrorF("[dix] TryClientEvents: Only one GenericEvent at a time.\n"); - return; - } - } - - if (events->u.u.type == GenericEvent) - { - eventlength += ((xGenericEvent*)events)->length * 4; - } - - if(pClient->swapped) - { - if (eventlength > swapEventLen) - { - swapEventLen = eventlength; - swapEvent = realloc(swapEvent, swapEventLen); - if (!swapEvent) - { - FatalError("WriteEventsToClient: Out of memory.\n"); - return; - } - } - - for(i = 0; i < count; i++) - { - eventFrom = &events[i]; - eventTo = swapEvent; - - /* Remember to strip off the leading bit of type in case - this event was sent with "SendEvent." */ - (*EventSwapVector[eventFrom->u.u.type & 0177]) - (eventFrom, eventTo); - - WriteToClient(pClient, eventlength, (char *)eventTo); - } - } - else - { - /* only one GenericEvent, remember? that means either count is 1 and - * eventlength is arbitrary or eventlength is 32 and count doesn't - * matter. And we're all set. Woohoo. */ - WriteToClient(pClient, count * eventlength, (char *) events); - } -} - -/* - * Set the client pointer for the given client. - * - * A client can have exactly one ClientPointer. Each time a - * request/reply/event is processed and the choice of devices is ambiguous - * (e.g. QueryPointer request), the server will pick the ClientPointer (see - * PickPointer()). - * If a keyboard is needed, the first keyboard paired with the CP is used. - */ -int -SetClientPointer(ClientPtr client, DeviceIntPtr device) -{ - int rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixUseAccess); - if (rc != Success) - return rc; - - if (!IsMaster(device)) - { - ErrorF("[dix] Need master device for ClientPointer. This is a bug.\n"); - return BadDevice; - } else if (!device->spriteInfo->spriteOwner) - { - ErrorF("[dix] Device %d does not have a sprite. " - "Cannot be ClientPointer\n", device->id); - return BadDevice; - } - client->clientPtr = device; - return Success; -} - -/* PickPointer will pick an appropriate pointer for the given client. - * - * An "appropriate device" is (in order of priority): - * 1) A device the given client has a core grab on. - * 2) A device set as ClientPointer for the given client. - * 3) The first master device. - */ -DeviceIntPtr -PickPointer(ClientPtr client) -{ - DeviceIntPtr it = inputInfo.devices; - - /* First, check if the client currently has a grab on a device. Even - * keyboards count. */ - for(it = inputInfo.devices; it; it = it->next) - { - GrabPtr grab = it->deviceGrab.grab; - if (grab && grab->grabtype == GRABTYPE_CORE && SameClient(grab, client)) - { - it = GetMaster(it, MASTER_POINTER); - return it; /* Always return a core grabbed device */ - } - } - - if (!client->clientPtr) - { - DeviceIntPtr it = inputInfo.devices; - while (it) - { - if (IsMaster(it) && it->spriteInfo->spriteOwner) - { - client->clientPtr = it; - break; - } - it = it->next; - } - } - return client->clientPtr; -} - -/* PickKeyboard will pick an appropriate keyboard for the given client by - * searching the list of devices for the keyboard device that is paired with - * the client's pointer. - */ -DeviceIntPtr -PickKeyboard(ClientPtr client) -{ - DeviceIntPtr ptr = PickPointer(client); - DeviceIntPtr kbd = GetMaster(ptr, MASTER_KEYBOARD); - - if (!kbd) - { - ErrorF("[dix] ClientPointer not paired with a keyboard. This " - "is a bug.\n"); - } - - return kbd; -} - -/* A client that has one or more core grabs does not get core events from - * devices it does not have a grab on. Legacy applications behave bad - * otherwise because they are not used to it and the events interfere. - * Only applies for core events. - * - * Return true if a core event from the device would interfere and should not - * be delivered. - */ -Bool -IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event) -{ - DeviceIntPtr it = inputInfo.devices; - - switch(event->u.u.type) - { - case KeyPress: - case KeyRelease: - case ButtonPress: - case ButtonRelease: - case MotionNotify: - case EnterNotify: - case LeaveNotify: - break; - default: - return FALSE; - } - - if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) - return FALSE; - - while(it) - { - if (it != dev) - { - if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client) - && !it->deviceGrab.fromPassiveGrab) - { - if ((IsPointerDevice(it) && IsPointerDevice(dev)) || - (IsKeyboardDevice(it) && IsKeyboardDevice(dev))) - return TRUE; - } - } - it = it->next; - } - - return FALSE; -} - +/************************************************************ + +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. + +********************************************************/ + +/* The panoramix components contained the following notice */ +/***************************************************************** + +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. + +******************************************************************/ + +/* + * Copyright (c) 2003-2005, Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** @file events.c + * This file handles event delivery and a big part of the server-side protocol + * handling (the parts for input devices). + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include "misc.h" +#include "resource.h" +#include +#include "windowstr.h" +#include "inputstr.h" +#include "scrnintstr.h" +#include "cursorstr.h" + +#include "dixstruct.h" +#ifdef PANORAMIX +#include "panoramiX.h" +#include "panoramiXsrv.h" +#endif +#include "globals.h" + +#include +#include "xkbsrv.h" +#include "xace.h" + +#ifdef XSERVER_DTRACE +#include +typedef const char *string; +#include "Xserver-dtrace.h" +#endif + +#include +#include +#include +#include +#include "exglobals.h" +#include "exevents.h" +#include "exglobals.h" +#include "extnsionst.h" + +#include "dixevents.h" +#include "dixgrabs.h" +#include "dispatch.h" + +#include +#include "geext.h" +#include "geint.h" + +#include "eventstr.h" +#include "enterleave.h" +#include "eventconvert.h" + +/* Extension events type numbering starts at EXTENSION_EVENT_BASE. */ +#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ +#define StructureAndSubMask ( StructureNotifyMask | SubstructureNotifyMask ) +#define AllButtonsMask ( \ + Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) +#define MotionMask ( \ + PointerMotionMask | Button1MotionMask | \ + Button2MotionMask | Button3MotionMask | Button4MotionMask | \ + Button5MotionMask | ButtonMotionMask ) +#define PropagateMask ( \ + KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \ + MotionMask ) +#define PointerGrabMask ( \ + ButtonPressMask | ButtonReleaseMask | \ + EnterWindowMask | LeaveWindowMask | \ + PointerMotionHintMask | KeymapStateMask | \ + MotionMask ) +#define AllModifiersMask ( \ + ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ + Mod3Mask | Mod4Mask | Mod5Mask ) +#define LastEventMask OwnerGrabButtonMask +#define AllEventMasks (LastEventMask|(LastEventMask-1)) + + +#define CORE_EVENT(event) \ + (!((event)->u.u.type & EXTENSION_EVENT_BASE) && \ + (event)->u.u.type != GenericEvent) +#define XI2_EVENT(event) \ + (((event)->u.u.type == GenericEvent) && \ + ((xGenericEvent*)(event))->extension == IReqCode) + +/** + * Used to indicate a implicit passive grab created by a ButtonPress event. + * See DeliverEventsToWindow(). + */ +#define ImplicitGrabMask (1 << 7) + +#define WID(w) ((w) ? ((w)->drawable.id) : 0) + +#define XE_KBPTR (xE->u.keyButtonPointer) + + +CallbackListPtr EventCallback; +CallbackListPtr DeviceEventCallback; + +#define DNPMCOUNT 8 + +Mask DontPropagateMasks[DNPMCOUNT]; +static int DontPropagateRefCnts[DNPMCOUNT]; + +static void CheckVirtualMotion( DeviceIntPtr pDev, QdEventPtr qe, WindowPtr pWin); +static void CheckPhysLimits(DeviceIntPtr pDev, + CursorPtr cursor, + Bool generateEvents, + Bool confineToScreen, + ScreenPtr pScreen); + +/** Key repeat hack. Do not use but in TryClientEvents */ +extern BOOL EventIsKeyRepeat(xEvent *event); + +/** + * Main input device struct. + * inputInfo.pointer + * is the core pointer. Referred to as "virtual core pointer", "VCP", + * "core pointer" or inputInfo.pointer. The VCP is the first master + * pointer device and cannot be deleted. + * + * inputInfo.keyboard + * is the core keyboard ("virtual core keyboard", "VCK", "core keyboard"). + * See inputInfo.pointer. + * + * inputInfo.devices + * linked list containing all devices including VCP and VCK. + * + * inputInfo.off_devices + * Devices that have not been initialized and are thus turned off. + * + * inputInfo.numDevices + * Total number of devices. + * + * inputInfo.all_devices + * Virtual device used for XIAllDevices passive grabs. This device is + * not part of the inputInfo.devices list and mostly unset except for + * the deviceid. It exists because passivegrabs need a valid device + * reference. + * + * inputInfo.all_master_devices + * Virtual device used for XIAllMasterDevices passive grabs. This device + * is not part of the inputInfo.devices list and mostly unset except for + * the deviceid. It exists because passivegrabs need a valid device + * reference. + */ +InputInfo inputInfo; + +EventSyncInfoRec syncEvents; + +/** + * The root window the given device is currently on. + */ +#define RootWindow(sprite) sprite->spriteTrace[0] + +static xEvent* swapEvent = NULL; +static int swapEventLen = 0; + +void +NotImplemented(xEvent *from, xEvent *to) +{ + FatalError("Not implemented"); +} + +/** + * Convert the given event type from an XI event to a core event. + * @param[in] The XI 1.x event type. + * @return The matching core event type or 0 if there is none. + */ +int +XItoCoreType(int xitype) +{ + int coretype = 0; + if (xitype == DeviceMotionNotify) + coretype = MotionNotify; + else if (xitype == DeviceButtonPress) + coretype = ButtonPress; + else if (xitype == DeviceButtonRelease) + coretype = ButtonRelease; + else if (xitype == DeviceKeyPress) + coretype = KeyPress; + else if (xitype == DeviceKeyRelease) + coretype = KeyRelease; + + return coretype; +} + +/** + * @return true if the device owns a cursor, false if device shares a cursor + * sprite with another device. + */ +Bool +DevHasCursor(DeviceIntPtr pDev) +{ + return pDev->spriteInfo->spriteOwner; +} + +/* + * @return true if a device is a pointer, check is the same as used by XI to + * fill the 'use' field. + */ +Bool +IsPointerDevice(DeviceIntPtr dev) +{ + return (dev->type == MASTER_POINTER) || + (dev->valuator && dev->button) || + (dev->valuator && !dev->key); +} + +/* + * @return true if a device is a keyboard, check is the same as used by XI to + * fill the 'use' field. + * + * Some pointer devices have keys as well (e.g. multimedia keys). Try to not + * count them as keyboard devices. + */ +Bool +IsKeyboardDevice(DeviceIntPtr dev) +{ + return (dev->type == MASTER_KEYBOARD) || + ((dev->key && dev->kbdfeed) && !IsPointerDevice(dev)); +} + +Bool +IsMaster(DeviceIntPtr dev) +{ + return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD; +} + +/** + * Max event opcode. + */ +extern int lastEvent; + +extern int DeviceMotionNotify; + +#define CantBeFiltered NoEventMask +/** + * Event masks for each event type. + * + * One set of filters for each device, but only the first layer + * is initialized. The rest is memcpy'd in InitEvents. + * + * Filters are used whether a given event may be delivered to a client, + * usually in the form of if (window-event-mask & filter); then deliver event. + * + * One notable filter is for PointerMotion/DevicePointerMotion events. Each + * time a button is pressed, the filter is modified to also contain the + * matching ButtonXMotion mask. + */ +static Mask filters[MAXDEVICES][128] = { +{ + NoSuchEvent, /* 0 */ + NoSuchEvent, /* 1 */ + KeyPressMask, /* KeyPress */ + KeyReleaseMask, /* KeyRelease */ + ButtonPressMask, /* ButtonPress */ + ButtonReleaseMask, /* ButtonRelease */ + PointerMotionMask, /* MotionNotify (initial state) */ + EnterWindowMask, /* EnterNotify */ + LeaveWindowMask, /* LeaveNotify */ + FocusChangeMask, /* FocusIn */ + FocusChangeMask, /* FocusOut */ + KeymapStateMask, /* KeymapNotify */ + ExposureMask, /* Expose */ + CantBeFiltered, /* GraphicsExpose */ + CantBeFiltered, /* NoExpose */ + VisibilityChangeMask, /* VisibilityNotify */ + SubstructureNotifyMask, /* CreateNotify */ + StructureAndSubMask, /* DestroyNotify */ + StructureAndSubMask, /* UnmapNotify */ + StructureAndSubMask, /* MapNotify */ + SubstructureRedirectMask, /* MapRequest */ + StructureAndSubMask, /* ReparentNotify */ + StructureAndSubMask, /* ConfigureNotify */ + SubstructureRedirectMask, /* ConfigureRequest */ + StructureAndSubMask, /* GravityNotify */ + ResizeRedirectMask, /* ResizeRequest */ + StructureAndSubMask, /* CirculateNotify */ + SubstructureRedirectMask, /* CirculateRequest */ + PropertyChangeMask, /* PropertyNotify */ + CantBeFiltered, /* SelectionClear */ + CantBeFiltered, /* SelectionRequest */ + CantBeFiltered, /* SelectionNotify */ + ColormapChangeMask, /* ColormapNotify */ + CantBeFiltered, /* ClientMessage */ + CantBeFiltered /* MappingNotify */ +}}; + +/** + * For the given event, return the matching event filter. This filter may then + * be AND'ed with the selected event mask. + * + * For XI2 events, the returned filter is simply the byte containing the event + * mask we're interested in. E.g. for a mask of (1 << 13), this would be + * byte[1]. + * + * @param[in] dev The device the event belongs to, may be NULL. + * @param[in] event The event to get the filter for. Only the type of the + * event matters, or the extension + evtype for GenericEvents. + * @return The filter mask for the given event. + * + * @see GetEventMask + */ +Mask +GetEventFilter(DeviceIntPtr dev, xEvent *event) +{ + if (event->u.u.type != GenericEvent) + return filters[dev ? dev->id : 0][event->u.u.type]; + else if (XI2_EVENT(event)) + return (1 << (((xXIDeviceEvent*)event)->evtype % 8)); + ErrorF("[dix] Unknown device type %d. No filter\n", event->u.u.type); + return 0; +} + +/** + * Return the windows complete XI2 mask for the given XI2 event type. + */ +Mask +GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev) +{ + OtherInputMasks *inputMasks = wOtherInputMasks(win); + int filter; + int evtype; + + if (!inputMasks || !XI2_EVENT(ev)) + return 0; + + evtype = ((xGenericEvent*)ev)->evtype; + filter = GetEventFilter(dev, ev); + + return ((inputMasks->xi2mask[dev->id][evtype/8] & filter) || + inputMasks->xi2mask[XIAllDevices][evtype/8] || + (inputMasks->xi2mask[XIAllMasterDevices][evtype/8] && IsMaster(dev))); +} + +Mask +GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients* other) +{ + /* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */ + if (XI2_EVENT(event)) + { + int byte = ((xGenericEvent*)event)->evtype / 8; + return (other->xi2mask[dev->id][byte] | + other->xi2mask[XIAllDevices][byte] | + (IsMaster(dev)? other->xi2mask[XIAllMasterDevices][byte] : 0)); + } else if (CORE_EVENT(event)) + return other->mask[XIAllDevices]; + else + return other->mask[dev->id]; +} + + +static CARD8 criticalEvents[32] = +{ + 0x7c, 0x30, 0x40 /* key, button, expose, and configure events */ +}; + +static void +SyntheticMotion(DeviceIntPtr dev, int x, int y) { + int screenno = 0; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) + screenno = dev->spriteInfo->sprite->screen->myNum; +#endif + PostSyntheticMotion(dev, x, y, screenno, + (syncEvents.playingEvents) ? syncEvents.time.milliseconds : currentTime.milliseconds); + +} + +#ifdef PANORAMIX +static void PostNewCursor(DeviceIntPtr pDev); + +static Bool +pointOnScreen(ScreenPtr pScreen, int x, int y) +{ + return x >= pScreen->x && x < pScreen->x + pScreen->width && + y >= pScreen->y && y < pScreen->y + pScreen->height; +} + +static Bool +XineramaSetCursorPosition( + DeviceIntPtr pDev, + int x, + int y, + Bool generateEvent +){ + ScreenPtr pScreen; + int i; + SpritePtr pSprite = pDev->spriteInfo->sprite; + + /* x,y are in Screen 0 coordinates. We need to decide what Screen + to send the message too and what the coordinates relative to + that screen are. */ + + pScreen = pSprite->screen; + x += screenInfo.screens[0]->x; + y += screenInfo.screens[0]->y; + + if(!pointOnScreen(pScreen, x, y)) + { + FOR_NSCREENS(i) + { + if(i == pScreen->myNum) + continue; + if(pointOnScreen(screenInfo.screens[i], x, y)) + { + pScreen = screenInfo.screens[i]; + break; + } + } + } + + pSprite->screen = pScreen; + pSprite->hotPhys.x = x - screenInfo.screens[0]->x; + pSprite->hotPhys.y = y - screenInfo.screens[0]->y; + x -= pScreen->x; + y -= pScreen->y; + + return (*pScreen->SetCursorPosition)(pDev, pScreen, x, y, generateEvent); +} + + +static void +XineramaConstrainCursor(DeviceIntPtr pDev) +{ + SpritePtr pSprite = pDev->spriteInfo->sprite; + ScreenPtr pScreen; + BoxRec newBox; + + pScreen = pSprite->screen; + newBox = pSprite->physLimits; + + /* Translate the constraining box to the screen + the sprite is actually on */ + newBox.x1 += screenInfo.screens[0]->x - pScreen->x; + newBox.x2 += screenInfo.screens[0]->x - pScreen->x; + newBox.y1 += screenInfo.screens[0]->y - pScreen->y; + newBox.y2 += screenInfo.screens[0]->y - pScreen->y; + + (* pScreen->ConstrainCursor)(pDev, pScreen, &newBox); +} + + +static Bool +XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin) +{ + SpritePtr pSprite = pDev->spriteInfo->sprite; + + if(pWin == screenInfo.screens[0]->root) { + int i; + for (i = 0; i < PanoramiXNumScreens; i++) + pSprite->windows[i] = screenInfo.screens[i]->root; + } else { + PanoramiXRes *win; + int rc, i; + + rc = dixLookupResourceByType((pointer *)&win, pWin->drawable.id, + XRT_WINDOW, serverClient, DixReadAccess); + if (rc != Success) + return FALSE; + + for(i = 0; i < PanoramiXNumScreens; i++) { + rc = dixLookupWindow(pSprite->windows + i, win->info[i].id, + serverClient, DixReadAccess); + if (rc != Success) /* window is being unmapped */ + return FALSE; + } + } + return TRUE; +} + +static void +XineramaConfineCursorToWindow(DeviceIntPtr pDev, + WindowPtr pWin, + Bool generateEvents) +{ + SpritePtr pSprite = pDev->spriteInfo->sprite; + + int x, y, off_x, off_y, i; + + if(!XineramaSetWindowPntrs(pDev, pWin)) + return; + + i = PanoramiXNumScreens - 1; + + RegionCopy(&pSprite->Reg1, + &pSprite->windows[i]->borderSize); + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; + + while(i--) { + x = off_x - screenInfo.screens[i]->x; + y = off_y - screenInfo.screens[i]->y; + + if(x || y) + RegionTranslate(&pSprite->Reg1, x, y); + + RegionUnion(&pSprite->Reg1, &pSprite->Reg1, + &pSprite->windows[i]->borderSize); + + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; + } + + pSprite->hotLimits = *RegionExtents(&pSprite->Reg1); + + if(RegionNumRects(&pSprite->Reg1) > 1) + pSprite->hotShape = &pSprite->Reg1; + else + pSprite->hotShape = NullRegion; + + pSprite->confined = FALSE; + pSprite->confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin; + + CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL); +} + +#endif /* PANORAMIX */ + +/** + * Modifies the filter for the given protocol event type to the given masks. + * + * There's only two callers: UpdateDeviceState() and XI's SetMaskForExtEvent(). + * The latter initialises masks for the matching XI events, it's a once-off + * setting. + * UDS however changes the mask for MotionNotify and DeviceMotionNotify each + * time a button is pressed to include the matching ButtonXMotion mask in the + * filter. + * + * @param[in] deviceid The device to modify the filter for. + * @param[in] mask The new filter mask. + * @param[in] event Protocol event type. + */ +void +SetMaskForEvent(int deviceid, Mask mask, int event) +{ + if (deviceid < 0 || deviceid >= MAXDEVICES) + FatalError("SetMaskForEvent: bogus device id"); + filters[deviceid][event] = mask; +} + +void +SetCriticalEvent(int event) +{ + if (event >= 128) + FatalError("SetCriticalEvent: bogus event number"); + criticalEvents[event >> 3] |= 1 << (event & 7); +} + +void +ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py) +{ + BoxRec box; + int x = *px, y = *py; + int incx = 1, incy = 1; + SpritePtr pSprite; + + pSprite = pDev->spriteInfo->sprite; + if (RegionContainsPoint(shape, x, y, &box)) + return; + box = *RegionExtents(shape); + /* this is rather crude */ + do { + x += incx; + if (x >= box.x2) + { + incx = -1; + x = *px - 1; + } + else if (x < box.x1) + { + incx = 1; + x = *px; + y += incy; + if (y >= box.y2) + { + incy = -1; + y = *py - 1; + } + else if (y < box.y1) + return; /* should never get here! */ + } + } while (!RegionContainsPoint(shape, x, y, &box)); + *px = x; + *py = y; +} + +static void +CheckPhysLimits( + DeviceIntPtr pDev, + CursorPtr cursor, + Bool generateEvents, + Bool confineToScreen, /* unused if PanoramiX on */ + ScreenPtr pScreen) /* unused if PanoramiX on */ +{ + HotSpot new; + SpritePtr pSprite = pDev->spriteInfo->sprite; + + if (!cursor) + return; + new = pSprite->hotPhys; +#ifdef PANORAMIX + if (!noPanoramiXExtension) + /* I don't care what the DDX has to say about it */ + pSprite->physLimits = pSprite->hotLimits; + else +#endif + { + if (pScreen) + new.pScreen = pScreen; + else + pScreen = new.pScreen; + (*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits, + &pSprite->physLimits); + pSprite->confined = confineToScreen; + (* pScreen->ConstrainCursor)(pDev, pScreen, &pSprite->physLimits); + } + + /* constrain the pointer to those limits */ + if (new.x < pSprite->physLimits.x1) + new.x = pSprite->physLimits.x1; + else + if (new.x >= pSprite->physLimits.x2) + new.x = pSprite->physLimits.x2 - 1; + if (new.y < pSprite->physLimits.y1) + new.y = pSprite->physLimits.y1; + else + if (new.y >= pSprite->physLimits.y2) + new.y = pSprite->physLimits.y2 - 1; + if (pSprite->hotShape) + ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y); + if (( +#ifdef PANORAMIX + noPanoramiXExtension && +#endif + (pScreen != pSprite->hotPhys.pScreen)) || + (new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)) + { +#ifdef PANORAMIX + if (!noPanoramiXExtension) + XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents); + else +#endif + { + if (pScreen != pSprite->hotPhys.pScreen) + pSprite->hotPhys = new; + (*pScreen->SetCursorPosition) + (pDev, pScreen, new.x, new.y, generateEvents); + } + if (!generateEvents) + SyntheticMotion(pDev, new.x, new.y); + } + +#ifdef PANORAMIX + /* Tell DDX what the limits are */ + if (!noPanoramiXExtension) + XineramaConstrainCursor(pDev); +#endif +} + +static void +CheckVirtualMotion( + DeviceIntPtr pDev, + QdEventPtr qe, + WindowPtr pWin) +{ + SpritePtr pSprite = pDev->spriteInfo->sprite; + RegionPtr reg = NULL; + DeviceEvent *ev = NULL; + + if (qe) + { + ev = &qe->event->device_event; + switch(ev->type) + { + case ET_Motion: + case ET_ButtonPress: + case ET_ButtonRelease: + case ET_KeyPress: + case ET_KeyRelease: + case ET_ProximityIn: + case ET_ProximityOut: + pSprite->hot.pScreen = qe->pScreen; + pSprite->hot.x = ev->root_x; + pSprite->hot.y = ev->root_y; + pWin = pDev->deviceGrab.grab ? pDev->deviceGrab.grab->confineTo : NullWindow; + break; + default: + break; + } + } + if (pWin) + { + BoxRec lims; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + int x, y, off_x, off_y, i; + + if(!XineramaSetWindowPntrs(pDev, pWin)) + return; + + i = PanoramiXNumScreens - 1; + + RegionCopy(&pSprite->Reg2, + &pSprite->windows[i]->borderSize); + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; + + while(i--) { + x = off_x - screenInfo.screens[i]->x; + y = off_y - screenInfo.screens[i]->y; + + if(x || y) + RegionTranslate(&pSprite->Reg2, x, y); + + RegionUnion(&pSprite->Reg2, &pSprite->Reg2, + &pSprite->windows[i]->borderSize); + + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; + } + } else +#endif + { + if (pSprite->hot.pScreen != pWin->drawable.pScreen) + { + pSprite->hot.pScreen = pWin->drawable.pScreen; + pSprite->hot.x = pSprite->hot.y = 0; + } + } + + lims = *RegionExtents(&pWin->borderSize); + if (pSprite->hot.x < lims.x1) + pSprite->hot.x = lims.x1; + else if (pSprite->hot.x >= lims.x2) + pSprite->hot.x = lims.x2 - 1; + if (pSprite->hot.y < lims.y1) + pSprite->hot.y = lims.y1; + else if (pSprite->hot.y >= lims.y2) + pSprite->hot.y = lims.y2 - 1; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) + { + if (RegionNumRects(&pSprite->Reg2) > 1) + reg = &pSprite->Reg2; + + } else +#endif + { + if (wBoundingShape(pWin)) + reg = &pWin->borderSize; + } + + if (reg) + ConfineToShape(pDev, reg, &pSprite->hot.x, &pSprite->hot.y); + + if (qe && ev) + { + qe->pScreen = pSprite->hot.pScreen; + ev->root_x = pSprite->hot.x; + ev->root_y = pSprite->hot.y; + } + } +#ifdef PANORAMIX + if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */ +#endif + RootWindow(pDev->spriteInfo->sprite) = pSprite->hot.pScreen->root; +} + +static void +ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bool confineToScreen) +{ + SpritePtr pSprite = pDev->spriteInfo->sprite; + + if (syncEvents.playingEvents) + { + CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin); + SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y); + } + else + { +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + XineramaConfineCursorToWindow(pDev, pWin, generateEvents); + return; + } +#endif + pSprite->hotLimits = *RegionExtents(&pWin->borderSize); + pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize + : NullRegion; + CheckPhysLimits(pDev, pSprite->current, generateEvents, + confineToScreen, pWin->drawable.pScreen); + } +} + +Bool +PointerConfinedToScreen(DeviceIntPtr pDev) +{ + return pDev->spriteInfo->sprite->confined; +} + +/** + * Update the sprite cursor to the given cursor. + * + * ChangeToCursor() will display the new cursor and free the old cursor (if + * applicable). If the provided cursor is already the updated cursor, nothing + * happens. + */ +static void +ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor) +{ + SpritePtr pSprite = pDev->spriteInfo->sprite; + ScreenPtr pScreen; + + if (cursor != pSprite->current) + { + if ((pSprite->current->bits->xhot != cursor->bits->xhot) || + (pSprite->current->bits->yhot != cursor->bits->yhot)) + CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined, + (ScreenPtr)NULL); +#ifdef PANORAMIX + /* XXX: is this really necessary?? (whot) */ + if (!noPanoramiXExtension) + pScreen = pSprite->screen; + else +#endif + pScreen = pSprite->hotPhys.pScreen; + + (*pScreen->DisplayCursor)(pDev, pScreen, cursor); + FreeCursor(pSprite->current, (Cursor)0); + pSprite->current = cursor; + pSprite->current->refcnt++; + } +} + +/** + * @returns true if b is a descendent of a + */ +Bool +IsParent(WindowPtr a, WindowPtr b) +{ + for (b = b->parent; b; b = b->parent) + if (b == a) return TRUE; + return FALSE; +} + +/** + * Update the cursor displayed on the screen. + * + * Called whenever a cursor may have changed shape or position. + */ +static void +PostNewCursor(DeviceIntPtr pDev) +{ + WindowPtr win; + GrabPtr grab = pDev->deviceGrab.grab; + SpritePtr pSprite = pDev->spriteInfo->sprite; + CursorPtr pCursor; + + if (syncEvents.playingEvents) + return; + if (grab) + { + if (grab->cursor) + { + ChangeToCursor(pDev, grab->cursor); + return; + } + if (IsParent(grab->window, pSprite->win)) + win = pSprite->win; + else + win = grab->window; + } + else + win = pSprite->win; + for (; win; win = win->parent) + { + if (win->optional) + { + pCursor = WindowGetDeviceCursor(win, pDev); + if (!pCursor && win->optional->cursor != NullCursor) + pCursor = win->optional->cursor; + if (pCursor) + { + ChangeToCursor(pDev, pCursor); + return; + } + } + } +} + + +/** + * @param dev device which you want to know its current root window + * @return root window where dev's sprite is located + */ +WindowPtr +GetCurrentRootWindow(DeviceIntPtr dev) +{ + return RootWindow(dev->spriteInfo->sprite); +} + +/** + * @return window underneath the cursor sprite. + */ +WindowPtr +GetSpriteWindow(DeviceIntPtr pDev) +{ + return pDev->spriteInfo->sprite->win; +} + +/** + * @return current sprite cursor. + */ +CursorPtr +GetSpriteCursor(DeviceIntPtr pDev) +{ + return pDev->spriteInfo->sprite->current; +} + +/** + * Set x/y current sprite position in screen coordinates. + */ +void +GetSpritePosition(DeviceIntPtr pDev, int *px, int *py) +{ + SpritePtr pSprite = pDev->spriteInfo->sprite; + *px = pSprite->hotPhys.x; + *py = pSprite->hotPhys.y; +} + +#ifdef PANORAMIX +int +XineramaGetCursorScreen(DeviceIntPtr pDev) +{ + if(!noPanoramiXExtension) { + return pDev->spriteInfo->sprite->screen->myNum; + } else { + return 0; + } +} +#endif /* PANORAMIX */ + +#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */ + +static void +MonthChangedOrBadTime(InternalEvent *ev) +{ + /* If the ddx/OS is careless about not processing timestamped events from + * different sources in sorted order, then it's possible for time to go + * backwards when it should not. Here we ensure a decent time. + */ + if ((currentTime.milliseconds - ev->any.time) > TIMESLOP) + currentTime.months++; + else + ev->any.time = currentTime.milliseconds; +} + +static void +NoticeTime(InternalEvent *ev) +{ + if (ev->any.time < currentTime.milliseconds) + MonthChangedOrBadTime(ev); + currentTime.milliseconds = ev->any.time; + lastDeviceEventTime = currentTime; +} + +void +NoticeEventTime(InternalEvent *ev) +{ + if (!syncEvents.playingEvents) + NoticeTime(ev); +} + +/************************************************************************** + * The following procedures deal with synchronous events * + **************************************************************************/ + +/** + * EnqueueEvent is a device's processInputProc if a device is frozen. + * Instead of delivering the events to the client, the event is tacked onto a + * linked list for later delivery. + */ +void +EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) +{ + QdEventPtr tail = *syncEvents.pendtail; + QdEventPtr qe; + SpritePtr pSprite = device->spriteInfo->sprite; + int eventlen; + DeviceEvent *event = &ev->device_event; + + NoticeTime((InternalEvent*)event); + + /* Fix for key repeating bug. */ + if (device->key != NULL && device->key->xkbInfo != NULL && + event->type == ET_KeyRelease) + AccessXCancelRepeatKey(device->key->xkbInfo, event->detail.key); + + if (DeviceEventCallback) + { + DeviceEventInfoRec eventinfo; + + /* The RECORD spec says that the root window field of motion events + * must be valid. At this point, it hasn't been filled in yet, so + * we do it here. The long expression below is necessary to get + * the current root window; the apparently reasonable alternative + * GetCurrentRootWindow()->drawable.id doesn't give you the right + * answer on the first motion event after a screen change because + * the data that GetCurrentRootWindow relies on hasn't been + * updated yet. + */ + if (ev->any.type == ET_Motion) + ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id; + + eventinfo.event = ev; + eventinfo.device = device; + CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo); + } + + if (event->type == ET_Motion) + { +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + event->root_x += pSprite->screen->x - screenInfo.screens[0]->x; + event->root_y += pSprite->screen->y - screenInfo.screens[0]->y; + } +#endif + pSprite->hotPhys.x = event->root_x; + pSprite->hotPhys.y = event->root_y; + /* do motion compression, but not if from different devices */ + if (tail && + (tail->event->any.type == ET_Motion) && + (tail->device == device) && + (tail->pScreen == pSprite->hotPhys.pScreen)) + { + DeviceEvent *tailev = &tail->event->device_event; + tailev->root_x = pSprite->hotPhys.x; + tailev->root_y = pSprite->hotPhys.y; + tailev->time = event->time; + tail->months = currentTime.months; + return; + } + } + + eventlen = event->length; + + qe = malloc(sizeof(QdEventRec) + eventlen); + if (!qe) + return; + qe->next = (QdEventPtr)NULL; + qe->device = device; + qe->pScreen = pSprite->hotPhys.pScreen; + qe->months = currentTime.months; + qe->event = (InternalEvent *)(qe + 1); + memcpy(qe->event, event, eventlen); + if (tail) + syncEvents.pendtail = &tail->next; + *syncEvents.pendtail = qe; +} + +/** + * Run through the list of events queued up in syncEvents. + * For each event do: + * If the device for this event is not frozen anymore, take it and process it + * as usually. + * After that, check if there's any devices in the list that are not frozen. + * If there is none, we're done. If there is at least one device that is not + * frozen, then re-run from the beginning of the event queue. + */ +static void +PlayReleasedEvents(void) +{ + QdEventPtr *prev, qe; + DeviceIntPtr dev; + DeviceIntPtr pDev; + + prev = &syncEvents.pending; + while ( (qe = *prev) ) + { + if (!qe->device->deviceGrab.sync.frozen) + { + *prev = qe->next; + pDev = qe->device; + if (*syncEvents.pendtail == *prev) + syncEvents.pendtail = prev; + if (qe->event->any.type == ET_Motion) + CheckVirtualMotion(pDev, qe, NullWindow); + syncEvents.time.months = qe->months; + syncEvents.time.milliseconds = qe->event->any.time; +#ifdef PANORAMIX + /* Translate back to the sprite screen since processInputProc + will translate from sprite screen to screen 0 upon reentry + to the DIX layer */ + if(!noPanoramiXExtension) { + DeviceEvent *ev = &qe->event->device_event; + switch(ev->type) + { + case ET_Motion: + case ET_ButtonPress: + case ET_ButtonRelease: + case ET_KeyPress: + case ET_KeyRelease: + case ET_ProximityIn: + case ET_ProximityOut: + ev->root_x += screenInfo.screens[0]->x - + pDev->spriteInfo->sprite->screen->x; + ev->root_y += screenInfo.screens[0]->y - + pDev->spriteInfo->sprite->screen->y; + break; + default: + break; + } + + } +#endif + (*qe->device->public.processInputProc)(qe->event, qe->device); + free(qe); + for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next) + ; + if (!dev) + break; + /* Playing the event may have unfrozen another device. */ + /* So to play it safe, restart at the head of the queue */ + prev = &syncEvents.pending; + } + else + prev = &qe->next; + } +} + +/** + * Freeze or thaw the given devices. The device's processing proc is + * switched to either the real processing proc (in case of thawing) or an + * enqueuing processing proc (usually EnqueueEvent()). + * + * @param dev The device to freeze/thaw + * @param frozen True to freeze or false to thaw. + */ +static void +FreezeThaw(DeviceIntPtr dev, Bool frozen) +{ + dev->deviceGrab.sync.frozen = frozen; + if (frozen) + dev->public.processInputProc = dev->public.enqueueInputProc; + else + dev->public.processInputProc = dev->public.realInputProc; +} + +/** + * Unfreeze devices and replay all events to the respective clients. + * + * ComputeFreezes takes the first event in the device's frozen event queue. It + * runs up the sprite tree (spriteTrace) and searches for the window to replay + * the events from. If it is found, it checks for passive grabs one down from + * the window or delivers the events. + */ +static void +ComputeFreezes(void) +{ + DeviceIntPtr replayDev = syncEvents.replayDev; + WindowPtr w; + GrabPtr grab; + DeviceIntPtr dev; + + for (dev = inputInfo.devices; dev; dev = dev->next) + FreezeThaw(dev, dev->deviceGrab.sync.other || + (dev->deviceGrab.sync.state >= FROZEN)); + if (syncEvents.playingEvents || (!replayDev && !syncEvents.pending)) + return; + syncEvents.playingEvents = TRUE; + if (replayDev) + { + DeviceEvent* event = replayDev->deviceGrab.sync.event; + + syncEvents.replayDev = (DeviceIntPtr)NULL; + + w = XYToWindow(replayDev->spriteInfo->sprite, + event->root_x, event->root_y); + if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) + { + if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) + DeliverFocusedEvent(replayDev, (InternalEvent*)event, w); + else + DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab, + NullWindow, replayDev); + } + } + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (!dev->deviceGrab.sync.frozen) + { + PlayReleasedEvents(); + break; + } + } + syncEvents.playingEvents = FALSE; + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (DevHasCursor(dev)) + { + /* the following may have been skipped during replay, + so do it now */ + if ((grab = dev->deviceGrab.grab) && grab->confineTo) + { + if (grab->confineTo->drawable.pScreen != + dev->spriteInfo->sprite->hotPhys.pScreen) + dev->spriteInfo->sprite->hotPhys.x = + dev->spriteInfo->sprite->hotPhys.y = 0; + ConfineCursorToWindow(dev, grab->confineTo, TRUE, TRUE); + } + else + ConfineCursorToWindow(dev, + dev->spriteInfo->sprite->hotPhys.pScreen->root, + TRUE, FALSE); + PostNewCursor(dev); + } + } +} + +#ifdef RANDR +void +ScreenRestructured (ScreenPtr pScreen) +{ + GrabPtr grab; + DeviceIntPtr pDev; + + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + { + if (!DevHasCursor(pDev)) + continue; + + /* GrabDevice doesn't have a confineTo field, so we don't need to + * worry about it. */ + if ((grab = pDev->deviceGrab.grab) && grab->confineTo) + { + if (grab->confineTo->drawable.pScreen + != pDev->spriteInfo->sprite->hotPhys.pScreen) + pDev->spriteInfo->sprite->hotPhys.x = pDev->spriteInfo->sprite->hotPhys.y = 0; + ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE); + } + else + ConfineCursorToWindow(pDev, + pDev->spriteInfo->sprite->hotPhys.pScreen->root, + TRUE, FALSE); + } +} +#endif + +static void +CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) +{ + GrabPtr grab = thisDev->deviceGrab.grab; + DeviceIntPtr dev; + + if (thisMode == GrabModeSync) + thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT; + else + { /* free both if same client owns both */ + thisDev->deviceGrab.sync.state = THAWED; + if (thisDev->deviceGrab.sync.other && + (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) == + CLIENT_BITS(grab->resource))) + thisDev->deviceGrab.sync.other = NullGrab; + } + + if (IsMaster(thisDev)) + { + dev = GetPairedDevice(thisDev); + if (otherMode == GrabModeSync) + dev->deviceGrab.sync.other = grab; + else + { /* free both if same client owns both */ + if (dev->deviceGrab.sync.other && + (CLIENT_BITS(dev->deviceGrab.sync.other->resource) == + CLIENT_BITS(grab->resource))) + dev->deviceGrab.sync.other = NullGrab; + } + } + ComputeFreezes(); +} + +/** + * Save the device's master device id. This needs to be done + * if a client directly grabs a slave device that is attached to a master. For + * the duration of the grab, the device is detached, ungrabbing re-attaches it + * though. + * + * We store the ID of the master device only in case the master disappears + * while the device has a grab. + */ +static void +DetachFromMaster(DeviceIntPtr dev) +{ + if (!dev->u.master) + return; + + dev->saved_master_id = dev->u.master->id; + + AttachDevice(NULL, dev, NULL); +} + +static void +ReattachToOldMaster(DeviceIntPtr dev) +{ + DeviceIntPtr master = NULL; + + if (IsMaster(dev)) + return; + + dixLookupDevice(&master, dev->saved_master_id, serverClient, DixUseAccess); + + if (master) + { + AttachDevice(serverClient, dev, master); + dev->saved_master_id = 0; + } +} + +/** + * Activate a pointer grab on the given device. A pointer grab will cause all + * core pointer events of this device to be delivered to the grabbing client only. + * No other device will send core events to the grab client while the grab is + * on, but core events will be sent to other clients. + * Can cause the cursor to change if a grab cursor is set. + * + * Note that parameter autoGrab may be (True & ImplicitGrabMask) if the grab + * is an implicit grab caused by a ButtonPress event. + * + * @param mouse The device to grab. + * @param grab The grab structure, needs to be setup. + * @param autoGrab True if the grab was caused by a button down event and not + * explicitely by a client. + */ +void +ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, + TimeStamp time, Bool autoGrab) +{ + GrabInfoPtr grabinfo = &mouse->deviceGrab; + WindowPtr oldWin = (grabinfo->grab) ? + grabinfo->grab->window + : mouse->spriteInfo->sprite->win; + Bool isPassive = autoGrab & ~ImplicitGrabMask; + + /* slave devices need to float for the duration of the grab. */ + if (grab->grabtype == GRABTYPE_XI2 && + !(autoGrab & ImplicitGrabMask) && !IsMaster(mouse)) + DetachFromMaster(mouse); + + if (grab->confineTo) + { + if (grab->confineTo->drawable.pScreen + != mouse->spriteInfo->sprite->hotPhys.pScreen) + mouse->spriteInfo->sprite->hotPhys.x = + mouse->spriteInfo->sprite->hotPhys.y = 0; + ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE); + } + DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab); + mouse->valuator->motionHintWindow = NullWindow; + if (syncEvents.playingEvents) + grabinfo->grabTime = syncEvents.time; + else + grabinfo->grabTime = time; + if (grab->cursor) + grab->cursor->refcnt++; + grabinfo->activeGrab = *grab; + grabinfo->grab = &grabinfo->activeGrab; + grabinfo->fromPassiveGrab = isPassive; + grabinfo->implicitGrab = autoGrab & ImplicitGrabMask; + PostNewCursor(mouse); + CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); +} + +/** + * Delete grab on given device, update the sprite. + * + * Extension devices are set up for ActivateKeyboardGrab(). + */ +void +DeactivatePointerGrab(DeviceIntPtr mouse) +{ + GrabPtr grab = mouse->deviceGrab.grab; + DeviceIntPtr dev; + Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && + mouse->deviceGrab.implicitGrab); + + mouse->valuator->motionHintWindow = NullWindow; + mouse->deviceGrab.grab = NullGrab; + mouse->deviceGrab.sync.state = NOT_GRABBED; + mouse->deviceGrab.fromPassiveGrab = FALSE; + + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (dev->deviceGrab.sync.other == grab) + dev->deviceGrab.sync.other = NullGrab; + } + DoEnterLeaveEvents(mouse, mouse->id, grab->window, + mouse->spriteInfo->sprite->win, NotifyUngrab); + if (grab->confineTo) + ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE); + PostNewCursor(mouse); + if (grab->cursor) + FreeCursor(grab->cursor, (Cursor)0); + + if (!wasImplicit && grab->grabtype == GRABTYPE_XI2) + ReattachToOldMaster(mouse); + + ComputeFreezes(); +} + +/** + * Activate a keyboard grab on the given device. + * + * Extension devices have ActivateKeyboardGrab() set as their grabbing proc. + */ +void +ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) +{ + GrabInfoPtr grabinfo = &keybd->deviceGrab; + WindowPtr oldWin; + + /* slave devices need to float for the duration of the grab. */ + if (grab->grabtype == GRABTYPE_XI2 && + !(passive & ImplicitGrabMask) && + !IsMaster(keybd)) + DetachFromMaster(keybd); + + if (grabinfo->grab) + oldWin = grabinfo->grab->window; + else if (keybd->focus) + oldWin = keybd->focus->win; + else + oldWin = keybd->spriteInfo->sprite->win; + if (oldWin == FollowKeyboardWin) + oldWin = keybd->focus->win; + if (keybd->valuator) + keybd->valuator->motionHintWindow = NullWindow; + DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab); + if (syncEvents.playingEvents) + grabinfo->grabTime = syncEvents.time; + else + grabinfo->grabTime = time; + grabinfo->activeGrab = *grab; + grabinfo->grab = &grabinfo->activeGrab; + grabinfo->fromPassiveGrab = passive; + grabinfo->implicitGrab = passive & ImplicitGrabMask; + CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode); +} + +/** + * Delete keyboard grab for the given device. + */ +void +DeactivateKeyboardGrab(DeviceIntPtr keybd) +{ + GrabPtr grab = keybd->deviceGrab.grab; + DeviceIntPtr dev; + WindowPtr focusWin = keybd->focus ? keybd->focus->win + : keybd->spriteInfo->sprite->win; + Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab && + keybd->deviceGrab.implicitGrab); + + if (focusWin == FollowKeyboardWin) + focusWin = inputInfo.keyboard->focus->win; + if (keybd->valuator) + keybd->valuator->motionHintWindow = NullWindow; + keybd->deviceGrab.grab = NullGrab; + keybd->deviceGrab.sync.state = NOT_GRABBED; + keybd->deviceGrab.fromPassiveGrab = FALSE; + + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (dev->deviceGrab.sync.other == grab) + dev->deviceGrab.sync.other = NullGrab; + } + DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); + + if (!wasImplicit && grab->grabtype == GRABTYPE_XI2) + ReattachToOldMaster(keybd); + + ComputeFreezes(); +} + +void +AllowSome(ClientPtr client, + TimeStamp time, + DeviceIntPtr thisDev, + int newState) +{ + Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced; + TimeStamp grabTime; + DeviceIntPtr dev; + GrabInfoPtr devgrabinfo, + grabinfo = &thisDev->deviceGrab; + + thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client); + thisSynced = FALSE; + otherGrabbed = FALSE; + othersFrozen = FALSE; + grabTime = grabinfo->grabTime; + for (dev = inputInfo.devices; dev; dev = dev->next) + { + devgrabinfo = &dev->deviceGrab; + + if (dev == thisDev) + continue; + if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client)) + { + if (!(thisGrabbed || otherGrabbed) || + (CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER)) + grabTime = devgrabinfo->grabTime; + otherGrabbed = TRUE; + if (grabinfo->sync.other == devgrabinfo->grab) + thisSynced = TRUE; + if (devgrabinfo->sync.state >= FROZEN) + othersFrozen = TRUE; + } + } + if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced)) + return; + if ((CompareTimeStamps(time, currentTime) == LATER) || + (CompareTimeStamps(time, grabTime) == EARLIER)) + return; + switch (newState) + { + case THAWED: /* Async */ + if (thisGrabbed) + grabinfo->sync.state = THAWED; + if (thisSynced) + grabinfo->sync.other = NullGrab; + ComputeFreezes(); + break; + case FREEZE_NEXT_EVENT: /* Sync */ + if (thisGrabbed) + { + grabinfo->sync.state = FREEZE_NEXT_EVENT; + if (thisSynced) + grabinfo->sync.other = NullGrab; + ComputeFreezes(); + } + break; + case THAWED_BOTH: /* AsyncBoth */ + if (othersFrozen) + { + for (dev = inputInfo.devices; dev; dev = dev->next) + { + devgrabinfo = &dev->deviceGrab; + if (devgrabinfo->grab + && SameClient(devgrabinfo->grab, client)) + devgrabinfo->sync.state = THAWED; + if (devgrabinfo->sync.other && + SameClient(devgrabinfo->sync.other, client)) + devgrabinfo->sync.other = NullGrab; + } + ComputeFreezes(); + } + break; + case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ + if (othersFrozen) + { + for (dev = inputInfo.devices; dev; dev = dev->next) + { + devgrabinfo = &dev->deviceGrab; + if (devgrabinfo->grab + && SameClient(devgrabinfo->grab, client)) + devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT; + if (devgrabinfo->sync.other + && SameClient(devgrabinfo->sync.other, client)) + devgrabinfo->sync.other = NullGrab; + } + ComputeFreezes(); + } + break; + case NOT_GRABBED: /* Replay */ + if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT) + { + if (thisSynced) + grabinfo->sync.other = NullGrab; + syncEvents.replayDev = thisDev; + syncEvents.replayWin = grabinfo->grab->window; + (*grabinfo->DeactivateGrab)(thisDev); + syncEvents.replayDev = (DeviceIntPtr)NULL; + } + break; + case THAW_OTHERS: /* AsyncOthers */ + if (othersFrozen) + { + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (dev == thisDev) + continue; + devgrabinfo = &dev->deviceGrab; + if (devgrabinfo->grab + && SameClient(devgrabinfo->grab, client)) + devgrabinfo->sync.state = THAWED; + if (devgrabinfo->sync.other + && SameClient(devgrabinfo->sync.other, client)) + devgrabinfo->sync.other = NullGrab; + } + ComputeFreezes(); + } + break; + } +} + +/** + * Server-side protocol handling for AllowEvents request. + * + * Release some events from a frozen device. + */ +int +ProcAllowEvents(ClientPtr client) +{ + TimeStamp time; + DeviceIntPtr mouse = NULL; + DeviceIntPtr keybd = NULL; + REQUEST(xAllowEventsReq); + + REQUEST_SIZE_MATCH(xAllowEventsReq); + time = ClientTimeToServerTime(stuff->time); + + mouse = PickPointer(client); + keybd = PickKeyboard(client); + + switch (stuff->mode) + { + case ReplayPointer: + AllowSome(client, time, mouse, NOT_GRABBED); + break; + case SyncPointer: + AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); + break; + case AsyncPointer: + AllowSome(client, time, mouse, THAWED); + break; + case ReplayKeyboard: + AllowSome(client, time, keybd, NOT_GRABBED); + break; + case SyncKeyboard: + AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); + break; + case AsyncKeyboard: + AllowSome(client, time, keybd, THAWED); + break; + case SyncBoth: + AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); + break; + case AsyncBoth: + AllowSome(client, time, keybd, THAWED_BOTH); + break; + default: + client->errorValue = stuff->mode; + return BadValue; + } + return Success; +} + +/** + * Deactivate grabs from any device that has been grabbed by the client. + */ +void +ReleaseActiveGrabs(ClientPtr client) +{ + DeviceIntPtr dev; + Bool done; + + /* XXX CloseDownClient should remove passive grabs before + * releasing active grabs. + */ + do { + done = TRUE; + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) + { + (*dev->deviceGrab.DeactivateGrab)(dev); + done = FALSE; + } + } + } while (!done); +} + +/************************************************************************** + * The following procedures deal with delivering events * + **************************************************************************/ + +/** + * Deliver the given events to the given client. + * + * More than one event may be delivered at a time. This is the case with + * DeviceMotionNotifies which may be followed by DeviceValuator events. + * + * TryClientEvents() is the last station before actually writing the events to + * the socket. Anything that is not filtered here, will get delivered to the + * client. + * An event is only delivered if + * - mask and filter match up. + * - no other client has a grab on the device that caused the event. + * + * + * @param client The target client to deliver to. + * @param dev The device the event came from. May be NULL. + * @param pEvents The events to be delivered. + * @param count Number of elements in pEvents. + * @param mask Event mask as set by the window. + * @param filter Mask based on event type. + * @param grab Possible grab on the device that caused the event. + * + * @return 1 if event was delivered, 0 if not or -1 if grab was not set by the + * client. + */ +int +TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents, + int count, Mask mask, Mask filter, GrabPtr grab) +{ + int type; + +#ifdef DEBUG_EVENTS + ErrorF("[dix] Event([%d, %d], mask=0x%lx), client=%d%s", + pEvents->u.u.type, pEvents->u.u.detail, mask, + client ? client->index : -1, + (client && client->clientGone) ? " (gone)" : ""); +#endif + + if (!client || client == serverClient || client->clientGone) { +#ifdef DEBUG_EVENTS + ErrorF(" not delivered to fake/dead client\n"); +#endif + return 0; + } + + if (filter != CantBeFiltered && !(mask & filter)) + { + #ifdef DEBUG_EVENTS + ErrorF(" filtered\n"); + #endif + return 0; + } + + if (grab && !SameClient(grab, client)) + { +#ifdef DEBUG_EVENTS + ErrorF(" not delivered due to grab\n"); +#endif + return -1; /* don't send, but notify caller */ + } + + type = pEvents->u.u.type; + if (type == MotionNotify) + { + if (mask & PointerMotionHintMask) + { + if (WID(dev->valuator->motionHintWindow) == + pEvents->u.keyButtonPointer.event) + { +#ifdef DEBUG_EVENTS + ErrorF("[dix] \n"); + ErrorF("[dix] motionHintWindow == keyButtonPointer.event\n"); +#endif + return 1; /* don't send, but pretend we did */ + } + pEvents->u.u.detail = NotifyHint; + } + else + { + pEvents->u.u.detail = NotifyNormal; + } + } + else if (type == DeviceMotionNotify) + { + if (MaybeSendDeviceMotionNotifyHint((deviceKeyButtonPointer*)pEvents, + mask) != 0) + return 1; + } else if (type == KeyPress) + { + if (EventIsKeyRepeat(pEvents)) + { + if (!_XkbWantsDetectableAutoRepeat(client)) + { + xEvent release = *pEvents; + release.u.u.type = KeyRelease; + WriteEventsToClient(client, 1, &release); +#ifdef DEBUG_EVENTS + ErrorF(" (plus fake core release for repeat)"); +#endif + } else + { +#ifdef DEBUG_EVENTS + ErrorF(" (detectable autorepeat for core)"); +#endif + } + } + + } else if (type == DeviceKeyPress) + { + if (EventIsKeyRepeat(pEvents)) + { + if (!_XkbWantsDetectableAutoRepeat(client)) + { + deviceKeyButtonPointer release = *(deviceKeyButtonPointer *)pEvents; + release.type = DeviceKeyRelease; +#ifdef DEBUG_EVENTS + ErrorF(" (plus fake xi1 release for repeat)"); +#endif + WriteEventsToClient(client, 1, (xEvent *) &release); + } + else { +#ifdef DEBUG_EVENTS + ErrorF(" (detectable autorepeat for core)"); +#endif + } + } + } + + if (BitIsOn(criticalEvents, type)) + { + if (client->smart_priority < SMART_MAX_PRIORITY) + client->smart_priority++; + SetCriticalOutputPending(); + } + + WriteEventsToClient(client, count, pEvents); +#ifdef DEBUG_EVENTS + ErrorF("[dix] delivered\n"); +#endif + return 1; +} + +/** + * Deliver events to a window. At this point, we do not yet know if the event + * actually needs to be delivered. May activate a grab if the event is a + * button press. + * + * Core events are always delivered to the window owner. If the filter is + * something other than CantBeFiltered, the event is also delivered to other + * clients with the matching mask on the window. + * + * More than one event may be delivered at a time. This is the case with + * DeviceMotionNotifies which may be followed by DeviceValuator events. + * + * @param pWin The window that would get the event. + * @param pEvents The events to be delivered. + * @param count Number of elements in pEvents. + * @param filter Mask based on event type. + * @param grab Possible grab on the device that caused the event. + * + * @return Number of events delivered to various clients. + */ +int +DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent + *pEvents, int count, Mask filter, GrabPtr grab) +{ + int deliveries = 0, nondeliveries = 0; + int attempt; + InputClients *other; + ClientPtr client = NullClient; + Mask deliveryMask = 0; /* If a grab occurs due to a button press, then + this mask is the mask of the grab. */ + int type = pEvents->u.u.type; + + + /* Deliver to window owner */ + if ((filter == CantBeFiltered) || CORE_EVENT(pEvents)) + { + /* if nobody ever wants to see this event, skip some work */ + if (filter != CantBeFiltered && + !((wOtherEventMasks(pWin)|pWin->eventMask) & filter)) + return 0; + + if (IsInterferingGrab(wClient(pWin), pDev, pEvents)) + return 0; + + if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) + /* do nothing */; + else if ( (attempt = TryClientEvents(wClient(pWin), pDev, pEvents, + count, pWin->eventMask, + filter, grab)) ) + { + if (attempt > 0) + { + deliveries++; + client = wClient(pWin); + deliveryMask = pWin->eventMask; + } else + nondeliveries--; + } + } + + /* CantBeFiltered means only window owner gets the event */ + if (filter != CantBeFiltered) + { + if (CORE_EVENT(pEvents)) + other = (InputClients *)wOtherClients(pWin); + else if (XI2_EVENT(pEvents)) + { + OtherInputMasks *inputMasks = wOtherInputMasks(pWin); + /* Has any client selected for the event? */ + if (!GetWindowXI2Mask(pDev, pWin, pEvents)) + return 0; + other = inputMasks->inputClients; + } else { + OtherInputMasks *inputMasks = wOtherInputMasks(pWin); + /* Has any client selected for the event? */ + if (!inputMasks || + !(inputMasks->inputEvents[pDev->id] & filter)) + return 0; + + other = inputMasks->inputClients; + } + + for (; other; other = other->next) + { + Mask mask; + if (IsInterferingGrab(rClient(other), pDev, pEvents)) + continue; + + mask = GetEventMask(pDev, pEvents, other); + + if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, + pEvents, count)) + /* do nothing */; + else if ( (attempt = TryClientEvents(rClient(other), pDev, + pEvents, count, + mask, filter, grab)) ) + { + if (attempt > 0) + { + deliveries++; + client = rClient(other); + deliveryMask = mask; + } else + nondeliveries--; + } + } + } + /* + * Note that since core events are delivered first, an implicit grab may + * be activated on a core grab, stopping the XI events. + */ + if ((type == DeviceButtonPress || type == ButtonPress || + ((XI2_EVENT(pEvents) && ((xGenericEvent*)pEvents)->evtype == XI_ButtonPress))) + && deliveries + && (!grab)) + { + GrabRec tempGrab; + OtherInputMasks *inputMasks; + + memset(&tempGrab, 0, sizeof(GrabRec)); + tempGrab.next = NULL; + tempGrab.device = pDev; + tempGrab.resource = client->clientAsMask; + tempGrab.window = pWin; + tempGrab.ownerEvents = (deliveryMask & OwnerGrabButtonMask) ? TRUE : FALSE; + tempGrab.eventMask = deliveryMask; + tempGrab.keyboardMode = GrabModeAsync; + tempGrab.pointerMode = GrabModeAsync; + tempGrab.confineTo = NullWindow; + tempGrab.cursor = NullCursor; + tempGrab.type = type; + if (type == ButtonPress) + tempGrab.grabtype = GRABTYPE_CORE; + else if (type == DeviceButtonPress) + tempGrab.grabtype = GRABTYPE_XI; + else + { + tempGrab.type = ((xGenericEvent*)pEvents)->evtype; + tempGrab.grabtype = GRABTYPE_XI2; + } + + /* get the XI and XI2 device mask */ + inputMasks = wOtherInputMasks(pWin); + tempGrab.deviceMask = (inputMasks) ? inputMasks->inputEvents[pDev->id]: 0; + + if (inputMasks) + memcpy(tempGrab.xi2mask, inputMasks->xi2mask, + sizeof(tempGrab.xi2mask)); + + (*pDev->deviceGrab.ActivateGrab)(pDev, &tempGrab, + currentTime, TRUE | ImplicitGrabMask); + } + else if ((type == MotionNotify) && deliveries) + pDev->valuator->motionHintWindow = pWin; + else + { + if ((type == DeviceMotionNotify || type == DeviceButtonPress) && + deliveries) + CheckDeviceGrabAndHintWindow (pWin, type, + (deviceKeyButtonPointer*) pEvents, + grab, client, deliveryMask); + } + if (deliveries) + return deliveries; + return nondeliveries; +} + +/* If the event goes to dontClient, don't send it and return 0. if + send works, return 1 or if send didn't work, return 2. + Only works for core events. +*/ + +#ifdef PANORAMIX +static int +XineramaTryClientEventsResult( + ClientPtr client, + GrabPtr grab, + Mask mask, + Mask filter +){ + if ((client) && (client != serverClient) && (!client->clientGone) && + ((filter == CantBeFiltered) || (mask & filter))) + { + if (grab && !SameClient(grab, client)) return -1; + else return 1; + } + return 0; +} +#endif + +/** + * Try to deliver events to the interested parties. + * + * @param pWin The window that would get the event. + * @param pEvents The events to be delivered. + * @param count Number of elements in pEvents. + * @param filter Mask based on event type. + * @param dontClient Don't deliver to the dontClient. + */ +int +MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, + int count, Mask filter, ClientPtr dontClient) +{ + OtherClients *other; + + + if (pWin->eventMask & filter) + { + if (wClient(pWin) == dontClient) + return 0; +#ifdef PANORAMIX + if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) + return XineramaTryClientEventsResult( + wClient(pWin), NullGrab, pWin->eventMask, filter); +#endif + if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) + return 1; /* don't send, but pretend we did */ + return TryClientEvents(wClient(pWin), NULL, pEvents, count, + pWin->eventMask, filter, NullGrab); + } + for (other = wOtherClients(pWin); other; other = other->next) + { + if (other->mask & filter) + { + if (SameClient(other, dontClient)) + return 0; +#ifdef PANORAMIX + if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) + return XineramaTryClientEventsResult( + rClient(other), NullGrab, other->mask, filter); +#endif + if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents, + count)) + return 1; /* don't send, but pretend we did */ + return TryClientEvents(rClient(other), NULL, pEvents, count, + other->mask, filter, NullGrab); + } + } + return 2; +} + +static Window FindChildForEvent(SpritePtr pSprite, WindowPtr event) +{ + WindowPtr w = pSprite->spriteTrace[pSprite->spriteTraceGood-1]; + Window child = None; + + /* If the search ends up past the root should the child field be + set to none or should the value in the argument be passed + through. It probably doesn't matter since everyone calls + this function with child == None anyway. */ + while (w) + { + /* If the source window is same as event window, child should be + none. Don't bother going all all the way back to the root. */ + + if (w == event) + { + child = None; + break; + } + + if (w->parent == event) + { + child = w->drawable.id; + break; + } + w = w->parent; + } + return child; +} + +/** + * Adjust event fields to comply with the window properties. + * + * @param xE Event to be modified in place + * @param pWin The window to get the information from. + * @param child Child window setting for event (if applicable) + * @param calcChild If True, calculate the child window. + */ +void +FixUpEventFromWindow( + SpritePtr pSprite, + xEvent *xE, + WindowPtr pWin, + Window child, + Bool calcChild) +{ + if (calcChild) + child = FindChildForEvent(pSprite, pWin); + + if (XI2_EVENT(xE)) + { + xXIDeviceEvent* event = (xXIDeviceEvent*)xE; + + if (event->evtype == XI_RawKeyPress || + event->evtype == XI_RawKeyRelease || + event->evtype == XI_RawButtonPress || + event->evtype == XI_RawButtonRelease || + event->evtype == XI_RawMotion || + event->evtype == XI_DeviceChanged || + event->evtype == XI_HierarchyChanged || + event->evtype == XI_PropertyEvent) + return; + + event->root = RootWindow(pSprite)->drawable.id; + event->event = pWin->drawable.id; + if (pSprite->hot.pScreen == pWin->drawable.pScreen) + { + event->event_x = event->root_x - FP1616(pWin->drawable.x, 0); + event->event_y = event->root_y - FP1616(pWin->drawable.y, 0); + event->child = child; + } else + { + event->event_x = 0; + event->event_y = 0; + event->child = None; + } + + if (event->evtype == XI_Enter || event->evtype == XI_Leave || + event->evtype == XI_FocusIn || event->evtype == XI_FocusOut) + ((xXIEnterEvent*)event)->same_screen = + (pSprite->hot.pScreen == pWin->drawable.pScreen); + + } else + { + XE_KBPTR.root = RootWindow(pSprite)->drawable.id; + XE_KBPTR.event = pWin->drawable.id; + if (pSprite->hot.pScreen == pWin->drawable.pScreen) + { + XE_KBPTR.sameScreen = xTrue; + XE_KBPTR.child = child; + XE_KBPTR.eventX = + XE_KBPTR.rootX - pWin->drawable.x; + XE_KBPTR.eventY = + XE_KBPTR.rootY - pWin->drawable.y; + } + else + { + XE_KBPTR.sameScreen = xFalse; + XE_KBPTR.child = None; + XE_KBPTR.eventX = 0; + XE_KBPTR.eventY = 0; + } + } +} + +/** + * Check if a given event is deliverable at all on a given window. + * + * This function only checks if any client wants it, not for a specific + * client. + * + * @param[in] dev The device this event is being sent for. + * @param[in] event The event that is to be sent. + * @param[in] win The current event window. + * + * @return Bitmask of ::XI2_MASK, ::XI_MASK, ::CORE_MASK, and + * ::DONT_PROPAGATE_MASK. + */ +int +EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win) +{ + int rc = 0; + int filter = 0; + int type; + OtherInputMasks *inputMasks = wOtherInputMasks(win); + xEvent ev; + + /* XXX: this makes me gag */ + type = GetXI2Type(event); + ev.u.u.type = GenericEvent; /* GetEventFilter only cares about type and evtype*/ + ((xGenericEvent*)&ev)->extension = IReqCode; + ((xGenericEvent*)&ev)->evtype = type; + filter = GetEventFilter(dev, &ev); + if (type && inputMasks && + ((inputMasks->xi2mask[XIAllDevices][type/8] & filter) || + ((inputMasks->xi2mask[XIAllMasterDevices][type/8] & filter) && IsMaster(dev)) || + (inputMasks->xi2mask[dev->id][type/8] & filter))) + rc |= XI2_MASK; + + type = GetXIType(event); + ev.u.u.type = type; + filter = GetEventFilter(dev, &ev); + + /* Check for XI mask */ + if (type && inputMasks && + (inputMasks->deliverableEvents[dev->id] & filter) && + (inputMasks->inputEvents[dev->id] & filter)) + rc |= XI_MASK; + + /* Check for XI DontPropagate mask */ + if (type && inputMasks && + (inputMasks->dontPropagateMask[dev->id] & filter)) + rc |= DONT_PROPAGATE_MASK; + + /* Check for core mask */ + type = GetCoreType(event); + if (type && (win->deliverableEvents & filter) && + ((wOtherEventMasks(win) | win->eventMask) & filter)) + rc |= CORE_MASK; + + /* Check for core DontPropagate mask */ + if (type && (filter & wDontPropagateMask(win))) + rc |= DONT_PROPAGATE_MASK; + + return rc; +} + +/** + * Deliver events caused by input devices. + * + * For events from a non-grabbed, non-focus device, DeliverDeviceEvents is + * called directly from the processInputProc. + * For grabbed devices, DeliverGrabbedEvent is called first, and _may_ call + * DeliverDeviceEvents. + * For focused events, DeliverFocusedEvent is called first, and _may_ call + * DeliverDeviceEvents. + * + * @param pWin Window to deliver event to. + * @param event The events to deliver, not yet in wire format. + * @param grab Possible grab on a device. + * @param stopAt Don't recurse up to the root window. + * @param dev The device that is responsible for the event. + * + * @see DeliverGrabbedEvent + * @see DeliverFocusedEvent + */ +int +DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, + WindowPtr stopAt, DeviceIntPtr dev) +{ + SpritePtr pSprite = dev->spriteInfo->sprite; + Window child = None; + Mask filter; + int deliveries = 0; + xEvent core; + xEvent *xE = NULL; + int rc, mask, count = 0; + + CHECKEVENT(event); + + while (pWin) + { + if ((mask = EventIsDeliverable(dev, event, pWin))) + { + /* XI2 events first */ + if (mask & XI2_MASK) + { + xEvent *xi2 = NULL; + rc = EventToXI2(event, &xi2); + if (rc == Success) + { + /* XXX: XACE */ + filter = GetEventFilter(dev, xi2); + FixUpEventFromWindow(pSprite, xi2, pWin, child, FALSE); + deliveries = DeliverEventsToWindow(dev, pWin, xi2, 1, + filter, grab); + free(xi2); + if (deliveries > 0) + goto unwind; + } else if (rc != BadMatch) + ErrorF("[dix] %s: XI2 conversion failed in DDE (%d).\n", + dev->name, rc); + } + + /* XI events */ + if (mask & XI_MASK) + { + rc = EventToXI(event, &xE, &count); + if (rc == Success) { + if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count) == Success) { + filter = GetEventFilter(dev, xE); + FixUpEventFromWindow(pSprite, xE, pWin, child, FALSE); + deliveries = DeliverEventsToWindow(dev, pWin, xE, count, + filter, grab); + if (deliveries > 0) + goto unwind; + } + } else if (rc != BadMatch) + ErrorF("[dix] %s: XI conversion failed in DDE (%d, %d). Skipping delivery.\n", + dev->name, event->any.type, rc); + } + + /* Core event */ + if ((mask & CORE_MASK) && IsMaster(dev) && dev->coreEvents) + { + rc = EventToCore(event, &core); + if (rc == Success) { + if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, &core, 1) == Success) { + filter = GetEventFilter(dev, &core); + FixUpEventFromWindow(pSprite, &core, pWin, child, FALSE); + deliveries = DeliverEventsToWindow(dev, pWin, &core, 1, + filter, grab); + if (deliveries > 0) + goto unwind; + } + } else if (rc != BadMatch) + ErrorF("[dix] %s: Core conversion failed in DDE (%d, %d).\n", + dev->name, event->any.type, rc); + } + + if ((deliveries < 0) || (pWin == stopAt) || + (mask & DONT_PROPAGATE_MASK)) + { + deliveries = 0; + goto unwind; + } + } + + child = pWin->drawable.id; + pWin = pWin->parent; + } + +unwind: + free(xE); + return deliveries; +} + +#undef XI_MASK +#undef CORE_MASK +#undef DONT_PROPAGATE_MASK + +/** + * Deliver event to a window and it's immediate parent. Used for most window + * events (CreateNotify, ConfigureNotify, etc.). Not useful for events that + * propagate up the tree or extension events + * + * In case of a ReparentNotify event, the event will be delivered to the + * otherParent as well. + * + * @param pWin Window to deliver events to. + * @param xE Events to deliver. + * @param count number of events in xE. + * @param otherParent Used for ReparentNotify events. + */ +int +DeliverEvents(WindowPtr pWin, xEvent *xE, int count, + WindowPtr otherParent) +{ + Mask filter; + int deliveries; + DeviceIntRec dummy; + +#ifdef PANORAMIX + if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) + return count; +#endif + + if (!count) + return 0; + + dummy.id = XIAllDevices; + filter = GetEventFilter(&dummy, xE); + if ((filter & SubstructureNotifyMask) && (xE->u.u.type != CreateNotify)) + xE->u.destroyNotify.event = pWin->drawable.id; + if (filter != StructureAndSubMask) + return DeliverEventsToWindow(&dummy, pWin, xE, count, filter, NullGrab); + deliveries = DeliverEventsToWindow(&dummy, pWin, xE, count, + StructureNotifyMask, NullGrab); + if (pWin->parent) + { + xE->u.destroyNotify.event = pWin->parent->drawable.id; + deliveries += DeliverEventsToWindow(&dummy, pWin->parent, xE, count, + SubstructureNotifyMask, NullGrab); + if (xE->u.u.type == ReparentNotify) + { + xE->u.destroyNotify.event = otherParent->drawable.id; + deliveries += DeliverEventsToWindow(&dummy, + otherParent, xE, count, SubstructureNotifyMask, + NullGrab); + } + } + return deliveries; +} + + +static Bool +PointInBorderSize(WindowPtr pWin, int x, int y) +{ + BoxRec box; + + if(RegionContainsPoint(&pWin->borderSize, x, y, &box)) + return TRUE; + +#ifdef PANORAMIX + if(!noPanoramiXExtension && + XineramaSetWindowPntrs(inputInfo.pointer, pWin)) { + SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite; + int i; + + for(i = 1; i < PanoramiXNumScreens; i++) { + if(RegionContainsPoint(&pSprite->windows[i]->borderSize, + x + screenInfo.screens[0]->x - screenInfo.screens[i]->x, + y + screenInfo.screens[0]->y - screenInfo.screens[i]->y, + &box)) + return TRUE; + } + } +#endif + return FALSE; +} + +/** + * Traversed from the root window to the window at the position x/y. While + * traversing, it sets up the traversal history in the spriteTrace array. + * After completing, the spriteTrace history is set in the following way: + * spriteTrace[0] ... root window + * spriteTrace[1] ... top level window that encloses x/y + * ... + * spriteTrace[spriteTraceGood - 1] ... window at x/y + * + * @returns the window at the given coordinates. + */ +WindowPtr +XYToWindow(SpritePtr pSprite, int x, int y) +{ + WindowPtr pWin; + BoxRec box; + + pSprite->spriteTraceGood = 1; /* root window still there */ + pWin = RootWindow(pSprite)->firstChild; + while (pWin) + { + if ((pWin->mapped) && + (x >= pWin->drawable.x - wBorderWidth (pWin)) && + (x < pWin->drawable.x + (int)pWin->drawable.width + + wBorderWidth(pWin)) && + (y >= pWin->drawable.y - wBorderWidth (pWin)) && + (y < pWin->drawable.y + (int)pWin->drawable.height + + wBorderWidth (pWin)) + /* When a window is shaped, a further check + * is made to see if the point is inside + * borderSize + */ + && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) + && (!wInputShape(pWin) || + RegionContainsPoint(wInputShape(pWin), + x - pWin->drawable.x, + y - pWin->drawable.y, &box)) +#ifdef ROOTLESS + /* In rootless mode windows may be offscreen, even when + * they're in X's stack. (E.g. if the native window system + * implements some form of virtual desktop system). + */ + && !pWin->rootlessUnhittable +#endif + ) + { + if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) + { + pSprite->spriteTraceSize += 10; + pSprite->spriteTrace = realloc(pSprite->spriteTrace, + pSprite->spriteTraceSize*sizeof(WindowPtr)); + } + pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin; + pWin = pWin->firstChild; + } + else + pWin = pWin->nextSib; + } + return pSprite->spriteTrace[pSprite->spriteTraceGood-1]; +} + +/** + * Ungrab a currently FocusIn grabbed device and grab the device on the + * given window. If the win given is the NoneWin, the device is ungrabbed if + * applicable and FALSE is returned. + * + * @returns TRUE if the device has been grabbed, or FALSE otherwise. + */ +BOOL +ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) +{ + BOOL rc = FALSE; + DeviceEvent event; + + if (dev->deviceGrab.grab) + { + if (!dev->deviceGrab.fromPassiveGrab || + dev->deviceGrab.grab->type != XI_Enter || + dev->deviceGrab.grab->window == win || + IsParent(dev->deviceGrab.grab->window, win)) + return FALSE; + DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); + (*dev->deviceGrab.DeactivateGrab)(dev); + } + + if (win == NoneWin || win == PointerRootWin) + return FALSE; + + memset(&event, 0, sizeof(DeviceEvent)); + event.header = ET_Internal; + event.type = ET_FocusIn; + event.length = sizeof(DeviceEvent); + event.time = GetTimeInMillis(); + event.deviceid = dev->id; + event.sourceid = dev->id; + event.detail.button = 0; + rc = (CheckPassiveGrabsOnWindow(win, dev, &event, FALSE, TRUE) != NULL); + if (rc) + DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); + return rc; +} + +/** + * Ungrab a currently Enter grabbed device and grab the device for the given + * window. + * + * @returns TRUE if the device has been grabbed, or FALSE otherwise. + */ +static BOOL +ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) +{ + BOOL rc = FALSE; + DeviceEvent event; + + if (dev->deviceGrab.grab) + { + if (!dev->deviceGrab.fromPassiveGrab || + dev->deviceGrab.grab->type != XI_Enter || + dev->deviceGrab.grab->window == win || + IsParent(dev->deviceGrab.grab->window, win)) + return FALSE; + DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); + (*dev->deviceGrab.DeactivateGrab)(dev); + } + + memset(&event, 0, sizeof(DeviceEvent)); + event.header = ET_Internal; + event.type = ET_Enter; + event.length = sizeof(DeviceEvent); + event.time = GetTimeInMillis(); + event.deviceid = dev->id; + event.sourceid = dev->id; + event.detail.button = 0; + rc = (CheckPassiveGrabsOnWindow(win, dev, &event, FALSE, TRUE) != NULL); + if (rc) + DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab); + return rc; +} + +/** + * Update the sprite coordinates based on the event. Update the cursor + * position, then update the event with the new coordinates that may have been + * changed. If the window underneath the sprite has changed, change to new + * cursor and send enter/leave events. + * + * CheckMotion() will not do anything and return FALSE if the event is not a + * pointer event. + * + * @return TRUE if the sprite has moved or FALSE otherwise. + */ +Bool +CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) +{ + WindowPtr prevSpriteWin, newSpriteWin; + SpritePtr pSprite = pDev->spriteInfo->sprite; + + CHECKEVENT(ev); + + prevSpriteWin = pSprite->win; + + if (ev && !syncEvents.playingEvents) + { + /* GetPointerEvents() guarantees that pointer events have the correct + rootX/Y set already. */ + switch (ev->type) + { + case ET_ButtonPress: + case ET_ButtonRelease: + case ET_Motion: + break; + default: + /* all other events return FALSE */ + return FALSE; + } + + +#ifdef PANORAMIX + if (!noPanoramiXExtension) + { + /* Motion events entering DIX get translated to Screen 0 + coordinates. Replayed events have already been + translated since they've entered DIX before */ + ev->root_x += pSprite->screen->x - screenInfo.screens[0]->x; + ev->root_y += pSprite->screen->y - screenInfo.screens[0]->y; + } else +#endif + { + if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen) + { + pSprite->hot.pScreen = pSprite->hotPhys.pScreen; + RootWindow(pDev->spriteInfo->sprite) = + pSprite->hot.pScreen->root; + } + } + + pSprite->hot.x = ev->root_x; + pSprite->hot.y = ev->root_y; + if (pSprite->hot.x < pSprite->physLimits.x1) + pSprite->hot.x = pSprite->physLimits.x1; + else if (pSprite->hot.x >= pSprite->physLimits.x2) + pSprite->hot.x = pSprite->physLimits.x2 - 1; + if (pSprite->hot.y < pSprite->physLimits.y1) + pSprite->hot.y = pSprite->physLimits.y1; + else if (pSprite->hot.y >= pSprite->physLimits.y2) + pSprite->hot.y = pSprite->physLimits.y2 - 1; + if (pSprite->hotShape) + ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y); + pSprite->hotPhys = pSprite->hot; + + if ((pSprite->hotPhys.x != ev->root_x) || + (pSprite->hotPhys.y != ev->root_y)) + { +#ifdef PANORAMIX + if (!noPanoramiXExtension) + { + XineramaSetCursorPosition( + pDev, pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE); + } else +#endif + { + (*pSprite->hotPhys.pScreen->SetCursorPosition)( + pDev, pSprite->hotPhys.pScreen, + pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE); + } + } + + ev->root_x = pSprite->hot.x; + ev->root_y = pSprite->hot.y; + } + + newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y); + + if (newSpriteWin != prevSpriteWin) + { + int sourceid; + if (!ev) { + UpdateCurrentTimeIf(); + sourceid = pDev->id; /* when from WindowsRestructured */ + } else + sourceid = ev->sourceid; + + if (prevSpriteWin != NullWindow) { + if (!ActivateEnterGrab(pDev, prevSpriteWin, newSpriteWin)) + DoEnterLeaveEvents(pDev, sourceid, prevSpriteWin, + newSpriteWin, NotifyNormal); + } + /* set pSprite->win after ActivateEnterGrab, otherwise + sprite window == grab_window and no enter/leave events are + sent. */ + pSprite->win = newSpriteWin; + PostNewCursor(pDev); + return FALSE; + } + return TRUE; +} + +/** + * Windows have restructured, we need to update the sprite position and the + * sprite's cursor. + */ +void +WindowsRestructured(void) +{ + DeviceIntPtr pDev = inputInfo.devices; + while(pDev) + { + if (IsMaster(pDev) || !pDev->u.master) + CheckMotion(NULL, pDev); + pDev = pDev->next; + } +} + +#ifdef PANORAMIX +/* This was added to support reconfiguration under Xdmx. The problem is + * that if the 0th screen (i.e., screenInfo.screens[0]) is moved to an origin + * other than 0,0, the information in the private sprite structure must + * be updated accordingly, or XYToWindow (and other routines) will not + * compute correctly. */ +void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) +{ + GrabPtr grab; + DeviceIntPtr pDev; + SpritePtr pSprite; + + if (noPanoramiXExtension) return; + + pDev = inputInfo.devices; + while(pDev) + { + if (DevHasCursor(pDev)) + { + pSprite = pDev->spriteInfo->sprite; + pSprite->hot.x -= xoff; + pSprite->hot.y -= yoff; + + pSprite->hotPhys.x -= xoff; + pSprite->hotPhys.y -= yoff; + + pSprite->hotLimits.x1 -= xoff; + pSprite->hotLimits.y1 -= yoff; + pSprite->hotLimits.x2 -= xoff; + pSprite->hotLimits.y2 -= yoff; + + if (RegionNotEmpty(&pSprite->Reg1)) + RegionTranslate(&pSprite->Reg1, xoff, yoff); + if (RegionNotEmpty(&pSprite->Reg2)) + RegionTranslate(&pSprite->Reg2, xoff, yoff); + + /* FIXME: if we call ConfineCursorToWindow, must we do anything else? */ + if ((grab = pDev->deviceGrab.grab) && grab->confineTo) { + if (grab->confineTo->drawable.pScreen + != pSprite->hotPhys.pScreen) + pSprite->hotPhys.x = pSprite->hotPhys.y = 0; + ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE); + } else + ConfineCursorToWindow( + pDev, + pSprite->hotPhys.pScreen->root, + TRUE, FALSE); + + } + pDev = pDev->next; + } +} +#endif + +/** + * Initialize a sprite for the given device and set it to some sane values. If + * the device already has a sprite alloc'd, don't realloc but just reset to + * default values. + * If a window is supplied, the sprite will be initialized with the window's + * cursor and positioned in the center of the window's screen. The root window + * is a good choice to pass in here. + * + * It's a good idea to call it only for pointer devices, unless you have a + * really talented keyboard. + * + * @param pDev The device to initialize. + * @param pWin The window where to generate the sprite in. + * + */ +void +InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) +{ + SpritePtr pSprite; + ScreenPtr pScreen; + CursorPtr pCursor; + + if (!pDev->spriteInfo->sprite) + { + DeviceIntPtr it; + + pDev->spriteInfo->sprite = (SpritePtr)calloc(1, sizeof(SpriteRec)); + if (!pDev->spriteInfo->sprite) + FatalError("InitializeSprite: failed to allocate sprite struct"); + + /* We may have paired another device with this device before our + * device had a actual sprite. We need to check for this and reset the + * sprite field for all paired devices. + * + * The VCK is always paired with the VCP before the VCP has a sprite. + */ + for (it = inputInfo.devices; it; it = it->next) + { + if (it->spriteInfo->paired == pDev) + it->spriteInfo->sprite = pDev->spriteInfo->sprite; + } + if (inputInfo.keyboard->spriteInfo->paired == pDev) + inputInfo.keyboard->spriteInfo->sprite = pDev->spriteInfo->sprite; + } + + pSprite = pDev->spriteInfo->sprite; + pDev->spriteInfo->spriteOwner = TRUE; + + pScreen = (pWin) ? pWin->drawable.pScreen : (ScreenPtr)NULL; + pSprite->hot.pScreen = pScreen; + pSprite->hotPhys.pScreen = pScreen; + if (pScreen) + { + pSprite->hotPhys.x = pScreen->width / 2; + pSprite->hotPhys.y = pScreen->height / 2; + pSprite->hotLimits.x2 = pScreen->width; + pSprite->hotLimits.y2 = pScreen->height; + } + + pSprite->hot = pSprite->hotPhys; + pSprite->win = pWin; + + if (pWin) + { + pCursor = wCursor(pWin); + pSprite->spriteTrace = (WindowPtr *)calloc(1, 32*sizeof(WindowPtr)); + if (!pSprite->spriteTrace) + FatalError("Failed to allocate spriteTrace"); + pSprite->spriteTraceSize = 32; + + RootWindow(pDev->spriteInfo->sprite) = pWin; + pSprite->spriteTraceGood = 1; + + pSprite->pEnqueueScreen = pScreen; + pSprite->pDequeueScreen = pSprite->pEnqueueScreen; + + } else { + pCursor = NullCursor; + pSprite->spriteTrace = NULL; + pSprite->spriteTraceSize = 0; + pSprite->spriteTraceGood = 0; + pSprite->pEnqueueScreen = screenInfo.screens[0]; + pSprite->pDequeueScreen = pSprite->pEnqueueScreen; + } + if (pCursor) + pCursor->refcnt++; + if (pSprite->current) + FreeCursor(pSprite->current, None); + pSprite->current = pCursor; + + if (pScreen) + { + (*pScreen->RealizeCursor) ( pDev, pScreen, pSprite->current); + (*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current, + &pSprite->hotLimits, &pSprite->physLimits); + pSprite->confined = FALSE; + + (*pScreen->ConstrainCursor) (pDev, pScreen, + &pSprite->physLimits); + (*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x, + pSprite->hot.y, + FALSE); + (*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current); + } +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; + pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; + pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; + pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; + pSprite->physLimits = pSprite->hotLimits; + pSprite->confineWin = NullWindow; + pSprite->hotShape = NullRegion; + pSprite->screen = pScreen; + /* gotta UNINIT these someplace */ + RegionNull(&pSprite->Reg1); + RegionNull(&pSprite->Reg2); + } +#endif +} + +/** + * Update the mouse sprite info when the server switches from a pScreen to another. + * Otherwise, the pScreen of the mouse sprite is never updated when we switch + * from a pScreen to another. Never updating the pScreen of the mouse sprite + * implies that windows that are in pScreen whose pScreen->myNum >0 will never + * get pointer events. This is because in CheckMotion(), sprite.hotPhys.pScreen + * always points to the first pScreen it has been set by + * DefineInitialRootWindow(). + * + * Calling this function is useful for use cases where the server + * has more than one pScreen. + * This function is similar to DefineInitialRootWindow() but it does not + * reset the mouse pointer position. + * @param win must be the new pScreen we are switching to. + */ +void +UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) +{ + SpritePtr pSprite = NULL; + WindowPtr win = NULL; + CursorPtr pCursor; + if (!pScreen) + return ; + + if (!pDev->spriteInfo->sprite) + return; + + pSprite = pDev->spriteInfo->sprite; + + win = pScreen->root; + + pSprite->hotPhys.pScreen = pScreen; + pSprite->hot = pSprite->hotPhys; + pSprite->hotLimits.x2 = pScreen->width; + pSprite->hotLimits.y2 = pScreen->height; + pSprite->win = win; + pCursor = wCursor(win); + if (pCursor) + pCursor->refcnt++; + if (pSprite->current) + FreeCursor(pSprite->current, 0); + pSprite->current = pCursor; + pSprite->spriteTraceGood = 1; + pSprite->spriteTrace[0] = win; + (*pScreen->CursorLimits) (pDev, + pScreen, + pSprite->current, + &pSprite->hotLimits, + &pSprite->physLimits); + pSprite->confined = FALSE; + (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits); + (*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current); + +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; + pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; + pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; + pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; + pSprite->physLimits = pSprite->hotLimits; + pSprite->screen = pScreen; + } +#endif +} + +/* + * This does not take any shortcuts, and even ignores its argument, since + * it does not happen very often, and one has to walk up the tree since + * this might be a newly instantiated cursor for an intermediate window + * between the one the pointer is in and the one that the last cursor was + * instantiated from. + */ +void +WindowHasNewCursor(WindowPtr pWin) +{ + DeviceIntPtr pDev; + + for(pDev = inputInfo.devices; pDev; pDev = pDev->next) + if (DevHasCursor(pDev)) + PostNewCursor(pDev); +} + +void +NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y) +{ + SpritePtr pSprite = pDev->spriteInfo->sprite; + + pSprite->hotPhys.x = x; + pSprite->hotPhys.y = y; +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + pSprite->hotPhys.x += newScreen->x - screenInfo.screens[0]->x; + pSprite->hotPhys.y += newScreen->y - screenInfo.screens[0]->y; + if (newScreen != pSprite->screen) { + pSprite->screen = newScreen; + /* Make sure we tell the DDX to update its copy of the screen */ + if(pSprite->confineWin) + XineramaConfineCursorToWindow(pDev, + pSprite->confineWin, TRUE); + else + XineramaConfineCursorToWindow(pDev, screenInfo.screens[0]->root, TRUE); + /* if the pointer wasn't confined, the DDX won't get + told of the pointer warp so we reposition it here */ + if(!syncEvents.playingEvents) + (*pSprite->screen->SetCursorPosition)( + pDev, + pSprite->screen, + pSprite->hotPhys.x + screenInfo.screens[0]->x - + pSprite->screen->x, + pSprite->hotPhys.y + screenInfo.screens[0]->y - + pSprite->screen->y, FALSE); + } + } else +#endif + if (newScreen != pSprite->hotPhys.pScreen) + ConfineCursorToWindow(pDev, newScreen->root, TRUE, FALSE); +} + +#ifdef PANORAMIX + +static Bool +XineramaPointInWindowIsVisible( + WindowPtr pWin, + int x, + int y +) +{ + BoxRec box; + int i, xoff, yoff; + + if (!pWin->realized) return FALSE; + + if (RegionContainsPoint(&pWin->borderClip, x, y, &box)) + return TRUE; + + if(!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE; + + xoff = x + screenInfo.screens[0]->x; + yoff = y + screenInfo.screens[0]->y; + + for(i = 1; i < PanoramiXNumScreens; i++) { + pWin = inputInfo.pointer->spriteInfo->sprite->windows[i]; + x = xoff - screenInfo.screens[i]->x; + y = yoff - screenInfo.screens[i]->y; + + if(RegionContainsPoint(&pWin->borderClip, x, y, &box) + && (!wInputShape(pWin) || + RegionContainsPoint(wInputShape(pWin), + x - pWin->drawable.x, + y - pWin->drawable.y, &box))) + return TRUE; + + } + + return FALSE; +} + +static int +XineramaWarpPointer(ClientPtr client) +{ + WindowPtr dest = NULL; + int x, y, rc; + SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite; + + REQUEST(xWarpPointerReq); + + + if (stuff->dstWid != None) { + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; + } + x = pSprite->hotPhys.x; + y = pSprite->hotPhys.y; + + if (stuff->srcWid != None) + { + int winX, winY; + XID winID = stuff->srcWid; + WindowPtr source; + + rc = dixLookupWindow(&source, winID, client, DixReadAccess); + if (rc != Success) + return rc; + + winX = source->drawable.x; + winY = source->drawable.y; + if(source == screenInfo.screens[0]->root) { + winX -= screenInfo.screens[0]->x; + winY -= screenInfo.screens[0]->y; + } + if (x < winX + stuff->srcX || + y < winY + stuff->srcY || + (stuff->srcWidth != 0 && + winX + stuff->srcX + (int)stuff->srcWidth < x) || + (stuff->srcHeight != 0 && + winY + stuff->srcY + (int)stuff->srcHeight < y) || + !XineramaPointInWindowIsVisible(source, x, y)) + return Success; + } + if (dest) { + x = dest->drawable.x; + y = dest->drawable.y; + if(dest == screenInfo.screens[0]->root) { + x -= screenInfo.screens[0]->x; + y -= screenInfo.screens[0]->y; + } + } + + x += stuff->dstX; + y += stuff->dstY; + + if (x < pSprite->physLimits.x1) + x = pSprite->physLimits.x1; + else if (x >= pSprite->physLimits.x2) + x = pSprite->physLimits.x2 - 1; + if (y < pSprite->physLimits.y1) + y = pSprite->physLimits.y1; + else if (y >= pSprite->physLimits.y2) + y = pSprite->physLimits.y2 - 1; + if (pSprite->hotShape) + ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y); + + XineramaSetCursorPosition(PickPointer(client), x, y, TRUE); + + return Success; +} + +#endif + + +/** + * Server-side protocol handling for WarpPointer request. + * Warps the cursor position to the coordinates given in the request. + */ +int +ProcWarpPointer(ClientPtr client) +{ + WindowPtr dest = NULL; + int x, y, rc; + ScreenPtr newScreen; + DeviceIntPtr dev, tmp; + SpritePtr pSprite; + + REQUEST(xWarpPointerReq); + REQUEST_SIZE_MATCH(xWarpPointerReq); + + dev = PickPointer(client); + + for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { + if ((tmp == dev) || (!IsMaster(tmp) && tmp->u.master == dev)) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess); + if (rc != Success) + return rc; + } + } + + if (dev->u.lastSlave) + dev = dev->u.lastSlave; + pSprite = dev->spriteInfo->sprite; + +#ifdef PANORAMIX + if(!noPanoramiXExtension) + return XineramaWarpPointer(client); +#endif + + if (stuff->dstWid != None) { + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess); + if (rc != Success) + return rc; + } + x = pSprite->hotPhys.x; + y = pSprite->hotPhys.y; + + if (stuff->srcWid != None) + { + int winX, winY; + XID winID = stuff->srcWid; + WindowPtr source; + + rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess); + if (rc != Success) + return rc; + + winX = source->drawable.x; + winY = source->drawable.y; + if (source->drawable.pScreen != pSprite->hotPhys.pScreen || + x < winX + stuff->srcX || + y < winY + stuff->srcY || + (stuff->srcWidth != 0 && + winX + stuff->srcX + (int)stuff->srcWidth < x) || + (stuff->srcHeight != 0 && + winY + stuff->srcY + (int)stuff->srcHeight < y) || + !PointInWindowIsVisible(source, x, y)) + return Success; + } + if (dest) + { + x = dest->drawable.x; + y = dest->drawable.y; + newScreen = dest->drawable.pScreen; + } else + newScreen = pSprite->hotPhys.pScreen; + + x += stuff->dstX; + y += stuff->dstY; + + if (x < 0) + x = 0; + else if (x >= newScreen->width) + x = newScreen->width - 1; + if (y < 0) + y = 0; + else if (y >= newScreen->height) + y = newScreen->height - 1; + + if (newScreen == pSprite->hotPhys.pScreen) + { + if (x < pSprite->physLimits.x1) + x = pSprite->physLimits.x1; + else if (x >= pSprite->physLimits.x2) + x = pSprite->physLimits.x2 - 1; + if (y < pSprite->physLimits.y1) + y = pSprite->physLimits.y1; + else if (y >= pSprite->physLimits.y2) + y = pSprite->physLimits.y2 - 1; + if (pSprite->hotShape) + ConfineToShape(dev, pSprite->hotShape, &x, &y); + (*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE); + } + else if (!PointerConfinedToScreen(dev)) + { + NewCurrentScreen(dev, newScreen, x, y); + } + return Success; +} + +static Bool +BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin) +{ + if(RegionNotEmpty(&pWin->borderSize)) + return TRUE; + +#ifdef PANORAMIX + if(!noPanoramiXExtension && XineramaSetWindowPntrs(pDev, pWin)) { + int i; + + for(i = 1; i < PanoramiXNumScreens; i++) { + if(RegionNotEmpty(&pDev->spriteInfo->sprite->windows[i]->borderSize)) + return TRUE; + } + } +#endif + return FALSE; +} + +/** + * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a + * passive grab set on the window to be activated. + * If activate is true and a passive grab is found, it will be activated, + * and the event will be delivered to the client. + * + * @param pWin The window that may be subject to a passive grab. + * @param device Device that caused the event. + * @param event The current device event. + * @param checkCore Check for core grabs too. + * @param activate If a grab is found, activate it and deliver the event. + */ + +GrabPtr +CheckPassiveGrabsOnWindow( + WindowPtr pWin, + DeviceIntPtr device, + DeviceEvent *event, + BOOL checkCore, + BOOL activate) +{ + SpritePtr pSprite = device->spriteInfo->sprite; + GrabPtr grab = wPassiveGrabs(pWin); + GrabRec tempGrab; + GrabInfoPtr grabinfo; +#define CORE_MATCH 0x1 +#define XI_MATCH 0x2 +#define XI2_MATCH 0x4 + int match = 0; + + if (!grab) + return NULL; + /* Fill out the grab details, but leave the type for later before + * comparing */ + tempGrab.window = pWin; + tempGrab.device = device; + tempGrab.detail.exact = event->detail.key; + tempGrab.detail.pMask = NULL; + tempGrab.modifiersDetail.pMask = NULL; + tempGrab.next = NULL; + for (; grab; grab = grab->next) + { + DeviceIntPtr gdev; + XkbSrvInfoPtr xkbi = NULL; + + gdev= grab->modifierDevice; + if (grab->grabtype == GRABTYPE_CORE) + { + if (IsPointerDevice(device)) + gdev = GetPairedDevice(device); + else + gdev = device; + } else if (grab->grabtype == GRABTYPE_XI2) + { + /* if the device is an attached slave device, gdev must be the + * attached master keyboard. Since the slave may have been + * reattached after the grab, the modifier device may not be the + * same. */ + if (!IsMaster(grab->device) && device->u.master) + gdev = GetMaster(device, MASTER_KEYBOARD); + } + + + if (gdev && gdev->key) + xkbi= gdev->key->xkbInfo; + tempGrab.modifierDevice = grab->modifierDevice; + tempGrab.modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0; + + /* Check for XI2 and XI grabs first */ + tempGrab.type = GetXI2Type((InternalEvent*)event); + tempGrab.grabtype = GRABTYPE_XI2; + if (GrabMatchesSecond(&tempGrab, grab, FALSE)) + match = XI2_MATCH; + + tempGrab.detail.exact = event->detail.key; + if (!match) + { + tempGrab.grabtype = GRABTYPE_XI; + if ((tempGrab.type = GetXIType((InternalEvent*)event)) && + (GrabMatchesSecond(&tempGrab, grab, FALSE))) + match = XI_MATCH; + } + + /* Check for a core grab (ignore the device when comparing) */ + if (!match && checkCore) + { + tempGrab.grabtype = GRABTYPE_CORE; + if ((tempGrab.type = GetCoreType((InternalEvent*)event)) && + (GrabMatchesSecond(&tempGrab, grab, TRUE))) + match = CORE_MATCH; + } + + if (match && (!grab->confineTo || + (grab->confineTo->realized && + BorderSizeNotEmpty(device, grab->confineTo)))) + { + int rc, count = 0; + xEvent *xE = NULL; + xEvent core; + + event->corestate &= 0x1f00; + event->corestate |= tempGrab.modifiersDetail.exact & (~0x1f00); + grabinfo = &device->deviceGrab; + /* In some cases a passive core grab may exist, but the client + * already has a core grab on some other device. In this case we + * must not get the grab, otherwise we may never ungrab the + * device. + */ + + if (grab->grabtype == GRABTYPE_CORE) + { + DeviceIntPtr other; + BOOL interfering = FALSE; + + /* A passive grab may have been created for a different device + than it is assigned to at this point in time. + Update the grab's device and modifier device to reflect the + current state. + Since XGrabDeviceButton requires to specify the + modifierDevice explicitly, we don't override this choice. + */ + if (tempGrab.type < GenericEvent) + { + grab->device = device; + grab->modifierDevice = GetPairedDevice(device); + } + + for (other = inputInfo.devices; other; other = other->next) + { + GrabPtr othergrab = other->deviceGrab.grab; + if (othergrab && othergrab->grabtype == GRABTYPE_CORE && + SameClient(grab, rClient(othergrab)) && + ((IsPointerDevice(grab->device) && + IsPointerDevice(othergrab->device)) || + (IsKeyboardDevice(grab->device) && + IsKeyboardDevice(othergrab->device)))) + { + interfering = TRUE; + break; + } + } + if (interfering) + continue; + } + + if (!activate) + return grab; + + if (match & CORE_MATCH) + { + rc = EventToCore((InternalEvent*)event, &core); + if (rc != Success) + { + if (rc != BadMatch) + ErrorF("[dix] %s: core conversion failed in CPGFW " + "(%d, %d).\n", device->name, event->type, rc); + continue; + } + xE = &core; + count = 1; + } else if (match & XI2_MATCH) + { + rc = EventToXI2((InternalEvent*)event, &xE); + if (rc != Success) + { + if (rc != BadMatch) + ErrorF("[dix] %s: XI2 conversion failed in CPGFW " + "(%d, %d).\n", device->name, event->type, rc); + continue; + } + count = 1; + } else + { + rc = EventToXI((InternalEvent*)event, &xE, &count); + if (rc != Success) + { + if (rc != BadMatch) + ErrorF("[dix] %s: XI conversion failed in CPGFW " + "(%d, %d).\n", device->name, event->type, rc); + continue; + } + } + + (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE); + + if (xE) + { + FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); + + TryClientEvents(rClient(grab), device, xE, count, + GetEventFilter(device, xE), + GetEventFilter(device, xE), grab); + } + + if (grabinfo->sync.state == FROZEN_NO_EVENT) + { + if (!grabinfo->sync.event) + grabinfo->sync.event = calloc(1, sizeof(InternalEvent)); + *grabinfo->sync.event = *event; + grabinfo->sync.state = FROZEN_WITH_EVENT; + } + + if (match & (XI_MATCH | XI2_MATCH)) + free(xE); /* on core match xE == &core */ + return grab; + } + } + return NULL; +#undef CORE_MATCH +#undef XI_MATCH +#undef XI2_MATCH +} + +/** + * CheckDeviceGrabs handles both keyboard and pointer events that may cause + * a passive grab to be activated. + * + * If the event is a keyboard event, the ancestors of the focus window are + * traced down and tried to see if they have any passive grabs to be + * activated. If the focus window itself is reached and it's descendants + * contain the pointer, the ancestors of the window that the pointer is in + * are then traced down starting at the focus window, otherwise no grabs are + * activated. + * If the event is a pointer event, the ancestors of the window that the + * pointer is in are traced down starting at the root until CheckPassiveGrabs + * causes a passive grab to activate or all the windows are + * tried. PRH + * + * If a grab is activated, the event has been sent to the client already! + * + * The event we pass in must always be an XI event. From this, we then emulate + * the core event and then check for grabs. + * + * @param device The device that caused the event. + * @param xE The event to handle (Device{Button|Key}Press). + * @param count Number of events in list. + * @return TRUE if a grab has been activated or false otherwise. +*/ + +Bool +CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor) +{ + int i; + WindowPtr pWin = NULL; + FocusClassPtr focus = IsPointerEvent((InternalEvent*)event) ? NULL : device->focus; + BOOL sendCore = (IsMaster(device) && device->coreEvents); + + if (event->type != ET_ButtonPress && + event->type != ET_KeyPress) + return FALSE; + + if (event->type == ET_ButtonPress + && (device->button->buttonsDown != 1)) + return FALSE; + + if (device->deviceGrab.grab) + return FALSE; + + i = 0; + if (ancestor) + { + while (i < device->spriteInfo->sprite->spriteTraceGood) + if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor) + break; + if (i == device->spriteInfo->sprite->spriteTraceGood) + return FALSE; + } + + if (focus) + { + for (; i < focus->traceGood; i++) + { + pWin = focus->trace[i]; + if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE)) + return TRUE; + } + + if ((focus->win == NoneWin) || + (i >= device->spriteInfo->sprite->spriteTraceGood) || + (pWin && pWin != device->spriteInfo->sprite->spriteTrace[i-1])) + return FALSE; + } + + for (; i < device->spriteInfo->sprite->spriteTraceGood; i++) + { + pWin = device->spriteInfo->sprite->spriteTrace[i]; + if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE)) + return TRUE; + } + + return FALSE; +} + +/** + * Called for keyboard events to deliver event to whatever client owns the + * focus. + * + * The event is delivered to the keyboard's focus window, the root window or + * to the window owning the input focus. + * + * @param keybd The keyboard originating the event. + * @param event The event, not yet in wire format. + * @param window Window underneath the sprite. + */ +void +DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) +{ + DeviceIntPtr ptr; + WindowPtr focus = keybd->focus->win; + BOOL sendCore = (IsMaster(keybd) && keybd->coreEvents); + xEvent core; + xEvent *xE = NULL, *xi2 = NULL; + int count, rc; + int deliveries = 0; + + if (focus == FollowKeyboardWin) + focus = inputInfo.keyboard->focus->win; + if (!focus) + return; + if (focus == PointerRootWin) + { + DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd); + return; + } + if ((focus == window) || IsParent(focus, window)) + { + if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd)) + return; + } + + /* just deliver it to the focus window */ + ptr = GetPairedDevice(keybd); + + + rc = EventToXI2(event, &xi2); + if (rc == Success) + { + /* XXX: XACE */ + int filter = GetEventFilter(keybd, xi2); + FixUpEventFromWindow(ptr->spriteInfo->sprite, xi2, focus, None, FALSE); + deliveries = DeliverEventsToWindow(keybd, focus, xi2, 1, + filter, NullGrab); + if (deliveries > 0) + goto unwind; + } else if (rc != BadMatch) + ErrorF("[dix] %s: XI2 conversion failed in DFE (%d, %d). Skipping delivery.\n", + keybd->name, event->any.type, rc); + + rc = EventToXI(event, &xE, &count); + if (rc == Success && + XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success) + { + FixUpEventFromWindow(ptr->spriteInfo->sprite, xE, focus, None, FALSE); + deliveries = DeliverEventsToWindow(keybd, focus, xE, count, + GetEventFilter(keybd, xE), + NullGrab); + + if (deliveries > 0) + goto unwind; + } else if (rc != BadMatch) + ErrorF("[dix] %s: XI conversion failed in DFE (%d, %d). Skipping delivery.\n", + keybd->name, event->any.type, rc); + + if (sendCore) + { + rc = EventToCore(event, &core); + if (rc == Success) { + if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, &core, 1) == Success) { + FixUpEventFromWindow(keybd->spriteInfo->sprite, &core, focus, + None, FALSE); + deliveries = DeliverEventsToWindow(keybd, focus, &core, 1, + GetEventFilter(keybd, &core), + NullGrab); + } + } else if (rc != BadMatch) + ErrorF("[dix] %s: core conversion failed DFE (%d, %d). Skipping delivery.\n", + keybd->name, event->any.type, rc); + } + +unwind: + free(xE); + free(xi2); + return; +} + +/** + * Deliver an event from a device that is currently grabbed. Uses + * DeliverDeviceEvents() for further delivery if a ownerEvents is set on the + * grab. If not, TryClientEvents() is used. + * + * @param deactivateGrab True if the device's grab should be deactivated. + */ +void +DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, + Bool deactivateGrab) +{ + GrabPtr grab; + GrabInfoPtr grabinfo; + int deliveries = 0; + DeviceIntPtr dev; + SpritePtr pSprite = thisDev->spriteInfo->sprite; + BOOL sendCore = FALSE; + int rc, count = 0; + xEvent *xi = NULL; + xEvent *xi2 = NULL; + + grabinfo = &thisDev->deviceGrab; + grab = grabinfo->grab; + + if (grab->ownerEvents) + { + WindowPtr focus; + + /* Hack: Some pointer device have a focus class. So we need to check + * for the type of event, to see if we really want to deliver it to + * the focus window. For pointer events, the answer is no. + */ + if (IsPointerEvent(event)) + focus = PointerRootWin; + else if (thisDev->focus) + { + focus = thisDev->focus->win; + if (focus == FollowKeyboardWin) + focus = inputInfo.keyboard->focus->win; + } + else + focus = PointerRootWin; + if (focus == PointerRootWin) + deliveries = DeliverDeviceEvents(pSprite->win, event, grab, + NullWindow, thisDev); + else if (focus && (focus == pSprite->win || + IsParent(focus, pSprite->win))) + deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus, + thisDev); + else if (focus) + deliveries = DeliverDeviceEvents(focus, event, grab, focus, + thisDev); + } + if (!deliveries) + { + Mask mask; + + /* XXX: In theory, we could pass the internal events through to + * everything and only convert just before hitting the wire. We can't + * do that yet, so DGE is the last stop for internal events. From here + * onwards, we deal with core/XI events. + */ + + mask = grab->eventMask; + + sendCore = (IsMaster(thisDev) && thisDev->coreEvents); + /* try core event */ + if (sendCore && grab->grabtype == GRABTYPE_CORE) + { + xEvent core; + + rc = EventToCore(event, &core); + if (rc == Success) + { + FixUpEventFromWindow(pSprite, &core, grab->window, None, TRUE); + if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, + grab->window, &core, 1) || + XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), + grab->window, &core, 1)) + deliveries = 1; /* don't send, but pretend we did */ + else if (!IsInterferingGrab(rClient(grab), thisDev, &core)) + { + deliveries = TryClientEvents(rClient(grab), thisDev, + &core, 1, mask, + GetEventFilter(thisDev, &core), + grab); + } + } else if (rc != BadMatch) + ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n"); + } + + if (!deliveries) + { + rc = EventToXI2(event, &xi2); + if (rc == Success) + { + int evtype = ((xGenericEvent*)xi2)->evtype; + mask = grab->xi2mask[XIAllDevices][evtype/8] | + grab->xi2mask[XIAllMasterDevices][evtype/8] | + grab->xi2mask[thisDev->id][evtype/8]; + /* try XI2 event */ + FixUpEventFromWindow(pSprite, xi2, grab->window, None, TRUE); + /* XXX: XACE */ + deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask, + GetEventFilter(thisDev, xi2), grab); + } else if (rc != BadMatch) + ErrorF("[dix] %s: XI2 conversion failed in DGE (%d, %d). Skipping delivery.\n", + thisDev->name, event->any.type, rc); + } + + if (!deliveries) + { + rc = EventToXI(event, &xi, &count); + if (rc == Success) + { + /* try XI event */ + if (grabinfo->fromPassiveGrab && + grabinfo->implicitGrab) + mask = grab->deviceMask; + else + mask = grab->eventMask; + + FixUpEventFromWindow(pSprite, xi, grab->window, None, TRUE); + + if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, + grab->window, xi, count) || + XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), + grab->window, xi, count)) + deliveries = 1; /* don't send, but pretend we did */ + else + { + deliveries = + TryClientEvents(rClient(grab), thisDev, + xi, count, + mask, + GetEventFilter(thisDev, xi), + grab); + } + } else if (rc != BadMatch) + ErrorF("[dix] %s: XI conversion failed in DGE (%d, %d). Skipping delivery.\n", + thisDev->name, event->any.type, rc); + } + + if (deliveries && (event->any.type == ET_Motion)) + thisDev->valuator->motionHintWindow = grab->window; + } + if (deliveries && !deactivateGrab && event->any.type != ET_Motion) + { + switch (grabinfo->sync.state) + { + case FREEZE_BOTH_NEXT_EVENT: + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (dev == thisDev) + continue; + FreezeThaw(dev, TRUE); + if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) && + (CLIENT_BITS(grab->resource) == + CLIENT_BITS(dev->deviceGrab.grab->resource))) + dev->deviceGrab.sync.state = FROZEN_NO_EVENT; + else if (GetPairedDevice(thisDev) == dev) + dev->deviceGrab.sync.other = grab; + } + /* fall through */ + case FREEZE_NEXT_EVENT: + grabinfo->sync.state = FROZEN_WITH_EVENT; + FreezeThaw(thisDev, TRUE); + if (!grabinfo->sync.event) + grabinfo->sync.event = calloc(1, sizeof(InternalEvent)); + *grabinfo->sync.event = event->device_event; + break; + } + } + + free(xi); + free(xi2); +} + +/* This function is used to set the key pressed or key released state - + this is only used when the pressing of keys does not cause + the device's processInputProc to be called, as in for example Mouse Keys. +*/ +void +FixKeyState (DeviceEvent *event, DeviceIntPtr keybd) +{ + int key = event->detail.key; + + if (event->type == ET_KeyPress) { + DebugF("FixKeyState: Key %d %s\n",key, + ((event->type == ET_KeyPress) ? "down" : "up")); + } + + if (event->type == ET_KeyPress) + set_key_down(keybd, key, KEY_PROCESSED); + else if (event->type == ET_KeyRelease) + set_key_up(keybd, key, KEY_PROCESSED); + else + FatalError("Impossible keyboard event"); +} + +#define AtMostOneClient \ + (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask) +#define ManagerMask \ + (SubstructureRedirectMask | ResizeRedirectMask) + +/** + * Recalculate which events may be deliverable for the given window. + * Recalculated mask is used for quicker determination which events may be + * delivered to a window. + * + * The otherEventMasks on a WindowOptional is the combination of all event + * masks set by all clients on the window. + * deliverableEventMask is the combination of the eventMask and the + * otherEventMask plus the events that may be propagated to the parent. + * + * Traverses to siblings and parents of the window. + */ +void +RecalculateDeliverableEvents(WindowPtr pWin) +{ + OtherClients *others; + WindowPtr pChild; + + pChild = pWin; + while (1) + { + if (pChild->optional) + { + pChild->optional->otherEventMasks = 0; + for (others = wOtherClients(pChild); others; others = others->next) + { + pChild->optional->otherEventMasks |= others->mask; + } + } + pChild->deliverableEvents = pChild->eventMask| + wOtherEventMasks(pChild); + if (pChild->parent) + pChild->deliverableEvents |= + (pChild->parent->deliverableEvents & + ~wDontPropagateMask(pChild) & PropagateMask); + if (pChild->firstChild) + { + pChild = pChild->firstChild; + continue; + } + while (!pChild->nextSib && (pChild != pWin)) + pChild = pChild->parent; + if (pChild == pWin) + break; + pChild = pChild->nextSib; + } +} + +/** + * + * \param value must conform to DeleteType + */ +int +OtherClientGone(pointer value, XID id) +{ + OtherClientsPtr other, prev; + WindowPtr pWin = (WindowPtr)value; + + prev = 0; + for (other = wOtherClients(pWin); other; other = other->next) + { + if (other->resource == id) + { + if (prev) + prev->next = other->next; + else + { + if (!(pWin->optional->otherClients = other->next)) + CheckWindowOptionalNeed (pWin); + } + free(other); + RecalculateDeliverableEvents(pWin); + return Success; + } + prev = other; + } + FatalError("client not on event list"); + /*NOTREACHED*/ + return -1; /* make compiler happy */ +} + +int +EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) +{ + Mask check; + OtherClients * others; + DeviceIntPtr dev; + int rc; + + if (mask & ~AllEventMasks) + { + client->errorValue = mask; + return BadValue; + } + check = (mask & ManagerMask); + if (check) { + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, + RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess); + if (rc != Success) + return rc; + } + check = (mask & AtMostOneClient); + if (check & (pWin->eventMask|wOtherEventMasks(pWin))) + { /* It is illegal for two different + clients to select on any of the + events for AtMostOneClient. However, + it is OK, for some client to + continue selecting on one of those + events. */ + if ((wClient(pWin) != client) && (check & pWin->eventMask)) + return BadAccess; + for (others = wOtherClients (pWin); others; others = others->next) + { + if (!SameClient(others, client) && (check & others->mask)) + return BadAccess; + } + } + if (wClient (pWin) == client) + { + check = pWin->eventMask; + pWin->eventMask = mask; + } + else + { + for (others = wOtherClients (pWin); others; others = others->next) + { + if (SameClient(others, client)) + { + check = others->mask; + if (mask == 0) + { + FreeResource(others->resource, RT_NONE); + return Success; + } + else + others->mask = mask; + goto maskSet; + } + } + check = 0; + if (!pWin->optional && !MakeWindowOptional (pWin)) + return BadAlloc; + others = malloc(sizeof(OtherClients)); + if (!others) + return BadAlloc; + others->mask = mask; + others->resource = FakeClientID(client->index); + others->next = pWin->optional->otherClients; + pWin->optional->otherClients = others; + if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer)pWin)) + return BadAlloc; + } +maskSet: + if ((mask & PointerMotionHintMask) && !(check & PointerMotionHintMask)) + { + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (dev->valuator && dev->valuator->motionHintWindow == pWin) + dev->valuator->motionHintWindow = NullWindow; + } + } + RecalculateDeliverableEvents(pWin); + return Success; +} + +int +EventSuppressForWindow(WindowPtr pWin, ClientPtr client, + Mask mask, Bool *checkOptional) +{ + int i, free; + + if (mask & ~PropagateMask) + { + client->errorValue = mask; + return BadValue; + } + if (pWin->dontPropagate) + DontPropagateRefCnts[pWin->dontPropagate]--; + if (!mask) + i = 0; + else + { + for (i = DNPMCOUNT, free = 0; --i > 0; ) + { + if (!DontPropagateRefCnts[i]) + free = i; + else if (mask == DontPropagateMasks[i]) + break; + } + if (!i && free) + { + i = free; + DontPropagateMasks[i] = mask; + } + } + if (i || !mask) + { + pWin->dontPropagate = i; + if (i) + DontPropagateRefCnts[i]++; + if (pWin->optional) + { + pWin->optional->dontPropagateMask = mask; + *checkOptional = TRUE; + } + } + else + { + if (!pWin->optional && !MakeWindowOptional (pWin)) + { + if (pWin->dontPropagate) + DontPropagateRefCnts[pWin->dontPropagate]++; + return BadAlloc; + } + pWin->dontPropagate = 0; + pWin->optional->dontPropagateMask = mask; + } + RecalculateDeliverableEvents(pWin); + return Success; +} + +/** + * Assembles an EnterNotify or LeaveNotify and sends it event to the client. + * Uses the paired keyboard to get some additional information. + */ +void +CoreEnterLeaveEvent( + DeviceIntPtr mouse, + int type, + int mode, + int detail, + WindowPtr pWin, + Window child) +{ + xEvent event; + WindowPtr focus; + DeviceIntPtr keybd; + GrabPtr grab = mouse->deviceGrab.grab; + Mask mask; + + keybd = GetPairedDevice(mouse); + + if ((pWin == mouse->valuator->motionHintWindow) && + (detail != NotifyInferior)) + mouse->valuator->motionHintWindow = NullWindow; + if (grab) + { + mask = (pWin == grab->window) ? grab->eventMask : 0; + if (grab->ownerEvents) + mask |= EventMaskForClient(pWin, rClient(grab)); + } + else + { + mask = pWin->eventMask | wOtherEventMasks(pWin); + } + + memset(&event, 0, sizeof(xEvent)); + event.u.u.type = type; + event.u.u.detail = detail; + event.u.enterLeave.time = currentTime.milliseconds; + event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x; + event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y; + /* Counts on the same initial structure of crossing & button events! */ + FixUpEventFromWindow(mouse->spriteInfo->sprite, &event, pWin, None, FALSE); + /* Enter/Leave events always set child */ + event.u.enterLeave.child = child; + event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ? + ELFlagSameScreen : 0; + event.u.enterLeave.state = mouse->button ? (mouse->button->state & 0x1f00) : 0; + if (keybd) + event.u.enterLeave.state |= + XkbGrabStateFromRec(&keybd->key->xkbInfo->state); + event.u.enterLeave.mode = mode; + focus = (keybd) ? keybd->focus->win : None; + if ((focus != NoneWin) && + ((pWin == focus) || (focus == PointerRootWin) || + IsParent(focus, pWin))) + event.u.enterLeave.flags |= ELFlagFocus; + + if ((mask & GetEventFilter(mouse, &event))) + { + if (grab) + TryClientEvents(rClient(grab), mouse, &event, 1, mask, + GetEventFilter(mouse, &event), grab); + else + DeliverEventsToWindow(mouse, pWin, &event, 1, + GetEventFilter(mouse, &event), + NullGrab); + } + + if ((type == EnterNotify) && (mask & KeymapStateMask)) + { + xKeymapEvent ke; + ClientPtr client = grab ? rClient(grab) : wClient(pWin); + if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess)) + memset((char *)&ke.map[0], 0, 31); + else + memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); + + ke.type = KeymapNotify; + if (grab) + TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1, + mask, KeymapStateMask, grab); + else + DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1, + KeymapStateMask, NullGrab); + } +} + +void +DeviceEnterLeaveEvent( + DeviceIntPtr mouse, + int sourceid, + int type, + int mode, + int detail, + WindowPtr pWin, + Window child) +{ + GrabPtr grab = mouse->deviceGrab.grab; + xXIEnterEvent *event; + int filter; + int btlen, len, i; + DeviceIntPtr kbd; + + if ((mode == XINotifyPassiveGrab && type == XI_Leave) || + (mode == XINotifyPassiveUngrab && type == XI_Enter)) + return; + + btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; + btlen = bytes_to_int32(btlen); + len = sizeof(xXIEnterEvent) + btlen * 4; + + event = calloc(1, len); + event->type = GenericEvent; + event->extension = IReqCode; + event->evtype = type; + event->length = (len - sizeof(xEvent))/4; + event->buttons_len = btlen; + event->detail = detail; + event->time = currentTime.milliseconds; + event->deviceid = mouse->id; + event->sourceid = sourceid; + event->mode = mode; + event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0); + event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0); + + for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) + if (BitIsOn(mouse->button->down, i)) + SetBit(&event[1], i); + + kbd = (IsMaster(mouse) || mouse->u.master) ? GetPairedDevice(mouse) : NULL; + if (kbd && kbd->key) + { + event->mods.base_mods = kbd->key->xkbInfo->state.base_mods; + event->mods.latched_mods = kbd->key->xkbInfo->state.latched_mods; + event->mods.locked_mods = kbd->key->xkbInfo->state.locked_mods; + + event->group.base_group = kbd->key->xkbInfo->state.base_group; + event->group.latched_group = kbd->key->xkbInfo->state.latched_group; + event->group.locked_group = kbd->key->xkbInfo->state.locked_group; + } + + FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent*)event, pWin, + None, FALSE); + + filter = GetEventFilter(mouse, (xEvent*)event); + + if (grab) + { + Mask mask; + mask = grab->xi2mask[XIAllDevices][type/8] | + grab->xi2mask[XIAllMasterDevices][type/8] | + grab->xi2mask[mouse->id][type/8]; + TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask, + filter, grab); + } else { + if (!GetWindowXI2Mask(mouse, pWin, (xEvent*)event)) + goto out; + DeliverEventsToWindow(mouse, pWin, (xEvent*)event, 1, filter, + NullGrab); + } + +out: + free(event); +} + +void +CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) +{ + xEvent event; + + memset(&event, 0, sizeof(xEvent)); + event.u.focus.mode = mode; + event.u.u.type = type; + event.u.u.detail = detail; + event.u.focus.window = pWin->drawable.id; + + DeliverEventsToWindow(dev, pWin, &event, 1, + GetEventFilter(dev, &event), NullGrab); + if ((type == FocusIn) && + ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) + { + xKeymapEvent ke; + ClientPtr client = wClient(pWin); + if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess)) + memset((char *)&ke.map[0], 0, 31); + else + memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); + + ke.type = KeymapNotify; + DeliverEventsToWindow(dev, pWin, (xEvent *)&ke, 1, + KeymapStateMask, NullGrab); + } +} + +/** + * Set the input focus to the given window. Subsequent keyboard events will be + * delivered to the given window. + * + * Usually called from ProcSetInputFocus as result of a client request. If so, + * the device is the inputInfo.keyboard. + * If called from ProcXSetInputFocus as result of a client xinput request, the + * device is set to the device specified by the client. + * + * @param client Client that requested input focus change. + * @param dev Focus device. + * @param focusID The window to obtain the focus. Can be PointerRoot or None. + * @param revertTo Specifies where the focus reverts to when window becomes + * unviewable. + * @param ctime Specifies the time. + * @param followOK True if pointer is allowed to follow the keyboard. + */ +int +SetInputFocus( + ClientPtr client, + DeviceIntPtr dev, + Window focusID, + CARD8 revertTo, + Time ctime, + Bool followOK) +{ + FocusClassPtr focus; + WindowPtr focusWin; + int mode, rc; + TimeStamp time; + DeviceIntPtr keybd; /* used for FollowKeyboard or FollowKeyboardWin */ + + + UpdateCurrentTime(); + if ((revertTo != RevertToParent) && + (revertTo != RevertToPointerRoot) && + (revertTo != RevertToNone) && + ((revertTo != RevertToFollowKeyboard) || !followOK)) + { + client->errorValue = revertTo; + return BadValue; + } + time = ClientTimeToServerTime(ctime); + + if (IsKeyboardDevice(dev)) + keybd = dev; + else + keybd = GetPairedDevice(dev); + + if ((focusID == None) || (focusID == PointerRoot)) + focusWin = (WindowPtr)(long)focusID; + else if ((focusID == FollowKeyboard) && followOK) + { + focusWin = keybd->focus->win; + } + else { + rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess); + if (rc != Success) + return rc; + /* It is a match error to try to set the input focus to an + unviewable window. */ + if(!focusWin->realized) + return BadMatch; + } + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetFocusAccess); + if (rc != Success) + return Success; + + focus = dev->focus; + if ((CompareTimeStamps(time, currentTime) == LATER) || + (CompareTimeStamps(time, focus->time) == EARLIER)) + return Success; + mode = (dev->deviceGrab.grab) ? NotifyWhileGrabbed : NotifyNormal; + if (focus->win == FollowKeyboardWin) + { + if (!ActivateFocusInGrab(dev, keybd->focus->win, focusWin)) + DoFocusEvents(dev, keybd->focus->win, focusWin, mode); + } else + { + if (!ActivateFocusInGrab(dev, focus->win, focusWin)) + DoFocusEvents(dev, focus->win, focusWin, mode); + } + focus->time = time; + focus->revert = revertTo; + if (focusID == FollowKeyboard) + focus->win = FollowKeyboardWin; + else + focus->win = focusWin; + if ((focusWin == NoneWin) || (focusWin == PointerRootWin)) + focus->traceGood = 0; + else + { + int depth = 0; + WindowPtr pWin; + + for (pWin = focusWin; pWin; pWin = pWin->parent) depth++; + if (depth > focus->traceSize) + { + focus->traceSize = depth+1; + focus->trace = realloc(focus->trace, + focus->traceSize * sizeof(WindowPtr)); + } + focus->traceGood = depth; + for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--) + focus->trace[depth] = pWin; + } + return Success; +} + +/** + * Server-side protocol handling for SetInputFocus request. + * + * Sets the input focus for the virtual core keyboard. + */ +int +ProcSetInputFocus(ClientPtr client) +{ + DeviceIntPtr kbd = PickKeyboard(client); + REQUEST(xSetInputFocusReq); + + REQUEST_SIZE_MATCH(xSetInputFocusReq); + + return SetInputFocus(client, kbd, stuff->focus, + stuff->revertTo, stuff->time, FALSE); +} + +/** + * Server-side protocol handling for GetInputFocus request. + * + * Sends the current input focus for the client's keyboard back to the + * client. + */ +int +ProcGetInputFocus(ClientPtr client) +{ + DeviceIntPtr kbd = PickKeyboard(client); + xGetInputFocusReply rep; + FocusClassPtr focus = kbd->focus; + int rc; + /* REQUEST(xReq); */ + REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetFocusAccess); + if (rc != Success) + return rc; + + memset(&rep, 0, sizeof(xGetInputFocusReply)); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + if (focus->win == NoneWin) + rep.focus = None; + else if (focus->win == PointerRootWin) + rep.focus = PointerRoot; + else rep.focus = focus->win->drawable.id; + rep.revertTo = focus->revert; + WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); + return Success; +} + +/** + * Server-side protocol handling for GrabPointer request. + * + * Sets an active grab on the client's ClientPointer and returns success + * status to client. + */ +int +ProcGrabPointer(ClientPtr client) +{ + xGrabPointerReply rep; + DeviceIntPtr device = PickPointer(client); + GrabPtr grab; + GrabMask mask; + WindowPtr confineTo; + CursorPtr oldCursor; + REQUEST(xGrabPointerReq); + TimeStamp time; + int rc; + + REQUEST_SIZE_MATCH(xGrabPointerReq); + UpdateCurrentTime(); + + if (stuff->eventMask & ~PointerGrabMask) + { + client->errorValue = stuff->eventMask; + return BadValue; + } + + if (stuff->confineTo == None) + confineTo = NullWindow; + else + { + rc = dixLookupWindow(&confineTo, stuff->confineTo, client, + DixSetAttrAccess); + if (rc != Success) + return rc; + } + + memset(&rep, 0, sizeof(xGrabPointerReply)); + oldCursor = NullCursor; + grab = device->deviceGrab.grab; + + if (grab) + { + if (grab->confineTo && !confineTo) + ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE, + FALSE); + oldCursor = grab->cursor; + } + + mask.core = stuff->eventMask; + + rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode, + stuff->grabWindow, stuff->ownerEvents, stuff->time, + &mask, GRABTYPE_CORE, stuff->cursor, + stuff->confineTo, &rep.status); + if (rc != Success) + return rc; + + if (oldCursor && rep.status == GrabSuccess) + FreeCursor (oldCursor, (Cursor)0); + + time = ClientTimeToServerTime(stuff->time); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep); + return Success; +} + +/** + * Server-side protocol handling for ChangeActivePointerGrab request. + * + * Changes properties of the grab hold by the client. If the client does not + * hold an active grab on the device, nothing happens. + */ +int +ProcChangeActivePointerGrab(ClientPtr client) +{ + DeviceIntPtr device; + GrabPtr grab; + CursorPtr newCursor, oldCursor; + REQUEST(xChangeActivePointerGrabReq); + TimeStamp time; + + REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); + if (stuff->eventMask & ~PointerGrabMask) + { + client->errorValue = stuff->eventMask; + return BadValue; + } + if (stuff->cursor == None) + newCursor = NullCursor; + else + { + int rc = dixLookupResourceByType((pointer *)&newCursor, stuff->cursor, + RT_CURSOR, client, DixUseAccess); + if (rc != Success) + { + client->errorValue = stuff->cursor; + return rc; + } + } + + device = PickPointer(client); + grab = device->deviceGrab.grab; + + if (!grab) + return Success; + if (!SameClient(grab, client)) + return Success; + time = ClientTimeToServerTime(stuff->time); + if ((CompareTimeStamps(time, currentTime) == LATER) || + (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER)) + return Success; + oldCursor = grab->cursor; + grab->cursor = newCursor; + if (newCursor) + newCursor->refcnt++; + PostNewCursor(device); + if (oldCursor) + FreeCursor(oldCursor, (Cursor)0); + grab->eventMask = stuff->eventMask; + return Success; +} + +/** + * Server-side protocol handling for UngrabPointer request. + * + * Deletes a pointer grab on a device the client has grabbed. + */ +int +ProcUngrabPointer(ClientPtr client) +{ + DeviceIntPtr device = PickPointer(client); + GrabPtr grab; + TimeStamp time; + REQUEST(xResourceReq); + + REQUEST_SIZE_MATCH(xResourceReq); + UpdateCurrentTime(); + grab = device->deviceGrab.grab; + + time = ClientTimeToServerTime(stuff->id); + if ((CompareTimeStamps(time, currentTime) != LATER) && + (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && + (grab) && SameClient(grab, client)) + (*device->deviceGrab.DeactivateGrab)(device); + return Success; +} + +/** + * Sets a grab on the given device. + * + * Called from ProcGrabKeyboard to work on the client's keyboard. + * Called from ProcXGrabDevice to work on the device specified by the client. + * + * The parameters this_mode and other_mode represent the keyboard_mode and + * pointer_mode parameters of XGrabKeyboard(). + * See man page for details on all the parameters + * + * @param client Client that owns the grab. + * @param dev The device to grab. + * @param this_mode GrabModeSync or GrabModeAsync + * @param other_mode GrabModeSync or GrabModeAsync + * @param status Return code to be returned to the caller. + * + * @returns Success or BadValue. + */ +int +GrabDevice(ClientPtr client, DeviceIntPtr dev, + unsigned pointer_mode, unsigned keyboard_mode, Window grabWindow, + unsigned ownerEvents, Time ctime, GrabMask *mask, + int grabtype, Cursor curs, Window confineToWin, CARD8 *status) +{ + WindowPtr pWin, confineTo; + GrabPtr grab; + TimeStamp time; + Mask access_mode = DixGrabAccess; + int rc; + GrabInfoPtr grabInfo = &dev->deviceGrab; + CursorPtr cursor; + + UpdateCurrentTime(); + if ((keyboard_mode != GrabModeSync) && (keyboard_mode != GrabModeAsync)) + { + client->errorValue = keyboard_mode; + return BadValue; + } + if ((pointer_mode != GrabModeSync) && (pointer_mode != GrabModeAsync)) + { + client->errorValue = pointer_mode; + return BadValue; + } + if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) + { + client->errorValue = ownerEvents; + return BadValue; + } + + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + + if (confineToWin == None) + confineTo = NullWindow; + else + { + rc = dixLookupWindow(&confineTo, confineToWin, client, + DixSetAttrAccess); + if (rc != Success) + return rc; + } + + if (curs == None) + cursor = NullCursor; + else + { + rc = dixLookupResourceByType((pointer *)&cursor, curs, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) + { + client->errorValue = curs; + return rc; + } + access_mode |= DixForceAccess; + } + + if (keyboard_mode == GrabModeSync || pointer_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc != Success) + return rc; + + time = ClientTimeToServerTime(ctime); + grab = grabInfo->grab; + if (grab && grab->grabtype != grabtype) + *status = AlreadyGrabbed; + if (grab && !SameClient(grab, client)) + *status = AlreadyGrabbed; + else if ((!pWin->realized) || + (confineTo && + !(confineTo->realized + && BorderSizeNotEmpty(dev, confineTo)))) + *status = GrabNotViewable; + else if ((CompareTimeStamps(time, currentTime) == LATER) || + (CompareTimeStamps(time, grabInfo->grabTime) == EARLIER)) + *status = GrabInvalidTime; + else if (grabInfo->sync.frozen && + grabInfo->sync.other && !SameClient(grabInfo->sync.other, client)) + *status = GrabFrozen; + else + { + GrabRec tempGrab; + + /* Otherwise segfaults happen on grabbed MPX devices */ + memset(&tempGrab, 0, sizeof(GrabRec)); + + tempGrab.next = NULL; + tempGrab.window = pWin; + tempGrab.resource = client->clientAsMask; + tempGrab.ownerEvents = ownerEvents; + tempGrab.keyboardMode = keyboard_mode; + tempGrab.pointerMode = pointer_mode; + if (grabtype == GRABTYPE_CORE) + tempGrab.eventMask = mask->core; + else if (grabtype == GRABTYPE_XI) + tempGrab.eventMask = mask->xi; + else + memcpy(tempGrab.xi2mask, mask->xi2mask, sizeof(tempGrab.xi2mask)); + tempGrab.device = dev; + tempGrab.cursor = cursor; + tempGrab.confineTo = confineTo; + tempGrab.grabtype = grabtype; + (*grabInfo->ActivateGrab)(dev, &tempGrab, time, FALSE); + *status = GrabSuccess; + } + return Success; +} + +/** + * Server-side protocol handling for GrabKeyboard request. + * + * Grabs the client's keyboard and returns success status to client. + */ +int +ProcGrabKeyboard(ClientPtr client) +{ + xGrabKeyboardReply rep; + REQUEST(xGrabKeyboardReq); + int result; + DeviceIntPtr keyboard = PickKeyboard(client); + GrabMask mask; + + REQUEST_SIZE_MATCH(xGrabKeyboardReq); + + memset(&rep, 0, sizeof(xGrabKeyboardReply)); + mask.core = KeyPressMask | KeyReleaseMask; + + result = GrabDevice(client, keyboard, stuff->pointerMode, + stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, + stuff->time, &mask, GRABTYPE_CORE, None, None, + &rep.status); + + if (result != Success) + return result; + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); + return Success; +} + +/** + * Server-side protocol handling for UngrabKeyboard request. + * + * Deletes a possible grab on the client's keyboard. + */ +int +ProcUngrabKeyboard(ClientPtr client) +{ + DeviceIntPtr device = PickKeyboard(client); + GrabPtr grab; + TimeStamp time; + REQUEST(xResourceReq); + + REQUEST_SIZE_MATCH(xResourceReq); + UpdateCurrentTime(); + + grab = device->deviceGrab.grab; + + time = ClientTimeToServerTime(stuff->id); + if ((CompareTimeStamps(time, currentTime) != LATER) && + (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && + (grab) && SameClient(grab, client) && grab->grabtype == GRABTYPE_CORE) + (*device->deviceGrab.DeactivateGrab)(device); + return Success; +} + +/** + * Server-side protocol handling for QueryPointer request. + * + * Returns the current state and position of the client's ClientPointer to the + * client. + */ +int +ProcQueryPointer(ClientPtr client) +{ + xQueryPointerReply rep; + WindowPtr pWin, t; + DeviceIntPtr mouse = PickPointer(client); + DeviceIntPtr keyboard; + SpritePtr pSprite; + int rc; + REQUEST(xResourceReq); + REQUEST_SIZE_MATCH(xResourceReq); + + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + return rc; + rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); + if (rc != Success && rc != BadAccess) + return rc; + + keyboard = GetPairedDevice(mouse); + + pSprite = mouse->spriteInfo->sprite; + if (mouse->valuator->motionHintWindow) + MaybeStopHint(mouse, client); + memset(&rep, 0, sizeof(xQueryPointerReply)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.mask = mouse->button ? (mouse->button->state) : 0; + rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state); + rep.length = 0; + rep.root = (GetCurrentRootWindow(mouse))->drawable.id; + rep.rootX = pSprite->hot.x; + rep.rootY = pSprite->hot.y; + rep.child = None; + if (pSprite->hot.pScreen == pWin->drawable.pScreen) + { + rep.sameScreen = xTrue; + rep.winX = pSprite->hot.x - pWin->drawable.x; + rep.winY = pSprite->hot.y - pWin->drawable.y; + for (t = pSprite->win; t; t = t->parent) + if (t->parent == pWin) + { + rep.child = t->drawable.id; + break; + } + } + else + { + rep.sameScreen = xFalse; + rep.winX = 0; + rep.winY = 0; + } + +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + rep.rootX += screenInfo.screens[0]->x; + rep.rootY += screenInfo.screens[0]->y; + if(stuff->id == rep.root) { + rep.winX += screenInfo.screens[0]->x; + rep.winY += screenInfo.screens[0]->y; + } + } +#endif + + if (rc == BadAccess) { + rep.mask = 0; + rep.child = None; + rep.rootX = 0; + rep.rootY = 0; + rep.winX = 0; + rep.winY = 0; + } + + WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep); + + return Success; +} + +/** + * Initializes the device list and the DIX sprite to sane values. Allocates + * trace memory used for quick window traversal. + */ +void +InitEvents(void) +{ + int i; + + inputInfo.numDevices = 0; + inputInfo.devices = (DeviceIntPtr)NULL; + inputInfo.off_devices = (DeviceIntPtr)NULL; + inputInfo.keyboard = (DeviceIntPtr)NULL; + inputInfo.pointer = (DeviceIntPtr)NULL; + /* The mask for pointer motion events may have changed in the last server + * generation. See comment above definition of filters. */ + filters[0][PointerMotionMask] = MotionNotify; + for (i = 1; i < MAXDEVICES; i++) + { + memcpy(&filters[i], filters[0], sizeof(filters[0])); + } + + syncEvents.replayDev = (DeviceIntPtr)NULL; + syncEvents.replayWin = NullWindow; + while (syncEvents.pending) + { + QdEventPtr next = syncEvents.pending->next; + free(syncEvents.pending); + syncEvents.pending = next; + } + syncEvents.pendtail = &syncEvents.pending; + syncEvents.playingEvents = FALSE; + syncEvents.time.months = 0; + syncEvents.time.milliseconds = 0; /* hardly matters */ + currentTime.months = 0; + currentTime.milliseconds = GetTimeInMillis(); + lastDeviceEventTime = currentTime; + for (i = 0; i < DNPMCOUNT; i++) + { + DontPropagateMasks[i] = 0; + DontPropagateRefCnts[i] = 0; + } + + InputEventListLen = GetMaximumEventsNum(); + InputEventList = InitEventList(InputEventListLen); + if (!InputEventList) + FatalError("[dix] Failed to allocate input event list.\n"); +} + +void +CloseDownEvents(void) +{ + FreeEventList(InputEventList, InputEventListLen); + InputEventListLen = 0; + InputEventList = NULL; +} + +/** + * Server-side protocol handling for SendEvent request. + * + * Locates the window to send the event to and forwards the event. + */ +int +ProcSendEvent(ClientPtr client) +{ + WindowPtr pWin; + WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ + DeviceIntPtr dev = PickPointer(client); + DeviceIntPtr keybd = GetPairedDevice(dev); + SpritePtr pSprite = dev->spriteInfo->sprite; + REQUEST(xSendEventReq); + + REQUEST_SIZE_MATCH(xSendEventReq); + + /* The client's event type must be a core event type or one defined by an + extension. */ + + if ( ! ((stuff->event.u.u.type > X_Reply && + stuff->event.u.u.type < LASTEvent) || + (stuff->event.u.u.type >= EXTENSION_EVENT_BASE && + stuff->event.u.u.type < (unsigned)lastEvent))) + { + client->errorValue = stuff->event.u.u.type; + return BadValue; + } + if (stuff->event.u.u.type == ClientMessage && + stuff->event.u.u.detail != 8 && + stuff->event.u.u.detail != 16 && + stuff->event.u.u.detail != 32) + { + client->errorValue = stuff->event.u.u.detail; + return BadValue; + } + if (stuff->eventMask & ~AllEventMasks) + { + client->errorValue = stuff->eventMask; + return BadValue; + } + + if (stuff->destination == PointerWindow) + pWin = pSprite->win; + else if (stuff->destination == InputFocus) + { + WindowPtr inputFocus = (keybd) ? keybd->focus->win : NoneWin; + + if (inputFocus == NoneWin) + return Success; + + /* If the input focus is PointerRootWin, send the event to where + the pointer is if possible, then perhaps propogate up to root. */ + if (inputFocus == PointerRootWin) + inputFocus = GetCurrentRootWindow(dev); + + if (IsParent(inputFocus, pSprite->win)) + { + effectiveFocus = inputFocus; + pWin = pSprite->win; + } + else + effectiveFocus = pWin = inputFocus; + } + else + dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess); + + if (!pWin) + return BadWindow; + if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) + { + client->errorValue = stuff->propagate; + return BadValue; + } + stuff->event.u.u.type |= 0x80; + if (stuff->propagate) + { + for (;pWin; pWin = pWin->parent) + { + if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, + &stuff->event, 1)) + return Success; + if (DeliverEventsToWindow(dev, pWin, + &stuff->event, 1, stuff->eventMask, NullGrab)) + return Success; + if (pWin == effectiveFocus) + return Success; + stuff->eventMask &= ~wDontPropagateMask(pWin); + if (!stuff->eventMask) + break; + } + } + else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1)) + DeliverEventsToWindow(dev, pWin, &stuff->event, + 1, stuff->eventMask, NullGrab); + return Success; +} + +/** + * Server-side protocol handling for UngrabKey request. + * + * Deletes a passive grab for the given key. Works on the + * client's keyboard. + */ +int +ProcUngrabKey(ClientPtr client) +{ + REQUEST(xUngrabKeyReq); + WindowPtr pWin; + GrabRec tempGrab; + DeviceIntPtr keybd = PickKeyboard(client); + int rc; + + REQUEST_SIZE_MATCH(xUngrabKeyReq); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixGetAttrAccess); + if (rc != Success) + return rc; + + if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) || + (stuff->key < keybd->key->xkbInfo->desc->min_key_code)) + && (stuff->key != AnyKey)) + { + client->errorValue = stuff->key; + return BadValue; + } + if ((stuff->modifiers != AnyModifier) && + (stuff->modifiers & ~AllModifiersMask)) + { + client->errorValue = stuff->modifiers; + return BadValue; + } + tempGrab.resource = client->clientAsMask; + tempGrab.device = keybd; + tempGrab.window = pWin; + tempGrab.modifiersDetail.exact = stuff->modifiers; + tempGrab.modifiersDetail.pMask = NULL; + tempGrab.modifierDevice = GetPairedDevice(keybd); + tempGrab.type = KeyPress; + tempGrab.grabtype = GRABTYPE_CORE; + tempGrab.detail.exact = stuff->key; + tempGrab.detail.pMask = NULL; + tempGrab.next = NULL; + + if (!DeletePassiveGrabFromList(&tempGrab)) + return BadAlloc; + return Success; +} + +/** + * Server-side protocol handling for GrabKey request. + * + * Creates a grab for the client's keyboard and adds it to the list of passive + * grabs. + */ +int +ProcGrabKey(ClientPtr client) +{ + WindowPtr pWin; + REQUEST(xGrabKeyReq); + GrabPtr grab; + DeviceIntPtr keybd = PickKeyboard(client); + int rc; + GrabParameters param; + GrabMask mask; + + REQUEST_SIZE_MATCH(xGrabKeyReq); + + memset(¶m, 0, sizeof(param)); + param.grabtype = GRABTYPE_CORE; + param.ownerEvents = stuff->ownerEvents; + param.this_device_mode = stuff->keyboardMode; + param.other_devices_mode = stuff->pointerMode; + param.modifiers = stuff->modifiers; + + rc = CheckGrabValues(client, ¶m); + if (rc != Success) + return rc; + + if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) || + (stuff->key < keybd->key->xkbInfo->desc->min_key_code)) + && (stuff->key != AnyKey)) + { + client->errorValue = stuff->key; + return BadValue; + } + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + + + mask.core = (KeyPressMask | KeyReleaseMask); + + grab = CreateGrab(client->index, keybd, keybd, pWin, GRABTYPE_CORE, &mask, + ¶m, KeyPress, stuff->key, NullWindow, NullCursor); + if (!grab) + return BadAlloc; + return AddPassiveGrabToList(client, grab); +} + + +/** + * Server-side protocol handling for GrabButton request. + * + * Creates a grab for the client's ClientPointer and adds it as a passive grab + * to the list. + */ +int +ProcGrabButton(ClientPtr client) +{ + WindowPtr pWin, confineTo; + REQUEST(xGrabButtonReq); + CursorPtr cursor; + GrabPtr grab; + DeviceIntPtr ptr, modifierDevice; + Mask access_mode = DixGrabAccess; + GrabMask mask; + GrabParameters param; + int rc; + + REQUEST_SIZE_MATCH(xGrabButtonReq); + if ((stuff->pointerMode != GrabModeSync) && + (stuff->pointerMode != GrabModeAsync)) + { + client->errorValue = stuff->pointerMode; + return BadValue; + } + if ((stuff->keyboardMode != GrabModeSync) && + (stuff->keyboardMode != GrabModeAsync)) + { + client->errorValue = stuff->keyboardMode; + return BadValue; + } + if ((stuff->modifiers != AnyModifier) && + (stuff->modifiers & ~AllModifiersMask)) + { + client->errorValue = stuff->modifiers; + return BadValue; + } + if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) + { + client->errorValue = stuff->ownerEvents; + return BadValue; + } + if (stuff->eventMask & ~PointerGrabMask) + { + client->errorValue = stuff->eventMask; + return BadValue; + } + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + if (stuff->confineTo == None) + confineTo = NullWindow; + else { + rc = dixLookupWindow(&confineTo, stuff->confineTo, client, + DixSetAttrAccess); + if (rc != Success) + return rc; + } + if (stuff->cursor == None) + cursor = NullCursor; + else + { + rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) + { + client->errorValue = stuff->cursor; + return rc; + } + access_mode |= DixForceAccess; + } + + ptr = PickPointer(client); + modifierDevice = GetPairedDevice(ptr); + if (stuff->pointerMode == GrabModeSync || + stuff->keyboardMode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, access_mode); + if (rc != Success) + return rc; + + memset(¶m, 0, sizeof(param)); + param.grabtype = GRABTYPE_CORE; + param.ownerEvents = stuff->ownerEvents; + param.this_device_mode = stuff->keyboardMode; + param.other_devices_mode = stuff->pointerMode; + param.modifiers = stuff->modifiers; + + mask.core = stuff->eventMask; + + grab = CreateGrab(client->index, ptr, modifierDevice, pWin, + GRABTYPE_CORE, &mask, ¶m, ButtonPress, + stuff->button, confineTo, cursor); + if (!grab) + return BadAlloc; + return AddPassiveGrabToList(client, grab); +} + +/** + * Server-side protocol handling for UngrabButton request. + * + * Deletes a passive grab on the client's ClientPointer from the list. + */ +int +ProcUngrabButton(ClientPtr client) +{ + REQUEST(xUngrabButtonReq); + WindowPtr pWin; + GrabRec tempGrab; + int rc; + DeviceIntPtr ptr; + + REQUEST_SIZE_MATCH(xUngrabButtonReq); + if ((stuff->modifiers != AnyModifier) && + (stuff->modifiers & ~AllModifiersMask)) + { + client->errorValue = stuff->modifiers; + return BadValue; + } + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; + + ptr = PickPointer(client); + + tempGrab.resource = client->clientAsMask; + tempGrab.device = ptr; + tempGrab.window = pWin; + tempGrab.modifiersDetail.exact = stuff->modifiers; + tempGrab.modifiersDetail.pMask = NULL; + tempGrab.modifierDevice = GetPairedDevice(ptr); + tempGrab.type = ButtonPress; + tempGrab.detail.exact = stuff->button; + tempGrab.grabtype = GRABTYPE_CORE; + tempGrab.detail.pMask = NULL; + tempGrab.next = NULL; + + if (!DeletePassiveGrabFromList(&tempGrab)) + return BadAlloc; + return Success; +} + +/** + * Deactivate any grab that may be on the window, remove the focus. + * Delete any XInput extension events from the window too. Does not change the + * window mask. Use just before the window is deleted. + * + * If freeResources is set, passive grabs on the window are deleted. + * + * @param pWin The window to delete events from. + * @param freeResources True if resources associated with the window should be + * deleted. + */ +void +DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) +{ + WindowPtr parent; + DeviceIntPtr mouse = inputInfo.pointer; + DeviceIntPtr keybd = inputInfo.keyboard; + FocusClassPtr focus; + OtherClientsPtr oc; + GrabPtr passive; + GrabPtr grab; + + + /* Deactivate any grabs performed on this window, before making any + input focus changes. */ + grab = mouse->deviceGrab.grab; + if (grab && + ((grab->window == pWin) || (grab->confineTo == pWin))) + (*mouse->deviceGrab.DeactivateGrab)(mouse); + + + /* Deactivating a keyboard grab should cause focus events. */ + grab = keybd->deviceGrab.grab; + if (grab && (grab->window == pWin)) + (*keybd->deviceGrab.DeactivateGrab)(keybd); + + /* And now the real devices */ + for (mouse = inputInfo.devices; mouse; mouse = mouse->next) + { + grab = mouse->deviceGrab.grab; + if (grab && ((grab->window == pWin) || (grab->confineTo == pWin))) + (*mouse->deviceGrab.DeactivateGrab)(mouse); + } + + + for (keybd = inputInfo.devices; keybd; keybd = keybd->next) + { + if (IsKeyboardDevice(keybd)) + { + focus = keybd->focus; + + /* If the focus window is a root window (ie. has no parent) then don't + delete the focus from it. */ + + if ((pWin == focus->win) && (pWin->parent != NullWindow)) + { + int focusEventMode = NotifyNormal; + + /* If a grab is in progress, then alter the mode of focus events. */ + + if (keybd->deviceGrab.grab) + focusEventMode = NotifyWhileGrabbed; + + switch (focus->revert) + { + case RevertToNone: + DoFocusEvents(keybd, pWin, NoneWin, focusEventMode); + focus->win = NoneWin; + focus->traceGood = 0; + break; + case RevertToParent: + parent = pWin; + do + { + parent = parent->parent; + focus->traceGood--; + } while (!parent->realized + /* This would be a good protocol change -- windows being reparented + during SaveSet processing would cause the focus to revert to the + nearest enclosing window which will survive the death of the exiting + client, instead of ending up reverting to a dying window and thence + to None + */ +#ifdef NOTDEF + || wClient(parent)->clientGone +#endif + ); + if (!ActivateFocusInGrab(keybd, pWin, parent)) + DoFocusEvents(keybd, pWin, parent, focusEventMode); + focus->win = parent; + focus->revert = RevertToNone; + break; + case RevertToPointerRoot: + if (!ActivateFocusInGrab(keybd, pWin, PointerRootWin)) + DoFocusEvents(keybd, pWin, PointerRootWin, focusEventMode); + focus->win = PointerRootWin; + focus->traceGood = 0; + break; + } + } + } + + if (IsPointerDevice(keybd)) + { + if (keybd->valuator->motionHintWindow == pWin) + keybd->valuator->motionHintWindow = NullWindow; + } + } + + if (freeResources) + { + if (pWin->dontPropagate) + DontPropagateRefCnts[pWin->dontPropagate]--; + while ( (oc = wOtherClients(pWin)) ) + FreeResource(oc->resource, RT_NONE); + while ( (passive = wPassiveGrabs(pWin)) ) + FreeResource(passive->resource, RT_NONE); + } + + DeleteWindowFromAnyExtEvents(pWin, freeResources); +} + +/** + * Call this whenever some window at or below pWin has changed geometry. If + * there is a grab on the window, the cursor will be re-confined into the + * window. + */ +void +CheckCursorConfinement(WindowPtr pWin) +{ + GrabPtr grab; + WindowPtr confineTo; + DeviceIntPtr pDev; + +#ifdef PANORAMIX + if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return; +#endif + + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + { + if (DevHasCursor(pDev)) + { + grab = pDev->deviceGrab.grab; + if (grab && (confineTo = grab->confineTo)) + { + if (!BorderSizeNotEmpty(pDev, confineTo)) + (*pDev->deviceGrab.DeactivateGrab)(pDev); + else if ((pWin == confineTo) || IsParent(pWin, confineTo)) + ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE); + } + } + } +} + +Mask +EventMaskForClient(WindowPtr pWin, ClientPtr client) +{ + OtherClientsPtr other; + + if (wClient (pWin) == client) + return pWin->eventMask; + for (other = wOtherClients(pWin); other; other = other->next) + { + if (SameClient(other, client)) + return other->mask; + } + return 0; +} + +/** + * Server-side protocol handling for RecolorCursor request. + */ +int +ProcRecolorCursor(ClientPtr client) +{ + CursorPtr pCursor; + int rc, nscr; + ScreenPtr pscr; + Bool displayed; + SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite; + REQUEST(xRecolorCursorReq); + + REQUEST_SIZE_MATCH(xRecolorCursorReq); + rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR, + client, DixWriteAccess); + if (rc != Success) + { + client->errorValue = stuff->cursor; + return rc; + } + + pCursor->foreRed = stuff->foreRed; + pCursor->foreGreen = stuff->foreGreen; + pCursor->foreBlue = stuff->foreBlue; + + pCursor->backRed = stuff->backRed; + pCursor->backGreen = stuff->backGreen; + pCursor->backBlue = stuff->backBlue; + + for (nscr = 0; nscr < screenInfo.numScreens; nscr++) + { + pscr = screenInfo.screens[nscr]; +#ifdef PANORAMIX + if(!noPanoramiXExtension) + displayed = (pscr == pSprite->screen); + else +#endif + displayed = (pscr == pSprite->hotPhys.pScreen); + ( *pscr->RecolorCursor)(PickPointer(client), pscr, pCursor, + (pCursor == pSprite->current) && displayed); + } + return Success; +} + +/** + * Write the given events to a client, swapping the byte order if necessary. + * To swap the byte ordering, a callback is called that has to be set up for + * the given event type. + * + * In the case of DeviceMotionNotify trailed by DeviceValuators, the events + * can be more than one. Usually it's just one event. + * + * Do not modify the event structure passed in. See comment below. + * + * @param pClient Client to send events to. + * @param count Number of events. + * @param events The event list. + */ +void +WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) +{ +#ifdef PANORAMIX + xEvent eventCopy; +#endif + xEvent *eventTo, *eventFrom; + int i, + eventlength = sizeof(xEvent); + + if (!pClient || pClient == serverClient || pClient->clientGone) + return; + + for (i = 0; i < count; i++) + if ((events[i].u.u.type & 0x7f) != KeymapNotify) + events[i].u.u.sequenceNumber = pClient->sequence; + + /* Let XKB rewrite the state, as it depends on client preferences. */ + XkbFilterEvents(pClient, count, events); + +#ifdef PANORAMIX + if(!noPanoramiXExtension && + (screenInfo.screens[0]->x || screenInfo.screens[0]->y)) + { + switch(events->u.u.type) { + case MotionNotify: + case ButtonPress: + case ButtonRelease: + case KeyPress: + case KeyRelease: + case EnterNotify: + case LeaveNotify: + /* + When multiple clients want the same event DeliverEventsToWindow + passes the same event structure multiple times so we can't + modify the one passed to us + */ + count = 1; /* should always be 1 */ + memcpy(&eventCopy, events, sizeof(xEvent)); + eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x; + eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y; + if(eventCopy.u.keyButtonPointer.event == + eventCopy.u.keyButtonPointer.root) + { + eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x; + eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y; + } + events = &eventCopy; + break; + default: break; + } + } +#endif + + if (EventCallback) + { + EventInfoRec eventinfo; + eventinfo.client = pClient; + eventinfo.events = events; + eventinfo.count = count; + CallCallbacks(&EventCallback, (pointer)&eventinfo); + } +#ifdef XSERVER_DTRACE + if (XSERVER_SEND_EVENT_ENABLED()) { + for (i = 0; i < count; i++) + { + XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]); + } + } +#endif + /* Just a safety check to make sure we only have one GenericEvent, it just + * makes things easier for me right now. (whot) */ + for (i = 1; i < count; i++) + { + if (events[i].u.u.type == GenericEvent) + { + ErrorF("[dix] TryClientEvents: Only one GenericEvent at a time.\n"); + return; + } + } + + if (events->u.u.type == GenericEvent) + { + eventlength += ((xGenericEvent*)events)->length * 4; + } + + if(pClient->swapped) + { + if (eventlength > swapEventLen) + { + swapEventLen = eventlength; + swapEvent = realloc(swapEvent, swapEventLen); + if (!swapEvent) + { + FatalError("WriteEventsToClient: Out of memory.\n"); + return; + } + } + + for(i = 0; i < count; i++) + { + eventFrom = &events[i]; + eventTo = swapEvent; + + /* Remember to strip off the leading bit of type in case + this event was sent with "SendEvent." */ + (*EventSwapVector[eventFrom->u.u.type & 0177]) + (eventFrom, eventTo); + + WriteToClient(pClient, eventlength, (char *)eventTo); + } + } + else + { + /* only one GenericEvent, remember? that means either count is 1 and + * eventlength is arbitrary or eventlength is 32 and count doesn't + * matter. And we're all set. Woohoo. */ + WriteToClient(pClient, count * eventlength, (char *) events); + } +} + +/* + * Set the client pointer for the given client. + * + * A client can have exactly one ClientPointer. Each time a + * request/reply/event is processed and the choice of devices is ambiguous + * (e.g. QueryPointer request), the server will pick the ClientPointer (see + * PickPointer()). + * If a keyboard is needed, the first keyboard paired with the CP is used. + */ +int +SetClientPointer(ClientPtr client, DeviceIntPtr device) +{ + int rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixUseAccess); + if (rc != Success) + return rc; + + if (!IsMaster(device)) + { + ErrorF("[dix] Need master device for ClientPointer. This is a bug.\n"); + return BadDevice; + } else if (!device->spriteInfo->spriteOwner) + { + ErrorF("[dix] Device %d does not have a sprite. " + "Cannot be ClientPointer\n", device->id); + return BadDevice; + } + client->clientPtr = device; + return Success; +} + +/* PickPointer will pick an appropriate pointer for the given client. + * + * An "appropriate device" is (in order of priority): + * 1) A device the given client has a core grab on. + * 2) A device set as ClientPointer for the given client. + * 3) The first master device. + */ +DeviceIntPtr +PickPointer(ClientPtr client) +{ + DeviceIntPtr it = inputInfo.devices; + + /* First, check if the client currently has a grab on a device. Even + * keyboards count. */ + for(it = inputInfo.devices; it; it = it->next) + { + GrabPtr grab = it->deviceGrab.grab; + if (grab && grab->grabtype == GRABTYPE_CORE && SameClient(grab, client)) + { + it = GetMaster(it, MASTER_POINTER); + return it; /* Always return a core grabbed device */ + } + } + + if (!client->clientPtr) + { + DeviceIntPtr it = inputInfo.devices; + while (it) + { + if (IsMaster(it) && it->spriteInfo->spriteOwner) + { + client->clientPtr = it; + break; + } + it = it->next; + } + } + return client->clientPtr; +} + +/* PickKeyboard will pick an appropriate keyboard for the given client by + * searching the list of devices for the keyboard device that is paired with + * the client's pointer. + */ +DeviceIntPtr +PickKeyboard(ClientPtr client) +{ + DeviceIntPtr ptr = PickPointer(client); + DeviceIntPtr kbd = GetMaster(ptr, MASTER_KEYBOARD); + + if (!kbd) + { + ErrorF("[dix] ClientPointer not paired with a keyboard. This " + "is a bug.\n"); + } + + return kbd; +} + +/* A client that has one or more core grabs does not get core events from + * devices it does not have a grab on. Legacy applications behave bad + * otherwise because they are not used to it and the events interfere. + * Only applies for core events. + * + * Return true if a core event from the device would interfere and should not + * be delivered. + */ +Bool +IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event) +{ + DeviceIntPtr it = inputInfo.devices; + + switch(event->u.u.type) + { + case KeyPress: + case KeyRelease: + case ButtonPress: + case ButtonRelease: + case MotionNotify: + case EnterNotify: + case LeaveNotify: + break; + default: + return FALSE; + } + + if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) + return FALSE; + + while(it) + { + if (it != dev) + { + if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client) + && !it->deviceGrab.fromPassiveGrab) + { + if ((IsPointerDevice(it) && IsPointerDevice(dev)) || + (IsKeyboardDevice(it) && IsKeyboardDevice(dev))) + return TRUE; + } + } + it = it->next; + } + + return FALSE; +} + diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c index 80275bd40..ef3142c84 100644 --- a/xorg-server/dix/inpututils.c +++ b/xorg-server/dix/inpututils.c @@ -1,550 +1,558 @@ -/* - * Copyright © 2008 Daniel Stone - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Daniel Stone - */ - -#ifdef HAVE_DIX_CONFIG_H -#include "dix-config.h" -#endif - -#include "exevents.h" -#include "exglobals.h" -#include "misc.h" -#include "input.h" -#include "inputstr.h" -#include "xace.h" -#include "xkbsrv.h" -#include "xkbstr.h" -#include "inpututils.h" - -/* Check if a button map change is okay with the device. - * Returns -1 for BadValue, as it collides with MappingBusy. */ -static int -check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out, - ClientPtr client) -{ - int i, ret; - - if (!dev || !dev->button) - { - client->errorValue = (dev) ? dev->id : 0; - return BadDevice; - } - - ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess); - if (ret != Success) - { - client->errorValue = dev->id; - return ret; - } - - for (i = 0; i < len; i++) { - if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1]) - return MappingBusy; - } - - return Success; -} - -static void -do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client) -{ - int i; - xEvent core_mn; - deviceMappingNotify xi_mn; - - /* The map in ButtonClassRec refers to button numbers, whereas the - * protocol is zero-indexed. Sigh. */ - memcpy(&(dev->button->map[1]), map, len); - - core_mn.u.u.type = MappingNotify; - core_mn.u.mappingNotify.request = MappingPointer; - - /* 0 is the server client. */ - for (i = 1; i < currentMaxClients; i++) { - /* Don't send irrelevant events to naïve clients. */ - if (!clients[i] || clients[i]->clientState != ClientStateRunning) - continue; - - if (!XIShouldNotify(clients[i], dev)) - continue; - - WriteEventsToClient(clients[i], 1, &core_mn); - } - - xi_mn.type = DeviceMappingNotify; - xi_mn.request = MappingPointer; - xi_mn.deviceid = dev->id; - xi_mn.time = GetTimeInMillis(); - - SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) &xi_mn, 1); -} - -/* - * Does what it says on the box, both for core and Xi. - * - * Faithfully reports any errors encountered while trying to apply the map - * to the requested device, faithfully ignores any errors encountered while - * trying to apply the map to its master/slaves. - */ -int -ApplyPointerMapping(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client) -{ - int ret; - - /* If we can't perform the change on the requested device, bail out. */ - ret = check_butmap_change(dev, map, len, &client->errorValue, client); - if (ret != Success) - return ret; - do_butmap_change(dev, map, len, client); - - return Success; -} - -/* Check if a modifier map change is okay with the device. - * Returns -1 for BadValue, as it collides with MappingBusy; this particular - * caveat can be removed with LegalModifier, as we have no other reason to - * set MappingFailed. Sigh. */ -static int -check_modmap_change(ClientPtr client, DeviceIntPtr dev, KeyCode *modmap) -{ - int ret, i; - XkbDescPtr xkb; - - ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess); - if (ret != Success) - return ret; - - if (!dev->key) - return BadMatch; - xkb = dev->key->xkbInfo->desc; - - for (i = 0; i < MAP_LENGTH; i++) { - if (!modmap[i]) - continue; - - /* Check that all the new modifiers fall within the advertised - * keycode range. */ - if (i < xkb->min_key_code || i > xkb->max_key_code) { - client->errorValue = i; - return -1; - } - - /* Make sure the mapping is okay with the DDX. */ - if (!LegalModifier(i, dev)) { - client->errorValue = i; - return MappingFailed; - } - - /* None of the new modifiers may be down while we change the - * map. */ - if (key_is_down(dev, i, KEY_POSTED | KEY_PROCESSED)) { - client->errorValue = i; - return MappingBusy; - } - } - - /* None of the old modifiers may be down while we change the map, - * either. */ - for (i = xkb->min_key_code; i < xkb->max_key_code; i++) { - if (!xkb->map->modmap[i]) - continue; - if (key_is_down(dev, i, KEY_POSTED | KEY_PROCESSED)) { - client->errorValue = i; - return MappingBusy; - } - } - - return Success; -} - -static int -check_modmap_change_slave(ClientPtr client, DeviceIntPtr master, - DeviceIntPtr slave, CARD8 *modmap) -{ - XkbDescPtr master_xkb, slave_xkb; - int i, j; - - if (!slave->key || !master->key) - return 0; - - master_xkb = master->key->xkbInfo->desc; - slave_xkb = slave->key->xkbInfo->desc; - - /* Ignore devices with a clearly different keymap. */ - if (slave_xkb->min_key_code != master_xkb->min_key_code || - slave_xkb->max_key_code != master_xkb->max_key_code) - return 0; - - for (i = 0; i < MAP_LENGTH; i++) { - if (!modmap[i]) - continue; - - /* If we have different symbols for any modifier on an - * extended keyboard, ignore the whole remap request. */ - for (j = 0; - j < XkbKeyNumSyms(slave_xkb, i) && - j < XkbKeyNumSyms(master_xkb, i); - j++) - if (XkbKeySymsPtr(slave_xkb, i)[j] != XkbKeySymsPtr(master_xkb, i)[j]) - return 0; - } - - if (check_modmap_change(client, slave, modmap) != Success) - return 0; - - return 1; -} - -/* Actually change the modifier map, and send notifications. Cannot fail. */ -static void -do_modmap_change(ClientPtr client, DeviceIntPtr dev, CARD8 *modmap) -{ - XkbApplyMappingChange(dev, NULL, 0, 0, modmap, serverClient); -} - -/* Rebuild modmap (key -> mod) from map (mod -> key). */ -static int build_modmap_from_modkeymap(CARD8 *modmap, KeyCode *modkeymap, - int max_keys_per_mod) -{ - int i, len = max_keys_per_mod * 8; - - memset(modmap, 0, MAP_LENGTH); - - for (i = 0; i < len; i++) { - if (!modkeymap[i]) - continue; - - if (modkeymap[i] >= MAP_LENGTH) - return BadValue; - - if (modmap[modkeymap[i]]) - return BadValue; - - modmap[modkeymap[i]] = 1 << (i / max_keys_per_mod); - } - - return Success; -} - -int -change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap, - int max_keys_per_mod) -{ - int ret; - CARD8 modmap[MAP_LENGTH]; - DeviceIntPtr tmp; - - ret = build_modmap_from_modkeymap(modmap, modkeymap, max_keys_per_mod); - if (ret != Success) - return ret; - - /* If we can't perform the change on the requested device, bail out. */ - ret = check_modmap_change(client, dev, modmap); - if (ret != Success) - return ret; - do_modmap_change(client, dev, modmap); - - /* Change any attached masters/slaves. */ - if (IsMaster(dev)) { - for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { - if (!IsMaster(tmp) && tmp->u.master == dev) - if (check_modmap_change_slave(client, dev, tmp, modmap)) - do_modmap_change(client, tmp, modmap); - } - } - else if (dev->u.master && dev->u.master->u.lastSlave == dev) { - /* If this fails, expect the results to be weird. */ - if (check_modmap_change(client, dev->u.master, modmap)) - do_modmap_change(client, dev->u.master, modmap); - } - - return Success; -} - -int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, - KeyCode **modkeymap_out, int *max_keys_per_mod_out) -{ - CARD8 keys_per_mod[8]; - int max_keys_per_mod; - KeyCode *modkeymap = NULL; - int i, j, ret; - - ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGetAttrAccess); - if (ret != Success) - return ret; - - if (!dev->key) - return BadMatch; - - /* Count the number of keys per modifier to determine how wide we - * should make the map. */ - max_keys_per_mod = 0; - for (i = 0; i < 8; i++) - keys_per_mod[i] = 0; - for (i = 8; i < MAP_LENGTH; i++) { - for (j = 0; j < 8; j++) { - if (dev->key->xkbInfo->desc->map->modmap[i] & (1 << j)) { - if (++keys_per_mod[j] > max_keys_per_mod) - max_keys_per_mod = keys_per_mod[j]; - } - } - } - - if (max_keys_per_mod != 0) { - modkeymap = calloc(max_keys_per_mod * 8, sizeof(KeyCode)); - if (!modkeymap) - return BadAlloc; - - for (i = 0; i < 8; i++) - keys_per_mod[i] = 0; - - for (i = 8; i < MAP_LENGTH; i++) { - for (j = 0; j < 8; j++) { - if (dev->key->xkbInfo->desc->map->modmap[i] & (1 << j)) { - modkeymap[(j * max_keys_per_mod) + keys_per_mod[j]] = i; - keys_per_mod[j]++; - } - } - } - } - - *max_keys_per_mod_out = max_keys_per_mod; - *modkeymap_out = modkeymap; - - return Success; -} - -/** - * Duplicate the InputAttributes in the most obvious way. - * No special memory handling is used to give drivers the maximum - * flexibility with the data. Drivers should be able to call realloc on the - * product string if needed and perform similar operations. - */ -InputAttributes* -DuplicateInputAttributes(InputAttributes *attrs) -{ - InputAttributes *new_attr; - int ntags = 0; - char **tags, **new_tags; - - if (!attrs) - return NULL; - - if (!(new_attr = calloc(1, sizeof(InputAttributes)))) - goto unwind; - - if (attrs->product && !(new_attr->product = strdup(attrs->product))) - goto unwind; - if (attrs->vendor && !(new_attr->vendor = strdup(attrs->vendor))) - goto unwind; - if (attrs->device && !(new_attr->device = strdup(attrs->device))) - goto unwind; - if (attrs->pnp_id && !(new_attr->pnp_id = strdup(attrs->pnp_id))) - goto unwind; - if (attrs->usb_id && !(new_attr->usb_id = strdup(attrs->usb_id))) - goto unwind; - - new_attr->flags = attrs->flags; - - if ((tags = attrs->tags)) - { - while(*tags++) - ntags++; - - new_attr->tags = calloc(ntags + 1, sizeof(char*)); - if (!new_attr->tags) - goto unwind; - - tags = attrs->tags; - new_tags = new_attr->tags; - - while(*tags) - { - *new_tags = strdup(*tags); - if (!*new_tags) - goto unwind; - - tags++; - new_tags++; - } - } - - return new_attr; - -unwind: - FreeInputAttributes(new_attr); - return NULL; -} - -void -FreeInputAttributes(InputAttributes *attrs) -{ - char **tags; - - if (!attrs) - return; - - free(attrs->product); - free(attrs->vendor); - free(attrs->device); - free(attrs->pnp_id); - free(attrs->usb_id); - - if ((tags = attrs->tags)) - while(*tags) - free(*tags++); - - free(attrs->tags); - free(attrs); -} - -/** - * Alloc a valuator mask large enough for num_valuators. - */ -ValuatorMask* -valuator_mask_new(int num_valuators) -{ - /* alloc a fixed size mask for now and ignore num_valuators. in the - * flying-car future, when we can dynamically alloc the masks and are - * not constrained by signals, we can start using num_valuators */ - ValuatorMask *mask = calloc(1, sizeof(ValuatorMask)); - mask->last_bit = -1; - return mask; -} - -/** - * Sets a range of valuators between first_valuator and num_valuators with - * the data in the valuators array. All other values are set to 0. - */ -void -valuator_mask_set_range(ValuatorMask *mask, int first_valuator, int num_valuators, - const int* valuators) -{ - int i; - - valuator_mask_zero(mask); - - for (i = first_valuator; i < min(first_valuator + num_valuators, MAX_VALUATORS); i++) - valuator_mask_set(mask, i, valuators[i - first_valuator]); -} - -/** - * Reset mask to zero. - */ -void -valuator_mask_zero(ValuatorMask *mask) -{ - memset(mask, 0, sizeof(*mask)); - mask->last_bit = -1; -} - -/** - * Returns the current size of the mask (i.e. the highest number of - * valuators currently set + 1). - */ -int -valuator_mask_size(const ValuatorMask *mask) -{ - return mask->last_bit + 1; -} - -/** - * Returns the number of valuators set in the given mask. - */ -int -valuator_mask_num_valuators(const ValuatorMask *mask) -{ - return CountBits(mask->mask, min(mask->last_bit + 1, MAX_VALUATORS)); -} - -/** - * Return true if the valuator is set in the mask, or false otherwise. - */ -int -valuator_mask_isset(const ValuatorMask *mask, int valuator) -{ - return mask->last_bit >= valuator && BitIsOn(mask->mask, valuator); -} - -/** - * Set the valuator to the given data. - */ -void -valuator_mask_set(ValuatorMask *mask, int valuator, int data) -{ - mask->last_bit = max(valuator, mask->last_bit); - SetBit(mask->mask, valuator); - mask->valuators[valuator] = data; -} - -/** - * Return the requested valuator value. If the mask bit is not set for the - * given valuator, the returned value is undefined. - */ -int -valuator_mask_get(const ValuatorMask *mask, int valuator) -{ - return mask->valuators[valuator]; -} - -/** - * Remove the valuator from the mask. - */ -void -valuator_mask_unset(ValuatorMask *mask, int valuator) -{ - if (mask->last_bit >= valuator) { - int i, lastbit = -1; - - ClearBit(mask->mask, valuator); - mask->valuators[valuator] = 0; - - for (i = 0; i <= mask->last_bit; i++) - if (valuator_mask_isset(mask, i)) - lastbit = max(lastbit, i); - mask->last_bit = lastbit; - } -} - -void -valuator_mask_copy(ValuatorMask *dest, const ValuatorMask *src) -{ - if (src) - memcpy(dest, src, sizeof(*dest)); - else - valuator_mask_zero(dest); -} - -int -CountBits(const uint8_t *mask, int len) -{ - int i; - int ret = 0; - - for (i = 0; i < len; i++) - if (BitIsOn(mask, i)) - ret++; - - return ret; -} +/* + * Copyright © 2008 Daniel Stone + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Daniel Stone + */ + +#ifdef HAVE_DIX_CONFIG_H +#include "dix-config.h" +#endif + +#include "exevents.h" +#include "exglobals.h" +#include "misc.h" +#include "input.h" +#include "inputstr.h" +#include "xace.h" +#include "xkbsrv.h" +#include "xkbstr.h" +#include "inpututils.h" + +/* Check if a button map change is okay with the device. + * Returns -1 for BadValue, as it collides with MappingBusy. */ +static int +check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out, + ClientPtr client) +{ + int i, ret; + + if (!dev || !dev->button) + { + client->errorValue = (dev) ? dev->id : 0; + return BadDevice; + } + + ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess); + if (ret != Success) + { + client->errorValue = dev->id; + return ret; + } + + for (i = 0; i < len; i++) { + if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1]) + return MappingBusy; + } + + return Success; +} + +static void +do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client) +{ + int i; + xEvent core_mn; + deviceMappingNotify xi_mn; + + /* The map in ButtonClassRec refers to button numbers, whereas the + * protocol is zero-indexed. Sigh. */ + memcpy(&(dev->button->map[1]), map, len); + + core_mn.u.u.type = MappingNotify; + core_mn.u.mappingNotify.request = MappingPointer; + + /* 0 is the server client. */ + for (i = 1; i < currentMaxClients; i++) { + /* Don't send irrelevant events to naïve clients. */ + if (!clients[i] || clients[i]->clientState != ClientStateRunning) + continue; + + if (!XIShouldNotify(clients[i], dev)) + continue; + + WriteEventsToClient(clients[i], 1, &core_mn); + } + + xi_mn.type = DeviceMappingNotify; + xi_mn.request = MappingPointer; + xi_mn.deviceid = dev->id; + xi_mn.time = GetTimeInMillis(); + + SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) &xi_mn, 1); +} + +/* + * Does what it says on the box, both for core and Xi. + * + * Faithfully reports any errors encountered while trying to apply the map + * to the requested device, faithfully ignores any errors encountered while + * trying to apply the map to its master/slaves. + */ +int +ApplyPointerMapping(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client) +{ + int ret; + + /* If we can't perform the change on the requested device, bail out. */ + ret = check_butmap_change(dev, map, len, &client->errorValue, client); + if (ret != Success) + return ret; + do_butmap_change(dev, map, len, client); + + return Success; +} + +/* Check if a modifier map change is okay with the device. + * Returns -1 for BadValue, as it collides with MappingBusy; this particular + * caveat can be removed with LegalModifier, as we have no other reason to + * set MappingFailed. Sigh. */ +static int +check_modmap_change(ClientPtr client, DeviceIntPtr dev, KeyCode *modmap) +{ + int ret, i; + XkbDescPtr xkb; + + ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess); + if (ret != Success) + return ret; + + if (!dev->key) + return BadMatch; + xkb = dev->key->xkbInfo->desc; + + for (i = 0; i < MAP_LENGTH; i++) { + if (!modmap[i]) + continue; + + /* Check that all the new modifiers fall within the advertised + * keycode range. */ + if (i < xkb->min_key_code || i > xkb->max_key_code) { + client->errorValue = i; + return -1; + } + + /* Make sure the mapping is okay with the DDX. */ + if (!LegalModifier(i, dev)) { + client->errorValue = i; + return MappingFailed; + } + + /* None of the new modifiers may be down while we change the + * map. */ + if (key_is_down(dev, i, KEY_POSTED | KEY_PROCESSED)) { + client->errorValue = i; + return MappingBusy; + } + } + + /* None of the old modifiers may be down while we change the map, + * either. */ + for (i = xkb->min_key_code; i < xkb->max_key_code; i++) { + if (!xkb->map->modmap[i]) + continue; + if (key_is_down(dev, i, KEY_POSTED | KEY_PROCESSED)) { + client->errorValue = i; + return MappingBusy; + } + } + + return Success; +} + +static int +check_modmap_change_slave(ClientPtr client, DeviceIntPtr master, + DeviceIntPtr slave, CARD8 *modmap) +{ + XkbDescPtr master_xkb, slave_xkb; + int i, j; + + if (!slave->key || !master->key) + return 0; + + master_xkb = master->key->xkbInfo->desc; + slave_xkb = slave->key->xkbInfo->desc; + + /* Ignore devices with a clearly different keymap. */ + if (slave_xkb->min_key_code != master_xkb->min_key_code || + slave_xkb->max_key_code != master_xkb->max_key_code) + return 0; + + for (i = 0; i < MAP_LENGTH; i++) { + if (!modmap[i]) + continue; + + /* If we have different symbols for any modifier on an + * extended keyboard, ignore the whole remap request. */ + for (j = 0; + j < XkbKeyNumSyms(slave_xkb, i) && + j < XkbKeyNumSyms(master_xkb, i); + j++) + if (XkbKeySymsPtr(slave_xkb, i)[j] != XkbKeySymsPtr(master_xkb, i)[j]) + return 0; + } + + if (check_modmap_change(client, slave, modmap) != Success) + return 0; + + return 1; +} + +/* Actually change the modifier map, and send notifications. Cannot fail. */ +static void +do_modmap_change(ClientPtr client, DeviceIntPtr dev, CARD8 *modmap) +{ + XkbApplyMappingChange(dev, NULL, 0, 0, modmap, serverClient); +} + +/* Rebuild modmap (key -> mod) from map (mod -> key). */ +static int build_modmap_from_modkeymap(CARD8 *modmap, KeyCode *modkeymap, + int max_keys_per_mod) +{ + int i, len = max_keys_per_mod * 8; + + memset(modmap, 0, MAP_LENGTH); + + for (i = 0; i < len; i++) { + if (!modkeymap[i]) + continue; + + if (modkeymap[i] >= MAP_LENGTH) + return BadValue; + + if (modmap[modkeymap[i]]) + return BadValue; + + modmap[modkeymap[i]] = 1 << (i / max_keys_per_mod); + } + + return Success; +} + +int +change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap, + int max_keys_per_mod) +{ + int ret; + CARD8 modmap[MAP_LENGTH]; + DeviceIntPtr tmp; + + ret = build_modmap_from_modkeymap(modmap, modkeymap, max_keys_per_mod); + if (ret != Success) + return ret; + + /* If we can't perform the change on the requested device, bail out. */ + ret = check_modmap_change(client, dev, modmap); + if (ret != Success) + return ret; + do_modmap_change(client, dev, modmap); + + /* Change any attached masters/slaves. */ + if (IsMaster(dev)) { + for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { + if (!IsMaster(tmp) && tmp->u.master == dev) + if (check_modmap_change_slave(client, dev, tmp, modmap)) + do_modmap_change(client, tmp, modmap); + } + } + else if (dev->u.master && dev->u.master->u.lastSlave == dev) { + /* If this fails, expect the results to be weird. */ + if (check_modmap_change(client, dev->u.master, modmap)) + do_modmap_change(client, dev->u.master, modmap); + } + + return Success; +} + +int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, + KeyCode **modkeymap_out, int *max_keys_per_mod_out) +{ + CARD8 keys_per_mod[8]; + int max_keys_per_mod; + KeyCode *modkeymap = NULL; + int i, j, ret; + + ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGetAttrAccess); + if (ret != Success) + return ret; + + if (!dev->key) + return BadMatch; + + /* Count the number of keys per modifier to determine how wide we + * should make the map. */ + max_keys_per_mod = 0; + for (i = 0; i < 8; i++) + keys_per_mod[i] = 0; + for (i = 8; i < MAP_LENGTH; i++) { + for (j = 0; j < 8; j++) { + if (dev->key->xkbInfo->desc->map->modmap[i] & (1 << j)) { + if (++keys_per_mod[j] > max_keys_per_mod) + max_keys_per_mod = keys_per_mod[j]; + } + } + } + + if (max_keys_per_mod != 0) { + modkeymap = calloc(max_keys_per_mod * 8, sizeof(KeyCode)); + if (!modkeymap) + return BadAlloc; + + for (i = 0; i < 8; i++) + keys_per_mod[i] = 0; + + for (i = 8; i < MAP_LENGTH; i++) { + for (j = 0; j < 8; j++) { + if (dev->key->xkbInfo->desc->map->modmap[i] & (1 << j)) { + modkeymap[(j * max_keys_per_mod) + keys_per_mod[j]] = i; + keys_per_mod[j]++; + } + } + } + } + + *max_keys_per_mod_out = max_keys_per_mod; + *modkeymap_out = modkeymap; + + return Success; +} + +/** + * Duplicate the InputAttributes in the most obvious way. + * No special memory handling is used to give drivers the maximum + * flexibility with the data. Drivers should be able to call realloc on the + * product string if needed and perform similar operations. + */ +InputAttributes* +DuplicateInputAttributes(InputAttributes *attrs) +{ + InputAttributes *new_attr; + int ntags = 0; + char **tags, **new_tags; + + if (!attrs) + return NULL; + + if (!(new_attr = calloc(1, sizeof(InputAttributes)))) + goto unwind; + + if (attrs->product && !(new_attr->product = strdup(attrs->product))) + goto unwind; + if (attrs->vendor && !(new_attr->vendor = strdup(attrs->vendor))) + goto unwind; + if (attrs->device && !(new_attr->device = strdup(attrs->device))) + goto unwind; + if (attrs->pnp_id && !(new_attr->pnp_id = strdup(attrs->pnp_id))) + goto unwind; + if (attrs->usb_id && !(new_attr->usb_id = strdup(attrs->usb_id))) + goto unwind; + + new_attr->flags = attrs->flags; + + if ((tags = attrs->tags)) + { + while(*tags++) + ntags++; + + new_attr->tags = calloc(ntags + 1, sizeof(char*)); + if (!new_attr->tags) + goto unwind; + + tags = attrs->tags; + new_tags = new_attr->tags; + + while(*tags) + { + *new_tags = strdup(*tags); + if (!*new_tags) + goto unwind; + + tags++; + new_tags++; + } + } + + return new_attr; + +unwind: + FreeInputAttributes(new_attr); + return NULL; +} + +void +FreeInputAttributes(InputAttributes *attrs) +{ + char **tags; + + if (!attrs) + return; + + free(attrs->product); + free(attrs->vendor); + free(attrs->device); + free(attrs->pnp_id); + free(attrs->usb_id); + + if ((tags = attrs->tags)) + while(*tags) + free(*tags++); + + free(attrs->tags); + free(attrs); +} + +/** + * Alloc a valuator mask large enough for num_valuators. + */ +ValuatorMask* +valuator_mask_new(int num_valuators) +{ + /* alloc a fixed size mask for now and ignore num_valuators. in the + * flying-car future, when we can dynamically alloc the masks and are + * not constrained by signals, we can start using num_valuators */ + ValuatorMask *mask = calloc(1, sizeof(ValuatorMask)); + mask->last_bit = -1; + return mask; +} + +void +valuator_mask_free(ValuatorMask **mask) +{ + free(*mask); + *mask = NULL; +} + + +/** + * Sets a range of valuators between first_valuator and num_valuators with + * the data in the valuators array. All other values are set to 0. + */ +void +valuator_mask_set_range(ValuatorMask *mask, int first_valuator, int num_valuators, + const int* valuators) +{ + int i; + + valuator_mask_zero(mask); + + for (i = first_valuator; i < min(first_valuator + num_valuators, MAX_VALUATORS); i++) + valuator_mask_set(mask, i, valuators[i - first_valuator]); +} + +/** + * Reset mask to zero. + */ +void +valuator_mask_zero(ValuatorMask *mask) +{ + memset(mask, 0, sizeof(*mask)); + mask->last_bit = -1; +} + +/** + * Returns the current size of the mask (i.e. the highest number of + * valuators currently set + 1). + */ +int +valuator_mask_size(const ValuatorMask *mask) +{ + return mask->last_bit + 1; +} + +/** + * Returns the number of valuators set in the given mask. + */ +int +valuator_mask_num_valuators(const ValuatorMask *mask) +{ + return CountBits(mask->mask, min(mask->last_bit + 1, MAX_VALUATORS)); +} + +/** + * Return true if the valuator is set in the mask, or false otherwise. + */ +int +valuator_mask_isset(const ValuatorMask *mask, int valuator) +{ + return mask->last_bit >= valuator && BitIsOn(mask->mask, valuator); +} + +/** + * Set the valuator to the given data. + */ +void +valuator_mask_set(ValuatorMask *mask, int valuator, int data) +{ + mask->last_bit = max(valuator, mask->last_bit); + SetBit(mask->mask, valuator); + mask->valuators[valuator] = data; +} + +/** + * Return the requested valuator value. If the mask bit is not set for the + * given valuator, the returned value is undefined. + */ +int +valuator_mask_get(const ValuatorMask *mask, int valuator) +{ + return mask->valuators[valuator]; +} + +/** + * Remove the valuator from the mask. + */ +void +valuator_mask_unset(ValuatorMask *mask, int valuator) +{ + if (mask->last_bit >= valuator) { + int i, lastbit = -1; + + ClearBit(mask->mask, valuator); + mask->valuators[valuator] = 0; + + for (i = 0; i <= mask->last_bit; i++) + if (valuator_mask_isset(mask, i)) + lastbit = max(lastbit, i); + mask->last_bit = lastbit; + } +} + +void +valuator_mask_copy(ValuatorMask *dest, const ValuatorMask *src) +{ + if (src) + memcpy(dest, src, sizeof(*dest)); + else + valuator_mask_zero(dest); +} + +int +CountBits(const uint8_t *mask, int len) +{ + int i; + int ret = 0; + + for (i = 0; i < len; i++) + if (BitIsOn(mask, i)) + ret++; + + return ret; +} diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c index bec68753e..26d2c72aa 100644 --- a/xorg-server/dix/resource.c +++ b/xorg-server/dix/resource.c @@ -1,973 +1,965 @@ -/************************************************************ - -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. - -********************************************************/ -/* The panoramix components contained the following notice */ -/***************************************************************** - -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. - -******************************************************************/ -/* XSERVER_DTRACE additions: - * Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/* Routines to manage various kinds of resources: - * - * CreateNewResourceType, CreateNewResourceClass, InitClientResources, - * FakeClientID, AddResource, FreeResource, FreeClientResources, - * FreeAllResources, LookupIDByType, LookupIDByClass, GetXIDRange - */ - -/* - * A resource ID is a 32 bit quantity, the upper 2 bits of which are - * off-limits for client-visible resources. The next 8 bits are - * used as client ID, and the low 22 bits come from the client. - * A resource ID is "hashed" by extracting and xoring subfields - * (varying with the size of the hash table). - * - * It is sometimes necessary for the server to create an ID that looks - * like it belongs to a client. This ID, however, must not be one - * the client actually can create, or we have the potential for conflict. - * The 31st bit of the ID is reserved for the server's use for this - * purpose. By setting CLIENT_ID(id) to the client, the SERVER_BIT to - * 1, and an otherwise arbitrary ID in the low 22 bits, we can create a - * resource "owned" by the client. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include "misc.h" -#include "os.h" -#include "resource.h" -#include "dixstruct.h" -#include "opaque.h" -#include "windowstr.h" -#include "dixfont.h" -#include "colormap.h" -#include "inputstr.h" -#include "dixevents.h" -#include "dixgrabs.h" -#include "cursor.h" -#ifdef PANORAMIX -#include "panoramiX.h" -#include "panoramiXsrv.h" -#endif -#include "xace.h" -#include -#include "registry.h" - -#ifdef XSERVER_DTRACE -#include -typedef const char *string; -#include "Xserver-dtrace.h" - -#define TypeNameString(t) LookupResourceName(t) -#endif - -static void RebuildTable( - int /*client*/ -); - -#define SERVER_MINID 32 - -#define INITBUCKETS 64 -#define INITHASHSIZE 6 -#define MAXHASHSIZE 11 - -typedef struct _Resource { - struct _Resource *next; - XID id; - RESTYPE type; - pointer value; -} ResourceRec, *ResourcePtr; -#define NullResource ((ResourcePtr)NULL) - -typedef struct _ClientResource { - ResourcePtr *resources; - int elements; - int buckets; - int hashsize; /* log(2)(buckets) */ - XID fakeID; - XID endFakeID; - XID expectID; -} ClientResourceRec; - -RESTYPE lastResourceType; -static RESTYPE lastResourceClass; -RESTYPE TypeMask; - -struct ResourceType { - DeleteType deleteFunc; - int errorValue; -}; - -static struct ResourceType *resourceTypes; -static const struct ResourceType predefTypes[] = { - [RT_NONE & (RC_LASTPREDEF - 1)] = { - .deleteFunc = (DeleteType)NoopDDA, - .errorValue = BadValue, - }, - [RT_WINDOW & (RC_LASTPREDEF - 1)] = { - .deleteFunc = DeleteWindow, - .errorValue = BadWindow, - }, - [RT_PIXMAP & (RC_LASTPREDEF - 1)] = { - .deleteFunc = dixDestroyPixmap, - .errorValue = BadPixmap, - }, - [RT_GC & (RC_LASTPREDEF - 1)] = { - .deleteFunc = FreeGC, - .errorValue = BadGC, - }, - [RT_FONT & (RC_LASTPREDEF - 1)] = { - .deleteFunc = CloseFont, - .errorValue = BadFont, - }, - [RT_CURSOR & (RC_LASTPREDEF - 1)] = { - .deleteFunc = FreeCursor, - .errorValue = BadCursor, - }, - [RT_COLORMAP & (RC_LASTPREDEF - 1)] = { - .deleteFunc = FreeColormap, - .errorValue = BadColor, - }, - [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = { - .deleteFunc = FreeClientPixels, - .errorValue = BadColor, - }, - [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = { - .deleteFunc = OtherClientGone, - .errorValue = BadValue, - }, - [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = { - .deleteFunc = DeletePassiveGrab, - .errorValue = BadValue, - }, -}; - -CallbackListPtr ResourceStateCallback; - -static _X_INLINE void -CallResourceStateCallback(ResourceState state, ResourceRec *res) -{ - if (ResourceStateCallback) { - ResourceStateInfoRec rsi = { state, res->id, res->type, res->value }; - CallCallbacks(&ResourceStateCallback, &rsi); - } -} - -RESTYPE -CreateNewResourceType(DeleteType deleteFunc, char *name) -{ - RESTYPE next = lastResourceType + 1; - struct ResourceType *types; - - if (next & lastResourceClass) - return 0; - types = realloc(resourceTypes, (next + 1) * sizeof(*resourceTypes)); - if (!types) - return 0; - - lastResourceType = next; - resourceTypes = types; - resourceTypes[next].deleteFunc = deleteFunc; - resourceTypes[next].errorValue = BadValue; - - /* Called even if name is NULL, to remove any previous entry */ - RegisterResourceName(next, name); - - return next; -} - -void -SetResourceTypeErrorValue(RESTYPE type, int errorValue) -{ - resourceTypes[type & TypeMask].errorValue = errorValue; -} - -RESTYPE -CreateNewResourceClass(void) -{ - RESTYPE next = lastResourceClass >> 1; - - if (next & lastResourceType) - return 0; - lastResourceClass = next; - TypeMask = next - 1; - return next; -} - -static ClientResourceRec clientTable[MAXCLIENTS]; - -/***************** - * InitClientResources - * When a new client is created, call this to allocate space - * in resource table - *****************/ - -Bool -InitClientResources(ClientPtr client) -{ - int i, j; - - if (client == serverClient) - { - lastResourceType = RT_LASTPREDEF; - lastResourceClass = RC_LASTPREDEF; - TypeMask = RC_LASTPREDEF - 1; - free(resourceTypes); - resourceTypes = malloc(sizeof(predefTypes)); - if (!resourceTypes) - return FALSE; - memcpy(resourceTypes, predefTypes, sizeof(predefTypes)); - } - clientTable[i = client->index].resources = - malloc(INITBUCKETS*sizeof(ResourcePtr)); - if (!clientTable[i].resources) - return FALSE; - clientTable[i].buckets = INITBUCKETS; - clientTable[i].elements = 0; - clientTable[i].hashsize = INITHASHSIZE; - /* Many IDs allocated from the server client are visible to clients, - * so we don't use the SERVER_BIT for them, but we have to start - * past the magic value constants used in the protocol. For normal - * clients, we can start from zero, with SERVER_BIT set. - */ - clientTable[i].fakeID = client->clientAsMask | - (client->index ? SERVER_BIT : SERVER_MINID); - clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1; - clientTable[i].expectID = client->clientAsMask; - for (j=0; j>6) ^ (id>>12)))); - case 7: - return ((int)(0x07F & (id ^ (id>>7) ^ (id>>13)))); - case 8: - return ((int)(0x0FF & (id ^ (id>>8) ^ (id>>16)))); - case 9: - return ((int)(0x1FF & (id ^ (id>>9)))); - case 10: - return ((int)(0x3FF & (id ^ (id>>10)))); - case 11: - return ((int)(0x7FF & (id ^ (id>>11)))); - } - return -1; -} - -static XID -AvailableID( - int client, - XID id, - XID maxid, - XID goodid) -{ - ResourcePtr res; - - if ((goodid >= id) && (goodid <= maxid)) - return goodid; - for (; id <= maxid; id++) - { - res = clientTable[client].resources[Hash(client, id)]; - while (res && (res->id != id)) - res = res->next; - if (!res) - return id; - } - return 0; -} - -void -GetXIDRange(int client, Bool server, XID *minp, XID *maxp) -{ - XID id, maxid; - ResourcePtr *resp; - ResourcePtr res; - int i; - XID goodid; - - id = (Mask)client << CLIENTOFFSET; - if (server) - id |= client ? SERVER_BIT : SERVER_MINID; - maxid = id | RESOURCE_ID_MASK; - goodid = 0; - for (resp = clientTable[client].resources, i = clientTable[client].buckets; - --i >= 0;) - { - for (res = *resp++; res; res = res->next) - { - if ((res->id < id) || (res->id > maxid)) - continue; - if (((res->id - id) >= (maxid - res->id)) ? - (goodid = AvailableID(client, id, res->id - 1, goodid)) : - !(goodid = AvailableID(client, res->id + 1, maxid, goodid))) - maxid = res->id - 1; - else - id = res->id + 1; - } - } - if (id > maxid) - id = maxid = 0; - *minp = id; - *maxp = maxid; -} - -/** - * GetXIDList is called by the XC-MISC extension's MiscGetXIDList function. - * This function tries to find count unused XIDs for the given client. It - * puts the IDs in the array pids and returns the number found, which should - * almost always be the number requested. - * - * The circumstances that lead to a call to this function are very rare. - * Xlib must run out of IDs while trying to generate a request that wants - * multiple ID's, like the Multi-buffering CreateImageBuffers request. - * - * No rocket science in the implementation; just iterate over all - * possible IDs for the given client and pick the first count IDs - * that aren't in use. A more efficient algorithm could probably be - * invented, but this will be used so rarely that this should suffice. - */ - -unsigned int -GetXIDList(ClientPtr pClient, unsigned count, XID *pids) -{ - unsigned int found = 0; - XID rc, id = pClient->clientAsMask; - XID maxid; - pointer val; - - maxid = id | RESOURCE_ID_MASK; - while ( (found < count) && (id <= maxid) ) - { - rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, - DixGetAttrAccess); - if (rc == BadValue) - { - pids[found++] = id; - } - id++; - } - return found; -} - -/* - * Return the next usable fake client ID. - * - * Normally this is just the next one in line, but if we've used the last - * in the range, we need to find a new range of safe IDs to avoid - * over-running another client. - */ - -XID -FakeClientID(int client) -{ - XID id, maxid; - - id = clientTable[client].fakeID++; - if (id != clientTable[client].endFakeID) - return id; - GetXIDRange(client, TRUE, &id, &maxid); - if (!id) { - if (!client) - FatalError("FakeClientID: server internal ids exhausted\n"); - MarkClientException(clients[client]); - id = ((Mask)client << CLIENTOFFSET) | (SERVER_BIT * 3); - maxid = id | RESOURCE_ID_MASK; - } - clientTable[client].fakeID = id + 1; - clientTable[client].endFakeID = maxid + 1; - return id; -} - -Bool -AddResource(XID id, RESTYPE type, pointer value) -{ - int client; - ClientResourceRec *rrec; - ResourcePtr res, *head; - -#ifdef XSERVER_DTRACE - XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type)); -#endif - client = CLIENT_ID(id); - rrec = &clientTable[client]; - if (!rrec->buckets) - { - ErrorF("[dix] AddResource(%lx, %lx, %lx), client=%d \n", - (unsigned long)id, type, (unsigned long)value, client); - FatalError("client not in use\n"); - } - if ((rrec->elements >= 4*rrec->buckets) && - (rrec->hashsize < MAXHASHSIZE)) - RebuildTable(client); - head = &rrec->resources[Hash(client, id)]; - res = malloc(sizeof(ResourceRec)); - if (!res) - { - (*resourceTypes[type & TypeMask].deleteFunc)(value, id); - return FALSE; - } - res->next = *head; - res->id = id; - res->type = type; - res->value = value; - *head = res; - rrec->elements++; - if (!(id & SERVER_BIT) && (id >= rrec->expectID)) - rrec->expectID = id + 1; - CallResourceStateCallback(ResourceStateAdding, res); - return TRUE; -} - -static void -RebuildTable(int client) -{ - int j; - ResourcePtr res, next; - ResourcePtr **tails, *resources; - ResourcePtr **tptr, *rptr; - - /* - * For now, preserve insertion order, since some ddx layers depend - * on resources being free in the opposite order they are added. - */ - - j = 2 * clientTable[client].buckets; - tails = malloc(j * sizeof(ResourcePtr *)); - if (!tails) - return; - resources = malloc(j * sizeof(ResourcePtr)); - if (!resources) - { - free(tails); - return; - } - for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) - { - *rptr = NullResource; - *tptr = rptr; - } - clientTable[client].hashsize++; - for (j = clientTable[client].buckets, - rptr = clientTable[client].resources; - --j >= 0; - rptr++) - { - for (res = *rptr; res; res = next) - { - next = res->next; - res->next = NullResource; - tptr = &tails[Hash(client, res->id)]; - **tptr = res; - *tptr = &res->next; - } - } - free(tails); - clientTable[client].buckets *= 2; - free(clientTable[client].resources); - clientTable[client].resources = resources; -} - -void -FreeResource(XID id, RESTYPE skipDeleteFuncType) -{ - int cid; - ResourcePtr res; - ResourcePtr *prev, *head; - int *eltptr; - int elements; - - if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) - { - head = &clientTable[cid].resources[Hash(cid, id)]; - eltptr = &clientTable[cid].elements; - - prev = head; - while ( (res = *prev) ) - { - if (res->id == id) - { - RESTYPE rtype = res->type; - -#ifdef XSERVER_DTRACE - XSERVER_RESOURCE_FREE(res->id, res->type, - res->value, TypeNameString(res->type)); -#endif - *prev = res->next; - elements = --*eltptr; - - CallResourceStateCallback(ResourceStateFreeing, res); - - if (rtype != skipDeleteFuncType) - (*resourceTypes[rtype & TypeMask].deleteFunc)(res->value, res->id); - free(res); - if (*eltptr != elements) - prev = head; /* prev may no longer be valid */ - } - else - prev = &res->next; - } - } -} - - -void -FreeResourceByType(XID id, RESTYPE type, Bool skipFree) -{ - int cid; - ResourcePtr res; - ResourcePtr *prev, *head; - if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) - { - head = &clientTable[cid].resources[Hash(cid, id)]; - - prev = head; - while ( (res = *prev) ) - { - if (res->id == id && res->type == type) - { -#ifdef XSERVER_DTRACE - XSERVER_RESOURCE_FREE(res->id, res->type, - res->value, TypeNameString(res->type)); -#endif - *prev = res->next; - clientTable[cid].elements--; - - CallResourceStateCallback(ResourceStateFreeing, res); - - if (!skipFree) - (*resourceTypes[type & TypeMask].deleteFunc)(res->value, res->id); - free(res); - break; - } - else - prev = &res->next; - } - } -} - -/* - * Change the value associated with a resource id. Caller - * is responsible for "doing the right thing" with the old - * data - */ - -Bool -ChangeResourceValue (XID id, RESTYPE rtype, pointer value) -{ - int cid; - ResourcePtr res; - - if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) - { - res = clientTable[cid].resources[Hash(cid, id)]; - - for (; res; res = res->next) - if ((res->id == id) && (res->type == rtype)) - { - res->value = value; - return TRUE; - } - } - return FALSE; -} - -/* Note: if func adds or deletes resources, then func can get called - * more than once for some resources. If func adds new resources, - * func might or might not get called for them. func cannot both - * add and delete an equal number of resources! - */ - -void -FindClientResourcesByType( - ClientPtr client, - RESTYPE type, - FindResType func, - pointer cdata -){ - ResourcePtr *resources; - ResourcePtr this, next; - int i, elements; - int *eltptr; - - if (!client) - client = serverClient; - - resources = clientTable[client->index].resources; - eltptr = &clientTable[client->index].elements; - for (i = 0; i < clientTable[client->index].buckets; i++) - { - for (this = resources[i]; this; this = next) - { - next = this->next; - if (!type || this->type == type) { - elements = *eltptr; - (*func)(this->value, this->id, cdata); - if (*eltptr != elements) - next = resources[i]; /* start over */ - } - } - } -} - -void -FindAllClientResources( - ClientPtr client, - FindAllRes func, - pointer cdata -){ - ResourcePtr *resources; - ResourcePtr this, next; - int i, elements; - int *eltptr; - - if (!client) - client = serverClient; - - resources = clientTable[client->index].resources; - eltptr = &clientTable[client->index].elements; - for (i = 0; i < clientTable[client->index].buckets; i++) - { - for (this = resources[i]; this; this = next) - { - next = this->next; - elements = *eltptr; - (*func)(this->value, this->id, this->type, cdata); - if (*eltptr != elements) - next = resources[i]; /* start over */ - } - } -} - - -pointer -LookupClientResourceComplex( - ClientPtr client, - RESTYPE type, - FindComplexResType func, - pointer cdata -){ - ResourcePtr *resources; - ResourcePtr this, next; - pointer value; - int i; - - if (!client) - client = serverClient; - - resources = clientTable[client->index].resources; - for (i = 0; i < clientTable[client->index].buckets; i++) { - for (this = resources[i]; this; this = next) { - next = this->next; - if (!type || this->type == type) { - /* workaround func freeing the type as DRI1 does */ - value = this->value; - if((*func)(value, this->id, cdata)) - return value; - } - } - } - return NULL; -} - - -void -FreeClientNeverRetainResources(ClientPtr client) -{ - ResourcePtr *resources; - ResourcePtr this; - ResourcePtr *prev; - int j, elements; - int *eltptr; - - if (!client) - return; - - resources = clientTable[client->index].resources; - eltptr = &clientTable[client->index].elements; - for (j=0; j < clientTable[client->index].buckets; j++) - { - prev = &resources[j]; - while ( (this = *prev) ) - { - RESTYPE rtype = this->type; - if (rtype & RC_NEVERRETAIN) - { -#ifdef XSERVER_DTRACE - XSERVER_RESOURCE_FREE(this->id, this->type, - this->value, TypeNameString(this->type)); -#endif - *prev = this->next; - clientTable[client->index].elements--; - - CallResourceStateCallback(ResourceStateFreeing, this); - - elements = *eltptr; - (*resourceTypes[rtype & TypeMask].deleteFunc)(this->value, this->id); - free(this); - if (*eltptr != elements) - prev = &resources[j]; /* prev may no longer be valid */ - } - else - prev = &this->next; - } - } -} - -void -FreeClientResources(ClientPtr client) -{ - ResourcePtr *resources; - ResourcePtr this; - int j; - - /* This routine shouldn't be called with a null client, but just in - case ... */ - - if (!client) - return; - - HandleSaveSet(client); - - resources = clientTable[client->index].resources; - for (j=0; j < clientTable[client->index].buckets; j++) - { - /* It may seem silly to update the head of this resource list as - we delete the members, since the entire list will be deleted any way, - but there are some resource deletion functions "FreeClientPixels" for - one which do a LookupID on another resource id (a Colormap id in this - case), so the resource list must be kept valid up to the point that - it is deleted, so every time we delete a resource, we must update the - head, just like in FreeResource. I hope that this doesn't slow down - mass deletion appreciably. PRH */ - - ResourcePtr *head; - - head = &resources[j]; - - for (this = *head; this; this = *head) - { - RESTYPE rtype = this->type; -#ifdef XSERVER_DTRACE - XSERVER_RESOURCE_FREE(this->id, this->type, - this->value, TypeNameString(this->type)); -#endif - *head = this->next; - clientTable[client->index].elements--; - - CallResourceStateCallback(ResourceStateFreeing, this); - - (*resourceTypes[rtype & TypeMask].deleteFunc)(this->value, this->id); - free(this); - } - } - free(clientTable[client->index].resources); - clientTable[client->index].resources = NULL; - clientTable[client->index].buckets = 0; -} - -void -FreeAllResources(void) -{ - int i; - - for (i = currentMaxClients; --i >= 0; ) - { - if (clientTable[i].buckets) - FreeClientResources(clients[i]); - } -} - -Bool -LegalNewID(XID id, ClientPtr client) -{ - pointer val; - int rc; - -#ifdef PANORAMIX - XID minid, maxid; - - if (!noPanoramiXExtension) { - minid = client->clientAsMask | (client->index ? - SERVER_BIT : SERVER_MINID); - maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1; - if ((id >= minid) && (id <= maxid)) - return TRUE; - } -#endif /* PANORAMIX */ - if (client->clientAsMask == (id & ~RESOURCE_ID_MASK)) - { - if (clientTable[client->index].expectID <= id) - return TRUE; - - rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, - DixGetAttrAccess); - return rc == BadValue; - } - return FALSE; -} - -int -dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype, - ClientPtr client, Mask mode) -{ - int cid = CLIENT_ID(id); - ResourcePtr res = NULL; - - *result = NULL; - if ((rtype & TypeMask) > lastResourceType) - return BadImplementation; - - if ((cid < MAXCLIENTS) && clientTable[cid].buckets) { - res = clientTable[cid].resources[Hash(cid, id)]; - - for (; res; res = res->next) - if (res->id == id && res->type == rtype) - break; - } - if (!res) - return resourceTypes[rtype & TypeMask].errorValue; - - if (client) { - client->errorValue = id; - cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, - res->value, RT_NONE, NULL, mode); - if (cid == BadValue) - return resourceTypes[rtype & TypeMask].errorValue; - if (cid != Success) - return cid; - } - - *result = res->value; - return Success; -} - -int -dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass, - ClientPtr client, Mask mode) -{ - int cid = CLIENT_ID(id); - ResourcePtr res = NULL; - - *result = NULL; - - if ((cid < MAXCLIENTS) && clientTable[cid].buckets) { - res = clientTable[cid].resources[Hash(cid, id)]; - - for (; res; res = res->next) - if (res->id == id && (res->type & rclass)) - break; - } - if (!res) - return BadValue; - - if (client) { - client->errorValue = id; - cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, - res->value, RT_NONE, NULL, mode); - if (cid != Success) - return cid; - } - - *result = res->value; - return Success; -} +/************************************************************ + +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. + +********************************************************/ +/* The panoramix components contained the following notice */ +/***************************************************************** + +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. + +******************************************************************/ +/* XSERVER_DTRACE additions: + * Copyright (c) 2005-2006, Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* Routines to manage various kinds of resources: + * + * CreateNewResourceType, CreateNewResourceClass, InitClientResources, + * FakeClientID, AddResource, FreeResource, FreeClientResources, + * FreeAllResources, LookupIDByType, LookupIDByClass, GetXIDRange + */ + +/* + * A resource ID is a 32 bit quantity, the upper 2 bits of which are + * off-limits for client-visible resources. The next 8 bits are + * used as client ID, and the low 22 bits come from the client. + * A resource ID is "hashed" by extracting and xoring subfields + * (varying with the size of the hash table). + * + * It is sometimes necessary for the server to create an ID that looks + * like it belongs to a client. This ID, however, must not be one + * the client actually can create, or we have the potential for conflict. + * The 31st bit of the ID is reserved for the server's use for this + * purpose. By setting CLIENT_ID(id) to the client, the SERVER_BIT to + * 1, and an otherwise arbitrary ID in the low 22 bits, we can create a + * resource "owned" by the client. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include "misc.h" +#include "os.h" +#include "resource.h" +#include "dixstruct.h" +#include "opaque.h" +#include "windowstr.h" +#include "dixfont.h" +#include "colormap.h" +#include "inputstr.h" +#include "dixevents.h" +#include "dixgrabs.h" +#include "cursor.h" +#ifdef PANORAMIX +#include "panoramiX.h" +#include "panoramiXsrv.h" +#endif +#include "xace.h" +#include +#include "registry.h" + +#ifdef XSERVER_DTRACE +#include +typedef const char *string; +#include "Xserver-dtrace.h" + +#define TypeNameString(t) LookupResourceName(t) +#endif + +static void RebuildTable( + int /*client*/ +); + +#define SERVER_MINID 32 + +#define INITBUCKETS 64 +#define INITHASHSIZE 6 +#define MAXHASHSIZE 11 + +typedef struct _Resource { + struct _Resource *next; + XID id; + RESTYPE type; + pointer value; +} ResourceRec, *ResourcePtr; + +typedef struct _ClientResource { + ResourcePtr *resources; + int elements; + int buckets; + int hashsize; /* log(2)(buckets) */ + XID fakeID; + XID endFakeID; +} ClientResourceRec; + +RESTYPE lastResourceType; +static RESTYPE lastResourceClass; +RESTYPE TypeMask; + +struct ResourceType { + DeleteType deleteFunc; + int errorValue; +}; + +static struct ResourceType *resourceTypes; +static const struct ResourceType predefTypes[] = { + [RT_NONE & (RC_LASTPREDEF - 1)] = { + .deleteFunc = (DeleteType)NoopDDA, + .errorValue = BadValue, + }, + [RT_WINDOW & (RC_LASTPREDEF - 1)] = { + .deleteFunc = DeleteWindow, + .errorValue = BadWindow, + }, + [RT_PIXMAP & (RC_LASTPREDEF - 1)] = { + .deleteFunc = dixDestroyPixmap, + .errorValue = BadPixmap, + }, + [RT_GC & (RC_LASTPREDEF - 1)] = { + .deleteFunc = FreeGC, + .errorValue = BadGC, + }, + [RT_FONT & (RC_LASTPREDEF - 1)] = { + .deleteFunc = CloseFont, + .errorValue = BadFont, + }, + [RT_CURSOR & (RC_LASTPREDEF - 1)] = { + .deleteFunc = FreeCursor, + .errorValue = BadCursor, + }, + [RT_COLORMAP & (RC_LASTPREDEF - 1)] = { + .deleteFunc = FreeColormap, + .errorValue = BadColor, + }, + [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = { + .deleteFunc = FreeClientPixels, + .errorValue = BadColor, + }, + [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = { + .deleteFunc = OtherClientGone, + .errorValue = BadValue, + }, + [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = { + .deleteFunc = DeletePassiveGrab, + .errorValue = BadValue, + }, +}; + +CallbackListPtr ResourceStateCallback; + +static _X_INLINE void +CallResourceStateCallback(ResourceState state, ResourceRec *res) +{ + if (ResourceStateCallback) { + ResourceStateInfoRec rsi = { state, res->id, res->type, res->value }; + CallCallbacks(&ResourceStateCallback, &rsi); + } +} + +RESTYPE +CreateNewResourceType(DeleteType deleteFunc, char *name) +{ + RESTYPE next = lastResourceType + 1; + struct ResourceType *types; + + if (next & lastResourceClass) + return 0; + types = realloc(resourceTypes, (next + 1) * sizeof(*resourceTypes)); + if (!types) + return 0; + + lastResourceType = next; + resourceTypes = types; + resourceTypes[next].deleteFunc = deleteFunc; + resourceTypes[next].errorValue = BadValue; + + /* Called even if name is NULL, to remove any previous entry */ + RegisterResourceName(next, name); + + return next; +} + +void +SetResourceTypeErrorValue(RESTYPE type, int errorValue) +{ + resourceTypes[type & TypeMask].errorValue = errorValue; +} + +RESTYPE +CreateNewResourceClass(void) +{ + RESTYPE next = lastResourceClass >> 1; + + if (next & lastResourceType) + return 0; + lastResourceClass = next; + TypeMask = next - 1; + return next; +} + +static ClientResourceRec clientTable[MAXCLIENTS]; + +/***************** + * InitClientResources + * When a new client is created, call this to allocate space + * in resource table + *****************/ + +Bool +InitClientResources(ClientPtr client) +{ + int i, j; + + if (client == serverClient) + { + lastResourceType = RT_LASTPREDEF; + lastResourceClass = RC_LASTPREDEF; + TypeMask = RC_LASTPREDEF - 1; + free(resourceTypes); + resourceTypes = malloc(sizeof(predefTypes)); + if (!resourceTypes) + return FALSE; + memcpy(resourceTypes, predefTypes, sizeof(predefTypes)); + } + clientTable[i = client->index].resources = + malloc(INITBUCKETS*sizeof(ResourcePtr)); + if (!clientTable[i].resources) + return FALSE; + clientTable[i].buckets = INITBUCKETS; + clientTable[i].elements = 0; + clientTable[i].hashsize = INITHASHSIZE; + /* Many IDs allocated from the server client are visible to clients, + * so we don't use the SERVER_BIT for them, but we have to start + * past the magic value constants used in the protocol. For normal + * clients, we can start from zero, with SERVER_BIT set. + */ + clientTable[i].fakeID = client->clientAsMask | + (client->index ? SERVER_BIT : SERVER_MINID); + clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1; + for (j=0; j>6) ^ (id>>12)))); + case 7: + return ((int)(0x07F & (id ^ (id>>7) ^ (id>>13)))); + case 8: + return ((int)(0x0FF & (id ^ (id>>8) ^ (id>>16)))); + case 9: + return ((int)(0x1FF & (id ^ (id>>9)))); + case 10: + return ((int)(0x3FF & (id ^ (id>>10)))); + case 11: + return ((int)(0x7FF & (id ^ (id>>11)))); + } + return -1; +} + +static XID +AvailableID( + int client, + XID id, + XID maxid, + XID goodid) +{ + ResourcePtr res; + + if ((goodid >= id) && (goodid <= maxid)) + return goodid; + for (; id <= maxid; id++) + { + res = clientTable[client].resources[Hash(client, id)]; + while (res && (res->id != id)) + res = res->next; + if (!res) + return id; + } + return 0; +} + +void +GetXIDRange(int client, Bool server, XID *minp, XID *maxp) +{ + XID id, maxid; + ResourcePtr *resp; + ResourcePtr res; + int i; + XID goodid; + + id = (Mask)client << CLIENTOFFSET; + if (server) + id |= client ? SERVER_BIT : SERVER_MINID; + maxid = id | RESOURCE_ID_MASK; + goodid = 0; + for (resp = clientTable[client].resources, i = clientTable[client].buckets; + --i >= 0;) + { + for (res = *resp++; res; res = res->next) + { + if ((res->id < id) || (res->id > maxid)) + continue; + if (((res->id - id) >= (maxid - res->id)) ? + (goodid = AvailableID(client, id, res->id - 1, goodid)) : + !(goodid = AvailableID(client, res->id + 1, maxid, goodid))) + maxid = res->id - 1; + else + id = res->id + 1; + } + } + if (id > maxid) + id = maxid = 0; + *minp = id; + *maxp = maxid; +} + +/** + * GetXIDList is called by the XC-MISC extension's MiscGetXIDList function. + * This function tries to find count unused XIDs for the given client. It + * puts the IDs in the array pids and returns the number found, which should + * almost always be the number requested. + * + * The circumstances that lead to a call to this function are very rare. + * Xlib must run out of IDs while trying to generate a request that wants + * multiple ID's, like the Multi-buffering CreateImageBuffers request. + * + * No rocket science in the implementation; just iterate over all + * possible IDs for the given client and pick the first count IDs + * that aren't in use. A more efficient algorithm could probably be + * invented, but this will be used so rarely that this should suffice. + */ + +unsigned int +GetXIDList(ClientPtr pClient, unsigned count, XID *pids) +{ + unsigned int found = 0; + XID rc, id = pClient->clientAsMask; + XID maxid; + pointer val; + + maxid = id | RESOURCE_ID_MASK; + while ( (found < count) && (id <= maxid) ) + { + rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, + DixGetAttrAccess); + if (rc == BadValue) + { + pids[found++] = id; + } + id++; + } + return found; +} + +/* + * Return the next usable fake client ID. + * + * Normally this is just the next one in line, but if we've used the last + * in the range, we need to find a new range of safe IDs to avoid + * over-running another client. + */ + +XID +FakeClientID(int client) +{ + XID id, maxid; + + id = clientTable[client].fakeID++; + if (id != clientTable[client].endFakeID) + return id; + GetXIDRange(client, TRUE, &id, &maxid); + if (!id) { + if (!client) + FatalError("FakeClientID: server internal ids exhausted\n"); + MarkClientException(clients[client]); + id = ((Mask)client << CLIENTOFFSET) | (SERVER_BIT * 3); + maxid = id | RESOURCE_ID_MASK; + } + clientTable[client].fakeID = id + 1; + clientTable[client].endFakeID = maxid + 1; + return id; +} + +Bool +AddResource(XID id, RESTYPE type, pointer value) +{ + int client; + ClientResourceRec *rrec; + ResourcePtr res, *head; + +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type)); +#endif + client = CLIENT_ID(id); + rrec = &clientTable[client]; + if (!rrec->buckets) + { + ErrorF("[dix] AddResource(%lx, %lx, %lx), client=%d \n", + (unsigned long)id, type, (unsigned long)value, client); + FatalError("client not in use\n"); + } + if ((rrec->elements >= 4*rrec->buckets) && + (rrec->hashsize < MAXHASHSIZE)) + RebuildTable(client); + head = &rrec->resources[Hash(client, id)]; + res = malloc(sizeof(ResourceRec)); + if (!res) + { + (*resourceTypes[type & TypeMask].deleteFunc)(value, id); + return FALSE; + } + res->next = *head; + res->id = id; + res->type = type; + res->value = value; + *head = res; + rrec->elements++; + CallResourceStateCallback(ResourceStateAdding, res); + return TRUE; +} + +static void +RebuildTable(int client) +{ + int j; + ResourcePtr res, next; + ResourcePtr **tails, *resources; + ResourcePtr **tptr, *rptr; + + /* + * For now, preserve insertion order, since some ddx layers depend + * on resources being free in the opposite order they are added. + */ + + j = 2 * clientTable[client].buckets; + tails = malloc(j * sizeof(ResourcePtr *)); + if (!tails) + return; + resources = malloc(j * sizeof(ResourcePtr)); + if (!resources) + { + free(tails); + return; + } + for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) + { + *rptr = NULL; + *tptr = rptr; + } + clientTable[client].hashsize++; + for (j = clientTable[client].buckets, + rptr = clientTable[client].resources; + --j >= 0; + rptr++) + { + for (res = *rptr; res; res = next) + { + next = res->next; + res->next = NULL; + tptr = &tails[Hash(client, res->id)]; + **tptr = res; + *tptr = &res->next; + } + } + free(tails); + clientTable[client].buckets *= 2; + free(clientTable[client].resources); + clientTable[client].resources = resources; +} + +void +FreeResource(XID id, RESTYPE skipDeleteFuncType) +{ + int cid; + ResourcePtr res; + ResourcePtr *prev, *head; + int *eltptr; + int elements; + + if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) + { + head = &clientTable[cid].resources[Hash(cid, id)]; + eltptr = &clientTable[cid].elements; + + prev = head; + while ( (res = *prev) ) + { + if (res->id == id) + { + RESTYPE rtype = res->type; + +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_FREE(res->id, res->type, + res->value, TypeNameString(res->type)); +#endif + *prev = res->next; + elements = --*eltptr; + + CallResourceStateCallback(ResourceStateFreeing, res); + + if (rtype != skipDeleteFuncType) + (*resourceTypes[rtype & TypeMask].deleteFunc)(res->value, res->id); + free(res); + if (*eltptr != elements) + prev = head; /* prev may no longer be valid */ + } + else + prev = &res->next; + } + } +} + + +void +FreeResourceByType(XID id, RESTYPE type, Bool skipFree) +{ + int cid; + ResourcePtr res; + ResourcePtr *prev, *head; + if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) + { + head = &clientTable[cid].resources[Hash(cid, id)]; + + prev = head; + while ( (res = *prev) ) + { + if (res->id == id && res->type == type) + { +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_FREE(res->id, res->type, + res->value, TypeNameString(res->type)); +#endif + *prev = res->next; + clientTable[cid].elements--; + + CallResourceStateCallback(ResourceStateFreeing, res); + + if (!skipFree) + (*resourceTypes[type & TypeMask].deleteFunc)(res->value, res->id); + free(res); + break; + } + else + prev = &res->next; + } + } +} + +/* + * Change the value associated with a resource id. Caller + * is responsible for "doing the right thing" with the old + * data + */ + +Bool +ChangeResourceValue (XID id, RESTYPE rtype, pointer value) +{ + int cid; + ResourcePtr res; + + if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) + { + res = clientTable[cid].resources[Hash(cid, id)]; + + for (; res; res = res->next) + if ((res->id == id) && (res->type == rtype)) + { + res->value = value; + return TRUE; + } + } + return FALSE; +} + +/* Note: if func adds or deletes resources, then func can get called + * more than once for some resources. If func adds new resources, + * func might or might not get called for them. func cannot both + * add and delete an equal number of resources! + */ + +void +FindClientResourcesByType( + ClientPtr client, + RESTYPE type, + FindResType func, + pointer cdata +){ + ResourcePtr *resources; + ResourcePtr this, next; + int i, elements; + int *eltptr; + + if (!client) + client = serverClient; + + resources = clientTable[client->index].resources; + eltptr = &clientTable[client->index].elements; + for (i = 0; i < clientTable[client->index].buckets; i++) + { + for (this = resources[i]; this; this = next) + { + next = this->next; + if (!type || this->type == type) { + elements = *eltptr; + (*func)(this->value, this->id, cdata); + if (*eltptr != elements) + next = resources[i]; /* start over */ + } + } + } +} + +void +FindAllClientResources( + ClientPtr client, + FindAllRes func, + pointer cdata +){ + ResourcePtr *resources; + ResourcePtr this, next; + int i, elements; + int *eltptr; + + if (!client) + client = serverClient; + + resources = clientTable[client->index].resources; + eltptr = &clientTable[client->index].elements; + for (i = 0; i < clientTable[client->index].buckets; i++) + { + for (this = resources[i]; this; this = next) + { + next = this->next; + elements = *eltptr; + (*func)(this->value, this->id, this->type, cdata); + if (*eltptr != elements) + next = resources[i]; /* start over */ + } + } +} + + +pointer +LookupClientResourceComplex( + ClientPtr client, + RESTYPE type, + FindComplexResType func, + pointer cdata +){ + ResourcePtr *resources; + ResourcePtr this, next; + pointer value; + int i; + + if (!client) + client = serverClient; + + resources = clientTable[client->index].resources; + for (i = 0; i < clientTable[client->index].buckets; i++) { + for (this = resources[i]; this; this = next) { + next = this->next; + if (!type || this->type == type) { + /* workaround func freeing the type as DRI1 does */ + value = this->value; + if((*func)(value, this->id, cdata)) + return value; + } + } + } + return NULL; +} + + +void +FreeClientNeverRetainResources(ClientPtr client) +{ + ResourcePtr *resources; + ResourcePtr this; + ResourcePtr *prev; + int j, elements; + int *eltptr; + + if (!client) + return; + + resources = clientTable[client->index].resources; + eltptr = &clientTable[client->index].elements; + for (j=0; j < clientTable[client->index].buckets; j++) + { + prev = &resources[j]; + while ( (this = *prev) ) + { + RESTYPE rtype = this->type; + if (rtype & RC_NEVERRETAIN) + { +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_FREE(this->id, this->type, + this->value, TypeNameString(this->type)); +#endif + *prev = this->next; + clientTable[client->index].elements--; + + CallResourceStateCallback(ResourceStateFreeing, this); + + elements = *eltptr; + (*resourceTypes[rtype & TypeMask].deleteFunc)(this->value, this->id); + free(this); + if (*eltptr != elements) + prev = &resources[j]; /* prev may no longer be valid */ + } + else + prev = &this->next; + } + } +} + +void +FreeClientResources(ClientPtr client) +{ + ResourcePtr *resources; + ResourcePtr this; + int j; + + /* This routine shouldn't be called with a null client, but just in + case ... */ + + if (!client) + return; + + HandleSaveSet(client); + + resources = clientTable[client->index].resources; + for (j=0; j < clientTable[client->index].buckets; j++) + { + /* It may seem silly to update the head of this resource list as + we delete the members, since the entire list will be deleted any way, + but there are some resource deletion functions "FreeClientPixels" for + one which do a LookupID on another resource id (a Colormap id in this + case), so the resource list must be kept valid up to the point that + it is deleted, so every time we delete a resource, we must update the + head, just like in FreeResource. I hope that this doesn't slow down + mass deletion appreciably. PRH */ + + ResourcePtr *head; + + head = &resources[j]; + + for (this = *head; this; this = *head) + { + RESTYPE rtype = this->type; +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_FREE(this->id, this->type, + this->value, TypeNameString(this->type)); +#endif + *head = this->next; + clientTable[client->index].elements--; + + CallResourceStateCallback(ResourceStateFreeing, this); + + (*resourceTypes[rtype & TypeMask].deleteFunc)(this->value, this->id); + free(this); + } + } + free(clientTable[client->index].resources); + clientTable[client->index].resources = NULL; + clientTable[client->index].buckets = 0; +} + +void +FreeAllResources(void) +{ + int i; + + for (i = currentMaxClients; --i >= 0; ) + { + if (clientTable[i].buckets) + FreeClientResources(clients[i]); + } +} + +Bool +LegalNewID(XID id, ClientPtr client) +{ + pointer val; + int rc; + +#ifdef PANORAMIX + XID minid, maxid; + + if (!noPanoramiXExtension) { + minid = client->clientAsMask | (client->index ? + SERVER_BIT : SERVER_MINID); + maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1; + if ((id >= minid) && (id <= maxid)) + return TRUE; + } +#endif /* PANORAMIX */ + if (client->clientAsMask == (id & ~RESOURCE_ID_MASK)) + { + rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, + DixGetAttrAccess); + return rc == BadValue; + } + return FALSE; +} + +int +dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype, + ClientPtr client, Mask mode) +{ + int cid = CLIENT_ID(id); + ResourcePtr res = NULL; + + *result = NULL; + if ((rtype & TypeMask) > lastResourceType) + return BadImplementation; + + if ((cid < MAXCLIENTS) && clientTable[cid].buckets) { + res = clientTable[cid].resources[Hash(cid, id)]; + + for (; res; res = res->next) + if (res->id == id && res->type == rtype) + break; + } + if (!res) + return resourceTypes[rtype & TypeMask].errorValue; + + if (client) { + client->errorValue = id; + cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, + res->value, RT_NONE, NULL, mode); + if (cid == BadValue) + return resourceTypes[rtype & TypeMask].errorValue; + if (cid != Success) + return cid; + } + + *result = res->value; + return Success; +} + +int +dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass, + ClientPtr client, Mask mode) +{ + int cid = CLIENT_ID(id); + ResourcePtr res = NULL; + + *result = NULL; + + if ((cid < MAXCLIENTS) && clientTable[cid].buckets) { + res = clientTable[cid].resources[Hash(cid, id)]; + + for (; res; res = res->next) + if (res->id == id && (res->type & rclass)) + break; + } + if (!res) + return BadValue; + + if (client) { + client->errorValue = id; + cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, + res->value, RT_NONE, NULL, mode); + if (cid != Success) + return cid; + } + + *result = res->value; + return Success; +} diff --git a/xorg-server/hw/dmx/config/xdmxconfig.c b/xorg-server/hw/dmx/config/xdmxconfig.c index 033b52512..c67077aec 100644 --- a/xorg-server/hw/dmx/config/xdmxconfig.c +++ b/xorg-server/hw/dmx/config/xdmxconfig.c @@ -142,7 +142,7 @@ static void dmxConfigGetDims(int *maxWidth, int *maxHeight) DMXConfigEntryPtr e; *maxWidth = dmxConfigWallWidth = 0; - *maxWidth = dmxConfigWallHeight = 0; + *maxHeight = dmxConfigWallHeight = 0; if (!dmxConfigCurrent) return; dmxConfigWallWidth = dmxConfigCurrent->width; diff --git a/xorg-server/hw/dmx/dmxextension.c b/xorg-server/hw/dmx/dmxextension.c index 97f2a04b0..bd326ce2a 100644 --- a/xorg-server/hw/dmx/dmxextension.c +++ b/xorg-server/hw/dmx/dmxextension.c @@ -1,1618 +1,1620 @@ -/* - * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation on the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * Author: - * Rickard E. (Rik) Faith - * Kevin E. Martin - * - */ - -/** \file - * This file provides the only interface to the X server extension support - * in programs/Xserver/Xext. Those programs should only include dmxext.h - */ - -#ifdef HAVE_DMX_CONFIG_H -#include -#endif - -#include - -#include "dmx.h" -#include "dmxinit.h" -#include "dmxextension.h" -#include "dmxwindow.h" -#include "dmxcb.h" -#include "dmxcursor.h" -#include "dmxpixmap.h" -#include "dmxgc.h" -#include "dmxfont.h" -#include "dmxcmap.h" -#include "dmxpict.h" -#include "dmxinput.h" -#include "dmxsync.h" -#include "dmxscrinit.h" -#include "input/dmxinputinit.h" - -#include "windowstr.h" -#include "inputstr.h" /* For DeviceIntRec */ -#include /* For DMX_BAD_* */ -#include "cursorstr.h" - -/* The default font is declared in dix/globals.c, but is not included in - * _any_ header files. */ -extern FontPtr defaultFont; - -/** This routine provides information to the DMX protocol extension - * about a particular screen. */ -Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr) -{ - DMXScreenInfo *dmxScreen; - - if (physical < 0 || physical >= dmxNumScreens) return FALSE; - - dmxScreen = &dmxScreens[physical]; - attr->displayName = dmxScreen->name; -#ifdef PANORAMIX - attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0; -#else - attr->logicalScreen = dmxScreen->index; -#endif - - attr->screenWindowWidth = dmxScreen->scrnWidth; - attr->screenWindowHeight = dmxScreen->scrnHeight; - attr->screenWindowXoffset = dmxScreen->scrnX; - attr->screenWindowYoffset = dmxScreen->scrnY; - - attr->rootWindowWidth = dmxScreen->rootWidth; - attr->rootWindowHeight = dmxScreen->rootHeight; - attr->rootWindowXoffset = dmxScreen->rootX; - attr->rootWindowYoffset = dmxScreen->rootY; - - attr->rootWindowXorigin = dmxScreen->rootXOrigin; - attr->rootWindowYorigin = dmxScreen->rootYOrigin; - - return TRUE; -} - -/** This routine provides information to the DMX protocol extension - * about a particular window. */ -Bool dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr) -{ - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - attr->screen = pWindow->drawable.pScreen->myNum; - attr->window = pWinPriv->window; - - attr->pos.x = pWindow->drawable.x; - attr->pos.y = pWindow->drawable.y; - attr->pos.width = pWindow->drawable.width; - attr->pos.height = pWindow->drawable.height; - - if (!pWinPriv->window || pWinPriv->offscreen) { - attr->vis.x = 0; - attr->vis.y = 0; - attr->vis.height = 0; - attr->vis.width = 0; - return pWinPriv->window ? TRUE : FALSE; - } - - /* Compute display-relative coordinates */ - attr->vis.x = pWindow->drawable.x; - attr->vis.y = pWindow->drawable.y; - attr->vis.width = pWindow->drawable.width; - attr->vis.height = pWindow->drawable.height; - - if (attr->pos.x < 0) { - attr->vis.x -= attr->pos.x; - attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x; - } - if (attr->pos.x + attr->pos.width > pWindow->drawable.pScreen->width) { - if (attr->pos.x < 0) - attr->vis.width = pWindow->drawable.pScreen->width; - else - attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x; - } - if (attr->pos.y < 0) { - attr->vis.y -= attr->pos.y; - attr->vis.height = attr->pos.y + attr->pos.height - attr->vis.y; - } - if (attr->pos.y + attr->pos.height > pWindow->drawable.pScreen->height) { - if (attr->pos.y < 0) - attr->vis.height = pWindow->drawable.pScreen->height; - else - attr->vis.height = pWindow->drawable.pScreen->height - attr->pos.y; - } - - /* Convert to window-relative coordinates */ - attr->vis.x -= attr->pos.x; - attr->vis.y -= attr->pos.y; - - return TRUE; -} - -void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr) -{ - attr->width = dmxGlobalWidth; - attr->height = dmxGlobalHeight; - attr->shiftX = 0; /* NOTE: The upper left hand corner of */ - attr->shiftY = 0; /* the desktop is always <0,0>. */ -} - -/** Return the total number of devices, not just #dmxNumInputs. The - * number returned should be the same as that returned by - * XListInputDevices. */ -int dmxGetInputCount(void) -{ - int i, total; - - for (total = i = 0; i < dmxNumInputs; i++) total += dmxInputs[i].numDevs; - return total; -} - -/** Return information about the device with id = \a deviceId. This - * information is primarily for the #ProcDMXGetInputAttributes() - * function, which does not have access to the appropriate data - * structure. */ -int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr) -{ - int i, j; - DMXInputInfo *dmxInput; - - if (deviceId < 0) return -1; - for (i = 0; i < dmxNumInputs; i++) { - dmxInput = &dmxInputs[i]; - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; - if (deviceId != dmxLocal->pDevice->id) continue; - attr->isCore = !!dmxLocal->isCore; - attr->sendsCore = !!dmxLocal->sendsCore; - attr->detached = !!dmxInput->detached; - attr->physicalScreen = -1; - attr->physicalId = -1; - attr->name = NULL; - switch (dmxLocal->extType) { - case DMX_LOCAL_TYPE_LOCAL: - attr->inputType = 0; - break; - case DMX_LOCAL_TYPE_CONSOLE: - attr->inputType = 1; - attr->name = dmxInput->name; - attr->physicalId = dmxLocal->deviceId; - break; - case DMX_LOCAL_TYPE_BACKEND: - case DMX_LOCAL_TYPE_COMMON: - attr->inputType = 2; - attr->physicalScreen = dmxInput->scrnIdx; - attr->name = dmxInput->name; - attr->physicalId = dmxLocal->deviceId; - break; - } - return 0; /* Success */ - } - } - return -1; /* Failure */ -} - -/** Reinitialized the cursor boundaries. */ -static void dmxAdjustCursorBoundaries(void) -{ - int i; - - dmxReInitOrigins(); - dmxInitOverlap(); - dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX); - dmxConnectionBlockCallback(); - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - if (!dmxInput->detached) dmxInputReInit(dmxInput); - } - - dmxCheckCursor(); - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - if (!dmxInput->detached) dmxInputLateReInit(dmxInput); - } -} - -/** Add an input with the specified attributes. If the input is added, - * the physical id is returned in \a deviceId. */ -int dmxAddInput(DMXInputAttributesPtr attr, int *id) -{ - int retcode = BadValue; - - if (attr->inputType == 1) /* console */ - retcode = dmxInputAttachConsole(attr->name, attr->sendsCore, id); - else if (attr->inputType == 2) /* backend */ - retcode = dmxInputAttachBackend(attr->physicalScreen, - attr->sendsCore,id); - - if (retcode == Success) { - /* Adjust the cursor boundaries */ - dmxAdjustCursorBoundaries(); - - /* Force completion of the changes */ - dmxSync(NULL, TRUE); - } - - return retcode; -} - -/** Remove the input with physical id \a id. */ -int dmxRemoveInput(int id) -{ - return dmxInputDetachId(id); -} - -/** Return the value of #dmxNumScreens -- the total number of backend - * screens in use (these are logical screens and may be larger than the - * number of backend displays). */ -unsigned long dmxGetNumScreens(void) -{ - return dmxNumScreens; -} - -/** Make sure that #dmxCreateAndRealizeWindow has been called for \a - * pWindow. */ -void dmxForceWindowCreation(WindowPtr pWindow) -{ - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - if (!pWinPriv->window) dmxCreateAndRealizeWindow(pWindow, TRUE); -} - -/** Flush pending syncs for all screens. */ -void dmxFlushPendingSyncs(void) -{ - dmxSync(NULL, TRUE); -} - -/** Update DMX's screen resources to match those of the newly moved - * and/or resized "root" window. */ -void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - WindowPtr pRoot = pScreen->root; - WindowPtr pChild; - Bool anyMarked = FALSE; - - /* Handle special case where width and/or height are zero */ - if (w == 0 || h == 0) { - w = 1; - h = 1; - } - - /* Change screen size */ - pScreen->width = w; - pScreen->height = h; - - /* Reset the root window's drawable's size */ - pRoot->drawable.width = w; - pRoot->drawable.height = h; - - /* Set the root window's new winSize and borderSize */ - pRoot->winSize.extents.x1 = 0; - pRoot->winSize.extents.y1 = 0; - pRoot->winSize.extents.x2 = w; - pRoot->winSize.extents.y2 = h; - - pRoot->borderSize.extents.x1 = 0; - pRoot->borderSize.extents.y1 = 0; - pRoot->borderSize.extents.x2 = w; - pRoot->borderSize.extents.y2 = h; - - /* Recompute this screen's mmWidth & mmHeight */ - pScreen->mmWidth = - (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10); - pScreen->mmHeight = - (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10); - - /* Recompute this screen's window's clip rects as follows: */ - /* 1. Mark all of root's children's windows */ - for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) - anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild, - (WindowPtr *)NULL); - - /* 2. Set the root window's borderClip */ - pRoot->borderClip.extents.x1 = 0; - pRoot->borderClip.extents.y1 = 0; - pRoot->borderClip.extents.x2 = w; - pRoot->borderClip.extents.y2 = h; - - /* 3. Set the root window's clipList */ - if (anyMarked) { - /* If any windows have been marked, set the root window's - * clipList to be broken since it will be recalculated in - * ValidateTree() - */ - RegionBreak(&pRoot->clipList); - } else { - /* Otherwise, we just set it directly since there are no - * windows visible on this screen - */ - pRoot->clipList.extents.x1 = 0; - pRoot->clipList.extents.y1 = 0; - pRoot->clipList.extents.x2 = w; - pRoot->clipList.extents.y2 = h; - } - - /* 4. Revalidate all clip rects and generate expose events */ - if (anyMarked) { - pScreen->ValidateTree(pRoot, NULL, VTBroken); - pScreen->HandleExposures(pRoot); - if (pScreen->PostValidateTree) - pScreen->PostValidateTree(pRoot, NULL, VTBroken); - } -} - -#ifdef PANORAMIX -#include "panoramiXsrv.h" - -/** Change the "screen" window attributes by resizing the actual window - * on the back-end display (if necessary). */ -static void dmxConfigureScreenWindow(int idx, - int x, int y, int w, int h) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - ScreenPtr pScreen = screenInfo.screens[idx]; - - /* Resize "screen" window */ - if (dmxScreen->scrnX != x || - dmxScreen->scrnY != y || - dmxScreen->scrnWidth != w || - dmxScreen->scrnHeight != h) { - dmxResizeScreenWindow(pScreen, x, y, w, h); - } - - /* Change "screen" window values */ - dmxScreen->scrnX = x; - dmxScreen->scrnY = y; - dmxScreen->scrnWidth = w; - dmxScreen->scrnHeight = h; -} - -/** Change the "root" window position and size by resizing the actual - * window on the back-end display (if necessary) and updating all of - * DMX's resources by calling #dmxUpdateScreenResources. */ -static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - WindowPtr pRoot = screenInfo.screens[idx]->root; - - /* NOTE: Either this function or the ones that it calls must handle - * the case where w == 0 || h == 0. Currently, the functions that - * this one calls handle that case. */ - - /* 1. Resize "root" window */ - if (dmxScreen->rootX != x || - dmxScreen->rootY != y || - dmxScreen->rootWidth != w || - dmxScreen->rootHeight != h) { - dmxResizeRootWindow(pRoot, x, y, w, h); - } - - /* 2. Update all of the screen's resources associated with this root - * window */ - if (dmxScreen->rootWidth != w || - dmxScreen->rootHeight != h) { - dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h); - } - - /* Change "root" window values */ - dmxScreen->rootX = x; - dmxScreen->rootY = y; - dmxScreen->rootWidth = w; - dmxScreen->rootHeight = h; -} - -/** Change the "root" window's origin by updating DMX's internal data - * structures (dix and Xinerama) to use the new origin and adjust the - * positions of windows that overlap this "root" window. */ -static void dmxSetRootWindowOrigin(int idx, int x, int y) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - ScreenPtr pScreen = screenInfo.screens[idx]; - WindowPtr pRoot = pScreen->root; - WindowPtr pChild; - int xoff; - int yoff; - - /* Change "root" window's origin */ - dmxScreen->rootXOrigin = x; - dmxScreen->rootYOrigin = y; - - /* Compute offsets here in case has been changed above */ - xoff = x - pScreen->x; - yoff = y - pScreen->y; - - /* Adjust the root window's position */ - pScreen->x = dmxScreen->rootXOrigin; - pScreen->y = dmxScreen->rootYOrigin; - - /* Recalculate the Xinerama regions and data structs */ - XineramaReinitData(pScreen); - - /* Adjust each of the root window's children */ - if (!idx) ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff); - pChild = pRoot->firstChild; - while (pChild) { - /* Adjust child window's position */ - pScreen->MoveWindow(pChild, - pChild->origin.x - wBorderWidth(pChild) - xoff, - pChild->origin.y - wBorderWidth(pChild) - yoff, - pChild->nextSib, - VTMove); - - /* Note that the call to MoveWindow will eventually call - * dmxPositionWindow which will automatically create a - * window if it is now exposed on screen (for lazy window - * creation optimization) and it will properly set the - * offscreen flag. - */ - - pChild = pChild->nextSib; - } -} - -/** Configure the attributes of each "screen" and "root" window. */ -int dmxConfigureScreenWindows(int nscreens, - CARD32 *screens, - DMXScreenAttributesPtr attribs, - int *errorScreen) -{ - int i; - - for (i = 0; i < nscreens; i++) { - DMXScreenAttributesPtr attr = &attribs[i]; - int idx = screens[i]; - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - - if (errorScreen) *errorScreen = i; - - if (!dmxScreen->beDisplay) return DMX_BAD_VALUE; - - /* Check for illegal values */ - if (idx < 0 || idx >= dmxNumScreens) return BadValue; - - /* The "screen" and "root" windows must have valid sizes */ - if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 || - attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0) - return DMX_BAD_VALUE; - - /* The "screen" window must fit entirely within the BE display */ - if (attr->screenWindowXoffset < 0 || - attr->screenWindowYoffset < 0 || - attr->screenWindowXoffset - + attr->screenWindowWidth > (unsigned)dmxScreen->beWidth || - attr->screenWindowYoffset - + attr->screenWindowHeight > (unsigned)dmxScreen->beHeight) - return DMX_BAD_VALUE; - - /* The "root" window must fit entirely within the "screen" window */ - if (attr->rootWindowXoffset < 0 || - attr->rootWindowYoffset < 0 || - attr->rootWindowXoffset - + attr->rootWindowWidth > attr->screenWindowWidth || - attr->rootWindowYoffset - + attr->rootWindowHeight > attr->screenWindowHeight) - return DMX_BAD_VALUE; - - /* The "root" window must not expose unaddressable coordinates */ - if (attr->rootWindowXorigin < 0 || - attr->rootWindowYorigin < 0 || - attr->rootWindowXorigin + attr->rootWindowWidth > 32767 || - attr->rootWindowYorigin + attr->rootWindowHeight > 32767) - return DMX_BAD_VALUE; - - /* The "root" window must fit within the global bounding box */ - if (attr->rootWindowXorigin - + attr->rootWindowWidth > (unsigned)dmxGlobalWidth || - attr->rootWindowYorigin - + attr->rootWindowHeight > (unsigned)dmxGlobalHeight) - return DMX_BAD_VALUE; - - /* FIXME: Handle the rest of the illegal value checking */ - } - - /* No illegal values found */ - if (errorScreen) *errorScreen = 0; - - for (i = 0; i < nscreens; i++) { - DMXScreenAttributesPtr attr = &attribs[i]; - int idx = screens[i]; - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - - dmxLog(dmxInfo, "Changing screen #%d attributes " - "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d " - "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n", - idx, - dmxScreen->scrnWidth, dmxScreen->scrnHeight, - dmxScreen->scrnX, dmxScreen->scrnY, - dmxScreen->rootWidth, dmxScreen->rootHeight, - dmxScreen->rootX, dmxScreen->rootY, - dmxScreen->rootXOrigin, dmxScreen->rootYOrigin, - attr->screenWindowWidth, attr->screenWindowHeight, - attr->screenWindowXoffset, attr->screenWindowYoffset, - attr->rootWindowWidth, attr->rootWindowHeight, - attr->rootWindowXoffset, attr->rootWindowYoffset, - attr->rootWindowXorigin, attr->rootWindowYorigin); - - /* Configure "screen" window */ - dmxConfigureScreenWindow(idx, - attr->screenWindowXoffset, - attr->screenWindowYoffset, - attr->screenWindowWidth, - attr->screenWindowHeight); - - /* Configure "root" window */ - dmxConfigureRootWindow(idx, - attr->rootWindowXoffset, - attr->rootWindowYoffset, - attr->rootWindowWidth, - attr->rootWindowHeight); - - - /* Set "root" window's origin */ - dmxSetRootWindowOrigin(idx, - attr->rootWindowXorigin, - attr->rootWindowYorigin); - } - - /* Adjust the cursor boundaries */ - dmxAdjustCursorBoundaries(); - - /* Force completion of the changes */ - dmxSync(NULL, TRUE); - - return Success; -} - -/** Configure the attributes of the global desktop. */ -int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs) -{ - if (attribs->width <= 0 || attribs->width >= 32767 || - attribs->height <= 0 || attribs->height >= 32767) - return DMX_BAD_VALUE; - - /* If the desktop is shrinking, adjust the "root" windows on each - * "screen" window to only show the visible desktop. Also, handle - * the special case where the desktop shrinks such that the it no - * longer overlaps an portion of a "screen" window. */ - if (attribs->width < dmxGlobalWidth || attribs->height < dmxGlobalHeight) { - int i; - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - if (dmxScreen->rootXOrigin - + dmxScreen->rootWidth > attribs->width || - dmxScreen->rootYOrigin - + dmxScreen->rootHeight > attribs->height) { - int w, h; - if ((w = attribs->width - dmxScreen->rootXOrigin) < 0) w = 0; - if ((h = attribs->height - dmxScreen->rootYOrigin) < 0) h = 0; - if (w > dmxScreen->scrnWidth) w = dmxScreen->scrnWidth; - if (h > dmxScreen->scrnHeight) h = dmxScreen->scrnHeight; - if (w > dmxScreen->rootWidth) w = dmxScreen->rootWidth; - if (h > dmxScreen->rootHeight) h = dmxScreen->rootHeight; - dmxConfigureRootWindow(i, - dmxScreen->rootX, - dmxScreen->rootY, - w, h); - } - } - } - - /* Set the global width/height */ - dmxSetWidthHeight(attribs->width, attribs->height); - - /* Handle shift[XY] changes */ - if (attribs->shiftX || attribs->shiftY) { - int i; - for (i = 0; i < dmxNumScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - WindowPtr pChild = pScreen->root->firstChild; - while (pChild) { - /* Adjust child window's position */ - pScreen->MoveWindow(pChild, - pChild->origin.x - wBorderWidth(pChild) - - attribs->shiftX, - pChild->origin.y - wBorderWidth(pChild) - - attribs->shiftY, - pChild->nextSib, - VTMove); - - /* Note that the call to MoveWindow will eventually call - * dmxPositionWindow which will automatically create a - * window if it is now exposed on screen (for lazy - * window creation optimization) and it will properly - * set the offscreen flag. - */ - - pChild = pChild->nextSib; - } - } - } - - /* Update connection block, Xinerama, etc. -- these appears to - * already be handled in dmxConnectionBlockCallback(), which is - * called from dmxAdjustCursorBoundaries() [below]. */ - - /* Adjust the cursor boundaries */ - dmxAdjustCursorBoundaries(); - - /* Force completion of the changes */ - dmxSync(NULL, TRUE); - - return Success; -} -#endif - -/** Create the scratch GCs per depth. */ -static void dmxBECreateScratchGCs(int scrnNum) -{ - ScreenPtr pScreen = screenInfo.screens[scrnNum]; - GCPtr *ppGC = pScreen->GCperDepth; - int i; - - for (i = 0; i <= pScreen->numDepths; i++) - dmxBECreateGC(pScreen, ppGC[i]); -} - -#ifdef PANORAMIX -static Bool FoundPixImage; - -/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs - * to have its image restored. When it is found, see if there is - * another screen with the same image. If so, copy the pixmap image - * from the existing screen to the newly created pixmap. */ -static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, - pointer p) -{ - if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { - PixmapPtr pDst = (PixmapPtr)p; - int idx = pDst->drawable.pScreen->myNum; - PanoramiXRes *pXinPix = (PanoramiXRes *)value; - PixmapPtr pPix; - int i; - - dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - if (pPix != pDst) return; /* Not a match.... Next! */ - - for (i = 0; i < PanoramiXNumScreens; i++) { - PixmapPtr pSrc; - dmxPixPrivPtr pSrcPriv = NULL; - - if (i == idx) continue; /* Self replication is bad */ - - dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); - if (pSrcPriv->pixmap) { - DMXScreenInfo *dmxSrcScreen = &dmxScreens[i]; - DMXScreenInfo *dmxDstScreen = &dmxScreens[idx]; - dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst); - XImage *img; - int j; - XlibGC gc = NULL; - - /* This should never happen, but just in case.... */ - if (pSrc->drawable.width != pDst->drawable.width || - pSrc->drawable.height != pDst->drawable.height) - return; - - /* Copy from src pixmap to dst pixmap */ - img = XGetImage(dmxSrcScreen->beDisplay, - pSrcPriv->pixmap, - 0, 0, - pSrc->drawable.width, pSrc->drawable.height, - -1, - ZPixmap); - - for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) { - if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) { - unsigned long m; - XGCValues v; - - m = GCFunction | GCPlaneMask | GCClipMask; - v.function = GXcopy; - v.plane_mask = AllPlanes; - v.clip_mask = None; - - gc = XCreateGC(dmxDstScreen->beDisplay, - dmxDstScreen->scrnDefDrawables[j], - m, &v); - break; - } - } - - if (gc) { - XPutImage(dmxDstScreen->beDisplay, - pDstPriv->pixmap, - gc, img, 0, 0, 0, 0, - pDst->drawable.width, pDst->drawable.height); - XFreeGC(dmxDstScreen->beDisplay, gc); - FoundPixImage = True; - } else { - dmxLog(dmxWarning, "Could not create GC\n"); - } - - XDestroyImage(img); - return; - } - } - } -} -#endif - -/** Restore the pixmap image either from another screen or from an image - * that was saved when the screen was previously detached. */ -static void dmxBERestorePixmap(PixmapPtr pPixmap) -{ -#ifdef PANORAMIX - int i; - - /* If Xinerama is not active, there's nothing we can do (see comment - * in #else below for more info). */ - if (noPanoramiXExtension) { - dmxLog(dmxWarning, "Cannot restore pixmap image\n"); - return; - } - - FoundPixImage = False; - for (i = currentMaxClients; --i >= 0; ) - if (clients[i]) - FindAllClientResources(clients[i], dmxBERestorePixmapImage, - (pointer)pPixmap); - - /* No corresponding pixmap image was found on other screens, so we - * need to copy it from the saved image when the screen was detached - * (if available). */ - if (!FoundPixImage) { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - - if (pPixPriv->detachedImage) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - XlibGC gc = NULL; - - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - if (dmxScreen->bePixmapFormats[i].depth == - pPixPriv->detachedImage->depth) { - unsigned long m; - XGCValues v; - - m = GCFunction | GCPlaneMask | GCClipMask; - v.function = GXcopy; - v.plane_mask = AllPlanes; - v.clip_mask = None; - - gc = XCreateGC(dmxScreen->beDisplay, - dmxScreen->scrnDefDrawables[i], - m, &v); - break; - } - } - - if (gc) { - XPutImage(dmxScreen->beDisplay, - pPixPriv->pixmap, - gc, - pPixPriv->detachedImage, - 0, 0, 0, 0, - pPixmap->drawable.width, pPixmap->drawable.height); - XFreeGC(dmxScreen->beDisplay, gc); - } else { - dmxLog(dmxWarning, "Cannot restore pixmap image\n"); - } - - XDestroyImage(pPixPriv->detachedImage); - pPixPriv->detachedImage = NULL; - } else { - dmxLog(dmxWarning, "Cannot restore pixmap image\n"); - } - } -#else - /* If Xinerama is not enabled, then there is no other copy of the - * pixmap image that we can restore. Saving all pixmap data is not - * a feasible option since there is no mechanism for updating pixmap - * data when a screen is detached, which means that the data that - * was previously saved would most likely be out of date. */ - dmxLog(dmxWarning, "Cannot restore pixmap image\n"); - return; -#endif -} - -/** Create resources on the back-end server. This function is called - * from #dmxAttachScreen() via the dix layer's FindAllResources - * function. It walks all resources, compares them to the screen - * number passed in as \a n and calls the appropriate DMX function to - * create the associated resource on the back-end server. */ -static void dmxBECreateResources(pointer value, XID id, RESTYPE type, - pointer n) -{ - int scrnNum = (int)n; - ScreenPtr pScreen = screenInfo.screens[scrnNum]; - - if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { - /* Window resources are created below in dmxBECreateWindowTree */ - } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) { - PixmapPtr pPix = value; - if (pPix->drawable.pScreen->myNum == scrnNum) { - dmxBECreatePixmap(pPix); - dmxBERestorePixmap(pPix); - } - } else if ((type & TypeMask) == (RT_GC & TypeMask)) { - GCPtr pGC = value; - if (pGC->pScreen->myNum == scrnNum) { - /* Create the GC on the back-end server */ - dmxBECreateGC(pScreen, pGC); - /* Create any pixmaps associated with this GC */ - if (!pGC->tileIsPixel) { - dmxBECreatePixmap(pGC->tile.pixmap); - dmxBERestorePixmap(pGC->tile.pixmap); - } - if (pGC->stipple != pScreen->PixmapPerDepth[0]) { - dmxBECreatePixmap(pGC->stipple); - dmxBERestorePixmap(pGC->stipple); - } - if (pGC->font != defaultFont) { - (void)dmxBELoadFont(pScreen, pGC->font); - } - /* Update the GC on the back-end server */ - dmxChangeGC(pGC, -1L); - } - } else if ((type & TypeMask) == (RT_FONT & TypeMask)) { - (void)dmxBELoadFont(pScreen, (FontPtr)value); - } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) { - dmxBECreateCursor(pScreen, (CursorPtr)value); - } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) { - ColormapPtr pCmap = value; - if (pCmap->pScreen->myNum == scrnNum) - (void)dmxBECreateColormap((ColormapPtr)value); -#if 0 - /* TODO: Recreate Picture and GlyphSet resources */ - } else if ((type & TypeMask) == (PictureType & TypeMask)) { - /* Picture resources are created when windows are created */ - } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { - dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value); -#endif - } else { - /* Other resource types??? */ - } -} - -/** Create window hierachy on back-end server. The window tree is - * created in a special order (bottom most subwindow first) so that the - * #dmxCreateNonRootWindow() function does not need to recursively call - * itself to create each window's parents. This is required so that we - * have the opportunity to create each window's border and background - * pixmaps (where appropriate) before the window is created. */ -static void dmxBECreateWindowTree(int idx) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - WindowPtr pRoot = screenInfo.screens[idx]->root; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot); - WindowPtr pWin; - - /* Create the pixmaps associated with the root window */ - if (!pRoot->borderIsPixel) { - dmxBECreatePixmap(pRoot->border.pixmap); - dmxBERestorePixmap(pRoot->border.pixmap); - } - if (pRoot->backgroundState == BackgroundPixmap) { - dmxBECreatePixmap(pRoot->background.pixmap); - dmxBERestorePixmap(pRoot->background.pixmap); - } - - /* Create root window first */ - dmxScreen->rootWin = pWinPriv->window = dmxCreateRootWindow(pRoot); - XMapWindow(dmxScreen->beDisplay, dmxScreen->rootWin); - - pWin = pRoot->lastChild; - while (pWin) { - pWinPriv = DMX_GET_WINDOW_PRIV(pWin); - - /* Create the pixmaps regardless of whether or not the - * window is created or not due to lazy window creation. - */ - if (!pWin->borderIsPixel) { - dmxBECreatePixmap(pWin->border.pixmap); - dmxBERestorePixmap(pWin->border.pixmap); - } - if (pWin->backgroundState == BackgroundPixmap) { - dmxBECreatePixmap(pWin->background.pixmap); - dmxBERestorePixmap(pWin->background.pixmap); - } - - /* Reset the window attributes */ - dmxGetDefaultWindowAttributes(pWin, - &pWinPriv->cmap, - &pWinPriv->visual); - - /* Create the window */ - if (pWinPriv->mapped && !pWinPriv->offscreen) - dmxCreateAndRealizeWindow(pWin, TRUE); - - /* Next, create the bottom-most child */ - if (pWin->lastChild) { - pWin = pWin->lastChild; - continue; - } - - /* If the window has no children, move on to the next higher window */ - while (!pWin->prevSib && (pWin != pRoot)) - pWin = pWin->parent; - - if (pWin->prevSib) { - pWin = pWin->prevSib; - continue; - } - - /* When we reach the root window, we are finished */ - if (pWin == pRoot) - break; - } -} - -/* Refresh screen by generating exposure events for all windows */ -static void dmxForceExposures(int idx) -{ - ScreenPtr pScreen = screenInfo.screens[idx]; - WindowPtr pRoot = pScreen->root; - Bool anyMarked = FALSE; - WindowPtr pChild; - - for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) - anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild, - (WindowPtr *)NULL); - if (anyMarked) { - /* If any windows have been marked, set the root window's - * clipList to be broken since it will be recalculated in - * ValidateTree() - */ - RegionBreak(&pRoot->clipList); - pScreen->ValidateTree(pRoot, NULL, VTBroken); - pScreen->HandleExposures(pRoot); - if (pScreen->PostValidateTree) - pScreen->PostValidateTree(pRoot, NULL, VTBroken); - } -} - -/** Compare the new and old screens to see if they are compatible. */ -static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old) -{ - int i; - - if (new->beWidth != old->beWidth) return FALSE; - if (new->beHeight != old->beHeight) return FALSE; - if (new->beDepth != old->beDepth) return FALSE; - if (new->beBPP != old->beBPP) return FALSE; - - if (new->beNumDepths != old->beNumDepths) return FALSE; - for (i = 0; i < old->beNumDepths; i++) - if (new->beDepths[i] != old->beDepths[i]) return FALSE; - - if (new->beNumPixmapFormats != old->beNumPixmapFormats) return FALSE; - for (i = 0; i < old->beNumPixmapFormats; i++) { - if (new->bePixmapFormats[i].depth != - old->bePixmapFormats[i].depth) return FALSE; - if (new->bePixmapFormats[i].bits_per_pixel != - old->bePixmapFormats[i].bits_per_pixel) return FALSE; - if (new->bePixmapFormats[i].scanline_pad != - old->bePixmapFormats[i].scanline_pad) return FALSE; - } - - if (new->beNumVisuals != old->beNumVisuals) return FALSE; - for (i = 0; i < old->beNumVisuals; i++) { - if (new->beVisuals[i].visualid != - old->beVisuals[i].visualid) return FALSE; - if (new->beVisuals[i].screen != - old->beVisuals[i].screen) return FALSE; - if (new->beVisuals[i].depth != - old->beVisuals[i].depth) return FALSE; - if (new->beVisuals[i].class != - old->beVisuals[i].class) return FALSE; - if (new->beVisuals[i].red_mask != - old->beVisuals[i].red_mask) return FALSE; - if (new->beVisuals[i].green_mask != - old->beVisuals[i].green_mask) return FALSE; - if (new->beVisuals[i].blue_mask != - old->beVisuals[i].blue_mask) return FALSE; - if (new->beVisuals[i].colormap_size != - old->beVisuals[i].colormap_size) return FALSE; - if (new->beVisuals[i].bits_per_rgb != - old->beVisuals[i].bits_per_rgb) return FALSE; - } - - if (new->beDefVisualIndex != old->beDefVisualIndex) return FALSE; - - return TRUE; -} - -/** Restore Render's picture */ -static void dmxBERestoreRenderPict(pointer value, XID id, pointer n) -{ - PicturePtr pPicture = value; /* The picture */ - DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */ - int scrnNum = (int)n; - - if (pDraw->pScreen->myNum != scrnNum) { - /* Picture not on the screen we are restoring*/ - return; - } - - if (pDraw->type == DRAWABLE_PIXMAP) { - PixmapPtr pPixmap = (PixmapPtr)pDraw; - - /* Create and restore the pixmap drawable */ - dmxBECreatePixmap(pPixmap); - dmxBERestorePixmap(pPixmap); - } - - dmxBECreatePicture(pPicture); -} - -/** Restore Render's glyphs */ -static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n) -{ - GlyphSetPtr glyphSet = value; - int scrnNum = (int)n; - dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum]; - GlyphRefPtr table; - char *images; - Glyph *gids; - XGlyphInfo *glyphs; - char *pos; - int beret; - int len_images = 0; - int i; - int ctr; - - if (glyphPriv->glyphSets[scrnNum]) { - /* Only restore glyphs on the screen we are attaching */ - return; - } - - /* First we must create the glyph set on the backend. */ - if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) { - dmxLog(dmxWarning, - "\tdmxBERestoreRenderGlyph failed to create glyphset!\n"); - return; - } - - /* Now for the complex part, restore the glyph data */ - table = glyphSet->hash.table; - - /* We need to know how much memory to allocate for this part */ - for (i = 0; i < glyphSet->hash.hashSet->size; i++) { - GlyphRefPtr gr = &table[i]; - GlyphPtr gl = gr->glyph; - - if (!gl || gl == DeletedGlyph) continue; - len_images += gl->size - sizeof(gl->info); - } - - /* Now allocate the memory we need */ - images = calloc(len_images, sizeof(char)); - gids = malloc(glyphSet->hash.tableEntries*sizeof(Glyph)); - glyphs = malloc(glyphSet->hash.tableEntries*sizeof(XGlyphInfo)); - - pos = images; - ctr = 0; - - /* Fill the allocated memory with the proper data */ - for (i = 0; i < glyphSet->hash.hashSet->size; i++) { - GlyphRefPtr gr = &table[i]; - GlyphPtr gl = gr->glyph; - - if (!gl || gl == DeletedGlyph) continue; - - /* First lets put the data into gids */ - gids[ctr] = gr->signature; - - /* Next do the glyphs data structures */ - glyphs[ctr].width = gl->info.width; - glyphs[ctr].height = gl->info.height; - glyphs[ctr].x = gl->info.x; - glyphs[ctr].y = gl->info.y; - glyphs[ctr].xOff = gl->info.xOff; - glyphs[ctr].yOff = gl->info.yOff; - - /* Copy the images from the DIX's data into the buffer */ - memcpy(pos, gl+1, gl->size - sizeof(gl->info)); - pos += gl->size - sizeof(gl->info); - ctr++; - } - - /* Now restore the glyph data */ - XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum], - gids,glyphs, glyphSet->hash.tableEntries, images, - len_images); - - /* Clean up */ - free(images); - free(gids); - free(glyphs); -} - -/** Reattach previously detached back-end screen. */ -int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) -{ - ScreenPtr pScreen; - DMXScreenInfo *dmxScreen; - CARD32 scrnNum = idx; - DMXScreenInfo oldDMXScreen; - int i; - - /* Return failure if dynamic addition/removal of screens is disabled */ - if (!dmxAddRemoveScreens) { - dmxLog(dmxWarning, - "Attempting to add a screen, but the AddRemoveScreen\n"); - dmxLog(dmxWarning, - "extension has not been enabled. To enable this extension\n"); - dmxLog(dmxWarning, - "add the \"-addremovescreens\" option either to the command\n"); - dmxLog(dmxWarning, - "line or in the configuration file.\n"); - return 1; - } - - /* Cannot add a screen that does not exist */ - if (idx < 0 || idx >= dmxNumScreens) return 1; - pScreen = screenInfo.screens[idx]; - dmxScreen = &dmxScreens[idx]; - - /* Cannot attach to a screen that is already opened */ - if (dmxScreen->beDisplay) { - dmxLog(dmxWarning, - "Attempting to add screen #%d but a screen already exists\n", - idx); - return 1; - } - - dmxLogOutput(dmxScreen, "Attaching screen #%d\n", idx); - - /* Save old info */ - oldDMXScreen = *dmxScreen; - - /* Copy the name to the new screen */ - dmxScreen->name = strdup(attr->displayName); - - /* Open display and get all of the screen info */ - if (!dmxOpenDisplay(dmxScreen)) { - dmxLog(dmxWarning, - "dmxOpenDisplay: Unable to open display %s\n", - dmxScreen->name); - - /* Restore the old screen */ - *dmxScreen = oldDMXScreen; - return 1; - } - - dmxSetErrorHandler(dmxScreen); - dmxCheckForWM(dmxScreen); - dmxGetScreenAttribs(dmxScreen); - - if (!dmxGetVisualInfo(dmxScreen)) { - dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n"); - XFree(dmxScreen->beVisuals); - XCloseDisplay(dmxScreen->beDisplay); - - /* Restore the old screen */ - *dmxScreen = oldDMXScreen; - return 1; - } - - dmxGetColormaps(dmxScreen); - dmxGetPixmapFormats(dmxScreen); - - /* Verify that the screen to be added has the same info as the - * previously added screen. */ - if (!dmxCompareScreens(dmxScreen, &oldDMXScreen)) { - dmxLog(dmxWarning, - "New screen data (%s) does not match previously\n", - dmxScreen->name); - dmxLog(dmxWarning, - "attached screen data (%s)\n", - oldDMXScreen.name); - dmxLog(dmxWarning, - "All data must match in order to attach to screen #%d\n", - idx); - XFree(dmxScreen->beVisuals); - XFree(dmxScreen->beDepths); - XFree(dmxScreen->bePixmapFormats); - XCloseDisplay(dmxScreen->beDisplay); - - /* Restore the old screen */ - *dmxScreen = oldDMXScreen; - return 1; - } - - /* Initialize the BE screen resources */ - dmxBEScreenInit(idx, screenInfo.screens[idx]); - - /* TODO: Handle GLX visual initialization. GLXProxy needs to be - * updated to handle dynamic addition/removal of screens. */ - - /* Create default stipple */ - dmxBECreatePixmap(pScreen->PixmapPerDepth[0]); - dmxBERestorePixmap(pScreen->PixmapPerDepth[0]); - - /* Create the scratch GCs */ - dmxBECreateScratchGCs(idx); - - /* Create the default font */ - (void)dmxBELoadFont(pScreen, defaultFont); - - /* Create all resources that don't depend on windows */ - for (i = currentMaxClients; --i >= 0; ) - if (clients[i]) - FindAllClientResources(clients[i], dmxBECreateResources, - (pointer)idx); - - /* Create window hierarchy (top down) */ - dmxBECreateWindowTree(idx); - - /* Restore the picture state for RENDER */ - for (i = currentMaxClients; --i >= 0; ) - if (clients[i]) - FindClientResourcesByType(clients[i],PictureType, - dmxBERestoreRenderPict,(pointer)idx); - - /* Restore the glyph state for RENDER */ - for (i = currentMaxClients; --i >= 0; ) - if (clients[i]) - FindClientResourcesByType(clients[i],GlyphSetType, - dmxBERestoreRenderGlyph,(pointer)idx); - - /* Refresh screen by generating exposure events for all windows */ - dmxForceExposures(idx); - - dmxSync(&dmxScreens[idx], TRUE); - - /* We used these to compare the old and new screens. They are no - * longer needed since we have a newly attached screen, so we can - * now free the old screen's resources. */ - XFree(oldDMXScreen.beVisuals); - XFree(oldDMXScreen.beDepths); - XFree(oldDMXScreen.bePixmapFormats); - /* TODO: should oldDMXScreen.name be freed?? */ - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL); - else -#endif - return 0; /* Success */ -} - -/* - * Resources that may have state on the BE server and need to be freed: - * - * RT_NONE - * RT_WINDOW - * RT_PIXMAP - * RT_GC - * RT_FONT - * RT_CURSOR - * RT_COLORMAP - * RT_CMAPENTRY - * RT_OTHERCLIENT - * RT_PASSIVEGRAB - * XRT_WINDOW - * XRT_PIXMAP - * XRT_GC - * XRT_COLORMAP - * XRT_PICTURE - * PictureType - * PictFormatType - * GlyphSetType - * ClientType - * EventType - * RT_INPUTCLIENT - * XETrapType - * RTCounter - * RTAwait - * RTAlarmClient - * RT_XKBCLIENT - * RTContext - * TagResType - * StalledResType - * SecurityAuthorizationResType - * RTEventClient - * __glXContextRes - * __glXClientRes - * __glXPixmapRes - * __glXWindowRes - * __glXPbufferRes - */ - -#ifdef PANORAMIX -/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs - * to have its image saved. */ -static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, - pointer p) -{ - if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { - PixmapPtr pDst = (PixmapPtr)p; - int idx = pDst->drawable.pScreen->myNum; - PanoramiXRes *pXinPix = (PanoramiXRes *)value; - PixmapPtr pPix; - int i; - - dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - if (pPix != pDst) return; /* Not a match.... Next! */ - - for (i = 0; i < PanoramiXNumScreens; i++) { - PixmapPtr pSrc; - dmxPixPrivPtr pSrcPriv = NULL; - - if (i == idx) continue; /* Self replication is bad */ - - dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); - if (pSrcPriv->pixmap) { - FoundPixImage = True; - return; - } - } - } -} -#endif - -/** Save the pixmap image only when there is not another screen with - * that pixmap from which the image can be read when the screen is - * reattached. To do this, we first try to find a pixmap on another - * screen corresponding to the one we are trying to save. If we find - * one, then we do not need to save the image data since during - * reattachment, the image data can be read from that other pixmap. - * However, if we do not find one, then we need to save the image data. - * The common case for these are for the default stipple and root - * tile. */ -static void dmxBESavePixmap(PixmapPtr pPixmap) -{ -#ifdef PANORAMIX - int i; - - /* If Xinerama is not active, there's nothing we can do (see comment - * in #else below for more info). */ - if (noPanoramiXExtension) return; - - FoundPixImage = False; - for (i = currentMaxClients; --i >= 0; ) - if (clients[i]) - FindAllClientResources(clients[i], dmxBEFindPixmapImage, - (pointer)pPixmap); - - /* Save the image only if there is no other screens that have a - * pixmap that corresponds to the one we are trying to save. */ - if (!FoundPixImage) { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - - if (!pPixPriv->detachedImage) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay, - pPixPriv->pixmap, - 0, 0, - pPixmap->drawable.width, - pPixmap->drawable.height, - -1, - ZPixmap); - if (!pPixPriv->detachedImage) - dmxLog(dmxWarning, "Cannot save pixmap image\n"); - } - } -#else - /* NOTE: The only time there is a pixmap on another screen that - * corresponds to the one we are trying to save is when Xinerama is - * active. Otherwise, the pixmap image data is only stored on a - * single screen, which means that once it is detached, that data is - * lost. We could save the data here, but then that would require - * us to implement the ability for Xdmx to keep the pixmap up to - * date while the screen is detached, which is beyond the scope of - * the current project. */ - return; -#endif -} - -/** Destroy resources on the back-end server. This function is called - * from #dmxDetachScreen() via the dix layer's FindAllResources - * function. It walks all resources, compares them to the screen - * number passed in as \a n and calls the appropriate DMX function to - * free the associated resource on the back-end server. */ -static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type, - pointer n) -{ - int scrnNum = (int)n; - ScreenPtr pScreen = screenInfo.screens[scrnNum]; - - if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { - /* Window resources are destroyed below in dmxBEDestroyWindowTree */ - } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) { - PixmapPtr pPix = value; - if (pPix->drawable.pScreen->myNum == scrnNum) { - dmxBESavePixmap(pPix); - dmxBEFreePixmap(pPix); - } - } else if ((type & TypeMask) == (RT_GC & TypeMask)) { - GCPtr pGC = value; - if (pGC->pScreen->myNum == scrnNum) - dmxBEFreeGC(pGC); - } else if ((type & TypeMask) == (RT_FONT & TypeMask)) { - dmxBEFreeFont(pScreen, (FontPtr)value); - } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) { - dmxBEFreeCursor(pScreen, (CursorPtr)value); - } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) { - ColormapPtr pCmap = value; - if (pCmap->pScreen->myNum == scrnNum) - dmxBEFreeColormap((ColormapPtr)value); - } else if ((type & TypeMask) == (PictureType & TypeMask)) { - PicturePtr pPict = value; - if (pPict->pDrawable->pScreen->myNum == scrnNum) { - /* Free the pixmaps on the backend if needed */ - if (pPict->pDrawable->type == DRAWABLE_PIXMAP) { - PixmapPtr pPixmap = (PixmapPtr)(pPict->pDrawable); - dmxBESavePixmap(pPixmap); - dmxBEFreePixmap(pPixmap); - } - dmxBEFreePicture((PicturePtr)value); - } - } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { - dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value); - } else { - /* Other resource types??? */ - } -} - -/** Destroy the scratch GCs that are created per depth. */ -static void dmxBEDestroyScratchGCs(int scrnNum) -{ - ScreenPtr pScreen = screenInfo.screens[scrnNum]; - GCPtr *ppGC = pScreen->GCperDepth; - int i; - - for (i = 0; i <= pScreen->numDepths; i++) - dmxBEFreeGC(ppGC[i]); -} - -/** Destroy window hierachy on back-end server. To ensure that all - * XDestroyWindow() calls succeed, they must be performed in a bottom - * up order so that windows are not destroyed before their children. - * XDestroyWindow(), which is called from #dmxBEDestroyWindow(), will - * destroy a window as well as all of it's children. */ -static void dmxBEDestroyWindowTree(int idx) -{ - WindowPtr pWin = screenInfo.screens[idx]->root; - WindowPtr pChild = pWin; - - while (1) { - if (pChild->firstChild) { - pChild = pChild->firstChild; - continue; - } - - /* Destroy the window */ - dmxBEDestroyWindow(pChild); - - /* Make sure we destroy the window's border and background - * pixmaps if they exist */ - if (!pChild->borderIsPixel) { - dmxBESavePixmap(pChild->border.pixmap); - dmxBEFreePixmap(pChild->border.pixmap); - } - if (pChild->backgroundState == BackgroundPixmap) { - dmxBESavePixmap(pChild->background.pixmap); - dmxBEFreePixmap(pChild->background.pixmap); - } - - while (!pChild->nextSib && (pChild != pWin)) { - pChild = pChild->parent; - dmxBEDestroyWindow(pChild); - if (!pChild->borderIsPixel) { - dmxBESavePixmap(pChild->border.pixmap); - dmxBEFreePixmap(pChild->border.pixmap); - } - if (pChild->backgroundState == BackgroundPixmap) { - dmxBESavePixmap(pChild->background.pixmap); - dmxBEFreePixmap(pChild->background.pixmap); - } - } - - if (pChild == pWin) - break; - - pChild = pChild->nextSib; - } -} - -/** Detach back-end screen. */ -int dmxDetachScreen(int idx) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - int i; - - /* Return failure if dynamic addition/removal of screens is disabled */ - if (!dmxAddRemoveScreens) { - dmxLog(dmxWarning, - "Attempting to remove a screen, but the AddRemoveScreen\n"); - dmxLog(dmxWarning, - "extension has not been enabled. To enable this extension\n"); - dmxLog(dmxWarning, - "add the \"-addremovescreens\" option either to the command\n"); - dmxLog(dmxWarning, - "line or in the configuration file.\n"); - return 1; - } - - /* Cannot remove a screen that does not exist */ - if (idx < 0 || idx >= dmxNumScreens) return 1; - - /* Cannot detach from a screen that is not opened */ - if (!dmxScreen->beDisplay) { - dmxLog(dmxWarning, - "Attempting to remove screen #%d but it has not been opened\n", - idx); - return 1; - } - - dmxLogOutput(dmxScreen, "Detaching screen #%d\n", idx); - - /* Detach input */ - dmxInputDetachAll(dmxScreen); - - /* Save all relevant state (TODO) */ - - /* Free all non-window resources related to this screen */ - for (i = currentMaxClients; --i >= 0; ) - if (clients[i]) - FindAllClientResources(clients[i], dmxBEDestroyResources, - (pointer)idx); - - /* Free scratch GCs */ - dmxBEDestroyScratchGCs(idx); - - /* Free window resources related to this screen */ - dmxBEDestroyWindowTree(idx); - - /* Free default stipple */ - dmxBESavePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]); - dmxBEFreePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]); - - /* Free the remaining screen resources and close the screen */ - dmxBECloseScreen(screenInfo.screens[idx]); - - /* Adjust the cursor boundaries (paints detached console window) */ - dmxAdjustCursorBoundaries(); - - return 0; /* Success */ -} +/* + * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Author: + * Rickard E. (Rik) Faith + * Kevin E. Martin + * + */ + +/** \file + * This file provides the only interface to the X server extension support + * in programs/Xserver/Xext. Those programs should only include dmxext.h + */ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include + +#include "dmx.h" +#include "dmxinit.h" +#include "dmxextension.h" +#include "dmxwindow.h" +#include "dmxcb.h" +#include "dmxcursor.h" +#include "dmxpixmap.h" +#include "dmxgc.h" +#include "dmxfont.h" +#include "dmxcmap.h" +#include "dmxpict.h" +#include "dmxinput.h" +#include "dmxsync.h" +#include "dmxscrinit.h" +#include "input/dmxinputinit.h" + +#include "windowstr.h" +#include "inputstr.h" /* For DeviceIntRec */ +#include /* For DMX_BAD_* */ +#include "cursorstr.h" + +/* The default font is declared in dix/globals.c, but is not included in + * _any_ header files. */ +extern FontPtr defaultFont; + +/** This routine provides information to the DMX protocol extension + * about a particular screen. */ +Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr) +{ + DMXScreenInfo *dmxScreen; + + if (physical < 0 || physical >= dmxNumScreens) return FALSE; + + dmxScreen = &dmxScreens[physical]; + attr->displayName = dmxScreen->name; +#ifdef PANORAMIX + attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0; +#else + attr->logicalScreen = dmxScreen->index; +#endif + + attr->screenWindowWidth = dmxScreen->scrnWidth; + attr->screenWindowHeight = dmxScreen->scrnHeight; + attr->screenWindowXoffset = dmxScreen->scrnX; + attr->screenWindowYoffset = dmxScreen->scrnY; + + attr->rootWindowWidth = dmxScreen->rootWidth; + attr->rootWindowHeight = dmxScreen->rootHeight; + attr->rootWindowXoffset = dmxScreen->rootX; + attr->rootWindowYoffset = dmxScreen->rootY; + + attr->rootWindowXorigin = dmxScreen->rootXOrigin; + attr->rootWindowYorigin = dmxScreen->rootYOrigin; + + return TRUE; +} + +/** This routine provides information to the DMX protocol extension + * about a particular window. */ +Bool dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr) +{ + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + + attr->screen = pWindow->drawable.pScreen->myNum; + attr->window = pWinPriv->window; + + attr->pos.x = pWindow->drawable.x; + attr->pos.y = pWindow->drawable.y; + attr->pos.width = pWindow->drawable.width; + attr->pos.height = pWindow->drawable.height; + + if (!pWinPriv->window || pWinPriv->offscreen) { + attr->vis.x = 0; + attr->vis.y = 0; + attr->vis.height = 0; + attr->vis.width = 0; + return pWinPriv->window ? TRUE : FALSE; + } + + /* Compute display-relative coordinates */ + attr->vis.x = pWindow->drawable.x; + attr->vis.y = pWindow->drawable.y; + attr->vis.width = pWindow->drawable.width; + attr->vis.height = pWindow->drawable.height; + + if (attr->pos.x < 0) { + attr->vis.x -= attr->pos.x; + attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x; + } + if (attr->pos.x + attr->pos.width > pWindow->drawable.pScreen->width) { + if (attr->pos.x < 0) + attr->vis.width = pWindow->drawable.pScreen->width; + else + attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x; + } + if (attr->pos.y < 0) { + attr->vis.y -= attr->pos.y; + attr->vis.height = attr->pos.y + attr->pos.height - attr->vis.y; + } + if (attr->pos.y + attr->pos.height > pWindow->drawable.pScreen->height) { + if (attr->pos.y < 0) + attr->vis.height = pWindow->drawable.pScreen->height; + else + attr->vis.height = pWindow->drawable.pScreen->height - attr->pos.y; + } + + /* Convert to window-relative coordinates */ + attr->vis.x -= attr->pos.x; + attr->vis.y -= attr->pos.y; + + return TRUE; +} + +void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr) +{ + attr->width = dmxGlobalWidth; + attr->height = dmxGlobalHeight; + attr->shiftX = 0; /* NOTE: The upper left hand corner of */ + attr->shiftY = 0; /* the desktop is always <0,0>. */ +} + +/** Return the total number of devices, not just #dmxNumInputs. The + * number returned should be the same as that returned by + * XListInputDevices. */ +int dmxGetInputCount(void) +{ + int i, total; + + for (total = i = 0; i < dmxNumInputs; i++) total += dmxInputs[i].numDevs; + return total; +} + +/** Return information about the device with id = \a deviceId. This + * information is primarily for the #ProcDMXGetInputAttributes() + * function, which does not have access to the appropriate data + * structure. */ +int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr) +{ + int i, j; + DMXInputInfo *dmxInput; + + if (deviceId < 0) return -1; + for (i = 0; i < dmxNumInputs; i++) { + dmxInput = &dmxInputs[i]; + for (j = 0; j < dmxInput->numDevs; j++) { + DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; + if (deviceId != dmxLocal->pDevice->id) continue; + attr->isCore = !!dmxLocal->isCore; + attr->sendsCore = !!dmxLocal->sendsCore; + attr->detached = !!dmxInput->detached; + attr->physicalScreen = -1; + attr->physicalId = -1; + attr->name = NULL; + switch (dmxLocal->extType) { + case DMX_LOCAL_TYPE_LOCAL: + attr->inputType = 0; + break; + case DMX_LOCAL_TYPE_CONSOLE: + attr->inputType = 1; + attr->name = dmxInput->name; + attr->physicalId = dmxLocal->deviceId; + break; + case DMX_LOCAL_TYPE_BACKEND: + case DMX_LOCAL_TYPE_COMMON: + attr->inputType = 2; + attr->physicalScreen = dmxInput->scrnIdx; + attr->name = dmxInput->name; + attr->physicalId = dmxLocal->deviceId; + break; + } + return 0; /* Success */ + } + } + return -1; /* Failure */ +} + +/** Reinitialized the cursor boundaries. */ +static void dmxAdjustCursorBoundaries(void) +{ + int i; + + dmxReInitOrigins(); + dmxInitOverlap(); + dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX); + dmxConnectionBlockCallback(); + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + if (!dmxInput->detached) dmxInputReInit(dmxInput); + } + + dmxCheckCursor(); + + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + if (!dmxInput->detached) dmxInputLateReInit(dmxInput); + } +} + +/** Add an input with the specified attributes. If the input is added, + * the physical id is returned in \a deviceId. */ +int dmxAddInput(DMXInputAttributesPtr attr, int *id) +{ + int retcode = BadValue; + + if (attr->inputType == 1) /* console */ + retcode = dmxInputAttachConsole(attr->name, attr->sendsCore, id); + else if (attr->inputType == 2) /* backend */ + retcode = dmxInputAttachBackend(attr->physicalScreen, + attr->sendsCore,id); + + if (retcode == Success) { + /* Adjust the cursor boundaries */ + dmxAdjustCursorBoundaries(); + + /* Force completion of the changes */ + dmxSync(NULL, TRUE); + } + + return retcode; +} + +/** Remove the input with physical id \a id. */ +int dmxRemoveInput(int id) +{ + return dmxInputDetachId(id); +} + +/** Return the value of #dmxNumScreens -- the total number of backend + * screens in use (these are logical screens and may be larger than the + * number of backend displays). */ +unsigned long dmxGetNumScreens(void) +{ + return dmxNumScreens; +} + +/** Make sure that #dmxCreateAndRealizeWindow has been called for \a + * pWindow. */ +void dmxForceWindowCreation(WindowPtr pWindow) +{ + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + if (!pWinPriv->window) dmxCreateAndRealizeWindow(pWindow, TRUE); +} + +/** Flush pending syncs for all screens. */ +void dmxFlushPendingSyncs(void) +{ + dmxSync(NULL, TRUE); +} + +/** Update DMX's screen resources to match those of the newly moved + * and/or resized "root" window. */ +void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; + WindowPtr pChild; + Bool anyMarked = FALSE; + + /* Handle special case where width and/or height are zero */ + if (w == 0 || h == 0) { + w = 1; + h = 1; + } + + /* Change screen size */ + pScreen->width = w; + pScreen->height = h; + + /* Reset the root window's drawable's size */ + pRoot->drawable.width = w; + pRoot->drawable.height = h; + + /* Set the root window's new winSize and borderSize */ + pRoot->winSize.extents.x1 = 0; + pRoot->winSize.extents.y1 = 0; + pRoot->winSize.extents.x2 = w; + pRoot->winSize.extents.y2 = h; + + pRoot->borderSize.extents.x1 = 0; + pRoot->borderSize.extents.y1 = 0; + pRoot->borderSize.extents.x2 = w; + pRoot->borderSize.extents.y2 = h; + + /* Recompute this screen's mmWidth & mmHeight */ + pScreen->mmWidth = + (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10); + pScreen->mmHeight = + (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10); + + /* Recompute this screen's window's clip rects as follows: */ + /* 1. Mark all of root's children's windows */ + for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) + anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild, + (WindowPtr *)NULL); + + /* 2. Set the root window's borderClip */ + pRoot->borderClip.extents.x1 = 0; + pRoot->borderClip.extents.y1 = 0; + pRoot->borderClip.extents.x2 = w; + pRoot->borderClip.extents.y2 = h; + + /* 3. Set the root window's clipList */ + if (anyMarked) { + /* If any windows have been marked, set the root window's + * clipList to be broken since it will be recalculated in + * ValidateTree() + */ + RegionBreak(&pRoot->clipList); + } else { + /* Otherwise, we just set it directly since there are no + * windows visible on this screen + */ + pRoot->clipList.extents.x1 = 0; + pRoot->clipList.extents.y1 = 0; + pRoot->clipList.extents.x2 = w; + pRoot->clipList.extents.y2 = h; + } + + /* 4. Revalidate all clip rects and generate expose events */ + if (anyMarked) { + pScreen->ValidateTree(pRoot, NULL, VTBroken); + pScreen->HandleExposures(pRoot); + if (pScreen->PostValidateTree) + pScreen->PostValidateTree(pRoot, NULL, VTBroken); + } +} + +#ifdef PANORAMIX +#include "panoramiXsrv.h" + +/** Change the "screen" window attributes by resizing the actual window + * on the back-end display (if necessary). */ +static void dmxConfigureScreenWindow(int idx, + int x, int y, int w, int h) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + ScreenPtr pScreen = screenInfo.screens[idx]; + + /* Resize "screen" window */ + if (dmxScreen->scrnX != x || + dmxScreen->scrnY != y || + dmxScreen->scrnWidth != w || + dmxScreen->scrnHeight != h) { + dmxResizeScreenWindow(pScreen, x, y, w, h); + } + + /* Change "screen" window values */ + dmxScreen->scrnX = x; + dmxScreen->scrnY = y; + dmxScreen->scrnWidth = w; + dmxScreen->scrnHeight = h; +} + +/** Change the "root" window position and size by resizing the actual + * window on the back-end display (if necessary) and updating all of + * DMX's resources by calling #dmxUpdateScreenResources. */ +static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + WindowPtr pRoot = screenInfo.screens[idx]->root; + + /* NOTE: Either this function or the ones that it calls must handle + * the case where w == 0 || h == 0. Currently, the functions that + * this one calls handle that case. */ + + /* 1. Resize "root" window */ + if (dmxScreen->rootX != x || + dmxScreen->rootY != y || + dmxScreen->rootWidth != w || + dmxScreen->rootHeight != h) { + dmxResizeRootWindow(pRoot, x, y, w, h); + } + + /* 2. Update all of the screen's resources associated with this root + * window */ + if (dmxScreen->rootWidth != w || + dmxScreen->rootHeight != h) { + dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h); + } + + /* Change "root" window values */ + dmxScreen->rootX = x; + dmxScreen->rootY = y; + dmxScreen->rootWidth = w; + dmxScreen->rootHeight = h; +} + +/** Change the "root" window's origin by updating DMX's internal data + * structures (dix and Xinerama) to use the new origin and adjust the + * positions of windows that overlap this "root" window. */ +static void dmxSetRootWindowOrigin(int idx, int x, int y) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + ScreenPtr pScreen = screenInfo.screens[idx]; + WindowPtr pRoot = pScreen->root; + WindowPtr pChild; + int xoff; + int yoff; + + /* Change "root" window's origin */ + dmxScreen->rootXOrigin = x; + dmxScreen->rootYOrigin = y; + + /* Compute offsets here in case has been changed above */ + xoff = x - pScreen->x; + yoff = y - pScreen->y; + + /* Adjust the root window's position */ + pScreen->x = dmxScreen->rootXOrigin; + pScreen->y = dmxScreen->rootYOrigin; + + /* Recalculate the Xinerama regions and data structs */ + XineramaReinitData(pScreen); + + /* Adjust each of the root window's children */ + if (!idx) ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff); + pChild = pRoot->firstChild; + while (pChild) { + /* Adjust child window's position */ + pScreen->MoveWindow(pChild, + pChild->origin.x - wBorderWidth(pChild) - xoff, + pChild->origin.y - wBorderWidth(pChild) - yoff, + pChild->nextSib, + VTMove); + + /* Note that the call to MoveWindow will eventually call + * dmxPositionWindow which will automatically create a + * window if it is now exposed on screen (for lazy window + * creation optimization) and it will properly set the + * offscreen flag. + */ + + pChild = pChild->nextSib; + } +} + +/** Configure the attributes of each "screen" and "root" window. */ +int dmxConfigureScreenWindows(int nscreens, + CARD32 *screens, + DMXScreenAttributesPtr attribs, + int *errorScreen) +{ + int i; + + for (i = 0; i < nscreens; i++) { + DMXScreenAttributesPtr attr = &attribs[i]; + int idx = screens[i]; + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + + if (errorScreen) *errorScreen = i; + + if (!dmxScreen->beDisplay) return DMX_BAD_VALUE; + + /* Check for illegal values */ + if (idx < 0 || idx >= dmxNumScreens) return BadValue; + + /* The "screen" and "root" windows must have valid sizes */ + if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 || + attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0) + return DMX_BAD_VALUE; + + /* The "screen" window must fit entirely within the BE display */ + if (attr->screenWindowXoffset < 0 || + attr->screenWindowYoffset < 0 || + attr->screenWindowXoffset + + attr->screenWindowWidth > (unsigned)dmxScreen->beWidth || + attr->screenWindowYoffset + + attr->screenWindowHeight > (unsigned)dmxScreen->beHeight) + return DMX_BAD_VALUE; + + /* The "root" window must fit entirely within the "screen" window */ + if (attr->rootWindowXoffset < 0 || + attr->rootWindowYoffset < 0 || + attr->rootWindowXoffset + + attr->rootWindowWidth > attr->screenWindowWidth || + attr->rootWindowYoffset + + attr->rootWindowHeight > attr->screenWindowHeight) + return DMX_BAD_VALUE; + + /* The "root" window must not expose unaddressable coordinates */ + if (attr->rootWindowXorigin < 0 || + attr->rootWindowYorigin < 0 || + attr->rootWindowXorigin + attr->rootWindowWidth > 32767 || + attr->rootWindowYorigin + attr->rootWindowHeight > 32767) + return DMX_BAD_VALUE; + + /* The "root" window must fit within the global bounding box */ + if (attr->rootWindowXorigin + + attr->rootWindowWidth > (unsigned)dmxGlobalWidth || + attr->rootWindowYorigin + + attr->rootWindowHeight > (unsigned)dmxGlobalHeight) + return DMX_BAD_VALUE; + + /* FIXME: Handle the rest of the illegal value checking */ + } + + /* No illegal values found */ + if (errorScreen) *errorScreen = 0; + + for (i = 0; i < nscreens; i++) { + DMXScreenAttributesPtr attr = &attribs[i]; + int idx = screens[i]; + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + + dmxLog(dmxInfo, "Changing screen #%d attributes " + "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d " + "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n", + idx, + dmxScreen->scrnWidth, dmxScreen->scrnHeight, + dmxScreen->scrnX, dmxScreen->scrnY, + dmxScreen->rootWidth, dmxScreen->rootHeight, + dmxScreen->rootX, dmxScreen->rootY, + dmxScreen->rootXOrigin, dmxScreen->rootYOrigin, + attr->screenWindowWidth, attr->screenWindowHeight, + attr->screenWindowXoffset, attr->screenWindowYoffset, + attr->rootWindowWidth, attr->rootWindowHeight, + attr->rootWindowXoffset, attr->rootWindowYoffset, + attr->rootWindowXorigin, attr->rootWindowYorigin); + + /* Configure "screen" window */ + dmxConfigureScreenWindow(idx, + attr->screenWindowXoffset, + attr->screenWindowYoffset, + attr->screenWindowWidth, + attr->screenWindowHeight); + + /* Configure "root" window */ + dmxConfigureRootWindow(idx, + attr->rootWindowXoffset, + attr->rootWindowYoffset, + attr->rootWindowWidth, + attr->rootWindowHeight); + + + /* Set "root" window's origin */ + dmxSetRootWindowOrigin(idx, + attr->rootWindowXorigin, + attr->rootWindowYorigin); + } + + /* Adjust the cursor boundaries */ + dmxAdjustCursorBoundaries(); + + /* Force completion of the changes */ + dmxSync(NULL, TRUE); + + return Success; +} + +/** Configure the attributes of the global desktop. */ +int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs) +{ + if (attribs->width <= 0 || attribs->width >= 32767 || + attribs->height <= 0 || attribs->height >= 32767) + return DMX_BAD_VALUE; + + /* If the desktop is shrinking, adjust the "root" windows on each + * "screen" window to only show the visible desktop. Also, handle + * the special case where the desktop shrinks such that the it no + * longer overlaps an portion of a "screen" window. */ + if (attribs->width < dmxGlobalWidth || attribs->height < dmxGlobalHeight) { + int i; + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + if (dmxScreen->rootXOrigin + + dmxScreen->rootWidth > attribs->width || + dmxScreen->rootYOrigin + + dmxScreen->rootHeight > attribs->height) { + int w, h; + if ((w = attribs->width - dmxScreen->rootXOrigin) < 0) w = 0; + if ((h = attribs->height - dmxScreen->rootYOrigin) < 0) h = 0; + if (w > dmxScreen->scrnWidth) w = dmxScreen->scrnWidth; + if (h > dmxScreen->scrnHeight) h = dmxScreen->scrnHeight; + if (w > dmxScreen->rootWidth) w = dmxScreen->rootWidth; + if (h > dmxScreen->rootHeight) h = dmxScreen->rootHeight; + dmxConfigureRootWindow(i, + dmxScreen->rootX, + dmxScreen->rootY, + w, h); + } + } + } + + /* Set the global width/height */ + dmxSetWidthHeight(attribs->width, attribs->height); + + /* Handle shift[XY] changes */ + if (attribs->shiftX || attribs->shiftY) { + int i; + for (i = 0; i < dmxNumScreens; i++) { + ScreenPtr pScreen = screenInfo.screens[i]; + WindowPtr pChild = pScreen->root->firstChild; + while (pChild) { + /* Adjust child window's position */ + pScreen->MoveWindow(pChild, + pChild->origin.x - wBorderWidth(pChild) + - attribs->shiftX, + pChild->origin.y - wBorderWidth(pChild) + - attribs->shiftY, + pChild->nextSib, + VTMove); + + /* Note that the call to MoveWindow will eventually call + * dmxPositionWindow which will automatically create a + * window if it is now exposed on screen (for lazy + * window creation optimization) and it will properly + * set the offscreen flag. + */ + + pChild = pChild->nextSib; + } + } + } + + /* Update connection block, Xinerama, etc. -- these appears to + * already be handled in dmxConnectionBlockCallback(), which is + * called from dmxAdjustCursorBoundaries() [below]. */ + + /* Adjust the cursor boundaries */ + dmxAdjustCursorBoundaries(); + + /* Force completion of the changes */ + dmxSync(NULL, TRUE); + + return Success; +} +#endif + +/** Create the scratch GCs per depth. */ +static void dmxBECreateScratchGCs(int scrnNum) +{ + ScreenPtr pScreen = screenInfo.screens[scrnNum]; + GCPtr *ppGC = pScreen->GCperDepth; + int i; + + for (i = 0; i <= pScreen->numDepths; i++) + dmxBECreateGC(pScreen, ppGC[i]); +} + +#ifdef PANORAMIX +static Bool FoundPixImage; + +/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs + * to have its image restored. When it is found, see if there is + * another screen with the same image. If so, copy the pixmap image + * from the existing screen to the newly created pixmap. */ +static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, + pointer p) +{ + if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { + PixmapPtr pDst = (PixmapPtr)p; + int idx = pDst->drawable.pScreen->myNum; + PanoramiXRes *pXinPix = (PanoramiXRes *)value; + PixmapPtr pPix; + int i; + + dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id, + RT_PIXMAP, NullClient, DixUnknownAccess); + if (pPix != pDst) return; /* Not a match.... Next! */ + + for (i = 0; i < PanoramiXNumScreens; i++) { + PixmapPtr pSrc; + dmxPixPrivPtr pSrcPriv = NULL; + + if (i == idx) continue; /* Self replication is bad */ + + dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id, + RT_PIXMAP, NullClient, DixUnknownAccess); + pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); + if (pSrcPriv->pixmap) { + DMXScreenInfo *dmxSrcScreen = &dmxScreens[i]; + DMXScreenInfo *dmxDstScreen = &dmxScreens[idx]; + dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst); + XImage *img; + int j; + XlibGC gc = NULL; + + /* This should never happen, but just in case.... */ + if (pSrc->drawable.width != pDst->drawable.width || + pSrc->drawable.height != pDst->drawable.height) + return; + + /* Copy from src pixmap to dst pixmap */ + img = XGetImage(dmxSrcScreen->beDisplay, + pSrcPriv->pixmap, + 0, 0, + pSrc->drawable.width, pSrc->drawable.height, + -1, + ZPixmap); + + for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) { + if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) { + unsigned long m; + XGCValues v; + + m = GCFunction | GCPlaneMask | GCClipMask; + v.function = GXcopy; + v.plane_mask = AllPlanes; + v.clip_mask = None; + + gc = XCreateGC(dmxDstScreen->beDisplay, + dmxDstScreen->scrnDefDrawables[j], + m, &v); + break; + } + } + + if (gc) { + XPutImage(dmxDstScreen->beDisplay, + pDstPriv->pixmap, + gc, img, 0, 0, 0, 0, + pDst->drawable.width, pDst->drawable.height); + XFreeGC(dmxDstScreen->beDisplay, gc); + FoundPixImage = True; + } else { + dmxLog(dmxWarning, "Could not create GC\n"); + } + + XDestroyImage(img); + return; + } + } + } +} +#endif + +/** Restore the pixmap image either from another screen or from an image + * that was saved when the screen was previously detached. */ +static void dmxBERestorePixmap(PixmapPtr pPixmap) +{ +#ifdef PANORAMIX + int i; + + /* If Xinerama is not active, there's nothing we can do (see comment + * in #else below for more info). */ + if (noPanoramiXExtension) { + dmxLog(dmxWarning, "Cannot restore pixmap image\n"); + return; + } + + FoundPixImage = False; + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindAllClientResources(clients[i], dmxBERestorePixmapImage, + (pointer)pPixmap); + + /* No corresponding pixmap image was found on other screens, so we + * need to copy it from the saved image when the screen was detached + * (if available). */ + if (!FoundPixImage) { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + + if (pPixPriv->detachedImage) { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + XlibGC gc = NULL; + + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { + if (dmxScreen->bePixmapFormats[i].depth == + pPixPriv->detachedImage->depth) { + unsigned long m; + XGCValues v; + + m = GCFunction | GCPlaneMask | GCClipMask; + v.function = GXcopy; + v.plane_mask = AllPlanes; + v.clip_mask = None; + + gc = XCreateGC(dmxScreen->beDisplay, + dmxScreen->scrnDefDrawables[i], + m, &v); + break; + } + } + + if (gc) { + XPutImage(dmxScreen->beDisplay, + pPixPriv->pixmap, + gc, + pPixPriv->detachedImage, + 0, 0, 0, 0, + pPixmap->drawable.width, pPixmap->drawable.height); + XFreeGC(dmxScreen->beDisplay, gc); + } else { + dmxLog(dmxWarning, "Cannot restore pixmap image\n"); + } + + XDestroyImage(pPixPriv->detachedImage); + pPixPriv->detachedImage = NULL; + } else { + dmxLog(dmxWarning, "Cannot restore pixmap image\n"); + } + } +#else + /* If Xinerama is not enabled, then there is no other copy of the + * pixmap image that we can restore. Saving all pixmap data is not + * a feasible option since there is no mechanism for updating pixmap + * data when a screen is detached, which means that the data that + * was previously saved would most likely be out of date. */ + dmxLog(dmxWarning, "Cannot restore pixmap image\n"); + return; +#endif +} + +/** Create resources on the back-end server. This function is called + * from #dmxAttachScreen() via the dix layer's FindAllResources + * function. It walks all resources, compares them to the screen + * number passed in as \a n and calls the appropriate DMX function to + * create the associated resource on the back-end server. */ +static void dmxBECreateResources(pointer value, XID id, RESTYPE type, + pointer n) +{ + int scrnNum = (uintptr_t)n; + ScreenPtr pScreen = screenInfo.screens[scrnNum]; + + if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { + /* Window resources are created below in dmxBECreateWindowTree */ + } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) { + PixmapPtr pPix = value; + if (pPix->drawable.pScreen->myNum == scrnNum) { + dmxBECreatePixmap(pPix); + dmxBERestorePixmap(pPix); + } + } else if ((type & TypeMask) == (RT_GC & TypeMask)) { + GCPtr pGC = value; + if (pGC->pScreen->myNum == scrnNum) { + /* Create the GC on the back-end server */ + dmxBECreateGC(pScreen, pGC); + /* Create any pixmaps associated with this GC */ + if (!pGC->tileIsPixel) { + dmxBECreatePixmap(pGC->tile.pixmap); + dmxBERestorePixmap(pGC->tile.pixmap); + } + if (pGC->stipple != pScreen->PixmapPerDepth[0]) { + dmxBECreatePixmap(pGC->stipple); + dmxBERestorePixmap(pGC->stipple); + } + if (pGC->font != defaultFont) { + (void)dmxBELoadFont(pScreen, pGC->font); + } + /* Update the GC on the back-end server */ + dmxChangeGC(pGC, -1L); + } + } else if ((type & TypeMask) == (RT_FONT & TypeMask)) { + (void)dmxBELoadFont(pScreen, (FontPtr)value); + } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) { + dmxBECreateCursor(pScreen, (CursorPtr)value); + } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) { + ColormapPtr pCmap = value; + if (pCmap->pScreen->myNum == scrnNum) + (void)dmxBECreateColormap((ColormapPtr)value); +#if 0 + /* TODO: Recreate Picture and GlyphSet resources */ + } else if ((type & TypeMask) == (PictureType & TypeMask)) { + /* Picture resources are created when windows are created */ + } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { + dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value); +#endif + } else { + /* Other resource types??? */ + } +} + +/** Create window hierachy on back-end server. The window tree is + * created in a special order (bottom most subwindow first) so that the + * #dmxCreateNonRootWindow() function does not need to recursively call + * itself to create each window's parents. This is required so that we + * have the opportunity to create each window's border and background + * pixmaps (where appropriate) before the window is created. */ +static void dmxBECreateWindowTree(int idx) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + WindowPtr pRoot = screenInfo.screens[idx]->root; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot); + WindowPtr pWin; + + /* Create the pixmaps associated with the root window */ + if (!pRoot->borderIsPixel) { + dmxBECreatePixmap(pRoot->border.pixmap); + dmxBERestorePixmap(pRoot->border.pixmap); + } + if (pRoot->backgroundState == BackgroundPixmap) { + dmxBECreatePixmap(pRoot->background.pixmap); + dmxBERestorePixmap(pRoot->background.pixmap); + } + + /* Create root window first */ + dmxScreen->rootWin = pWinPriv->window = dmxCreateRootWindow(pRoot); + XMapWindow(dmxScreen->beDisplay, dmxScreen->rootWin); + + pWin = pRoot->lastChild; + while (pWin) { + pWinPriv = DMX_GET_WINDOW_PRIV(pWin); + + /* Create the pixmaps regardless of whether or not the + * window is created or not due to lazy window creation. + */ + if (!pWin->borderIsPixel) { + dmxBECreatePixmap(pWin->border.pixmap); + dmxBERestorePixmap(pWin->border.pixmap); + } + if (pWin->backgroundState == BackgroundPixmap) { + dmxBECreatePixmap(pWin->background.pixmap); + dmxBERestorePixmap(pWin->background.pixmap); + } + + /* Reset the window attributes */ + dmxGetDefaultWindowAttributes(pWin, + &pWinPriv->cmap, + &pWinPriv->visual); + + /* Create the window */ + if (pWinPriv->mapped && !pWinPriv->offscreen) + dmxCreateAndRealizeWindow(pWin, TRUE); + + /* Next, create the bottom-most child */ + if (pWin->lastChild) { + pWin = pWin->lastChild; + continue; + } + + /* If the window has no children, move on to the next higher window */ + while (!pWin->prevSib && (pWin != pRoot)) + pWin = pWin->parent; + + if (pWin->prevSib) { + pWin = pWin->prevSib; + continue; + } + + /* When we reach the root window, we are finished */ + if (pWin == pRoot) + break; + } +} + +/* Refresh screen by generating exposure events for all windows */ +static void dmxForceExposures(int idx) +{ + ScreenPtr pScreen = screenInfo.screens[idx]; + WindowPtr pRoot = pScreen->root; + Bool anyMarked = FALSE; + WindowPtr pChild; + + for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) + anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild, + (WindowPtr *)NULL); + if (anyMarked) { + /* If any windows have been marked, set the root window's + * clipList to be broken since it will be recalculated in + * ValidateTree() + */ + RegionBreak(&pRoot->clipList); + pScreen->ValidateTree(pRoot, NULL, VTBroken); + pScreen->HandleExposures(pRoot); + if (pScreen->PostValidateTree) + pScreen->PostValidateTree(pRoot, NULL, VTBroken); + } +} + +/** Compare the new and old screens to see if they are compatible. */ +static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old) +{ + int i; + + if (new->beWidth != old->beWidth) return FALSE; + if (new->beHeight != old->beHeight) return FALSE; + if (new->beDepth != old->beDepth) return FALSE; + if (new->beBPP != old->beBPP) return FALSE; + + if (new->beNumDepths != old->beNumDepths) return FALSE; + for (i = 0; i < old->beNumDepths; i++) + if (new->beDepths[i] != old->beDepths[i]) return FALSE; + + if (new->beNumPixmapFormats != old->beNumPixmapFormats) return FALSE; + for (i = 0; i < old->beNumPixmapFormats; i++) { + if (new->bePixmapFormats[i].depth != + old->bePixmapFormats[i].depth) return FALSE; + if (new->bePixmapFormats[i].bits_per_pixel != + old->bePixmapFormats[i].bits_per_pixel) return FALSE; + if (new->bePixmapFormats[i].scanline_pad != + old->bePixmapFormats[i].scanline_pad) return FALSE; + } + + if (new->beNumVisuals != old->beNumVisuals) return FALSE; + for (i = 0; i < old->beNumVisuals; i++) { + if (new->beVisuals[i].visualid != + old->beVisuals[i].visualid) return FALSE; + if (new->beVisuals[i].screen != + old->beVisuals[i].screen) return FALSE; + if (new->beVisuals[i].depth != + old->beVisuals[i].depth) return FALSE; + if (new->beVisuals[i].class != + old->beVisuals[i].class) return FALSE; + if (new->beVisuals[i].red_mask != + old->beVisuals[i].red_mask) return FALSE; + if (new->beVisuals[i].green_mask != + old->beVisuals[i].green_mask) return FALSE; + if (new->beVisuals[i].blue_mask != + old->beVisuals[i].blue_mask) return FALSE; + if (new->beVisuals[i].colormap_size != + old->beVisuals[i].colormap_size) return FALSE; + if (new->beVisuals[i].bits_per_rgb != + old->beVisuals[i].bits_per_rgb) return FALSE; + } + + if (new->beDefVisualIndex != old->beDefVisualIndex) return FALSE; + + return TRUE; +} + +/** Restore Render's picture */ +static void dmxBERestoreRenderPict(pointer value, XID id, pointer n) +{ + PicturePtr pPicture = value; /* The picture */ + DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */ + int scrnNum = (uintptr_t)n; + + if (pDraw->pScreen->myNum != scrnNum) { + /* Picture not on the screen we are restoring*/ + return; + } + + if (pDraw->type == DRAWABLE_PIXMAP) { + PixmapPtr pPixmap = (PixmapPtr)pDraw; + + /* Create and restore the pixmap drawable */ + dmxBECreatePixmap(pPixmap); + dmxBERestorePixmap(pPixmap); + } + + dmxBECreatePicture(pPicture); +} + +/** Restore Render's glyphs */ +static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n) +{ + GlyphSetPtr glyphSet = value; + int scrnNum = (uintptr_t)n; + dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum]; + GlyphRefPtr table; + char *images; + Glyph *gids; + XGlyphInfo *glyphs; + char *pos; + int beret; + int len_images = 0; + int i; + int ctr; + + if (glyphPriv->glyphSets[scrnNum]) { + /* Only restore glyphs on the screen we are attaching */ + return; + } + + /* First we must create the glyph set on the backend. */ + if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) { + dmxLog(dmxWarning, + "\tdmxBERestoreRenderGlyph failed to create glyphset!\n"); + return; + } + + /* Now for the complex part, restore the glyph data */ + table = glyphSet->hash.table; + + /* We need to know how much memory to allocate for this part */ + for (i = 0; i < glyphSet->hash.hashSet->size; i++) { + GlyphRefPtr gr = &table[i]; + GlyphPtr gl = gr->glyph; + + if (!gl || gl == DeletedGlyph) continue; + len_images += gl->size - sizeof(gl->info); + } + + /* Now allocate the memory we need */ + images = calloc(len_images, sizeof(char)); + gids = malloc(glyphSet->hash.tableEntries*sizeof(Glyph)); + glyphs = malloc(glyphSet->hash.tableEntries*sizeof(XGlyphInfo)); + + pos = images; + ctr = 0; + + /* Fill the allocated memory with the proper data */ + for (i = 0; i < glyphSet->hash.hashSet->size; i++) { + GlyphRefPtr gr = &table[i]; + GlyphPtr gl = gr->glyph; + + if (!gl || gl == DeletedGlyph) continue; + + /* First lets put the data into gids */ + gids[ctr] = gr->signature; + + /* Next do the glyphs data structures */ + glyphs[ctr].width = gl->info.width; + glyphs[ctr].height = gl->info.height; + glyphs[ctr].x = gl->info.x; + glyphs[ctr].y = gl->info.y; + glyphs[ctr].xOff = gl->info.xOff; + glyphs[ctr].yOff = gl->info.yOff; + + /* Copy the images from the DIX's data into the buffer */ + memcpy(pos, gl+1, gl->size - sizeof(gl->info)); + pos += gl->size - sizeof(gl->info); + ctr++; + } + + /* Now restore the glyph data */ + XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum], + gids,glyphs, glyphSet->hash.tableEntries, images, + len_images); + + /* Clean up */ + free(images); + free(gids); + free(glyphs); +} + +/** Reattach previously detached back-end screen. */ +int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) +{ + ScreenPtr pScreen; + DMXScreenInfo *dmxScreen; + CARD32 scrnNum = idx; + DMXScreenInfo oldDMXScreen; + int i; + + /* Return failure if dynamic addition/removal of screens is disabled */ + if (!dmxAddRemoveScreens) { + dmxLog(dmxWarning, + "Attempting to add a screen, but the AddRemoveScreen\n"); + dmxLog(dmxWarning, + "extension has not been enabled. To enable this extension\n"); + dmxLog(dmxWarning, + "add the \"-addremovescreens\" option either to the command\n"); + dmxLog(dmxWarning, + "line or in the configuration file.\n"); + return 1; + } + + /* Cannot add a screen that does not exist */ + if (idx < 0 || idx >= dmxNumScreens) return 1; + pScreen = screenInfo.screens[idx]; + dmxScreen = &dmxScreens[idx]; + + /* Cannot attach to a screen that is already opened */ + if (dmxScreen->beDisplay) { + dmxLog(dmxWarning, + "Attempting to add screen #%d but a screen already exists\n", + idx); + return 1; + } + + dmxLogOutput(dmxScreen, "Attaching screen #%d\n", idx); + + /* Save old info */ + oldDMXScreen = *dmxScreen; + + /* Copy the name to the new screen */ + dmxScreen->name = strdup(attr->displayName); + + /* Open display and get all of the screen info */ + if (!dmxOpenDisplay(dmxScreen)) { + dmxLog(dmxWarning, + "dmxOpenDisplay: Unable to open display %s\n", + dmxScreen->name); + + /* Restore the old screen */ + *dmxScreen = oldDMXScreen; + return 1; + } + + dmxSetErrorHandler(dmxScreen); + dmxCheckForWM(dmxScreen); + dmxGetScreenAttribs(dmxScreen); + + if (!dmxGetVisualInfo(dmxScreen)) { + dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n"); + XFree(dmxScreen->beVisuals); + XCloseDisplay(dmxScreen->beDisplay); + + /* Restore the old screen */ + *dmxScreen = oldDMXScreen; + return 1; + } + + dmxGetColormaps(dmxScreen); + dmxGetPixmapFormats(dmxScreen); + + /* Verify that the screen to be added has the same info as the + * previously added screen. */ + if (!dmxCompareScreens(dmxScreen, &oldDMXScreen)) { + dmxLog(dmxWarning, + "New screen data (%s) does not match previously\n", + dmxScreen->name); + dmxLog(dmxWarning, + "attached screen data (%s)\n", + oldDMXScreen.name); + dmxLog(dmxWarning, + "All data must match in order to attach to screen #%d\n", + idx); + XFree(dmxScreen->beVisuals); + XFree(dmxScreen->beDepths); + XFree(dmxScreen->bePixmapFormats); + XCloseDisplay(dmxScreen->beDisplay); + + /* Restore the old screen */ + *dmxScreen = oldDMXScreen; + return 1; + } + + /* Initialize the BE screen resources */ + dmxBEScreenInit(idx, screenInfo.screens[idx]); + + /* TODO: Handle GLX visual initialization. GLXProxy needs to be + * updated to handle dynamic addition/removal of screens. */ + + /* Create default stipple */ + dmxBECreatePixmap(pScreen->PixmapPerDepth[0]); + dmxBERestorePixmap(pScreen->PixmapPerDepth[0]); + + /* Create the scratch GCs */ + dmxBECreateScratchGCs(idx); + + /* Create the default font */ + (void)dmxBELoadFont(pScreen, defaultFont); + + /* Create all resources that don't depend on windows */ + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindAllClientResources(clients[i], dmxBECreateResources, + (pointer)(uintptr_t)idx); + + /* Create window hierarchy (top down) */ + dmxBECreateWindowTree(idx); + + /* Restore the picture state for RENDER */ + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindClientResourcesByType(clients[i],PictureType, + dmxBERestoreRenderPict, + (pointer)(uintptr_t)idx); + + /* Restore the glyph state for RENDER */ + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindClientResourcesByType(clients[i],GlyphSetType, + dmxBERestoreRenderGlyph, + (pointer)(uintptr_t)idx); + + /* Refresh screen by generating exposure events for all windows */ + dmxForceExposures(idx); + + dmxSync(&dmxScreens[idx], TRUE); + + /* We used these to compare the old and new screens. They are no + * longer needed since we have a newly attached screen, so we can + * now free the old screen's resources. */ + XFree(oldDMXScreen.beVisuals); + XFree(oldDMXScreen.beDepths); + XFree(oldDMXScreen.bePixmapFormats); + /* TODO: should oldDMXScreen.name be freed?? */ + +#ifdef PANORAMIX + if (!noPanoramiXExtension) + return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL); + else +#endif + return 0; /* Success */ +} + +/* + * Resources that may have state on the BE server and need to be freed: + * + * RT_NONE + * RT_WINDOW + * RT_PIXMAP + * RT_GC + * RT_FONT + * RT_CURSOR + * RT_COLORMAP + * RT_CMAPENTRY + * RT_OTHERCLIENT + * RT_PASSIVEGRAB + * XRT_WINDOW + * XRT_PIXMAP + * XRT_GC + * XRT_COLORMAP + * XRT_PICTURE + * PictureType + * PictFormatType + * GlyphSetType + * ClientType + * EventType + * RT_INPUTCLIENT + * XETrapType + * RTCounter + * RTAwait + * RTAlarmClient + * RT_XKBCLIENT + * RTContext + * TagResType + * StalledResType + * SecurityAuthorizationResType + * RTEventClient + * __glXContextRes + * __glXClientRes + * __glXPixmapRes + * __glXWindowRes + * __glXPbufferRes + */ + +#ifdef PANORAMIX +/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs + * to have its image saved. */ +static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, + pointer p) +{ + if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { + PixmapPtr pDst = (PixmapPtr)p; + int idx = pDst->drawable.pScreen->myNum; + PanoramiXRes *pXinPix = (PanoramiXRes *)value; + PixmapPtr pPix; + int i; + + dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id, + RT_PIXMAP, NullClient, DixUnknownAccess); + if (pPix != pDst) return; /* Not a match.... Next! */ + + for (i = 0; i < PanoramiXNumScreens; i++) { + PixmapPtr pSrc; + dmxPixPrivPtr pSrcPriv = NULL; + + if (i == idx) continue; /* Self replication is bad */ + + dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id, + RT_PIXMAP, NullClient, DixUnknownAccess); + pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); + if (pSrcPriv->pixmap) { + FoundPixImage = True; + return; + } + } + } +} +#endif + +/** Save the pixmap image only when there is not another screen with + * that pixmap from which the image can be read when the screen is + * reattached. To do this, we first try to find a pixmap on another + * screen corresponding to the one we are trying to save. If we find + * one, then we do not need to save the image data since during + * reattachment, the image data can be read from that other pixmap. + * However, if we do not find one, then we need to save the image data. + * The common case for these are for the default stipple and root + * tile. */ +static void dmxBESavePixmap(PixmapPtr pPixmap) +{ +#ifdef PANORAMIX + int i; + + /* If Xinerama is not active, there's nothing we can do (see comment + * in #else below for more info). */ + if (noPanoramiXExtension) return; + + FoundPixImage = False; + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindAllClientResources(clients[i], dmxBEFindPixmapImage, + (pointer)pPixmap); + + /* Save the image only if there is no other screens that have a + * pixmap that corresponds to the one we are trying to save. */ + if (!FoundPixImage) { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + + if (!pPixPriv->detachedImage) { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay, + pPixPriv->pixmap, + 0, 0, + pPixmap->drawable.width, + pPixmap->drawable.height, + -1, + ZPixmap); + if (!pPixPriv->detachedImage) + dmxLog(dmxWarning, "Cannot save pixmap image\n"); + } + } +#else + /* NOTE: The only time there is a pixmap on another screen that + * corresponds to the one we are trying to save is when Xinerama is + * active. Otherwise, the pixmap image data is only stored on a + * single screen, which means that once it is detached, that data is + * lost. We could save the data here, but then that would require + * us to implement the ability for Xdmx to keep the pixmap up to + * date while the screen is detached, which is beyond the scope of + * the current project. */ + return; +#endif +} + +/** Destroy resources on the back-end server. This function is called + * from #dmxDetachScreen() via the dix layer's FindAllResources + * function. It walks all resources, compares them to the screen + * number passed in as \a n and calls the appropriate DMX function to + * free the associated resource on the back-end server. */ +static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type, + pointer n) +{ + int scrnNum = (uintptr_t)n; + ScreenPtr pScreen = screenInfo.screens[scrnNum]; + + if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { + /* Window resources are destroyed below in dmxBEDestroyWindowTree */ + } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) { + PixmapPtr pPix = value; + if (pPix->drawable.pScreen->myNum == scrnNum) { + dmxBESavePixmap(pPix); + dmxBEFreePixmap(pPix); + } + } else if ((type & TypeMask) == (RT_GC & TypeMask)) { + GCPtr pGC = value; + if (pGC->pScreen->myNum == scrnNum) + dmxBEFreeGC(pGC); + } else if ((type & TypeMask) == (RT_FONT & TypeMask)) { + dmxBEFreeFont(pScreen, (FontPtr)value); + } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) { + dmxBEFreeCursor(pScreen, (CursorPtr)value); + } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) { + ColormapPtr pCmap = value; + if (pCmap->pScreen->myNum == scrnNum) + dmxBEFreeColormap((ColormapPtr)value); + } else if ((type & TypeMask) == (PictureType & TypeMask)) { + PicturePtr pPict = value; + if (pPict->pDrawable->pScreen->myNum == scrnNum) { + /* Free the pixmaps on the backend if needed */ + if (pPict->pDrawable->type == DRAWABLE_PIXMAP) { + PixmapPtr pPixmap = (PixmapPtr)(pPict->pDrawable); + dmxBESavePixmap(pPixmap); + dmxBEFreePixmap(pPixmap); + } + dmxBEFreePicture((PicturePtr)value); + } + } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { + dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value); + } else { + /* Other resource types??? */ + } +} + +/** Destroy the scratch GCs that are created per depth. */ +static void dmxBEDestroyScratchGCs(int scrnNum) +{ + ScreenPtr pScreen = screenInfo.screens[scrnNum]; + GCPtr *ppGC = pScreen->GCperDepth; + int i; + + for (i = 0; i <= pScreen->numDepths; i++) + dmxBEFreeGC(ppGC[i]); +} + +/** Destroy window hierachy on back-end server. To ensure that all + * XDestroyWindow() calls succeed, they must be performed in a bottom + * up order so that windows are not destroyed before their children. + * XDestroyWindow(), which is called from #dmxBEDestroyWindow(), will + * destroy a window as well as all of it's children. */ +static void dmxBEDestroyWindowTree(int idx) +{ + WindowPtr pWin = screenInfo.screens[idx]->root; + WindowPtr pChild = pWin; + + while (1) { + if (pChild->firstChild) { + pChild = pChild->firstChild; + continue; + } + + /* Destroy the window */ + dmxBEDestroyWindow(pChild); + + /* Make sure we destroy the window's border and background + * pixmaps if they exist */ + if (!pChild->borderIsPixel) { + dmxBESavePixmap(pChild->border.pixmap); + dmxBEFreePixmap(pChild->border.pixmap); + } + if (pChild->backgroundState == BackgroundPixmap) { + dmxBESavePixmap(pChild->background.pixmap); + dmxBEFreePixmap(pChild->background.pixmap); + } + + while (!pChild->nextSib && (pChild != pWin)) { + pChild = pChild->parent; + dmxBEDestroyWindow(pChild); + if (!pChild->borderIsPixel) { + dmxBESavePixmap(pChild->border.pixmap); + dmxBEFreePixmap(pChild->border.pixmap); + } + if (pChild->backgroundState == BackgroundPixmap) { + dmxBESavePixmap(pChild->background.pixmap); + dmxBEFreePixmap(pChild->background.pixmap); + } + } + + if (pChild == pWin) + break; + + pChild = pChild->nextSib; + } +} + +/** Detach back-end screen. */ +int dmxDetachScreen(int idx) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + int i; + + /* Return failure if dynamic addition/removal of screens is disabled */ + if (!dmxAddRemoveScreens) { + dmxLog(dmxWarning, + "Attempting to remove a screen, but the AddRemoveScreen\n"); + dmxLog(dmxWarning, + "extension has not been enabled. To enable this extension\n"); + dmxLog(dmxWarning, + "add the \"-addremovescreens\" option either to the command\n"); + dmxLog(dmxWarning, + "line or in the configuration file.\n"); + return 1; + } + + /* Cannot remove a screen that does not exist */ + if (idx < 0 || idx >= dmxNumScreens) return 1; + + /* Cannot detach from a screen that is not opened */ + if (!dmxScreen->beDisplay) { + dmxLog(dmxWarning, + "Attempting to remove screen #%d but it has not been opened\n", + idx); + return 1; + } + + dmxLogOutput(dmxScreen, "Detaching screen #%d\n", idx); + + /* Detach input */ + dmxInputDetachAll(dmxScreen); + + /* Save all relevant state (TODO) */ + + /* Free all non-window resources related to this screen */ + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindAllClientResources(clients[i], dmxBEDestroyResources, + (pointer)(uintptr_t)idx); + + /* Free scratch GCs */ + dmxBEDestroyScratchGCs(idx); + + /* Free window resources related to this screen */ + dmxBEDestroyWindowTree(idx); + + /* Free default stipple */ + dmxBESavePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]); + dmxBEFreePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]); + + /* Free the remaining screen resources and close the screen */ + dmxBECloseScreen(screenInfo.screens[idx]); + + /* Adjust the cursor boundaries (paints detached console window) */ + dmxAdjustCursorBoundaries(); + + return 0; /* Success */ +} diff --git a/xorg-server/hw/dmx/dmxgc.c b/xorg-server/hw/dmx/dmxgc.c index 10e93c110..f10f9a074 100644 --- a/xorg-server/hw/dmx/dmxgc.c +++ b/xorg-server/hw/dmx/dmxgc.c @@ -1,421 +1,416 @@ -/* - * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation on the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * Authors: - * Kevin E. Martin - * - */ - -/** \file - * This file provides support for GCs. */ - -#ifdef HAVE_DMX_CONFIG_H -#include -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxgc.h" -#include "dmxgcops.h" -#include "dmxpixmap.h" -#include "dmxfont.h" - -#include "gcstruct.h" -#include "pixmapstr.h" -#include "migc.h" - -static GCFuncs dmxGCFuncs = { - dmxValidateGC, - dmxChangeGC, - dmxCopyGC, - dmxDestroyGC, - dmxChangeClip, - dmxDestroyClip, - dmxCopyClip, -}; - -static GCOps dmxGCOps = { - dmxFillSpans, - dmxSetSpans, - dmxPutImage, - dmxCopyArea, - dmxCopyPlane, - dmxPolyPoint, - dmxPolylines, - dmxPolySegment, - dmxPolyRectangle, - dmxPolyArc, - dmxFillPolygon, - dmxPolyFillRect, - dmxPolyFillArc, - dmxPolyText8, - dmxPolyText16, - dmxImageText8, - dmxImageText16, - dmxImageGlyphBlt, - dmxPolyGlyphBlt, - dmxPushPixels -}; - -/** Initialize the GC on \a pScreen */ -Bool dmxInitGC(ScreenPtr pScreen) -{ - if (!dixRegisterPrivateKey(&dmxGCPrivateKeyRec, PRIVATE_GC, sizeof(dmxGCPrivRec))) - return FALSE; - return TRUE; -} - -/** Create the GC on the back-end server. */ -void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - int i; - - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) { - unsigned long mask; - XGCValues gcvals; - - mask = GCGraphicsExposures; - gcvals.graphics_exposures = FALSE; - - /* Create GC in the back-end servers */ - pGCPriv->gc = XCreateGC(dmxScreen->beDisplay, - dmxScreen->scrnDefDrawables[i], - mask, &gcvals); - break; - } - } -} - -/** Create a graphics context on the back-end server associated /a pGC's - * screen. */ -Bool dmxCreateGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Bool ret; - - DMX_UNWRAP(CreateGC, dmxScreen, pScreen); - if ((ret = pScreen->CreateGC(pGC))) { - /* Save the old funcs */ - pGCPriv->funcs = pGC->funcs; - pGCPriv->ops = NULL; - - pGC->funcs = &dmxGCFuncs; - - if (dmxScreen->beDisplay) { - dmxBECreateGC(pScreen, pGC); - } else { - pGCPriv->gc = NULL; - } - - /* Check for "magic special case" - * 1. see CreateGC in dix/gc.c for more info - * 2. see dmxChangeGC for more info - */ - pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap); - } - DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); - - return ret; -} - -/** Validate a graphics context, \a pGC, locally in the DMX server and - * recompute the composite clip, if necessary. */ -void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) -{ - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - - DMX_GC_FUNC_PROLOGUE(pGC); -#if 0 - pGC->funcs->ValidateGC(pGC, changes, pDrawable); -#endif - - if (pDrawable->type == DRAWABLE_WINDOW || - pDrawable->type == DRAWABLE_PIXMAP) { - /* Save the old ops, since we're about to change the ops in the - * epilogue. - */ - pGCPriv->ops = pGC->ops; - } else { - pGCPriv->ops = NULL; - } - - /* If the client clip is different or moved OR the subwindowMode has - * changed OR the window's clip has changed since the last - * validation, then we need to recompute the composite clip. - */ - if ((changes & (GCClipXOrigin | - GCClipYOrigin | - GCClipMask | - GCSubwindowMode)) || - (pDrawable->serialNumber != - (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) { - miComputeCompositeClip(pGC, pDrawable); - } - - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Set the values in the graphics context on the back-end server - * associated with \a pGC's screen. */ -void dmxChangeGC(GCPtr pGC, unsigned long mask) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - XGCValues v; - - DMX_GC_FUNC_PROLOGUE(pGC); -#if 0 - pGC->funcs->ChangeGC(pGC, mask); -#endif - - /* Handle "magic special case" from CreateGC */ - if (pGCPriv->msc) { - /* The "magic special case" is used to handle the case where a - * foreground pixel is set when the GC is created so that a - * "pseudo default-tile" can be created and used in case the - * fillstyle was set to FillTiled. This specific case is tested - * in xtest (XCreateGC test #3). What has happened in dix by - * the time it reaches here is (1) the pGC->tile.pixel has been - * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a - * tile has also been set, then pGC->tileIsPixel is unset and - * pGC->tile.pixmap is initialized; else, the default tile is - * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is - * initialized to the "pseudo default-tile". In either case, - * pGC->tile.pixmap is set; however, in the "magic special case" - * the mask is not updated to allow us to detect that we should - * initialize the GCTile in the back-end server. Thus, we catch - * this case in dmxCreateGC and add GCTile to the mask here. - * Are there any cases that I've missed? - */ - - /* Make sure that the tile.pixmap is set, just in case the user - * set GCTile in the mask but forgot to set vals.pixmap - */ - if (pGC->tile.pixmap) mask |= GCTile; - - /* This only happens once when the GC is created */ - pGCPriv->msc = FALSE; - } - - /* Update back-end server's gc */ - if (mask & GCFunction) v.function = pGC->alu; - if (mask & GCPlaneMask) v.plane_mask = pGC->planemask; - if (mask & GCForeground) v.foreground = pGC->fgPixel; - if (mask & GCBackground) v.background = pGC->bgPixel; - if (mask & GCLineWidth) v.line_width = pGC->lineWidth; - if (mask & GCLineStyle) v.line_style = pGC->lineStyle; - if (mask & GCCapStyle) v.cap_style = pGC->capStyle; - if (mask & GCJoinStyle) v.join_style = pGC->joinStyle; - if (mask & GCFillStyle) v.fill_style = pGC->fillStyle; - if (mask & GCFillRule) v.fill_rule = pGC->fillRule; - if (mask & GCTile) { - if (pGC->tileIsPixel) { - mask &= ~GCTile; - } else { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap); - v.tile = (Drawable)pPixPriv->pixmap; - } - } - if (mask & GCStipple) { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple); - v.stipple = (Drawable)pPixPriv->pixmap; - } - if (mask & GCTileStipXOrigin) v.ts_x_origin = pGC->patOrg.x; - if (mask & GCTileStipYOrigin) v.ts_y_origin = pGC->patOrg.y; - if (mask & GCFont) { - if (dmxScreen->beDisplay) { - dmxFontPrivPtr pFontPriv; - pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex); - v.font = pFontPriv->font[pScreen->myNum]->fid; - } else { - mask &= ~GCFont; - } - } - if (mask & GCSubwindowMode) v.subwindow_mode = pGC->subWindowMode; - - /* Graphics exposures are not needed on the back-ends since they can - be generated on the front-end thereby saving bandwidth. */ - if (mask & GCGraphicsExposures) mask &= ~GCGraphicsExposures; - - if (mask & GCClipXOrigin) v.clip_x_origin = pGC->clipOrg.x; - if (mask & GCClipYOrigin) v.clip_y_origin = pGC->clipOrg.y; - if (mask & GCClipMask) mask &= ~GCClipMask; /* See ChangeClip */ - if (mask & GCDashOffset) v.dash_offset = pGC->dashOffset; - if (mask & GCDashList) { - mask &= ~GCDashList; - if (dmxScreen->beDisplay) - XSetDashes(dmxScreen->beDisplay, pGCPriv->gc, - pGC->dashOffset, (char *)pGC->dash, - pGC->numInDashList); - } - if (mask & GCArcMode) v.arc_mode = pGC->arcMode; - - if (mask && dmxScreen->beDisplay) { - XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v); - dmxSync(dmxScreen, FALSE); - } - - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Copy \a pGCSrc to \a pGCDst on the back-end server associated with - * \a pGCSrc's screen. */ -void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst) -{ - ScreenPtr pScreen = pGCSrc->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc); - dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst); - - DMX_GC_FUNC_PROLOGUE(pGCDst); - pGCDst->funcs->CopyGC(pGCSrc, changes, pGCDst); - - /* Copy the GC on the back-end server */ - if (dmxScreen->beDisplay) - XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc); - - DMX_GC_FUNC_EPILOGUE(pGCDst); -} - -/** Free the \a pGC on the back-end server. */ -Bool dmxBEFreeGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - - if (pGCPriv->gc) { - XFreeGC(dmxScreen->beDisplay, pGCPriv->gc); - pGCPriv->gc = NULL; - return TRUE; - } - - return FALSE; -} - -/** Destroy the graphics context, \a pGC and free the corresponding GC - * on the back-end server. */ -void dmxDestroyGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - DMX_GC_FUNC_PROLOGUE(pGC); - - /* Free the GC on the back-end server */ - if (dmxScreen->beDisplay) - dmxBEFreeGC(pGC); - - pGC->funcs->DestroyGC(pGC); - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Change the clip rects for a GC. */ -void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - XRectangle *pRects; - BoxPtr pBox; - int i, nRects; - - DMX_GC_FUNC_PROLOGUE(pGC); - pGC->funcs->ChangeClip(pGC, type, pvalue, nrects); - - /* Set the client clip on the back-end server */ - switch (pGC->clientClipType) { - case CT_NONE: - if (dmxScreen->beDisplay) - XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); - break; - - case CT_REGION: - if (dmxScreen->beDisplay) { - nRects = RegionNumRects((RegionPtr)pGC->clientClip); - pRects = malloc(nRects * sizeof(*pRects)); - pBox = RegionRects((RegionPtr)pGC->clientClip); - - for (i = 0; i < nRects; i++) { - pRects[i].x = pBox[i].x1; - pRects[i].y = pBox[i].y1; - pRects[i].width = pBox[i].x2 - pBox[i].x1; - pRects[i].height = pBox[i].y2 - pBox[i].y1; - } - - XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc, - pGC->clipOrg.x, pGC->clipOrg.y, - pRects, nRects, Unsorted); - - free(pRects); - } - break; - - case CT_PIXMAP: - case CT_UNSORTED: - case CT_YSORTED: - case CT_YXSORTED: - case CT_YXBANDED: - /* These clip types are condensed down to either NONE or REGION - in the mi code */ - break; - } - - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Destroy a GC's clip rects. */ -void dmxDestroyClip(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - - DMX_GC_FUNC_PROLOGUE(pGC); - pGC->funcs->DestroyClip(pGC); - - /* Set the client clip on the back-end server to None */ - if (dmxScreen->beDisplay) - XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); - - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Copy a GC's clip rects. */ -void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc) -{ - DMX_GC_FUNC_PROLOGUE(pGCDst); - pGCDst->funcs->CopyClip(pGCDst, pGCSrc); - DMX_GC_FUNC_EPILOGUE(pGCDst); -} +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * This file provides support for GCs. */ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxgc.h" +#include "dmxgcops.h" +#include "dmxpixmap.h" +#include "dmxfont.h" + +#include "gcstruct.h" +#include "pixmapstr.h" +#include "migc.h" + +static GCFuncs dmxGCFuncs = { + dmxValidateGC, + dmxChangeGC, + dmxCopyGC, + dmxDestroyGC, + dmxChangeClip, + dmxDestroyClip, + dmxCopyClip, +}; + +static GCOps dmxGCOps = { + dmxFillSpans, + dmxSetSpans, + dmxPutImage, + dmxCopyArea, + dmxCopyPlane, + dmxPolyPoint, + dmxPolylines, + dmxPolySegment, + dmxPolyRectangle, + dmxPolyArc, + dmxFillPolygon, + dmxPolyFillRect, + dmxPolyFillArc, + dmxPolyText8, + dmxPolyText16, + dmxImageText8, + dmxImageText16, + dmxImageGlyphBlt, + dmxPolyGlyphBlt, + dmxPushPixels +}; + +/** Initialize the GC on \a pScreen */ +Bool dmxInitGC(ScreenPtr pScreen) +{ + if (!dixRegisterPrivateKey(&dmxGCPrivateKeyRec, PRIVATE_GC, sizeof(dmxGCPrivRec))) + return FALSE; + return TRUE; +} + +/** Create the GC on the back-end server. */ +void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + int i; + + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { + if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) { + unsigned long mask; + XGCValues gcvals; + + mask = GCGraphicsExposures; + gcvals.graphics_exposures = FALSE; + + /* Create GC in the back-end servers */ + pGCPriv->gc = XCreateGC(dmxScreen->beDisplay, + dmxScreen->scrnDefDrawables[i], + mask, &gcvals); + break; + } + } +} + +/** Create a graphics context on the back-end server associated /a pGC's + * screen. */ +Bool dmxCreateGC(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Bool ret; + + DMX_UNWRAP(CreateGC, dmxScreen, pScreen); + if ((ret = pScreen->CreateGC(pGC))) { + /* Save the old funcs */ + pGCPriv->funcs = pGC->funcs; + pGCPriv->ops = NULL; + + pGC->funcs = &dmxGCFuncs; + + if (dmxScreen->beDisplay) { + dmxBECreateGC(pScreen, pGC); + } else { + pGCPriv->gc = NULL; + } + + /* Check for "magic special case" + * 1. see CreateGC in dix/gc.c for more info + * 2. see dmxChangeGC for more info + */ + pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap); + } + DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); + + return ret; +} + +/** Validate a graphics context, \a pGC, locally in the DMX server and + * recompute the composite clip, if necessary. */ +void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) +{ + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + + DMX_GC_FUNC_PROLOGUE(pGC); +#if 0 + pGC->funcs->ValidateGC(pGC, changes, pDrawable); +#endif + + if (pDrawable->type == DRAWABLE_WINDOW || + pDrawable->type == DRAWABLE_PIXMAP) { + /* Save the old ops, since we're about to change the ops in the + * epilogue. + */ + pGCPriv->ops = pGC->ops; + } else { + pGCPriv->ops = NULL; + } + + /* If the client clip is different or moved OR the subwindowMode has + * changed OR the window's clip has changed since the last + * validation, then we need to recompute the composite clip. + */ + if ((changes & (GCClipXOrigin | + GCClipYOrigin | + GCClipMask | + GCSubwindowMode)) || + (pDrawable->serialNumber != + (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) { + miComputeCompositeClip(pGC, pDrawable); + } + + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Set the values in the graphics context on the back-end server + * associated with \a pGC's screen. */ +void dmxChangeGC(GCPtr pGC, unsigned long mask) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + XGCValues v; + + DMX_GC_FUNC_PROLOGUE(pGC); +#if 0 + pGC->funcs->ChangeGC(pGC, mask); +#endif + + /* Handle "magic special case" from CreateGC */ + if (pGCPriv->msc) { + /* The "magic special case" is used to handle the case where a + * foreground pixel is set when the GC is created so that a + * "pseudo default-tile" can be created and used in case the + * fillstyle was set to FillTiled. This specific case is tested + * in xtest (XCreateGC test #3). What has happened in dix by + * the time it reaches here is (1) the pGC->tile.pixel has been + * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a + * tile has also been set, then pGC->tileIsPixel is unset and + * pGC->tile.pixmap is initialized; else, the default tile is + * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is + * initialized to the "pseudo default-tile". In either case, + * pGC->tile.pixmap is set; however, in the "magic special case" + * the mask is not updated to allow us to detect that we should + * initialize the GCTile in the back-end server. Thus, we catch + * this case in dmxCreateGC and add GCTile to the mask here. + * Are there any cases that I've missed? + */ + + /* Make sure that the tile.pixmap is set, just in case the user + * set GCTile in the mask but forgot to set vals.pixmap + */ + if (pGC->tile.pixmap) mask |= GCTile; + + /* This only happens once when the GC is created */ + pGCPriv->msc = FALSE; + } + + /* Update back-end server's gc */ + if (mask & GCFunction) v.function = pGC->alu; + if (mask & GCPlaneMask) v.plane_mask = pGC->planemask; + if (mask & GCForeground) v.foreground = pGC->fgPixel; + if (mask & GCBackground) v.background = pGC->bgPixel; + if (mask & GCLineWidth) v.line_width = pGC->lineWidth; + if (mask & GCLineStyle) v.line_style = pGC->lineStyle; + if (mask & GCCapStyle) v.cap_style = pGC->capStyle; + if (mask & GCJoinStyle) v.join_style = pGC->joinStyle; + if (mask & GCFillStyle) v.fill_style = pGC->fillStyle; + if (mask & GCFillRule) v.fill_rule = pGC->fillRule; + if (mask & GCTile) { + if (pGC->tileIsPixel) { + mask &= ~GCTile; + } else { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap); + v.tile = (Drawable)pPixPriv->pixmap; + } + } + if (mask & GCStipple) { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple); + v.stipple = (Drawable)pPixPriv->pixmap; + } + if (mask & GCTileStipXOrigin) v.ts_x_origin = pGC->patOrg.x; + if (mask & GCTileStipYOrigin) v.ts_y_origin = pGC->patOrg.y; + if (mask & GCFont) { + if (dmxScreen->beDisplay) { + dmxFontPrivPtr pFontPriv; + pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex); + v.font = pFontPriv->font[pScreen->myNum]->fid; + } else { + mask &= ~GCFont; + } + } + if (mask & GCSubwindowMode) v.subwindow_mode = pGC->subWindowMode; + + /* Graphics exposures are not needed on the back-ends since they can + be generated on the front-end thereby saving bandwidth. */ + if (mask & GCGraphicsExposures) mask &= ~GCGraphicsExposures; + + if (mask & GCClipXOrigin) v.clip_x_origin = pGC->clipOrg.x; + if (mask & GCClipYOrigin) v.clip_y_origin = pGC->clipOrg.y; + if (mask & GCClipMask) mask &= ~GCClipMask; /* See ChangeClip */ + if (mask & GCDashOffset) v.dash_offset = pGC->dashOffset; + if (mask & GCDashList) { + mask &= ~GCDashList; + if (dmxScreen->beDisplay) + XSetDashes(dmxScreen->beDisplay, pGCPriv->gc, + pGC->dashOffset, (char *)pGC->dash, + pGC->numInDashList); + } + if (mask & GCArcMode) v.arc_mode = pGC->arcMode; + + if (mask && dmxScreen->beDisplay) { + XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v); + dmxSync(dmxScreen, FALSE); + } + + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Copy \a pGCSrc to \a pGCDst on the back-end server associated with + * \a pGCSrc's screen. */ +void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst) +{ + ScreenPtr pScreen = pGCSrc->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc); + dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst); + + DMX_GC_FUNC_PROLOGUE(pGCDst); + pGCDst->funcs->CopyGC(pGCSrc, changes, pGCDst); + + /* Copy the GC on the back-end server */ + if (dmxScreen->beDisplay) + XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc); + + DMX_GC_FUNC_EPILOGUE(pGCDst); +} + +/** Free the \a pGC on the back-end server. */ +Bool dmxBEFreeGC(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + + if (pGCPriv->gc) { + XFreeGC(dmxScreen->beDisplay, pGCPriv->gc); + pGCPriv->gc = NULL; + return TRUE; + } + + return FALSE; +} + +/** Destroy the graphics context, \a pGC and free the corresponding GC + * on the back-end server. */ +void dmxDestroyGC(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + DMX_GC_FUNC_PROLOGUE(pGC); + + /* Free the GC on the back-end server */ + if (dmxScreen->beDisplay) + dmxBEFreeGC(pGC); + + pGC->funcs->DestroyGC(pGC); + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Change the clip rects for a GC. */ +void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + XRectangle *pRects; + BoxPtr pBox; + int i, nRects; + + DMX_GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ChangeClip(pGC, type, pvalue, nrects); + + /* Set the client clip on the back-end server */ + switch (pGC->clientClipType) { + case CT_NONE: + if (dmxScreen->beDisplay) + XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); + break; + + case CT_REGION: + if (dmxScreen->beDisplay) { + nRects = RegionNumRects((RegionPtr)pGC->clientClip); + pRects = malloc(nRects * sizeof(*pRects)); + pBox = RegionRects((RegionPtr)pGC->clientClip); + + for (i = 0; i < nRects; i++) { + pRects[i].x = pBox[i].x1; + pRects[i].y = pBox[i].y1; + pRects[i].width = pBox[i].x2 - pBox[i].x1; + pRects[i].height = pBox[i].y2 - pBox[i].y1; + } + + XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc, + pGC->clipOrg.x, pGC->clipOrg.y, + pRects, nRects, Unsorted); + + free(pRects); + } + break; + + case CT_PIXMAP: + /* Condensed down to REGION in the mi code */ + break; + } + + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Destroy a GC's clip rects. */ +void dmxDestroyClip(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + + DMX_GC_FUNC_PROLOGUE(pGC); + pGC->funcs->DestroyClip(pGC); + + /* Set the client clip on the back-end server to None */ + if (dmxScreen->beDisplay) + XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); + + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Copy a GC's clip rects. */ +void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc) +{ + DMX_GC_FUNC_PROLOGUE(pGCDst); + pGCDst->funcs->CopyClip(pGCDst, pGCSrc); + DMX_GC_FUNC_EPILOGUE(pGCDst); +} diff --git a/xorg-server/hw/dmx/input/dmxinputinit.c b/xorg-server/hw/dmx/input/dmxinputinit.c index 4b10ecb17..5cbd620c9 100644 --- a/xorg-server/hw/dmx/input/dmxinputinit.c +++ b/xorg-server/hw/dmx/input/dmxinputinit.c @@ -1,1306 +1,1274 @@ -/* - * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation on the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith - * - */ - -/** \file - * This file provides generic input support. Functions here set up - * input and lead to the calling of low-level device drivers for - * input. */ - -#ifdef HAVE_DMX_CONFIG_H -#include -#endif - -#define DMX_WINDOW_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxextension.h" /* For dmxInputCount */ - -#include "dmxdummy.h" -#include "dmxbackend.h" -#include "dmxconsole.h" -#include "dmxcommon.h" -#include "dmxevents.h" -#include "dmxmotion.h" -#include "dmxprop.h" -#include "config/dmxconfig.h" -#include "dmxcursor.h" - -#include "lnx-keyboard.h" -#include "lnx-ms.h" -#include "lnx-ps2.h" -#include "usb-keyboard.h" -#include "usb-mouse.h" -#include "usb-other.h" -#include "usb-common.h" - -#include "dmxsigio.h" -#include "dmxarg.h" - -#include "inputstr.h" -#include "input.h" -#include "mipointer.h" -#include "windowstr.h" -#include "mi.h" -#include "xkbsrv.h" - -#include -#include -#include "exevents.h" -#include "extinit.h" - -DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; - -static DMXLocalInputInfoRec DMXDummyMou = { - "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo -}; - -static DMXLocalInputInfoRec DMXDummyKbd = { - "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo -}; - -static DMXLocalInputInfoRec DMXBackendMou = { - "backend-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_BACKEND, 2, - dmxBackendCreatePrivate, dmxBackendDestroyPrivate, - dmxBackendInit, NULL, dmxBackendLateReInit, dmxBackendMouGetInfo, - dmxCommonMouOn, dmxCommonMouOff, dmxBackendUpdatePosition, - NULL, NULL, NULL, - dmxBackendCollectEvents, dmxBackendProcessInput, dmxBackendFunctions, NULL, - dmxCommonMouCtrl -}; - -static DMXLocalInputInfoRec DMXBackendKbd = { - "backend-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_BACKEND, - 1, /* With backend-mou or console-mou */ - dmxCommonCopyPrivate, NULL, - dmxBackendInit, NULL, NULL, dmxBackendKbdGetInfo, - dmxCommonKbdOn, dmxCommonKbdOff, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, dmxCommonKbdCtrl, dmxCommonKbdBell -}; - -static DMXLocalInputInfoRec DMXConsoleMou = { - "console-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_CONSOLE, 2, - dmxConsoleCreatePrivate, dmxConsoleDestroyPrivate, - dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleMouGetInfo, - dmxCommonMouOn, dmxCommonMouOff, dmxConsoleUpdatePosition, - NULL, NULL, NULL, - dmxConsoleCollectEvents, NULL, dmxConsoleFunctions, dmxConsoleUpdateInfo, - dmxCommonMouCtrl -}; - -static DMXLocalInputInfoRec DMXConsoleKbd = { - "console-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_CONSOLE, - 1, /* With backend-mou or console-mou */ - dmxCommonCopyPrivate, NULL, - dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleKbdGetInfo, - dmxCommonKbdOn, dmxCommonKbdOff, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, dmxCommonKbdCtrl, dmxCommonKbdBell -}; - -static DMXLocalInputInfoRec DMXCommonOth = { - "common-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_COMMON, 1, - dmxCommonCopyPrivate, NULL, - NULL, NULL, NULL, dmxCommonOthGetInfo, - dmxCommonOthOn, dmxCommonOthOff -}; - - -static DMXLocalInputInfoRec DMXLocalDevices[] = { - /* Dummy drivers that can compile on any OS */ -#ifdef __linux__ - /* Linux-specific drivers */ - { - "kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - kbdLinuxCreatePrivate, kbdLinuxDestroyPrivate, - kbdLinuxInit, NULL, NULL, kbdLinuxGetInfo, - kbdLinuxOn, kbdLinuxOff, NULL, - kbdLinuxVTPreSwitch, kbdLinuxVTPostSwitch, kbdLinuxVTSwitch, - kbdLinuxRead, NULL, NULL, NULL, - NULL, kbdLinuxCtrl, kbdLinuxBell - }, - { - "ms", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - msLinuxCreatePrivate, msLinuxDestroyPrivate, - msLinuxInit, NULL, NULL, msLinuxGetInfo, - msLinuxOn, msLinuxOff, NULL, - msLinuxVTPreSwitch, msLinuxVTPostSwitch, NULL, - msLinuxRead - }, - { - "ps2", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - ps2LinuxCreatePrivate, ps2LinuxDestroyPrivate, - ps2LinuxInit, NULL, NULL, ps2LinuxGetInfo, - ps2LinuxOn, ps2LinuxOff, NULL, - ps2LinuxVTPreSwitch, ps2LinuxVTPostSwitch, NULL, - ps2LinuxRead - }, -#endif -#ifdef __linux__ - /* USB drivers, currently only for - Linux, but relatively easy to port to - other OSs */ - { - "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - kbdUSBInit, NULL, NULL, kbdUSBGetInfo, - kbdUSBOn, usbOff, NULL, - NULL, NULL, NULL, - kbdUSBRead, NULL, NULL, NULL, - NULL, kbdUSBCtrl - }, - { - "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - mouUSBInit, NULL, NULL, mouUSBGetInfo, - mouUSBOn, usbOff, NULL, - NULL, NULL, NULL, - mouUSBRead - }, - { - "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - othUSBInit, NULL, NULL, othUSBGetInfo, - othUSBOn, usbOff, NULL, - NULL, NULL, NULL, - othUSBRead - }, -#endif - { - "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo - }, - { - "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo - }, - { NULL } /* Must be last */ -}; - - -#if 11 /*BP*/ -void -DDXRingBell(int volume, int pitch, int duration) -{ - /* NO-OP */ -} - -/* taken from kdrive/src/kinput.c: */ -static void -dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) -{ -#if 0 - KdKeyboardInfo *ki; - - for (ki = kdKeyboards; ki; ki = ki->next) { - if (ki->dixdev && ki->dixdev->id == pDevice->id) - break; - } - - if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver) - return; - - KdSetLeds(ki, ctrl->leds); - ki->bellPitch = ctrl->bell_pitch; - ki->bellDuration = ctrl->bell_duration; -#endif -} - -/* taken from kdrive/src/kinput.c: */ -static void -dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something) -{ -#if 0 - KeybdCtrl *ctrl = arg; - KdKeyboardInfo *ki = NULL; - - for (ki = kdKeyboards; ki; ki = ki->next) { - if (ki->dixdev && ki->dixdev->id == pDev->id) - break; - } - - if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) - return; - - KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); -#endif -} - -#endif /*BP*/ - -static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, - PtrCtrl *ctrl) -{ - if (!dmxLocal) return; - dmxLocal->mctrl = *ctrl; - if (dmxLocal->mCtrl) dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl); -} - -/** Change the pointer control information for the \a pDevice. If the - * device sends core events, then also change the control information - * for all of the pointer devices that send core events. */ -void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - if (dmxInput->detached) continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxChangePointerControl(dmxInput->devs[j], ctrl); - } - } else { /* Do for this device only */ - _dmxChangePointerControl(dmxLocal, ctrl); - } -} - -static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal, - KeybdCtrl *ctrl) -{ - dmxLocal->kctrl = *ctrl; - if (dmxLocal->kCtrl) { - dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl); - if (dmxLocal->pDevice->kbdfeed) { - XkbEventCauseRec cause; - XkbSetCauseUnknown(&cause); - /* Generate XKB events, as necessary */ - XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False, - NULL, &cause); - } - } -} - - -/** Change the keyboard control information for the \a pDevice. If the - * device sends core events, then also change the control information - * for all of the keyboard devices that send core events. */ -void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - if (dmxInput->detached) continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxKeyboardKbdCtrlProc(dmxInput->devs[j], ctrl); - } - } else { /* Do for this device only */ - _dmxKeyboardKbdCtrlProc(dmxLocal, ctrl); - } -} - -static void _dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent) -{ - if (dmxLocal->kBell) dmxLocal->kBell(&dmxLocal->pDevice->public, - percent, - dmxLocal->kctrl.bell, - dmxLocal->kctrl.bell_pitch, - dmxLocal->kctrl.bell_duration); -} - -/** Sound the bell on the device. If the device send core events, then - * sound the bell on all of the devices that send core events. */ -void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, - pointer ctrl, int unknown) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - if (dmxInput->detached) continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxKeyboardBellProc(dmxInput->devs[j], percent); - } - } else { /* Do for this device only */ - _dmxKeyboardBellProc(dmxLocal, percent); - } -} - -static void dmxKeyboardFreeNames(XkbComponentNamesPtr names) -{ - if (names->keycodes) XFree(names->keycodes); - if (names->types) XFree(names->types); - if (names->compat) XFree(names->compat); - if (names->symbols) XFree(names->symbols); - if (names->geometry) XFree(names->geometry); -} - - -static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info) -{ - GETDMXINPUTFROMPDEVICE; - XkbRMLVOSet rmlvo; - - rmlvo.rules = dmxConfigGetXkbRules(); - rmlvo.model = dmxConfigGetXkbModel(); - rmlvo.layout = dmxConfigGetXkbLayout(); - rmlvo.variant = dmxConfigGetXkbVariant(); - rmlvo.options = dmxConfigGetXkbOptions(); - - XkbSetRulesDflts(&rmlvo); - if (!info->force && (dmxInput->keycodes - || dmxInput->symbols - || dmxInput->geometry)) { - if (info->freenames) dmxKeyboardFreeNames(&info->names); - info->freenames = 0; - info->names.keycodes = dmxInput->keycodes; - info->names.types = NULL; - info->names.compat = NULL; - info->names.symbols = dmxInput->symbols; - info->names.geometry = dmxInput->geometry; - - dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s", - info->names.keycodes); - if (info->names.symbols && *info->names.symbols) - dmxLogInputCont(dmxInput, " %s", info->names.symbols); - if (info->names.geometry && *info->names.geometry) - dmxLogInputCont(dmxInput, " %s", info->names.geometry); - dmxLogInputCont(dmxInput, "\n"); - } else if (info->names.keycodes) { - dmxLogInput(dmxInput, "XKEYBOARD: From device: %s", - info->names.keycodes); - if (info->names.symbols && *info->names.symbols) - dmxLogInputCont(dmxInput, " %s", info->names.symbols); - if (info->names.geometry && *info->names.geometry) - dmxLogInputCont(dmxInput, " %s", info->names.geometry); - dmxLogInputCont(dmxInput, "\n"); - } else { - dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n", - dmxConfigGetXkbRules(), - dmxConfigGetXkbLayout(), - dmxConfigGetXkbModel(), - dmxConfigGetXkbVariant() - ? dmxConfigGetXkbVariant() : "", - dmxConfigGetXkbOptions() - ? dmxConfigGetXkbOptions() : ""); - } - InitKeyboardDeviceStruct(pDevice, &rmlvo, - dmxKeyboardBellProc, - dmxKeyboardKbdCtrlProc); - - if (info->freenames) dmxKeyboardFreeNames(&info->names); - - return Success; -} - - -static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) -{ - GETDMXINPUTFROMPDEVICE; - int fd; - DMXLocalInitInfo info; - int i; - Atom btn_labels[MAX_BUTTONS] = {0}; /* FIXME */ - Atom axis_labels[MAX_VALUATORS] = {0}; /* FIXME */ - - if (dmxInput->detached) return Success; - - memset(&info, 0, sizeof(info)); - switch (what) { - case DEVICE_INIT: - if (dmxLocal->init) - dmxLocal->init(pDev); - if (dmxLocal->get_info) - dmxLocal->get_info(pDev, &info); - if (info.keyboard) { /* XKEYBOARD makes this a special case */ - dmxKeyboardOn(pDevice, &info); - break; - } - if (info.keyClass) { - XkbRMLVOSet rmlvo; - - rmlvo.rules = dmxConfigGetXkbRules(); - rmlvo.model = dmxConfigGetXkbModel(); - rmlvo.layout = dmxConfigGetXkbLayout(); - rmlvo.variant = dmxConfigGetXkbVariant(); - rmlvo.options = dmxConfigGetXkbOptions(); - - InitKeyboardDeviceStruct(pDevice, - &rmlvo, - dmxBell, dmxKbdCtrl); - } - if (info.buttonClass) { - InitButtonClassDeviceStruct(pDevice, info.numButtons, - btn_labels, info.map); - } - if (info.valuatorClass) { - if (info.numRelAxes && dmxLocal->sendsCore) { - InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, - axis_labels, - GetMaximumEventsNum(), - Relative); - for (i = 0; i < info.numRelAxes; i++) - InitValuatorAxisStruct(pDevice, i, axis_labels[i], - info.minval[i], info.maxval[i], - info.res[i], - info.minres[i], info.maxres[i], - Relative); - } else if (info.numRelAxes) { - InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, - axis_labels, - dmxPointerGetMotionBufferSize(), - Relative); - for (i = 0; i < info.numRelAxes; i++) - InitValuatorAxisStruct(pDevice, i, axis_labels[i], - info.minval[i], - info.maxval[i], info.res[i], - info.minres[i], info.maxres[i], - Relative); - } else if (info.numAbsAxes) { - InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes, - axis_labels, - dmxPointerGetMotionBufferSize(), - Absolute); - for (i = 0; i < info.numAbsAxes; i++) - InitValuatorAxisStruct(pDevice, i, - axis_labels[i], - info.minval[i], info.maxval[i], - info.res[i], info.minres[i], - info.maxres[i], Absolute); - } - } - if (info.focusClass) InitFocusClassDeviceStruct(pDevice); - if (info.proximityClass) InitProximityClassDeviceStruct(pDevice); - if (info.ptrFeedbackClass) - InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl); - if (info.intFeedbackClass || info.strFeedbackClass) - dmxLog(dmxWarning, - "Integer and string feedback not supported for %s\n", - pDevice->name); - if (!info.keyboard && (info.ledFeedbackClass || info.belFeedbackClass)) - dmxLog(dmxWarning, - "Led and bel feedback not supported for non-keyboard %s\n", - pDevice->name); - break; - case DEVICE_ON: - if (!pDev->on) { - if (dmxLocal->on && (fd = dmxLocal->on(pDev)) >= 0) - dmxSigioRegister(dmxInput, fd); - pDev->on = TRUE; - } - break; - case DEVICE_OFF: - case DEVICE_CLOSE: - /* This can get called twice consecutively: once for a - * detached screen (DEVICE_OFF), and then again at server - * generation time (DEVICE_CLOSE). */ - if (pDev->on) { - dmxSigioUnregister(dmxInput); - if (dmxLocal->off) dmxLocal->off(pDev); - pDev->on = FALSE; - } - break; - } - if (info.keySyms.map && info.freemap) { - XFree(info.keySyms.map); - info.keySyms.map = NULL; - } - if (info.xkb) XkbFreeKeyboard(info.xkb, 0, True); - return Success; -} - -static void dmxProcessInputEvents(DMXInputInfo *dmxInput) -{ - int i; - - mieqProcessInputEvents(); -#if 00 /*BP*/ - miPointerUpdate(); -#endif - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->process_input) { -#if 11 /*BP*/ - miPointerUpdateSprite(dmxInput->devs[i]->pDevice); -#endif - dmxInput->devs[i]->process_input(dmxInput->devs[i]->private); - } - -#if 11 /*BP*/ - mieqProcessInputEvents(); -#endif -} - -static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput, - DMXUpdateType type, - WindowPtr pWindow) -{ - int i; - -#ifdef PANORAMIX - if (!noPanoramiXExtension && pWindow && pWindow->parent != screenInfo.screens[0]->root) - return; -#endif -#if DMX_WINDOW_DEBUG - { - const char *name = "Unknown"; - switch (type) { - case DMX_UPDATE_REALIZE: name = "Realize"; break; - case DMX_UPDATE_UNREALIZE: name = "Unrealize"; break; - case DMX_UPDATE_RESTACK: name = "Restack"; break; - case DMX_UPDATE_COPY: name = "Copy"; break; - case DMX_UPDATE_RESIZE: name = "Resize"; break; - case DMX_UPDATE_REPARENT: name = "Repaint"; break; - } - dmxLog(dmxDebug, "Window %p changed: %s\n", pWindow, name); - } -#endif - - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->update_info) - dmxInput->devs[i]->update_info(dmxInput->devs[i]->private, - type, pWindow); -} - -static void dmxCollectAll(DMXInputInfo *dmxInput) -{ - int i; - - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->collect_events) - dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice->public, - dmxMotion, - dmxEnqueue, - dmxCheckSpecialKeys, DMX_BLOCK); -} - -static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, - pointer pReadMask) -{ - DMXInputInfo *dmxInput = &dmxInputs[(int)blockData]; - static unsigned long generation = 0; - - if (generation != serverGeneration) { - generation = serverGeneration; - dmxCollectAll(dmxInput); - } -} - -static void dmxSwitchReturn(pointer p) -{ - DMXInputInfo *dmxInput = p; - int i; - - dmxLog(dmxInfo, "Returning from VT %d\n", dmxInput->vt_switched); - - if (!dmxInput->vt_switched) - dmxLog(dmxFatal, "dmxSwitchReturn called, but not switched\n"); - dmxSigioEnableInput(); - for (i = 0; i < dmxInput->numDevs; i++) - if (dmxInput->devs[i]->vt_post_switch) - dmxInput->devs[i]->vt_post_switch(dmxInput->devs[i]->private); - dmxInput->vt_switched = 0; -} - -static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask) -{ - DMXInputInfo *dmxInput = &dmxInputs[(int)blockData]; - int i; - - if (dmxInput->vt_switch_pending) { - dmxLog(dmxInfo, "Switching to VT %d\n", dmxInput->vt_switch_pending); - for (i = 0; i < dmxInput->numDevs; i++) - if (dmxInput->devs[i]->vt_pre_switch) - dmxInput->devs[i]->vt_pre_switch(dmxInput->devs[i]->private); - dmxInput->vt_switched = dmxInput->vt_switch_pending; - dmxInput->vt_switch_pending = 0; - for (i = 0; i < dmxInput->numDevs; i++) { - if (dmxInput->devs[i]->vt_switch) { - dmxSigioDisableInput(); - if (!dmxInput->devs[i]->vt_switch(dmxInput->devs[i]->private, - dmxInput->vt_switched, - dmxSwitchReturn, - dmxInput)) - dmxSwitchReturn(dmxInput); - break; /* Only call one vt_switch routine */ - } - } - } - dmxCollectAll(dmxInput); -} - -static char *dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal) -{ - static int k = 0; - static int m = 0; - static int o = 0; - static unsigned long dmxGeneration = 0; -#define LEN 32 - char * buf = malloc(LEN); - - if (dmxGeneration != serverGeneration) { - k = m = o = 0; - dmxGeneration = serverGeneration; - } - - switch (dmxLocal->type) { - case DMX_LOCAL_KEYBOARD: XmuSnprintf(buf, LEN, "Keyboard%d", k++); break; - case DMX_LOCAL_MOUSE: XmuSnprintf(buf, LEN, "Mouse%d", m++); break; - default: XmuSnprintf(buf, LEN, "Other%d", o++); break; - } - - return buf; -} - -static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) -{ - DeviceIntPtr pDevice; - Atom atom; - const char *name = NULL; - char *devname; - DMXInputInfo *dmxInput; - - if (!dmxLocal) - return NULL; - dmxInput = &dmxInputs[dmxLocal->inputIdx]; - - if (dmxLocal->sendsCore) { - if (dmxLocal->type == DMX_LOCAL_KEYBOARD && !dmxLocalCoreKeyboard) { - dmxLocal->isCore = 1; - dmxLocalCoreKeyboard = dmxLocal; - name = "keyboard"; - } - if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) { - dmxLocal->isCore = 1; - dmxLocalCorePointer = dmxLocal; - name = "pointer"; - } - } - - if (!name) { - name = "extension"; - } - - if (!name) - dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name); - - pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE); - if (!pDevice) { - dmxLog(dmxError, "Too many devices -- cannot add device %s\n", - dmxLocal->name); - return NULL; - } - pDevice->public.devicePrivate = dmxLocal; - dmxLocal->pDevice = pDevice; - - devname = dmxMakeUniqueDeviceName(dmxLocal); - atom = MakeAtom((char *)devname, strlen(devname), TRUE); - pDevice->type = atom; - pDevice->name = devname; - - if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) { -#if 00 /*BP*/ - miRegisterPointerDevice(screenInfo.screens[0], pDevice); -#else - /* Nothing? dmxDeviceOnOff() should get called to init, right? */ -#endif - } - - if (dmxLocal->create_private) - dmxLocal->private = dmxLocal->create_private(pDevice); - - dmxLogInput(dmxInput, "Added %s as %s device called %s%s\n", - dmxLocal->name, name, devname, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore - ? " [sends core events]" - : "")); - - return pDevice; -} - -static DMXLocalInputInfoPtr dmxLookupLocal(const char *name) -{ - DMXLocalInputInfoPtr pt; - - for (pt = &DMXLocalDevices[0]; pt->name; ++pt) - if (!strcmp(pt->name, name)) return pt; /* search for device name */ - return NULL; -} - -/** Copy the local input information from \a s into a new \a devs slot - * in \a dmxInput. */ -DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput, - DMXLocalInputInfoPtr s) -{ - DMXLocalInputInfoPtr dmxLocal = malloc(sizeof(*dmxLocal)); - - if (!dmxLocal) - dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n"); - - memcpy(dmxLocal, s, sizeof(*dmxLocal)); - dmxLocal->inputIdx = dmxInput->inputIdx; - dmxLocal->sendsCore = dmxInput->core; - dmxLocal->savedSendsCore = dmxInput->core; - dmxLocal->deviceId = -1; - - ++dmxInput->numDevs; - dmxInput->devs = realloc(dmxInput->devs, - dmxInput->numDevs * sizeof(*dmxInput->devs)); - dmxInput->devs[dmxInput->numDevs-1] = dmxLocal; - - return dmxLocal; -} - -static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a) -{ - int i; - int help = 0; - DMXLocalInputInfoRec *pt; - - for (i = 1; i < dmxArgC(a); i++) { - const char *name = dmxArgV(a, i); - if ((pt = dmxLookupLocal(name))) { - dmxInputCopyLocal(dmxInput, pt); - } else { - if (strlen(name)) - dmxLog(dmxWarning, - "Could not find a driver called %s\n", name); - ++help; - } - } - if (help) { - dmxLog(dmxInfo, "Available local device drivers:\n"); - for (pt = &DMXLocalDevices[0]; pt->name; ++pt) { - const char *type; - switch (pt->type) { - case DMX_LOCAL_KEYBOARD: type = "keyboard"; break; - case DMX_LOCAL_MOUSE: type = "pointer"; break; - default: type = "unknown"; break; - } - dmxLog(dmxInfo, " %s (%s)\n", pt->name, type); - } - dmxLog(dmxFatal, "Must have valid local device driver\n"); - } -} - -int dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name, _Xconst char *reason) -{ - return 0; -} - -static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI) -{ - XExtensionVersion *ext; - XDeviceInfo *devices; - Display *display; - int num; - int i, j; - XextErrorHandler handler; - - if (!(display = XOpenDisplay(dmxInput->name))) return; - - /* Print out information about the XInput Extension. */ - handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler); - ext = XGetExtensionVersion(display, INAME); - XSetExtensionErrorHandler(handler); - - if (!ext || ext == (XExtensionVersion *)NoSuchExtension) { - dmxLogInput(dmxInput, "%s is not available\n", INAME); - } else { - dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n", - dmxInput->name, INAME, - ext->major_version, ext->minor_version); - devices = XListInputDevices(display, &num); - - XFree(ext); - ext = NULL; - - /* Print a list of all devices */ - for (i = 0; i < num; i++) { - const char *use = "Unknown"; - switch (devices[i].use) { - case IsXPointer: use = "XPointer"; break; - case IsXKeyboard: use = "XKeyboard"; break; - case IsXExtensionDevice: use = "XExtensionDevice"; break; - case IsXExtensionPointer: use = "XExtensionPointer"; break; - case IsXExtensionKeyboard: use = "XExtensionKeyboard"; break; - } - dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n", - devices[i].id, - devices[i].name ? devices[i].name : "", - use); - } - - /* Search for extensions */ - for (i = 0; i < num; i++) { - switch (devices[i].use) { - case IsXKeyboard: - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; - if (dmxL->type == DMX_LOCAL_KEYBOARD - && dmxL->deviceId < 0) { - dmxL->deviceId = devices[i].id; - dmxL->deviceName = (devices[i].name - ? strdup(devices[i].name) - : NULL); - } - } - break; - case IsXPointer: - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; - if (dmxL->type == DMX_LOCAL_MOUSE && dmxL->deviceId < 0) { - dmxL->deviceId = devices[i].id; - dmxL->deviceName = (devices[i].name - ? xstrdup(devices[i].name) - : NULL); - } - } - break; -#if 0 - case IsXExtensionDevice: - case IsXExtensionKeyboard: - case IsXExtensionPointer: - if (doXI) { - if (!dmxInput->numDevs) { - dmxLog(dmxWarning, - "Cannot use remote (%s) XInput devices if" - " not also using core devices\n", - dmxInput->name); - } else { - dmxLocal = dmxInputCopyLocal(dmxInput, - &DMXCommonOth); - dmxLocal->isCore = FALSE; - dmxLocal->sendsCore = FALSE; - dmxLocal->deviceId = devices[i].id; - dmxLocal->deviceName = (devices[i].name - ? strdup(devices[i].name) - : NULL); - } - } - break; -#endif - } - } - XFreeDeviceList(devices); - } - XCloseDisplay(display); -} - -/** Re-initialize all the devices described in \a dmxInput. Called from - #dmxAdjustCursorBoundaries before the cursor is redisplayed. */ -void dmxInputReInit(DMXInputInfo *dmxInput) -{ - int i; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - if (dmxLocal->reinit) - dmxLocal->reinit(&dmxLocal->pDevice->public); - } -} - -/** Re-initialize all the devices described in \a dmxInput. Called from - #dmxAdjustCursorBoundaries after the cursor is redisplayed. */ -void dmxInputLateReInit(DMXInputInfo *dmxInput) -{ - int i; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - if (dmxLocal->latereinit) - dmxLocal->latereinit(&dmxLocal->pDevice->public); - } -} - -/** Initialize all of the devices described in \a dmxInput. */ -void dmxInputInit(DMXInputInfo *dmxInput) -{ - DeviceIntPtr pPointer = NULL, pKeyboard = NULL; - dmxArg a; - const char *name; - int i; - int doXI = 1; /* Include by default */ - int forceConsole = 0; - int doWindows = 1; /* On by default */ - int hasXkb = 0; - - a = dmxArgParse(dmxInput->name); - - for (i = 1; i < dmxArgC(a); i++) { - switch (hasXkb) { - case 1: - dmxInput->keycodes = xstrdup(dmxArgV(a, i)); - ++hasXkb; - break; - case 2: - dmxInput->symbols = xstrdup(dmxArgV(a, i)); - ++hasXkb; - break; - case 3: - dmxInput->geometry = xstrdup(dmxArgV(a, i)); - hasXkb = 0; - break; - case 0: - if (!strcmp(dmxArgV(a, i), "noxi")) doXI = 0; - else if (!strcmp(dmxArgV(a, i), "xi")) doXI = 1; - else if (!strcmp(dmxArgV(a, i), "console")) forceConsole = 1; - else if (!strcmp(dmxArgV(a, i), "noconsole")) forceConsole = 0; - else if (!strcmp(dmxArgV(a, i), "windows")) doWindows = 1; - else if (!strcmp(dmxArgV(a, i), "nowindows")) doWindows = 0; - else if (!strcmp(dmxArgV(a, i), "xkb")) hasXkb = 1; - else { - dmxLog(dmxFatal, - "Unknown input argument: %s\n", dmxArgV(a, i)); - } - } - } - - name = dmxArgV(a, 0); - - if (!strcmp(name, "local")) { - dmxPopulateLocal(dmxInput, a); - } else if (!strcmp(name, "dummy")) { - dmxInputCopyLocal(dmxInput, &DMXDummyMou); - dmxInputCopyLocal(dmxInput, &DMXDummyKbd); - dmxLogInput(dmxInput, "Using dummy input\n"); - } else { - int found; - - for (found = 0, i = 0; i < dmxNumScreens; i++) { - if (dmxPropertySameDisplay(&dmxScreens[i], name)) { - if (dmxScreens[i].shared) - dmxLog(dmxFatal, - "Cannot take input from shared backend (%s)\n", - name); - if (!dmxInput->core) { - dmxLog(dmxWarning, - "Cannot use core devices on a backend (%s)" - " as XInput devices\n", name); - } else { - char *pt; - for (pt = (char *)dmxInput->name; pt && *pt; pt++) - if (*pt == ',') *pt = '\0'; - dmxInputCopyLocal(dmxInput, &DMXBackendMou); - dmxInputCopyLocal(dmxInput, &DMXBackendKbd); - dmxInput->scrnIdx = i; - dmxLogInput(dmxInput, - "Using backend input from %s\n", name); - } - ++found; - break; - } - } - if (!found || forceConsole) { - char *pt; - if (found) dmxInput->console = TRUE; - for (pt = (char *)dmxInput->name; pt && *pt; pt++) - if (*pt == ',') *pt = '\0'; - dmxInputCopyLocal(dmxInput, &DMXConsoleMou); - dmxInputCopyLocal(dmxInput, &DMXConsoleKbd); - if (doWindows) { - dmxInput->windows = TRUE; - dmxInput->updateWindowInfo = dmxUpdateWindowInformation; - } - dmxLogInput(dmxInput, - "Using console input from %s (%s windows)\n", - name, doWindows ? "with" : "without"); - } - } - - dmxArgFree(a); - - /* Locate extensions we may be interested in */ - dmxInputScanForExtensions(dmxInput, doXI); - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - dmxLocal->pDevice = dmxAddDevice(dmxLocal); - if (dmxLocal->isCore) { - if (dmxLocal->type == DMX_LOCAL_MOUSE) - pPointer = dmxLocal->pDevice; - if (dmxLocal->type == DMX_LOCAL_KEYBOARD) - pKeyboard = dmxLocal->pDevice; - } - } - - dmxInput->processInputEvents = dmxProcessInputEvents; - dmxInput->detached = False; - - RegisterBlockAndWakeupHandlers(dmxBlockHandler, - dmxWakeupHandler, - (void *)dmxInput->inputIdx); -} - -static void dmxInputFreeLocal(DMXLocalInputInfoRec *local) -{ - if (!local) return; - if (local->isCore && local->type == DMX_LOCAL_MOUSE) - dmxLocalCorePointer = NULL; - if (local->isCore && local->type == DMX_LOCAL_KEYBOARD) - dmxLocalCoreKeyboard = NULL; - if (local->destroy_private) local->destroy_private(local->private); - free(local->history); - free(local->valuators); - free(local->deviceName); - local->private = NULL; - local->history = NULL; - local->deviceName = NULL; - free(local); -} - -/** Free all of the memory associated with \a dmxInput */ -void dmxInputFree(DMXInputInfo *dmxInput) -{ - int i; - - if (!dmxInput) return; - - free(dmxInput->keycodes); - free(dmxInput->symbols); - free(dmxInput->geometry); - - for (i = 0; i < dmxInput->numDevs; i++) { - dmxInputFreeLocal(dmxInput->devs[i]); - dmxInput->devs[i] = NULL; - } - free(dmxInput->devs); - dmxInput->devs = NULL; - dmxInput->numDevs = 0; - if (dmxInput->freename) free(dmxInput->name); - dmxInput->name = NULL; -} - -/** Log information about all of the known devices using #dmxLog(). */ -void dmxInputLogDevices(void) -{ - int i, j; - - dmxLog(dmxInfo, "%d devices:\n", dmxGetInputCount()); - dmxLog(dmxInfo, " Id Name Classes\n"); - for (j = 0; j < dmxNumInputs; j++) { - DMXInputInfo *dmxInput = &dmxInputs[j]; - const char *pt = strchr(dmxInput->name, ','); - int len = (pt - ? (size_t)(pt-dmxInput->name) - : strlen(dmxInput->name)); - - for (i = 0; i < dmxInput->numDevs; i++) { - DeviceIntPtr pDevice = dmxInput->devs[i]->pDevice; - if (pDevice) { - dmxLog(dmxInfo, " %2d%c %-20.20s", - pDevice->id, - dmxInput->detached ? 'D' : ' ', - pDevice->name); - if (pDevice->key) dmxLogCont(dmxInfo, " key"); - if (pDevice->valuator) dmxLogCont(dmxInfo, " val"); - if (pDevice->button) dmxLogCont(dmxInfo, " btn"); - if (pDevice->focus) dmxLogCont(dmxInfo, " foc"); - if (pDevice->kbdfeed) dmxLogCont(dmxInfo, " fb/kbd"); - if (pDevice->ptrfeed) dmxLogCont(dmxInfo, " fb/ptr"); - if (pDevice->intfeed) dmxLogCont(dmxInfo, " fb/int"); - if (pDevice->stringfeed) dmxLogCont(dmxInfo, " fb/str"); - if (pDevice->bell) dmxLogCont(dmxInfo, " fb/bel"); - if (pDevice->leds) dmxLogCont(dmxInfo, " fb/led"); - if (!pDevice->key && !pDevice->valuator && !pDevice->button - && !pDevice->focus && !pDevice->kbdfeed - && !pDevice->ptrfeed && !pDevice->intfeed - && !pDevice->stringfeed && !pDevice->bell - && !pDevice->leds) dmxLogCont(dmxInfo, " (none)"); - - dmxLogCont(dmxInfo, "\t[i%d/%*.*s", - dmxInput->inputIdx, len, len, dmxInput->name); - if (dmxInput->devs[i]->deviceId >= 0) - dmxLogCont(dmxInfo, "/id%d", dmxInput->devs[i]->deviceId); - if (dmxInput->devs[i]->deviceName) - dmxLogCont(dmxInfo, "=%s", dmxInput->devs[i]->deviceName); - dmxLogCont(dmxInfo, "] %s\n", - dmxInput->devs[i]->isCore - ? "core" - : (dmxInput->devs[i]->sendsCore - ? "extension (sends core events)" - : "extension")); - } - } - } -} - -/** Detach an input */ -int dmxInputDetach(DMXInputInfo *dmxInput) -{ - int i; - - if (dmxInput->detached) return BadAccess; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - dmxLogInput(dmxInput, "Detaching device id %d: %s%s\n", - dmxLocal->pDevice->id, - dmxLocal->pDevice->name, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore - ? " [sends core events]" - : "")); - DisableDevice(dmxLocal->pDevice, TRUE); - } - dmxInput->detached = True; - dmxInputLogDevices(); - return 0; -} - -/** Search for input associated with \a dmxScreen, and detach. */ -void dmxInputDetachAll(DMXScreenInfo *dmxScreen) -{ - int i; - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - if (dmxInput->scrnIdx == dmxScreen->index) dmxInputDetach(dmxInput); - } -} - -/** Search for input associated with \a deviceId, and detach. */ -int dmxInputDetachId(int id) -{ - DMXInputInfo *dmxInput = dmxInputLocateId(id); - - if (!dmxInput) return BadValue; - - return dmxInputDetach(dmxInput); -} - -DMXInputInfo *dmxInputLocateId(int id) -{ - int i, j; - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; - if (dmxLocal->pDevice->id == id) return dmxInput; - } - } - return NULL; -} - -static int dmxInputAttachNew(DMXInputInfo *dmxInput, int *id) -{ - dmxInputInit(dmxInput); - InitAndStartDevices(); - if (id && dmxInput->devs) *id = dmxInput->devs[0]->pDevice->id; - dmxInputLogDevices(); - return 0; -} - -static int dmxInputAttachOld(DMXInputInfo *dmxInput, int *id) -{ - int i; - - dmxInput->detached = False; - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - if (id) *id = dmxLocal->pDevice->id; - dmxLogInput(dmxInput, - "Attaching device id %d: %s%s\n", - dmxLocal->pDevice->id, - dmxLocal->pDevice->name, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore - ? " [sends core events]" - : "")); - EnableDevice(dmxLocal->pDevice, TRUE); - } - dmxInputLogDevices(); - return 0; -} - -int dmxInputAttachConsole(const char *name, int isCore, int *id) -{ - DMXInputInfo *dmxInput; - int i; - - for (i = 0; i < dmxNumInputs; i++) { - dmxInput = &dmxInputs[i]; - if (dmxInput->scrnIdx == -1 - && dmxInput->detached - && !strcmp(dmxInput->name, name)) { - /* Found match */ - dmxLogInput(dmxInput, "Reattaching detached console input\n"); - return dmxInputAttachOld(dmxInput, id); - } - } - - /* No match found */ - dmxInput = dmxConfigAddInput(xstrdup(name), isCore); - dmxInput->freename = TRUE; - dmxLogInput(dmxInput, "Attaching new console input\n"); - return dmxInputAttachNew(dmxInput, id); -} - -int dmxInputAttachBackend(int physicalScreen, int isCore, int *id) -{ - DMXInputInfo *dmxInput; - DMXScreenInfo *dmxScreen; - int i; - - if (physicalScreen < 0 || physicalScreen >= dmxNumScreens) return BadValue; - for (i = 0; i < dmxNumInputs; i++) { - dmxInput = &dmxInputs[i]; - if (dmxInput->scrnIdx != -1 && dmxInput->scrnIdx == physicalScreen) { - /* Found match */ - if (!dmxInput->detached) return BadAccess; /* Already attached */ - dmxScreen = &dmxScreens[physicalScreen]; - if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */ - dmxLogInput(dmxInput, "Reattaching detached backend input\n"); - return dmxInputAttachOld(dmxInput, id); - } - } - /* No match found */ - dmxScreen = &dmxScreens[physicalScreen]; - if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */ - dmxInput = dmxConfigAddInput(dmxScreen->name, isCore); - dmxLogInput(dmxInput, "Attaching new backend input\n"); - return dmxInputAttachNew(dmxInput, id); -} +/* + * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This file provides generic input support. Functions here set up + * input and lead to the calling of low-level device drivers for + * input. */ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#define DMX_WINDOW_DEBUG 0 + +#include "dmxinputinit.h" +#include "dmxextension.h" /* For dmxInputCount */ + +#include "dmxdummy.h" +#include "dmxbackend.h" +#include "dmxconsole.h" +#include "dmxcommon.h" +#include "dmxevents.h" +#include "dmxmotion.h" +#include "dmxprop.h" +#include "config/dmxconfig.h" +#include "dmxcursor.h" + +#include "lnx-keyboard.h" +#include "lnx-ms.h" +#include "lnx-ps2.h" +#include "usb-keyboard.h" +#include "usb-mouse.h" +#include "usb-other.h" +#include "usb-common.h" + +#include "dmxsigio.h" +#include "dmxarg.h" + +#include "inputstr.h" +#include "input.h" +#include "mipointer.h" +#include "windowstr.h" +#include "mi.h" +#include "xkbsrv.h" + +#include +#include +#include "exevents.h" +#include "extinit.h" + +DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; + +static DMXLocalInputInfoRec DMXDummyMou = { + "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, + NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo +}; + +static DMXLocalInputInfoRec DMXDummyKbd = { + "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, + NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo +}; + +static DMXLocalInputInfoRec DMXBackendMou = { + "backend-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_BACKEND, 2, + dmxBackendCreatePrivate, dmxBackendDestroyPrivate, + dmxBackendInit, NULL, dmxBackendLateReInit, dmxBackendMouGetInfo, + dmxCommonMouOn, dmxCommonMouOff, dmxBackendUpdatePosition, + NULL, NULL, NULL, + dmxBackendCollectEvents, dmxBackendProcessInput, dmxBackendFunctions, NULL, + dmxCommonMouCtrl +}; + +static DMXLocalInputInfoRec DMXBackendKbd = { + "backend-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_BACKEND, + 1, /* With backend-mou or console-mou */ + dmxCommonCopyPrivate, NULL, + dmxBackendInit, NULL, NULL, dmxBackendKbdGetInfo, + dmxCommonKbdOn, dmxCommonKbdOff, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, dmxCommonKbdCtrl, dmxCommonKbdBell +}; + +static DMXLocalInputInfoRec DMXConsoleMou = { + "console-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_CONSOLE, 2, + dmxConsoleCreatePrivate, dmxConsoleDestroyPrivate, + dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleMouGetInfo, + dmxCommonMouOn, dmxCommonMouOff, dmxConsoleUpdatePosition, + NULL, NULL, NULL, + dmxConsoleCollectEvents, NULL, dmxConsoleFunctions, dmxConsoleUpdateInfo, + dmxCommonMouCtrl +}; + +static DMXLocalInputInfoRec DMXConsoleKbd = { + "console-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_CONSOLE, + 1, /* With backend-mou or console-mou */ + dmxCommonCopyPrivate, NULL, + dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleKbdGetInfo, + dmxCommonKbdOn, dmxCommonKbdOff, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, dmxCommonKbdCtrl, dmxCommonKbdBell +}; + +static DMXLocalInputInfoRec DMXLocalDevices[] = { + /* Dummy drivers that can compile on any OS */ +#ifdef __linux__ + /* Linux-specific drivers */ + { + "kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, + kbdLinuxCreatePrivate, kbdLinuxDestroyPrivate, + kbdLinuxInit, NULL, NULL, kbdLinuxGetInfo, + kbdLinuxOn, kbdLinuxOff, NULL, + kbdLinuxVTPreSwitch, kbdLinuxVTPostSwitch, kbdLinuxVTSwitch, + kbdLinuxRead, NULL, NULL, NULL, + NULL, kbdLinuxCtrl, kbdLinuxBell + }, + { + "ms", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, + msLinuxCreatePrivate, msLinuxDestroyPrivate, + msLinuxInit, NULL, NULL, msLinuxGetInfo, + msLinuxOn, msLinuxOff, NULL, + msLinuxVTPreSwitch, msLinuxVTPostSwitch, NULL, + msLinuxRead + }, + { + "ps2", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, + ps2LinuxCreatePrivate, ps2LinuxDestroyPrivate, + ps2LinuxInit, NULL, NULL, ps2LinuxGetInfo, + ps2LinuxOn, ps2LinuxOff, NULL, + ps2LinuxVTPreSwitch, ps2LinuxVTPostSwitch, NULL, + ps2LinuxRead + }, +#endif +#ifdef __linux__ + /* USB drivers, currently only for + Linux, but relatively easy to port to + other OSs */ + { + "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, + usbCreatePrivate, usbDestroyPrivate, + kbdUSBInit, NULL, NULL, kbdUSBGetInfo, + kbdUSBOn, usbOff, NULL, + NULL, NULL, NULL, + kbdUSBRead, NULL, NULL, NULL, + NULL, kbdUSBCtrl + }, + { + "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, + usbCreatePrivate, usbDestroyPrivate, + mouUSBInit, NULL, NULL, mouUSBGetInfo, + mouUSBOn, usbOff, NULL, + NULL, NULL, NULL, + mouUSBRead + }, + { + "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1, + usbCreatePrivate, usbDestroyPrivate, + othUSBInit, NULL, NULL, othUSBGetInfo, + othUSBOn, usbOff, NULL, + NULL, NULL, NULL, + othUSBRead + }, +#endif + { + "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, + NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo + }, + { + "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, + NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo + }, + { NULL } /* Must be last */ +}; + + +#if 11 /*BP*/ +void +DDXRingBell(int volume, int pitch, int duration) +{ + /* NO-OP */ +} + +/* taken from kdrive/src/kinput.c: */ +static void +dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) +{ +#if 0 + KdKeyboardInfo *ki; + + for (ki = kdKeyboards; ki; ki = ki->next) { + if (ki->dixdev && ki->dixdev->id == pDevice->id) + break; + } + + if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver) + return; + + KdSetLeds(ki, ctrl->leds); + ki->bellPitch = ctrl->bell_pitch; + ki->bellDuration = ctrl->bell_duration; +#endif +} + +/* taken from kdrive/src/kinput.c: */ +static void +dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something) +{ +#if 0 + KeybdCtrl *ctrl = arg; + KdKeyboardInfo *ki = NULL; + + for (ki = kdKeyboards; ki; ki = ki->next) { + if (ki->dixdev && ki->dixdev->id == pDev->id) + break; + } + + if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) + return; + + KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); +#endif +} + +#endif /*BP*/ + +static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, + PtrCtrl *ctrl) +{ + if (!dmxLocal) return; + dmxLocal->mctrl = *ctrl; + if (dmxLocal->mCtrl) dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl); +} + +/** Change the pointer control information for the \a pDevice. If the + * device sends core events, then also change the control information + * for all of the pointer devices that send core events. */ +void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl) +{ + GETDMXLOCALFROMPDEVICE; + int i, j; + + if (dmxLocal->sendsCore) { /* Do for all core devices */ + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + if (dmxInput->detached) continue; + for (j = 0; j < dmxInput->numDevs; j++) + if (dmxInput->devs[j]->sendsCore) + _dmxChangePointerControl(dmxInput->devs[j], ctrl); + } + } else { /* Do for this device only */ + _dmxChangePointerControl(dmxLocal, ctrl); + } +} + +static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal, + KeybdCtrl *ctrl) +{ + dmxLocal->kctrl = *ctrl; + if (dmxLocal->kCtrl) { + dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl); + if (dmxLocal->pDevice->kbdfeed) { + XkbEventCauseRec cause; + XkbSetCauseUnknown(&cause); + /* Generate XKB events, as necessary */ + XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False, + NULL, &cause); + } + } +} + + +/** Change the keyboard control information for the \a pDevice. If the + * device sends core events, then also change the control information + * for all of the keyboard devices that send core events. */ +void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl) +{ + GETDMXLOCALFROMPDEVICE; + int i, j; + + if (dmxLocal->sendsCore) { /* Do for all core devices */ + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + if (dmxInput->detached) continue; + for (j = 0; j < dmxInput->numDevs; j++) + if (dmxInput->devs[j]->sendsCore) + _dmxKeyboardKbdCtrlProc(dmxInput->devs[j], ctrl); + } + } else { /* Do for this device only */ + _dmxKeyboardKbdCtrlProc(dmxLocal, ctrl); + } +} + +static void _dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent) +{ + if (dmxLocal->kBell) dmxLocal->kBell(&dmxLocal->pDevice->public, + percent, + dmxLocal->kctrl.bell, + dmxLocal->kctrl.bell_pitch, + dmxLocal->kctrl.bell_duration); +} + +/** Sound the bell on the device. If the device send core events, then + * sound the bell on all of the devices that send core events. */ +void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, + pointer ctrl, int unknown) +{ + GETDMXLOCALFROMPDEVICE; + int i, j; + + if (dmxLocal->sendsCore) { /* Do for all core devices */ + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + if (dmxInput->detached) continue; + for (j = 0; j < dmxInput->numDevs; j++) + if (dmxInput->devs[j]->sendsCore) + _dmxKeyboardBellProc(dmxInput->devs[j], percent); + } + } else { /* Do for this device only */ + _dmxKeyboardBellProc(dmxLocal, percent); + } +} + +static void dmxKeyboardFreeNames(XkbComponentNamesPtr names) +{ + if (names->keycodes) XFree(names->keycodes); + if (names->types) XFree(names->types); + if (names->compat) XFree(names->compat); + if (names->symbols) XFree(names->symbols); + if (names->geometry) XFree(names->geometry); +} + + +static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info) +{ + GETDMXINPUTFROMPDEVICE; + XkbRMLVOSet rmlvo; + + rmlvo.rules = dmxConfigGetXkbRules(); + rmlvo.model = dmxConfigGetXkbModel(); + rmlvo.layout = dmxConfigGetXkbLayout(); + rmlvo.variant = dmxConfigGetXkbVariant(); + rmlvo.options = dmxConfigGetXkbOptions(); + + XkbSetRulesDflts(&rmlvo); + if (!info->force && (dmxInput->keycodes + || dmxInput->symbols + || dmxInput->geometry)) { + if (info->freenames) dmxKeyboardFreeNames(&info->names); + info->freenames = 0; + info->names.keycodes = dmxInput->keycodes; + info->names.types = NULL; + info->names.compat = NULL; + info->names.symbols = dmxInput->symbols; + info->names.geometry = dmxInput->geometry; + + dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s", + info->names.keycodes); + if (info->names.symbols && *info->names.symbols) + dmxLogInputCont(dmxInput, " %s", info->names.symbols); + if (info->names.geometry && *info->names.geometry) + dmxLogInputCont(dmxInput, " %s", info->names.geometry); + dmxLogInputCont(dmxInput, "\n"); + } else if (info->names.keycodes) { + dmxLogInput(dmxInput, "XKEYBOARD: From device: %s", + info->names.keycodes); + if (info->names.symbols && *info->names.symbols) + dmxLogInputCont(dmxInput, " %s", info->names.symbols); + if (info->names.geometry && *info->names.geometry) + dmxLogInputCont(dmxInput, " %s", info->names.geometry); + dmxLogInputCont(dmxInput, "\n"); + } else { + dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n", + dmxConfigGetXkbRules(), + dmxConfigGetXkbLayout(), + dmxConfigGetXkbModel(), + dmxConfigGetXkbVariant() + ? dmxConfigGetXkbVariant() : "", + dmxConfigGetXkbOptions() + ? dmxConfigGetXkbOptions() : ""); + } + InitKeyboardDeviceStruct(pDevice, &rmlvo, + dmxKeyboardBellProc, + dmxKeyboardKbdCtrlProc); + + if (info->freenames) dmxKeyboardFreeNames(&info->names); + + return Success; +} + + +static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) +{ + GETDMXINPUTFROMPDEVICE; + int fd; + DMXLocalInitInfo info; + int i; + Atom btn_labels[MAX_BUTTONS] = {0}; /* FIXME */ + Atom axis_labels[MAX_VALUATORS] = {0}; /* FIXME */ + + if (dmxInput->detached) return Success; + + memset(&info, 0, sizeof(info)); + switch (what) { + case DEVICE_INIT: + if (dmxLocal->init) + dmxLocal->init(pDev); + if (dmxLocal->get_info) + dmxLocal->get_info(pDev, &info); + if (info.keyboard) { /* XKEYBOARD makes this a special case */ + dmxKeyboardOn(pDevice, &info); + break; + } + if (info.keyClass) { + XkbRMLVOSet rmlvo; + + rmlvo.rules = dmxConfigGetXkbRules(); + rmlvo.model = dmxConfigGetXkbModel(); + rmlvo.layout = dmxConfigGetXkbLayout(); + rmlvo.variant = dmxConfigGetXkbVariant(); + rmlvo.options = dmxConfigGetXkbOptions(); + + InitKeyboardDeviceStruct(pDevice, + &rmlvo, + dmxBell, dmxKbdCtrl); + } + if (info.buttonClass) { + InitButtonClassDeviceStruct(pDevice, info.numButtons, + btn_labels, info.map); + } + if (info.valuatorClass) { + if (info.numRelAxes && dmxLocal->sendsCore) { + InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, + axis_labels, + GetMaximumEventsNum(), + Relative); + for (i = 0; i < info.numRelAxes; i++) + InitValuatorAxisStruct(pDevice, i, axis_labels[i], + info.minval[i], info.maxval[i], + info.res[i], + info.minres[i], info.maxres[i], + Relative); + } else if (info.numRelAxes) { + InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, + axis_labels, + dmxPointerGetMotionBufferSize(), + Relative); + for (i = 0; i < info.numRelAxes; i++) + InitValuatorAxisStruct(pDevice, i, axis_labels[i], + info.minval[i], + info.maxval[i], info.res[i], + info.minres[i], info.maxres[i], + Relative); + } else if (info.numAbsAxes) { + InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes, + axis_labels, + dmxPointerGetMotionBufferSize(), + Absolute); + for (i = 0; i < info.numAbsAxes; i++) + InitValuatorAxisStruct(pDevice, i, + axis_labels[i], + info.minval[i], info.maxval[i], + info.res[i], info.minres[i], + info.maxres[i], Absolute); + } + } + if (info.focusClass) InitFocusClassDeviceStruct(pDevice); + if (info.proximityClass) InitProximityClassDeviceStruct(pDevice); + if (info.ptrFeedbackClass) + InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl); + if (info.intFeedbackClass || info.strFeedbackClass) + dmxLog(dmxWarning, + "Integer and string feedback not supported for %s\n", + pDevice->name); + if (!info.keyboard && (info.ledFeedbackClass || info.belFeedbackClass)) + dmxLog(dmxWarning, + "Led and bel feedback not supported for non-keyboard %s\n", + pDevice->name); + break; + case DEVICE_ON: + if (!pDev->on) { + if (dmxLocal->on && (fd = dmxLocal->on(pDev)) >= 0) + dmxSigioRegister(dmxInput, fd); + pDev->on = TRUE; + } + break; + case DEVICE_OFF: + case DEVICE_CLOSE: + /* This can get called twice consecutively: once for a + * detached screen (DEVICE_OFF), and then again at server + * generation time (DEVICE_CLOSE). */ + if (pDev->on) { + dmxSigioUnregister(dmxInput); + if (dmxLocal->off) dmxLocal->off(pDev); + pDev->on = FALSE; + } + break; + } + if (info.keySyms.map && info.freemap) { + XFree(info.keySyms.map); + info.keySyms.map = NULL; + } + if (info.xkb) XkbFreeKeyboard(info.xkb, 0, True); + return Success; +} + +static void dmxProcessInputEvents(DMXInputInfo *dmxInput) +{ + int i; + + mieqProcessInputEvents(); +#if 00 /*BP*/ + miPointerUpdate(); +#endif + if (dmxInput->detached) + return; + for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) + if (dmxInput->devs[i]->process_input) { +#if 11 /*BP*/ + miPointerUpdateSprite(dmxInput->devs[i]->pDevice); +#endif + dmxInput->devs[i]->process_input(dmxInput->devs[i]->private); + } + +#if 11 /*BP*/ + mieqProcessInputEvents(); +#endif +} + +static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput, + DMXUpdateType type, + WindowPtr pWindow) +{ + int i; + +#ifdef PANORAMIX + if (!noPanoramiXExtension && pWindow && pWindow->parent != screenInfo.screens[0]->root) + return; +#endif +#if DMX_WINDOW_DEBUG + { + const char *name = "Unknown"; + switch (type) { + case DMX_UPDATE_REALIZE: name = "Realize"; break; + case DMX_UPDATE_UNREALIZE: name = "Unrealize"; break; + case DMX_UPDATE_RESTACK: name = "Restack"; break; + case DMX_UPDATE_COPY: name = "Copy"; break; + case DMX_UPDATE_RESIZE: name = "Resize"; break; + case DMX_UPDATE_REPARENT: name = "Repaint"; break; + } + dmxLog(dmxDebug, "Window %p changed: %s\n", pWindow, name); + } +#endif + + if (dmxInput->detached) + return; + for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) + if (dmxInput->devs[i]->update_info) + dmxInput->devs[i]->update_info(dmxInput->devs[i]->private, + type, pWindow); +} + +static void dmxCollectAll(DMXInputInfo *dmxInput) +{ + int i; + + if (dmxInput->detached) + return; + for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) + if (dmxInput->devs[i]->collect_events) + dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice->public, + dmxMotion, + dmxEnqueue, + dmxCheckSpecialKeys, DMX_BLOCK); +} + +static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, + pointer pReadMask) +{ + DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData]; + static unsigned long generation = 0; + + if (generation != serverGeneration) { + generation = serverGeneration; + dmxCollectAll(dmxInput); + } +} + +static void dmxSwitchReturn(pointer p) +{ + DMXInputInfo *dmxInput = p; + int i; + + dmxLog(dmxInfo, "Returning from VT %d\n", dmxInput->vt_switched); + + if (!dmxInput->vt_switched) + dmxLog(dmxFatal, "dmxSwitchReturn called, but not switched\n"); + dmxSigioEnableInput(); + for (i = 0; i < dmxInput->numDevs; i++) + if (dmxInput->devs[i]->vt_post_switch) + dmxInput->devs[i]->vt_post_switch(dmxInput->devs[i]->private); + dmxInput->vt_switched = 0; +} + +static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask) +{ + DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData]; + int i; + + if (dmxInput->vt_switch_pending) { + dmxLog(dmxInfo, "Switching to VT %d\n", dmxInput->vt_switch_pending); + for (i = 0; i < dmxInput->numDevs; i++) + if (dmxInput->devs[i]->vt_pre_switch) + dmxInput->devs[i]->vt_pre_switch(dmxInput->devs[i]->private); + dmxInput->vt_switched = dmxInput->vt_switch_pending; + dmxInput->vt_switch_pending = 0; + for (i = 0; i < dmxInput->numDevs; i++) { + if (dmxInput->devs[i]->vt_switch) { + dmxSigioDisableInput(); + if (!dmxInput->devs[i]->vt_switch(dmxInput->devs[i]->private, + dmxInput->vt_switched, + dmxSwitchReturn, + dmxInput)) + dmxSwitchReturn(dmxInput); + break; /* Only call one vt_switch routine */ + } + } + } + dmxCollectAll(dmxInput); +} + +static char *dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal) +{ + static int k = 0; + static int m = 0; + static int o = 0; + static unsigned long dmxGeneration = 0; +#define LEN 32 + char * buf = malloc(LEN); + + if (dmxGeneration != serverGeneration) { + k = m = o = 0; + dmxGeneration = serverGeneration; + } + + switch (dmxLocal->type) { + case DMX_LOCAL_KEYBOARD: XmuSnprintf(buf, LEN, "Keyboard%d", k++); break; + case DMX_LOCAL_MOUSE: XmuSnprintf(buf, LEN, "Mouse%d", m++); break; + default: XmuSnprintf(buf, LEN, "Other%d", o++); break; + } + + return buf; +} + +static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) +{ + DeviceIntPtr pDevice; + Atom atom; + const char *name = NULL; + char *devname; + DMXInputInfo *dmxInput; + + if (!dmxLocal) + return NULL; + dmxInput = &dmxInputs[dmxLocal->inputIdx]; + + if (dmxLocal->sendsCore) { + if (dmxLocal->type == DMX_LOCAL_KEYBOARD && !dmxLocalCoreKeyboard) { + dmxLocal->isCore = 1; + dmxLocalCoreKeyboard = dmxLocal; + name = "keyboard"; + } + if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) { + dmxLocal->isCore = 1; + dmxLocalCorePointer = dmxLocal; + name = "pointer"; + } + } + + if (!name) { + name = "extension"; + } + + if (!name) + dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name); + + pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE); + if (!pDevice) { + dmxLog(dmxError, "Too many devices -- cannot add device %s\n", + dmxLocal->name); + return NULL; + } + pDevice->public.devicePrivate = dmxLocal; + dmxLocal->pDevice = pDevice; + + devname = dmxMakeUniqueDeviceName(dmxLocal); + atom = MakeAtom((char *)devname, strlen(devname), TRUE); + pDevice->type = atom; + pDevice->name = devname; + + if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) { +#if 00 /*BP*/ + miRegisterPointerDevice(screenInfo.screens[0], pDevice); +#else + /* Nothing? dmxDeviceOnOff() should get called to init, right? */ +#endif + } + + if (dmxLocal->create_private) + dmxLocal->private = dmxLocal->create_private(pDevice); + + dmxLogInput(dmxInput, "Added %s as %s device called %s%s\n", + dmxLocal->name, name, devname, + dmxLocal->isCore + ? " [core]" + : (dmxLocal->sendsCore + ? " [sends core events]" + : "")); + + return pDevice; +} + +static DMXLocalInputInfoPtr dmxLookupLocal(const char *name) +{ + DMXLocalInputInfoPtr pt; + + for (pt = &DMXLocalDevices[0]; pt->name; ++pt) + if (!strcmp(pt->name, name)) return pt; /* search for device name */ + return NULL; +} + +/** Copy the local input information from \a s into a new \a devs slot + * in \a dmxInput. */ +DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput, + DMXLocalInputInfoPtr s) +{ + DMXLocalInputInfoPtr dmxLocal = malloc(sizeof(*dmxLocal)); + + if (!dmxLocal) + dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n"); + + memcpy(dmxLocal, s, sizeof(*dmxLocal)); + dmxLocal->inputIdx = dmxInput->inputIdx; + dmxLocal->sendsCore = dmxInput->core; + dmxLocal->savedSendsCore = dmxInput->core; + dmxLocal->deviceId = -1; + + ++dmxInput->numDevs; + dmxInput->devs = realloc(dmxInput->devs, + dmxInput->numDevs * sizeof(*dmxInput->devs)); + dmxInput->devs[dmxInput->numDevs-1] = dmxLocal; + + return dmxLocal; +} + +static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a) +{ + int i; + int help = 0; + DMXLocalInputInfoRec *pt; + + for (i = 1; i < dmxArgC(a); i++) { + const char *name = dmxArgV(a, i); + if ((pt = dmxLookupLocal(name))) { + dmxInputCopyLocal(dmxInput, pt); + } else { + if (strlen(name)) + dmxLog(dmxWarning, + "Could not find a driver called %s\n", name); + ++help; + } + } + if (help) { + dmxLog(dmxInfo, "Available local device drivers:\n"); + for (pt = &DMXLocalDevices[0]; pt->name; ++pt) { + const char *type; + switch (pt->type) { + case DMX_LOCAL_KEYBOARD: type = "keyboard"; break; + case DMX_LOCAL_MOUSE: type = "pointer"; break; + default: type = "unknown"; break; + } + dmxLog(dmxInfo, " %s (%s)\n", pt->name, type); + } + dmxLog(dmxFatal, "Must have valid local device driver\n"); + } +} + +int dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name, _Xconst char *reason) +{ + return 0; +} + +static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI) +{ + XExtensionVersion *ext; + XDeviceInfo *devices; + Display *display; + int num; + int i, j; + XextErrorHandler handler; + + if (!(display = XOpenDisplay(dmxInput->name))) return; + + /* Print out information about the XInput Extension. */ + handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler); + ext = XGetExtensionVersion(display, INAME); + XSetExtensionErrorHandler(handler); + + if (!ext || ext == (XExtensionVersion *)NoSuchExtension) { + dmxLogInput(dmxInput, "%s is not available\n", INAME); + } else { + dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n", + dmxInput->name, INAME, + ext->major_version, ext->minor_version); + devices = XListInputDevices(display, &num); + + XFree(ext); + ext = NULL; + + /* Print a list of all devices */ + for (i = 0; i < num; i++) { + const char *use = "Unknown"; + switch (devices[i].use) { + case IsXPointer: use = "XPointer"; break; + case IsXKeyboard: use = "XKeyboard"; break; + case IsXExtensionDevice: use = "XExtensionDevice"; break; + case IsXExtensionPointer: use = "XExtensionPointer"; break; + case IsXExtensionKeyboard: use = "XExtensionKeyboard"; break; + } + dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n", + devices[i].id, + devices[i].name ? devices[i].name : "", + use); + } + + /* Search for extensions */ + for (i = 0; i < num; i++) { + switch (devices[i].use) { + case IsXKeyboard: + for (j = 0; j < dmxInput->numDevs; j++) { + DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; + if (dmxL->type == DMX_LOCAL_KEYBOARD + && dmxL->deviceId < 0) { + dmxL->deviceId = devices[i].id; + dmxL->deviceName = (devices[i].name + ? strdup(devices[i].name) + : NULL); + } + } + break; + case IsXPointer: + for (j = 0; j < dmxInput->numDevs; j++) { + DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; + if (dmxL->type == DMX_LOCAL_MOUSE && dmxL->deviceId < 0) { + dmxL->deviceId = devices[i].id; + dmxL->deviceName = (devices[i].name + ? xstrdup(devices[i].name) + : NULL); + } + } + break; + } + } + XFreeDeviceList(devices); + } + XCloseDisplay(display); +} + +/** Re-initialize all the devices described in \a dmxInput. Called from + #dmxAdjustCursorBoundaries before the cursor is redisplayed. */ +void dmxInputReInit(DMXInputInfo *dmxInput) +{ + int i; + + for (i = 0; i < dmxInput->numDevs; i++) { + DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; + if (dmxLocal->reinit) + dmxLocal->reinit(&dmxLocal->pDevice->public); + } +} + +/** Re-initialize all the devices described in \a dmxInput. Called from + #dmxAdjustCursorBoundaries after the cursor is redisplayed. */ +void dmxInputLateReInit(DMXInputInfo *dmxInput) +{ + int i; + + for (i = 0; i < dmxInput->numDevs; i++) { + DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; + if (dmxLocal->latereinit) + dmxLocal->latereinit(&dmxLocal->pDevice->public); + } +} + +/** Initialize all of the devices described in \a dmxInput. */ +void dmxInputInit(DMXInputInfo *dmxInput) +{ + DeviceIntPtr pPointer = NULL, pKeyboard = NULL; + dmxArg a; + const char *name; + int i; + int doXI = 1; /* Include by default */ + int forceConsole = 0; + int doWindows = 1; /* On by default */ + int hasXkb = 0; + + a = dmxArgParse(dmxInput->name); + + for (i = 1; i < dmxArgC(a); i++) { + switch (hasXkb) { + case 1: + dmxInput->keycodes = xstrdup(dmxArgV(a, i)); + ++hasXkb; + break; + case 2: + dmxInput->symbols = xstrdup(dmxArgV(a, i)); + ++hasXkb; + break; + case 3: + dmxInput->geometry = xstrdup(dmxArgV(a, i)); + hasXkb = 0; + break; + case 0: + if (!strcmp(dmxArgV(a, i), "noxi")) doXI = 0; + else if (!strcmp(dmxArgV(a, i), "xi")) doXI = 1; + else if (!strcmp(dmxArgV(a, i), "console")) forceConsole = 1; + else if (!strcmp(dmxArgV(a, i), "noconsole")) forceConsole = 0; + else if (!strcmp(dmxArgV(a, i), "windows")) doWindows = 1; + else if (!strcmp(dmxArgV(a, i), "nowindows")) doWindows = 0; + else if (!strcmp(dmxArgV(a, i), "xkb")) hasXkb = 1; + else { + dmxLog(dmxFatal, + "Unknown input argument: %s\n", dmxArgV(a, i)); + } + } + } + + name = dmxArgV(a, 0); + + if (!strcmp(name, "local")) { + dmxPopulateLocal(dmxInput, a); + } else if (!strcmp(name, "dummy")) { + dmxInputCopyLocal(dmxInput, &DMXDummyMou); + dmxInputCopyLocal(dmxInput, &DMXDummyKbd); + dmxLogInput(dmxInput, "Using dummy input\n"); + } else { + int found; + + for (found = 0, i = 0; i < dmxNumScreens; i++) { + if (dmxPropertySameDisplay(&dmxScreens[i], name)) { + if (dmxScreens[i].shared) + dmxLog(dmxFatal, + "Cannot take input from shared backend (%s)\n", + name); + if (!dmxInput->core) { + dmxLog(dmxWarning, + "Cannot use core devices on a backend (%s)" + " as XInput devices\n", name); + } else { + char *pt; + for (pt = (char *)dmxInput->name; pt && *pt; pt++) + if (*pt == ',') *pt = '\0'; + dmxInputCopyLocal(dmxInput, &DMXBackendMou); + dmxInputCopyLocal(dmxInput, &DMXBackendKbd); + dmxInput->scrnIdx = i; + dmxLogInput(dmxInput, + "Using backend input from %s\n", name); + } + ++found; + break; + } + } + if (!found || forceConsole) { + char *pt; + if (found) dmxInput->console = TRUE; + for (pt = (char *)dmxInput->name; pt && *pt; pt++) + if (*pt == ',') *pt = '\0'; + dmxInputCopyLocal(dmxInput, &DMXConsoleMou); + dmxInputCopyLocal(dmxInput, &DMXConsoleKbd); + if (doWindows) { + dmxInput->windows = TRUE; + dmxInput->updateWindowInfo = dmxUpdateWindowInformation; + } + dmxLogInput(dmxInput, + "Using console input from %s (%s windows)\n", + name, doWindows ? "with" : "without"); + } + } + + dmxArgFree(a); + + /* Locate extensions we may be interested in */ + dmxInputScanForExtensions(dmxInput, doXI); + + for (i = 0; i < dmxInput->numDevs; i++) { + DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; + dmxLocal->pDevice = dmxAddDevice(dmxLocal); + if (dmxLocal->isCore) { + if (dmxLocal->type == DMX_LOCAL_MOUSE) + pPointer = dmxLocal->pDevice; + if (dmxLocal->type == DMX_LOCAL_KEYBOARD) + pKeyboard = dmxLocal->pDevice; + } + } + + dmxInput->processInputEvents = dmxProcessInputEvents; + dmxInput->detached = False; + + RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler, + (void *)(uintptr_t)dmxInput->inputIdx); +} + +static void dmxInputFreeLocal(DMXLocalInputInfoRec *local) +{ + if (!local) return; + if (local->isCore && local->type == DMX_LOCAL_MOUSE) + dmxLocalCorePointer = NULL; + if (local->isCore && local->type == DMX_LOCAL_KEYBOARD) + dmxLocalCoreKeyboard = NULL; + if (local->destroy_private) local->destroy_private(local->private); + free(local->history); + free(local->valuators); + free(local->deviceName); + local->private = NULL; + local->history = NULL; + local->deviceName = NULL; + free(local); +} + +/** Free all of the memory associated with \a dmxInput */ +void dmxInputFree(DMXInputInfo *dmxInput) +{ + int i; + + if (!dmxInput) return; + + free(dmxInput->keycodes); + free(dmxInput->symbols); + free(dmxInput->geometry); + + for (i = 0; i < dmxInput->numDevs; i++) { + dmxInputFreeLocal(dmxInput->devs[i]); + dmxInput->devs[i] = NULL; + } + free(dmxInput->devs); + dmxInput->devs = NULL; + dmxInput->numDevs = 0; + if (dmxInput->freename) free(dmxInput->name); + dmxInput->name = NULL; +} + +/** Log information about all of the known devices using #dmxLog(). */ +void dmxInputLogDevices(void) +{ + int i, j; + + dmxLog(dmxInfo, "%d devices:\n", dmxGetInputCount()); + dmxLog(dmxInfo, " Id Name Classes\n"); + for (j = 0; j < dmxNumInputs; j++) { + DMXInputInfo *dmxInput = &dmxInputs[j]; + const char *pt = strchr(dmxInput->name, ','); + int len = (pt + ? (size_t)(pt-dmxInput->name) + : strlen(dmxInput->name)); + + for (i = 0; i < dmxInput->numDevs; i++) { + DeviceIntPtr pDevice = dmxInput->devs[i]->pDevice; + if (pDevice) { + dmxLog(dmxInfo, " %2d%c %-20.20s", + pDevice->id, + dmxInput->detached ? 'D' : ' ', + pDevice->name); + if (pDevice->key) dmxLogCont(dmxInfo, " key"); + if (pDevice->valuator) dmxLogCont(dmxInfo, " val"); + if (pDevice->button) dmxLogCont(dmxInfo, " btn"); + if (pDevice->focus) dmxLogCont(dmxInfo, " foc"); + if (pDevice->kbdfeed) dmxLogCont(dmxInfo, " fb/kbd"); + if (pDevice->ptrfeed) dmxLogCont(dmxInfo, " fb/ptr"); + if (pDevice->intfeed) dmxLogCont(dmxInfo, " fb/int"); + if (pDevice->stringfeed) dmxLogCont(dmxInfo, " fb/str"); + if (pDevice->bell) dmxLogCont(dmxInfo, " fb/bel"); + if (pDevice->leds) dmxLogCont(dmxInfo, " fb/led"); + if (!pDevice->key && !pDevice->valuator && !pDevice->button + && !pDevice->focus && !pDevice->kbdfeed + && !pDevice->ptrfeed && !pDevice->intfeed + && !pDevice->stringfeed && !pDevice->bell + && !pDevice->leds) dmxLogCont(dmxInfo, " (none)"); + + dmxLogCont(dmxInfo, "\t[i%d/%*.*s", + dmxInput->inputIdx, len, len, dmxInput->name); + if (dmxInput->devs[i]->deviceId >= 0) + dmxLogCont(dmxInfo, "/id%d", dmxInput->devs[i]->deviceId); + if (dmxInput->devs[i]->deviceName) + dmxLogCont(dmxInfo, "=%s", dmxInput->devs[i]->deviceName); + dmxLogCont(dmxInfo, "] %s\n", + dmxInput->devs[i]->isCore + ? "core" + : (dmxInput->devs[i]->sendsCore + ? "extension (sends core events)" + : "extension")); + } + } + } +} + +/** Detach an input */ +int dmxInputDetach(DMXInputInfo *dmxInput) +{ + int i; + + if (dmxInput->detached) return BadAccess; + + for (i = 0; i < dmxInput->numDevs; i++) { + DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; + dmxLogInput(dmxInput, "Detaching device id %d: %s%s\n", + dmxLocal->pDevice->id, + dmxLocal->pDevice->name, + dmxLocal->isCore + ? " [core]" + : (dmxLocal->sendsCore + ? " [sends core events]" + : "")); + DisableDevice(dmxLocal->pDevice, TRUE); + } + dmxInput->detached = True; + dmxInputLogDevices(); + return 0; +} + +/** Search for input associated with \a dmxScreen, and detach. */ +void dmxInputDetachAll(DMXScreenInfo *dmxScreen) +{ + int i; + + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + if (dmxInput->scrnIdx == dmxScreen->index) dmxInputDetach(dmxInput); + } +} + +/** Search for input associated with \a deviceId, and detach. */ +int dmxInputDetachId(int id) +{ + DMXInputInfo *dmxInput = dmxInputLocateId(id); + + if (!dmxInput) return BadValue; + + return dmxInputDetach(dmxInput); +} + +DMXInputInfo *dmxInputLocateId(int id) +{ + int i, j; + + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + for (j = 0; j < dmxInput->numDevs; j++) { + DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; + if (dmxLocal->pDevice->id == id) return dmxInput; + } + } + return NULL; +} + +static int dmxInputAttachNew(DMXInputInfo *dmxInput, int *id) +{ + dmxInputInit(dmxInput); + InitAndStartDevices(); + if (id && dmxInput->devs) *id = dmxInput->devs[0]->pDevice->id; + dmxInputLogDevices(); + return 0; +} + +static int dmxInputAttachOld(DMXInputInfo *dmxInput, int *id) +{ + int i; + + dmxInput->detached = False; + for (i = 0; i < dmxInput->numDevs; i++) { + DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; + if (id) *id = dmxLocal->pDevice->id; + dmxLogInput(dmxInput, + "Attaching device id %d: %s%s\n", + dmxLocal->pDevice->id, + dmxLocal->pDevice->name, + dmxLocal->isCore + ? " [core]" + : (dmxLocal->sendsCore + ? " [sends core events]" + : "")); + EnableDevice(dmxLocal->pDevice, TRUE); + } + dmxInputLogDevices(); + return 0; +} + +int dmxInputAttachConsole(const char *name, int isCore, int *id) +{ + DMXInputInfo *dmxInput; + int i; + + for (i = 0; i < dmxNumInputs; i++) { + dmxInput = &dmxInputs[i]; + if (dmxInput->scrnIdx == -1 + && dmxInput->detached + && !strcmp(dmxInput->name, name)) { + /* Found match */ + dmxLogInput(dmxInput, "Reattaching detached console input\n"); + return dmxInputAttachOld(dmxInput, id); + } + } + + /* No match found */ + dmxInput = dmxConfigAddInput(xstrdup(name), isCore); + dmxInput->freename = TRUE; + dmxLogInput(dmxInput, "Attaching new console input\n"); + return dmxInputAttachNew(dmxInput, id); +} + +int dmxInputAttachBackend(int physicalScreen, int isCore, int *id) +{ + DMXInputInfo *dmxInput; + DMXScreenInfo *dmxScreen; + int i; + + if (physicalScreen < 0 || physicalScreen >= dmxNumScreens) return BadValue; + for (i = 0; i < dmxNumInputs; i++) { + dmxInput = &dmxInputs[i]; + if (dmxInput->scrnIdx != -1 && dmxInput->scrnIdx == physicalScreen) { + /* Found match */ + if (!dmxInput->detached) return BadAccess; /* Already attached */ + dmxScreen = &dmxScreens[physicalScreen]; + if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */ + dmxLogInput(dmxInput, "Reattaching detached backend input\n"); + return dmxInputAttachOld(dmxInput, id); + } + } + /* No match found */ + dmxScreen = &dmxScreens[physicalScreen]; + if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */ + dmxInput = dmxConfigAddInput(dmxScreen->name, isCore); + dmxLogInput(dmxInput, "Attaching new backend input\n"); + return dmxInputAttachNew(dmxInput, id); +} diff --git a/xorg-server/hw/xfree86/doc/man/Makefile.am b/xorg-server/hw/xfree86/doc/man/Makefile.am index fe330a72c..80e22cbab 100644 --- a/xorg-server/hw/xfree86/doc/man/Makefile.am +++ b/xorg-server/hw/xfree86/doc/man/Makefile.am @@ -1,3 +1,3 @@ include $(top_srcdir)/manpages.am appman_PRE = Xorg.man -fileman_PRE = xorg.conf.man +fileman_PRE = xorg.conf.man xorg.conf.d.man diff --git a/xorg-server/hw/xfree86/doc/man/xorg.conf.d.man b/xorg-server/hw/xfree86/doc/man/xorg.conf.d.man new file mode 100644 index 000000000..6b3379ece --- /dev/null +++ b/xorg-server/hw/xfree86/doc/man/xorg.conf.d.man @@ -0,0 +1 @@ +.so man__filemansuffix__/xorg.conf.__filemansuffix__ diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index fea4a34f9..7faed0170 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -1,1108 +1,1111 @@ - -/* - -Copyright 1993, 1998 The Open Group -Copyright (C) Colin Harrison 2005-2008 - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" -#include "winmsg.h" -#include "winconfig.h" -#include "winprefs.h" -#ifdef XWIN_CLIPBOARD -#include "X11/Xlocale.h" -#endif -#ifdef DPMSExtension -#include "dpmsproc.h" -#endif -#ifdef __CYGWIN__ -#include -#endif -#if defined(WIN32) -#include "xkbsrv.h" -#endif -#ifdef RELOCATE_PROJECTROOT -#include -typedef HRESULT (*SHGETFOLDERPATHPROC)( - HWND hwndOwner, - int nFolder, - HANDLE hToken, - DWORD dwFlags, - LPTSTR pszPath -); -#endif - -/* - * References to external symbols - */ -#ifdef XWIN_CLIPBOARD -extern Bool g_fUnicodeClipboard; -extern Bool g_fClipboardLaunched; -extern Bool g_fClipboardStarted; -extern pthread_t g_ptClipboardProc; -extern HWND g_hwndClipboard; -extern Bool g_fClipboard; -#endif - - -/* - module handle for dynamically loaded comctl32 library -*/ -static HMODULE g_hmodCommonControls = NULL; - -/* - * Function prototypes - */ - -#ifdef XWIN_CLIPBOARD -static void -winClipboardShutdown (void); -#endif - -#if defined(DDXOSVERRORF) -void -OsVendorVErrorF (const char *pszFormat, va_list va_args); -#endif - -static Bool -winCheckDisplayNumber (void); - -void -winLogCommandLine (int argc, char *argv[]); - -void -winLogVersionInfo (void); - -Bool -winValidateArgs (void); - -#ifdef RELOCATE_PROJECTROOT -const char * -winGetBaseDir(void); -#endif - -/* - * For the depth 24 pixmap we default to 32 bits per pixel, but - * we change this pixmap format later if we detect that the display - * is going to be running at 24 bits per pixel. - * - * FIXME: On second thought, don't DIBs only support 32 bits per pixel? - * DIBs are the underlying bitmap used for DirectDraw surfaces, so it - * seems that all pixmap formats with depth 24 would be 32 bits per pixel. - * Confirm whether depth 24 DIBs can have 24 bits per pixel, then remove/keep - * the bits per pixel adjustment and update this comment to reflect the - * situation. Harold Hunt - 2002/07/02 - */ - -static PixmapFormatRec g_PixmapFormats[] = { - { 1, 1, BITMAP_SCANLINE_PAD }, - { 4, 8, BITMAP_SCANLINE_PAD }, - { 8, 8, BITMAP_SCANLINE_PAD }, - { 15, 16, BITMAP_SCANLINE_PAD }, - { 16, 16, BITMAP_SCANLINE_PAD }, - { 24, 32, BITMAP_SCANLINE_PAD }, - { 32, 32, BITMAP_SCANLINE_PAD } -}; - -const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]); - -#ifdef XWIN_CLIPBOARD -static void -winClipboardShutdown (void) -{ - /* Close down clipboard resources */ - if (g_fClipboard && g_fClipboardLaunched && g_fClipboardStarted) - { - /* Synchronously destroy the clipboard window */ - if (g_hwndClipboard != NULL) - { - SendMessage (g_hwndClipboard, WM_DESTROY, 0, 0); - /* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */ - } - else - return; - - /* Wait for the clipboard thread to exit */ - pthread_join (g_ptClipboardProc, NULL); - - g_fClipboardLaunched = FALSE; - g_fClipboardStarted = FALSE; - - winDebug ("winClipboardShutdown - Clipboard thread has exited.\n"); - } -} -#endif - -void -ddxPushProviders(void) -{ -#ifdef XWIN_GLX_WINDOWS - if (g_fNativeGl) - { - /* install the native GL provider */ - glxWinPushNativeProvider(); - } -#endif -} - -#if defined(DDXBEFORERESET) -/* - * Called right before KillAllClients when the server is going to reset, - * allows us to shutdown our seperate threads cleanly. - */ - -void -ddxBeforeReset (void) -{ - winDebug ("ddxBeforeReset - Hello\n"); - -#ifdef XWIN_CLIPBOARD - winClipboardShutdown (); -#endif -} -#endif - - -/* See Porting Layer Definition - p. 57 */ -void -ddxGiveUp (void) -{ - int i; - -#if CYGDEBUG - winDebug ("ddxGiveUp\n"); -#endif - - /* Perform per-screen deinitialization */ - for (i = 0; i < g_iNumScreens; ++i) - { - /* Delete the tray icon */ - if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen) - winDeleteNotifyIcon (winGetScreenPriv (g_ScreenInfo[i].pScreen)); - } - -#ifdef XWIN_MULTIWINDOW - /* Notify the worker threads we're exiting */ - winDeinitMultiWindowWM (); -#endif - -#ifdef HAS_DEVWINDOWS - /* Close our handle to our message queue */ - if (g_fdMessageQueue != WIN_FD_INVALID) - { - /* Close /dev/windows */ - close (g_fdMessageQueue); - - /* Set the file handle to invalid */ - g_fdMessageQueue = WIN_FD_INVALID; - } -#endif - - if (!g_fLogInited) { - g_pszLogFile = LogInit (g_pszLogFile, NULL); - g_fLogInited = TRUE; - } - LogClose (); - - /* - * At this point we aren't creating any new screens, so - * we are guaranteed to not need the DirectDraw functions. - */ - winReleaseDDProcAddresses(); - - /* Unload our TrackMouseEvent function pointer */ - if (g_hmodCommonControls != NULL) - { - FreeLibrary (g_hmodCommonControls); - g_hmodCommonControls = NULL; - g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA; - } - - /* Free concatenated command line */ - free(g_pszCommandLine); - g_pszCommandLine = NULL; - - /* Remove our keyboard hook if it is installed */ - winRemoveKeyboardHookLL (); - - /* Tell Windows that we want to end the app */ - PostQuitMessage (0); -} - - -/* See Porting Layer Definition - p. 57 */ -void -AbortDDX (void) -{ -#if CYGDEBUG - winDebug ("AbortDDX\n"); -#endif - ddxGiveUp (); -} - -#ifdef __CYGWIN__ -/* hasmntopt is currently not implemented for cygwin */ -static const char *winCheckMntOpt(const struct mntent *mnt, const char *opt) -{ - const char *s; - size_t len; - if (mnt == NULL) - return NULL; - if (opt == NULL) - return NULL; - if (mnt->mnt_opts == NULL) - return NULL; - - len = strlen(opt); - s = strstr(mnt->mnt_opts, opt); - if (s == NULL) - return NULL; - if ((s == mnt->mnt_opts || *(s-1) == ',') && (s[len] == 0 || s[len] == ',')) - return (char *)opt; - return NULL; -} - -static void -winCheckMount(void) -{ - FILE *mnt; - struct mntent *ent; - - enum { none = 0, sys_root, user_root, sys_tmp, user_tmp } - level = none, curlevel; - BOOL binary = TRUE; - - mnt = setmntent("/etc/mtab", "r"); - if (mnt == NULL) - { - ErrorF("setmntent failed"); - return; - } - - while ((ent = getmntent(mnt)) != NULL) - { - BOOL system = (winCheckMntOpt(ent, "user") != NULL); - BOOL root = (strcmp(ent->mnt_dir, "/") == 0); - BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0); - - if (system) - { - if (root) - curlevel = sys_root; - else if (tmp) - curlevel = sys_tmp; - else - continue; - } - else - { - if (root) - curlevel = user_root; - else if (tmp) - curlevel = user_tmp; - else - continue; - } - - if (curlevel <= level) - continue; - level = curlevel; - - if ((winCheckMntOpt(ent, "binary") == NULL) && - (winCheckMntOpt(ent, "binmode") == NULL)) - binary = FALSE; - else - binary = TRUE; - } - - if (endmntent(mnt) != 1) - { - ErrorF("endmntent failed"); - return; - } - - if (!binary) - winMsg(X_WARNING, "/tmp mounted in textmode\n"); -} -#else -static void -winCheckMount(void) -{ -} -#endif - -#ifdef RELOCATE_PROJECTROOT -const char * -winGetBaseDir(void) -{ - static BOOL inited = FALSE; - static char buffer[MAX_PATH]; - if (!inited) - { - char *fendptr; - HMODULE module = GetModuleHandle(NULL); - DWORD size = GetModuleFileName(module, buffer, sizeof(buffer)); - if (sizeof(buffer) > 0) - buffer[sizeof(buffer)-1] = 0; - - fendptr = buffer + size; - while (fendptr > buffer) - { - if (*fendptr == '\\' || *fendptr == '/') - { - *fendptr = 0; - break; - } - fendptr--; - } - inited = TRUE; - } - return buffer; -} -#endif - -static void -winFixupPaths (void) -{ - BOOL changed_fontpath = FALSE; - MessageType font_from = X_DEFAULT; -#ifdef RELOCATE_PROJECTROOT - const char *basedir = winGetBaseDir(); - size_t basedirlen = strlen(basedir); -#endif - -#ifdef READ_FONTDIRS - { - /* Open fontpath configuration file */ - FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt"); - if (fontdirs != NULL) - { - char buffer[256]; - int needs_sep = TRUE; - int comment_block = FALSE; - - /* get default fontpath */ - char *fontpath = strdup(defaultFontPath); - size_t size = strlen(fontpath); - - /* read all lines */ - while (!feof(fontdirs)) - { - size_t blen; - char *hashchar; - char *str; - int has_eol = FALSE; - - /* read one line */ - str = fgets(buffer, sizeof(buffer), fontdirs); - if (str == NULL) /* stop on error or eof */ - break; - - if (strchr(str, '\n') != NULL) - has_eol = TRUE; - - /* check if block is continued comment */ - if (comment_block) - { - /* ignore all input */ - *str = 0; - blen = 0; - if (has_eol) /* check if line ended in this block */ - comment_block = FALSE; - } - else - { - /* find comment character. ignore all trailing input */ - hashchar = strchr(str, '#'); - if (hashchar != NULL) - { - *hashchar = 0; - if (!has_eol) /* mark next block as continued comment */ - comment_block = TRUE; - } - } - - /* strip whitespaces from beginning */ - while (*str == ' ' || *str == '\t') - str++; - - /* get size, strip whitespaces from end */ - blen = strlen(str); - while (blen > 0 && (str[blen-1] == ' ' || - str[blen-1] == '\t' || str[blen-1] == '\n')) - { - str[--blen] = 0; - } - - /* still something left to add? */ - if (blen > 0) - { - size_t newsize = size + blen; - /* reserve one character more for ',' */ - if (needs_sep) - newsize++; - - /* allocate memory */ - if (fontpath == NULL) - fontpath = malloc(newsize+1); - else - fontpath = realloc(fontpath, newsize+1); - - /* add separator */ - if (needs_sep) - { - fontpath[size] = ','; - size++; - needs_sep = FALSE; - } - - /* mark next line as new entry */ - if (has_eol) - needs_sep = TRUE; - - /* add block */ - strncpy(fontpath + size, str, blen); - fontpath[newsize] = 0; - size = newsize; - } - } - - /* cleanup */ - fclose(fontdirs); - defaultFontPath = strdup(fontpath); - free(fontpath); - changed_fontpath = TRUE; - font_from = X_CONFIG; - } - } -#endif /* READ_FONTDIRS */ -#ifdef RELOCATE_PROJECTROOT - { - const char *libx11dir = PROJECTROOT "/lib/X11"; - size_t libx11dir_len = strlen(libx11dir); - char *newfp = NULL; - size_t newfp_len = 0; - const char *endptr, *ptr, *oldptr = defaultFontPath; - - endptr = oldptr + strlen(oldptr); - ptr = strchr(oldptr, ','); - if (ptr == NULL) - ptr = endptr; - while (ptr != NULL) - { - size_t oldfp_len = (ptr - oldptr); - size_t newsize = oldfp_len; - char *newpath = malloc(newsize + 1); - strncpy(newpath, oldptr, newsize); - newpath[newsize] = 0; - - - if (strncmp(libx11dir, newpath, libx11dir_len) == 0) - { - char *compose; - newsize = newsize - libx11dir_len + basedirlen; - compose = malloc(newsize + 1); - strcpy(compose, basedir); - strncat(compose, newpath + libx11dir_len, newsize - basedirlen); - compose[newsize] = 0; - free(newpath); - newpath = compose; - } - - oldfp_len = newfp_len; - if (oldfp_len > 0) - newfp_len ++; /* space for separator */ - newfp_len += newsize; - - if (newfp == NULL) - newfp = malloc(newfp_len + 1); - else - newfp = realloc(newfp, newfp_len + 1); - - if (oldfp_len > 0) - { - strcpy(newfp + oldfp_len, ","); - oldfp_len++; - } - strcpy(newfp + oldfp_len, newpath); - - free(newpath); - - if (*ptr == 0) - { - oldptr = ptr; - ptr = NULL; - } else - { - oldptr = ptr + 1; - ptr = strchr(oldptr, ','); - if (ptr == NULL) - ptr = endptr; - } - } - - defaultFontPath = strdup(newfp); - free(newfp); - changed_fontpath = TRUE; - } -#endif /* RELOCATE_PROJECTROOT */ - if (changed_fontpath) - winMsg (font_from, "FontPath set to \"%s\"\n", defaultFontPath); - -#ifdef RELOCATE_PROJECTROOT - if (getenv("XKEYSYMDB") == NULL) - { - char buffer[MAX_PATH]; - snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB", - basedir); - buffer[sizeof(buffer)-1] = 0; - putenv(buffer); - } - if (getenv("XERRORDB") == NULL) - { - char buffer[MAX_PATH]; - snprintf(buffer, sizeof(buffer), "XERRORDB=%s\\XErrorDB", - basedir); - buffer[sizeof(buffer)-1] = 0; - putenv(buffer); - } - if (getenv("XLOCALEDIR") == NULL) - { - char buffer[MAX_PATH]; - snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale", - basedir); - buffer[sizeof(buffer)-1] = 0; - putenv(buffer); - } - if (getenv("HOME") == NULL) - { - HMODULE shfolder; - SHGETFOLDERPATHPROC shgetfolderpath = NULL; - char buffer[MAX_PATH + 5]; - strncpy(buffer, "HOME=", 5); - - /* Try to load SHGetFolderPath from shfolder.dll and shell32.dll */ - - shfolder = LoadLibrary("shfolder.dll"); - /* fallback to shell32.dll */ - if (shfolder == NULL) - shfolder = LoadLibrary("shell32.dll"); - - /* resolve SHGetFolderPath */ - if (shfolder != NULL) - shgetfolderpath = (SHGETFOLDERPATHPROC)GetProcAddress(shfolder, "SHGetFolderPathA"); - - /* query appdata directory */ - if (shgetfolderpath && - shgetfolderpath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, - buffer + 5) == 0) - { - putenv(buffer); - } else - { - winMsg (X_ERROR, "Can not determine HOME directory\n"); - } - if (shfolder != NULL) - FreeLibrary(shfolder); - } - if (!g_fLogFileChanged) { - static char buffer[MAX_PATH]; - DWORD size = GetTempPath(sizeof(buffer), buffer); - if (size && size < sizeof(buffer)) - { - snprintf(buffer + size, sizeof(buffer) - size, - "XWin.%s.log", display); - buffer[sizeof(buffer)-1] = 0; - g_pszLogFile = buffer; - winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile); - } - } - { - static char xkbbasedir[MAX_PATH]; - - snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir); - if (sizeof(xkbbasedir) > 0) - xkbbasedir[sizeof(xkbbasedir)-1] = 0; - XkbBaseDirectory = xkbbasedir; - XkbBinDirectory = basedir; - } -#endif /* RELOCATE_PROJECTROOT */ -} - -void -OsVendorInit (void) -{ - /* Re-initialize global variables on server reset */ - winInitializeGlobals (); - - winFixupPaths(); - -#ifdef DDXOSVERRORF - if (!OsVendorVErrorFProc) - OsVendorVErrorFProc = OsVendorVErrorF; -#endif - - if (!g_fLogInited) { - /* keep this order. If LogInit fails it calls Abort which then calls - * ddxGiveUp where LogInit is called again and creates an infinite - * recursion. If we set g_fLogInited to TRUE before the init we - * avoid the second call - */ - g_fLogInited = TRUE; - g_pszLogFile = LogInit (g_pszLogFile, NULL); - } - LogSetParameter (XLOG_FLUSH, 1); - LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose); - LogSetParameter (XLOG_FILE_VERBOSITY, g_iLogVerbose); - - /* Log the version information */ - if (serverGeneration == 1) - winLogVersionInfo (); - - winCheckMount(); - - /* Add a default screen if no screens were specified */ - if (g_iNumScreens == 0) - { - winDebug ("OsVendorInit - Creating default screen 0\n"); - - /* - * We need to initialize the default screen 0 if no -screen - * arguments were processed. - * - * Add a screen 0 using the defaults set by winInitializeDefaultScreens() - * and any additional default screen parameters given - */ - winInitializeScreens(1); - - /* We have to flag this as an explicit screen, even though it isn't */ - g_ScreenInfo[0].fExplicitScreen = TRUE; - } -} - - -static void -winUseMsg (void) -{ - ErrorF("\n"); - ErrorF("\n"); - ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n"); - ErrorF("\n"); - -#ifdef XWIN_CLIPBOARD - ErrorF ("-[no]clipboard\n" - "\tEnable [disable] the clipboard integration. Default is enabled.\n"); -#endif - - ErrorF ("-clipupdates num_boxes\n" - "\tUse a clipping region to constrain shadow update blits to\n" - "\tthe updated region when num_boxes, or more, are in the\n" - "\tupdated region.\n"); - -#ifdef XWIN_XF86CONFIG - ErrorF ("-config\n" - "\tSpecify a configuration file.\n"); - - ErrorF ("-configdir\n" - "\tSpecify a configuration directory.\n"); -#endif - - ErrorF ("-depth bits_per_pixel\n" - "\tSpecify an optional bitdepth to use in fullscreen mode\n" - "\twith a DirectDraw engine.\n"); - - ErrorF ("-emulate3buttons [timeout]\n" - "\tEmulate 3 button mouse with an optional timeout in\n" - "\tmilliseconds.\n"); - -#ifdef XWIN_EMULATEPSEUDO - ErrorF ("-emulatepseudo\n" - "\tCreate a depth 8 PseudoColor visual when running in\n" - "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n" - "\tdepths. The PseudoColor visual does not have correct colors,\n" - "\tand it may crash, but it at least allows you to run your\n" - "\tapplication in TrueColor modes.\n"); -#endif - - ErrorF ("-engine engine_type_id\n" - "\tOverride the server's automatically selected engine type:\n" - "\t\t1 - Shadow GDI\n" - "\t\t2 - Shadow DirectDraw\n" - "\t\t4 - Shadow DirectDraw4 Non-Locking\n" -#ifdef XWIN_NATIVEGDI - "\t\t16 - Native GDI - experimental\n" -#endif - ); - - ErrorF ("-fullscreen\n" - "\tRun the server in fullscreen mode.\n"); - - ErrorF ("-ignoreinput\n" - "\tIgnore keyboard and mouse input.\n"); - -#ifdef XWIN_MULTIWINDOWEXTWM - ErrorF ("-internalwm\n" - "\tRun the internal window manager.\n"); -#endif - -#ifdef XWIN_XF86CONFIG - ErrorF ("-keyboard\n" - "\tSpecify a keyboard device from the configuration file.\n"); -#endif - - ErrorF ("-[no]keyhook\n" - "\tGrab special Windows keypresses like Alt-Tab or the Menu " - "key.\n"); - - ErrorF ("-lesspointer\n" - "\tHide the windows mouse pointer when it is over any\n" - "\t" EXECUTABLE_NAME " window. This prevents ghost cursors appearing when\n" - "\tthe Windows cursor is drawn on top of the X cursor\n"); - - ErrorF ("-logfile filename\n" - "\tWrite log messages to .\n"); - - ErrorF ("-logverbose verbosity\n" - "\tSet the verbosity of log messages. [NOTE: Only a few messages\n" - "\trespect the settings yet]\n" - "\t\t0 - only print fatal error.\n" - "\t\t1 - print additional configuration information.\n" - "\t\t2 - print additional runtime information [default].\n" - "\t\t3 - print debugging and tracing information.\n"); - - ErrorF ("-[no]multimonitors or -[no]multiplemonitors\n" - "\tUse the entire virtual screen if multiple\n" - "\tmonitors are present.\n"); - -#ifdef XWIN_MULTIWINDOW - ErrorF ("-multiwindow\n" - "\tRun the server in multi-window mode.\n"); -#endif - -#ifdef XWIN_MULTIWINDOWEXTWM - ErrorF ("-mwextwm\n" - "\tRun the server in multi-window external window manager mode.\n"); -#endif - - ErrorF ("-nodecoration\n" - "\tDo not draw a window border, title bar, etc. Windowed\n" - "\tmode only.\n"); - -#ifdef XWIN_CLIPBOARD - ErrorF ("-nounicodeclipboard\n" - "\tDo not use Unicode clipboard even if on a NT-based platform.\n"); -#endif - - ErrorF ("-refresh rate_in_Hz\n" - "\tSpecify an optional refresh rate to use in fullscreen mode\n" - "\twith a DirectDraw engine.\n"); - - ErrorF ("-rootless\n" - "\tRun the server in rootless mode.\n"); - - ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n" - "\tEnable screen scr_num and optionally specify a width and\n" - "\theight and initial position for that screen. Additionally\n" - "\ta monitor number can be specified to start the server on,\n" - "\tat which point, all coordinates become relative to that\n" - "\tmonitor (Not for Windows NT4 and 95). Examples:\n" - "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n" - "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n" - "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n"); - - ErrorF ("-scrollbars\n" - "\tIn windowed mode, allow screens bigger than the Windows desktop.\n" - "\tMoreover, if the window has decorations, one can now resize\n" - "\tit.\n"); - - ErrorF ("-silent-dup-error\n" - "\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n" - "\texit silently and don't display any error message.\n"); - - ErrorF ("-swcursor\n" - "\tDisable the usage of the Windows cursor and use the X11 software\n" - "\tcursor instead.\n"); - - ErrorF ("-[no]trayicon\n" - "\tDo not create a tray icon. Default is to create one\n" - "\ticon per screen. You can globally disable tray icons with\n" - "\t-notrayicon, then enable it for specific screens with\n" - "\t-trayicon for those screens.\n"); - - ErrorF ("-[no]unixkill\n" - "\tCtrl+Alt+Backspace exits the X Server.\n"); - -#ifdef XWIN_GLX_WINDOWS - ErrorF ("-[no]wgl\n" - "\tEnable the GLX extension to use the native Windows WGL interface for accelerated OpenGL\n"); -#endif - - ErrorF ("-[no]winkill\n" - "\tAlt+F4 exits the X Server.\n"); - - ErrorF ("-xkblayout XKBLayout\n" - "\tEquivalent to XKBLayout in XF86Config files.\n" - "\tFor example: -xkblayout de\n"); - - ErrorF ("-xkbmodel XKBModel\n" - "\tEquivalent to XKBModel in XF86Config files.\n"); - - ErrorF ("-xkboptions XKBOptions\n" - "\tEquivalent to XKBOptions in XF86Config files.\n"); - - ErrorF ("-xkbrules XKBRules\n" - "\tEquivalent to XKBRules in XF86Config files.\n"); - - ErrorF ("-xkbvariant XKBVariant\n" - "\tEquivalent to XKBVariant in XF86Config files.\n" - "\tFor example: -xkbvariant nodeadkeys\n"); -} - -/* See Porting Layer Definition - p. 57 */ -void -ddxUseMsg(void) -{ - /* Set a flag so that FatalError won't give duplicate warning message */ - g_fSilentFatalError = TRUE; - - winUseMsg(); - - /* Log file will not be opened for UseMsg unless we open it now */ - if (!g_fLogInited) { - g_pszLogFile = LogInit (g_pszLogFile, NULL); - g_fLogInited = TRUE; - } - LogClose (); - - /* Notify user where UseMsg text can be found.*/ - if (!g_fNoHelpMessageBox) - winMessageBoxF ("The " PROJECT_NAME " help text has been printed to " - "%s.\n" - "Please open %s to read the help text.\n", - MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile); -} - -/* See Porting Layer Definition - p. 20 */ -/* - * Do any global initialization, then initialize each screen. - * - * NOTE: We use ddxProcessArgument, so we don't need to touch argc and argv - */ - -void -InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) -{ - int i; - - /* Log the command line */ - winLogCommandLine (argc, argv); - -#if CYGDEBUG - winDebug ("InitOutput\n"); -#endif - - /* Validate command-line arguments */ - if (serverGeneration == 1 && !winValidateArgs ()) - { - FatalError ("InitOutput - Invalid command-line arguments found. " - "Exiting.\n"); - } - - /* Check for duplicate invocation on same display number.*/ - if (serverGeneration == 1 && !winCheckDisplayNumber ()) - { - if (g_fSilentDupError) - g_fSilentFatalError = TRUE; - FatalError ("InitOutput - Duplicate invocation on display " - "number: %s. Exiting.\n", display); - } - -#ifdef XWIN_XF86CONFIG - /* Try to read the xorg.conf-style configuration file */ - if (!winReadConfigfile ()) - winErrorFVerb (1, "InitOutput - Error reading config file\n"); -#else - winMsg(X_INFO, "xorg.conf is not supported\n"); - winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html " - "for more information\n"); - winConfigFiles (); -#endif - - /* Load preferences from XWinrc file */ - LoadPreferences(); - - /* Setup global screen info parameters */ - screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - screenInfo->numPixmapFormats = NUMFORMATS; - - /* Describe how we want common pixmap formats padded */ - for (i = 0; i < NUMFORMATS; i++) - { - screenInfo->formats[i] = g_PixmapFormats[i]; - } - - /* Load pointers to DirectDraw functions */ - winGetDDProcAddresses (); - - /* Detect supported engines */ - winDetectSupportedEngines (); - - /* Load common controls library */ - g_hmodCommonControls = LoadLibraryEx ("comctl32.dll", NULL, 0); - - /* Load TrackMouseEvent function pointer */ - g_fpTrackMouseEvent = GetProcAddress (g_hmodCommonControls, - "_TrackMouseEvent"); - if (g_fpTrackMouseEvent == NULL) - { - winErrorFVerb (1, "InitOutput - Could not get pointer to function\n" - "\t_TrackMouseEvent in comctl32.dll. Try installing\n" - "\tInternet Explorer 3.0 or greater if you have not\n" - "\talready.\n"); - - /* Free the library since we won't need it */ - FreeLibrary (g_hmodCommonControls); - g_hmodCommonControls = NULL; - - /* Set function pointer to point to no operation function */ - g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA; - } - - /* Store the instance handle */ - g_hInstance = GetModuleHandle (NULL); - - /* Initialize each screen */ - for (i = 0; i < g_iNumScreens; ++i) - { - /* Initialize the screen */ - if (-1 == AddScreen (winScreenInit, argc, argv)) - { - FatalError ("InitOutput - Couldn't add screen %d", i); - } - } - -#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) - - /* Generate a cookie used by internal clients for authorization */ - if (g_fXdmcpEnabled || g_fAuthEnabled) - winGenerateAuthorization (); - - /* Perform some one time initialization */ - if (1 == serverGeneration) - { - /* - * setlocale applies to all threads in the current process. - * Apply locale specified in LANG environment variable. - */ - setlocale (LC_ALL, ""); - } -#endif - -#if CYGDEBUG || YES - winDebug ("InitOutput - Returning.\n"); -#endif -} - - -/* - * winCheckDisplayNumber - Check if another instance of Cygwin/X is - * already running on the same display number. If no one exists, - * make a mutex to prevent new instances from running on the same display. - * - * return FALSE if the display number is already used. - */ - -static Bool -winCheckDisplayNumber (void) -{ - int nDisp; - HANDLE mutex; - char name[MAX_PATH]; - char * pszPrefix = '\0'; - OSVERSIONINFO osvi = {0}; - - /* Check display range */ - nDisp = atoi (display); - if (nDisp < 0 || nDisp > 65535) - { - ErrorF ("winCheckDisplayNumber - Bad display number: %d\n", nDisp); - return FALSE; - } - - /* Set first character of mutex name to null */ - name[0] = '\0'; - - /* Get operating system version information */ - osvi.dwOSVersionInfoSize = sizeof (osvi); - GetVersionEx (&osvi); - - /* Want a mutex shared among all terminals on NT > 4.0 */ - if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT - && osvi.dwMajorVersion >= 5) - { - pszPrefix = "Global\\"; - } - - /* Setup Cygwin/X specific part of name */ - snprintf (name, sizeof(name), "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp); - - /* Windows automatically releases the mutex when this process exits */ - mutex = CreateMutex (NULL, FALSE, name); - if (!mutex) - { - LPVOID lpMsgBuf; - - /* Display a fancy error message */ - FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError (), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, NULL); - ErrorF ("winCheckDisplayNumber - CreateMutex failed: %s\n", - (LPSTR)lpMsgBuf); - LocalFree (lpMsgBuf); - - return FALSE; - } - if (GetLastError () == ERROR_ALREADY_EXISTS) - { - ErrorF ("winCheckDisplayNumber - " - PROJECT_NAME " is already running on display %d\n", - nDisp); - return FALSE; - } - - return TRUE; -} + +/* + +Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" +#include "winmsg.h" +#include "winconfig.h" +#include "winprefs.h" +#ifdef XWIN_CLIPBOARD +#include "X11/Xlocale.h" +#endif +#ifdef DPMSExtension +#include "dpmsproc.h" +#endif +#ifdef __CYGWIN__ +#include +#endif +#if defined(WIN32) +#include "xkbsrv.h" +#endif +#ifdef RELOCATE_PROJECTROOT +#include +typedef HRESULT (*SHGETFOLDERPATHPROC)( + HWND hwndOwner, + int nFolder, + HANDLE hToken, + DWORD dwFlags, + LPTSTR pszPath +); +#endif + +/* + * References to external symbols + */ +#ifdef XWIN_CLIPBOARD +extern Bool g_fUnicodeClipboard; +extern Bool g_fClipboardLaunched; +extern Bool g_fClipboardStarted; +extern pthread_t g_ptClipboardProc; +extern HWND g_hwndClipboard; +extern Bool g_fClipboard; +#endif + + +/* + module handle for dynamically loaded comctl32 library +*/ +static HMODULE g_hmodCommonControls = NULL; + +/* + * Function prototypes + */ + +#ifdef XWIN_CLIPBOARD +static void +winClipboardShutdown (void); +#endif + +#if defined(DDXOSVERRORF) +void +OsVendorVErrorF (const char *pszFormat, va_list va_args); +#endif + +static Bool +winCheckDisplayNumber (void); + +void +winLogCommandLine (int argc, char *argv[]); + +void +winLogVersionInfo (void); + +Bool +winValidateArgs (void); + +#ifdef RELOCATE_PROJECTROOT +const char * +winGetBaseDir(void); +#endif + +/* + * For the depth 24 pixmap we default to 32 bits per pixel, but + * we change this pixmap format later if we detect that the display + * is going to be running at 24 bits per pixel. + * + * FIXME: On second thought, don't DIBs only support 32 bits per pixel? + * DIBs are the underlying bitmap used for DirectDraw surfaces, so it + * seems that all pixmap formats with depth 24 would be 32 bits per pixel. + * Confirm whether depth 24 DIBs can have 24 bits per pixel, then remove/keep + * the bits per pixel adjustment and update this comment to reflect the + * situation. Harold Hunt - 2002/07/02 + */ + +static PixmapFormatRec g_PixmapFormats[] = { + { 1, 1, BITMAP_SCANLINE_PAD }, + { 4, 8, BITMAP_SCANLINE_PAD }, + { 8, 8, BITMAP_SCANLINE_PAD }, + { 15, 16, BITMAP_SCANLINE_PAD }, + { 16, 16, BITMAP_SCANLINE_PAD }, + { 24, 32, BITMAP_SCANLINE_PAD }, + { 32, 32, BITMAP_SCANLINE_PAD } +}; + +const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]); + +#ifdef XWIN_CLIPBOARD +static void +winClipboardShutdown (void) +{ + /* Close down clipboard resources */ + if (g_fClipboard && g_fClipboardLaunched && g_fClipboardStarted) + { + /* Synchronously destroy the clipboard window */ + if (g_hwndClipboard != NULL) + { + SendMessage (g_hwndClipboard, WM_DESTROY, 0, 0); + /* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */ + } + else + return; + + /* Wait for the clipboard thread to exit */ + pthread_join (g_ptClipboardProc, NULL); + + g_fClipboardLaunched = FALSE; + g_fClipboardStarted = FALSE; + + winDebug ("winClipboardShutdown - Clipboard thread has exited.\n"); + } +} +#endif + +void +ddxPushProviders(void) +{ +#ifdef XWIN_GLX_WINDOWS + if (g_fNativeGl) + { + /* install the native GL provider */ + glxWinPushNativeProvider(); + } +#endif +} + +#if defined(DDXBEFORERESET) +/* + * Called right before KillAllClients when the server is going to reset, + * allows us to shutdown our seperate threads cleanly. + */ + +void +ddxBeforeReset (void) +{ + winDebug ("ddxBeforeReset - Hello\n"); + +#ifdef XWIN_CLIPBOARD + winClipboardShutdown (); +#endif +} +#endif + + +/* See Porting Layer Definition - p. 57 */ +void +ddxGiveUp (void) +{ + int i; + +#if CYGDEBUG + winDebug ("ddxGiveUp\n"); +#endif + + /* Perform per-screen deinitialization */ + for (i = 0; i < g_iNumScreens; ++i) + { + /* Delete the tray icon */ + if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen) + winDeleteNotifyIcon (winGetScreenPriv (g_ScreenInfo[i].pScreen)); + } + +#ifdef XWIN_MULTIWINDOW + /* Notify the worker threads we're exiting */ + winDeinitMultiWindowWM (); +#endif + +#ifdef HAS_DEVWINDOWS + /* Close our handle to our message queue */ + if (g_fdMessageQueue != WIN_FD_INVALID) + { + /* Close /dev/windows */ + close (g_fdMessageQueue); + + /* Set the file handle to invalid */ + g_fdMessageQueue = WIN_FD_INVALID; + } +#endif + + if (!g_fLogInited) { + g_pszLogFile = LogInit (g_pszLogFile, NULL); + g_fLogInited = TRUE; + } + LogClose (); + + /* + * At this point we aren't creating any new screens, so + * we are guaranteed to not need the DirectDraw functions. + */ + winReleaseDDProcAddresses(); + + /* Unload our TrackMouseEvent function pointer */ + if (g_hmodCommonControls != NULL) + { + FreeLibrary (g_hmodCommonControls); + g_hmodCommonControls = NULL; + g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA; + } + + /* Free concatenated command line */ + free(g_pszCommandLine); + g_pszCommandLine = NULL; + + /* Remove our keyboard hook if it is installed */ + winRemoveKeyboardHookLL (); + + /* Tell Windows that we want to end the app */ + PostQuitMessage (0); +} + + +/* See Porting Layer Definition - p. 57 */ +void +AbortDDX (void) +{ +#if CYGDEBUG + winDebug ("AbortDDX\n"); +#endif + ddxGiveUp (); +} + +#ifdef __CYGWIN__ +/* hasmntopt is currently not implemented for cygwin */ +static const char *winCheckMntOpt(const struct mntent *mnt, const char *opt) +{ + const char *s; + size_t len; + if (mnt == NULL) + return NULL; + if (opt == NULL) + return NULL; + if (mnt->mnt_opts == NULL) + return NULL; + + len = strlen(opt); + s = strstr(mnt->mnt_opts, opt); + if (s == NULL) + return NULL; + if ((s == mnt->mnt_opts || *(s-1) == ',') && (s[len] == 0 || s[len] == ',')) + return (char *)opt; + return NULL; +} + +static void +winCheckMount(void) +{ + FILE *mnt; + struct mntent *ent; + + enum { none = 0, sys_root, user_root, sys_tmp, user_tmp } + level = none, curlevel; + BOOL binary = TRUE; + + mnt = setmntent("/etc/mtab", "r"); + if (mnt == NULL) + { + ErrorF("setmntent failed"); + return; + } + + while ((ent = getmntent(mnt)) != NULL) + { + BOOL system = (winCheckMntOpt(ent, "user") != NULL); + BOOL root = (strcmp(ent->mnt_dir, "/") == 0); + BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0); + + if (system) + { + if (root) + curlevel = sys_root; + else if (tmp) + curlevel = sys_tmp; + else + continue; + } + else + { + if (root) + curlevel = user_root; + else if (tmp) + curlevel = user_tmp; + else + continue; + } + + if (curlevel <= level) + continue; + level = curlevel; + + if ((winCheckMntOpt(ent, "binary") == NULL) && + (winCheckMntOpt(ent, "binmode") == NULL)) + binary = FALSE; + else + binary = TRUE; + } + + if (endmntent(mnt) != 1) + { + ErrorF("endmntent failed"); + return; + } + + if (!binary) + winMsg(X_WARNING, "/tmp mounted in textmode\n"); +} +#else +static void +winCheckMount(void) +{ +} +#endif + +#ifdef RELOCATE_PROJECTROOT +const char * +winGetBaseDir(void) +{ + static BOOL inited = FALSE; + static char buffer[MAX_PATH]; + if (!inited) + { + char *fendptr; + HMODULE module = GetModuleHandle(NULL); + DWORD size = GetModuleFileName(module, buffer, sizeof(buffer)); + if (sizeof(buffer) > 0) + buffer[sizeof(buffer)-1] = 0; + + fendptr = buffer + size; + while (fendptr > buffer) + { + if (*fendptr == '\\' || *fendptr == '/') + { + *fendptr = 0; + break; + } + fendptr--; + } + inited = TRUE; + } + return buffer; +} +#endif + +static void +winFixupPaths (void) +{ + BOOL changed_fontpath = FALSE; + MessageType font_from = X_DEFAULT; +#ifdef RELOCATE_PROJECTROOT + const char *basedir = winGetBaseDir(); + size_t basedirlen = strlen(basedir); +#endif + +#ifdef READ_FONTDIRS + { + /* Open fontpath configuration file */ + FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt"); + if (fontdirs != NULL) + { + char buffer[256]; + int needs_sep = TRUE; + int comment_block = FALSE; + + /* get default fontpath */ + char *fontpath = strdup(defaultFontPath); + size_t size = strlen(fontpath); + + /* read all lines */ + while (!feof(fontdirs)) + { + size_t blen; + char *hashchar; + char *str; + int has_eol = FALSE; + + /* read one line */ + str = fgets(buffer, sizeof(buffer), fontdirs); + if (str == NULL) /* stop on error or eof */ + break; + + if (strchr(str, '\n') != NULL) + has_eol = TRUE; + + /* check if block is continued comment */ + if (comment_block) + { + /* ignore all input */ + *str = 0; + blen = 0; + if (has_eol) /* check if line ended in this block */ + comment_block = FALSE; + } + else + { + /* find comment character. ignore all trailing input */ + hashchar = strchr(str, '#'); + if (hashchar != NULL) + { + *hashchar = 0; + if (!has_eol) /* mark next block as continued comment */ + comment_block = TRUE; + } + } + + /* strip whitespaces from beginning */ + while (*str == ' ' || *str == '\t') + str++; + + /* get size, strip whitespaces from end */ + blen = strlen(str); + while (blen > 0 && (str[blen-1] == ' ' || + str[blen-1] == '\t' || str[blen-1] == '\n')) + { + str[--blen] = 0; + } + + /* still something left to add? */ + if (blen > 0) + { + size_t newsize = size + blen; + /* reserve one character more for ',' */ + if (needs_sep) + newsize++; + + /* allocate memory */ + if (fontpath == NULL) + fontpath = malloc(newsize+1); + else + fontpath = realloc(fontpath, newsize+1); + + /* add separator */ + if (needs_sep) + { + fontpath[size] = ','; + size++; + needs_sep = FALSE; + } + + /* mark next line as new entry */ + if (has_eol) + needs_sep = TRUE; + + /* add block */ + strncpy(fontpath + size, str, blen); + fontpath[newsize] = 0; + size = newsize; + } + } + + /* cleanup */ + fclose(fontdirs); + defaultFontPath = strdup(fontpath); + free(fontpath); + changed_fontpath = TRUE; + font_from = X_CONFIG; + } + } +#endif /* READ_FONTDIRS */ +#ifdef RELOCATE_PROJECTROOT + { + const char *libx11dir = PROJECTROOT "/lib/X11"; + size_t libx11dir_len = strlen(libx11dir); + char *newfp = NULL; + size_t newfp_len = 0; + const char *endptr, *ptr, *oldptr = defaultFontPath; + + endptr = oldptr + strlen(oldptr); + ptr = strchr(oldptr, ','); + if (ptr == NULL) + ptr = endptr; + while (ptr != NULL) + { + size_t oldfp_len = (ptr - oldptr); + size_t newsize = oldfp_len; + char *newpath = malloc(newsize + 1); + strncpy(newpath, oldptr, newsize); + newpath[newsize] = 0; + + + if (strncmp(libx11dir, newpath, libx11dir_len) == 0) + { + char *compose; + newsize = newsize - libx11dir_len + basedirlen; + compose = malloc(newsize + 1); + strcpy(compose, basedir); + strncat(compose, newpath + libx11dir_len, newsize - basedirlen); + compose[newsize] = 0; + free(newpath); + newpath = compose; + } + + oldfp_len = newfp_len; + if (oldfp_len > 0) + newfp_len ++; /* space for separator */ + newfp_len += newsize; + + if (newfp == NULL) + newfp = malloc(newfp_len + 1); + else + newfp = realloc(newfp, newfp_len + 1); + + if (oldfp_len > 0) + { + strcpy(newfp + oldfp_len, ","); + oldfp_len++; + } + strcpy(newfp + oldfp_len, newpath); + + free(newpath); + + if (*ptr == 0) + { + oldptr = ptr; + ptr = NULL; + } else + { + oldptr = ptr + 1; + ptr = strchr(oldptr, ','); + if (ptr == NULL) + ptr = endptr; + } + } + + defaultFontPath = strdup(newfp); + free(newfp); + changed_fontpath = TRUE; + } +#endif /* RELOCATE_PROJECTROOT */ + if (changed_fontpath) + winMsg (font_from, "FontPath set to \"%s\"\n", defaultFontPath); + +#ifdef RELOCATE_PROJECTROOT + if (getenv("XKEYSYMDB") == NULL) + { + char buffer[MAX_PATH]; + snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB", + basedir); + buffer[sizeof(buffer)-1] = 0; + putenv(buffer); + } + if (getenv("XERRORDB") == NULL) + { + char buffer[MAX_PATH]; + snprintf(buffer, sizeof(buffer), "XERRORDB=%s\\XErrorDB", + basedir); + buffer[sizeof(buffer)-1] = 0; + putenv(buffer); + } + if (getenv("XLOCALEDIR") == NULL) + { + char buffer[MAX_PATH]; + snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale", + basedir); + buffer[sizeof(buffer)-1] = 0; + putenv(buffer); + } + if (getenv("HOME") == NULL) + { + HMODULE shfolder; + SHGETFOLDERPATHPROC shgetfolderpath = NULL; + char buffer[MAX_PATH + 5]; + strncpy(buffer, "HOME=", 5); + + /* Try to load SHGetFolderPath from shfolder.dll and shell32.dll */ + + shfolder = LoadLibrary("shfolder.dll"); + /* fallback to shell32.dll */ + if (shfolder == NULL) + shfolder = LoadLibrary("shell32.dll"); + + /* resolve SHGetFolderPath */ + if (shfolder != NULL) + shgetfolderpath = (SHGETFOLDERPATHPROC)GetProcAddress(shfolder, "SHGetFolderPathA"); + + /* query appdata directory */ + if (shgetfolderpath && + shgetfolderpath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, + buffer + 5) == 0) + { + putenv(buffer); + } else + { + winMsg (X_ERROR, "Can not determine HOME directory\n"); + } + if (shfolder != NULL) + FreeLibrary(shfolder); + } + if (!g_fLogFileChanged) { + static char buffer[MAX_PATH]; + DWORD size = GetTempPath(sizeof(buffer), buffer); + if (size && size < sizeof(buffer)) + { + snprintf(buffer + size, sizeof(buffer) - size, + "XWin.%s.log", display); + buffer[sizeof(buffer)-1] = 0; + g_pszLogFile = buffer; + winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile); + } + } + { + static char xkbbasedir[MAX_PATH]; + + snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir); + if (sizeof(xkbbasedir) > 0) + xkbbasedir[sizeof(xkbbasedir)-1] = 0; + XkbBaseDirectory = xkbbasedir; + XkbBinDirectory = basedir; + } +#endif /* RELOCATE_PROJECTROOT */ +} + +void +OsVendorInit (void) +{ + /* Re-initialize global variables on server reset */ + winInitializeGlobals (); + + winFixupPaths(); + +#ifdef DDXOSVERRORF + if (!OsVendorVErrorFProc) + OsVendorVErrorFProc = OsVendorVErrorF; +#endif + + if (!g_fLogInited) { + /* keep this order. If LogInit fails it calls Abort which then calls + * ddxGiveUp where LogInit is called again and creates an infinite + * recursion. If we set g_fLogInited to TRUE before the init we + * avoid the second call + */ + g_fLogInited = TRUE; + g_pszLogFile = LogInit (g_pszLogFile, NULL); + } + LogSetParameter (XLOG_FLUSH, 1); + LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose); + LogSetParameter (XLOG_FILE_VERBOSITY, g_iLogVerbose); + + /* Log the version information */ + if (serverGeneration == 1) + winLogVersionInfo (); + + winCheckMount(); + + /* Add a default screen if no screens were specified */ + if (g_iNumScreens == 0) + { + winDebug ("OsVendorInit - Creating default screen 0\n"); + + /* + * We need to initialize the default screen 0 if no -screen + * arguments were processed. + * + * Add a screen 0 using the defaults set by winInitializeDefaultScreens() + * and any additional default screen parameters given + */ + winInitializeScreens(1); + + /* We have to flag this as an explicit screen, even though it isn't */ + g_ScreenInfo[0].fExplicitScreen = TRUE; + } +} + + +static void +winUseMsg (void) +{ + ErrorF("\n"); + ErrorF("\n"); + ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n"); + ErrorF("\n"); + +#ifdef XWIN_CLIPBOARD + ErrorF ("-[no]clipboard\n" + "\tEnable [disable] the clipboard integration. Default is enabled.\n"); +#endif + + ErrorF ("-clipupdates num_boxes\n" + "\tUse a clipping region to constrain shadow update blits to\n" + "\tthe updated region when num_boxes, or more, are in the\n" + "\tupdated region.\n"); + +#ifdef XWIN_XF86CONFIG + ErrorF ("-config\n" + "\tSpecify a configuration file.\n"); + + ErrorF ("-configdir\n" + "\tSpecify a configuration directory.\n"); +#endif + + ErrorF ("-depth bits_per_pixel\n" + "\tSpecify an optional bitdepth to use in fullscreen mode\n" + "\twith a DirectDraw engine.\n"); + + ErrorF ("-emulate3buttons [timeout]\n" + "\tEmulate 3 button mouse with an optional timeout in\n" + "\tmilliseconds.\n"); + +#ifdef XWIN_EMULATEPSEUDO + ErrorF ("-emulatepseudo\n" + "\tCreate a depth 8 PseudoColor visual when running in\n" + "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n" + "\tdepths. The PseudoColor visual does not have correct colors,\n" + "\tand it may crash, but it at least allows you to run your\n" + "\tapplication in TrueColor modes.\n"); +#endif + + ErrorF ("-engine engine_type_id\n" + "\tOverride the server's automatically selected engine type:\n" + "\t\t1 - Shadow GDI\n" + "\t\t2 - Shadow DirectDraw\n" + "\t\t4 - Shadow DirectDraw4 Non-Locking\n" +#ifdef XWIN_PRIMARYFB + "\t\t8 - Primary DirectDraw - obsolete\n" +#endif +#ifdef XWIN_NATIVEGDI + "\t\t16 - Native GDI - experimental\n" +#endif + ); + + ErrorF ("-fullscreen\n" + "\tRun the server in fullscreen mode.\n"); + + ErrorF ("-ignoreinput\n" + "\tIgnore keyboard and mouse input.\n"); + +#ifdef XWIN_MULTIWINDOWEXTWM + ErrorF ("-internalwm\n" + "\tRun the internal window manager.\n"); +#endif + +#ifdef XWIN_XF86CONFIG + ErrorF ("-keyboard\n" + "\tSpecify a keyboard device from the configuration file.\n"); +#endif + + ErrorF ("-[no]keyhook\n" + "\tGrab special Windows keypresses like Alt-Tab or the Menu " + "key.\n"); + + ErrorF ("-lesspointer\n" + "\tHide the windows mouse pointer when it is over any\n" + "\t" EXECUTABLE_NAME " window. This prevents ghost cursors appearing when\n" + "\tthe Windows cursor is drawn on top of the X cursor\n"); + + ErrorF ("-logfile filename\n" + "\tWrite log messages to .\n"); + + ErrorF ("-logverbose verbosity\n" + "\tSet the verbosity of log messages. [NOTE: Only a few messages\n" + "\trespect the settings yet]\n" + "\t\t0 - only print fatal error.\n" + "\t\t1 - print additional configuration information.\n" + "\t\t2 - print additional runtime information [default].\n" + "\t\t3 - print debugging and tracing information.\n"); + + ErrorF ("-[no]multimonitors or -[no]multiplemonitors\n" + "\tUse the entire virtual screen if multiple\n" + "\tmonitors are present.\n"); + +#ifdef XWIN_MULTIWINDOW + ErrorF ("-multiwindow\n" + "\tRun the server in multi-window mode.\n"); +#endif + +#ifdef XWIN_MULTIWINDOWEXTWM + ErrorF ("-mwextwm\n" + "\tRun the server in multi-window external window manager mode.\n"); +#endif + + ErrorF ("-nodecoration\n" + "\tDo not draw a window border, title bar, etc. Windowed\n" + "\tmode only.\n"); + +#ifdef XWIN_CLIPBOARD + ErrorF ("-nounicodeclipboard\n" + "\tDo not use Unicode clipboard even if on a NT-based platform.\n"); +#endif + + ErrorF ("-refresh rate_in_Hz\n" + "\tSpecify an optional refresh rate to use in fullscreen mode\n" + "\twith a DirectDraw engine.\n"); + + ErrorF ("-resize=none|scrollbars|randr" + "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n" + "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n" + "\textension to resize the X screen.\n"); + + ErrorF ("-rootless\n" + "\tRun the server in rootless mode.\n"); + + ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n" + "\tEnable screen scr_num and optionally specify a width and\n" + "\theight and initial position for that screen. Additionally\n" + "\ta monitor number can be specified to start the server on,\n" + "\tat which point, all coordinates become relative to that\n" + "\tmonitor (Not for Windows NT4 and 95). Examples:\n" + "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n" + "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n" + "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n"); + + ErrorF ("-silent-dup-error\n" + "\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n" + "\texit silently and don't display any error message.\n"); + + ErrorF ("-swcursor\n" + "\tDisable the usage of the Windows cursor and use the X11 software\n" + "\tcursor instead.\n"); + + ErrorF ("-[no]trayicon\n" + "\tDo not create a tray icon. Default is to create one\n" + "\ticon per screen. You can globally disable tray icons with\n" + "\t-notrayicon, then enable it for specific screens with\n" + "\t-trayicon for those screens.\n"); + + ErrorF ("-[no]unixkill\n" + "\tCtrl+Alt+Backspace exits the X Server.\n"); + +#ifdef XWIN_GLX_WINDOWS + ErrorF ("-[no]wgl\n" + "\tEnable the GLX extension to use the native Windows WGL interface for accelerated OpenGL\n"); +#endif + + ErrorF ("-[no]winkill\n" + "\tAlt+F4 exits the X Server.\n"); + + ErrorF ("-xkblayout XKBLayout\n" + "\tEquivalent to XKBLayout in XF86Config files.\n" + "\tFor example: -xkblayout de\n"); + + ErrorF ("-xkbmodel XKBModel\n" + "\tEquivalent to XKBModel in XF86Config files.\n"); + + ErrorF ("-xkboptions XKBOptions\n" + "\tEquivalent to XKBOptions in XF86Config files.\n"); + + ErrorF ("-xkbrules XKBRules\n" + "\tEquivalent to XKBRules in XF86Config files.\n"); + + ErrorF ("-xkbvariant XKBVariant\n" + "\tEquivalent to XKBVariant in XF86Config files.\n" + "\tFor example: -xkbvariant nodeadkeys\n"); +} + +/* See Porting Layer Definition - p. 57 */ +void +ddxUseMsg(void) +{ + /* Set a flag so that FatalError won't give duplicate warning message */ + g_fSilentFatalError = TRUE; + + winUseMsg(); + + /* Log file will not be opened for UseMsg unless we open it now */ + if (!g_fLogInited) { + g_pszLogFile = LogInit (g_pszLogFile, NULL); + g_fLogInited = TRUE; + } + LogClose (); + + /* Notify user where UseMsg text can be found.*/ + if (!g_fNoHelpMessageBox) + winMessageBoxF ("The " PROJECT_NAME " help text has been printed to " + "%s.\n" + "Please open %s to read the help text.\n", + MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile); +} + +/* See Porting Layer Definition - p. 20 */ +/* + * Do any global initialization, then initialize each screen. + * + * NOTE: We use ddxProcessArgument, so we don't need to touch argc and argv + */ + +void +InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) +{ + int i; + + /* Log the command line */ + winLogCommandLine (argc, argv); + +#if CYGDEBUG + winDebug ("InitOutput\n"); +#endif + + /* Validate command-line arguments */ + if (serverGeneration == 1 && !winValidateArgs ()) + { + FatalError ("InitOutput - Invalid command-line arguments found. " + "Exiting.\n"); + } + + /* Check for duplicate invocation on same display number.*/ + if (serverGeneration == 1 && !winCheckDisplayNumber ()) + { + if (g_fSilentDupError) + g_fSilentFatalError = TRUE; + FatalError ("InitOutput - Duplicate invocation on display " + "number: %s. Exiting.\n", display); + } + +#ifdef XWIN_XF86CONFIG + /* Try to read the xorg.conf-style configuration file */ + if (!winReadConfigfile ()) + winErrorFVerb (1, "InitOutput - Error reading config file\n"); +#else + winMsg(X_INFO, "xorg.conf is not supported\n"); + winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html " + "for more information\n"); + winConfigFiles (); +#endif + + /* Load preferences from XWinrc file */ + LoadPreferences(); + + /* Setup global screen info parameters */ + screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; + screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + screenInfo->numPixmapFormats = NUMFORMATS; + + /* Describe how we want common pixmap formats padded */ + for (i = 0; i < NUMFORMATS; i++) + { + screenInfo->formats[i] = g_PixmapFormats[i]; + } + + /* Load pointers to DirectDraw functions */ + winGetDDProcAddresses (); + + /* Detect supported engines */ + winDetectSupportedEngines (); + + /* Load common controls library */ + g_hmodCommonControls = LoadLibraryEx ("comctl32.dll", NULL, 0); + + /* Load TrackMouseEvent function pointer */ + g_fpTrackMouseEvent = GetProcAddress (g_hmodCommonControls, + "_TrackMouseEvent"); + if (g_fpTrackMouseEvent == NULL) + { + winErrorFVerb (1, "InitOutput - Could not get pointer to function\n" + "\t_TrackMouseEvent in comctl32.dll. Try installing\n" + "\tInternet Explorer 3.0 or greater if you have not\n" + "\talready.\n"); + + /* Free the library since we won't need it */ + FreeLibrary (g_hmodCommonControls); + g_hmodCommonControls = NULL; + + /* Set function pointer to point to no operation function */ + g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA; + } + + /* Store the instance handle */ + g_hInstance = GetModuleHandle (NULL); + + /* Initialize each screen */ + for (i = 0; i < g_iNumScreens; ++i) + { + /* Initialize the screen */ + if (-1 == AddScreen (winScreenInit, argc, argv)) + { + FatalError ("InitOutput - Couldn't add screen %d", i); + } + } + +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) + + /* Generate a cookie used by internal clients for authorization */ + if (g_fXdmcpEnabled || g_fAuthEnabled) + winGenerateAuthorization (); + + /* Perform some one time initialization */ + if (1 == serverGeneration) + { + /* + * setlocale applies to all threads in the current process. + * Apply locale specified in LANG environment variable. + */ + setlocale (LC_ALL, ""); + } +#endif + +#if CYGDEBUG || YES + winDebug ("InitOutput - Returning.\n"); +#endif +} + + +/* + * winCheckDisplayNumber - Check if another instance of Cygwin/X is + * already running on the same display number. If no one exists, + * make a mutex to prevent new instances from running on the same display. + * + * return FALSE if the display number is already used. + */ + +static Bool +winCheckDisplayNumber (void) +{ + int nDisp; + HANDLE mutex; + char name[MAX_PATH]; + char * pszPrefix = '\0'; + OSVERSIONINFO osvi = {0}; + + /* Check display range */ + nDisp = atoi (display); + if (nDisp < 0 || nDisp > 65535) + { + ErrorF ("winCheckDisplayNumber - Bad display number: %d\n", nDisp); + return FALSE; + } + + /* Set first character of mutex name to null */ + name[0] = '\0'; + + /* Get operating system version information */ + osvi.dwOSVersionInfoSize = sizeof (osvi); + GetVersionEx (&osvi); + + /* Want a mutex shared among all terminals on NT > 4.0 */ + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT + && osvi.dwMajorVersion >= 5) + { + pszPrefix = "Global\\"; + } + + /* Setup Cygwin/X specific part of name */ + snprintf (name, sizeof(name), "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp); + + /* Windows automatically releases the mutex when this process exits */ + mutex = CreateMutex (NULL, FALSE, name); + if (!mutex) + { + LPVOID lpMsgBuf; + + /* Display a fancy error message */ + FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError (), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, NULL); + ErrorF ("winCheckDisplayNumber - CreateMutex failed: %s\n", + (LPSTR)lpMsgBuf); + LocalFree (lpMsgBuf); + + return FALSE; + } + if (GetLastError () == ERROR_ALREADY_EXISTS) + { + ErrorF ("winCheckDisplayNumber - " + PROJECT_NAME " is already running on display %d\n", + nDisp); + return FALSE; + } + + return TRUE; +} diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am index f6a75df2c..ce2edb2e6 100644 --- a/xorg-server/hw/xwin/Makefile.am +++ b/xorg-server/hw/xwin/Makefile.am @@ -87,6 +87,7 @@ SRCS = InitInput.c \ winkeybd.c \ winkeyhook.c \ winmisc.c \ + winmonitors.c \ winmouse.c \ winmsg.c \ winmultiwindowclass.c \ diff --git a/xorg-server/hw/xwin/man/XWin.man b/xorg-server/hw/xwin/man/XWin.man index 51268f69a..e7933c9c8 100644 --- a/xorg-server/hw/xwin/man/XWin.man +++ b/xorg-server/hw/xwin/man/XWin.man @@ -103,7 +103,7 @@ Examples: .SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS These parameters only apply to windowed mode screens i.e. not -in \fB-multwindow\fP or \fB-rootless\fP mode +in \fB-multiwindow\fP or \fB-rootless\fP mode. .TP 8 .B "\-fullscreen" The X server window takes the full screen, covering completely the @@ -115,10 +115,52 @@ etc. This parameter is ignored when the \fB\-fullscreen\fP parameter is specified. .TP 8 .B \-scrollbars -In windowed mode, allow screens bigger than the \fIWindows\fP desktop. -Moreover, if the window has decorations, one can now resize it. -This parameter is ignored when the \fB\-fullscreen\fP parameter is specified. +Alternative name for \fB\-resize=scrollbars\fP. + +.SH OPTIONS CONTROLLING RESIZE BEHAVIOUR +.TP 8 +.B \-resize[=none|scrollbars|randr] +Select the resize mode of an X screen. + +.RS +.IP \fB\-resize=none\fP 8 +(default). The screen is not resizable. + +In windowed mode, if the window has decorations, a fixed frame is used. + +.IP \fB\-resize=scrollbars\fP 8 +The screen window is resizeable, but the screen is not resizable. + +In windowed mode, if the window has decorations, a resizing frame is used. +Scrollbars are drawn when needed to allow the entire X screen +to viewed by adjusting them. + +This also permits screens bigger than the \fIWindows\fP virtual desktop to be used. + +This parameter is ignored in \fB-multiwindow\fP or \fB-rootless\fP mode. +Alternative name is \fB\-scrollbars\fP. + +.IP \fB\-resize=randr\fP 8 +The screen is resizable and the screen window is resizeable. +In windowed mode, if the window has decorations, a resizing frame is used. + +Resizing the \fIWindows\fP window will use the RANDR extension to change +the size of the X screen. Likewise, changing the size of +the X screen using the RANDR extension will cause the size +of the \fIWindows\fP window containing the X screen to be changed. + +In \fB-multiwindow\fP or \fB-rootless\fP mode, if the X screen is +of the same dimensions as a Windows monitor or the virtual desktop, +the X server will respond to the WM_DISPLAYCHANGED sent when those +dimensions change by resizing the X screen. Changing the size +of the X screen using the RANDR extension is not permitted. + +The maximum dimensions of the screen are the dimensions of the \fIWindows\fP virtual desktop. + +.IP \fB\--resize\fP 8 +on its own is equivalent to \fB\--resize=randr\fP +.RE .SH OPTIONS CONTROLLING WINDOWS INTEGRATION .TP 8 @@ -190,15 +232,27 @@ respectively). .TP 8 .B "\-engine \fIengine_type_id\fP" This option, which is intended for Cygwin/X developers, -overrides the server's automatically selected engine type. This -parameter will be ignored if the specified engine type is not -supported on the current system. The supported engine type ids are 1 -- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw Non-Locking. -Additionally, there are engines with type ids -8 - Primary DirectDraw (obsolete) and 16 - Native GDI (experimental and barely functional). -Default behavior is to determine the engine with optimum performance that +overrides the server's automatically selected drawing engine type. This +parameter will be ignored if the specified drawing engine type is not +supported on the current system. + +Default behavior is to select the drawing engine with optimum performance that supports the specified depth and window configuration. +The engine type ids are: +.RS +.IP 1 4 +Shadow GDI +.IP 2 4 +Shadow DirectDraw +.IP 4 4 +Shadow DirectDraw Non-Locking +.IP 8 4 +Primary DirectDraw (unsupported, obsolete) +.IP 16 4 +Native GDI (unsupported, experimental and barely functional) +.RE + .SH FULLSCREEN OPTIONS .TP 8 .B "\-depth \fIdepth\fP" @@ -322,12 +376,9 @@ X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__), s .SH BUGS .I XWin -and this man page still have many limitations. Some of the more obvious -ones are: -.br -- The display mode can not be changed once the X server has started. -.br -- The \fIXWin\fP software is continuously developing; it is therefore possible that +and this man page still have many limitations. + +The \fIXWin\fP software is continuously developing; it is therefore possible that this man page is not up to date. It is always prudent to look also at the output of \fIXWin -help\fP in order to check the options that are operative. diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index e790d2d73..3f40fdbe0 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -1,1459 +1,1491 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *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 XFREE86 PROJECT 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 XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Dakshinamurthy Karra - * Suhaib M Siddiqi - * Peter Busch - * Harold L Hunt II - * Kensuke Matsuzaki - */ - -#ifndef _WIN_H_ -#define _WIN_H_ - -#ifndef NO -#define NO 0 -#endif -#ifndef YES -#define YES 1 -#endif - -/* Turn debug messages on or off */ -#ifndef CYGDEBUG -#define CYGDEBUG NO -#endif - -/* WM_XBUTTON Messages. They should go into w32api. */ -#ifndef WM_XBUTTONDOWN -# define WM_XBUTTONDOWN 523 -#endif -#ifndef WM_XBUTTONUP -# define WM_XBUTTONUP 524 -#endif -#ifndef WM_XBUTTONDBLCLK -# define WM_XBUTTONDBLCLK 525 -#endif - - -#define WIN_DEFAULT_BPP 0 -#define WIN_DEFAULT_WHITEPIXEL 255 -#define WIN_DEFAULT_BLACKPIXEL 0 -#define WIN_DEFAULT_LINEBIAS 0 -#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */ -#define WIN_DEFAULT_DPI 75 -#define WIN_DEFAULT_REFRESH 0 -#define WIN_DEFAULT_WIN_KILL TRUE -#define WIN_DEFAULT_UNIX_KILL FALSE -#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0 -#ifdef XWIN_EMULATEPSEUDO -#define WIN_DEFAULT_EMULATE_PSEUDO FALSE -#endif -#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE - -#define WIN_DIB_MAXIMUM_SIZE 0x08000000 /* 16 MB on Windows 95, 98, Me */ -#define WIN_DIB_MAXIMUM_SIZE_MB (WIN_DIB_MAXIMUM_SIZE / 8 / 1024 / 1024) - -/* - * Windows only supports 256 color palettes - */ -#define WIN_NUM_PALETTE_ENTRIES 256 - -/* - * Number of times to call Restore in an attempt to restore the primary surface - */ -#define WIN_REGAIN_SURFACE_RETRIES 1 - -/* - * Build a supported display depths mask by shifting one to the left - * by the number of bits in the supported depth. - */ -#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \ - | (1 << (16 - 1)) | (1 << (15 - 1)) \ - | (1 << ( 8 - 1))) -#define WIN_CHECK_DEPTH YES - -/* - * Timer IDs for WM_TIMER - */ -#define WIN_E3B_TIMER_ID 1 -#define WIN_POLLING_MOUSE_TIMER_ID 2 - -#define MOUSE_POLLING_INTERVAL 50 - -#define WIN_E3B_OFF -1 -#define WIN_FD_INVALID -1 - -#define WIN_SERVER_NONE 0x0L /* 0 */ -#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */ -#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */ -#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */ -#ifdef XWIN_PRIMARYFB -#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */ -#endif -#ifdef XWIN_NATIVEGDI -# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */ -#endif - -#define AltMapIndex Mod1MapIndex -#define NumLockMapIndex Mod2MapIndex -#define AltLangMapIndex Mod3MapIndex -#define KanaMapIndex Mod4MapIndex -#define ScrollLockMapIndex Mod5MapIndex - -#define WIN_MOD_LALT 0x00000001 -#define WIN_MOD_RALT 0x00000002 -#define WIN_MOD_LCONTROL 0x00000004 -#define WIN_MOD_RCONTROL 0x00000008 - -#define WIN_24BPP_MASK_RED 0x00FF0000 -#define WIN_24BPP_MASK_GREEN 0x0000FF00 -#define WIN_24BPP_MASK_BLUE 0x000000FF - -#define WIN_MAX_KEYS_PER_KEY 4 - -#include -#include -#include - -#include -#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) -#define HANDLE void * -#include -#undef HANDLE -#endif - -#ifdef HAS_MMAP -#include -#ifndef MAP_FILE -#define MAP_FILE 0 -#endif /* MAP_FILE */ -#endif /* HAS_MMAP */ - -#include -#include -#include -#include -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "pixmap.h" -#include "region.h" -#include "gcstruct.h" -#include "colormap.h" -#include "colormapst.h" -#include "miscstruct.h" -#include "servermd.h" -#include "windowstr.h" -#include "mi.h" -#include "micmap.h" -#include "mifillarc.h" -#include "mifpoly.h" -#include "mibstore.h" -#include "input.h" -#include "mipointer.h" -#include "X11/keysym.h" -#include "mibstore.h" -#include "micoord.h" -#include "dix.h" -#include "miline.h" -#include "shadow.h" -#include "fb.h" -#include "rootless.h" - -#include "mipict.h" -#include "picturestr.h" - -#ifdef RANDR -#include "randrstr.h" -#endif - -/* - * Windows headers - */ -#include "winms.h" -#include "winresource.h" - - -/* - * Define Windows constants - */ - -#define WM_TRAYICON (WM_USER + 1000) -#define WM_INIT_SYS_MENU (WM_USER + 1001) -#define WM_GIVEUP (WM_USER + 1002) - - -/* Local includes */ -#include "winwindow.h" -#include "winmsg.h" - - -/* - * Debugging macros - */ - -#if CYGDEBUG -#define DEBUG_MSG(str,...) \ -if (fDebugProcMsg) \ -{ \ - char *pszTemp; \ - int iLength; \ - if (asprintf (&pszTemp, str, ##__VA_ARGS__) != -1) { \ - MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ - free (pszTemp); \ - } \ -} -#else -#define DEBUG_MSG(str,...) -#endif - -#if CYGDEBUG -#define DEBUG_FN_NAME(str) PTSTR szFunctionName = str -#else -#define DEBUG_FN_NAME(str) -#endif - -#if CYGDEBUG || YES -#define DEBUGVARS BOOL fDebugProcMsg = FALSE -#else -#define DEBUGVARS -#endif - -#if CYGDEBUG || YES -#define DEBUGPROC_MSG fDebugProcMsg = TRUE -#else -#define DEBUGPROC_MSG -#endif - -#define PROFILEPOINT(point,thresh)\ -{\ -static unsigned int PROFPT##point = 0;\ -if (++PROFPT##point % thresh == 0)\ -ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\ -} - - -/* We use xor this macro for detecting toggle key state changes */ -#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) - -#define DEFINE_ATOM_HELPER(func,atom_name) \ -static Atom func (void) { \ - static int generation; \ - static Atom atom; \ - if (generation != serverGeneration) { \ - generation = serverGeneration; \ - atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ - } \ - return atom; \ -} - -/* - * Typedefs for engine dependent function pointers - */ - -typedef Bool (*winAllocateFBProcPtr)(ScreenPtr); - -typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr); - -typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr); - -typedef Bool (*winInitVisualsProcPtr)(ScreenPtr); - -typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr); - -typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr); - -typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **); - -typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr); - -typedef Bool (*winActivateAppProcPtr)(ScreenPtr); - -typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen); - -typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen); - -typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap); - -typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap, - int ndef, xColorItem *pdefs); - -typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap); - -typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap); - -typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr); - -typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr); - -typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr); - -typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin); - -typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr); - - -/* - * GC (graphics context) privates - */ - -typedef struct -{ - HDC hdc; - HDC hdcMem; -} winPrivGCRec, *winPrivGCPtr; - - -/* - * Pixmap privates - */ - -typedef struct -{ - HDC hdcSelected; - HBITMAP hBitmap; - BYTE *pbBits; - DWORD dwScanlineBytes; - BITMAPINFOHEADER *pbmih; -} winPrivPixmapRec, *winPrivPixmapPtr; - - -/* - * Colormap privates - */ - -typedef struct -{ - HPALETTE hPalette; - LPDIRECTDRAWPALETTE lpDDPalette; - RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES]; - PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES]; -} winPrivCmapRec, *winPrivCmapPtr; - -/* - * Windows Cursor handling. - */ - -typedef struct { - /* from GetSystemMetrics */ - int sm_cx; - int sm_cy; - - BOOL visible; - HCURSOR handle; - QueryBestSizeProcPtr QueryBestSize; - miPointerSpriteFuncPtr spriteFuncs; -} winCursorRec; - -/* - * Screen information structure that we need before privates are available - * in the server startup sequence. - */ - -typedef struct -{ - ScreenPtr pScreen; - - /* Did the user specify a height and width? */ - Bool fUserGaveHeightAndWidth; - - DWORD dwScreen; - DWORD dwUserWidth; - DWORD dwUserHeight; - DWORD dwWidth; - DWORD dwHeight; - DWORD dwWidth_mm; - DWORD dwHeight_mm; - DWORD dwPaddedWidth; - - /* Did the user specify a screen position? */ - Bool fUserGavePosition; - DWORD dwInitialX; - DWORD dwInitialY; - - /* - * dwStride is the number of whole pixels that occupy a scanline, - * including those pixels that are not displayed. This is basically - * a rounding up of the width. - */ - DWORD dwStride; - - /* Offset of the screen in the window when using scrollbars */ - DWORD dwXOffset; - DWORD dwYOffset; - - DWORD dwBPP; - DWORD dwDepth; - DWORD dwRefreshRate; - char *pfb; - DWORD dwEngine; - DWORD dwEnginePreferred; - DWORD dwClipUpdatesNBoxes; -#ifdef XWIN_EMULATEPSEUDO - Bool fEmulatePseudo; -#endif - Bool fFullScreen; - Bool fDecoration; -#ifdef XWIN_MULTIWINDOWEXTWM - Bool fMWExtWM; - Bool fInternalWM; - Bool fAnotherWMRunning; -#endif - Bool fRootless; -#ifdef XWIN_MULTIWINDOW - Bool fMultiWindow; -#endif -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - Bool fMultiMonitorOverride; -#endif - Bool fMultipleMonitors; - Bool fLessPointer; - Bool fScrollbars; - Bool fNoTrayIcon; - int iE3BTimeout; - /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */ - Bool fUseWinKillKey; - Bool fUseUnixKillKey; - Bool fIgnoreInput; - - /* Did the user explicitly set this screen? */ - Bool fExplicitScreen; -} winScreenInfo, *winScreenInfoPtr; - - -/* - * Screen privates - */ - -typedef struct _winPrivScreenRec -{ - winScreenInfoPtr pScreenInfo; - - Bool fEnabled; - Bool fClosed; - Bool fActive; - Bool fBadDepth; - - int iDeltaZ; - - int iConnectedClients; - - CloseScreenProcPtr CloseScreen; - - DWORD dwRedMask; - DWORD dwGreenMask; - DWORD dwBlueMask; - DWORD dwBitsPerRGB; - - DWORD dwModeKeyStates; - - /* Handle to icons that must be freed */ - HICON hiconNotifyIcon; - - /* Last width, height, and depth of the Windows display */ - DWORD dwLastWindowsWidth; - DWORD dwLastWindowsHeight; - DWORD dwLastWindowsBitsPixel; - - /* Palette management */ - ColormapPtr pcmapInstalled; - - /* Pointer to the root visual so we only have to look it up once */ - VisualPtr pRootVisual; - - /* 3 button emulation variables */ - int iE3BCachedPress; - Bool fE3BFakeButton2Sent; - - /* Privates used by shadow fb GDI server */ - HBITMAP hbmpShadow; - HDC hdcScreen; - HDC hdcShadow; - HWND hwndScreen; - - /* Privates used by shadow fb and primary fb DirectDraw servers */ - LPDIRECTDRAW pdd; - LPDIRECTDRAWSURFACE2 pddsPrimary; - LPDIRECTDRAW2 pdd2; - - /* Privates used by shadow fb DirectDraw server */ - LPDIRECTDRAWSURFACE2 pddsShadow; - LPDDSURFACEDESC pddsdShadow; - - /* Privates used by primary fb DirectDraw server */ - LPDIRECTDRAWSURFACE2 pddsOffscreen; - LPDDSURFACEDESC pddsdOffscreen; - LPDDSURFACEDESC pddsdPrimary; - - /* Privates used by shadow fb DirectDraw Nonlocking server */ - LPDIRECTDRAW4 pdd4; - LPDIRECTDRAWSURFACE4 pddsShadow4; - LPDIRECTDRAWSURFACE4 pddsPrimary4; - BOOL fRetryCreateSurface; - - /* Privates used by both shadow fb DirectDraw servers */ - LPDIRECTDRAWCLIPPER pddcPrimary; - -#ifdef XWIN_MULTIWINDOWEXTWM - /* Privates used by multi-window external window manager */ - RootlessFrameID widTop; - Bool fRestacking; -#endif - -#ifdef XWIN_MULTIWINDOW - /* Privates used by multi-window */ - pthread_t ptWMProc; - pthread_t ptXMsgProc; - void *pWMInfo; -#endif - -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - /* Privates used by both multi-window and rootless */ - Bool fRootWindowShown; -#endif - -#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) - /* Privates used for any module running in a seperate thread */ - pthread_mutex_t pmServerStarted; - Bool fServerStarted; -#endif - - /* Engine specific functions */ - winAllocateFBProcPtr pwinAllocateFB; - winShadowUpdateProcPtr pwinShadowUpdate; - winCloseScreenProcPtr pwinCloseScreen; - winInitVisualsProcPtr pwinInitVisuals; - winAdjustVideoModeProcPtr pwinAdjustVideoMode; - winCreateBoundingWindowProcPtr pwinCreateBoundingWindow; - winFinishScreenInitProcPtr pwinFinishScreenInit; - winBltExposedRegionsProcPtr pwinBltExposedRegions; - winActivateAppProcPtr pwinActivateApp; - winRedrawScreenProcPtr pwinRedrawScreen; - winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette; - winInstallColormapProcPtr pwinInstallColormap; - winStoreColorsProcPtr pwinStoreColors; - winCreateColormapProcPtr pwinCreateColormap; - winDestroyColormapProcPtr pwinDestroyColormap; - winHotKeyAltTabProcPtr pwinHotKeyAltTab; - winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface; - winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface; - - winCreateScreenResourcesProc pwinCreateScreenResources; - -#ifdef XWIN_MULTIWINDOW - /* Window Procedures for MultiWindow mode */ - winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow; -#endif - - /* Window Procedures for Rootless mode */ - CreateWindowProcPtr CreateWindow; - DestroyWindowProcPtr DestroyWindow; - PositionWindowProcPtr PositionWindow; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - RealizeWindowProcPtr RealizeWindow; - UnrealizeWindowProcPtr UnrealizeWindow; - ValidateTreeProcPtr ValidateTree; - PostValidateTreeProcPtr PostValidateTree; - WindowExposuresProcPtr WindowExposures; - CopyWindowProcPtr CopyWindow; - ClearToBackgroundProcPtr ClearToBackground; - ClipNotifyProcPtr ClipNotify; - RestackWindowProcPtr RestackWindow; - ReparentWindowProcPtr ReparentWindow; - ResizeWindowProcPtr ResizeWindow; - MoveWindowProcPtr MoveWindow; - SetShapeProcPtr SetShape; - - winCursorRec cursor; -} winPrivScreenRec; - - -#ifdef XWIN_MULTIWINDOWEXTWM -typedef struct { - RootlessWindowPtr pFrame; - HWND hWnd; - int dwWidthBytes; - BITMAPINFOHEADER *pbmihShadow; - HBITMAP hbmpShadow; - HDC hdcShadow; - HDC hdcScreen; - BOOL fResized; - BOOL fRestackingNow; - BOOL fClose; - BOOL fMovingOrSizing; - BOOL fDestroyed;//for debug - char *pfb; -} win32RootlessWindowRec, *win32RootlessWindowPtr; -#endif - - -typedef struct { - pointer value; - XID id; -} WindowIDPairRec, *WindowIDPairPtr; - - -/* - * Extern declares for general global variables - */ - -#include "winglobals.h" - -extern winScreenInfo * g_ScreenInfo; -extern miPointerScreenFuncRec g_winPointerCursorFuncs; -extern DWORD g_dwEvents; -#ifdef HAS_DEVWINDOWS -extern int g_fdMessageQueue; -#endif -extern DevPrivateKeyRec g_iScreenPrivateKeyRec; -#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec) -extern DevPrivateKeyRec g_iCmapPrivateKeyRec; -#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec) -extern DevPrivateKeyRec g_iGCPrivateKeyRec; -#define g_iGCPrivateKey (&g_iGCPrivateKeyRec) -extern DevPrivateKeyRec g_iPixmapPrivateKeyRec; -#define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec) -extern DevPrivateKeyRec g_iWindowPrivateKeyRec; -#define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec) - -extern unsigned long g_ulServerGeneration; -extern DWORD g_dwEnginesSupported; -extern HINSTANCE g_hInstance; -extern int g_copyROP[]; -extern int g_patternROP[]; -extern const char * g_pszQueryHost; -extern DeviceIntPtr g_pwinPointer; -extern DeviceIntPtr g_pwinKeyboard; - -/* - * Extern declares for dynamically loaded library function pointers - */ - -extern FARPROC g_fpDirectDrawCreate; -extern FARPROC g_fpDirectDrawCreateClipper; -extern FARPROC g_fpTrackMouseEvent; - - -/* - * Screen privates macros - */ - -#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ - dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey)) - -#define winSetScreenPriv(pScreen,v) \ - dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v) - -#define winScreenPriv(pScreen) \ - winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) - - -/* - * Colormap privates macros - */ - -#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \ - dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey)) - -#define winSetCmapPriv(pCmap,v) \ - dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v) - -#define winCmapPriv(pCmap) \ - winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap) - - -/* - * GC privates macros - */ - -#define winGetGCPriv(pGC) ((winPrivGCPtr) \ - dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey)) - -#define winSetGCPriv(pGC,v) \ - dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v) - -#define winGCPriv(pGC) \ - winPrivGCPtr pGCPriv = winGetGCPriv(pGC) - - -/* - * Pixmap privates macros - */ - -#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \ - dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey)) - -#define winSetPixmapPriv(pPixmap,v) \ - dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v) - -#define winPixmapPriv(pPixmap) \ - winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap) - - -/* - * Window privates macros - */ - -#define winGetWindowPriv(pWin) ((winPrivWinPtr) \ - dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey)) - -#define winSetWindowPriv(pWin,v) \ - dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v) - -#define winWindowPriv(pWin) \ - winPrivWinPtr pWinPriv = winGetWindowPriv(pWin) - -/* - * wrapper macros - */ -#define _WIN_WRAP(priv, real, mem, func) {\ - priv->mem = real->mem; \ - real->mem = func; \ -} - -#define _WIN_UNWRAP(priv, real, mem) {\ - real->mem = priv->mem; \ -} - -#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func) - -#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem) - -/* - * BEGIN DDX and DIX Function Prototypes - */ - - -/* - * winallpriv.c - */ - -Bool -winAllocatePrivates (ScreenPtr pScreen); - -Bool -winInitCmapPrivates (ColormapPtr pCmap, int index); - -Bool -winAllocateCmapPrivates (ColormapPtr pCmap); - - -/* - * winauth.c - */ - -#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) -Bool -winGenerateAuthorization (void); -void winSetAuthorization(void); -#endif - - -/* - * winblock.c - */ - -void -winBlockHandler (int nScreen, - pointer pBlockData, - pointer pTimeout, - pointer pReadMask); - - -#ifdef XWIN_NATIVEGDI -/* - * winclip.c - */ - -RegionPtr -winPixmapToRegionNativeGDI (PixmapPtr pPix); -#endif - - -#ifdef XWIN_CLIPBOARD -/* - * winclipboardinit.c - */ - -Bool -winInitClipboard (void); - -void -winFixClipboardChain (void); -#endif - - -/* - * wincmap.c - */ - -void -winSetColormapFunctions (ScreenPtr pScreen); - -Bool -winCreateDefColormap (ScreenPtr pScreen); - - -/* - * wincreatewnd.c - */ - -Bool -winCreateBoundingWindowFullScreen (ScreenPtr pScreen); - -Bool -winCreateBoundingWindowWindowed (ScreenPtr pScreen); - - -/* - * windialogs.c - */ - -void -winDisplayExitDialog (winPrivScreenPtr pScreenPriv); - -void -winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv); - -void -winDisplayAboutDialog (winPrivScreenPtr pScreenPriv); - - -/* - * winengine.c - */ - -void -winDetectSupportedEngines (void); - -Bool -winSetEngine (ScreenPtr pScreen); - -Bool -winGetDDProcAddresses (void); - -void -winReleaseDDProcAddresses(void); - - -/* - * winerror.c - */ - -#ifdef DDXOSVERRORF -void -OSVenderVErrorF (const char *pszFormat, va_list va_args); -#endif - -void -winMessageBoxF (const char *pszError, UINT uType, ...); - - -#ifdef XWIN_NATIVEGDI -/* - * winfillsp.c - */ - -void -winFillSpansNativeGDI (DrawablePtr pDrawable, - GCPtr pGC, - int nSpans, - DDXPointPtr pPoints, - int *pWidths, - int fSorted); -#endif - - -#ifdef XWIN_NATIVEGDI -/* - * winfont.c - */ - -Bool -winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); - -Bool -winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); -#endif - - -#ifdef XWIN_NATIVEGDI -/* - * wingc.c - */ - -Bool -winCreateGCNativeGDI (GCPtr pGC); -#endif - - -#ifdef XWIN_NATIVEGDI -/* - * wingetsp.c - */ - -void -winGetSpansNativeGDI (DrawablePtr pDrawable, - int wMax, - DDXPointPtr pPoints, - int *pWidths, - int nSpans, - char *pDst); -#endif - - -/* - * winglobals.c - */ - -void -winInitializeGlobals (void); - - -/* - * winkeybd.c - */ - -void -winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode); - -int -winKeybdProc (DeviceIntPtr pDeviceInt, int iState); - -void -winInitializeModeKeyStates (void); - -void -winRestoreModeKeyStates (void); - -Bool -winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam); - -void -winKeybdReleaseKeys (void); - -void -winSendKeyEvent (DWORD dwKey, Bool fDown); - -BOOL -winCheckKeyPressed(WPARAM wParam, LPARAM lParam); - -void -winFixShiftKeys (int iScanCode); - -/* - * winkeyhook.c - */ - -Bool -winInstallKeyboardHookLL (void); - -void -winRemoveKeyboardHookLL (void); - - -/* - * winmisc.c - */ - -#ifdef XWIN_NATIVEGDI -void -winQueryBestSizeNativeGDI (int class, unsigned short *pWidth, - unsigned short *pHeight, ScreenPtr pScreen); -#endif - -CARD8 -winCountBits (DWORD dw); - -Bool -winUpdateFBPointer (ScreenPtr pScreen, void *pbits); - -#ifdef XWIN_NATIVEGDI -BOOL -winPaintBackground (HWND hwnd, COLORREF colorref); -#endif - - -/* - * winmouse.c - */ - -int -winMouseProc (DeviceIntPtr pDeviceInt, int iState); - -int -winMouseWheel (ScreenPtr pScreen, int iDeltaZ); - -void -winMouseButtonsSendEvent (int iEventType, int iButton); - -int -winMouseButtonsHandle (ScreenPtr pScreen, - int iEventType, int iButton, - WPARAM wParam); - -void -winEnqueueMotion(int x, int y); - -#ifdef XWIN_NATIVEGDI -/* - * winnativegdi.c - */ - -HBITMAP -winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth, - BYTE **ppbBits, BITMAPINFO **ppbmi); - -Bool -winSetEngineFunctionsNativeGDI (ScreenPtr pScreen); -#endif - - -#ifdef XWIN_PRIMARYFB -/* - * winpfbddd.c - */ - -Bool -winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen); -#endif - - -#ifdef XWIN_NATIVEGDI -/* - * winpixmap.c - */ - -PixmapPtr -winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth, - unsigned usage_hint); - -Bool -winDestroyPixmapNativeGDI (PixmapPtr pPixmap); - -Bool -winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap, - int iWidth, int iHeight, - int iDepth, - int iBitsPerPixel, - int devKind, - pointer pPixData); -#endif - -#ifdef XWIN_NATIVEGDI -/* - * winpolyline.c - */ - -void -winPolyLineNativeGDI (DrawablePtr pDrawable, - GCPtr pGC, - int mode, - int npt, - DDXPointPtr ppt); -#endif - - -#ifdef XWIN_NATIVEGDI -/* - * winpushpxl.c - */ - -void -winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, - int dx, int dy, int xOrg, int yOrg); -#endif - - -/* - * winscrinit.c - */ - -Bool -winScreenInit (int index, - ScreenPtr pScreen, - int argc, char **argv); - -Bool -winFinishScreenInitFB (int index, - ScreenPtr pScreen, - int argc, char **argv); - -#if defined(XWIN_NATIVEGDI) -Bool -winFinishScreenInitNativeGDI (int index, - ScreenPtr pScreen, - int argc, char **argv); -#endif - - -#ifdef XWIN_NATIVEGDI -/* - * winsetsp.c - */ - -void -winSetSpansNativeGDI (DrawablePtr pDrawable, - GCPtr pGC, - char *pSrc, - DDXPointPtr pPoints, - int *pWidth, - int nSpans, - int fSorted); -#endif - - -/* - * winshaddd.c - */ - -Bool -winSetEngineFunctionsShadowDD (ScreenPtr pScreen); - - -/* - * winshadddnl.c - */ - -Bool -winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen); - - -/* - * winshadgdi.c - */ - -Bool -winSetEngineFunctionsShadowGDI (ScreenPtr pScreen); - - -/* - * winwakeup.c - */ - -void -winWakeupHandler (int nScreen, - pointer pWakeupData, - unsigned long ulResult, - pointer pReadmask); - - -/* - * winwindow.c - */ - -#ifdef XWIN_NATIVEGDI -Bool -winCreateWindowNativeGDI (WindowPtr pWin); - -Bool -winDestroyWindowNativeGDI (WindowPtr pWin); - -Bool -winPositionWindowNativeGDI (WindowPtr pWin, int x, int y); - -void -winCopyWindowNativeGDI (WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc); - -Bool -winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask); - -Bool -winUnmapWindowNativeGDI (WindowPtr pWindow); - -Bool -winMapWindowNativeGDI (WindowPtr pWindow); -#endif - -Bool -winCreateWindowRootless (WindowPtr pWindow); - -Bool -winDestroyWindowRootless (WindowPtr pWindow); - -Bool -winPositionWindowRootless (WindowPtr pWindow, int x, int y); - -Bool -winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask); - -Bool -winUnmapWindowRootless (WindowPtr pWindow); - -Bool -winMapWindowRootless (WindowPtr pWindow); - -void -winSetShapeRootless (WindowPtr pWindow, int kind); - - -/* - * winmultiwindowicons.c - Used by both multi-window and Win32Rootless - */ - -HICON -winXIconToHICON (WindowPtr pWin, int iconSize); - -void -winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon); - -#ifdef XWIN_MULTIWINDOW -/* - * winmultiwindowshape.c - */ - -void -winReshapeMultiWindow (WindowPtr pWin); - -void -winSetShapeMultiWindow (WindowPtr pWindow, int kind); - -void -winUpdateRgnMultiWindow (WindowPtr pWindow); -#endif - - -#ifdef XWIN_MULTIWINDOW -/* - * winmultiwindowwindow.c - */ - -Bool -winCreateWindowMultiWindow (WindowPtr pWindow); - -Bool -winDestroyWindowMultiWindow (WindowPtr pWindow); - -Bool -winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y); - -Bool -winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask); - -Bool -winUnmapWindowMultiWindow (WindowPtr pWindow); - -Bool -winMapWindowMultiWindow (WindowPtr pWindow); - -void -winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent); - -void -winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib); - -void -winReorderWindowsMultiWindow (void); - -void -winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w, - unsigned int h, WindowPtr pSib); -void -winMoveWindowMultiWindow (WindowPtr pWin, int x, int y, - WindowPtr pSib, VTKind kind); - -void -winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt, - RegionPtr oldRegion); - -XID -winGetWindowID (WindowPtr pWin); - -int -winAdjustXWindow (WindowPtr pWin, HWND hwnd); -#endif - - -#ifdef XWIN_MULTIWINDOW -/* - * winmultiwindowwndproc.c - */ - -LRESULT CALLBACK -winTopLevelWindowProc (HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam); -#endif - - -/* - * wintrayicon.c - */ - -void -winInitNotifyIcon (winPrivScreenPtr pScreenPriv); - -void -winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv); - -LRESULT -winHandleIconMessage (HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam, - winPrivScreenPtr pScreenPriv); - - -/* - * winwndproc.c - */ - -LRESULT CALLBACK -winWindowProc (HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam); - - -#ifdef XWIN_MULTIWINDOWEXTWM -/* - * winwin32rootless.c - */ - -Bool -winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen, - int newX, int newY, RegionPtr pShape); - -void -winMWExtWMDestroyFrame (RootlessFrameID wid); - -void -winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); - -void -winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen, - int newX, int newY, unsigned int newW, unsigned int newH, - unsigned int gravity); - -void -winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid); - -void -winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape); - -void -winMWExtWMUnmapFrame (RootlessFrameID wid); - -void -winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow); - -void -winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush); - -void -winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage); - -void -winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects, - int shift_x, int shift_y); - -void -winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin); - -void -winMWExtWMCopyBytes (unsigned int width, unsigned int height, - const void *src, unsigned int srcRowBytes, - void *dst, unsigned int dstRowBytes); - -void -winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, - int dx, int dy); -#endif - - -#ifdef XWIN_MULTIWINDOWEXTWM -/* - * winwin32rootlesswindow.c - */ - -void -winMWExtWMReorderWindows (ScreenPtr pScreen); - -void -winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y); - -void -winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h); - -void -winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h); - -void -winMWExtWMUpdateIcon (Window id); - -void -winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv, - winScreenInfoPtr pScreenInfo); - -wBOOL CALLBACK -winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam); - -Bool -winIsInternalWMRunning (winScreenInfoPtr pScreenInfo); - -void -winMWExtWMRestackWindows (ScreenPtr pScreen); -#endif - - -#ifdef XWIN_MULTIWINDOWEXTWM -/* - * winwin32rootlesswndproc.c - */ - -LRESULT CALLBACK -winMWExtWMWindowProc (HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam); -#endif - - -/* - * winwindowswm.c - */ - -void -winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg, - Window window, int x, int y, int w, int h); - -void -winWindowsWMExtensionInit (void); - -/* - * wincursor.c - */ - -Bool -winInitCursor (ScreenPtr pScreen); - -/* - * winprocarg.c - */ -void -winInitializeScreens(int maxscreens); - -/* - * END DDX and DIX Function Prototypes - */ - -#endif /* _WIN_H_ */ - +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + * Kensuke Matsuzaki + */ + +#ifndef _WIN_H_ +#define _WIN_H_ + +#ifndef NO +#define NO 0 +#endif +#ifndef YES +#define YES 1 +#endif + +/* Turn debug messages on or off */ +#ifndef CYGDEBUG +#define CYGDEBUG NO +#endif + +/* WM_XBUTTON Messages. They should go into w32api. */ +#ifndef WM_XBUTTONDOWN +# define WM_XBUTTONDOWN 523 +#endif +#ifndef WM_XBUTTONUP +# define WM_XBUTTONUP 524 +#endif +#ifndef WM_XBUTTONDBLCLK +# define WM_XBUTTONDBLCLK 525 +#endif + + +#define WIN_DEFAULT_BPP 0 +#define WIN_DEFAULT_WHITEPIXEL 255 +#define WIN_DEFAULT_BLACKPIXEL 0 +#define WIN_DEFAULT_LINEBIAS 0 +#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */ +#define WIN_DEFAULT_DPI 75 +#define WIN_DEFAULT_REFRESH 0 +#define WIN_DEFAULT_WIN_KILL TRUE +#define WIN_DEFAULT_UNIX_KILL FALSE +#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0 +#ifdef XWIN_EMULATEPSEUDO +#define WIN_DEFAULT_EMULATE_PSEUDO FALSE +#endif +#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE + +/* + * Windows only supports 256 color palettes + */ +#define WIN_NUM_PALETTE_ENTRIES 256 + +/* + * Number of times to call Restore in an attempt to restore the primary surface + */ +#define WIN_REGAIN_SURFACE_RETRIES 1 + +/* + * Build a supported display depths mask by shifting one to the left + * by the number of bits in the supported depth. + */ +#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \ + | (1 << (16 - 1)) | (1 << (15 - 1)) \ + | (1 << ( 8 - 1))) +#define WIN_CHECK_DEPTH YES + +/* + * Timer IDs for WM_TIMER + */ +#define WIN_E3B_TIMER_ID 1 +#define WIN_POLLING_MOUSE_TIMER_ID 2 + +#define MOUSE_POLLING_INTERVAL 50 + +#define WIN_E3B_OFF -1 +#define WIN_FD_INVALID -1 + +#define WIN_SERVER_NONE 0x0L /* 0 */ +#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */ +#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */ +#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */ +#ifdef XWIN_PRIMARYFB +#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */ +#endif +#ifdef XWIN_NATIVEGDI +# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */ +#endif + +#define AltMapIndex Mod1MapIndex +#define NumLockMapIndex Mod2MapIndex +#define AltLangMapIndex Mod3MapIndex +#define KanaMapIndex Mod4MapIndex +#define ScrollLockMapIndex Mod5MapIndex + +#define WIN_MOD_LALT 0x00000001 +#define WIN_MOD_RALT 0x00000002 +#define WIN_MOD_LCONTROL 0x00000004 +#define WIN_MOD_RCONTROL 0x00000008 + +#define WIN_24BPP_MASK_RED 0x00FF0000 +#define WIN_24BPP_MASK_GREEN 0x0000FF00 +#define WIN_24BPP_MASK_BLUE 0x000000FF + +#define WIN_MAX_KEYS_PER_KEY 4 + +#include +#include +#include + +#include +#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) +#define HANDLE void * +#include +#undef HANDLE +#endif + +#ifdef HAS_MMAP +#include +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif /* MAP_FILE */ +#endif /* HAS_MMAP */ + +#include +#include +#include +#include +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "pixmap.h" +#include "region.h" +#include "gcstruct.h" +#include "colormap.h" +#include "colormapst.h" +#include "miscstruct.h" +#include "servermd.h" +#include "windowstr.h" +#include "mi.h" +#include "micmap.h" +#include "mifillarc.h" +#include "mifpoly.h" +#include "mibstore.h" +#include "input.h" +#include "mipointer.h" +#include "X11/keysym.h" +#include "mibstore.h" +#include "micoord.h" +#include "dix.h" +#include "miline.h" +#include "shadow.h" +#include "fb.h" +#include "rootless.h" + +#include "mipict.h" +#include "picturestr.h" + +#ifdef RANDR +#include "randrstr.h" +#endif + +/* + * Windows headers + */ +#include "winms.h" +#include "winresource.h" + + +/* + * Define Windows constants + */ + +#define WM_TRAYICON (WM_USER + 1000) +#define WM_INIT_SYS_MENU (WM_USER + 1001) +#define WM_GIVEUP (WM_USER + 1002) + + +/* Local includes */ +#include "winwindow.h" +#include "winmsg.h" + + +/* + * Debugging macros + */ + +#if CYGDEBUG +#define DEBUG_MSG(str,...) \ +if (fDebugProcMsg) \ +{ \ + char *pszTemp; \ + int iLength; \ + if (asprintf (&pszTemp, str, ##__VA_ARGS__) != -1) { \ + MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ + free (pszTemp); \ + } \ +} +#else +#define DEBUG_MSG(str,...) +#endif + +#if CYGDEBUG +#define DEBUG_FN_NAME(str) PTSTR szFunctionName = str +#else +#define DEBUG_FN_NAME(str) +#endif + +#if CYGDEBUG || YES +#define DEBUGVARS BOOL fDebugProcMsg = FALSE +#else +#define DEBUGVARS +#endif + +#if CYGDEBUG || YES +#define DEBUGPROC_MSG fDebugProcMsg = TRUE +#else +#define DEBUGPROC_MSG +#endif + +#define PROFILEPOINT(point,thresh)\ +{\ +static unsigned int PROFPT##point = 0;\ +if (++PROFPT##point % thresh == 0)\ +ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\ +} + + +/* We use xor this macro for detecting toggle key state changes */ +#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) + +#define DEFINE_ATOM_HELPER(func,atom_name) \ +static Atom func (void) { \ + static int generation; \ + static Atom atom; \ + if (generation != serverGeneration) { \ + generation = serverGeneration; \ + atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ + } \ + return atom; \ +} + +/* + * Typedefs for engine dependent function pointers + */ + +typedef Bool (*winAllocateFBProcPtr)(ScreenPtr); + +typedef void (*winFreeFBProcPtr)(ScreenPtr); + +typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr); + +typedef Bool (*winInitScreenProcPtr)(ScreenPtr); + +typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr); + +typedef Bool (*winInitVisualsProcPtr)(ScreenPtr); + +typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr); + +typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr); + +typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **); + +typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr); + +typedef Bool (*winActivateAppProcPtr)(ScreenPtr); + +typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen); + +typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen); + +typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap); + +typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap, + int ndef, xColorItem *pdefs); + +typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap); + +typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap); + +typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr); + +typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr); + +typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr); + +typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin); + +typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr); + +#ifdef XWIN_NATIVEGDI +/* Typedefs for native GDI wrappers */ +typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont); +typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont); +#endif + + +/* + * GC (graphics context) privates + */ + +typedef struct +{ + HDC hdc; + HDC hdcMem; +} winPrivGCRec, *winPrivGCPtr; + + +/* + * Pixmap privates + */ + +typedef struct +{ + HDC hdcSelected; + HBITMAP hBitmap; + BYTE *pbBits; + DWORD dwScanlineBytes; + BITMAPINFOHEADER *pbmih; +} winPrivPixmapRec, *winPrivPixmapPtr; + + +/* + * Colormap privates + */ + +typedef struct +{ + HPALETTE hPalette; + LPDIRECTDRAWPALETTE lpDDPalette; + RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES]; + PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES]; +} winPrivCmapRec, *winPrivCmapPtr; + +/* + * Windows Cursor handling. + */ + +typedef struct { + /* from GetSystemMetrics */ + int sm_cx; + int sm_cy; + + BOOL visible; + HCURSOR handle; + QueryBestSizeProcPtr QueryBestSize; + miPointerSpriteFuncPtr spriteFuncs; +} winCursorRec; + +/* + * Resize modes + */ +typedef enum { + notAllowed, + resizeWithScrollbars, + resizeWithRandr +} winResizeMode; + +/* + * Screen information structure that we need before privates are available + * in the server startup sequence. + */ + +typedef struct +{ + ScreenPtr pScreen; + + /* Did the user specify a height and width? */ + Bool fUserGaveHeightAndWidth; + + DWORD dwScreen; + + int iMonitor; + DWORD dwUserWidth; + DWORD dwUserHeight; + DWORD dwWidth; + DWORD dwHeight; + DWORD dwPaddedWidth; + + /* Did the user specify a screen position? */ + Bool fUserGavePosition; + DWORD dwInitialX; + DWORD dwInitialY; + + /* + * dwStride is the number of whole pixels that occupy a scanline, + * including those pixels that are not displayed. This is basically + * a rounding up of the width. + */ + DWORD dwStride; + + /* Offset of the screen in the window when using scrollbars */ + DWORD dwXOffset; + DWORD dwYOffset; + + DWORD dwBPP; + DWORD dwDepth; + DWORD dwRefreshRate; + char *pfb; + DWORD dwEngine; + DWORD dwEnginePreferred; + DWORD dwClipUpdatesNBoxes; +#ifdef XWIN_EMULATEPSEUDO + Bool fEmulatePseudo; +#endif + Bool fFullScreen; + Bool fDecoration; +#ifdef XWIN_MULTIWINDOWEXTWM + Bool fMWExtWM; + Bool fInternalWM; + Bool fAnotherWMRunning; +#endif + Bool fRootless; +#ifdef XWIN_MULTIWINDOW + Bool fMultiWindow; +#endif +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + Bool fMultiMonitorOverride; +#endif + Bool fMultipleMonitors; + Bool fLessPointer; + winResizeMode iResizeMode; + Bool fNoTrayIcon; + int iE3BTimeout; + /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */ + Bool fUseWinKillKey; + Bool fUseUnixKillKey; + Bool fIgnoreInput; + + /* Did the user explicitly set this screen? */ + Bool fExplicitScreen; +} winScreenInfo, *winScreenInfoPtr; + + +/* + * Screen privates + */ + +typedef struct _winPrivScreenRec +{ + winScreenInfoPtr pScreenInfo; + + Bool fEnabled; + Bool fClosed; + Bool fActive; + Bool fBadDepth; + + int iDeltaZ; + + int iConnectedClients; + + CloseScreenProcPtr CloseScreen; + + DWORD dwRedMask; + DWORD dwGreenMask; + DWORD dwBlueMask; + DWORD dwBitsPerRGB; + + DWORD dwModeKeyStates; + + /* Handle to icons that must be freed */ + HICON hiconNotifyIcon; + + /* Palette management */ + ColormapPtr pcmapInstalled; + + /* Pointer to the root visual so we only have to look it up once */ + VisualPtr pRootVisual; + + /* 3 button emulation variables */ + int iE3BCachedPress; + Bool fE3BFakeButton2Sent; + + /* Privates used by shadow fb GDI server */ + HBITMAP hbmpShadow; + HDC hdcScreen; + HDC hdcShadow; + HWND hwndScreen; + BITMAPINFOHEADER *pbmih; + + /* Privates used by shadow fb and primary fb DirectDraw servers */ + LPDIRECTDRAW pdd; + LPDIRECTDRAWSURFACE2 pddsPrimary; + LPDIRECTDRAW2 pdd2; + + /* Privates used by shadow fb DirectDraw server */ + LPDIRECTDRAWSURFACE2 pddsShadow; + LPDDSURFACEDESC pddsdShadow; + + /* Privates used by primary fb DirectDraw server */ + LPDIRECTDRAWSURFACE2 pddsOffscreen; + LPDDSURFACEDESC pddsdOffscreen; + LPDDSURFACEDESC pddsdPrimary; + + /* Privates used by shadow fb DirectDraw Nonlocking server */ + LPDIRECTDRAW4 pdd4; + LPDIRECTDRAWSURFACE4 pddsShadow4; + LPDIRECTDRAWSURFACE4 pddsPrimary4; + BOOL fRetryCreateSurface; + + /* Privates used by both shadow fb DirectDraw servers */ + LPDIRECTDRAWCLIPPER pddcPrimary; + +#ifdef XWIN_MULTIWINDOWEXTWM + /* Privates used by multi-window external window manager */ + RootlessFrameID widTop; + Bool fRestacking; +#endif + +#ifdef XWIN_MULTIWINDOW + /* Privates used by multi-window */ + pthread_t ptWMProc; + pthread_t ptXMsgProc; + void *pWMInfo; +#endif + +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + /* Privates used by both multi-window and rootless */ + Bool fRootWindowShown; +#endif + +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) + /* Privates used for any module running in a seperate thread */ + pthread_mutex_t pmServerStarted; + Bool fServerStarted; +#endif + + /* Engine specific functions */ + winAllocateFBProcPtr pwinAllocateFB; + winFreeFBProcPtr pwinFreeFB; + winShadowUpdateProcPtr pwinShadowUpdate; + winInitScreenProcPtr pwinInitScreen; + winCloseScreenProcPtr pwinCloseScreen; + winInitVisualsProcPtr pwinInitVisuals; + winAdjustVideoModeProcPtr pwinAdjustVideoMode; + winCreateBoundingWindowProcPtr pwinCreateBoundingWindow; + winFinishScreenInitProcPtr pwinFinishScreenInit; + winBltExposedRegionsProcPtr pwinBltExposedRegions; + winActivateAppProcPtr pwinActivateApp; + winRedrawScreenProcPtr pwinRedrawScreen; + winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette; + winInstallColormapProcPtr pwinInstallColormap; + winStoreColorsProcPtr pwinStoreColors; + winCreateColormapProcPtr pwinCreateColormap; + winDestroyColormapProcPtr pwinDestroyColormap; + winHotKeyAltTabProcPtr pwinHotKeyAltTab; + winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface; + winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface; + + winCreateScreenResourcesProc pwinCreateScreenResources; + +#ifdef XWIN_MULTIWINDOW + /* Window Procedures for MultiWindow mode */ + winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow; +#endif + + /* Window Procedures for Rootless mode */ + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; + PositionWindowProcPtr PositionWindow; + ChangeWindowAttributesProcPtr ChangeWindowAttributes; + RealizeWindowProcPtr RealizeWindow; + UnrealizeWindowProcPtr UnrealizeWindow; + ValidateTreeProcPtr ValidateTree; + PostValidateTreeProcPtr PostValidateTree; + WindowExposuresProcPtr WindowExposures; + CopyWindowProcPtr CopyWindow; + ClearToBackgroundProcPtr ClearToBackground; + ClipNotifyProcPtr ClipNotify; + RestackWindowProcPtr RestackWindow; + ReparentWindowProcPtr ReparentWindow; + ResizeWindowProcPtr ResizeWindow; + MoveWindowProcPtr MoveWindow; + SetShapeProcPtr SetShape; + + winCursorRec cursor; + +#ifdef XWIN_NATIVEGDI + RealizeFontPtr RealizeFont; + UnrealizeFontPtr UnrealizeFont; +#endif + +} winPrivScreenRec; + + +#ifdef XWIN_MULTIWINDOWEXTWM +typedef struct { + RootlessWindowPtr pFrame; + HWND hWnd; + int dwWidthBytes; + BITMAPINFOHEADER *pbmihShadow; + HBITMAP hbmpShadow; + HDC hdcShadow; + HDC hdcScreen; + BOOL fResized; + BOOL fRestackingNow; + BOOL fClose; + BOOL fMovingOrSizing; + BOOL fDestroyed;//for debug + char *pfb; +} win32RootlessWindowRec, *win32RootlessWindowPtr; +#endif + + +typedef struct { + pointer value; + XID id; +} WindowIDPairRec, *WindowIDPairPtr; + + +/* + * Extern declares for general global variables + */ + +#include "winglobals.h" + +extern winScreenInfo * g_ScreenInfo; +extern miPointerScreenFuncRec g_winPointerCursorFuncs; +extern DWORD g_dwEvents; +#ifdef HAS_DEVWINDOWS +extern int g_fdMessageQueue; +#endif +extern DevPrivateKeyRec g_iScreenPrivateKeyRec; +#define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec) +extern DevPrivateKeyRec g_iCmapPrivateKeyRec; +#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec) +extern DevPrivateKeyRec g_iGCPrivateKeyRec; +#define g_iGCPrivateKey (&g_iGCPrivateKeyRec) +extern DevPrivateKeyRec g_iPixmapPrivateKeyRec; +#define g_iPixmapPrivateKey (&g_iPixmapPrivateKeyRec) +extern DevPrivateKeyRec g_iWindowPrivateKeyRec; +#define g_iWindowPrivateKey (&g_iWindowPrivateKeyRec) + +extern unsigned long g_ulServerGeneration; +extern DWORD g_dwEnginesSupported; +extern HINSTANCE g_hInstance; +extern int g_copyROP[]; +extern int g_patternROP[]; +extern const char * g_pszQueryHost; +extern DeviceIntPtr g_pwinPointer; +extern DeviceIntPtr g_pwinKeyboard; + +/* + * Extern declares for dynamically loaded library function pointers + */ + +extern FARPROC g_fpDirectDrawCreate; +extern FARPROC g_fpDirectDrawCreateClipper; +extern FARPROC g_fpTrackMouseEvent; + + +/* + * Screen privates macros + */ + +#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey)) + +#define winSetScreenPriv(pScreen,v) \ + dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v) + +#define winScreenPriv(pScreen) \ + winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) + + +/* + * Colormap privates macros + */ + +#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \ + dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey)) + +#define winSetCmapPriv(pCmap,v) \ + dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v) + +#define winCmapPriv(pCmap) \ + winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap) + + +/* + * GC privates macros + */ + +#define winGetGCPriv(pGC) ((winPrivGCPtr) \ + dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey)) + +#define winSetGCPriv(pGC,v) \ + dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v) + +#define winGCPriv(pGC) \ + winPrivGCPtr pGCPriv = winGetGCPriv(pGC) + + +/* + * Pixmap privates macros + */ + +#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \ + dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey)) + +#define winSetPixmapPriv(pPixmap,v) \ + dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v) + +#define winPixmapPriv(pPixmap) \ + winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap) + + +/* + * Window privates macros + */ + +#define winGetWindowPriv(pWin) ((winPrivWinPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey)) + +#define winSetWindowPriv(pWin,v) \ + dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v) + +#define winWindowPriv(pWin) \ + winPrivWinPtr pWinPriv = winGetWindowPriv(pWin) + +/* + * wrapper macros + */ +#define _WIN_WRAP(priv, real, mem, func) {\ + priv->mem = real->mem; \ + real->mem = func; \ +} + +#define _WIN_UNWRAP(priv, real, mem) {\ + real->mem = priv->mem; \ +} + +#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func) + +#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem) + +/* + * BEGIN DDX and DIX Function Prototypes + */ + + +/* + * winallpriv.c + */ + +Bool +winAllocatePrivates (ScreenPtr pScreen); + +Bool +winInitCmapPrivates (ColormapPtr pCmap, int index); + +Bool +winAllocateCmapPrivates (ColormapPtr pCmap); + + +/* + * winauth.c + */ + +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) +Bool +winGenerateAuthorization (void); +void winSetAuthorization(void); +#endif + + +/* + * winblock.c + */ + +void +winBlockHandler (int nScreen, + pointer pBlockData, + pointer pTimeout, + pointer pReadMask); + + +#ifdef XWIN_NATIVEGDI +/* + * winclip.c + */ + +RegionPtr +winPixmapToRegionNativeGDI (PixmapPtr pPix); +#endif + + +#ifdef XWIN_CLIPBOARD +/* + * winclipboardinit.c + */ + +Bool +winInitClipboard (void); + +void +winFixClipboardChain (void); +#endif + + +/* + * wincmap.c + */ + +void +winSetColormapFunctions (ScreenPtr pScreen); + +Bool +winCreateDefColormap (ScreenPtr pScreen); + + +/* + * wincreatewnd.c + */ + +Bool +winCreateBoundingWindowFullScreen (ScreenPtr pScreen); + +Bool +winCreateBoundingWindowWindowed (ScreenPtr pScreen); + + +/* + * windialogs.c + */ + +void +winDisplayExitDialog (winPrivScreenPtr pScreenPriv); + +void +winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv); + +void +winDisplayAboutDialog (winPrivScreenPtr pScreenPriv); + + +/* + * winengine.c + */ + +void +winDetectSupportedEngines (void); + +Bool +winSetEngine (ScreenPtr pScreen); + +Bool +winGetDDProcAddresses (void); + +void +winReleaseDDProcAddresses(void); + + +/* + * winerror.c + */ + +#ifdef DDXOSVERRORF +void +OSVenderVErrorF (const char *pszFormat, va_list va_args); +#endif + +void +winMessageBoxF (const char *pszError, UINT uType, ...); + + +#ifdef XWIN_NATIVEGDI +/* + * winfillsp.c + */ + +void +winFillSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int nSpans, + DDXPointPtr pPoints, + int *pWidths, + int fSorted); +#endif + + +#ifdef XWIN_NATIVEGDI +/* + * winfont.c + */ + +Bool +winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); + +Bool +winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); +#endif + + +#ifdef XWIN_NATIVEGDI +/* + * wingc.c + */ + +Bool +winCreateGCNativeGDI (GCPtr pGC); +#endif + + +#ifdef XWIN_NATIVEGDI +/* + * wingetsp.c + */ + +void +winGetSpansNativeGDI (DrawablePtr pDrawable, + int wMax, + DDXPointPtr pPoints, + int *pWidths, + int nSpans, + char *pDst); +#endif + + +/* + * winglobals.c + */ + +void +winInitializeGlobals (void); + + +/* + * winkeybd.c + */ + +void +winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode); + +int +winKeybdProc (DeviceIntPtr pDeviceInt, int iState); + +void +winInitializeModeKeyStates (void); + +void +winRestoreModeKeyStates (void); + +Bool +winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam); + +void +winKeybdReleaseKeys (void); + +void +winSendKeyEvent (DWORD dwKey, Bool fDown); + +BOOL +winCheckKeyPressed(WPARAM wParam, LPARAM lParam); + +void +winFixShiftKeys (int iScanCode); + +/* + * winkeyhook.c + */ + +Bool +winInstallKeyboardHookLL (void); + +void +winRemoveKeyboardHookLL (void); + + +/* + * winmisc.c + */ + +#ifdef XWIN_NATIVEGDI +void +winQueryBestSizeNativeGDI (int class, unsigned short *pWidth, + unsigned short *pHeight, ScreenPtr pScreen); +#endif + +CARD8 +winCountBits (DWORD dw); + +Bool +winUpdateFBPointer (ScreenPtr pScreen, void *pbits); + +#ifdef XWIN_NATIVEGDI +BOOL +winPaintBackground (HWND hwnd, COLORREF colorref); +#endif + + +/* + * winmouse.c + */ + +int +winMouseProc (DeviceIntPtr pDeviceInt, int iState); + +int +winMouseWheel (ScreenPtr pScreen, int iDeltaZ); + +void +winMouseButtonsSendEvent (int iEventType, int iButton); + +int +winMouseButtonsHandle (ScreenPtr pScreen, + int iEventType, int iButton, + WPARAM wParam); + +void +winEnqueueMotion(int x, int y); + +#ifdef XWIN_NATIVEGDI +/* + * winnativegdi.c + */ + +HBITMAP +winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth, + BYTE **ppbBits, BITMAPINFO **ppbmi); + +Bool +winSetEngineFunctionsNativeGDI (ScreenPtr pScreen); +#endif + + +#ifdef XWIN_PRIMARYFB +/* + * winpfbddd.c + */ + +Bool +winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen); +#endif + + +#ifdef XWIN_NATIVEGDI +/* + * winpixmap.c + */ + +PixmapPtr +winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth, + unsigned usage_hint); + +Bool +winDestroyPixmapNativeGDI (PixmapPtr pPixmap); + +Bool +winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap, + int iWidth, int iHeight, + int iDepth, + int iBitsPerPixel, + int devKind, + pointer pPixData); +#endif + +#ifdef XWIN_NATIVEGDI +/* + * winpolyline.c + */ + +void +winPolyLineNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt); +#endif + + +#ifdef XWIN_NATIVEGDI +/* + * winpushpxl.c + */ + +void +winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, + int dx, int dy, int xOrg, int yOrg); +#endif + + +/* + * winscrinit.c + */ + +Bool +winScreenInit (int index, + ScreenPtr pScreen, + int argc, char **argv); + +Bool +winFinishScreenInitFB (int index, + ScreenPtr pScreen, + int argc, char **argv); + +#if defined(XWIN_NATIVEGDI) +Bool +winFinishScreenInitNativeGDI (int index, + ScreenPtr pScreen, + int argc, char **argv); +#endif + + +#ifdef XWIN_NATIVEGDI +/* + * winsetsp.c + */ + +void +winSetSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + char *pSrc, + DDXPointPtr pPoints, + int *pWidth, + int nSpans, + int fSorted); +#endif + + +/* + * winshaddd.c + */ + +Bool +winSetEngineFunctionsShadowDD (ScreenPtr pScreen); + + +/* + * winshadddnl.c + */ + +Bool +winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen); + + +/* + * winshadgdi.c + */ + +Bool +winSetEngineFunctionsShadowGDI (ScreenPtr pScreen); + + +/* + * winwakeup.c + */ + +void +winWakeupHandler (int nScreen, + pointer pWakeupData, + unsigned long ulResult, + pointer pReadmask); + + +/* + * winwindow.c + */ + +#ifdef XWIN_NATIVEGDI +Bool +winCreateWindowNativeGDI (WindowPtr pWin); + +Bool +winDestroyWindowNativeGDI (WindowPtr pWin); + +Bool +winPositionWindowNativeGDI (WindowPtr pWin, int x, int y); + +void +winCopyWindowNativeGDI (WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +Bool +winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask); + +Bool +winUnmapWindowNativeGDI (WindowPtr pWindow); + +Bool +winMapWindowNativeGDI (WindowPtr pWindow); +#endif + +Bool +winCreateWindowRootless (WindowPtr pWindow); + +Bool +winDestroyWindowRootless (WindowPtr pWindow); + +Bool +winPositionWindowRootless (WindowPtr pWindow, int x, int y); + +Bool +winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask); + +Bool +winUnmapWindowRootless (WindowPtr pWindow); + +Bool +winMapWindowRootless (WindowPtr pWindow); + +void +winSetShapeRootless (WindowPtr pWindow, int kind); + + +/* + * winmultiwindowicons.c - Used by both multi-window and Win32Rootless + */ + +HICON +winXIconToHICON (WindowPtr pWin, int iconSize); + +void +winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon); + +#ifdef XWIN_MULTIWINDOW +/* + * winmultiwindowshape.c + */ + +void +winReshapeMultiWindow (WindowPtr pWin); + +void +winSetShapeMultiWindow (WindowPtr pWindow, int kind); + +void +winUpdateRgnMultiWindow (WindowPtr pWindow); +#endif + + +#ifdef XWIN_MULTIWINDOW +/* + * winmultiwindowwindow.c + */ + +Bool +winCreateWindowMultiWindow (WindowPtr pWindow); + +Bool +winDestroyWindowMultiWindow (WindowPtr pWindow); + +Bool +winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y); + +Bool +winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask); + +Bool +winUnmapWindowMultiWindow (WindowPtr pWindow); + +Bool +winMapWindowMultiWindow (WindowPtr pWindow); + +void +winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent); + +void +winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib); + +void +winReorderWindowsMultiWindow (void); + +void +winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w, + unsigned int h, WindowPtr pSib); +void +winMoveWindowMultiWindow (WindowPtr pWin, int x, int y, + WindowPtr pSib, VTKind kind); + +void +winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt, + RegionPtr oldRegion); + +XID +winGetWindowID (WindowPtr pWin); + +int +winAdjustXWindow (WindowPtr pWin, HWND hwnd); +#endif + + +#ifdef XWIN_MULTIWINDOW +/* + * winmultiwindowwndproc.c + */ + +LRESULT CALLBACK +winTopLevelWindowProc (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam); +#endif + + +/* + * wintrayicon.c + */ + +void +winInitNotifyIcon (winPrivScreenPtr pScreenPriv); + +void +winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv); + +LRESULT +winHandleIconMessage (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam, + winPrivScreenPtr pScreenPriv); + + +/* + * winwndproc.c + */ + +LRESULT CALLBACK +winWindowProc (HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam); + + +#ifdef XWIN_MULTIWINDOWEXTWM +/* + * winwin32rootless.c + */ + +Bool +winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen, + int newX, int newY, RegionPtr pShape); + +void +winMWExtWMDestroyFrame (RootlessFrameID wid); + +void +winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); + +void +winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen, + int newX, int newY, unsigned int newW, unsigned int newH, + unsigned int gravity); + +void +winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid); + +void +winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape); + +void +winMWExtWMUnmapFrame (RootlessFrameID wid); + +void +winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow); + +void +winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush); + +void +winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage); + +void +winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects, + int shift_x, int shift_y); + +void +winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin); + +void +winMWExtWMCopyBytes (unsigned int width, unsigned int height, + const void *src, unsigned int srcRowBytes, + void *dst, unsigned int dstRowBytes); + +void +winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, + int dx, int dy); +#endif + + +#ifdef XWIN_MULTIWINDOWEXTWM +/* + * winwin32rootlesswindow.c + */ + +void +winMWExtWMReorderWindows (ScreenPtr pScreen); + +void +winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y); + +void +winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h); + +void +winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h); + +void +winMWExtWMUpdateIcon (Window id); + +void +winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv, + winScreenInfoPtr pScreenInfo); + +wBOOL CALLBACK +winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam); + +Bool +winIsInternalWMRunning (winScreenInfoPtr pScreenInfo); + +void +winMWExtWMRestackWindows (ScreenPtr pScreen); +#endif + + +#ifdef XWIN_MULTIWINDOWEXTWM +/* + * winwin32rootlesswndproc.c + */ + +LRESULT CALLBACK +winMWExtWMWindowProc (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam); +#endif + + +/* + * winwindowswm.c + */ + +void +winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg, + Window window, int x, int y, int w, int h); + +void +winWindowsWMExtensionInit (void); + +/* + * wincursor.c + */ + +Bool +winInitCursor (ScreenPtr pScreen); + +/* + * winprocarg.c + */ +void +winInitializeScreens(int maxscreens); + +/* + * winrandr.c + */ +Bool +winRandRInit (ScreenPtr pScreen); +void +winDoRandRScreenSetSize (ScreenPtr pScreen, + CARD16 width, + CARD16 height, + CARD32 mmWidth, + CARD32 mmHeight); + +/* + * END DDX and DIX Function Prototypes + */ + +#endif /* _WIN_H_ */ + diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c index 0c342e1ae..755373965 100644 --- a/xorg-server/hw/xwin/wincreatewnd.c +++ b/xorg-server/hw/xwin/wincreatewnd.c @@ -192,7 +192,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) fForceShowWindow = TRUE; } dwWindowStyle |= WS_CAPTION; - if (pScreenInfo->fScrollbars) + if (pScreenInfo->iResizeMode != notAllowed) dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX; } else @@ -233,6 +233,22 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) iPosY = rcWorkArea.top; } + /* Clean up the scrollbars flag, if necessary */ + if ((!pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fMWExtWM +#endif + || pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || pScreenInfo->fMultiWindow +#endif + ) + && (pScreenInfo->iResizeMode == resizeWithScrollbars)) + { + /* We cannot have scrollbars if we do not have a window border */ + pScreenInfo->iResizeMode = notAllowed; + } + /* Did the user specify a height and width? */ if (pScreenInfo->fUserGaveHeightAndWidth) { @@ -256,12 +272,12 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) #if CYGDEBUG winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n"); #endif - /* Are we using scrollbars? */ - if (pScreenInfo->fScrollbars) + + /* Are we resizable */ + if (pScreenInfo->iResizeMode != notAllowed) { #if CYGDEBUG - winDebug ("winCreateBoundingWindowWindowed - Window has " - "scrollbars\n"); + winDebug ("winCreateBoundingWindowWindowed - Window is resizable\n"); #endif iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME); @@ -271,8 +287,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) else { #if CYGDEBUG - winDebug ("winCreateBoundingWindowWindowed - Window does not have " - "scrollbars\n"); + winDebug ("winCreateBoundingWindowWindowed - Window is not resizable\n"); #endif iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME); @@ -296,22 +311,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) } } - /* Clean up the scrollbars flag, if necessary */ - if ((!pScreenInfo->fDecoration -#ifdef XWIN_MULTIWINDOWEXTWM - || pScreenInfo->fMWExtWM -#endif - || pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOW - || pScreenInfo->fMultiWindow -#endif - ) - && pScreenInfo->fScrollbars) - { - /* We cannot have scrollbars if we do not have a window border */ - pScreenInfo->fScrollbars = FALSE; - } - + /* Make sure window is no bigger than work area */ if (TRUE #ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fMWExtWM @@ -396,7 +396,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) rcClient.bottom, rcClient.top); /* We adjust the visual size if the user did not specify it */ - if (!(pScreenInfo->fScrollbars && pScreenInfo->fUserGaveHeightAndWidth)) + if (!((pScreenInfo->iResizeMode == resizeWithScrollbars) && pScreenInfo->fUserGaveHeightAndWidth)) { /* * User did not give a height and width with scrollbars enabled, diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c index 8c648e84a..c3a149762 100644 --- a/xorg-server/hw/xwin/windialogs.c +++ b/xorg-server/hw/xwin/windialogs.c @@ -1,774 +1,773 @@ -/* - *Copyright (C) 2003-2004 Harold L Hunt II 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 HAROLD L HUNT II 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 Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. - * - * Authors: Harold L Hunt II - * Earle F. Philhower III - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" -#ifdef __CYGWIN__ -#include -#endif -#include -#include "winprefs.h" - - -/* - * References to external globals - */ - -#ifdef XWIN_CLIPBOARD -extern Bool g_fClipboardStarted; -#endif -/* - * Local function prototypes - */ - -static wBOOL CALLBACK -winExitDlgProc (HWND hDialog, UINT message, - WPARAM wParam, LPARAM lParam); - -static wBOOL CALLBACK -winChangeDepthDlgProc (HWND hDialog, UINT message, - WPARAM wParam, LPARAM lParam); - -static wBOOL CALLBACK -winAboutDlgProc (HWND hDialog, UINT message, - WPARAM wParam, LPARAM lParam); - - -static void -winDrawURLWindow (LPARAM lParam); - -static LRESULT CALLBACK -winURLWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - -static void -winOverrideURLButton (HWND hdlg, int id); - -static void -winUnoverrideURLButton (HWND hdlg, int id); - - -/* - * Owner-draw a button as a URL - */ - -static void -winDrawURLWindow (LPARAM lParam) -{ - DRAWITEMSTRUCT *draw; - char str[256]; - RECT rect; - HFONT font; - COLORREF crText; - - draw = (DRAWITEMSTRUCT *) lParam; - GetWindowText (draw->hwndItem, str, sizeof(str)); - str[255] = 0; - GetClientRect (draw->hwndItem, &rect); - - /* Color the button depending upon its state */ - if (draw->itemState & ODS_SELECTED) - crText = RGB(128+64,0,0); - else if (draw->itemState & ODS_FOCUS) - crText = RGB(0,128+64,0); - else - crText = RGB(0,0,128+64); - SetTextColor (draw->hDC, crText); - - /* Create font 8 high, standard dialog font */ - font = CreateFont (-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, - 0, 0, 0, 0, 0, "MS Sans Serif"); - if (!font) - { - ErrorF ("winDrawURLWindow: Unable to create URL font, bailing.\n"); - return; - } - /* Draw it */ - SetBkMode (draw->hDC, OPAQUE); - SelectObject (draw->hDC, font); - DrawText (draw->hDC, str, strlen (str),&rect,DT_CENTER | DT_VCENTER); - /* Delete the created font, replace it with stock font */ - DeleteObject (SelectObject (draw->hDC, GetStockObject (ANSI_VAR_FONT))); -} - - -/* - * WndProc for overridden buttons - */ - -static LRESULT CALLBACK -winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - WNDPROC origCB = NULL; - HCURSOR cursor; - - /* If it's a SetCursor message, tell it to the hand */ - if (msg==WM_SETCURSOR) { - cursor = LoadCursor (NULL, IDC_HAND); - if (cursor) - SetCursor (cursor); - return TRUE; - } - origCB = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA); - /* Otherwise fall through to original WndProc */ - if (origCB) - return CallWindowProc (origCB, hwnd, msg, wParam, lParam); - else - return FALSE; -} - - -/* - * Register and unregister the custom WndProc - */ - -static void -winOverrideURLButton (HWND hwnd, int id) -{ - WNDPROC origCB; - origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id), - GWLP_WNDPROC, (LONG_PTR)winURLWndProc); - SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_USERDATA, (LONG_PTR)origCB); -} - -static void -winUnoverrideURLButton (HWND hwnd, int id) -{ - WNDPROC origCB; - origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id), - GWLP_USERDATA, 0); - if (origCB) - SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_WNDPROC, (LONG_PTR)origCB); -} - - -/* - * Center a dialog window in the desktop window - * and set small and large icons to X icons. - */ - -static void -winInitDialog (HWND hwndDlg) -{ - HWND hwndDesk; - RECT rc, rcDlg, rcDesk; - HICON hIcon, hIconSmall; - - hwndDesk = GetParent (hwndDlg); - if (!hwndDesk || IsIconic (hwndDesk)) - hwndDesk = GetDesktopWindow (); - - /* Remove minimize and maximize buttons */ - SetWindowLongPtr(hwndDlg, GWL_STYLE, - GetWindowLongPtr(hwndDlg, GWL_STYLE) - & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); - - /* Set Window not to show in the task bar */ - SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, - GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); - - /* Center dialog window in the screen. Not done for multi-monitor systems, where - * it is likely to end up split across the screens. In that case, it appears - * near the Tray icon. - */ - if (GetSystemMetrics(SM_CMONITORS)>1) { - /* Still need to refresh the frame change. */ - SetWindowPos (hwndDlg, HWND_TOPMOST, 0,0,0,0, - SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); - } else { - GetWindowRect (hwndDesk, &rcDesk); - GetWindowRect (hwndDlg, &rcDlg); - CopyRect (&rc, &rcDesk); - - OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); - OffsetRect (&rc, -rc.left, -rc.top); - OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); - - SetWindowPos (hwndDlg, - HWND_TOPMOST, - rcDesk.left + (rc.right / 2), - rcDesk.top + (rc.bottom / 2), - 0, 0, - SWP_NOSIZE | SWP_FRAMECHANGED); - } - -#ifdef XWIN_MULTIWINDOW - if (g_hIconX) hIcon=g_hIconX; - else -#endif - hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); - -#ifdef XWIN_MULTIWINDOW - if (g_hSmallIconX) hIconSmall=g_hSmallIconX; - else -#endif - hIconSmall = LoadImage (g_hInstance, - MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), - GetSystemMetrics(SM_CYSMICON), - LR_SHARED); - - PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon); - PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); -} - - -/* - * Display the Exit dialog box - */ - -void -winDisplayExitDialog (winPrivScreenPtr pScreenPriv) -{ - int i; - int liveClients = 0; - - /* Count up running clients (clients[0] is serverClient) */ - for (i = 1; i < currentMaxClients; i++) - if (clients[i] != NullClient) - liveClients++; -#if defined(XWIN_MULTIWINDOW) - /* Count down server internal clients */ - if (pScreenPriv->pScreenInfo->fMultiWindow) - liveClients -= 2; /* multiwindow window manager & XMsgProc */ -#endif -#if defined(XWIN_CLIPBOARD) - if (g_fClipboardStarted) - liveClients--; /* clipboard manager */ -#endif - - /* A user reported that this sometimes drops below zero. just eye-candy. */ - if (liveClients < 0) - liveClients = 0; - - /* Don't show the exit confirmation dialog if SilentExit & no clients, - or ForceExit, is enabled */ - if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit) - { - if (g_hDlgExit != NULL) - { - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - } - PostMessage (pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0); - return; - } - - pScreenPriv->iConnectedClients = liveClients; - - /* Check if dialog already exists */ - if (g_hDlgExit != NULL) - { - /* Dialog box already exists, display it */ - ShowWindow (g_hDlgExit, SW_SHOWDEFAULT); - - /* User has lost the dialog. Show them where it is. */ - SetForegroundWindow (g_hDlgExit); - - return; - } - - /* Create dialog box */ - g_hDlgExit = CreateDialogParam (g_hInstance, - "EXIT_DIALOG", - pScreenPriv->hwndScreen, - winExitDlgProc, - (int) pScreenPriv); - - /* Show the dialog box */ - ShowWindow (g_hDlgExit, SW_SHOW); - - /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */ - SetForegroundWindow (g_hDlgExit); - - /* Set focus to the Cancel button */ - PostMessage (g_hDlgExit, WM_NEXTDLGCTL, - (WPARAM)GetDlgItem (g_hDlgExit, IDCANCEL), TRUE); -} - -#define CONNECTED_CLIENTS_FORMAT "There %s currently %d client%s connected." - - -/* - * Exit dialog window procedure - */ - -static wBOOL CALLBACK -winExitDlgProc (HWND hDialog, UINT message, - WPARAM wParam, LPARAM lParam) -{ - static winPrivScreenPtr s_pScreenPriv = NULL; - - /* Branch on message type */ - switch (message) - { - case WM_INITDIALOG: - { - char *pszConnectedClients; - - /* Store pointers to private structures for future use */ - s_pScreenPriv = (winPrivScreenPtr) lParam; - - winInitDialog (hDialog); - - /* Format the connected clients string */ - if (asprintf (&pszConnectedClients, CONNECTED_CLIENTS_FORMAT, - (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are", - s_pScreenPriv->iConnectedClients, - (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1) - return TRUE; - - - - /* Set the number of connected clients */ - SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED), - pszConnectedClients); - free(pszConnectedClients); - } - return TRUE; - - case WM_COMMAND: - switch (LOWORD (wParam)) - { - case IDOK: - /* Send message to call the GiveUp function */ - PostMessage (s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0); - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - - /* Fix to make sure keyboard focus isn't trapped */ - PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); - return TRUE; - - case IDCANCEL: - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - - /* Fix to make sure keyboard focus isn't trapped */ - PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); - return TRUE; - } - break; - - case WM_MOUSEMOVE: - case WM_NCMOUSEMOVE: - /* Show the cursor if it is hidden */ - if (g_fSoftwareCursor && !g_fCursor) - { - g_fCursor = TRUE; - ShowCursor (TRUE); - } - return TRUE; - - case WM_CLOSE: - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - - /* Fix to make sure keyboard focus isn't trapped */ - PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); - return TRUE; - } - - return FALSE; -} - - -/* - * Display the Depth Change dialog box - */ - -void -winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv) -{ - /* Check if dialog already exists */ - if (g_hDlgDepthChange != NULL) - { - /* Dialog box already exists, display it */ - ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT); - - /* User has lost the dialog. Show them where it is. */ - SetForegroundWindow (g_hDlgDepthChange); - - return; - } - - /* - * Display a notification to the user that the visual - * will not be displayed until the Windows display depth - * is restored to the original value. - */ - g_hDlgDepthChange = CreateDialogParam (g_hInstance, - "DEPTH_CHANGE_BOX", - pScreenPriv->hwndScreen, - winChangeDepthDlgProc, - (int) pScreenPriv); - /* Show the dialog box */ - ShowWindow (g_hDlgDepthChange, SW_SHOW); - - ErrorF ("winDisplayDepthChangeDialog - DialogBox returned: %d\n", - (int) g_hDlgDepthChange); - ErrorF ("winDisplayDepthChangeDialog - GetLastError: %d\n", - (int) GetLastError ()); - - /* Minimize the display window */ - ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); -} - - -/* - * Process messages for the dialog that is displayed for - * disruptive screen depth changes. - */ - -static wBOOL CALLBACK -winChangeDepthDlgProc (HWND hwndDialog, UINT message, - WPARAM wParam, LPARAM lParam) -{ - static winPrivScreenPtr s_pScreenPriv = NULL; - static winScreenInfo *s_pScreenInfo = NULL; - static ScreenPtr s_pScreen = NULL; - -#if CYGDEBUG - winDebug ("winChangeDepthDlgProc\n"); -#endif - - /* Branch on message type */ - switch (message) - { - case WM_INITDIALOG: -#if CYGDEBUG - winDebug ("winChangeDepthDlgProc - WM_INITDIALOG\n"); -#endif - - /* Store pointers to private structures for future use */ - s_pScreenPriv = (winPrivScreenPtr) lParam; - s_pScreenInfo = s_pScreenPriv->pScreenInfo; - s_pScreen = s_pScreenInfo->pScreen; - -#if CYGDEBUG - winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, " - "s_pScreenInfo: %08x, s_pScreen: %08x\n", - s_pScreenPriv, s_pScreenInfo, s_pScreen); -#endif - -#if CYGDEBUG - winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, " - "last bpp: %d\n", - s_pScreenInfo->dwBPP, - s_pScreenPriv->dwLastWindowsBitsPixel); -#endif - - winInitDialog( hwndDialog ); - - return TRUE; - - case WM_DISPLAYCHANGE: -#if CYGDEBUG - winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, " - "last bpp: %d, new bpp: %d\n", - s_pScreenInfo->dwBPP, - s_pScreenPriv->dwLastWindowsBitsPixel, - wParam); -#endif - - /* Dismiss the dialog if the display returns to the original depth */ - if (wParam == s_pScreenInfo->dwBPP) - { - ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n"); - - /* Depth has been restored, dismiss dialog */ - DestroyWindow (g_hDlgDepthChange); - g_hDlgDepthChange = NULL; - - /* Flag that we have a valid screen depth */ - s_pScreenPriv->fBadDepth = FALSE; - } - return TRUE; - - case WM_COMMAND: - switch (LOWORD (wParam)) - { - case IDOK: - case IDCANCEL: - ErrorF ("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n"); - - /* - * User dismissed the dialog, hide it until the - * display mode is restored. - */ - ShowWindow (g_hDlgDepthChange, SW_HIDE); - return TRUE; - } - break; - - case WM_CLOSE: - ErrorF ("winChangeDepthDlgProc - WM_CLOSE\n"); - - DestroyWindow (g_hDlgAbout); - g_hDlgAbout = NULL; - - /* Fix to make sure keyboard focus isn't trapped */ - PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); - return TRUE; - } - - return FALSE; -} - - -/* - * Display the About dialog box - */ - -void -winDisplayAboutDialog (winPrivScreenPtr pScreenPriv) -{ - /* Check if dialog already exists */ - if (g_hDlgAbout != NULL) - { - /* Dialog box already exists, display it */ - ShowWindow (g_hDlgAbout, SW_SHOWDEFAULT); - - /* User has lost the dialog. Show them where it is. */ - SetForegroundWindow (g_hDlgAbout); - - return; - } - - /* - * Display the about box - */ - g_hDlgAbout = CreateDialogParam (g_hInstance, - "ABOUT_BOX", - pScreenPriv->hwndScreen, - winAboutDlgProc, - (int) pScreenPriv); - - /* Show the dialog box */ - ShowWindow (g_hDlgAbout, SW_SHOW); - - /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */ - SetForegroundWindow (g_hDlgAbout); - - /* Set focus to the OK button */ - PostMessage (g_hDlgAbout, WM_NEXTDLGCTL, - (WPARAM)GetDlgItem (g_hDlgAbout, IDOK), TRUE); -} - - -/* - * Process messages for the about dialog. - */ - -static wBOOL CALLBACK -winAboutDlgProc (HWND hwndDialog, UINT message, - WPARAM wParam, LPARAM lParam) -{ - static winPrivScreenPtr s_pScreenPriv = NULL; - static winScreenInfo *s_pScreenInfo = NULL; - static ScreenPtr s_pScreen = NULL; - -#if CYGDEBUG - winDebug ("winAboutDlgProc\n"); -#endif - - /* Branch on message type */ - switch (message) - { - case WM_INITDIALOG: -#if CYGDEBUG - winDebug ("winAboutDlgProc - WM_INITDIALOG\n"); -#endif - - /* Store pointers to private structures for future use */ - s_pScreenPriv = (winPrivScreenPtr) lParam; - s_pScreenInfo = s_pScreenPriv->pScreenInfo; - s_pScreen = s_pScreenInfo->pScreen; - - winInitDialog (hwndDialog); - - /* Override the URL buttons */ - winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG); - winOverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE); - winOverrideURLButton (hwndDialog, ID_ABOUT_UG); - winOverrideURLButton (hwndDialog, ID_ABOUT_FAQ); - - return TRUE; - - case WM_DRAWITEM: - /* Draw the URL buttons as needed */ - winDrawURLWindow (lParam); - return TRUE; - - case WM_MOUSEMOVE: - case WM_NCMOUSEMOVE: - /* Show the cursor if it is hidden */ - if (g_fSoftwareCursor && !g_fCursor) - { - g_fCursor = TRUE; - ShowCursor (TRUE); - } - return TRUE; - - case WM_COMMAND: - switch (LOWORD (wParam)) - { - case IDOK: - case IDCANCEL: - ErrorF ("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n"); - - DestroyWindow (g_hDlgAbout); - g_hDlgAbout = NULL; - - /* Fix to make sure keyboard focus isn't trapped */ - PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); - - /* Restore window procedures for URL buttons */ - winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG); - winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE); - winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG); - winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ); - - return TRUE; - - case ID_ABOUT_CHANGELOG: - { - int iReturn; -#ifdef __CYGWIN__ - const char * pszCygPath = "/usr/X11R6/share/doc/" - "xorg-x11-xwin/changelog.html"; - char pszWinPath[MAX_PATH + 1]; - - /* Convert the POSIX path to a Win32 path */ - cygwin_conv_to_win32_path (pszCygPath, pszWinPath); -#else - const char * pszWinPath = "http://x.cygwin.com/" - "devel/server/changelog.html"; -#endif - - iReturn = (int)ShellExecute (NULL, - "open", - pszWinPath, - NULL, - NULL, - SW_MAXIMIZE); - if (iReturn < 32) - { - ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - " - "ShellExecute failed: %d\n", - iReturn); - } - } - return TRUE; - - case ID_ABOUT_WEBSITE: - { - const char * pszPath = __VENDORDWEBSUPPORT__; - int iReturn; - - iReturn = (int)ShellExecute (NULL, - "open", - pszPath, - NULL, - NULL, - SW_MAXIMIZE); - if (iReturn < 32) - { - ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - " - "ShellExecute failed: %d\n", - iReturn); - } - } - return TRUE; - - case ID_ABOUT_UG: - { - const char * pszPath = "http://x.cygwin.com/docs/ug/"; - int iReturn; - - iReturn = (int)ShellExecute (NULL, - "open", - pszPath, - NULL, - NULL, - SW_MAXIMIZE); - if (iReturn < 32) - { - ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - " - "ShellExecute failed: %d\n", - iReturn); - } - } - return TRUE; - - case ID_ABOUT_FAQ: - { - const char * pszPath = "http://x.cygwin.com/docs/faq/"; - int iReturn; - - iReturn = (int)ShellExecute (NULL, - "open", - pszPath, - NULL, - NULL, - SW_MAXIMIZE); - if (iReturn < 32) - { - ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - " - "ShellExecute failed: %d\n", - iReturn); - } - } - return TRUE; - } - break; - - case WM_CLOSE: - ErrorF ("winAboutDlgProc - WM_CLOSE\n"); - - DestroyWindow (g_hDlgAbout); - g_hDlgAbout = NULL; - - /* Fix to make sure keyboard focus isn't trapped */ - PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); - - /* Restore window procedures for URL buttons */ - winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG); - winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE); - winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG); - winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ); - - return TRUE; - } - - return FALSE; -} +/* + *Copyright (C) 2003-2004 Harold L Hunt II 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 HAROLD L HUNT II 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 Harold L Hunt II + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from Harold L Hunt II. + * + * Authors: Harold L Hunt II + * Earle F. Philhower III + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" +#ifdef __CYGWIN__ +#include +#endif +#include +#include "winprefs.h" + + +/* + * References to external globals + */ + +#ifdef XWIN_CLIPBOARD +extern Bool g_fClipboardStarted; +#endif +/* + * Local function prototypes + */ + +static wBOOL CALLBACK +winExitDlgProc (HWND hDialog, UINT message, + WPARAM wParam, LPARAM lParam); + +static wBOOL CALLBACK +winChangeDepthDlgProc (HWND hDialog, UINT message, + WPARAM wParam, LPARAM lParam); + +static wBOOL CALLBACK +winAboutDlgProc (HWND hDialog, UINT message, + WPARAM wParam, LPARAM lParam); + + +static void +winDrawURLWindow (LPARAM lParam); + +static LRESULT CALLBACK +winURLWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +static void +winOverrideURLButton (HWND hdlg, int id); + +static void +winUnoverrideURLButton (HWND hdlg, int id); + + +/* + * Owner-draw a button as a URL + */ + +static void +winDrawURLWindow (LPARAM lParam) +{ + DRAWITEMSTRUCT *draw; + char str[256]; + RECT rect; + HFONT font; + COLORREF crText; + + draw = (DRAWITEMSTRUCT *) lParam; + GetWindowText (draw->hwndItem, str, sizeof(str)); + str[255] = 0; + GetClientRect (draw->hwndItem, &rect); + + /* Color the button depending upon its state */ + if (draw->itemState & ODS_SELECTED) + crText = RGB(128+64,0,0); + else if (draw->itemState & ODS_FOCUS) + crText = RGB(0,128+64,0); + else + crText = RGB(0,0,128+64); + SetTextColor (draw->hDC, crText); + + /* Create font 8 high, standard dialog font */ + font = CreateFont (-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, + 0, 0, 0, 0, 0, "MS Sans Serif"); + if (!font) + { + ErrorF ("winDrawURLWindow: Unable to create URL font, bailing.\n"); + return; + } + /* Draw it */ + SetBkMode (draw->hDC, OPAQUE); + SelectObject (draw->hDC, font); + DrawText (draw->hDC, str, strlen (str),&rect,DT_CENTER | DT_VCENTER); + /* Delete the created font, replace it with stock font */ + DeleteObject (SelectObject (draw->hDC, GetStockObject (ANSI_VAR_FONT))); +} + + +/* + * WndProc for overridden buttons + */ + +static LRESULT CALLBACK +winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + WNDPROC origCB = NULL; + HCURSOR cursor; + + /* If it's a SetCursor message, tell it to the hand */ + if (msg==WM_SETCURSOR) { + cursor = LoadCursor (NULL, IDC_HAND); + if (cursor) + SetCursor (cursor); + return TRUE; + } + origCB = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA); + /* Otherwise fall through to original WndProc */ + if (origCB) + return CallWindowProc (origCB, hwnd, msg, wParam, lParam); + else + return FALSE; +} + + +/* + * Register and unregister the custom WndProc + */ + +static void +winOverrideURLButton (HWND hwnd, int id) +{ + WNDPROC origCB; + origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id), + GWLP_WNDPROC, (LONG_PTR)winURLWndProc); + SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_USERDATA, (LONG_PTR)origCB); +} + +static void +winUnoverrideURLButton (HWND hwnd, int id) +{ + WNDPROC origCB; + origCB = (WNDPROC)SetWindowLongPtr(GetDlgItem (hwnd, id), + GWLP_USERDATA, 0); + if (origCB) + SetWindowLongPtr(GetDlgItem (hwnd, id), GWLP_WNDPROC, (LONG_PTR)origCB); +} + + +/* + * Center a dialog window in the desktop window + * and set small and large icons to X icons. + */ + +static void +winInitDialog (HWND hwndDlg) +{ + HWND hwndDesk; + RECT rc, rcDlg, rcDesk; + HICON hIcon, hIconSmall; + + hwndDesk = GetParent (hwndDlg); + if (!hwndDesk || IsIconic (hwndDesk)) + hwndDesk = GetDesktopWindow (); + + /* Remove minimize and maximize buttons */ + SetWindowLongPtr(hwndDlg, GWL_STYLE, + GetWindowLongPtr(hwndDlg, GWL_STYLE) + & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX)); + + /* Set Window not to show in the task bar */ + SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, + GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW ); + + /* Center dialog window in the screen. Not done for multi-monitor systems, where + * it is likely to end up split across the screens. In that case, it appears + * near the Tray icon. + */ + if (GetSystemMetrics(SM_CMONITORS)>1) { + /* Still need to refresh the frame change. */ + SetWindowPos (hwndDlg, HWND_TOPMOST, 0,0,0,0, + SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + } else { + GetWindowRect (hwndDesk, &rcDesk); + GetWindowRect (hwndDlg, &rcDlg); + CopyRect (&rc, &rcDesk); + + OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); + OffsetRect (&rc, -rc.left, -rc.top); + OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); + + SetWindowPos (hwndDlg, + HWND_TOPMOST, + rcDesk.left + (rc.right / 2), + rcDesk.top + (rc.bottom / 2), + 0, 0, + SWP_NOSIZE | SWP_FRAMECHANGED); + } + +#ifdef XWIN_MULTIWINDOW + if (g_hIconX) hIcon=g_hIconX; + else +#endif + hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)); + +#ifdef XWIN_MULTIWINDOW + if (g_hSmallIconX) hIconSmall=g_hSmallIconX; + else +#endif + hIconSmall = LoadImage (g_hInstance, + MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + LR_SHARED); + + PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon); + PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall); +} + + +/* + * Display the Exit dialog box + */ + +void +winDisplayExitDialog (winPrivScreenPtr pScreenPriv) +{ + int i; + int liveClients = 0; + + /* Count up running clients (clients[0] is serverClient) */ + for (i = 1; i < currentMaxClients; i++) + if (clients[i] != NullClient) + liveClients++; +#if defined(XWIN_MULTIWINDOW) + /* Count down server internal clients */ + if (pScreenPriv->pScreenInfo->fMultiWindow) + liveClients -= 2; /* multiwindow window manager & XMsgProc */ +#endif +#if defined(XWIN_CLIPBOARD) + if (g_fClipboardStarted) + liveClients--; /* clipboard manager */ +#endif + + /* A user reported that this sometimes drops below zero. just eye-candy. */ + if (liveClients < 0) + liveClients = 0; + + /* Don't show the exit confirmation dialog if SilentExit & no clients, + or ForceExit, is enabled */ + if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit) + { + if (g_hDlgExit != NULL) + { + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + } + PostMessage (pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0); + return; + } + + pScreenPriv->iConnectedClients = liveClients; + + /* Check if dialog already exists */ + if (g_hDlgExit != NULL) + { + /* Dialog box already exists, display it */ + ShowWindow (g_hDlgExit, SW_SHOWDEFAULT); + + /* User has lost the dialog. Show them where it is. */ + SetForegroundWindow (g_hDlgExit); + + return; + } + + /* Create dialog box */ + g_hDlgExit = CreateDialogParam (g_hInstance, + "EXIT_DIALOG", + pScreenPriv->hwndScreen, + winExitDlgProc, + (int) pScreenPriv); + + /* Show the dialog box */ + ShowWindow (g_hDlgExit, SW_SHOW); + + /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */ + SetForegroundWindow (g_hDlgExit); + + /* Set focus to the Cancel button */ + PostMessage (g_hDlgExit, WM_NEXTDLGCTL, + (WPARAM)GetDlgItem (g_hDlgExit, IDCANCEL), TRUE); +} + +#define CONNECTED_CLIENTS_FORMAT "There %s currently %d client%s connected." + + +/* + * Exit dialog window procedure + */ + +static wBOOL CALLBACK +winExitDlgProc (HWND hDialog, UINT message, + WPARAM wParam, LPARAM lParam) +{ + static winPrivScreenPtr s_pScreenPriv = NULL; + + /* Branch on message type */ + switch (message) + { + case WM_INITDIALOG: + { + char *pszConnectedClients; + + /* Store pointers to private structures for future use */ + s_pScreenPriv = (winPrivScreenPtr) lParam; + + winInitDialog (hDialog); + + /* Format the connected clients string */ + if (asprintf (&pszConnectedClients, CONNECTED_CLIENTS_FORMAT, + (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are", + s_pScreenPriv->iConnectedClients, + (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1) + return TRUE; + + + + /* Set the number of connected clients */ + SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED), + pszConnectedClients); + free(pszConnectedClients); + } + return TRUE; + + case WM_COMMAND: + switch (LOWORD (wParam)) + { + case IDOK: + /* Send message to call the GiveUp function */ + PostMessage (s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0); + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + + /* Fix to make sure keyboard focus isn't trapped */ + PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); + return TRUE; + + case IDCANCEL: + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + + /* Fix to make sure keyboard focus isn't trapped */ + PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); + return TRUE; + } + break; + + case WM_MOUSEMOVE: + case WM_NCMOUSEMOVE: + /* Show the cursor if it is hidden */ + if (g_fSoftwareCursor && !g_fCursor) + { + g_fCursor = TRUE; + ShowCursor (TRUE); + } + return TRUE; + + case WM_CLOSE: + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + + /* Fix to make sure keyboard focus isn't trapped */ + PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); + return TRUE; + } + + return FALSE; +} + + +/* + * Display the Depth Change dialog box + */ + +void +winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv) +{ + /* Check if dialog already exists */ + if (g_hDlgDepthChange != NULL) + { + /* Dialog box already exists, display it */ + ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT); + + /* User has lost the dialog. Show them where it is. */ + SetForegroundWindow (g_hDlgDepthChange); + + return; + } + + /* + * Display a notification to the user that the visual + * will not be displayed until the Windows display depth + * is restored to the original value. + */ + g_hDlgDepthChange = CreateDialogParam (g_hInstance, + "DEPTH_CHANGE_BOX", + pScreenPriv->hwndScreen, + winChangeDepthDlgProc, + (int) pScreenPriv); + /* Show the dialog box */ + ShowWindow (g_hDlgDepthChange, SW_SHOW); + + ErrorF ("winDisplayDepthChangeDialog - DialogBox returned: %d\n", + (int) g_hDlgDepthChange); + ErrorF ("winDisplayDepthChangeDialog - GetLastError: %d\n", + (int) GetLastError ()); + + /* Minimize the display window */ + ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); +} + + +/* + * Process messages for the dialog that is displayed for + * disruptive screen depth changes. + */ + +static wBOOL CALLBACK +winChangeDepthDlgProc (HWND hwndDialog, UINT message, + WPARAM wParam, LPARAM lParam) +{ + static winPrivScreenPtr s_pScreenPriv = NULL; + static winScreenInfo *s_pScreenInfo = NULL; + static ScreenPtr s_pScreen = NULL; + +#if CYGDEBUG + winDebug ("winChangeDepthDlgProc\n"); +#endif + + /* Branch on message type */ + switch (message) + { + case WM_INITDIALOG: +#if CYGDEBUG + winDebug ("winChangeDepthDlgProc - WM_INITDIALOG\n"); +#endif + + /* Store pointers to private structures for future use */ + s_pScreenPriv = (winPrivScreenPtr) lParam; + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + s_pScreen = s_pScreenInfo->pScreen; + +#if CYGDEBUG + winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, " + "s_pScreenInfo: %08x, s_pScreen: %08x\n", + s_pScreenPriv, s_pScreenInfo, s_pScreen); +#endif + +#if CYGDEBUG + winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, " + "current bpp: %d\n", + s_pScreenInfo->dwBPP, + GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)); +#endif + + winInitDialog( hwndDialog ); + + return TRUE; + + case WM_DISPLAYCHANGE: +#if CYGDEBUG + winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, " + "new bpp: %d\n", + s_pScreenInfo->dwBPP, + GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)); +#endif + + /* Dismiss the dialog if the display returns to the original depth */ + if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) == s_pScreenInfo->dwBPP) + { + ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n"); + + /* Depth has been restored, dismiss dialog */ + DestroyWindow (g_hDlgDepthChange); + g_hDlgDepthChange = NULL; + + /* Flag that we have a valid screen depth */ + s_pScreenPriv->fBadDepth = FALSE; + } + return TRUE; + + case WM_COMMAND: + switch (LOWORD (wParam)) + { + case IDOK: + case IDCANCEL: + ErrorF ("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n"); + + /* + * User dismissed the dialog, hide it until the + * display mode is restored. + */ + ShowWindow (g_hDlgDepthChange, SW_HIDE); + return TRUE; + } + break; + + case WM_CLOSE: + ErrorF ("winChangeDepthDlgProc - WM_CLOSE\n"); + + DestroyWindow (g_hDlgAbout); + g_hDlgAbout = NULL; + + /* Fix to make sure keyboard focus isn't trapped */ + PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); + return TRUE; + } + + return FALSE; +} + + +/* + * Display the About dialog box + */ + +void +winDisplayAboutDialog (winPrivScreenPtr pScreenPriv) +{ + /* Check if dialog already exists */ + if (g_hDlgAbout != NULL) + { + /* Dialog box already exists, display it */ + ShowWindow (g_hDlgAbout, SW_SHOWDEFAULT); + + /* User has lost the dialog. Show them where it is. */ + SetForegroundWindow (g_hDlgAbout); + + return; + } + + /* + * Display the about box + */ + g_hDlgAbout = CreateDialogParam (g_hInstance, + "ABOUT_BOX", + pScreenPriv->hwndScreen, + winAboutDlgProc, + (int) pScreenPriv); + + /* Show the dialog box */ + ShowWindow (g_hDlgAbout, SW_SHOW); + + /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */ + SetForegroundWindow (g_hDlgAbout); + + /* Set focus to the OK button */ + PostMessage (g_hDlgAbout, WM_NEXTDLGCTL, + (WPARAM)GetDlgItem (g_hDlgAbout, IDOK), TRUE); +} + + +/* + * Process messages for the about dialog. + */ + +static wBOOL CALLBACK +winAboutDlgProc (HWND hwndDialog, UINT message, + WPARAM wParam, LPARAM lParam) +{ + static winPrivScreenPtr s_pScreenPriv = NULL; + static winScreenInfo *s_pScreenInfo = NULL; + static ScreenPtr s_pScreen = NULL; + +#if CYGDEBUG + winDebug ("winAboutDlgProc\n"); +#endif + + /* Branch on message type */ + switch (message) + { + case WM_INITDIALOG: +#if CYGDEBUG + winDebug ("winAboutDlgProc - WM_INITDIALOG\n"); +#endif + + /* Store pointers to private structures for future use */ + s_pScreenPriv = (winPrivScreenPtr) lParam; + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + s_pScreen = s_pScreenInfo->pScreen; + + winInitDialog (hwndDialog); + + /* Override the URL buttons */ + winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG); + winOverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE); + winOverrideURLButton (hwndDialog, ID_ABOUT_UG); + winOverrideURLButton (hwndDialog, ID_ABOUT_FAQ); + + return TRUE; + + case WM_DRAWITEM: + /* Draw the URL buttons as needed */ + winDrawURLWindow (lParam); + return TRUE; + + case WM_MOUSEMOVE: + case WM_NCMOUSEMOVE: + /* Show the cursor if it is hidden */ + if (g_fSoftwareCursor && !g_fCursor) + { + g_fCursor = TRUE; + ShowCursor (TRUE); + } + return TRUE; + + case WM_COMMAND: + switch (LOWORD (wParam)) + { + case IDOK: + case IDCANCEL: + ErrorF ("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n"); + + DestroyWindow (g_hDlgAbout); + g_hDlgAbout = NULL; + + /* Fix to make sure keyboard focus isn't trapped */ + PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); + + /* Restore window procedures for URL buttons */ + winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG); + winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE); + winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG); + winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ); + + return TRUE; + + case ID_ABOUT_CHANGELOG: + { + int iReturn; +#ifdef __CYGWIN__ + const char * pszCygPath = "/usr/X11R6/share/doc/" + "xorg-x11-xwin/changelog.html"; + char pszWinPath[MAX_PATH + 1]; + + /* Convert the POSIX path to a Win32 path */ + cygwin_conv_to_win32_path (pszCygPath, pszWinPath); +#else + const char * pszWinPath = "http://x.cygwin.com/" + "devel/server/changelog.html"; +#endif + + iReturn = (int)ShellExecute (NULL, + "open", + pszWinPath, + NULL, + NULL, + SW_MAXIMIZE); + if (iReturn < 32) + { + ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - " + "ShellExecute failed: %d\n", + iReturn); + } + } + return TRUE; + + case ID_ABOUT_WEBSITE: + { + const char * pszPath = __VENDORDWEBSUPPORT__; + int iReturn; + + iReturn = (int)ShellExecute (NULL, + "open", + pszPath, + NULL, + NULL, + SW_MAXIMIZE); + if (iReturn < 32) + { + ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - " + "ShellExecute failed: %d\n", + iReturn); + } + } + return TRUE; + + case ID_ABOUT_UG: + { + const char * pszPath = "http://x.cygwin.com/docs/ug/"; + int iReturn; + + iReturn = (int)ShellExecute (NULL, + "open", + pszPath, + NULL, + NULL, + SW_MAXIMIZE); + if (iReturn < 32) + { + ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - " + "ShellExecute failed: %d\n", + iReturn); + } + } + return TRUE; + + case ID_ABOUT_FAQ: + { + const char * pszPath = "http://x.cygwin.com/docs/faq/"; + int iReturn; + + iReturn = (int)ShellExecute (NULL, + "open", + pszPath, + NULL, + NULL, + SW_MAXIMIZE); + if (iReturn < 32) + { + ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - " + "ShellExecute failed: %d\n", + iReturn); + } + } + return TRUE; + } + break; + + case WM_CLOSE: + ErrorF ("winAboutDlgProc - WM_CLOSE\n"); + + DestroyWindow (g_hDlgAbout); + g_hDlgAbout = NULL; + + /* Fix to make sure keyboard focus isn't trapped */ + PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); + + /* Restore window procedures for URL buttons */ + winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG); + winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE); + winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG); + winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ); + + return TRUE; + } + + return FALSE; +} diff --git a/xorg-server/hw/xwin/winmonitors.c b/xorg-server/hw/xwin/winmonitors.c new file mode 100644 index 000000000..63af803d0 --- /dev/null +++ b/xorg-server/hw/xwin/winmonitors.c @@ -0,0 +1,92 @@ +/* + +Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 + +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. + +*/ + + +#include "win.h" +#include "winmonitors.h" + +/* + * getMonitorInfo - callback function used to return information from the enumeration of monitors attached + */ + +static +wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) +{ + struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data; + // only get data for monitor number specified in + data->monitorNum++; + if (data->monitorNum == data->requestedMonitor) + { + data->bMonitorSpecifiedExists = TRUE; + data->monitorOffsetX = rect->left; + data->monitorOffsetY = rect->top; + data->monitorHeight = rect->bottom - rect->top; + data->monitorWidth = rect->right - rect->left; + return FALSE; + } + return TRUE; +} + +typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); +ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; + +wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); + +Bool QueryMonitor(int index, struct GetMonitorInfoData *data) +{ + /* Load EnumDisplayMonitors from DLL */ + HMODULE user32; + FARPROC func; + user32 = LoadLibrary("user32.dll"); + if (user32 == NULL) + { + winW32Error(2, "Could not open user32.dll"); + return FALSE; + } + func = GetProcAddress(user32, "EnumDisplayMonitors"); + if (func == NULL) + { + winW32Error(2, "Could not resolve EnumDisplayMonitors: "); + return FALSE; + } + _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func; + + /* prepare data */ + if (data == NULL) + return FALSE; + memset(data, 0, sizeof(*data)); + data->requestedMonitor = index; + + /* query information */ + _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); + + /* cleanup */ + FreeLibrary(user32); + return TRUE; +} diff --git a/xorg-server/hw/xwin/winmonitors.h b/xorg-server/hw/xwin/winmonitors.h new file mode 100644 index 000000000..180566b00 --- /dev/null +++ b/xorg-server/hw/xwin/winmonitors.h @@ -0,0 +1,14 @@ + +/* data returned for monitor information */ +struct GetMonitorInfoData { + int requestedMonitor; + int monitorNum; + Bool bUserSpecifiedMonitor; + Bool bMonitorSpecifiedExists; + int monitorOffsetX; + int monitorOffsetY; + int monitorHeight; + int monitorWidth; +}; + +Bool QueryMonitor(int index, struct GetMonitorInfoData *data); diff --git a/xorg-server/hw/xwin/winnativegdi.c b/xorg-server/hw/xwin/winnativegdi.c index 1a41bb484..4d7afe898 100644 --- a/xorg-server/hw/xwin/winnativegdi.c +++ b/xorg-server/hw/xwin/winnativegdi.c @@ -1,539 +1,534 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *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 XFREE86 PROJECT 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 XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - - -/* - * Local function prototypes - */ - -static Bool -winAllocateFBNativeGDI (ScreenPtr pScreen); - -static void -winShadowUpdateNativeGDI (ScreenPtr pScreen, - shadowBufPtr pBuf); - -static Bool -winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen); - -static Bool -winInitVisualsNativeGDI (ScreenPtr pScreen); - -static Bool -winAdjustVideoModeNativeGDI (ScreenPtr pScreen); - -#if 0 -static Bool -winBltExposedRegionsNativeGDI (ScreenPtr pScreen); -#endif - -static Bool -winActivateAppNativeGDI (ScreenPtr pScreen); - -static Bool -winRedrawScreenNativeGDI (ScreenPtr pScreen); - -static Bool -winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen); - -static Bool -winInstallColormapNativeGDI (ColormapPtr pColormap); - -static Bool -winStoreColorsNativeGDI (ColormapPtr pmap, - int ndef, - xColorItem *pdefs); - -static Bool -winCreateColormapNativeGDI (ColormapPtr pColormap); - -static Bool -winDestroyColormapNativeGDI (ColormapPtr pColormap); - - - -static Bool -winAllocateFBNativeGDI (ScreenPtr pScreen) -{ - FatalError ("winAllocateFBNativeGDI\n"); - - return TRUE; -} - - -/* - * We wrap whatever CloseScreen procedure was specified by fb; - * a pointer to said procedure is stored in our privates. - */ - -static Bool -winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - ErrorF ("winCloseScreenNativeGDI - Freeing screen resources\n"); - - /* Flag that the screen is closed */ - pScreenPriv->fClosed = TRUE; - pScreenPriv->fActive = FALSE; - - /* - * NOTE: mi doesn't use a CloseScreen procedure, so we do not - * need to call a wrapped procedure here. - */ - - /* Delete the window property */ - RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - - ErrorF ("winCloseScreenNativeGDI - Destroying window\n"); - - /* Delete tray icon, if we have one */ - if (!pScreenInfo->fNoTrayIcon) - winDeleteNotifyIcon (pScreenPriv); - - /* Free the exit confirmation dialog box, if it exists */ - if (g_hDlgExit != NULL) - { - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - } - - /* Kill our window */ - if (pScreenPriv->hwndScreen) - { - DestroyWindow (pScreenPriv->hwndScreen); - pScreenPriv->hwndScreen = NULL; - } - - /* Invalidate our screeninfo's pointer to the screen */ - pScreenInfo->pScreen = NULL; - - /* Free the screen privates for this screen */ - free (pScreenPriv); - - ErrorF ("winCloseScreenNativeGDI - Returning\n"); - - return TRUE; -} - - -static void -winShadowUpdateNativeGDI (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - FatalError ("winShadowUpdateNativeGDI\n"); - return; -} - - -static Bool -winInitVisualsNativeGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Set the bitsPerRGB and bit masks */ - switch (pScreenInfo->dwDepth) - { - case 24: - pScreenPriv->dwBitsPerRGB = 8; - pScreenPriv->dwRedMask = 0x00FF0000; - pScreenPriv->dwGreenMask = 0x0000FF00; - pScreenPriv->dwBlueMask = 0x000000FF; - break; - - case 16: - pScreenPriv->dwBitsPerRGB = 6; - pScreenPriv->dwRedMask = 0xF800; - pScreenPriv->dwGreenMask = 0x07E0; - pScreenPriv->dwBlueMask = 0x001F; - break; - - case 15: - pScreenPriv->dwBitsPerRGB = 5; - pScreenPriv->dwRedMask = 0x7C00; - pScreenPriv->dwGreenMask = 0x03E0; - pScreenPriv->dwBlueMask = 0x001F; - break; - - case 8: - pScreenPriv->dwBitsPerRGB = 8; - pScreenPriv->dwRedMask = 0; - pScreenPriv->dwGreenMask = 0; - pScreenPriv->dwBlueMask = 0; - break; - - default: - ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n"); - return FALSE; - break; - } - - /* Tell the user how many bits per RGB we are using */ - ErrorF ("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n", - (int) pScreenPriv->dwBitsPerRGB); - - /* Create a single visual according to the Windows screen depth */ - switch (pScreenInfo->dwDepth) - { - case 24: - case 16: - case 15: - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - TrueColorMask, - pScreenPriv->dwBitsPerRGB, - TrueColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n"); - return FALSE; - } - break; - - case 8: - ErrorF ("winInitVisuals - Calling miSetVisualTypesAndMasks\n"); - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - StaticColorMask, - pScreenPriv->dwBitsPerRGB, - StaticColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n"); - return FALSE; - } - break; - - default: - ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n"); - return FALSE; - } - -#if 1 - ErrorF ("winInitVisualsNativeGDI - Returning\n"); -#endif - - return TRUE; -} - - -/* Adjust the video mode */ -static Bool -winAdjustVideoModeNativeGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HDC hdc = NULL; - DWORD dwBPP; - - hdc = GetDC (NULL); - - /* We're in serious trouble if we can't get a DC */ - if (hdc == NULL) - { - ErrorF ("winAdjustVideoModeNativeGDI - GetDC () failed\n"); - return FALSE; - } - - /* Query GDI for current display depth */ - dwBPP = GetDeviceCaps (hdc, BITSPIXEL); - pScreenInfo->dwDepth = GetDeviceCaps (hdc, PLANES); - - switch (pScreenInfo->dwDepth) { - case 24: - case 16: - case 15: - case 8: - break; - default: - if (dwBPP == 32) - pScreenInfo->dwDepth = 24; - else - pScreenInfo->dwDepth = dwBPP; - break; - } - - /* GDI cannot change the screen depth */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) - { - /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeNativeGDI - Using Windows display " - "depth of %d bits per pixel, %d depth\n", - (int) dwBPP, (int) pScreenInfo->dwDepth); - - /* Use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Warn user if GDI depth is different than -depth parameter */ - ErrorF ("winAdjustVideoModeNativeGDI - Command line bpp: %d, "\ - "using bpp: %d\n", - (int) pScreenInfo->dwBPP, (int) dwBPP); - - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - - /* Release our DC */ - ReleaseDC (NULL, hdc); - - return TRUE; -} - - -static Bool -winActivateAppNativeGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* - * Are we active? - * Are we fullscreen? - */ - if (pScreenPriv != NULL - && pScreenPriv->fActive - && pScreenInfo->fFullScreen) - { - /* - * Activating, attempt to bring our window - * to the top of the display - */ - ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE); - } - - /* - * Are we inactive? - * Are we fullscreen? - */ - if (pScreenPriv != NULL - && !pScreenPriv->fActive - && pScreenInfo->fFullScreen) - { - /* - * Deactivating, stuff our window onto the - * task bar. - */ - ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); - } - - return TRUE; -} - - -HBITMAP -winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth, - BYTE **ppbBits, BITMAPINFO **ppbmi) -{ - BITMAPINFOHEADER *pbmih = NULL; - HBITMAP hBitmap = NULL; - BITMAPINFO *pbmi = NULL; - - /* Don't create an invalid bitmap */ - if (iWidth == 0 - || iHeight == 0 - || iDepth == 0) - { - ErrorF ("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n", - iWidth, iHeight, iDepth); - return NULL; - } - - /* Allocate bitmap info header */ - pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) - + 256 * sizeof (RGBQUAD)); - if (pbmih == NULL) - { - ErrorF ("winCreateDIBNativeGDI - malloc () failed\n"); - return FALSE; - } - ZeroMemory (pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); - - /* Describe bitmap to be created */ - pbmih->biSize = sizeof (BITMAPINFOHEADER); - pbmih->biWidth = iWidth; - pbmih->biHeight = -iHeight; - pbmih->biPlanes = 1; - pbmih->biBitCount = iDepth; - pbmih->biCompression = BI_RGB; - pbmih->biSizeImage = 0; - pbmih->biXPelsPerMeter = 0; - pbmih->biYPelsPerMeter = 0; - pbmih->biClrUsed = 0; - pbmih->biClrImportant = 0; - - /* Setup color table for mono DIBs */ - if (iDepth == 1) - { - pbmi = (BITMAPINFO*) pbmih; - pbmi->bmiColors[1].rgbBlue = 255; - pbmi->bmiColors[1].rgbGreen = 255; - pbmi->bmiColors[1].rgbRed = 255; - } - - /* Create a DIB with a bit pointer */ - hBitmap = CreateDIBSection (NULL, - (BITMAPINFO *) pbmih, - DIB_RGB_COLORS, - (void **) ppbBits, - NULL, - 0); - if (hBitmap == NULL) - { - ErrorF ("winCreateDIBNativeGDI - CreateDIBSection () failed\n"); - return NULL; - } - - /* Free the bitmap info header memory */ - if (ppbmi != NULL) - { - /* Store the address of the BMIH in the ppbmih parameter */ - *ppbmi = (BITMAPINFO *) pbmih; - } - else - { - free (pbmih); - pbmih = NULL; - } - - return hBitmap; -} - - -#if 0 -static Bool -winBltExposedRegionsNativeGDI (ScreenPtr pScreen) -{ - - return TRUE; -} -#endif - - -static Bool -winRedrawScreenNativeGDI (ScreenPtr pScreen) -{ - FatalError ("winRedrawScreenNativeGDI\n"); - return TRUE; -} - - -static Bool -winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen) -{ - FatalError ("winRealizeInstalledPaletteNativeGDI\n"); - return TRUE; -} - - -static Bool -winInstallColormapNativeGDI (ColormapPtr pColormap) -{ - FatalError ("winInstallColormapNativeGDI\n"); - return TRUE; -} - - -static Bool -winStoreColorsNativeGDI (ColormapPtr pmap, - int ndef, - xColorItem *pdefs) -{ - FatalError ("winStoreColorsNativeGDI\n"); - return TRUE; -} - - -static Bool -winCreateColormapNativeGDI (ColormapPtr pColormap) -{ - FatalError ("winCreateColormapNativeGDI\n"); - return TRUE; -} - - -static Bool -winDestroyColormapNativeGDI (ColormapPtr pColormap) -{ - FatalError ("winDestroyColormapNativeGDI\n"); - return TRUE; -} - - -/* Set engine specific funtions */ -Bool -winSetEngineFunctionsNativeGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Set our pointers */ - pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI; - pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI; - pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI; - pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI; - pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI; - if (pScreenInfo->fFullScreen) - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; - else - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; - pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI; - /* - * WARNING: Do not set the BltExposedRegions procedure pointer to anything - * other than NULL until a working painting procedure is in place. - * Else, winWindowProc will get stuck in an infinite loop because - * Windows expects the BeginPaint and EndPaint functions to be called - * before a WM_PAINT message can be removed from the queue. We are - * using NULL here as a signal for winWindowProc that it should - * not signal that the WM_PAINT message has been processed. - */ - pScreenPriv->pwinBltExposedRegions = NULL; - pScreenPriv->pwinActivateApp = winActivateAppNativeGDI; - pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI; - pScreenPriv->pwinRealizeInstalledPalette = - winRealizeInstalledPaletteNativeGDI; - pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI; - pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI; - pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI; - pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI; - pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; - - return TRUE; -} +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" + + +/* + * Local function prototypes + */ + +static Bool +winAllocateFBNativeGDI (ScreenPtr pScreen); + +static void +winShadowUpdateNativeGDI (ScreenPtr pScreen, + shadowBufPtr pBuf); + +static Bool +winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen); + +static Bool +winInitVisualsNativeGDI (ScreenPtr pScreen); + +static Bool +winAdjustVideoModeNativeGDI (ScreenPtr pScreen); + +#if 0 +static Bool +winBltExposedRegionsNativeGDI (ScreenPtr pScreen); +#endif + +static Bool +winActivateAppNativeGDI (ScreenPtr pScreen); + +static Bool +winRedrawScreenNativeGDI (ScreenPtr pScreen); + +static Bool +winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen); + +static Bool +winInstallColormapNativeGDI (ColormapPtr pColormap); + +static Bool +winStoreColorsNativeGDI (ColormapPtr pmap, + int ndef, + xColorItem *pdefs); + +static Bool +winCreateColormapNativeGDI (ColormapPtr pColormap); + +static Bool +winDestroyColormapNativeGDI (ColormapPtr pColormap); + + + +static Bool +winAllocateFBNativeGDI (ScreenPtr pScreen) +{ + FatalError ("winAllocateFBNativeGDI\n"); + + return TRUE; +} + +static void +winFreeFBNativeGDI (ScreenPtr pScreen) +{ + FatalError ("winFreeFBNativeGDI\n"); +} + + +static Bool +winInitScreenNativeGDI(ScreenPtr pScreen) +{ + FatalError ("winInitScreenNativeGDI\n"); +} + +/* + * We wrap whatever CloseScreen procedure was specified by fb; + * a pointer to said procedure is stored in our privates. + */ + +static Bool +winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + ErrorF ("winCloseScreenNativeGDI - Freeing screen resources\n"); + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* + * NOTE: mi doesn't use a CloseScreen procedure, so we do not + * need to call a wrapped procedure here. + */ + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + ErrorF ("winCloseScreenNativeGDI - Destroying window\n"); + + /* Delete tray icon, if we have one */ + if (!pScreenInfo->fNoTrayIcon) + winDeleteNotifyIcon (pScreenPriv); + + /* Free the exit confirmation dialog box, if it exists */ + if (g_hDlgExit != NULL) + { + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + } + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Invalidate our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Free the screen privates for this screen */ + free (pScreenPriv); + + ErrorF ("winCloseScreenNativeGDI - Returning\n"); + + return TRUE; +} + + +static void +winShadowUpdateNativeGDI (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + FatalError ("winShadowUpdateNativeGDI\n"); + return; +} + + +static Bool +winInitVisualsNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set the bitsPerRGB and bit masks */ + switch (pScreenInfo->dwDepth) + { + case 24: + pScreenPriv->dwBitsPerRGB = 8; + pScreenPriv->dwRedMask = 0x00FF0000; + pScreenPriv->dwGreenMask = 0x0000FF00; + pScreenPriv->dwBlueMask = 0x000000FF; + break; + + case 16: + pScreenPriv->dwBitsPerRGB = 6; + pScreenPriv->dwRedMask = 0xF800; + pScreenPriv->dwGreenMask = 0x07E0; + pScreenPriv->dwBlueMask = 0x001F; + break; + + case 15: + pScreenPriv->dwBitsPerRGB = 5; + pScreenPriv->dwRedMask = 0x7C00; + pScreenPriv->dwGreenMask = 0x03E0; + pScreenPriv->dwBlueMask = 0x001F; + break; + + case 8: + pScreenPriv->dwBitsPerRGB = 8; + pScreenPriv->dwRedMask = 0; + pScreenPriv->dwGreenMask = 0; + pScreenPriv->dwBlueMask = 0; + break; + + default: + ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n"); + return FALSE; + break; + } + + /* Tell the user how many bits per RGB we are using */ + ErrorF ("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n", + (int) pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + case 8: + ErrorF ("winInitVisuals - Calling miSetVisualTypesAndMasks\n"); + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + StaticColorMask, + pScreenPriv->dwBitsPerRGB, + StaticColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + default: + ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n"); + return FALSE; + } + +#if 1 + ErrorF ("winInitVisualsNativeGDI - Returning\n"); +#endif + + return TRUE; +} + + +/* Adjust the video mode */ +static Bool +winAdjustVideoModeNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwBPP; + + hdc = GetDC (NULL); + + /* We're in serious trouble if we can't get a DC */ + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModeNativeGDI - GetDC () failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); + pScreenInfo->dwDepth = GetDeviceCaps (hdc, PLANES); + + switch (pScreenInfo->dwDepth) { + case 24: + case 16: + case 15: + case 8: + break; + default: + if (dwBPP == 32) + pScreenInfo->dwDepth = 24; + else + pScreenInfo->dwDepth = dwBPP; + break; + } + + /* GDI cannot change the screen depth, so we'll use GDI's depth */ + pScreenInfo->dwBPP = dwBPP; + + /* Release our DC */ + ReleaseDC (NULL, hdc); + + return TRUE; +} + + +static Bool +winActivateAppNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* + * Are we active? + * Are we fullscreen? + */ + if (pScreenPriv != NULL + && pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* + * Activating, attempt to bring our window + * to the top of the display + */ + ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE); + } + + /* + * Are we inactive? + * Are we fullscreen? + */ + if (pScreenPriv != NULL + && !pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* + * Deactivating, stuff our window onto the + * task bar. + */ + ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); + } + + return TRUE; +} + + +HBITMAP +winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth, + BYTE **ppbBits, BITMAPINFO **ppbmi) +{ + BITMAPINFOHEADER *pbmih = NULL; + HBITMAP hBitmap = NULL; + BITMAPINFO *pbmi = NULL; + + /* Don't create an invalid bitmap */ + if (iWidth == 0 + || iHeight == 0 + || iDepth == 0) + { + ErrorF ("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n", + iWidth, iHeight, iDepth); + return NULL; + } + + /* Allocate bitmap info header */ + pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pbmih == NULL) + { + ErrorF ("winCreateDIBNativeGDI - malloc () failed\n"); + return FALSE; + } + ZeroMemory (pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); + + /* Describe bitmap to be created */ + pbmih->biSize = sizeof (BITMAPINFOHEADER); + pbmih->biWidth = iWidth; + pbmih->biHeight = -iHeight; + pbmih->biPlanes = 1; + pbmih->biBitCount = iDepth; + pbmih->biCompression = BI_RGB; + pbmih->biSizeImage = 0; + pbmih->biXPelsPerMeter = 0; + pbmih->biYPelsPerMeter = 0; + pbmih->biClrUsed = 0; + pbmih->biClrImportant = 0; + + /* Setup color table for mono DIBs */ + if (iDepth == 1) + { + pbmi = (BITMAPINFO*) pbmih; + pbmi->bmiColors[1].rgbBlue = 255; + pbmi->bmiColors[1].rgbGreen = 255; + pbmi->bmiColors[1].rgbRed = 255; + } + + /* Create a DIB with a bit pointer */ + hBitmap = CreateDIBSection (NULL, + (BITMAPINFO *) pbmih, + DIB_RGB_COLORS, + (void **) ppbBits, + NULL, + 0); + if (hBitmap == NULL) + { + ErrorF ("winCreateDIBNativeGDI - CreateDIBSection () failed\n"); + return NULL; + } + + /* Free the bitmap info header memory */ + if (ppbmi != NULL) + { + /* Store the address of the BMIH in the ppbmih parameter */ + *ppbmi = (BITMAPINFO *) pbmih; + } + else + { + free (pbmih); + pbmih = NULL; + } + + return hBitmap; +} + + +#if 0 +static Bool +winBltExposedRegionsNativeGDI (ScreenPtr pScreen) +{ + + return TRUE; +} +#endif + + +static Bool +winRedrawScreenNativeGDI (ScreenPtr pScreen) +{ + FatalError ("winRedrawScreenNativeGDI\n"); + return TRUE; +} + + +static Bool +winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen) +{ + FatalError ("winRealizeInstalledPaletteNativeGDI\n"); + return TRUE; +} + + +static Bool +winInstallColormapNativeGDI (ColormapPtr pColormap) +{ + FatalError ("winInstallColormapNativeGDI\n"); + return TRUE; +} + + +static Bool +winStoreColorsNativeGDI (ColormapPtr pmap, + int ndef, + xColorItem *pdefs) +{ + FatalError ("winStoreColorsNativeGDI\n"); + return TRUE; +} + + +static Bool +winCreateColormapNativeGDI (ColormapPtr pColormap) +{ + FatalError ("winCreateColormapNativeGDI\n"); + return TRUE; +} + + +static Bool +winDestroyColormapNativeGDI (ColormapPtr pColormap) +{ + FatalError ("winDestroyColormapNativeGDI\n"); + return TRUE; +} + + +/* Set engine specific funtions */ +Bool +winSetEngineFunctionsNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI; + pScreenPriv->pwinFreeFB = winFreeFBNativeGDI; + pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI; + pScreenPriv->pwinInitScreen = winInitScreenNativeGDI; + pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI; + pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI; + /* + * WARNING: Do not set the BltExposedRegions procedure pointer to anything + * other than NULL until a working painting procedure is in place. + * Else, winWindowProc will get stuck in an infinite loop because + * Windows expects the BeginPaint and EndPaint functions to be called + * before a WM_PAINT message can be removed from the queue. We are + * using NULL here as a signal for winWindowProc that it should + * not signal that the WM_PAINT message has been processed. + */ + pScreenPriv->pwinBltExposedRegions = NULL; + pScreenPriv->pwinActivateApp = winActivateAppNativeGDI; + pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI; + pScreenPriv->pwinRealizeInstalledPalette = + winRealizeInstalledPaletteNativeGDI; + pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI; + pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI; + pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI; + pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; + + return TRUE; +} diff --git a/xorg-server/hw/xwin/winpfbdd.c b/xorg-server/hw/xwin/winpfbdd.c index 840a839f0..c0bca71e3 100644 --- a/xorg-server/hw/xwin/winpfbdd.c +++ b/xorg-server/hw/xwin/winpfbdd.c @@ -1,676 +1,678 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *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 XFREE86 PROJECT 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 XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Dakshinamurthy Karra - * Suhaib M Siddiqi - * Peter Busch - * Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - - -/* - * Local function prototypes - */ - -static Bool -winAllocateFBPrimaryDD (ScreenPtr pScreen); - -static Bool -winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen); - -static Bool -winInitVisualsPrimaryDD (ScreenPtr pScreen); - -static Bool -winAdjustVideoModePrimaryDD (ScreenPtr pScreen); - -static Bool -winActivateAppPrimaryDD (ScreenPtr pScreen); - -static Bool -winHotKeyAltTabPrimaryDD (ScreenPtr pScreen); - - -/* - * Create a DirectDraw primary surface - */ - -static Bool -winAllocateFBPrimaryDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HRESULT ddrval = DD_OK; - DDSURFACEDESC ddsd; - DDSURFACEDESC *pddsdPrimary = NULL; - DDSURFACEDESC *pddsdOffscreen = NULL; - RECT rcClient; - - ErrorF ("winAllocateFBPrimaryDD\n"); - - /* Get client area location in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&rcClient, 2); - - /* Create a DirectDraw object, store the address at lpdd */ - ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL); - if (ddrval != DD_OK) - FatalError ("winAllocateFBPrimaryDD - Could not start DirectDraw\n"); - - /* Get a DirectDraw2 interface pointer */ - ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, - &IID_IDirectDraw2, - (LPVOID*) &pScreenPriv->pdd2); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - - - ErrorF ("winAllocateFBPrimaryDD - Created and initialized DD\n"); - - /* Are we windowed or fullscreen? */ - if (pScreenInfo->fFullScreen) - { - /* Full screen mode */ - ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, - pScreenPriv->hwndScreen, - DDSCL_FULLSCREEN - | DDSCL_EXCLUSIVE); - if (FAILED (ddrval)) - FatalError ("winAllocateFBPrimaryDD - Could not set " - "cooperative level\n"); - - /* Change the video mode to the mode requested */ - ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, - pScreenInfo->dwWidth, - pScreenInfo->dwHeight, - pScreenInfo->dwBPP, - pScreenInfo->dwRefreshRate, - 0); - if (FAILED (ddrval)) - FatalError ("winAllocateFBPrimaryDD - Could not set " - "full screen display mode\n"); - } - else - { - /* Windowed mode */ - ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, - pScreenPriv->hwndScreen, - DDSCL_NORMAL); - if (FAILED (ddrval)) - FatalError ("winAllocateFBPrimaryDD - Could not set " - "cooperative level\n"); - } - - /* Describe the primary surface */ - ZeroMemory (&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - /* Create the primary surface */ - ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, - &ddsd, - &pScreenPriv->pddsPrimary, - NULL); - if (FAILED (ddrval)) - FatalError ("winAllocateFBPrimaryDD - Could not create primary " - "surface %08x\n", (unsigned int) ddrval); - - ErrorF ("winAllocateFBPrimaryDD - Created primary\n"); - - /* Allocate a DD surface description for our screen privates */ - pddsdPrimary = pScreenPriv->pddsdPrimary - = malloc (sizeof (DDSURFACEDESC)); - if (pddsdPrimary == NULL) - FatalError ("winAllocateFBPrimaryDD - Could not allocate surface " - "description memory\n"); - ZeroMemory (pddsdPrimary, sizeof (*pddsdPrimary)); - pddsdPrimary->dwSize = sizeof (*pddsdPrimary); - - /* Describe the offscreen surface to be created */ - /* - * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, - * as drawing, locking, and unlocking take forever - * with video memory surfaces. In addition, - * video memory is a somewhat scarce resource, - * so you shouldn't be allocating video memory when - * you have the option of using system memory instead. - */ - ZeroMemory (&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - ddsd.dwHeight = pScreenInfo->dwHeight; - ddsd.dwWidth = pScreenInfo->dwWidth; - - /* Create the shadow surface */ - ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, - &ddsd, - &pScreenPriv->pddsOffscreen, - NULL); - if (ddrval != DD_OK) - FatalError ("winAllocateFBPrimaryDD - Could not create shadow " - "surface\n"); - - ErrorF ("winAllocateFBPrimaryDD - Created offscreen\n"); - - /* Allocate a DD surface description for our screen privates */ - pddsdOffscreen = pScreenPriv->pddsdOffscreen - = malloc (sizeof (DDSURFACEDESC)); - if (pddsdOffscreen == NULL) - FatalError ("winAllocateFBPrimaryDD - Could not allocate surface " - "description memory\n"); - ZeroMemory (pddsdOffscreen, sizeof (*pddsdOffscreen)); - pddsdOffscreen->dwSize = sizeof (*pddsdOffscreen); - - ErrorF ("winAllocateFBPrimaryDD - Locking primary\n"); - - /* Lock the primary surface */ - ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary, - pScreenInfo->fFullScreen ? NULL:&rcClient, - pddsdPrimary, - DDLOCK_WAIT, - NULL); - if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL) - FatalError ("winAllocateFBPrimaryDD - Could not lock " - "primary surface\n"); - - ErrorF ("winAllocateFBPrimaryDD - Locked primary\n"); - - /* We don't know how to deal with anything other than RGB */ - if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB)) - FatalError ("winAllocateFBPrimaryDD - Color format other than RGB\n"); - - /* Grab the pitch from the surface desc */ - pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8) - / pScreenInfo->dwBPP; - - /* Save the pointer to our surface memory */ - pScreenInfo->pfb = pddsdPrimary->lpSurface; - - /* Grab the color depth and masks from the surface description */ - pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask; - pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask; - pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask; - - ErrorF ("winAllocateFBPrimaryDD - Returning\n"); - - return TRUE; -} - - -/* - * Call the wrapped CloseScreen function. - * - * Free our resources and private structures. - */ - -static Bool -winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - Bool fReturn; - - ErrorF ("winCloseScreenPrimaryDD - Freeing screen resources\n"); - - /* Flag that the screen is closed */ - pScreenPriv->fClosed = TRUE; - pScreenPriv->fActive = FALSE; - - /* Call the wrapped CloseScreen procedure */ - WIN_UNWRAP(CloseScreen); - fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); - - /* Delete the window property */ - RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - - /* Free the offscreen surface, if there is one */ - if (pScreenPriv->pddsOffscreen) - { - IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL); - IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen); - pScreenPriv->pddsOffscreen = NULL; - } - - /* Release the primary surface, if there is one */ - if (pScreenPriv->pddsPrimary) - { - IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL); - IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); - pScreenPriv->pddsPrimary = NULL; - } - - /* Free the DirectDraw object, if there is one */ - if (pScreenPriv->pdd) - { - IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd); - IDirectDraw2_Release (pScreenPriv->pdd); - pScreenPriv->pdd = NULL; - } - - /* Delete tray icon, if we have one */ - if (!pScreenInfo->fNoTrayIcon) - winDeleteNotifyIcon (pScreenPriv); - - /* Free the exit confirmation dialog box, if it exists */ - if (g_hDlgExit != NULL) - { - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - } - - /* Kill our window */ - if (pScreenPriv->hwndScreen) - { - DestroyWindow (pScreenPriv->hwndScreen); - pScreenPriv->hwndScreen = NULL; - } - - /* Kill our screeninfo's pointer to the screen */ - pScreenInfo->pScreen = NULL; - - /* Invalidate the ScreenInfo's fb pointer */ - pScreenInfo->pfb = NULL; - - /* Free the screen privates for this screen */ - free ((pointer) pScreenPriv); - - return fReturn; -} - - -/* - * Tell mi what sort of visuals we need. - * - * Generally we only need one visual, as our screen can only - * handle one format at a time, I believe. You may want - * to verify that last sentence. - */ - -static Bool -winInitVisualsPrimaryDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - DWORD dwRedBits, dwGreenBits, dwBlueBits; - - /* Count the number of ones in each color mask */ - dwRedBits = winCountBits (pScreenPriv->dwRedMask); - dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); - dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); - - /* Store the maximum number of ones in a color mask as the bitsPerRGB */ - if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) - pScreenPriv->dwBitsPerRGB = dwRedBits; - else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) - pScreenPriv->dwBitsPerRGB = dwGreenBits; - else - pScreenPriv->dwBitsPerRGB = dwBlueBits; - - ErrorF ("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n", - (unsigned int) pScreenPriv->dwRedMask, - (unsigned int) pScreenPriv->dwGreenMask, - (unsigned int) pScreenPriv->dwBlueMask, - (int) pScreenPriv->dwBitsPerRGB); - - /* Create a single visual according to the Windows screen depth */ - switch (pScreenInfo->dwDepth) - { - case 24: - case 16: - case 15: - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - TrueColorMask, - pScreenPriv->dwBitsPerRGB, - TrueColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisualsPrimaryDD - " - "miSetVisualTypesAndMasks failed\n"); - return FALSE; - } - break; - - case 8: -#if CYGDEBUG - winDebug ("winInitVisuals - Calling miSetVisualTypesAndMasks\n"); -#endif /* CYGDEBUG */ - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - PseudoColorMask, - pScreenPriv->dwBitsPerRGB, - PseudoColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisualsPrimaryDD - " - "miSetVisualTypesAndMasks failed\n"); - return FALSE; - } -#if CYGDEBUG - winDebug ("winInitVisualsPrimaryDD - Returned from " - "miSetVisualTypesAndMasks\n"); -#endif /* CYGDEBUG */ - break; - - default: - ErrorF ("winInitVisualsPrimaryDD - Unknown screen depth\n"); - return FALSE; - } - - ErrorF ("winInitVisualsPrimaryDD - Returning\n"); - - return TRUE; -} - - -static Bool -winAdjustVideoModePrimaryDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HDC hdc = NULL; - DWORD dwBPP; - - /* We're in serious trouble if we can't get a DC */ - hdc = GetDC (NULL); - if (hdc == NULL) - { - ErrorF ("winAdjustVideoModePrimaryDD - GetDC failed\n"); - return FALSE; - } - - /* Query GDI for current display depth */ - dwBPP = GetDeviceCaps (hdc, BITSPIXEL); - - /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) - { - /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModePrimaryDD - Using Windows display " - "depth of %d bits per pixel\n", (int) dwBPP); - - /* Use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - else if (pScreenInfo->fFullScreen - && pScreenInfo->dwBPP != dwBPP) - { - /* FullScreen, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModePrimaryDD - FullScreen, using command " - "line depth: %d\n", (int) pScreenInfo->dwBPP); - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Windowed, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModePrimaryDD - Windowed, command line " - "depth: %d, using depth: %d\n", - (int) pScreenInfo->dwBPP, (int) dwBPP); - - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - - /* Release our DC */ - ReleaseDC (NULL, hdc); - - return TRUE; -} - - -/* - * We need to blit our offscreen fb to - * the screen when we are activated, and we need to point - * the fb code back to the primary surface memory. - */ - -static Bool -winActivateAppPrimaryDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RECT rcSrc, rcClient; - HRESULT ddrval = DD_OK; - - /* Check for errors */ - if (pScreenPriv == NULL - || pScreenPriv->pddsPrimary == NULL - || pScreenPriv->pddsOffscreen == NULL) - return FALSE; - - /* Check for do-nothing */ - if (!pScreenPriv->fActive) - return TRUE; - - /* We are activating */ - ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsOffscreen); - if (ddrval == DD_OK) - { - IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, - NULL); - /* - * We don't check for an error from Unlock, because it - * doesn't matter if the Unlock failed. - */ - } - - /* Restore both surfaces, just cause I like it that way */ - IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen); - IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); - - /* Get client area in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&rcClient, 2); - - /* Setup a source rectangle */ - rcSrc.left = 0; - rcSrc.top = 0; - rcSrc.right = pScreenInfo->dwWidth; - rcSrc.bottom = pScreenInfo->dwHeight; - - ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, - &rcClient, - pScreenPriv->pddsOffscreen, - &rcSrc, - DDBLT_WAIT, - NULL); - if (ddrval != DD_OK) - FatalError ("winActivateAppPrimaryDD () - Failed blitting offscreen " - "surface to primary surface %08x\n", (unsigned int) ddrval); - - /* Lock the primary surface */ - ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary, - &rcClient, - pScreenPriv->pddsdPrimary, - DDLOCK_WAIT, - NULL); - if (ddrval != DD_OK - || pScreenPriv->pddsdPrimary->lpSurface == NULL) - FatalError ("winActivateAppPrimaryDD () - Could not lock " - "primary surface\n"); - - /* Notify FB of the new memory pointer */ - winUpdateFBPointer (pScreen, - pScreenPriv->pddsdPrimary->lpSurface); - - /* - * Register the Alt-Tab combo as a hotkey so we can copy - * the primary framebuffer before the display mode changes - */ - RegisterHotKey (pScreenPriv->hwndScreen, 1, MOD_ALT, 9); - - return TRUE; -} - - -/* - * Handle the Alt+Tab hotkey. - * - * We need to save the primary fb to an offscreen fb when - * we get deactivated, and point the fb code at the offscreen - * fb for the duration of the deactivation. - */ - -static Bool -winHotKeyAltTabPrimaryDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RECT rcClient, rcSrc; - HRESULT ddrval = DD_OK; - - ErrorF ("\nwinHotKeyAltTabPrimaryDD\n\n"); - - /* Alt+Tab was pressed, we will lose focus very soon */ - pScreenPriv->fActive = FALSE; - - /* Check for error conditions */ - if (pScreenPriv->pddsPrimary == NULL - || pScreenPriv->pddsOffscreen == NULL) - return FALSE; - - /* Get client area in screen coords */ - GetClientRect (pScreenPriv->hwndScreen, &rcClient); - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&rcClient, 2); - - /* Did we loose the primary surface? */ - ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsPrimary); - if (ddrval == DD_OK) - { - ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, - NULL); - if (FAILED (ddrval)) - FatalError ("winHotKeyAltTabPrimaryDD - Failed unlocking primary " - "surface\n"); - } - - /* Setup a source rectangle */ - rcSrc.left = 0; - rcSrc.top = 0; - rcSrc.right = pScreenInfo->dwWidth; - rcSrc.bottom = pScreenInfo->dwHeight; - - /* Blit the primary surface to the offscreen surface */ - ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen, - NULL, /* should be rcDest */ - pScreenPriv->pddsPrimary, - NULL, - DDBLT_WAIT, - NULL); - if (ddrval == DDERR_SURFACELOST) - { - IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen); - IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); - - /* Blit the primary surface to the offscreen surface */ - ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen, - NULL, - pScreenPriv->pddsPrimary, - NULL, - DDBLT_WAIT, - NULL); - if (FAILED (ddrval)) - FatalError ("winHotKeyAltTabPrimaryDD - Failed blitting primary " - "surface to offscreen surface: %08x\n", - (unsigned int) ddrval); - } - else - { - FatalError ("winHotKeyAltTabPrimaryDD - Unknown error from " - "Blt: %08dx\n", (unsigned int) ddrval); - } - - /* Lock the offscreen surface */ - ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsOffscreen, - NULL, - pScreenPriv->pddsdOffscreen, - DDLOCK_WAIT, - NULL); - if (ddrval != DD_OK - || pScreenPriv->pddsdPrimary->lpSurface == NULL) - FatalError ("winHotKeyAltTabPrimaryDD - Could not lock " - "offscreen surface\n"); - - /* Notify FB of the new memory pointer */ - winUpdateFBPointer (pScreen, - pScreenPriv->pddsdOffscreen->lpSurface); - - /* Unregister our hotkey */ - UnregisterHotKey (pScreenPriv->hwndScreen, 1); - - return TRUE; -} - - -/* Set engine specific functions */ -Bool -winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Set our pointers */ - pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD; - pScreenPriv->pwinShadowUpdate - = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA; - pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD; - pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD; - pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD; - if (pScreenInfo->fFullScreen) - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; - else - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; - pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; - pScreenPriv->pwinBltExposedRegions - = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA; - pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD; - pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD; -#ifdef XWIN_MULTIWINDOW - pScreenPriv->pwinFinishCreateWindowsWindow = - (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA; -#endif - - return TRUE; -} +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" + + +/* + * Local function prototypes + */ + +static Bool +winAllocateFBPrimaryDD (ScreenPtr pScreen); + +static Bool +winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen); + +static Bool +winInitVisualsPrimaryDD (ScreenPtr pScreen); + +static Bool +winAdjustVideoModePrimaryDD (ScreenPtr pScreen); + +static Bool +winActivateAppPrimaryDD (ScreenPtr pScreen); + +static Bool +winHotKeyAltTabPrimaryDD (ScreenPtr pScreen); + + +/* + * Create a DirectDraw primary surface + */ + +static Bool +winAllocateFBPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC ddsd; + DDSURFACEDESC *pddsdPrimary = NULL; + DDSURFACEDESC *pddsdOffscreen = NULL; + RECT rcClient; + + ErrorF ("winAllocateFBPrimaryDD\n"); + + /* Get client area location in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBPrimaryDD - Could not start DirectDraw\n"); + + /* Get a DirectDraw2 interface pointer */ + ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, + &IID_IDirectDraw2, + (LPVOID*) &pScreenPriv->pdd2); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + + + ErrorF ("winAllocateFBPrimaryDD - Created and initialized DD\n"); + + /* Are we windowed or fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* Full screen mode */ + ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, + pScreenPriv->hwndScreen, + DDSCL_FULLSCREEN + | DDSCL_EXCLUSIVE); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD - Could not set " + "cooperative level\n"); + + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + pScreenInfo->dwRefreshRate, + 0); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD - Could not set " + "full screen display mode\n"); + } + else + { + /* Windowed mode */ + ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD - Could not set " + "cooperative level\n"); + } + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD - Could not create primary " + "surface %08x\n", (unsigned int) ddrval); + + ErrorF ("winAllocateFBPrimaryDD - Created primary\n"); + + /* Allocate a DD surface description for our screen privates */ + pddsdPrimary = pScreenPriv->pddsdPrimary + = malloc (sizeof (DDSURFACEDESC)); + if (pddsdPrimary == NULL) + FatalError ("winAllocateFBPrimaryDD - Could not allocate surface " + "description memory\n"); + ZeroMemory (pddsdPrimary, sizeof (*pddsdPrimary)); + pddsdPrimary->dwSize = sizeof (*pddsdPrimary); + + /* Describe the offscreen surface to be created */ + /* + * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, + * as drawing, locking, and unlocking take forever + * with video memory surfaces. In addition, + * video memory is a somewhat scarce resource, + * so you shouldn't be allocating video memory when + * you have the option of using system memory instead. + */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsd.dwHeight = pScreenInfo->dwHeight; + ddsd.dwWidth = pScreenInfo->dwWidth; + + /* Create the shadow surface */ + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsOffscreen, + NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBPrimaryDD - Could not create shadow " + "surface\n"); + + ErrorF ("winAllocateFBPrimaryDD - Created offscreen\n"); + + /* Allocate a DD surface description for our screen privates */ + pddsdOffscreen = pScreenPriv->pddsdOffscreen + = malloc (sizeof (DDSURFACEDESC)); + if (pddsdOffscreen == NULL) + FatalError ("winAllocateFBPrimaryDD - Could not allocate surface " + "description memory\n"); + ZeroMemory (pddsdOffscreen, sizeof (*pddsdOffscreen)); + pddsdOffscreen->dwSize = sizeof (*pddsdOffscreen); + + ErrorF ("winAllocateFBPrimaryDD - Locking primary\n"); + + /* Lock the primary surface */ + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary, + pScreenInfo->fFullScreen ? NULL:&rcClient, + pddsdPrimary, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL) + FatalError ("winAllocateFBPrimaryDD - Could not lock " + "primary surface\n"); + + ErrorF ("winAllocateFBPrimaryDD - Locked primary\n"); + + /* We don't know how to deal with anything other than RGB */ + if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB)) + FatalError ("winAllocateFBPrimaryDD - Color format other than RGB\n"); + + /* Grab the pitch from the surface desc */ + pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8) + / pScreenInfo->dwBPP; + + /* Save the pointer to our surface memory */ + pScreenInfo->pfb = pddsdPrimary->lpSurface; + + /* Grab the color depth and masks from the surface description */ + pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask; + + ErrorF ("winAllocateFBPrimaryDD - Returning\n"); + + return TRUE; +} + +static void +winFreeFBPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Free the offscreen surface, if there is one */ + if (pScreenPriv->pddsOffscreen) + { + IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL); + IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen); + pScreenPriv->pddsOffscreen = NULL; + } + + /* Release the primary surface, if there is one */ + if (pScreenPriv->pddsPrimary) + { + IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL); + IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); + pScreenPriv->pddsPrimary = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw2_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; +} + +static Bool +winInitScreenPrimaryDD(ScreenPtr pScreen) +{ + return winAllocateFBPrimaryDD(pScreen); +} + +/* + * Call the wrapped CloseScreen function. + * + * Free our resources and private structures. + */ + +static Bool +winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + + ErrorF ("winCloseScreenPrimaryDD - Freeing screen resources\n"); + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + WIN_UNWRAP(CloseScreen); + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + winFreeFBPrimaryDD(pScreen); + + /* Delete tray icon, if we have one */ + if (!pScreenInfo->fNoTrayIcon) + winDeleteNotifyIcon (pScreenPriv); + + /* Free the exit confirmation dialog box, if it exists */ + if (g_hDlgExit != NULL) + { + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + } + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Free the screen privates for this screen */ + free ((pointer) pScreenPriv); + + return fReturn; +} + + +/* + * Tell mi what sort of visuals we need. + * + * Generally we only need one visual, as our screen can only + * handle one format at a time, I believe. You may want + * to verify that last sentence. + */ + +static Bool +winInitVisualsPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + ErrorF ("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n", + (unsigned int) pScreenPriv->dwRedMask, + (unsigned int) pScreenPriv->dwGreenMask, + (unsigned int) pScreenPriv->dwBlueMask, + (int) pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsPrimaryDD - " + "miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + case 8: +#if CYGDEBUG + winDebug ("winInitVisuals - Calling miSetVisualTypesAndMasks\n"); +#endif /* CYGDEBUG */ + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsPrimaryDD - " + "miSetVisualTypesAndMasks failed\n"); + return FALSE; + } +#if CYGDEBUG + winDebug ("winInitVisualsPrimaryDD - Returned from " + "miSetVisualTypesAndMasks\n"); +#endif /* CYGDEBUG */ + break; + + default: + ErrorF ("winInitVisualsPrimaryDD - Unknown screen depth\n"); + return FALSE; + } + + ErrorF ("winInitVisualsPrimaryDD - Returning\n"); + + return TRUE; +} + + +static Bool +winAdjustVideoModePrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwBPP; + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModePrimaryDD - GetDC failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); + + /* DirectDraw can only change the depth in fullscreen mode */ + if (!(pScreenInfo->fFullScreen && + (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) + { + /* Otherwise, We'll use GDI's depth */ + pScreenInfo->dwBPP = dwBPP; + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + + return TRUE; +} + + +/* + * We need to blit our offscreen fb to + * the screen when we are activated, and we need to point + * the fb code back to the primary surface memory. + */ + +static Bool +winActivateAppPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RECT rcSrc, rcClient; + HRESULT ddrval = DD_OK; + + /* Check for errors */ + if (pScreenPriv == NULL + || pScreenPriv->pddsPrimary == NULL + || pScreenPriv->pddsOffscreen == NULL) + return FALSE; + + /* Check for do-nothing */ + if (!pScreenPriv->fActive) + return TRUE; + + /* We are activating */ + ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsOffscreen); + if (ddrval == DD_OK) + { + IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, + NULL); + /* + * We don't check for an error from Unlock, because it + * doesn't matter if the Unlock failed. + */ + } + + /* Restore both surfaces, just cause I like it that way */ + IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen); + IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Setup a source rectangle */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsOffscreen, + &rcSrc, + DDBLT_WAIT, + NULL); + if (ddrval != DD_OK) + FatalError ("winActivateAppPrimaryDD () - Failed blitting offscreen " + "surface to primary surface %08x\n", (unsigned int) ddrval); + + /* Lock the primary surface */ + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsdPrimary, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK + || pScreenPriv->pddsdPrimary->lpSurface == NULL) + FatalError ("winActivateAppPrimaryDD () - Could not lock " + "primary surface\n"); + + /* Notify FB of the new memory pointer */ + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdPrimary->lpSurface); + + /* + * Register the Alt-Tab combo as a hotkey so we can copy + * the primary framebuffer before the display mode changes + */ + RegisterHotKey (pScreenPriv->hwndScreen, 1, MOD_ALT, 9); + + return TRUE; +} + + +/* + * Handle the Alt+Tab hotkey. + * + * We need to save the primary fb to an offscreen fb when + * we get deactivated, and point the fb code at the offscreen + * fb for the duration of the deactivation. + */ + +static Bool +winHotKeyAltTabPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RECT rcClient, rcSrc; + HRESULT ddrval = DD_OK; + + ErrorF ("\nwinHotKeyAltTabPrimaryDD\n\n"); + + /* Alt+Tab was pressed, we will lose focus very soon */ + pScreenPriv->fActive = FALSE; + + /* Check for error conditions */ + if (pScreenPriv->pddsPrimary == NULL + || pScreenPriv->pddsOffscreen == NULL) + return FALSE; + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Did we loose the primary surface? */ + ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsPrimary); + if (ddrval == DD_OK) + { + ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winHotKeyAltTabPrimaryDD - Failed unlocking primary " + "surface\n"); + } + + /* Setup a source rectangle */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Blit the primary surface to the offscreen surface */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen, + NULL, /* should be rcDest */ + pScreenPriv->pddsPrimary, + NULL, + DDBLT_WAIT, + NULL); + if (ddrval == DDERR_SURFACELOST) + { + IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen); + IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); + + /* Blit the primary surface to the offscreen surface */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen, + NULL, + pScreenPriv->pddsPrimary, + NULL, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winHotKeyAltTabPrimaryDD - Failed blitting primary " + "surface to offscreen surface: %08x\n", + (unsigned int) ddrval); + } + else + { + FatalError ("winHotKeyAltTabPrimaryDD - Unknown error from " + "Blt: %08dx\n", (unsigned int) ddrval); + } + + /* Lock the offscreen surface */ + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsOffscreen, + NULL, + pScreenPriv->pddsdOffscreen, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK + || pScreenPriv->pddsdPrimary->lpSurface == NULL) + FatalError ("winHotKeyAltTabPrimaryDD - Could not lock " + "offscreen surface\n"); + + /* Notify FB of the new memory pointer */ + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdOffscreen->lpSurface); + + /* Unregister our hotkey */ + UnregisterHotKey (pScreenPriv->hwndScreen, 1); + + return TRUE; +} + + +/* Set engine specific functions */ +Bool +winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD; + pScreenPriv->pwinFreeFB = winFreeFBPrimaryDD; + pScreenPriv->pwinShadowUpdate = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinInitScreen = winInitScreenPrimaryDD; + pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD; + pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + pScreenPriv->pwinBltExposedRegions = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD; + pScreenPriv->pwinRedrawScreen = NULL; + pScreenPriv->pwinRealizeInstalledPalette = NULL; + pScreenPriv->pwinInstallColormap = NULL; + pScreenPriv->pwinStoreColors = NULL; + pScreenPriv->pwinCreateColormap = NULL; + pScreenPriv->pwinDestroyColormap = NULL; + pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD; + pScreenPriv->pwinCreatePrimarySurface = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinReleasePrimarySurface = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA; +#ifdef XWIN_MULTIWINDOW + pScreenPriv->pwinFinishCreateWindowsWindow = + (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA; +#endif + + return TRUE; +} diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index 39f0ee3e5..ddfe1f5b7 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -1,1256 +1,1217 @@ -/* - -Copyright 1993, 1998 The Open Group -Copyright (C) Colin Harrison 2005-2008 - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif - -#include <../xfree86/common/xorgVersion.h> -#include "win.h" -#include "winconfig.h" -#include "winmsg.h" - -/* - * References to external symbols - */ - -#ifdef XWIN_CLIPBOARD -extern Bool g_fUnicodeClipboard; -extern Bool g_fClipboard; -#endif -/* globals required by callback function for monitor information */ -struct GetMonitorInfoData { - int requestedMonitor; - int monitorNum; - Bool bUserSpecifiedMonitor; - Bool bMonitorSpecifiedExists; - int monitorOffsetX; - int monitorOffsetY; - int monitorHeight; - int monitorWidth; -}; - -typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); -ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; - -wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); - -static Bool QueryMonitor(int index, struct GetMonitorInfoData *data) -{ - /* Load EnumDisplayMonitors from DLL */ - HMODULE user32; - FARPROC func; - user32 = LoadLibrary("user32.dll"); - if (user32 == NULL) - { - winW32Error(2, "Could not open user32.dll"); - return FALSE; - } - func = GetProcAddress(user32, "EnumDisplayMonitors"); - if (func == NULL) - { - winW32Error(2, "Could not resolve EnumDisplayMonitors: "); - return FALSE; - } - _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func; - - /* prepare data */ - if (data == NULL) - return FALSE; - memset(data, 0, sizeof(*data)); - data->requestedMonitor = index; - - /* query information */ - _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); - - /* cleanup */ - FreeLibrary(user32); - return TRUE; -} - -/* - * Function prototypes - */ - -void -winLogCommandLine (int argc, char *argv[]); - -void -winLogVersionInfo (void); - -#ifdef DDXOSVERRORF -void OsVendorVErrorF (const char *pszFormat, va_list va_args); -#endif - -/* - * Process arguments on the command line - */ - -static int iLastScreen = -1; -static winScreenInfo defaultScreenInfo; - -static void -winInitializeScreenDefaults(void) -{ - DWORD dwWidth, dwHeight; - static Bool fInitializedScreenDefaults = FALSE; - - /* Bail out early if default screen has already been initialized */ - if (fInitializedScreenDefaults) - return; - - /* Zero the memory used for storing the screen info */ - memset(&defaultScreenInfo, 0, sizeof(winScreenInfo)); - - /* Get default width and height */ - /* - * NOTE: These defaults will cause the window to cover only - * the primary monitor in the case that we have multiple monitors. - */ - dwWidth = GetSystemMetrics (SM_CXSCREEN); - dwHeight = GetSystemMetrics (SM_CYSCREEN); - - winErrorFVerb (2, "winInitializeScreenDefaults - w %d h %d\n", - (int) dwWidth, (int) dwHeight); - - /* Set a default DPI, if no parameter was passed */ - if (monitorResolution == 0) - monitorResolution = WIN_DEFAULT_DPI; - - defaultScreenInfo.dwWidth = dwWidth; - defaultScreenInfo.dwHeight = dwHeight; - defaultScreenInfo.dwUserWidth = dwWidth; - defaultScreenInfo.dwUserHeight = dwHeight; - defaultScreenInfo.fUserGaveHeightAndWidth = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH; - defaultScreenInfo.fUserGavePosition = FALSE; - defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP; - defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES; -#ifdef XWIN_EMULATEPSEUDO - defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO; -#endif - defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH; - defaultScreenInfo.pfb = NULL; - defaultScreenInfo.fFullScreen = FALSE; - defaultScreenInfo.fDecoration = TRUE; -#ifdef XWIN_MULTIWINDOWEXTWM - defaultScreenInfo.fMWExtWM = FALSE; - defaultScreenInfo.fInternalWM = FALSE; -#endif - defaultScreenInfo.fRootless = FALSE; -#ifdef XWIN_MULTIWINDOW - defaultScreenInfo.fMultiWindow = FALSE; -#endif -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - defaultScreenInfo.fMultiMonitorOverride = FALSE; -#endif - defaultScreenInfo.fMultipleMonitors = FALSE; - defaultScreenInfo.fLessPointer = FALSE; - defaultScreenInfo.fScrollbars = FALSE; - defaultScreenInfo.fNoTrayIcon = FALSE; - defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF; - defaultScreenInfo.dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) * 25.4; - defaultScreenInfo.dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI) * 25.4; - defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL; - defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; - defaultScreenInfo.fIgnoreInput = FALSE; - defaultScreenInfo.fExplicitScreen = FALSE; - - /* Note that the default screen has been initialized */ - fInitializedScreenDefaults = TRUE; -} - -static void -winInitializeScreen(int i) -{ - winErrorFVerb (2, "winInitializeScreen - %d\n",i); - - /* Initialize default screen values, if needed */ - winInitializeScreenDefaults(); - - /* Copy the default screen info */ - g_ScreenInfo[i] = defaultScreenInfo; - - /* Set the screen number */ - g_ScreenInfo[i].dwScreen = i; -} - -void -winInitializeScreens(int maxscreens) -{ - int i; - winErrorFVerb (2, "winInitializeScreens - %i\n", maxscreens); - - if (maxscreens > g_iNumScreens) - { - /* Reallocate the memory for DDX-specific screen info */ - g_ScreenInfo = realloc(g_ScreenInfo, maxscreens * sizeof (winScreenInfo)); - - /* Set default values for any new screens */ - for (i = g_iNumScreens; i < maxscreens ; i++) - winInitializeScreen(i); - - /* Keep a count of the number of screens */ - g_iNumScreens = maxscreens; - } -} - -/* See Porting Layer Definition - p. 57 */ -/* - * INPUT - * argv: pointer to an array of null-terminated strings, one for - * each token in the X Server command line; the first token - * is 'XWin.exe', or similar. - * argc: a count of the number of tokens stored in argv. - * i: a zero-based index into argv indicating the current token being - * processed. - * - * OUTPUT - * return: return the number of tokens processed correctly. - * - * NOTE - * When looking for n tokens, check that i + n is less than argc. Or, - * you may check if i is greater than or equal to argc, in which case - * you should display the UseMsg () and return 0. - */ - -/* Check if enough arguments are given for the option */ -#define CHECK_ARGS(count) if (i + count >= argc) { UseMsg (); return 0; } - -/* Compare the current option with the string. */ -#define IS_OPTION(name) (strcmp (argv[i], name) == 0) - -int -ddxProcessArgument (int argc, char *argv[], int i) -{ - static Bool s_fBeenHere = FALSE; - winScreenInfo *screenInfoPtr = NULL; - - /* Initialize once */ - if (!s_fBeenHere) - { -#ifdef DDXOSVERRORF - /* - * This initialises our hook into VErrorF () for catching log messages - * that are generated before OsInit () is called. - */ - OsVendorVErrorFProc = OsVendorVErrorF; -#endif - - s_fBeenHere = TRUE; - - /* Initialize only if option is not -help */ - if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") && - !IS_OPTION("-version") && !IS_OPTION("--version")) - { - - /* Log the version information */ - winLogVersionInfo (); - - /* Log the command line */ - winLogCommandLine (argc, argv); - - /* - * Initialize default screen settings. We have to do this before - * OsVendorInit () gets called, otherwise we will overwrite - * settings changed by parameters such as -fullscreen, etc. - */ - winErrorFVerb (2, "ddxProcessArgument - Initializing default " - "screens\n"); - winInitializeScreenDefaults(); - } - } - -#if CYGDEBUG - winDebug ("ddxProcessArgument - arg: %s\n", argv[i]); -#endif - - /* - * Look for the '-help' and similar options - */ - if (IS_OPTION ("-help") || IS_OPTION("-h") || IS_OPTION("--help")) - { - /* Reset logfile. We don't need that helpmessage in the logfile */ - g_pszLogFile = NULL; - g_fNoHelpMessageBox = TRUE; - UseMsg(); - exit (0); - return 1; - } - - if (IS_OPTION ("-version") || IS_OPTION("--version")) - { - /* Reset logfile. We don't need that versioninfo in the logfile */ - g_pszLogFile = NULL; - winLogVersionInfo (); - exit (0); - return 1; - } - - /* - * Look for the '-screen scr_num [width height]' argument - */ - if (IS_OPTION ("-screen")) - { - int iArgsProcessed = 1; - int nScreenNum; - int iWidth, iHeight, iX, iY; - int iMonitor; - -#if CYGDEBUG - winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n", - argc, i); -#endif - - /* Display the usage message if the argument is malformed */ - if (i + 1 >= argc) - { - return 0; - } - - /* Grab screen number */ - nScreenNum = atoi (argv[i + 1]); - - /* Validate the specified screen number */ - if (nScreenNum < 0) - { - ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n", - nScreenNum); - UseMsg (); - return 0; - } - - /* - Initialize default values for any new screens - - Note that default values can't change after a -screen option is - seen, so it's safe to do this for each screen as it is introduced - */ - winInitializeScreens(nScreenNum+1); - - /* look for @m where m is monitor number */ - if (i + 2 < argc - && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) - { - struct GetMonitorInfoData data; - if (!QueryMonitor(iMonitor, &data)) - { - ErrorF ("ddxProcessArgument - screen - " - "Querying monitors is not supported on NT4 and Win95\n"); - } else if (data.bMonitorSpecifiedExists == TRUE) - { - winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); - iArgsProcessed = 3; - g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; - g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; - g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth; - g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight; - g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth; - g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight; - g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; - g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; - } - else - { - /* monitor does not exist, error out */ - ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", - iMonitor); - UseMsg (); - exit (0); - return 0; - } - } - - /* Look for 'WxD' or 'W D' */ - else if (i + 2 < argc - && 2 == sscanf (argv[i + 2], "%dx%d", - (int *) &iWidth, - (int *) &iHeight)) - { - winErrorFVerb (2, "ddxProcessArgument - screen - Found ``WxD'' arg\n"); - iArgsProcessed = 3; - g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; - g_ScreenInfo[nScreenNum].dwWidth = iWidth; - g_ScreenInfo[nScreenNum].dwHeight = iHeight; - g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; - g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; - /* Look for WxD+X+Y */ - if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d", - (int *) &iX, - (int *) &iY)) - { - winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n"); - g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; - g_ScreenInfo[nScreenNum].dwInitialX = iX; - g_ScreenInfo[nScreenNum].dwInitialY = iY; - - /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */ - if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d", - (int *) &iMonitor)) - { - struct GetMonitorInfoData data; - if (!QueryMonitor(iMonitor, &data)) - { - ErrorF ("ddxProcessArgument - screen - " - "Querying monitors is not supported on NT4 and Win95\n"); - } else if (data.bMonitorSpecifiedExists == TRUE) - { - g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX; - g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY; - } - else - { - /* monitor does not exist, error out */ - ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", - iMonitor); - UseMsg (); - exit (0); - return 0; - } - - } - } - - /* look for WxD@m where m is monitor number */ - else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d", - (int *) &iMonitor)) - { - struct GetMonitorInfoData data; - if (!QueryMonitor(iMonitor, &data)) - { - ErrorF ("ddxProcessArgument - screen - " - "Querying monitors is not supported on NT4 and Win95\n"); - } else if (data.bMonitorSpecifiedExists == TRUE) - { - winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); - g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; - g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; - g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; - } - else - { - /* monitor does not exist, error out */ - ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", - iMonitor); - UseMsg (); - exit (0); - return 0; - } - - } - } - else if (i + 3 < argc - && 1 == sscanf (argv[i + 2], "%d", - (int *) &iWidth) - && 1 == sscanf (argv[i + 3], "%d", - (int *) &iHeight)) - { - winErrorFVerb (2, "ddxProcessArgument - screen - Found ``W D'' arg\n"); - iArgsProcessed = 4; - g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; - g_ScreenInfo[nScreenNum].dwWidth = iWidth; - g_ScreenInfo[nScreenNum].dwHeight = iHeight; - g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; - g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; - if (i + 5 < argc - && 1 == sscanf (argv[i + 4], "%d", - (int *) &iX) - && 1 == sscanf (argv[i + 5], "%d", - (int *) &iY)) - { - winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X Y'' arg\n"); - iArgsProcessed = 6; - g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; - g_ScreenInfo[nScreenNum].dwInitialX = iX; - g_ScreenInfo[nScreenNum].dwInitialY = iY; - } - } - else - { - winErrorFVerb (2, "ddxProcessArgument - screen - Did not find size arg. " - "dwWidth: %d dwHeight: %d\n", - (int) g_ScreenInfo[nScreenNum].dwWidth, - (int) g_ScreenInfo[nScreenNum].dwHeight); - iArgsProcessed = 2; - g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; - } - - /* Calculate the screen width and height in millimeters */ - if (g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth) - { - g_ScreenInfo[nScreenNum].dwWidth_mm - = (g_ScreenInfo[nScreenNum].dwWidth - / monitorResolution) * 25.4; - g_ScreenInfo[nScreenNum].dwHeight_mm - = (g_ScreenInfo[nScreenNum].dwHeight - / monitorResolution) * 25.4; - } - - /* Flag that this screen was explicity specified by the user */ - g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE; - - /* - * Keep track of the last screen number seen, as parameters seen - * before a screen number apply to all screens, whereas parameters - * seen after a screen number apply to that screen number only. - */ - iLastScreen = nScreenNum; - - return iArgsProcessed; - } - - - /* - * Is this parameter attached to a screen or global? - * - * If the parameter is for all screens (appears before - * any -screen option), store it in the default screen - * info - * - * If the parameter is for a single screen (appears - * after a -screen option), store it in the screen info - * for that screen - * - */ - if (iLastScreen == -1) - { - screenInfoPtr = &defaultScreenInfo; - } - else - { - screenInfoPtr = &(g_ScreenInfo[iLastScreen]); - } - - /* - * Look for the '-engine n' argument - */ - if (IS_OPTION ("-engine")) - { - DWORD dwEngine = 0; - CARD8 c8OnBits = 0; - - /* Display the usage message if the argument is malformed */ - if (++i >= argc) - { - UseMsg (); - return 0; - } - - /* Grab the argument */ - dwEngine = atoi (argv[i]); - - /* Count the one bits in the engine argument */ - c8OnBits = winCountBits (dwEngine); - - /* Argument should only have a single bit on */ - if (c8OnBits != 1) - { - UseMsg (); - return 0; - } - - screenInfoPtr->dwEnginePreferred = dwEngine; - - /* Indicate that we have processed the argument */ - return 2; - } - - /* - * Look for the '-fullscreen' argument - */ - if (IS_OPTION ("-fullscreen")) - { -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - if (!screenInfoPtr->fMultiMonitorOverride) - screenInfoPtr->fMultipleMonitors = FALSE; -#endif - screenInfoPtr->fFullScreen = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-lesspointer' argument - */ - if (IS_OPTION ("-lesspointer")) - { - screenInfoPtr->fLessPointer = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-nodecoration' argument - */ - if (IS_OPTION ("-nodecoration")) - { -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - if (!screenInfoPtr->fMultiMonitorOverride) - screenInfoPtr->fMultipleMonitors = FALSE; -#endif - screenInfoPtr->fDecoration = FALSE; - - /* Indicate that we have processed this argument */ - return 1; - } - -#ifdef XWIN_MULTIWINDOWEXTWM - /* - * Look for the '-mwextwm' argument - */ - if (IS_OPTION ("-mwextwm")) - { - if (!screenInfoPtr->fMultiMonitorOverride) - screenInfoPtr->fMultipleMonitors = TRUE; - screenInfoPtr->fMWExtWM = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - /* - * Look for the '-internalwm' argument - */ - if (IS_OPTION ("-internalwm")) - { - if (!screenInfoPtr->fMultiMonitorOverride) - screenInfoPtr->fMultipleMonitors = TRUE; - screenInfoPtr->fMWExtWM = TRUE; - screenInfoPtr->fInternalWM = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } -#endif - - /* - * Look for the '-rootless' argument - */ - if (IS_OPTION ("-rootless")) - { -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - if (!screenInfoPtr->fMultiMonitorOverride) - screenInfoPtr->fMultipleMonitors = FALSE; -#endif - screenInfoPtr->fRootless = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - -#ifdef XWIN_MULTIWINDOW - /* - * Look for the '-multiwindow' argument - */ - if (IS_OPTION ("-multiwindow")) - { -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - if (!screenInfoPtr->fMultiMonitorOverride) - screenInfoPtr->fMultipleMonitors = TRUE; -#endif - screenInfoPtr->fMultiWindow = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } -#endif - - /* - * Look for the '-multiplemonitors' argument - */ - if (IS_OPTION ("-multiplemonitors") - || IS_OPTION ("-multimonitors")) - { -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - screenInfoPtr->fMultiMonitorOverride = TRUE; -#endif - screenInfoPtr->fMultipleMonitors = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-nomultiplemonitors' argument - */ - if (IS_OPTION ("-nomultiplemonitors") - || IS_OPTION ("-nomultimonitors")) - { -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - screenInfoPtr->fMultiMonitorOverride = TRUE; -#endif - screenInfoPtr->fMultipleMonitors = FALSE; - - /* Indicate that we have processed this argument */ - return 1; - } - - - /* - * Look for the '-scrollbars' argument - */ - if (IS_OPTION ("-scrollbars")) - { - screenInfoPtr->fScrollbars = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - -#ifdef XWIN_CLIPBOARD - /* - * Look for the '-clipboard' argument - */ - if (IS_OPTION ("-clipboard")) - { - /* Now the default, we still accept the arg for backwards compatibility */ - g_fClipboard = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-noclipboard' argument - */ - if (IS_OPTION ("-noclipboard")) - { - g_fClipboard = FALSE; - - /* Indicate that we have processed this argument */ - return 1; - } -#endif - - - /* - * Look for the '-ignoreinput' argument - */ - if (IS_OPTION ("-ignoreinput")) - { - screenInfoPtr->fIgnoreInput = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-emulate3buttons' argument - */ - if (IS_OPTION ("-emulate3buttons")) - { - int iArgsProcessed = 1; - int iE3BTimeout = WIN_DEFAULT_E3B_TIME; - - /* Grab the optional timeout value */ - if (i + 1 < argc - && 1 == sscanf (argv[i + 1], "%d", - &iE3BTimeout)) - { - /* Indicate that we have processed the next argument */ - iArgsProcessed++; - } - else - { - /* - * sscanf () won't modify iE3BTimeout if it doesn't find - * the specified format; however, I want to be explicit - * about setting the default timeout in such cases to - * prevent some programs (me) from getting confused. - */ - iE3BTimeout = WIN_DEFAULT_E3B_TIME; - } - - screenInfoPtr->iE3BTimeout = iE3BTimeout; - - /* Indicate that we have processed this argument */ - return iArgsProcessed; - } - - /* - * Look for the '-depth n' argument - */ - if (IS_OPTION ("-depth")) - { - DWORD dwBPP = 0; - - /* Display the usage message if the argument is malformed */ - if (++i >= argc) - { - UseMsg (); - return 0; - } - - /* Grab the argument */ - dwBPP = atoi (argv[i]); - - screenInfoPtr->dwBPP = dwBPP; - - /* Indicate that we have processed the argument */ - return 2; - } - - /* - * Look for the '-refresh n' argument - */ - if (IS_OPTION ("-refresh")) - { - DWORD dwRefreshRate = 0; - - /* Display the usage message if the argument is malformed */ - if (++i >= argc) - { - UseMsg (); - return 0; - } - - /* Grab the argument */ - dwRefreshRate = atoi (argv[i]); - - screenInfoPtr->dwRefreshRate = dwRefreshRate; - - /* Indicate that we have processed the argument */ - return 2; - } - - /* - * Look for the '-clipupdates num_boxes' argument - */ - if (IS_OPTION ("-clipupdates")) - { - DWORD dwNumBoxes = 0; - - /* Display the usage message if the argument is malformed */ - if (++i >= argc) - { - UseMsg (); - return 0; - } - - /* Grab the argument */ - dwNumBoxes = atoi (argv[i]); - - screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes; - - /* Indicate that we have processed the argument */ - return 2; - } - -#ifdef XWIN_EMULATEPSEUDO - /* - * Look for the '-emulatepseudo' argument - */ - if (IS_OPTION ("-emulatepseudo")) - { - screenInfoPtr->fEmulatePseudo = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } -#endif - - /* - * Look for the '-nowinkill' argument - */ - if (IS_OPTION ("-nowinkill")) - { - screenInfoPtr->fUseWinKillKey = FALSE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-winkill' argument - */ - if (IS_OPTION ("-winkill")) - { - screenInfoPtr->fUseWinKillKey = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-nounixkill' argument - */ - if (IS_OPTION ("-nounixkill")) - { - screenInfoPtr->fUseUnixKillKey = FALSE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-unixkill' argument - */ - if (IS_OPTION ("-unixkill")) - { - screenInfoPtr->fUseUnixKillKey = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-notrayicon' argument - */ - if (IS_OPTION ("-notrayicon")) - { - screenInfoPtr->fNoTrayIcon = TRUE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-trayicon' argument - */ - if (IS_OPTION ("-trayicon")) - { - screenInfoPtr->fNoTrayIcon = FALSE; - - /* Indicate that we have processed this argument */ - return 1; - } - - /* - * Look for the '-fp' argument - */ - if (IS_OPTION ("-fp")) - { - CHECK_ARGS (1); - g_cmdline.fontPath = argv[++i]; - return 0; /* Let DIX parse this again */ - } - - /* - * Look for the '-query' argument - */ - if (IS_OPTION ("-query")) - { - CHECK_ARGS (1); - g_fXdmcpEnabled = TRUE; - g_pszQueryHost = argv[++i]; - return 0; /* Let DIX parse this again */ - } - - /* - * Look for the '-auth' argument - */ - if (IS_OPTION ("-auth")) - { - g_fAuthEnabled = TRUE; - return 0; /* Let DIX parse this again */ - } - - /* - * Look for the '-indirect' or '-broadcast' arguments - */ - if (IS_OPTION ("-indirect") - || IS_OPTION ("-broadcast")) - { - g_fXdmcpEnabled = TRUE; - return 0; /* Let DIX parse this again */ - } - - /* - * Look for the '-config' argument - */ - if (IS_OPTION ("-config") - || IS_OPTION ("-xf86config")) - { - CHECK_ARGS (1); -#ifdef XWIN_XF86CONFIG - g_cmdline.configFile = argv[++i]; -#else - winMessageBoxF ("The %s option is not supported in this " - "release.\n" - "Ignoring this option and continuing.\n", - MB_ICONINFORMATION, - argv[i]); -#endif - return 2; - } - - /* - * Look for the '-configdir' argument - */ - if (IS_OPTION ("-configdir")) - { - CHECK_ARGS (1); -#ifdef XWIN_XF86CONFIG - g_cmdline.configDir = argv[++i]; -#else - winMessageBoxF ("The %s option is not supported in this " - "release.\n" - "Ignoring this option and continuing.\n", - MB_ICONINFORMATION, - argv[i]); -#endif - return 2; - } - - /* - * Look for the '-keyboard' argument - */ - if (IS_OPTION ("-keyboard")) - { -#ifdef XWIN_XF86CONFIG - CHECK_ARGS (1); - g_cmdline.keyboard = argv[++i]; -#else - winMessageBoxF ("The -keyboard option is not supported in this " - "release.\n" - "Ignoring this option and continuing.\n", - MB_ICONINFORMATION); -#endif - return 2; - } - - /* - * Look for the '-logfile' argument - */ - if (IS_OPTION ("-logfile")) - { - CHECK_ARGS (1); - g_pszLogFile = argv[++i]; -#ifdef RELOCATE_PROJECTROOT - g_fLogFileChanged = TRUE; -#endif - return 2; - } - - /* - * Look for the '-logverbose' argument - */ - if (IS_OPTION ("-logverbose")) - { - CHECK_ARGS (1); - g_iLogVerbose = atoi(argv[++i]); - return 2; - } - -#ifdef XWIN_CLIPBOARD - /* - * Look for the '-nounicodeclipboard' argument - */ - if (IS_OPTION ("-nounicodeclipboard")) - { - g_fUnicodeClipboard = FALSE; - /* Indicate that we have processed the argument */ - return 1; - } -#endif - - if (IS_OPTION ("-xkbrules")) - { - CHECK_ARGS (1); - g_cmdline.xkbRules = argv[++i]; - return 2; - } - if (IS_OPTION ("-xkbmodel")) - { - CHECK_ARGS (1); - g_cmdline.xkbModel = argv[++i]; - return 2; - } - if (IS_OPTION ("-xkblayout")) - { - CHECK_ARGS (1); - g_cmdline.xkbLayout = argv[++i]; - return 2; - } - if (IS_OPTION ("-xkbvariant")) - { - CHECK_ARGS (1); - g_cmdline.xkbVariant = argv[++i]; - return 2; - } - if (IS_OPTION ("-xkboptions")) - { - CHECK_ARGS (1); - g_cmdline.xkbOptions = argv[++i]; - return 2; - } - - if (IS_OPTION ("-keyhook")) - { - g_fKeyboardHookLL = TRUE; - return 1; - } - - if (IS_OPTION ("-nokeyhook")) - { - g_fKeyboardHookLL = FALSE; - return 1; - } - - if (IS_OPTION ("-swcursor")) - { - g_fSoftwareCursor = TRUE; - return 1; - } - - if (IS_OPTION ("-silent-dup-error")) - { - g_fSilentDupError = TRUE; - return 1; - } - - if (IS_OPTION("-wgl")) - { - g_fNativeGl = TRUE; - return 1; - } - - if (IS_OPTION("-nowgl")) - { - g_fNativeGl = FALSE; - return 1; - } - - return 0; -} - - -/* - * winLogCommandLine - Write entire command line to the log file - */ - -void -winLogCommandLine (int argc, char *argv[]) -{ - int i; - int iSize = 0; - int iCurrLen = 0; - -#define CHARS_PER_LINE 60 - - /* Bail if command line has already been logged */ - if (g_pszCommandLine) - return; - - /* Count how much memory is needed for concatenated command line */ - for (i = 0, iCurrLen = 0; i < argc; ++i) - if (argv[i]) - { - /* Adds two characters for lines that overflow */ - if ((strlen (argv[i]) < CHARS_PER_LINE - && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE) - || strlen (argv[i]) > CHARS_PER_LINE) - { - iCurrLen = 0; - iSize += 2; - } - - /* Add space for item and trailing space */ - iSize += strlen (argv[i]) + 1; - - /* Update current line length */ - iCurrLen += strlen (argv[i]); - } - - /* Allocate memory for concatenated command line */ - g_pszCommandLine = malloc (iSize + 1); - if (!g_pszCommandLine) - FatalError ("winLogCommandLine - Could not allocate memory for " - "command line string. Exiting.\n"); - - /* Set first character to concatenated command line to null */ - g_pszCommandLine[0] = '\0'; - - /* Loop through all args */ - for (i = 0, iCurrLen = 0; i < argc; ++i) - { - /* Add a character for lines that overflow */ - if ((strlen (argv[i]) < CHARS_PER_LINE - && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE) - || strlen (argv[i]) > CHARS_PER_LINE) - { - iCurrLen = 0; - - /* Add line break if it fits */ - strncat (g_pszCommandLine, "\n ", iSize - strlen (g_pszCommandLine)); - } - - strncat (g_pszCommandLine, argv[i], iSize - strlen (g_pszCommandLine)); - strncat (g_pszCommandLine, " ", iSize - strlen (g_pszCommandLine)); - - /* Save new line length */ - iCurrLen += strlen (argv[i]); - } - - ErrorF ("XWin was started with the following command line:\n\n" - "%s\n\n", g_pszCommandLine); -} - - -/* - * winLogVersionInfo - Log Cygwin/X version information - */ - -void -winLogVersionInfo (void) -{ - static Bool s_fBeenHere = FALSE; - - if (s_fBeenHere) - return; - s_fBeenHere = TRUE; - - ErrorF ("Welcome to the XWin X Server\n"); - ErrorF ("Vendor: %s\n", XVENDORNAME); - ErrorF ("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT); - ErrorF ("%s\n\n", BUILDERSTRING); - ErrorF ("Contact: %s\n", BUILDERADDR); -} - -/* - * getMonitorInfo - callback function used to return information from the enumeration of monitors attached - */ - -wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) -{ - struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data; - // only get data for monitor number specified in - data->monitorNum++; - if (data->monitorNum == data->requestedMonitor) - { - data->bMonitorSpecifiedExists = TRUE; - data->monitorOffsetX = rect->left; - data->monitorOffsetY = rect->top; - data->monitorHeight = rect->bottom - rect->top; - data->monitorWidth = rect->right - rect->left; - return FALSE; - } - return TRUE; -} +/* + +Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif + +#include <../xfree86/common/xorgVersion.h> +#include "win.h" +#include "winconfig.h" +#include "winmsg.h" +#include "winmonitors.h" + +/* + * References to external symbols + */ + +#ifdef XWIN_CLIPBOARD +extern Bool g_fUnicodeClipboard; +extern Bool g_fClipboard; +#endif + +/* + * Function prototypes + */ + +void +winLogCommandLine (int argc, char *argv[]); + +void +winLogVersionInfo (void); + +#ifdef DDXOSVERRORF +void OsVendorVErrorF (const char *pszFormat, va_list va_args); +#endif + +/* + * Process arguments on the command line + */ + +static int iLastScreen = -1; +static winScreenInfo defaultScreenInfo; + +static void +winInitializeScreenDefaults(void) +{ + DWORD dwWidth, dwHeight; + static Bool fInitializedScreenDefaults = FALSE; + + /* Bail out early if default screen has already been initialized */ + if (fInitializedScreenDefaults) + return; + + /* Zero the memory used for storing the screen info */ + memset(&defaultScreenInfo, 0, sizeof(winScreenInfo)); + + /* Get default width and height */ + /* + * NOTE: These defaults will cause the window to cover only + * the primary monitor in the case that we have multiple monitors. + */ + dwWidth = GetSystemMetrics (SM_CXSCREEN); + dwHeight = GetSystemMetrics (SM_CYSCREEN); + + winErrorFVerb (2, "winInitializeScreenDefaults - w %d h %d\n", + (int) dwWidth, (int) dwHeight); + + /* Set a default DPI, if no parameter was passed */ + if (monitorResolution == 0) + monitorResolution = WIN_DEFAULT_DPI; + + defaultScreenInfo.iMonitor = 1; + defaultScreenInfo.dwWidth = dwWidth; + defaultScreenInfo.dwHeight = dwHeight; + defaultScreenInfo.dwUserWidth = dwWidth; + defaultScreenInfo.dwUserHeight = dwHeight; + defaultScreenInfo.fUserGaveHeightAndWidth = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH; + defaultScreenInfo.fUserGavePosition = FALSE; + defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP; + defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES; +#ifdef XWIN_EMULATEPSEUDO + defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO; +#endif + defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH; + defaultScreenInfo.pfb = NULL; + defaultScreenInfo.fFullScreen = FALSE; + defaultScreenInfo.fDecoration = TRUE; +#ifdef XWIN_MULTIWINDOWEXTWM + defaultScreenInfo.fMWExtWM = FALSE; + defaultScreenInfo.fInternalWM = FALSE; +#endif + defaultScreenInfo.fRootless = FALSE; +#ifdef XWIN_MULTIWINDOW + defaultScreenInfo.fMultiWindow = FALSE; +#endif +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + defaultScreenInfo.fMultiMonitorOverride = FALSE; +#endif + defaultScreenInfo.fMultipleMonitors = FALSE; + defaultScreenInfo.fLessPointer = FALSE; + defaultScreenInfo.iResizeMode = notAllowed; + defaultScreenInfo.fNoTrayIcon = FALSE; + defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF; + defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL; + defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; + defaultScreenInfo.fIgnoreInput = FALSE; + defaultScreenInfo.fExplicitScreen = FALSE; + + /* Note that the default screen has been initialized */ + fInitializedScreenDefaults = TRUE; +} + +static void +winInitializeScreen(int i) +{ + winErrorFVerb (2, "winInitializeScreen - %d\n",i); + + /* Initialize default screen values, if needed */ + winInitializeScreenDefaults(); + + /* Copy the default screen info */ + g_ScreenInfo[i] = defaultScreenInfo; + + /* Set the screen number */ + g_ScreenInfo[i].dwScreen = i; +} + +void +winInitializeScreens(int maxscreens) +{ + int i; + winErrorFVerb (2, "winInitializeScreens - %i\n", maxscreens); + + if (maxscreens > g_iNumScreens) + { + /* Reallocate the memory for DDX-specific screen info */ + g_ScreenInfo = realloc(g_ScreenInfo, maxscreens * sizeof (winScreenInfo)); + + /* Set default values for any new screens */ + for (i = g_iNumScreens; i < maxscreens ; i++) + winInitializeScreen(i); + + /* Keep a count of the number of screens */ + g_iNumScreens = maxscreens; + } +} + +/* See Porting Layer Definition - p. 57 */ +/* + * INPUT + * argv: pointer to an array of null-terminated strings, one for + * each token in the X Server command line; the first token + * is 'XWin.exe', or similar. + * argc: a count of the number of tokens stored in argv. + * i: a zero-based index into argv indicating the current token being + * processed. + * + * OUTPUT + * return: return the number of tokens processed correctly. + * + * NOTE + * When looking for n tokens, check that i + n is less than argc. Or, + * you may check if i is greater than or equal to argc, in which case + * you should display the UseMsg () and return 0. + */ + +/* Check if enough arguments are given for the option */ +#define CHECK_ARGS(count) if (i + count >= argc) { UseMsg (); return 0; } + +/* Compare the current option with the string. */ +#define IS_OPTION(name) (strcmp (argv[i], name) == 0) + +int +ddxProcessArgument (int argc, char *argv[], int i) +{ + static Bool s_fBeenHere = FALSE; + winScreenInfo *screenInfoPtr = NULL; + + /* Initialize once */ + if (!s_fBeenHere) + { +#ifdef DDXOSVERRORF + /* + * This initialises our hook into VErrorF () for catching log messages + * that are generated before OsInit () is called. + */ + OsVendorVErrorFProc = OsVendorVErrorF; +#endif + + s_fBeenHere = TRUE; + + /* Initialize only if option is not -help */ + if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") && + !IS_OPTION("-version") && !IS_OPTION("--version")) + { + + /* Log the version information */ + winLogVersionInfo (); + + /* Log the command line */ + winLogCommandLine (argc, argv); + + /* + * Initialize default screen settings. We have to do this before + * OsVendorInit () gets called, otherwise we will overwrite + * settings changed by parameters such as -fullscreen, etc. + */ + winErrorFVerb (2, "ddxProcessArgument - Initializing default " + "screens\n"); + winInitializeScreenDefaults(); + } + } + +#if CYGDEBUG + winDebug ("ddxProcessArgument - arg: %s\n", argv[i]); +#endif + + /* + * Look for the '-help' and similar options + */ + if (IS_OPTION ("-help") || IS_OPTION("-h") || IS_OPTION("--help")) + { + /* Reset logfile. We don't need that helpmessage in the logfile */ + g_pszLogFile = NULL; + g_fNoHelpMessageBox = TRUE; + UseMsg(); + exit (0); + return 1; + } + + if (IS_OPTION ("-version") || IS_OPTION("--version")) + { + /* Reset logfile. We don't need that versioninfo in the logfile */ + g_pszLogFile = NULL; + winLogVersionInfo (); + exit (0); + return 1; + } + + /* + * Look for the '-screen scr_num [width height]' argument + */ + if (IS_OPTION ("-screen")) + { + int iArgsProcessed = 1; + int nScreenNum; + int iWidth, iHeight, iX, iY; + int iMonitor; + +#if CYGDEBUG + winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n", + argc, i); +#endif + + /* Display the usage message if the argument is malformed */ + if (i + 1 >= argc) + { + return 0; + } + + /* Grab screen number */ + nScreenNum = atoi (argv[i + 1]); + + /* Validate the specified screen number */ + if (nScreenNum < 0) + { + ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n", + nScreenNum); + UseMsg (); + return 0; + } + + /* + Initialize default values for any new screens + + Note that default values can't change after a -screen option is + seen, so it's safe to do this for each screen as it is introduced + */ + winInitializeScreens(nScreenNum+1); + + /* look for @m where m is monitor number */ + if (i + 2 < argc + && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) + { + struct GetMonitorInfoData data; + if (!QueryMonitor(iMonitor, &data)) + { + ErrorF ("ddxProcessArgument - screen - " + "Querying monitors is not supported on NT4 and Win95\n"); + } else if (data.bMonitorSpecifiedExists == TRUE) + { + winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); + iArgsProcessed = 3; + g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; + g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].iMonitor = iMonitor; + g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth; + g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight; + g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth; + g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight; + g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; + g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; + } + else + { + /* monitor does not exist, error out */ + ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", + iMonitor); + UseMsg (); + exit (0); + return 0; + } + } + + /* Look for 'WxD' or 'W D' */ + else if (i + 2 < argc + && 2 == sscanf (argv[i + 2], "%dx%d", + (int *) &iWidth, + (int *) &iHeight)) + { + winErrorFVerb (2, "ddxProcessArgument - screen - Found ``WxD'' arg\n"); + iArgsProcessed = 3; + g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; + g_ScreenInfo[nScreenNum].dwWidth = iWidth; + g_ScreenInfo[nScreenNum].dwHeight = iHeight; + g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; + g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; + /* Look for WxD+X+Y */ + if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d", + (int *) &iX, + (int *) &iY)) + { + winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n"); + g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].dwInitialX = iX; + g_ScreenInfo[nScreenNum].dwInitialY = iY; + + /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */ + if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d", + (int *) &iMonitor)) + { + struct GetMonitorInfoData data; + if (!QueryMonitor(iMonitor, &data)) + { + ErrorF ("ddxProcessArgument - screen - " + "Querying monitors is not supported on NT4 and Win95\n"); + } else if (data.bMonitorSpecifiedExists == TRUE) + { + g_ScreenInfo[nScreenNum].iMonitor = iMonitor; + g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX; + g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY; + } + else + { + /* monitor does not exist, error out */ + ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", + iMonitor); + UseMsg (); + exit (0); + return 0; + } + + } + } + + /* look for WxD@m where m is monitor number */ + else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d", + (int *) &iMonitor)) + { + struct GetMonitorInfoData data; + if (!QueryMonitor(iMonitor, &data)) + { + ErrorF ("ddxProcessArgument - screen - " + "Querying monitors is not supported on NT4 and Win95\n"); + } else if (data.bMonitorSpecifiedExists == TRUE) + { + winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); + g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].iMonitor = iMonitor; + g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; + g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; + } + else + { + /* monitor does not exist, error out */ + ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", + iMonitor); + UseMsg (); + exit (0); + return 0; + } + + } + } + else if (i + 3 < argc + && 1 == sscanf (argv[i + 2], "%d", + (int *) &iWidth) + && 1 == sscanf (argv[i + 3], "%d", + (int *) &iHeight)) + { + winErrorFVerb (2, "ddxProcessArgument - screen - Found ``W D'' arg\n"); + iArgsProcessed = 4; + g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE; + g_ScreenInfo[nScreenNum].dwWidth = iWidth; + g_ScreenInfo[nScreenNum].dwHeight = iHeight; + g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; + g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; + if (i + 5 < argc + && 1 == sscanf (argv[i + 4], "%d", + (int *) &iX) + && 1 == sscanf (argv[i + 5], "%d", + (int *) &iY)) + { + winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X Y'' arg\n"); + iArgsProcessed = 6; + g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].dwInitialX = iX; + g_ScreenInfo[nScreenNum].dwInitialY = iY; + } + } + else + { + winErrorFVerb (2, "ddxProcessArgument - screen - Did not find size arg. " + "dwWidth: %d dwHeight: %d\n", + (int) g_ScreenInfo[nScreenNum].dwWidth, + (int) g_ScreenInfo[nScreenNum].dwHeight); + iArgsProcessed = 2; + g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; + } + + /* Flag that this screen was explicity specified by the user */ + g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE; + + /* + * Keep track of the last screen number seen, as parameters seen + * before a screen number apply to all screens, whereas parameters + * seen after a screen number apply to that screen number only. + */ + iLastScreen = nScreenNum; + + return iArgsProcessed; + } + + + /* + * Is this parameter attached to a screen or global? + * + * If the parameter is for all screens (appears before + * any -screen option), store it in the default screen + * info + * + * If the parameter is for a single screen (appears + * after a -screen option), store it in the screen info + * for that screen + * + */ + if (iLastScreen == -1) + { + screenInfoPtr = &defaultScreenInfo; + } + else + { + screenInfoPtr = &(g_ScreenInfo[iLastScreen]); + } + + /* + * Look for the '-engine n' argument + */ + if (IS_OPTION ("-engine")) + { + DWORD dwEngine = 0; + CARD8 c8OnBits = 0; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } + + /* Grab the argument */ + dwEngine = atoi (argv[i]); + + /* Count the one bits in the engine argument */ + c8OnBits = winCountBits (dwEngine); + + /* Argument should only have a single bit on */ + if (c8OnBits != 1) + { + UseMsg (); + return 0; + } + + screenInfoPtr->dwEnginePreferred = dwEngine; + + /* Indicate that we have processed the argument */ + return 2; + } + + /* + * Look for the '-fullscreen' argument + */ + if (IS_OPTION ("-fullscreen")) + { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + if (!screenInfoPtr->fMultiMonitorOverride) + screenInfoPtr->fMultipleMonitors = FALSE; +#endif + screenInfoPtr->fFullScreen = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-lesspointer' argument + */ + if (IS_OPTION ("-lesspointer")) + { + screenInfoPtr->fLessPointer = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-nodecoration' argument + */ + if (IS_OPTION ("-nodecoration")) + { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + if (!screenInfoPtr->fMultiMonitorOverride) + screenInfoPtr->fMultipleMonitors = FALSE; +#endif + screenInfoPtr->fDecoration = FALSE; + + /* Indicate that we have processed this argument */ + return 1; + } + +#ifdef XWIN_MULTIWINDOWEXTWM + /* + * Look for the '-mwextwm' argument + */ + if (IS_OPTION ("-mwextwm")) + { + if (!screenInfoPtr->fMultiMonitorOverride) + screenInfoPtr->fMultipleMonitors = TRUE; + screenInfoPtr->fMWExtWM = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + /* + * Look for the '-internalwm' argument + */ + if (IS_OPTION ("-internalwm")) + { + if (!screenInfoPtr->fMultiMonitorOverride) + screenInfoPtr->fMultipleMonitors = TRUE; + screenInfoPtr->fMWExtWM = TRUE; + screenInfoPtr->fInternalWM = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } +#endif + + /* + * Look for the '-rootless' argument + */ + if (IS_OPTION ("-rootless")) + { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + if (!screenInfoPtr->fMultiMonitorOverride) + screenInfoPtr->fMultipleMonitors = FALSE; +#endif + screenInfoPtr->fRootless = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + +#ifdef XWIN_MULTIWINDOW + /* + * Look for the '-multiwindow' argument + */ + if (IS_OPTION ("-multiwindow")) + { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + if (!screenInfoPtr->fMultiMonitorOverride) + screenInfoPtr->fMultipleMonitors = TRUE; +#endif + screenInfoPtr->fMultiWindow = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } +#endif + + /* + * Look for the '-multiplemonitors' argument + */ + if (IS_OPTION ("-multiplemonitors") + || IS_OPTION ("-multimonitors")) + { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + screenInfoPtr->fMultiMonitorOverride = TRUE; +#endif + screenInfoPtr->fMultipleMonitors = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-nomultiplemonitors' argument + */ + if (IS_OPTION ("-nomultiplemonitors") + || IS_OPTION ("-nomultimonitors")) + { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + screenInfoPtr->fMultiMonitorOverride = TRUE; +#endif + screenInfoPtr->fMultipleMonitors = FALSE; + + /* Indicate that we have processed this argument */ + return 1; + } + + + /* + * Look for the '-scrollbars' argument + */ + if (IS_OPTION ("-scrollbars")) + { + + screenInfoPtr->iResizeMode = resizeWithScrollbars; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-resize' argument + */ + if (IS_OPTION ("-resize") || IS_OPTION ("-noresize") || + (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0)) + { + winResizeMode mode; + + if (IS_OPTION ("-resize")) + mode = resizeWithRandr; + else if (IS_OPTION ("-noresize")) + mode = notAllowed; + else if (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0) + { + char *option = argv[i] + strlen("-resize="); + if (strcmp(option, "randr") == 0) + mode = resizeWithRandr; + else if (strcmp(option, "scrollbars") == 0) + mode = resizeWithScrollbars; + else if (strcmp(option, "none") == 0) + mode = notAllowed; + else + { + ErrorF ("ddxProcessArgument - resize - Invalid resize mode %s\n", option); + return 0; + } + } + else + { + ErrorF ("ddxProcessArgument - resize - Invalid resize option %s\n", argv[i]); + return 0; + } + + screenInfoPtr->iResizeMode = mode; + + /* Indicate that we have processed this argument */ + return 1; + } + +#ifdef XWIN_CLIPBOARD + /* + * Look for the '-clipboard' argument + */ + if (IS_OPTION ("-clipboard")) + { + /* Now the default, we still accept the arg for backwards compatibility */ + g_fClipboard = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-noclipboard' argument + */ + if (IS_OPTION ("-noclipboard")) + { + g_fClipboard = FALSE; + + /* Indicate that we have processed this argument */ + return 1; + } +#endif + + + /* + * Look for the '-ignoreinput' argument + */ + if (IS_OPTION ("-ignoreinput")) + { + screenInfoPtr->fIgnoreInput = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-emulate3buttons' argument + */ + if (IS_OPTION ("-emulate3buttons")) + { + int iArgsProcessed = 1; + int iE3BTimeout = WIN_DEFAULT_E3B_TIME; + + /* Grab the optional timeout value */ + if (i + 1 < argc + && 1 == sscanf (argv[i + 1], "%d", + &iE3BTimeout)) + { + /* Indicate that we have processed the next argument */ + iArgsProcessed++; + } + else + { + /* + * sscanf () won't modify iE3BTimeout if it doesn't find + * the specified format; however, I want to be explicit + * about setting the default timeout in such cases to + * prevent some programs (me) from getting confused. + */ + iE3BTimeout = WIN_DEFAULT_E3B_TIME; + } + + screenInfoPtr->iE3BTimeout = iE3BTimeout; + + /* Indicate that we have processed this argument */ + return iArgsProcessed; + } + + /* + * Look for the '-depth n' argument + */ + if (IS_OPTION ("-depth")) + { + DWORD dwBPP = 0; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } + + /* Grab the argument */ + dwBPP = atoi (argv[i]); + + screenInfoPtr->dwBPP = dwBPP; + + /* Indicate that we have processed the argument */ + return 2; + } + + /* + * Look for the '-refresh n' argument + */ + if (IS_OPTION ("-refresh")) + { + DWORD dwRefreshRate = 0; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } + + /* Grab the argument */ + dwRefreshRate = atoi (argv[i]); + + screenInfoPtr->dwRefreshRate = dwRefreshRate; + + /* Indicate that we have processed the argument */ + return 2; + } + + /* + * Look for the '-clipupdates num_boxes' argument + */ + if (IS_OPTION ("-clipupdates")) + { + DWORD dwNumBoxes = 0; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } + + /* Grab the argument */ + dwNumBoxes = atoi (argv[i]); + + screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes; + + /* Indicate that we have processed the argument */ + return 2; + } + +#ifdef XWIN_EMULATEPSEUDO + /* + * Look for the '-emulatepseudo' argument + */ + if (IS_OPTION ("-emulatepseudo")) + { + screenInfoPtr->fEmulatePseudo = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } +#endif + + /* + * Look for the '-nowinkill' argument + */ + if (IS_OPTION ("-nowinkill")) + { + screenInfoPtr->fUseWinKillKey = FALSE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-winkill' argument + */ + if (IS_OPTION ("-winkill")) + { + screenInfoPtr->fUseWinKillKey = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-nounixkill' argument + */ + if (IS_OPTION ("-nounixkill")) + { + screenInfoPtr->fUseUnixKillKey = FALSE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-unixkill' argument + */ + if (IS_OPTION ("-unixkill")) + { + screenInfoPtr->fUseUnixKillKey = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-notrayicon' argument + */ + if (IS_OPTION ("-notrayicon")) + { + screenInfoPtr->fNoTrayIcon = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-trayicon' argument + */ + if (IS_OPTION ("-trayicon")) + { + screenInfoPtr->fNoTrayIcon = FALSE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-fp' argument + */ + if (IS_OPTION ("-fp")) + { + CHECK_ARGS (1); + g_cmdline.fontPath = argv[++i]; + return 0; /* Let DIX parse this again */ + } + + /* + * Look for the '-query' argument + */ + if (IS_OPTION ("-query")) + { + CHECK_ARGS (1); + g_fXdmcpEnabled = TRUE; + g_pszQueryHost = argv[++i]; + return 0; /* Let DIX parse this again */ + } + + /* + * Look for the '-auth' argument + */ + if (IS_OPTION ("-auth")) + { + g_fAuthEnabled = TRUE; + return 0; /* Let DIX parse this again */ + } + + /* + * Look for the '-indirect' or '-broadcast' arguments + */ + if (IS_OPTION ("-indirect") + || IS_OPTION ("-broadcast")) + { + g_fXdmcpEnabled = TRUE; + return 0; /* Let DIX parse this again */ + } + + /* + * Look for the '-config' argument + */ + if (IS_OPTION ("-config") + || IS_OPTION ("-xf86config")) + { + CHECK_ARGS (1); +#ifdef XWIN_XF86CONFIG + g_cmdline.configFile = argv[++i]; +#else + winMessageBoxF ("The %s option is not supported in this " + "release.\n" + "Ignoring this option and continuing.\n", + MB_ICONINFORMATION, + argv[i]); +#endif + return 2; + } + + /* + * Look for the '-configdir' argument + */ + if (IS_OPTION ("-configdir")) + { + CHECK_ARGS (1); +#ifdef XWIN_XF86CONFIG + g_cmdline.configDir = argv[++i]; +#else + winMessageBoxF ("The %s option is not supported in this " + "release.\n" + "Ignoring this option and continuing.\n", + MB_ICONINFORMATION, + argv[i]); +#endif + return 2; + } + + /* + * Look for the '-keyboard' argument + */ + if (IS_OPTION ("-keyboard")) + { +#ifdef XWIN_XF86CONFIG + CHECK_ARGS (1); + g_cmdline.keyboard = argv[++i]; +#else + winMessageBoxF ("The -keyboard option is not supported in this " + "release.\n" + "Ignoring this option and continuing.\n", + MB_ICONINFORMATION); +#endif + return 2; + } + + /* + * Look for the '-logfile' argument + */ + if (IS_OPTION ("-logfile")) + { + CHECK_ARGS (1); + g_pszLogFile = argv[++i]; +#ifdef RELOCATE_PROJECTROOT + g_fLogFileChanged = TRUE; +#endif + return 2; + } + + /* + * Look for the '-logverbose' argument + */ + if (IS_OPTION ("-logverbose")) + { + CHECK_ARGS (1); + g_iLogVerbose = atoi(argv[++i]); + return 2; + } + +#ifdef XWIN_CLIPBOARD + /* + * Look for the '-nounicodeclipboard' argument + */ + if (IS_OPTION ("-nounicodeclipboard")) + { + g_fUnicodeClipboard = FALSE; + /* Indicate that we have processed the argument */ + return 1; + } +#endif + + if (IS_OPTION ("-xkbrules")) + { + CHECK_ARGS (1); + g_cmdline.xkbRules = argv[++i]; + return 2; + } + if (IS_OPTION ("-xkbmodel")) + { + CHECK_ARGS (1); + g_cmdline.xkbModel = argv[++i]; + return 2; + } + if (IS_OPTION ("-xkblayout")) + { + CHECK_ARGS (1); + g_cmdline.xkbLayout = argv[++i]; + return 2; + } + if (IS_OPTION ("-xkbvariant")) + { + CHECK_ARGS (1); + g_cmdline.xkbVariant = argv[++i]; + return 2; + } + if (IS_OPTION ("-xkboptions")) + { + CHECK_ARGS (1); + g_cmdline.xkbOptions = argv[++i]; + return 2; + } + + if (IS_OPTION ("-keyhook")) + { + g_fKeyboardHookLL = TRUE; + return 1; + } + + if (IS_OPTION ("-nokeyhook")) + { + g_fKeyboardHookLL = FALSE; + return 1; + } + + if (IS_OPTION ("-swcursor")) + { + g_fSoftwareCursor = TRUE; + return 1; + } + + if (IS_OPTION ("-silent-dup-error")) + { + g_fSilentDupError = TRUE; + return 1; + } + + if (IS_OPTION("-wgl")) + { + g_fNativeGl = TRUE; + return 1; + } + + if (IS_OPTION("-nowgl")) + { + g_fNativeGl = FALSE; + return 1; + } + + return 0; +} + + +/* + * winLogCommandLine - Write entire command line to the log file + */ + +void +winLogCommandLine (int argc, char *argv[]) +{ + int i; + int iSize = 0; + int iCurrLen = 0; + +#define CHARS_PER_LINE 60 + + /* Bail if command line has already been logged */ + if (g_pszCommandLine) + return; + + /* Count how much memory is needed for concatenated command line */ + for (i = 0, iCurrLen = 0; i < argc; ++i) + if (argv[i]) + { + /* Adds two characters for lines that overflow */ + if ((strlen (argv[i]) < CHARS_PER_LINE + && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE) + || strlen (argv[i]) > CHARS_PER_LINE) + { + iCurrLen = 0; + iSize += 2; + } + + /* Add space for item and trailing space */ + iSize += strlen (argv[i]) + 1; + + /* Update current line length */ + iCurrLen += strlen (argv[i]); + } + + /* Allocate memory for concatenated command line */ + g_pszCommandLine = malloc (iSize + 1); + if (!g_pszCommandLine) + FatalError ("winLogCommandLine - Could not allocate memory for " + "command line string. Exiting.\n"); + + /* Set first character to concatenated command line to null */ + g_pszCommandLine[0] = '\0'; + + /* Loop through all args */ + for (i = 0, iCurrLen = 0; i < argc; ++i) + { + /* Add a character for lines that overflow */ + if ((strlen (argv[i]) < CHARS_PER_LINE + && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE) + || strlen (argv[i]) > CHARS_PER_LINE) + { + iCurrLen = 0; + + /* Add line break if it fits */ + strncat (g_pszCommandLine, "\n ", iSize - strlen (g_pszCommandLine)); + } + + strncat (g_pszCommandLine, argv[i], iSize - strlen (g_pszCommandLine)); + strncat (g_pszCommandLine, " ", iSize - strlen (g_pszCommandLine)); + + /* Save new line length */ + iCurrLen += strlen (argv[i]); + } + + ErrorF ("XWin was started with the following command line:\n\n" + "%s\n\n", g_pszCommandLine); +} + + +/* + * winLogVersionInfo - Log Cygwin/X version information + */ + +void +winLogVersionInfo (void) +{ + static Bool s_fBeenHere = FALSE; + + if (s_fBeenHere) + return; + s_fBeenHere = TRUE; + + ErrorF ("Welcome to the XWin X Server\n"); + ErrorF ("Vendor: %s\n", XVENDORNAME); + ErrorF ("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT); + ErrorF ("%s\n\n", BUILDERSTRING); + ErrorF ("Contact: %s\n", BUILDERADDR); +} diff --git a/xorg-server/hw/xwin/winrandr.c b/xorg-server/hw/xwin/winrandr.c index 7b5b1359c..248404800 100644 --- a/xorg-server/hw/xwin/winrandr.c +++ b/xorg-server/hw/xwin/winrandr.c @@ -1,8 +1,9 @@ /* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) 2009-2010 Jon TURNEY * *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the + *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 @@ -20,101 +21,280 @@ *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 Harold L Hunt II + *Except as contained in this notice, the name of the author(s) *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *from the author(s) * * Authors: Harold L Hunt II + * Jon TURNEY */ #ifdef HAVE_XWIN_CONFIG_H #include #endif #include "win.h" +#include "mivalidate.h" // for union _Validate used by windowstr.h + +#ifndef RANDR_12_INTERFACE +#error X server must have RandR 1.2 interface +#endif /* - * Local prototypes + * Answer queries about the RandR features supported. */ static Bool -winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations); +winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations) +{ + winDebug ("winRandRGetInfo ()\n"); -static Bool -winRandRSetConfig (ScreenPtr pScreen, - Rotation rotateKind, - int rate, - RRScreenSizePtr pSize); + /* Don't support rotations */ + *pRotations = RR_Rotate_0; -Bool -winRandRInit (ScreenPtr pScreen); + /* + The screen doesn't have to be limited to the actual + monitor size (we can have scrollbars :-), so what is + the upper limit? + */ + RRScreenSetSizeRange(pScreen, 0, 0, 4096, 4096); + + return TRUE; +} /* - * Answer queries about the RandR features supported. + Copied from the xfree86 DDX + + Why can't this be in DIX? + Does union _Validate vary depending on DDX?? */ +static void +xf86SetRootClip (ScreenPtr pScreen, Bool enable) +{ + WindowPtr pWin = pScreen->root; + WindowPtr pChild; + Bool WasViewable = (Bool)(pWin->viewable); + Bool anyMarked = FALSE; + WindowPtr pLayerWin; + BoxRec box; -static Bool -winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations) + if (WasViewable) + { + for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) + { + (void) (*pScreen->MarkOverlappedWindows)(pChild, + pChild, + &pLayerWin); + } + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + if (pWin->valdata) + { + if (HasBorder (pWin)) + { + RegionPtr borderVisible; + + borderVisible = REGION_CREATE(pScreen, NullBox, 1); + REGION_SUBTRACT(pScreen, borderVisible, + &pWin->borderClip, &pWin->winSize); + pWin->valdata->before.borderVisible = borderVisible; + } + pWin->valdata->before.resized = TRUE; + } + } + + /* + * Use REGION_BREAK to avoid optimizations in ValidateTree + * that assume the root borderClip can't change well, normally + * it doesn't...) + */ + if (enable) + { + box.x1 = 0; + box.y1 = 0; + box.x2 = pScreen->width; + box.y2 = pScreen->height; + REGION_INIT (pScreen, &pWin->winSize, &box, 1); + REGION_INIT (pScreen, &pWin->borderSize, &box, 1); + if (WasViewable) + REGION_RESET(pScreen, &pWin->borderClip, &box); + pWin->drawable.width = pScreen->width; + pWin->drawable.height = pScreen->height; + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + else + { + REGION_EMPTY(pScreen, &pWin->borderClip); + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + + ResizeChildrenWinSize (pWin, 0, 0, 0, 0); + + if (WasViewable) + { + if (pWin->firstChild) + { + anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild, + pWin->firstChild, + (WindowPtr *)NULL); + } + else + { + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + } + + + if (anyMarked) + (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); + } + + if (WasViewable) + { + if (anyMarked) + (*pScreen->HandleExposures)(pWin); + if (anyMarked && pScreen->PostValidateTree) + (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); + } + if (pWin->realized) + WindowsRestructured (); + FlushAllOutput (); +} + +/* + +*/ +void +winDoRandRScreenSetSize (ScreenPtr pScreen, + CARD16 width, + CARD16 height, + CARD32 mmWidth, + CARD32 mmHeight) { winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - int n; - Rotation rotateKind; - RRScreenSizePtr pSize; + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + WindowPtr pRoot = pScreen->root; - winDebug ("winRandRGetInfo ()\n"); + // Prevent screen updates while we change things around + xf86SetRootClip(pScreen, FALSE); - /* Don't support rotations, yet */ - *pRotations = RR_Rotate_0; + /* Update the screen size as requested */ + pScreenInfo->dwWidth = width; + pScreenInfo->dwHeight = height; - /* Bail if no depth has a visual associated with it */ - for (n = 0; n < pScreen->numDepths; n++) - if (pScreen->allowedDepths[n].numVids) - break; - if (n == pScreen->numDepths) - return FALSE; + /* Reallocate the framebuffer used by the drawing engine */ + (*pScreenPriv->pwinFreeFB)(pScreen); + if (!(*pScreenPriv->pwinAllocateFB)(pScreen)) + { + ErrorF ("winDoRandRScreenSetSize - Could not reallocate framebuffer\n"); + } - /* Only one allowed rotation for now */ - rotateKind = RR_Rotate_0; + pScreen->width = width; + pScreen->height = height; + pScreen->mmWidth = mmWidth; + pScreen->mmHeight = mmHeight; - /* - * Register supported sizes. This can be called many times, but - * we only support one size for now. - */ - pSize = RRRegisterSize (pScreen, - pScreenInfo->dwWidth, - pScreenInfo->dwHeight, - pScreenInfo->dwWidth_mm, - pScreenInfo->dwHeight_mm); - - /* Tell RandR what the current config is */ - RRSetCurrentConfig (pScreen, - rotateKind, - 0, /* refresh rate, not needed */ - pSize); - - return TRUE; -} + /* Update the screen pixmap to point to the new framebuffer */ + winUpdateFBPointer(pScreen, pScreenInfo->pfb); + + // pScreen->devPrivate == pScreen->GetScreenPixmap(screen) ? + // resize the root window + //pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL); + // does this emit a ConfigureNotify?? + // Restore the ability to update screen, now with new dimensions + xf86SetRootClip(pScreen, TRUE); + + // and arrange for it to be repainted + miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); + + /* Indicate that a screen size change took place */ + RRScreenSizeNotify(pScreen); +} /* - * Respond to resize/rotate request from either X Server or X client app + * Respond to resize request */ - -static Bool -winRandRSetConfig (ScreenPtr pScreen, - Rotation rotateKind, - int rate, - RRScreenSizePtr pSize) +static +Bool +winRandRScreenSetSize (ScreenPtr pScreen, + CARD16 width, + CARD16 height, + CARD16 pixWidth, + CARD16 pixHeight, + CARD32 mmWidth, + CARD32 mmHeight) { - winDebug ("winRandRSetConfig ()\n"); + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + winDebug ("winRandRScreenSetSize ()\n"); + + /* + It doesn't currently make sense to allow resize in fullscreen mode + (we'd actually have to list the supported resolutions) + */ + if (pScreenInfo->fFullScreen) + { + ErrorF ("winRandRScreenSetSize - resize not supported in fullscreen mode\n"); + return FALSE; + } + + /* + Client resize requests aren't allowed in rootless modes, even if + the X screen is monitor or virtual desktop size, we'd need to + resize the native display size + */ + if (FALSE +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fMWExtWM +#endif + || pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || pScreenInfo->fMultiWindow +#endif + ) + { + ErrorF ("winRandRScreenSetSize - resize not supported in rootless modes\n"); + return FALSE; + } + + winDoRandRScreenSetSize(pScreen, width, height, mmWidth, mmHeight); + + /* Cause the native window for the screen to resize itself */ + { + DWORD dwStyle, dwExStyle; + RECT rcClient; + + rcClient.left = 0; + rcClient.top = 0; + rcClient.right = width; + rcClient.bottom = height; + + ErrorF ("winRandRScreenSetSize new client area w: %d h: %d\n", width, height); + + /* Get the Windows window style and extended style */ + dwExStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_EXSTYLE); + dwStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_STYLE); + + /* + * Calculate the window size needed for the given client area + * adjusting for any decorations it will have + */ + AdjustWindowRectEx(&rcClient, dwStyle, FALSE, dwExStyle); + + ErrorF ("winRandRScreenSetSize new window area w: %ld h: %ld\n", rcClient.right-rcClient.left, rcClient.bottom-rcClient.top); + + SetWindowPos(pScreenPriv->hwndScreen, NULL, + 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, + SWP_NOZORDER | SWP_NOMOVE); + } return TRUE; } - /* * Initialize the RandR layer. */ @@ -122,8 +302,7 @@ winRandRSetConfig (ScreenPtr pScreen, Bool winRandRInit (ScreenPtr pScreen) { - rrScrPrivPtr pRRScrPriv; - + rrScrPrivPtr pRRScrPriv; winDebug ("winRandRInit ()\n"); if (!RRScreenInit (pScreen)) @@ -135,7 +314,10 @@ winRandRInit (ScreenPtr pScreen) /* Set some RandR function pointers */ pRRScrPriv = rrGetScrPriv (pScreen); pRRScrPriv->rrGetInfo = winRandRGetInfo; - pRRScrPriv->rrSetConfig = winRandRSetConfig; + pRRScrPriv->rrSetConfig = NULL; + pRRScrPriv->rrScreenSetSize = winRandRScreenSetSize; + pRRScrPriv->rrCrtcSet = NULL; + pRRScrPriv->rrCrtcSetGamma = NULL; return TRUE; } diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c index f067fde6a..691237e6f 100644 --- a/xorg-server/hw/xwin/winscrinit.c +++ b/xorg-server/hw/xwin/winscrinit.c @@ -1,767 +1,769 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *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 XFREE86 PROJECT 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 XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Dakshinamurthy Karra - * Suhaib M Siddiqi - * Peter Busch - * Harold L Hunt II - * Kensuke Matsuzaki - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" -#include "winmsg.h" - - -#ifdef XWIN_MULTIWINDOWEXTWM -static RootlessFrameProcsRec -winMWExtWMProcs = { - winMWExtWMCreateFrame, - winMWExtWMDestroyFrame, - - winMWExtWMMoveFrame, - winMWExtWMResizeFrame, - winMWExtWMRestackFrame, - winMWExtWMReshapeFrame, - winMWExtWMUnmapFrame, - - winMWExtWMStartDrawing, - winMWExtWMStopDrawing, - winMWExtWMUpdateRegion, - winMWExtWMDamageRects, - winMWExtWMRootlessSwitchWindow, - NULL,//winMWExtWMDoReorderWindow, - NULL,//winMWExtWMHideWindow, - NULL,//winMWExtWMUpdateColorMap, - - NULL,//winMWExtWMCopyBytes, - winMWExtWMCopyWindow -}; -#endif - -/* - * Prototypes - */ - -Bool -winRandRInit (ScreenPtr pScreen); - - -/* - * Local functions - */ - -static Bool -winSaveScreen (ScreenPtr pScreen, int on); - - -/* - * Determine what type of screen we are initializing - * and call the appropriate procedure to intiailize - * that type of screen. - */ - -Bool -winScreenInit (int index, - ScreenPtr pScreen, - int argc, char **argv) -{ - winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; - winPrivScreenPtr pScreenPriv; - HDC hdc; - -#if CYGDEBUG || YES - winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n", - pScreenInfo->dwWidth, pScreenInfo->dwHeight); -#endif - - /* Allocate privates for this screen */ - if (!winAllocatePrivates (pScreen)) - { - ErrorF ("winScreenInit - Couldn't allocate screen privates\n"); - return FALSE; - } - - /* Get a pointer to the privates structure that was allocated */ - pScreenPriv = winGetScreenPriv (pScreen); - - /* Save a pointer to this screen in the screen info structure */ - pScreenInfo->pScreen = pScreen; - - /* Save a pointer to the screen info in the screen privates structure */ - /* This allows us to get back to the screen info from a screen pointer */ - pScreenPriv->pScreenInfo = pScreenInfo; - - /* - * Determine which engine to use. - * - * NOTE: This is done once per screen because each screen possibly has - * a preferred engine specified on the command line. - */ - if (!winSetEngine (pScreen)) - { - ErrorF ("winScreenInit - winSetEngine () failed\n"); - return FALSE; - } - - /* Adjust the video mode for our engine type */ - if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) - { - ErrorF ("winScreenInit - winAdjustVideoMode () failed\n"); - return FALSE; - } - - /* Check for supported display depth */ - if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1)))) - { - ErrorF ("winScreenInit - Unsupported display depth: %d\n" \ - "Change your Windows display depth to 15, 16, 24, or 32 bits " - "per pixel.\n", - (int) pScreenInfo->dwBPP); - ErrorF ("winScreenInit - Supported depths: %08x\n", - WIN_SUPPORTED_BPPS); -#if WIN_CHECK_DEPTH - return FALSE; -#endif - } - - /* - * Check that all monitors have the same display depth if we are using - * multiple monitors - */ - if (pScreenInfo->fMultipleMonitors - && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT)) - { - ErrorF ("winScreenInit - Monitors do not all have same pixel format / " - "display depth.\n" - "Using primary display only.\n"); - pScreenInfo->fMultipleMonitors = FALSE; - } - - /* Create display window */ - if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) - { - ErrorF ("winScreenInit - pwinCreateBoundingWindow () " - "failed\n"); - return FALSE; - } - - /* Get a device context */ - hdc = GetDC (pScreenPriv->hwndScreen); - - /* Store the initial height, width, and depth of the display */ - /* Are we using multiple monitors? */ - if (pScreenInfo->fMultipleMonitors) - { - pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); - pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); - - /* - * In this case, some of the defaults set in - * winInitializeScreenDefaults() are not correct ... - */ - if (!pScreenInfo->fUserGaveHeightAndWidth) - { - pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); - pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); - pScreenInfo->dwWidth_mm = (pScreenInfo->dwWidth / - WIN_DEFAULT_DPI) * 25.4; - pScreenInfo->dwHeight_mm = (pScreenInfo->dwHeight / - WIN_DEFAULT_DPI) * 25.4; - } - } - else - { - pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN); - pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN); - } - - /* Save the original bits per pixel */ - pScreenPriv->dwLastWindowsBitsPixel = GetDeviceCaps (hdc, BITSPIXEL); - - /* Release the device context */ - ReleaseDC (pScreenPriv->hwndScreen, hdc); - - /* Clear the visuals list */ - miClearVisualTypes (); - - /* Set the padded screen width */ - pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, - pScreenInfo->dwBPP); - - /* Call the engine dependent screen initialization procedure */ - if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) - { - ErrorF ("winScreenInit - winFinishScreenInit () failed\n"); - return FALSE; - } - - if (!g_fSoftwareCursor) - winInitCursor(pScreen); - else - winErrorFVerb(2, "winScreenInit - Using software cursor\n"); - - /* - Note the screen origin in a normalized coordinate space where (0,0) is at the top left - of the native virtual desktop area - */ - pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN); - pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN); - - ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n", - index, pScreen->x, pScreen->y); - -#if CYGDEBUG || YES - winDebug ("winScreenInit - returning\n"); -#endif - - return TRUE; -} - -static Bool -winCreateScreenResources(ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - Bool result; - - result = pScreenPriv->pwinCreateScreenResources(pScreen); - - /* Now the screen bitmap has been wrapped in a pixmap, - add that to the Shadow framebuffer */ - if (!shadowAdd(pScreen, pScreen->devPrivate, - pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) - { - ErrorF ("winCreateScreenResources - shadowAdd () failed\n"); - return FALSE; - } - - return result; -} - -/* See Porting Layer Definition - p. 20 */ -Bool -winFinishScreenInitFB (int index, - ScreenPtr pScreen, - int argc, char **argv) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - VisualPtr pVisual = NULL; - char *pbits = NULL; -#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) - int iReturn; -#endif - - /* Create framebuffer */ - if (!(*pScreenPriv->pwinAllocateFB) (pScreen)) - { - ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n"); - return FALSE; - } - - /* - * Grab the number of bits that are used to represent color in each pixel. - */ - if (pScreenInfo->dwBPP == 8) - pScreenInfo->dwDepth = 8; - else - pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask) - + winCountBits (pScreenPriv->dwGreenMask) - + winCountBits (pScreenPriv->dwBlueMask); - - winErrorFVerb (2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n", - (unsigned int) pScreenPriv->dwRedMask, - (unsigned int) pScreenPriv->dwGreenMask, - (unsigned int) pScreenPriv->dwBlueMask); - - /* Init visuals */ - if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) - { - ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n"); - return FALSE; - } - - /* Setup a local variable to point to the framebuffer */ - pbits = pScreenInfo->pfb; - - /* Apparently we need this for the render extension */ - miSetPixmapDepths (); - - /* Start fb initialization */ - if (!fbSetupScreen (pScreen, - pScreenInfo->pfb, - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - monitorResolution, monitorResolution, - pScreenInfo->dwStride, - pScreenInfo->dwBPP)) - { - ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n"); - return FALSE; - } - - /* Override default colormap routines if visual class is dynamic */ - if (pScreenInfo->dwDepth == 8 - && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI - || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL - && pScreenInfo->fFullScreen) - || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD - && pScreenInfo->fFullScreen))) - { - winSetColormapFunctions (pScreen); - - /* - * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its - * own colormap, as it cannot allocate 7 planes in the default - * colormap. Setting whitePixel to 1 allows Magic to get 7 - * planes in the default colormap, so it doesn't create its - * own colormap. This latter situation is highly desireable, - * as it keeps the Magic window viewable when switching to - * other X clients that use the default colormap. - */ - pScreen->blackPixel = 0; - pScreen->whitePixel = 1; - } - - /* Place our save screen function */ - pScreen->SaveScreen = winSaveScreen; - - /* Finish fb initialization */ - if (!fbFinishScreenInit (pScreen, - pScreenInfo->pfb, - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - monitorResolution, monitorResolution, - pScreenInfo->dwStride, - pScreenInfo->dwBPP)) - { - ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n"); - return FALSE; - } - - /* Save a pointer to the root visual */ - for (pVisual = pScreen->visuals; - pVisual->vid != pScreen->rootVisual; - pVisual++); - pScreenPriv->pRootVisual = pVisual; - - /* - * Setup points to the block and wakeup handlers. Pass a pointer - * to the current screen as pWakeupdata. - */ - pScreen->BlockHandler = winBlockHandler; - pScreen->WakeupHandler = winWakeupHandler; - pScreen->blockData = pScreen; - pScreen->wakeupData = pScreen; - - /* Render extension initialization, calls miPictureInit */ - if (!fbPictureInit (pScreen, NULL, 0)) - { - ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n"); - return FALSE; - } - -#ifdef RANDR - /* Initialize resize and rotate support */ - if (!winRandRInit (pScreen)) - { - ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n"); - return FALSE; - } -#endif - - /* Setup the cursor routines */ -#if CYGDEBUG - winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n"); -#endif - miDCInitialize (pScreen, &g_winPointerCursorFuncs); - - /* KDrive does winCreateDefColormap right after miDCInitialize */ - /* Create a default colormap */ -#if CYGDEBUG - winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n"); -#endif - if (!winCreateDefColormap (pScreen)) - { - ErrorF ("winFinishScreenInitFB - Could not create colormap\n"); - return FALSE; - } - - /* Initialize the shadow framebuffer layer */ - if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI - || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD - || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) -#ifdef XWIN_MULTIWINDOWEXTWM - && !pScreenInfo->fMWExtWM -#endif - ) - { -#if CYGDEBUG - winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n"); -#endif - if (!shadowSetup(pScreen)) - { - ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n"); - return FALSE; - } - - /* Wrap CreateScreenResources so we can add the screen pixmap - to the Shadow framebuffer after it's been created */ - pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources; - pScreen->CreateScreenResources = winCreateScreenResources; - } - -#ifdef XWIN_MULTIWINDOWEXTWM - /* Handle multi-window external window manager mode */ - if (pScreenInfo->fMWExtWM) - { - winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n"); - - RootlessInit(pScreen, &winMWExtWMProcs); - - winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n"); - - rootless_CopyBytes_threshold = 0; - /* FIXME: How many? Profiling needed? */ - rootless_CopyWindow_threshold = 1; - - winWindowsWMExtensionInit (); - } -#endif - - /* Handle rootless mode */ - if (pScreenInfo->fRootless) - { - /* Define the WRAP macro temporarily for local use */ -#define WRAP(a) \ - if (pScreen->a) { \ - pScreenPriv->a = pScreen->a; \ - } else { \ - ErrorF("null screen fn " #a "\n"); \ - pScreenPriv->a = NULL; \ - } - - /* Save a pointer to each lower-level window procedure */ - WRAP(CreateWindow); - WRAP(DestroyWindow); - WRAP(RealizeWindow); - WRAP(UnrealizeWindow); - WRAP(PositionWindow); - WRAP(ChangeWindowAttributes); - WRAP(SetShape); - - /* Assign rootless window procedures to be top level procedures */ - pScreen->CreateWindow = winCreateWindowRootless; - pScreen->DestroyWindow = winDestroyWindowRootless; - pScreen->PositionWindow = winPositionWindowRootless; - /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/ - pScreen->RealizeWindow = winMapWindowRootless; - pScreen->UnrealizeWindow = winUnmapWindowRootless; - pScreen->SetShape = winSetShapeRootless; - - /* Undefine the WRAP macro, as it is not needed elsewhere */ -#undef WRAP - } - - -#ifdef XWIN_MULTIWINDOW - /* Handle multi window mode */ - else if (pScreenInfo->fMultiWindow) - { - /* Define the WRAP macro temporarily for local use */ -#define WRAP(a) \ - if (pScreen->a) { \ - pScreenPriv->a = pScreen->a; \ - } else { \ - ErrorF("null screen fn " #a "\n"); \ - pScreenPriv->a = NULL; \ - } - - /* Save a pointer to each lower-level window procedure */ - WRAP(CreateWindow); - WRAP(DestroyWindow); - WRAP(RealizeWindow); - WRAP(UnrealizeWindow); - WRAP(PositionWindow); - WRAP(ChangeWindowAttributes); - WRAP(ReparentWindow); - WRAP(RestackWindow); - WRAP(ResizeWindow); - WRAP(MoveWindow); - WRAP(CopyWindow); - WRAP(SetShape); - - /* Assign multi-window window procedures to be top level procedures */ - pScreen->CreateWindow = winCreateWindowMultiWindow; - pScreen->DestroyWindow = winDestroyWindowMultiWindow; - pScreen->PositionWindow = winPositionWindowMultiWindow; - /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow;*/ - pScreen->RealizeWindow = winMapWindowMultiWindow; - pScreen->UnrealizeWindow = winUnmapWindowMultiWindow; - pScreen->ReparentWindow = winReparentWindowMultiWindow; - pScreen->RestackWindow = winRestackWindowMultiWindow; - pScreen->ResizeWindow = winResizeWindowMultiWindow; - pScreen->MoveWindow = winMoveWindowMultiWindow; - pScreen->CopyWindow = winCopyWindowMultiWindow; - pScreen->SetShape = winSetShapeMultiWindow; - - /* Undefine the WRAP macro, as it is not needed elsewhere */ -#undef WRAP - } -#endif - - /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */ - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; - -#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) - /* Create a mutex for modules in separate threads to wait for */ - iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL); - if (iReturn != 0) - { - ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n", - iReturn); - return FALSE; - } - - /* Own the mutex for modules in separate threads */ - iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted); - if (iReturn != 0) - { - ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n", - iReturn); - return FALSE; - } - - /* Set the ServerStarted flag to false */ - pScreenPriv->fServerStarted = FALSE; -#endif - -#ifdef XWIN_MULTIWINDOWEXTWM - pScreenPriv->fRestacking = FALSE; -#endif - -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) - if (FALSE -#ifdef XWIN_MULTIWINDOW - || pScreenInfo->fMultiWindow -#endif -#ifdef XWIN_MULTIWINDOWEXTWM - || pScreenInfo->fInternalWM -#endif - ) - { -#if CYGDEBUG || YES - winDebug ("winFinishScreenInitFB - Calling winInitWM.\n"); -#endif - - /* Initialize multi window mode */ - if (!winInitWM (&pScreenPriv->pWMInfo, - &pScreenPriv->ptWMProc, - &pScreenPriv->ptXMsgProc, - &pScreenPriv->pmServerStarted, - pScreenInfo->dwScreen, - (HWND)&pScreenPriv->hwndScreen, -#ifdef XWIN_MULTIWINDOWEXTWM - pScreenInfo->fInternalWM || -#endif - FALSE)) - { - ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n"); - return FALSE; - } - } -#endif - - /* Tell the server that we are enabled */ - pScreenPriv->fEnabled = TRUE; - - /* Tell the server that we have a valid depth */ - pScreenPriv->fBadDepth = FALSE; - -#if CYGDEBUG || YES - winDebug ("winFinishScreenInitFB - returning\n"); -#endif - - return TRUE; -} - -#ifdef XWIN_NATIVEGDI -/* See Porting Layer Definition - p. 20 */ - -Bool -winFinishScreenInitNativeGDI (int index, - ScreenPtr pScreen, - int argc, char **argv) -{ - winScreenPriv(pScreen); - winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; - VisualPtr pVisuals = NULL; - DepthPtr pDepths = NULL; - VisualID rootVisual = 0; - int nVisuals = 0, nDepths = 0, nRootDepth = 0; - - /* Ignore user input (mouse, keyboard) */ - pScreenInfo->fIgnoreInput = FALSE; - - /* Get device contexts for the screen and shadow bitmap */ - pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); - if (pScreenPriv->hdcScreen == NULL) - FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n"); - - /* Init visuals */ - if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) - { - ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n"); - return FALSE; - } - - /* Initialize the mi visuals */ - if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth, - &rootVisual, - ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8, - TrueColor)) - { - ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n"); - return FALSE; - } - - /* Initialize the CloseScreen procedure pointer */ - pScreen->CloseScreen = NULL; - - /* Initialize the mi code */ - if (!miScreenInit (pScreen, - NULL, /* No framebuffer */ - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - monitorResolution, monitorResolution, - pScreenInfo->dwStride, - nRootDepth, nDepths, pDepths, rootVisual, - nVisuals, pVisuals)) - { - ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n"); - return FALSE; - } - - pScreen->defColormap = FakeClientID(0); - - /* - * Register our block and wakeup handlers; these procedures - * process messages in our Windows message queue; specifically, - * they process mouse and keyboard input. - */ - pScreen->BlockHandler = winBlockHandler; - pScreen->WakeupHandler = winWakeupHandler; - pScreen->blockData = pScreen; - pScreen->wakeupData = pScreen; - - /* Place our save screen function */ - pScreen->SaveScreen = winSaveScreen; - - /* Pixmaps */ - pScreen->CreatePixmap = winCreatePixmapNativeGDI; - pScreen->DestroyPixmap = winDestroyPixmapNativeGDI; - - /* Other Screen Routines */ - pScreen->QueryBestSize = winQueryBestSizeNativeGDI; - pScreen->SaveScreen = winSaveScreen; - pScreen->GetImage = miGetImage; - pScreen->GetSpans = winGetSpansNativeGDI; - - /* Window Procedures */ - pScreen->CreateWindow = winCreateWindowNativeGDI; - pScreen->DestroyWindow = winDestroyWindowNativeGDI; - pScreen->PositionWindow = winPositionWindowNativeGDI; - /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/ - pScreen->RealizeWindow = winMapWindowNativeGDI; - pScreen->UnrealizeWindow = winUnmapWindowNativeGDI; - - /* Paint window */ - pScreen->CopyWindow = winCopyWindowNativeGDI; - - /* Fonts */ - pScreen->RealizeFont = winRealizeFontNativeGDI; - pScreen->UnrealizeFont = winUnrealizeFontNativeGDI; - - /* GC */ - pScreen->CreateGC = winCreateGCNativeGDI; - - /* Colormap Routines */ - pScreen->CreateColormap = miInitializeColormap; - pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA; - pScreen->InstallColormap = miInstallColormap; - pScreen->UninstallColormap = miUninstallColormap; - pScreen->ListInstalledColormaps = miListInstalledColormaps; - pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA; - pScreen->ResolveColor = miResolveColor; - - /* Bitmap */ - pScreen->BitmapToRegion = winPixmapToRegionNativeGDI; - - ErrorF ("winFinishScreenInitNativeGDI - calling miDCInitialize\n"); - - /* Set the default white and black pixel positions */ - pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0; - - /* Initialize the cursor */ - if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs)) - { - ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n"); - return FALSE; - } - - /* Create a default colormap */ - if (!miCreateDefColormap (pScreen)) - { - ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () " - "failed\n"); - return FALSE; - } - - ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () " - "returned\n"); - - /* mi doesn't use a CloseScreen procedure, so no need to wrap */ - pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; - - /* Tell the server that we are enabled */ - pScreenPriv->fEnabled = TRUE; - - ErrorF ("winFinishScreenInitNativeGDI - Successful addition of " - "screen %08x\n", - (unsigned int) pScreen); - - return TRUE; -} -#endif - - -/* See Porting Layer Definition - p. 33 */ -static Bool -winSaveScreen (ScreenPtr pScreen, int on) -{ - return TRUE; -} +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + * Kensuke Matsuzaki + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" +#include "winmsg.h" + + +#ifdef XWIN_MULTIWINDOWEXTWM +static RootlessFrameProcsRec +winMWExtWMProcs = { + winMWExtWMCreateFrame, + winMWExtWMDestroyFrame, + + winMWExtWMMoveFrame, + winMWExtWMResizeFrame, + winMWExtWMRestackFrame, + winMWExtWMReshapeFrame, + winMWExtWMUnmapFrame, + + winMWExtWMStartDrawing, + winMWExtWMStopDrawing, + winMWExtWMUpdateRegion, + winMWExtWMDamageRects, + winMWExtWMRootlessSwitchWindow, + NULL,//winMWExtWMDoReorderWindow, + NULL,//winMWExtWMHideWindow, + NULL,//winMWExtWMUpdateColorMap, + + NULL,//winMWExtWMCopyBytes, + winMWExtWMCopyWindow +}; +#endif + +/* + * Prototypes + */ + +/* + * Local functions + */ + +static Bool +winSaveScreen (ScreenPtr pScreen, int on); + + +/* + * Determine what type of screen we are initializing + * and call the appropriate procedure to intiailize + * that type of screen. + */ + +Bool +winScreenInit (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; + winPrivScreenPtr pScreenPriv; + HDC hdc; + DWORD dwInitialBPP; + +#if CYGDEBUG || YES + winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight); +#endif + + /* Allocate privates for this screen */ + if (!winAllocatePrivates (pScreen)) + { + ErrorF ("winScreenInit - Couldn't allocate screen privates\n"); + return FALSE; + } + + /* Get a pointer to the privates structure that was allocated */ + pScreenPriv = winGetScreenPriv (pScreen); + + /* Save a pointer to this screen in the screen info structure */ + pScreenInfo->pScreen = pScreen; + + /* Save a pointer to the screen info in the screen privates structure */ + /* This allows us to get back to the screen info from a screen pointer */ + pScreenPriv->pScreenInfo = pScreenInfo; + + /* + * Determine which engine to use. + * + * NOTE: This is done once per screen because each screen possibly has + * a preferred engine specified on the command line. + */ + if (!winSetEngine (pScreen)) + { + ErrorF ("winScreenInit - winSetEngine () failed\n"); + return FALSE; + } + + /* Horribly misnamed function: Allow engine to adjust BPP for screen */ + dwInitialBPP = pScreenInfo->dwBPP; + + if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) + { + ErrorF ("winScreenInit - winAdjustVideoMode () failed\n"); + return FALSE; + } + + if (dwInitialBPP == WIN_DEFAULT_BPP) + { + /* No -depth parameter was passed, let the user know the depth being used */ + ErrorF ("winScreenInit - Using Windows display depth of %d bits per pixel\n", (int) pScreenInfo->dwBPP); + } + else if (dwInitialBPP != pScreenInfo->dwBPP) + { + /* Warn user if engine forced a depth different to -depth parameter */ + ErrorF ("winScreenInit - Command line depth of %d bpp overidden by engine, using %d bpp\n", (int) dwInitialBPP, (int) pScreenInfo->dwBPP); + } + else + { + ErrorF ("winScreenInit - Using command line depth of %d bpp\n", (int) pScreenInfo->dwBPP); + } + + /* Check for supported display depth */ + if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1)))) + { + ErrorF ("winScreenInit - Unsupported display depth: %d\n" \ + "Change your Windows display depth to 15, 16, 24, or 32 bits " + "per pixel.\n", + (int) pScreenInfo->dwBPP); + ErrorF ("winScreenInit - Supported depths: %08x\n", + WIN_SUPPORTED_BPPS); +#if WIN_CHECK_DEPTH + return FALSE; +#endif + } + + /* + * Check that all monitors have the same display depth if we are using + * multiple monitors + */ + if (pScreenInfo->fMultipleMonitors + && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT)) + { + ErrorF ("winScreenInit - Monitors do not all have same pixel format / " + "display depth.\n"); + if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI) + { + ErrorF ("winScreenInit - Performance may suffer off primary display.\n"); + } + else + { + ErrorF ("winScreenInit - Using primary display only.\n"); + pScreenInfo->fMultipleMonitors = FALSE; + } + } + + /* Create display window */ + if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen)) + { + ErrorF ("winScreenInit - pwinCreateBoundingWindow () " + "failed\n"); + return FALSE; + } + + /* Get a device context */ + hdc = GetDC (pScreenPriv->hwndScreen); + + /* Are we using multiple monitors? */ + if (pScreenInfo->fMultipleMonitors) + { + /* + * In this case, some of the defaults set in + * winInitializeScreenDefaults() are not correct ... + */ + if (!pScreenInfo->fUserGaveHeightAndWidth) + { + pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); + pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + } + } + + /* Release the device context */ + ReleaseDC (pScreenPriv->hwndScreen, hdc); + + /* Clear the visuals list */ + miClearVisualTypes (); + + /* Call the engine dependent screen initialization procedure */ + if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) + { + ErrorF ("winScreenInit - winFinishScreenInit () failed\n"); + return FALSE; + } + + if (!g_fSoftwareCursor) + winInitCursor(pScreen); + else + winErrorFVerb(2, "winScreenInit - Using software cursor\n"); + + /* + Note the screen origin in a normalized coordinate space where (0,0) is at the top left + of the native virtual desktop area + */ + pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN); + pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN); + + ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n", + index, pScreen->x, pScreen->y); + +#if CYGDEBUG || YES + winDebug ("winScreenInit - returning\n"); +#endif + + return TRUE; +} + +static Bool +winCreateScreenResources(ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + Bool result; + + result = pScreenPriv->pwinCreateScreenResources(pScreen); + + /* Now the screen bitmap has been wrapped in a pixmap, + add that to the Shadow framebuffer */ + if (!shadowAdd(pScreen, pScreen->devPrivate, + pScreenPriv->pwinShadowUpdate, NULL, 0, 0)) + { + ErrorF ("winCreateScreenResources - shadowAdd () failed\n"); + return FALSE; + } + + return result; +} + +/* See Porting Layer Definition - p. 20 */ +Bool +winFinishScreenInitFB (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + VisualPtr pVisual = NULL; + char *pbits = NULL; +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) + int iReturn; +#endif + + /* Create framebuffer */ + if (!(*pScreenPriv->pwinInitScreen) (pScreen)) + { + ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n"); + return FALSE; + } + + /* + * Calculate the number of bits that are used to represent color in each pixel, + * the color depth for the screen + */ + if (pScreenInfo->dwBPP == 8) + pScreenInfo->dwDepth = 8; + else + pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask) + + winCountBits (pScreenPriv->dwGreenMask) + + winCountBits (pScreenPriv->dwBlueMask); + + winErrorFVerb (2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n", + (unsigned int) pScreenPriv->dwRedMask, + (unsigned int) pScreenPriv->dwGreenMask, + (unsigned int) pScreenPriv->dwBlueMask); + + /* Init visuals */ + if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) + { + ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n"); + return FALSE; + } + + /* Setup a local variable to point to the framebuffer */ + pbits = pScreenInfo->pfb; + + /* Apparently we need this for the render extension */ + miSetPixmapDepths (); + + /* Start fb initialization */ + if (!fbSetupScreen (pScreen, + pScreenInfo->pfb, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + monitorResolution, monitorResolution, + pScreenInfo->dwStride, + pScreenInfo->dwBPP)) + { + ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n"); + return FALSE; + } + + /* Override default colormap routines if visual class is dynamic */ + if (pScreenInfo->dwDepth == 8 + && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI + || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL + && pScreenInfo->fFullScreen) + || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + && pScreenInfo->fFullScreen))) + { + winSetColormapFunctions (pScreen); + + /* + * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its + * own colormap, as it cannot allocate 7 planes in the default + * colormap. Setting whitePixel to 1 allows Magic to get 7 + * planes in the default colormap, so it doesn't create its + * own colormap. This latter situation is highly desireable, + * as it keeps the Magic window viewable when switching to + * other X clients that use the default colormap. + */ + pScreen->blackPixel = 0; + pScreen->whitePixel = 1; + } + + /* Place our save screen function */ + pScreen->SaveScreen = winSaveScreen; + + /* Finish fb initialization */ + if (!fbFinishScreenInit (pScreen, + pScreenInfo->pfb, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + monitorResolution, monitorResolution, + pScreenInfo->dwStride, + pScreenInfo->dwBPP)) + { + ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n"); + return FALSE; + } + + /* Save a pointer to the root visual */ + for (pVisual = pScreen->visuals; + pVisual->vid != pScreen->rootVisual; + pVisual++); + pScreenPriv->pRootVisual = pVisual; + + /* + * Setup points to the block and wakeup handlers. Pass a pointer + * to the current screen as pWakeupdata. + */ + pScreen->BlockHandler = winBlockHandler; + pScreen->WakeupHandler = winWakeupHandler; + pScreen->blockData = pScreen; + pScreen->wakeupData = pScreen; + + /* Render extension initialization, calls miPictureInit */ + if (!fbPictureInit (pScreen, NULL, 0)) + { + ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n"); + return FALSE; + } + +#ifdef RANDR + /* Initialize resize and rotate support */ + if (!winRandRInit (pScreen)) + { + ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n"); + return FALSE; + } +#endif + + /* Setup the cursor routines */ +#if CYGDEBUG + winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n"); +#endif + miDCInitialize (pScreen, &g_winPointerCursorFuncs); + + /* KDrive does winCreateDefColormap right after miDCInitialize */ + /* Create a default colormap */ +#if CYGDEBUG + winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n"); +#endif + if (!winCreateDefColormap (pScreen)) + { + ErrorF ("winFinishScreenInitFB - Could not create colormap\n"); + return FALSE; + } + + /* Initialize the shadow framebuffer layer */ + if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI + || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) +#ifdef XWIN_MULTIWINDOWEXTWM + && !pScreenInfo->fMWExtWM +#endif + ) + { +#if CYGDEBUG + winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n"); +#endif + if (!shadowSetup(pScreen)) + { + ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n"); + return FALSE; + } + + /* Wrap CreateScreenResources so we can add the screen pixmap + to the Shadow framebuffer after it's been created */ + pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = winCreateScreenResources; + } + +#ifdef XWIN_MULTIWINDOWEXTWM + /* Handle multi-window external window manager mode */ + if (pScreenInfo->fMWExtWM) + { + winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n"); + + RootlessInit(pScreen, &winMWExtWMProcs); + + winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n"); + + rootless_CopyBytes_threshold = 0; + /* FIXME: How many? Profiling needed? */ + rootless_CopyWindow_threshold = 1; + + winWindowsWMExtensionInit (); + } +#endif + + /* Handle rootless mode */ + if (pScreenInfo->fRootless) + { + /* Define the WRAP macro temporarily for local use */ +#define WRAP(a) \ + if (pScreen->a) { \ + pScreenPriv->a = pScreen->a; \ + } else { \ + ErrorF("null screen fn " #a "\n"); \ + pScreenPriv->a = NULL; \ + } + + /* Save a pointer to each lower-level window procedure */ + WRAP(CreateWindow); + WRAP(DestroyWindow); + WRAP(RealizeWindow); + WRAP(UnrealizeWindow); + WRAP(PositionWindow); + WRAP(ChangeWindowAttributes); + WRAP(SetShape); + + /* Assign rootless window procedures to be top level procedures */ + pScreen->CreateWindow = winCreateWindowRootless; + pScreen->DestroyWindow = winDestroyWindowRootless; + pScreen->PositionWindow = winPositionWindowRootless; + /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/ + pScreen->RealizeWindow = winMapWindowRootless; + pScreen->UnrealizeWindow = winUnmapWindowRootless; + pScreen->SetShape = winSetShapeRootless; + + /* Undefine the WRAP macro, as it is not needed elsewhere */ +#undef WRAP + } + + +#ifdef XWIN_MULTIWINDOW + /* Handle multi window mode */ + else if (pScreenInfo->fMultiWindow) + { + /* Define the WRAP macro temporarily for local use */ +#define WRAP(a) \ + if (pScreen->a) { \ + pScreenPriv->a = pScreen->a; \ + } else { \ + ErrorF("null screen fn " #a "\n"); \ + pScreenPriv->a = NULL; \ + } + + /* Save a pointer to each lower-level window procedure */ + WRAP(CreateWindow); + WRAP(DestroyWindow); + WRAP(RealizeWindow); + WRAP(UnrealizeWindow); + WRAP(PositionWindow); + WRAP(ChangeWindowAttributes); + WRAP(ReparentWindow); + WRAP(RestackWindow); + WRAP(ResizeWindow); + WRAP(MoveWindow); + WRAP(CopyWindow); + WRAP(SetShape); + + /* Assign multi-window window procedures to be top level procedures */ + pScreen->CreateWindow = winCreateWindowMultiWindow; + pScreen->DestroyWindow = winDestroyWindowMultiWindow; + pScreen->PositionWindow = winPositionWindowMultiWindow; + /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow;*/ + pScreen->RealizeWindow = winMapWindowMultiWindow; + pScreen->UnrealizeWindow = winUnmapWindowMultiWindow; + pScreen->ReparentWindow = winReparentWindowMultiWindow; + pScreen->RestackWindow = winRestackWindowMultiWindow; + pScreen->ResizeWindow = winResizeWindowMultiWindow; + pScreen->MoveWindow = winMoveWindowMultiWindow; + pScreen->CopyWindow = winCopyWindowMultiWindow; + pScreen->SetShape = winSetShapeMultiWindow; + + /* Undefine the WRAP macro, as it is not needed elsewhere */ +#undef WRAP + } +#endif + + /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */ + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; + +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) + /* Create a mutex for modules in separate threads to wait for */ + iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL); + if (iReturn != 0) + { + ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n", + iReturn); + return FALSE; + } + + /* Own the mutex for modules in separate threads */ + iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted); + if (iReturn != 0) + { + ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n", + iReturn); + return FALSE; + } + + /* Set the ServerStarted flag to false */ + pScreenPriv->fServerStarted = FALSE; +#endif + +#ifdef XWIN_MULTIWINDOWEXTWM + pScreenPriv->fRestacking = FALSE; +#endif + +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + if (FALSE +#ifdef XWIN_MULTIWINDOW + || pScreenInfo->fMultiWindow +#endif +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fInternalWM +#endif + ) + { +#if CYGDEBUG || YES + winDebug ("winFinishScreenInitFB - Calling winInitWM.\n"); +#endif + + /* Initialize multi window mode */ + if (!winInitWM (&pScreenPriv->pWMInfo, + &pScreenPriv->ptWMProc, + &pScreenPriv->ptXMsgProc, + &pScreenPriv->pmServerStarted, + pScreenInfo->dwScreen, + (HWND)&pScreenPriv->hwndScreen, +#ifdef XWIN_MULTIWINDOWEXTWM + pScreenInfo->fInternalWM || +#endif + FALSE)) + { + ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n"); + return FALSE; + } + } +#endif + + /* Tell the server that we are enabled */ + pScreenPriv->fEnabled = TRUE; + + /* Tell the server that we have a valid depth */ + pScreenPriv->fBadDepth = FALSE; + +#if CYGDEBUG || YES + winDebug ("winFinishScreenInitFB - returning\n"); +#endif + + return TRUE; +} + +#ifdef XWIN_NATIVEGDI +/* See Porting Layer Definition - p. 20 */ + +Bool +winFinishScreenInitNativeGDI (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenPriv(pScreen); + winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; + VisualPtr pVisuals = NULL; + DepthPtr pDepths = NULL; + VisualID rootVisual = 0; + int nVisuals = 0, nDepths = 0, nRootDepth = 0; + + /* Ignore user input (mouse, keyboard) */ + pScreenInfo->fIgnoreInput = FALSE; + + /* Get device contexts for the screen and shadow bitmap */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + if (pScreenPriv->hdcScreen == NULL) + FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n"); + + /* Init visuals */ + if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) + { + ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n"); + return FALSE; + } + + /* Initialize the mi visuals */ + if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth, + &rootVisual, + ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8, + TrueColor)) + { + ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n"); + return FALSE; + } + + /* Initialize the CloseScreen procedure pointer */ + pScreen->CloseScreen = NULL; + + /* Initialize the mi code */ + if (!miScreenInit (pScreen, + NULL, /* No framebuffer */ + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + monitorResolution, monitorResolution, + pScreenInfo->dwStride, + nRootDepth, nDepths, pDepths, rootVisual, + nVisuals, pVisuals)) + { + ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n"); + return FALSE; + } + + pScreen->defColormap = FakeClientID(0); + + /* + * Register our block and wakeup handlers; these procedures + * process messages in our Windows message queue; specifically, + * they process mouse and keyboard input. + */ + pScreen->BlockHandler = winBlockHandler; + pScreen->WakeupHandler = winWakeupHandler; + pScreen->blockData = pScreen; + pScreen->wakeupData = pScreen; + + /* Place our save screen function */ + pScreen->SaveScreen = winSaveScreen; + + /* Pixmaps */ + pScreen->CreatePixmap = winCreatePixmapNativeGDI; + pScreen->DestroyPixmap = winDestroyPixmapNativeGDI; + + /* Other Screen Routines */ + pScreen->QueryBestSize = winQueryBestSizeNativeGDI; + pScreen->SaveScreen = winSaveScreen; + pScreen->GetImage = miGetImage; + pScreen->GetSpans = winGetSpansNativeGDI; + + /* Window Procedures */ + pScreen->CreateWindow = winCreateWindowNativeGDI; + pScreen->DestroyWindow = winDestroyWindowNativeGDI; + pScreen->PositionWindow = winPositionWindowNativeGDI; + /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/ + pScreen->RealizeWindow = winMapWindowNativeGDI; + pScreen->UnrealizeWindow = winUnmapWindowNativeGDI; + + /* Paint window */ + pScreen->CopyWindow = winCopyWindowNativeGDI; + + /* Fonts */ + pScreen->RealizeFont = winRealizeFontNativeGDI; + pScreen->UnrealizeFont = winUnrealizeFontNativeGDI; + + /* GC */ + pScreen->CreateGC = winCreateGCNativeGDI; + + /* Colormap Routines */ + pScreen->CreateColormap = miInitializeColormap; + pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA; + pScreen->InstallColormap = miInstallColormap; + pScreen->UninstallColormap = miUninstallColormap; + pScreen->ListInstalledColormaps = miListInstalledColormaps; + pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA; + pScreen->ResolveColor = miResolveColor; + + /* Bitmap */ + pScreen->BitmapToRegion = winPixmapToRegionNativeGDI; + + ErrorF ("winFinishScreenInitNativeGDI - calling miDCInitialize\n"); + + /* Set the default white and black pixel positions */ + pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0; + + /* Initialize the cursor */ + if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs)) + { + ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n"); + return FALSE; + } + + /* Create a default colormap */ + if (!miCreateDefColormap (pScreen)) + { + ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () " + "failed\n"); + return FALSE; + } + + ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () " + "returned\n"); + + /* mi doesn't use a CloseScreen procedure, so no need to wrap */ + pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; + + /* Tell the server that we are enabled */ + pScreenPriv->fEnabled = TRUE; + + ErrorF ("winFinishScreenInitNativeGDI - Successful addition of " + "screen %08x\n", + (unsigned int) pScreen); + + return TRUE; +} +#endif + + +/* See Porting Layer Definition - p. 33 */ +static Bool +winSaveScreen (ScreenPtr pScreen, int on) +{ + return TRUE; +} diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c index ae49d5a3d..00d7a379f 100644 --- a/xorg-server/hw/xwin/winshaddd.c +++ b/xorg-server/hw/xwin/winshaddd.c @@ -1,1400 +1,1366 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *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 XFREE86 PROJECT 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 XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Dakshinamurthy Karra - * Suhaib M Siddiqi - * Peter Busch - * Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - - -/* - * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, - * so we have to redefine it here. - */ -#ifdef DEFINE_GUID -#undef DEFINE_GUID -#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} -#endif /* DEFINE_GUID */ - - -/* - * FIXME: Headers are broken, IID_IDirectDraw2 has to be defined - * here manually. Should be handled by ddraw.h - */ -#ifndef IID_IDirectDraw2 -DEFINE_GUID( IID_IDirectDraw2,0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); -#endif /* IID_IDirectDraw2 */ - - -/* - * Local prototypes - */ - -static Bool -winAllocateFBShadowDD (ScreenPtr pScreen); - -static void -winShadowUpdateDD (ScreenPtr pScreen, - shadowBufPtr pBuf); - -static Bool -winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen); - -static Bool -winInitVisualsShadowDD (ScreenPtr pScreen); - -static Bool -winAdjustVideoModeShadowDD (ScreenPtr pScreen); - -static Bool -winBltExposedRegionsShadowDD (ScreenPtr pScreen); - -static Bool -winActivateAppShadowDD (ScreenPtr pScreen); - -static Bool -winRedrawScreenShadowDD (ScreenPtr pScreen); - -static Bool -winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen); - -static Bool -winInstallColormapShadowDD (ColormapPtr pColormap); - -static Bool -winStoreColorsShadowDD (ColormapPtr pmap, - int ndef, - xColorItem *pdefs); - -static Bool -winCreateColormapShadowDD (ColormapPtr pColormap); - -static Bool -winDestroyColormapShadowDD (ColormapPtr pColormap); - -static Bool -winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen); - -static Bool -winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen); - - -/* - * Create the primary surface and attach the clipper. - * Used for both the initial surface creation and during - * WM_DISPLAYCHANGE messages. - */ - -static Bool -winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - HRESULT ddrval = DD_OK; - DDSURFACEDESC ddsd; - - /* Describe the primary surface */ - ZeroMemory (&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - /* Create the primary surface */ - ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, - &ddsd, - &pScreenPriv->pddsPrimary, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winCreatePrimarySurfaceShadowDD - Could not create primary " - "surface: %08x\n", (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winCreatePrimarySurfaceShadowDD - Created primary surface\n"); -#endif - - /* - * Attach a clipper to the primary surface that will clip our blits to our - * display window. - */ - ddrval = IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, - pScreenPriv->pddcPrimary); - if (FAILED (ddrval)) - { - ErrorF ("winCreatePrimarySurfaceShadowDD - Primary attach clipper " - "failed: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winCreatePrimarySurfaceShadowDD - Attached clipper to " - "primary surface\n"); -#endif - - /* Everything was correct */ - return TRUE; -} - - -/* - * Detach the clipper and release the primary surface. - * Called from WM_DISPLAYCHANGE. - */ - -static Bool -winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - - ErrorF ("winReleasePrimarySurfaceShadowDD - Hello\n"); - - /* Release the primary surface and clipper, if they exist */ - if (pScreenPriv->pddsPrimary) - { - /* - * Detach the clipper from the primary surface. - * NOTE: We do this explicity for clarity. The Clipper is not released. - */ - IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, - NULL); - - ErrorF ("winReleasePrimarySurfaceShadowDD - Detached clipper\n"); - - /* Release the primary surface */ - IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); - pScreenPriv->pddsPrimary = NULL; - } - - ErrorF ("winReleasePrimarySurfaceShadowDD - Released primary surface\n"); - - return TRUE; -} - - -/* - * Create a DirectDraw surface for the shadow framebuffer; also create - * a primary surface object so we can blit to the display. - * - * Install a DirectDraw clipper on our primary surface object - * that clips our blits to the unobscured client area of our display window. - */ - -static Bool -winAllocateFBShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HRESULT ddrval = DD_OK; - DDSURFACEDESC ddsd; - DDSURFACEDESC *pddsdShadow = NULL; - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDD\n"); -#endif - - /* Create a clipper */ - ddrval = (*g_fpDirectDrawCreateClipper) (0, - &pScreenPriv->pddcPrimary, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Could not create clipper: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDD - Created a clipper\n"); -#endif - - /* Get a device context for the screen */ - pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); - - /* Attach the clipper to our display window */ - ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, - 0, - pScreenPriv->hwndScreen); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Clipper not attached to " - "window: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDD - Attached clipper to window\n"); -#endif - - /* Create a DirectDraw object, store the address at lpdd */ - ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Could not start DirectDraw: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDD () - Created and initialized DD\n"); -#endif - - /* Get a DirectDraw2 interface pointer */ - ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, - &IID_IDirectDraw2, - (LPVOID*) &pScreenPriv->pdd2); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - - /* Are we full screen? */ - if (pScreenInfo->fFullScreen) - { - DDSURFACEDESC ddsdCurrent; - DWORD dwRefreshRateCurrent = 0; - HDC hdc = NULL; - - /* Set the cooperative level to full screen */ - ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, - pScreenPriv->hwndScreen, - DDSCL_EXCLUSIVE - | DDSCL_FULLSCREEN); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Could not set " - "cooperative level: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - - /* - * We only need to get the current refresh rate for comparison - * if a refresh rate has been passed on the command line. - */ - if (pScreenInfo->dwRefreshRate != 0) - { - ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent)); - ddsdCurrent.dwSize = sizeof (ddsdCurrent); - - /* Get information about current display settings */ - ddrval = IDirectDraw2_GetDisplayMode (pScreenPriv->pdd2, - &ddsdCurrent); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Could not get current " - "refresh rate: %08x. Continuing.\n", - (unsigned int) ddrval); - dwRefreshRateCurrent = 0; - } - else - { - /* Grab the current refresh rate */ - dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate; - } - } - - /* Clean up the refresh rate */ - if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) - { - /* - * Refresh rate is non-specified or equal to current. - */ - pScreenInfo->dwRefreshRate = 0; - } - - /* Grab a device context for the screen */ - hdc = GetDC (NULL); - if (hdc == NULL) - { - ErrorF ("winAllocateFBShadowDD - GetDC () failed\n"); - return FALSE; - } - - /* Only change the video mode when different than current mode */ - if (!pScreenInfo->fMultipleMonitors - && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) - || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) - || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL) - || pScreenInfo->dwRefreshRate != 0)) - { - ErrorF ("winAllocateFBShadowDD - Changing video mode\n"); - - /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ - ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, - pScreenInfo->dwWidth, - pScreenInfo->dwHeight, - pScreenInfo->dwBPP, - pScreenInfo->dwRefreshRate, - 0); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Could not set "\ - "full screen display mode: %08x\n", - (unsigned int) ddrval); - ErrorF ("winAllocateFBShadowDD - Using default driver refresh rate\n"); - ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, - pScreenInfo->dwWidth, - pScreenInfo->dwHeight, - pScreenInfo->dwBPP, - 0, - 0); - if (FAILED(ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Could not set default refresh rate " - "full screen display mode: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - } - } - else - { - ErrorF ("winAllocateFBShadowDD - Not changing video mode\n"); - } - - /* Release our DC */ - ReleaseDC (NULL, hdc); - hdc = NULL; - } - else - { - /* Set the cooperative level for windowed mode */ - ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, - pScreenPriv->hwndScreen, - DDSCL_NORMAL); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Could not set "\ - "cooperative level: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - } - - /* Create the primary surface */ - if (!winCreatePrimarySurfaceShadowDD (pScreen)) - { - ErrorF ("winAllocateFBShadowDD - winCreatePrimarySurfaceShadowDD " - "failed\n"); - return FALSE; - } - - /* Describe the shadow surface to be created */ - /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, - * as drawing, locking, and unlocking take forever - * with video memory surfaces. In addition, - * video memory is a somewhat scarce resource, - * so you shouldn't be allocating video memory when - * you have the option of using system memory instead. - */ - ZeroMemory (&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - ddsd.dwHeight = pScreenInfo->dwHeight; - ddsd.dwWidth = pScreenInfo->dwWidth; - - /* Create the shadow surface */ - ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, - &ddsd, - &pScreenPriv->pddsShadow, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDD - Could not create shadow "\ - "surface: %08x\n", (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDD - Created shadow\n"); -#endif - - /* Allocate a DD surface description for our screen privates */ - pddsdShadow = pScreenPriv->pddsdShadow = malloc (sizeof (DDSURFACEDESC)); - if (pddsdShadow == NULL) - { - ErrorF ("winAllocateFBShadowDD - Could not allocate surface "\ - "description memory\n"); - return FALSE; - } - ZeroMemory (pddsdShadow, sizeof (*pddsdShadow)); - pddsdShadow->dwSize = sizeof (*pddsdShadow); - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDD - Locking shadow\n"); -#endif - - /* Lock the shadow surface */ - ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, - NULL, - pddsdShadow, - DDLOCK_WAIT, - NULL); - if (FAILED (ddrval) || pddsdShadow->lpSurface == NULL) - { - ErrorF ("winAllocateFBShadowDD - Could not lock shadow "\ - "surface: %08x\n", (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDD - Locked shadow\n"); -#endif - - /* We don't know how to deal with anything other than RGB */ - if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB)) - { - ErrorF ("winAllocateFBShadowDD - Color format other than RGB\n"); - return FALSE; - } - - /* Grab the pitch from the surface desc */ - pScreenInfo->dwStride = (pddsdShadow->u1.lPitch * 8) - / pScreenInfo->dwBPP; - - /* Save the pointer to our surface memory */ - pScreenInfo->pfb = pddsdShadow->lpSurface; - - /* Grab the color depth and masks from the surface description */ - pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask; - pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask; - pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask; - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDD - Returning\n"); -#endif - - return TRUE; -} - - -/* - * Transfer the damaged regions of the shadow framebuffer to the display. - */ - -static void -winShadowUpdateDD (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = shadowDamage(pBuf); - HRESULT ddrval = DD_OK; - RECT rcDest, rcSrc; - POINT ptOrigin; - DWORD dwBox = RegionNumRects (damage); - BoxPtr pBox = RegionRects (damage); - HRGN hrgnTemp = NULL, hrgnCombined = NULL; - - /* - * Return immediately if the app is not active - * and we are fullscreen, or if we have a bad display depth - */ - if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) - || pScreenPriv->fBadDepth) return; - - /* Get the origin of the window in the screen coords */ - ptOrigin.x = pScreenInfo->dwXOffset; - ptOrigin.y = pScreenInfo->dwYOffset; - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&ptOrigin, 1); - - /* Unlock the shadow surface, so we can blit */ - ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); - if (FAILED (ddrval)) - { - ErrorF ("winShadowUpdateDD - Unlock failed\n"); - return; - } - - /* - * Handle small regions with multiple blits, - * handle large regions by creating a clipping region and - * doing a single blit constrained to that clipping region. - */ - if (pScreenInfo->dwClipUpdatesNBoxes == 0 - || dwBox < pScreenInfo->dwClipUpdatesNBoxes) - { - /* Loop through all boxes in the damaged region */ - while (dwBox--) - { - /* Assign damage box to source rectangle */ - rcSrc.left = pBox->x1; - rcSrc.top = pBox->y1; - rcSrc.right = pBox->x2; - rcSrc.bottom = pBox->y2; - - /* Calculate destination rectange */ - rcDest.left = ptOrigin.x + rcSrc.left; - rcDest.top = ptOrigin.y + rcSrc.top; - rcDest.right = ptOrigin.x + rcSrc.right; - rcDest.bottom = ptOrigin.y + rcSrc.bottom; - - /* Blit the damaged areas */ - ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, - &rcDest, - pScreenPriv->pddsShadow, - &rcSrc, - DDBLT_WAIT, - NULL); - - /* Get a pointer to the next box */ - ++pBox; - } - } - else - { - BoxPtr pBoxExtents = RegionExtents(damage); - - /* Compute a GDI region from the damaged region */ - hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); - dwBox--; - pBox++; - while (dwBox--) - { - hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); - CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); - DeleteObject (hrgnTemp); - pBox++; - } - - /* Install the GDI region as a clipping region */ - SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); - DeleteObject (hrgnCombined); - hrgnCombined = NULL; - - /* Calculating a bounding box for the source is easy */ - rcSrc.left = pBoxExtents->x1; - rcSrc.top = pBoxExtents->y1; - rcSrc.right = pBoxExtents->x2; - rcSrc.bottom = pBoxExtents->y2; - - /* Calculating a bounding box for the destination is trickier */ - rcDest.left = ptOrigin.x + rcSrc.left; - rcDest.top = ptOrigin.y + rcSrc.top; - rcDest.right = ptOrigin.x + rcSrc.right; - rcDest.bottom = ptOrigin.y + rcSrc.bottom; - - /* Our Blt should be clipped to the invalidated region */ - ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, - &rcDest, - pScreenPriv->pddsShadow, - &rcSrc, - DDBLT_WAIT, - NULL); - - /* Reset the clip region */ - SelectClipRgn (pScreenPriv->hdcScreen, NULL); - } - - /* Relock the shadow surface */ - ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, - NULL, - pScreenPriv->pddsdShadow, - DDLOCK_WAIT, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winShadowUpdateDD - Lock failed\n"); - return; - } - - /* Has our memory pointer changed? */ - if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) - { - ErrorF ("winShadowUpdateDD - Memory location of the shadow " - "surface has changed, trying to update the root window " - "pixmap header to point to the new address. If you get " - "this message and "PROJECT_NAME" freezes or crashes " - "after this message then send a problem report and your " - "%s file to " BUILDERADDR "\n", g_pszLogFile); - - /* Location of shadow framebuffer has changed */ - pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface; - - /* Update the screen pixmap */ - if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, - pScreen->width, - pScreen->height, - pScreen->rootDepth, - BitsPerPixel (pScreen->rootDepth), - PixmapBytePad (pScreenInfo->dwStride, - pScreenInfo->dwBPP), - pScreenInfo->pfb)) - { - ErrorF ("winShadowUpdateDD - Bits changed, could not " - "notify fb.\n"); - return; - } - } -} - - -/* - * Call the wrapped CloseScreen function. - * - * Free our resources and private structures. - */ - -static Bool -winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - Bool fReturn; - -#if CYGDEBUG - winDebug ("winCloseScreenShadowDD - Freeing screen resources\n"); -#endif - - /* Flag that the screen is closed */ - pScreenPriv->fClosed = TRUE; - pScreenPriv->fActive = FALSE; - - /* Call the wrapped CloseScreen procedure */ - WIN_UNWRAP(CloseScreen); - fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); - - /* Free the screen DC */ - ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); - - /* Delete the window property */ - RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - - /* Free the shadow surface, if there is one */ - if (pScreenPriv->pddsShadow) - { - IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); - IDirectDrawSurface2_Release (pScreenPriv->pddsShadow); - pScreenPriv->pddsShadow = NULL; - } - - /* Detach the clipper from the primary surface and release the clipper. */ - if (pScreenPriv->pddcPrimary) - { - /* Detach the clipper */ - IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, - NULL); - - /* Release the clipper object */ - IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); - pScreenPriv->pddcPrimary = NULL; - } - - /* Release the primary surface, if there is one */ - if (pScreenPriv->pddsPrimary) - { - IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); - pScreenPriv->pddsPrimary = NULL; - } - - /* Free the DirectDraw2 object, if there is one */ - if (pScreenPriv->pdd2) - { - IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2); - IDirectDraw2_Release (pScreenPriv->pdd2); - pScreenPriv->pdd2 = NULL; - } - - /* Free the DirectDraw object, if there is one */ - if (pScreenPriv->pdd) - { - IDirectDraw_Release (pScreenPriv->pdd); - pScreenPriv->pdd = NULL; - } - - /* Delete tray icon, if we have one */ - if (!pScreenInfo->fNoTrayIcon) - winDeleteNotifyIcon (pScreenPriv); - - /* Free the exit confirmation dialog box, if it exists */ - if (g_hDlgExit != NULL) - { - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - } - - /* Kill our window */ - if (pScreenPriv->hwndScreen) - { - DestroyWindow (pScreenPriv->hwndScreen); - pScreenPriv->hwndScreen = NULL; - } - -#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) - /* Destroy the thread startup mutex */ - pthread_mutex_destroy (&pScreenPriv->pmServerStarted); -#endif - - /* Kill our screeninfo's pointer to the screen */ - pScreenInfo->pScreen = NULL; - - /* Invalidate the ScreenInfo's fb pointer */ - pScreenInfo->pfb = NULL; - - /* Free the screen privates for this screen */ - free ((pointer) pScreenPriv); - - return fReturn; -} - - -/* - * Tell mi what sort of visuals we need. - * - * Generally we only need one visual, as our screen can only - * handle one format at a time, I believe. You may want - * to verify that last sentence. - */ - -static Bool -winInitVisualsShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - DWORD dwRedBits, dwGreenBits, dwBlueBits; - - /* Count the number of ones in each color mask */ - dwRedBits = winCountBits (pScreenPriv->dwRedMask); - dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); - dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); - - /* Store the maximum number of ones in a color mask as the bitsPerRGB */ - if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0) - pScreenPriv->dwBitsPerRGB = 8; - else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) - pScreenPriv->dwBitsPerRGB = dwRedBits; - else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) - pScreenPriv->dwBitsPerRGB = dwGreenBits; - else - pScreenPriv->dwBitsPerRGB = dwBlueBits; - - ErrorF ("winInitVisualsShadowDD - Masks %08x %08x %08x BPRGB %d d %d " - "bpp %d\n", - (unsigned int) pScreenPriv->dwRedMask, - (unsigned int) pScreenPriv->dwGreenMask, - (unsigned int) pScreenPriv->dwBlueMask, - (int) pScreenPriv->dwBitsPerRGB, - (int) pScreenInfo->dwDepth, - (int) pScreenInfo->dwBPP); - - /* Create a single visual according to the Windows screen depth */ - switch (pScreenInfo->dwDepth) - { - case 24: - case 16: - case 15: - /* Create the real visual */ - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - TrueColorMask, - pScreenPriv->dwBitsPerRGB, - TrueColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " - "failed for TrueColor\n"); - return FALSE; - } - -#ifdef XWIN_EMULATEPSEUDO - if (!pScreenInfo->fEmulatePseudo) - break; - - /* Setup a pseudocolor visual */ - if (!miSetVisualTypesAndMasks (8, - PseudoColorMask, - 8, - -1, - 0, - 0, - 0)) - { - ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " - "failed for PseudoColor\n"); - return FALSE; - } -#endif - break; - - case 8: - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - pScreenInfo->fFullScreen - ? PseudoColorMask : StaticColorMask, - pScreenPriv->dwBitsPerRGB, - pScreenInfo->fFullScreen - ? PseudoColor : StaticColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " - "failed\n"); - return FALSE; - } - break; - - default: - ErrorF ("winInitVisualsShadowDD - Unknown screen depth\n"); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winInitVisualsShadowDD - Returning\n"); -#endif - - return TRUE; -} - - -/* - * Adjust the user proposed video mode - */ - -static Bool -winAdjustVideoModeShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HDC hdc = NULL; - DWORD dwBPP; - - /* We're in serious trouble if we can't get a DC */ - hdc = GetDC (NULL); - if (hdc == NULL) - { - ErrorF ("winAdjustVideoModeShadowDD - GetDC () failed\n"); - return FALSE; - } - - /* Query GDI for current display depth */ - dwBPP = GetDeviceCaps (hdc, BITSPIXEL); - - /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) - { - /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeShadowDD - Using Windows display " - "depth of %d bits per pixel\n", (int) dwBPP); - - /* Use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - else if (pScreenInfo->fFullScreen - && pScreenInfo->dwBPP != dwBPP) - { - /* FullScreen, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModeShadowDD - FullScreen, using command line " - "bpp: %d\n", (int) pScreenInfo->dwBPP); - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Windowed, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModeShadowDD - Windowed, command line bpp: " - "%d, using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP); - - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - - /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP - >= WIN_DIB_MAXIMUM_SIZE) - { - ErrorF ("winAdjustVideoModeShadowDD - Requested DirectDraw surface " - "will be larger than %d MB. The surface may fail to be " - "allocated on Windows 95, 98, or Me, due to a %d MB limit in " - "DIB size. This limit does not apply to Windows NT/2000, and " - "this message may be ignored on those platforms.\n", - WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); - } - - /* Release our DC */ - ReleaseDC (NULL, hdc); - return TRUE; -} - - -/* - * Blt exposed regions to the screen - */ - -static Bool -winBltExposedRegionsShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RECT rcSrc, rcDest; - POINT ptOrigin; - HDC hdcUpdate = NULL; - PAINTSTRUCT ps; - HRESULT ddrval = DD_OK; - Bool fReturn = TRUE; - Bool fLocked = TRUE; - int i; - - /* BeginPaint gives us an hdc that clips to the invalidated region */ - hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); - if (hdcUpdate == NULL) - { - ErrorF ("winBltExposedRegionsShadowDD - BeginPaint () returned " - "a NULL device context handle. Aborting blit attempt.\n"); - return FALSE; - } - - /* Unlock the shadow surface, so we can blit */ - ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); - if (FAILED (ddrval)) - { - fReturn = FALSE; - goto winBltExposedRegionsShadowDD_Exit; - } - else - { - /* Flag that we have unlocked the shadow surface */ - fLocked = FALSE; - } - - /* Get the origin of the window in the screen coords */ - ptOrigin.x = pScreenInfo->dwXOffset; - ptOrigin.y = pScreenInfo->dwYOffset; - - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&ptOrigin, 1); - rcDest.left = ptOrigin.x; - rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; - rcDest.top = ptOrigin.y; - rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; - - /* Source can be enter shadow surface, as Blt should clip */ - rcSrc.left = 0; - rcSrc.top = 0; - rcSrc.right = pScreenInfo->dwWidth; - rcSrc.bottom = pScreenInfo->dwHeight; - - /* Try to regain the primary surface and blit again if we've lost it */ - for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) - { - /* Our Blt should be clipped to the invalidated region */ - ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, - &rcDest, - pScreenPriv->pddsShadow, - &rcSrc, - DDBLT_WAIT, - NULL); - if (ddrval == DDERR_SURFACELOST) - { - /* Surface was lost */ - ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt " - "reported that the primary surface was lost, " - "trying to restore, retry: %d\n", i + 1); - - /* Try to restore the surface, once */ - ddrval = IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); - ErrorF ("winBltExposedRegionsShadowDD - " - "IDirectDrawSurface2_Restore returned: "); - if (ddrval == DD_OK) - ErrorF ("DD_OK\n"); - else if (ddrval == DDERR_WRONGMODE) - ErrorF ("DDERR_WRONGMODE\n"); - else if (ddrval == DDERR_INCOMPATIBLEPRIMARY) - ErrorF ("DDERR_INCOMPATIBLEPRIMARY\n"); - else if (ddrval == DDERR_UNSUPPORTED) - ErrorF ("DDERR_UNSUPPORTED\n"); - else if (ddrval == DDERR_INVALIDPARAMS) - ErrorF ("DDERR_INVALIDPARAMS\n"); - else if (ddrval == DDERR_INVALIDOBJECT) - ErrorF ("DDERR_INVALIDOBJECT\n"); - else - ErrorF ("unknown error: %08x\n", (unsigned int) ddrval); - - /* Loop around to try the blit one more time */ - continue; - } - else if (FAILED (ddrval)) - { - fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt " - "failed, but surface not lost: %08x %d\n", - (unsigned int) ddrval, (int) ddrval); - goto winBltExposedRegionsShadowDD_Exit; - } - else - { - /* Success, stop looping */ - break; - } - } - - /* Relock the shadow surface */ - ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, - NULL, - pScreenPriv->pddsdShadow, - DDLOCK_WAIT, - NULL); - if (FAILED (ddrval)) - { - fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Lock " - "failed\n"); - goto winBltExposedRegionsShadowDD_Exit; - } - else - { - /* Indicate that we have relocked the shadow surface */ - fLocked = TRUE; - } - - /* Has our memory pointer changed? */ - if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) - winUpdateFBPointer (pScreen, - pScreenPriv->pddsdShadow->lpSurface); - - winBltExposedRegionsShadowDD_Exit: - /* EndPaint frees the DC */ - if (hdcUpdate != NULL) - EndPaint (pScreenPriv->hwndScreen, &ps); - - /* - * Relock the surface if it is not locked. We don't care if locking fails, - * as it will cause the server to shutdown within a few more operations. - */ - if (!fLocked) - { - IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, - NULL, - pScreenPriv->pddsdShadow, - DDLOCK_WAIT, - NULL); - - /* Has our memory pointer changed? */ - if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) - winUpdateFBPointer (pScreen, - pScreenPriv->pddsdShadow->lpSurface); - - fLocked = TRUE; - } - return fReturn; -} - - -/* - * Do any engine-specific appliation-activation processing - */ - -static Bool -winActivateAppShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - - /* - * Do we have a surface? - * Are we active? - * Are we fullscreen? - */ - if (pScreenPriv != NULL - && pScreenPriv->pddsPrimary != NULL - && pScreenPriv->fActive) - { - /* Primary surface was lost, restore it */ - IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); - } - - return TRUE; -} - - -/* - * Reblit the shadow framebuffer to the screen. - */ - -static Bool -winRedrawScreenShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HRESULT ddrval = DD_OK; - RECT rcSrc, rcDest; - POINT ptOrigin; - - /* Get the origin of the window in the screen coords */ - ptOrigin.x = pScreenInfo->dwXOffset; - ptOrigin.y = pScreenInfo->dwYOffset; - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&ptOrigin, 1); - rcDest.left = ptOrigin.x; - rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; - rcDest.top = ptOrigin.y; - rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; - - /* Source can be entire shadow surface, as Blt should clip for us */ - rcSrc.left = 0; - rcSrc.top = 0; - rcSrc.right = pScreenInfo->dwWidth; - rcSrc.bottom = pScreenInfo->dwHeight; - - /* Redraw the whole window, to take account for the new colors */ - ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, - &rcDest, - pScreenPriv->pddsShadow, - &rcSrc, - DDBLT_WAIT, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winRedrawScreenShadowDD - IDirectDrawSurface_Blt () " - "failed: %08x\n", - (unsigned int) ddrval); - } - - return TRUE; -} - - -/* - * Realize the currently installed colormap - */ - -static Bool -winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen) -{ - return TRUE; -} - - -/* - * Install the specified colormap - */ - -static Bool -winInstallColormapShadowDD (ColormapPtr pColormap) -{ - ScreenPtr pScreen = pColormap->pScreen; - winScreenPriv(pScreen); - winCmapPriv(pColormap); - HRESULT ddrval = DD_OK; - - /* Install the DirectDraw palette on the primary surface */ - ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary, - pCmapPriv->lpDDPalette); - if (FAILED (ddrval)) - { - ErrorF ("winInstallColormapShadowDD - Failed installing the " - "DirectDraw palette.\n"); - return FALSE; - } - - /* Save a pointer to the newly installed colormap */ - pScreenPriv->pcmapInstalled = pColormap; - - return TRUE; -} - - -/* - * Store the specified colors in the specified colormap - */ - -static Bool -winStoreColorsShadowDD (ColormapPtr pColormap, - int ndef, - xColorItem *pdefs) -{ - ScreenPtr pScreen = pColormap->pScreen; - winScreenPriv(pScreen); - winCmapPriv(pColormap); - ColormapPtr curpmap = pScreenPriv->pcmapInstalled; - HRESULT ddrval = DD_OK; - - /* Put the X colormap entries into the Windows logical palette */ - ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette, - 0, - pdefs[0].pixel, - ndef, - pCmapPriv->peColors - + pdefs[0].pixel); - if (FAILED (ddrval)) - { - ErrorF ("winStoreColorsShadowDD - SetEntries () failed\n"); - return FALSE; - } - - /* Don't install the DirectDraw palette if the colormap is not installed */ - if (pColormap != curpmap) - { - return TRUE; - } - - if (!winInstallColormapShadowDD (pColormap)) - { - ErrorF ("winStoreColorsShadowDD - Failed installing colormap\n"); - return FALSE; - } - - return TRUE; -} - - -/* - * Colormap initialization procedure - */ - -static Bool -winCreateColormapShadowDD (ColormapPtr pColormap) -{ - HRESULT ddrval = DD_OK; - ScreenPtr pScreen = pColormap->pScreen; - winScreenPriv(pScreen); - winCmapPriv(pColormap); - - /* Create a DirectDraw palette */ - ddrval = IDirectDraw2_CreatePalette (pScreenPriv->pdd, - DDPCAPS_8BIT | DDPCAPS_ALLOW256, - pCmapPriv->peColors, - &pCmapPriv->lpDDPalette, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winCreateColormapShadowDD - CreatePalette failed\n"); - return FALSE; - } - - return TRUE; -} - - -/* - * Colormap destruction procedure - */ - -static Bool -winDestroyColormapShadowDD (ColormapPtr pColormap) -{ - winScreenPriv(pColormap->pScreen); - winCmapPriv(pColormap); - HRESULT ddrval = DD_OK; - - /* - * Is colormap to be destroyed the default? - * - * Non-default colormaps should have had winUninstallColormap - * called on them before we get here. The default colormap - * will not have had winUninstallColormap called on it. Thus, - * we need to handle the default colormap in a special way. - */ - if (pColormap->flags & IsDefault) - { -#if CYGDEBUG - winDebug ("winDestroyColormapShadowDD - Destroying default " - "colormap\n"); -#endif - - /* - * FIXME: Walk the list of all screens, popping the default - * palette out of each screen device context. - */ - - /* Pop the palette out of the primary surface */ - ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winDestroyColormapShadowDD - Failed freeing the " - "default colormap DirectDraw palette.\n"); - return FALSE; - } - - /* Clear our private installed colormap pointer */ - pScreenPriv->pcmapInstalled = NULL; - } - - /* Release the palette */ - IDirectDrawPalette_Release (pCmapPriv->lpDDPalette); - - /* Invalidate the colormap privates */ - pCmapPriv->lpDDPalette = NULL; - - return TRUE; -} - - -/* - * Set engine specific functions - */ - -Bool -winSetEngineFunctionsShadowDD (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Set our pointers */ - pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD; - pScreenPriv->pwinShadowUpdate = winShadowUpdateDD; - pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD; - pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD; - pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD; - if (pScreenInfo->fFullScreen) - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; - else - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; - pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; - pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDD; - pScreenPriv->pwinActivateApp = winActivateAppShadowDD; - pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDD; - pScreenPriv->pwinRealizeInstalledPalette - = winRealizeInstalledPaletteShadowDD; - pScreenPriv->pwinInstallColormap = winInstallColormapShadowDD; - pScreenPriv->pwinStoreColors = winStoreColorsShadowDD; - pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD; - pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD; - pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; - pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD; - pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD; -#ifdef XWIN_MULTIWINDOW - pScreenPriv->pwinFinishCreateWindowsWindow = - (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA; -#endif - - return TRUE; -} +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" + + +/* + * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, + * so we have to redefine it here. + */ +#ifdef DEFINE_GUID +#undef DEFINE_GUID +#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} +#endif /* DEFINE_GUID */ + + +/* + * FIXME: Headers are broken, IID_IDirectDraw2 has to be defined + * here manually. Should be handled by ddraw.h + */ +#ifndef IID_IDirectDraw2 +DEFINE_GUID( IID_IDirectDraw2,0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +#endif /* IID_IDirectDraw2 */ + + +/* + * Local prototypes + */ + +static Bool +winAllocateFBShadowDD (ScreenPtr pScreen); + +static void +winShadowUpdateDD (ScreenPtr pScreen, + shadowBufPtr pBuf); + +static Bool +winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen); + +static Bool +winInitVisualsShadowDD (ScreenPtr pScreen); + +static Bool +winAdjustVideoModeShadowDD (ScreenPtr pScreen); + +static Bool +winBltExposedRegionsShadowDD (ScreenPtr pScreen); + +static Bool +winActivateAppShadowDD (ScreenPtr pScreen); + +static Bool +winRedrawScreenShadowDD (ScreenPtr pScreen); + +static Bool +winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen); + +static Bool +winInstallColormapShadowDD (ColormapPtr pColormap); + +static Bool +winStoreColorsShadowDD (ColormapPtr pmap, + int ndef, + xColorItem *pdefs); + +static Bool +winCreateColormapShadowDD (ColormapPtr pColormap); + +static Bool +winDestroyColormapShadowDD (ColormapPtr pColormap); + +static Bool +winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen); + +static Bool +winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen); + + +/* + * Create the primary surface and attach the clipper. + * Used for both the initial surface creation and during + * WM_DISPLAYCHANGE messages. + */ + +static Bool +winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + HRESULT ddrval = DD_OK; + DDSURFACEDESC ddsd; + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winCreatePrimarySurfaceShadowDD - Could not create primary " + "surface: %08x\n", (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winCreatePrimarySurfaceShadowDD - Created primary surface\n"); +#endif + + /* + * Attach a clipper to the primary surface that will clip our blits to our + * display window. + */ + ddrval = IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, + pScreenPriv->pddcPrimary); + if (FAILED (ddrval)) + { + ErrorF ("winCreatePrimarySurfaceShadowDD - Primary attach clipper " + "failed: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winCreatePrimarySurfaceShadowDD - Attached clipper to " + "primary surface\n"); +#endif + + /* Everything was correct */ + return TRUE; +} + + +/* + * Detach the clipper and release the primary surface. + * Called from WM_DISPLAYCHANGE. + */ + +static Bool +winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + ErrorF ("winReleasePrimarySurfaceShadowDD - Hello\n"); + + /* Release the primary surface and clipper, if they exist */ + if (pScreenPriv->pddsPrimary) + { + /* + * Detach the clipper from the primary surface. + * NOTE: We do this explicity for clarity. The Clipper is not released. + */ + IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, + NULL); + + ErrorF ("winReleasePrimarySurfaceShadowDD - Detached clipper\n"); + + /* Release the primary surface */ + IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); + pScreenPriv->pddsPrimary = NULL; + } + + ErrorF ("winReleasePrimarySurfaceShadowDD - Released primary surface\n"); + + return TRUE; +} + + +/* + * Create a DirectDraw surface for the shadow framebuffer; also create + * a primary surface object so we can blit to the display. + * + * Install a DirectDraw clipper on our primary surface object + * that clips our blits to the unobscured client area of our display window. + */ + +static Bool +winAllocateFBShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC ddsd; + DDSURFACEDESC *pddsdShadow = NULL; + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDD\n"); +#endif + + /* Create a clipper */ + ddrval = (*g_fpDirectDrawCreateClipper) (0, + &pScreenPriv->pddcPrimary, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not create clipper: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDD - Created a clipper\n"); +#endif + + /* Attach the clipper to our display window */ + ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, + 0, + pScreenPriv->hwndScreen); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Clipper not attached to " + "window: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDD - Attached clipper to window\n"); +#endif + + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not start DirectDraw: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDD () - Created and initialized DD\n"); +#endif + + /* Get a DirectDraw2 interface pointer */ + ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, + &IID_IDirectDraw2, + (LPVOID*) &pScreenPriv->pdd2); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + + /* Are we full screen? */ + if (pScreenInfo->fFullScreen) + { + DDSURFACEDESC ddsdCurrent; + DWORD dwRefreshRateCurrent = 0; + HDC hdc = NULL; + + /* Set the cooperative level to full screen */ + ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, + pScreenPriv->hwndScreen, + DDSCL_EXCLUSIVE + | DDSCL_FULLSCREEN); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not set " + "cooperative level: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + + /* + * We only need to get the current refresh rate for comparison + * if a refresh rate has been passed on the command line. + */ + if (pScreenInfo->dwRefreshRate != 0) + { + ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent)); + ddsdCurrent.dwSize = sizeof (ddsdCurrent); + + /* Get information about current display settings */ + ddrval = IDirectDraw2_GetDisplayMode (pScreenPriv->pdd2, + &ddsdCurrent); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not get current " + "refresh rate: %08x. Continuing.\n", + (unsigned int) ddrval); + dwRefreshRateCurrent = 0; + } + else + { + /* Grab the current refresh rate */ + dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate; + } + } + + /* Clean up the refresh rate */ + if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) + { + /* + * Refresh rate is non-specified or equal to current. + */ + pScreenInfo->dwRefreshRate = 0; + } + + /* Grab a device context for the screen */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAllocateFBShadowDD - GetDC () failed\n"); + return FALSE; + } + + /* Only change the video mode when different than current mode */ + if (!pScreenInfo->fMultipleMonitors + && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) + || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) + || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL) + || pScreenInfo->dwRefreshRate != 0)) + { + ErrorF ("winAllocateFBShadowDD - Changing video mode\n"); + + /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ + ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + pScreenInfo->dwRefreshRate, + 0); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not set "\ + "full screen display mode: %08x\n", + (unsigned int) ddrval); + ErrorF ("winAllocateFBShadowDD - Using default driver refresh rate\n"); + ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + 0, + 0); + if (FAILED(ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not set default refresh rate " + "full screen display mode: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + } + } + else + { + ErrorF ("winAllocateFBShadowDD - Not changing video mode\n"); + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + hdc = NULL; + } + else + { + /* Set the cooperative level for windowed mode */ + ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not set "\ + "cooperative level: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + } + + /* Create the primary surface */ + if (!winCreatePrimarySurfaceShadowDD (pScreen)) + { + ErrorF ("winAllocateFBShadowDD - winCreatePrimarySurfaceShadowDD " + "failed\n"); + return FALSE; + } + + /* Describe the shadow surface to be created */ + /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, + * as drawing, locking, and unlocking take forever + * with video memory surfaces. In addition, + * video memory is a somewhat scarce resource, + * so you shouldn't be allocating video memory when + * you have the option of using system memory instead. + */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsd.dwHeight = pScreenInfo->dwHeight; + ddsd.dwWidth = pScreenInfo->dwWidth; + + /* Create the shadow surface */ + ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2, + &ddsd, + &pScreenPriv->pddsShadow, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD - Could not create shadow "\ + "surface: %08x\n", (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDD - Created shadow\n"); +#endif + + /* Allocate a DD surface description for our screen privates */ + pddsdShadow = pScreenPriv->pddsdShadow = malloc (sizeof (DDSURFACEDESC)); + if (pddsdShadow == NULL) + { + ErrorF ("winAllocateFBShadowDD - Could not allocate surface "\ + "description memory\n"); + return FALSE; + } + ZeroMemory (pddsdShadow, sizeof (*pddsdShadow)); + pddsdShadow->dwSize = sizeof (*pddsdShadow); + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDD - Locking shadow\n"); +#endif + + /* Lock the shadow surface */ + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, + NULL, + pddsdShadow, + DDLOCK_WAIT, + NULL); + if (FAILED (ddrval) || pddsdShadow->lpSurface == NULL) + { + ErrorF ("winAllocateFBShadowDD - Could not lock shadow "\ + "surface: %08x\n", (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDD - Locked shadow\n"); +#endif + + /* We don't know how to deal with anything other than RGB */ + if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB)) + { + ErrorF ("winAllocateFBShadowDD - Color format other than RGB\n"); + return FALSE; + } + + /* Grab the pitch from the surface desc */ + pScreenInfo->dwStride = (pddsdShadow->u1.lPitch * 8) + / pScreenInfo->dwBPP; + + /* Save the pointer to our surface memory */ + pScreenInfo->pfb = pddsdShadow->lpSurface; + + /* Grab the color depth and masks from the surface description */ + pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask; + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDD - Returning\n"); +#endif + + return TRUE; +} + +static void +winFreeFBShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Free the shadow surface, if there is one */ + if (pScreenPriv->pddsShadow) + { + IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); + IDirectDrawSurface2_Release (pScreenPriv->pddsShadow); + pScreenPriv->pddsShadow = NULL; + } + + /* Detach the clipper from the primary surface and release the primary surface, if there is one */ + winReleasePrimarySurfaceShadowDD(pScreen); + + /* Release the clipper object */ + if (pScreenPriv->pddcPrimary) + { + IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); + pScreenPriv->pddcPrimary = NULL; + } + + /* Free the DirectDraw2 object, if there is one */ + if (pScreenPriv->pdd2) + { + IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2); + IDirectDraw2_Release (pScreenPriv->pdd2); + pScreenPriv->pdd2 = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; +} + +/* + * Transfer the damaged regions of the shadow framebuffer to the display. + */ + +static void +winShadowUpdateDD (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RegionPtr damage = shadowDamage(pBuf); + HRESULT ddrval = DD_OK; + RECT rcDest, rcSrc; + POINT ptOrigin; + DWORD dwBox = RegionNumRects (damage); + BoxPtr pBox = RegionRects (damage); + HRGN hrgnTemp = NULL, hrgnCombined = NULL; + + /* + * Return immediately if the app is not active + * and we are fullscreen, or if we have a bad display depth + */ + if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) + || pScreenPriv->fBadDepth) return; + + /* Return immediately if we didn't get needed surfaces */ + if (!pScreenPriv->pddsPrimary || !pScreenPriv->pddsShadow) + return; + + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&ptOrigin, 1); + + /* Unlock the shadow surface, so we can blit */ + ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); + if (FAILED (ddrval)) + { + ErrorF ("winShadowUpdateDD - Unlock failed\n"); + return; + } + + /* + * Handle small regions with multiple blits, + * handle large regions by creating a clipping region and + * doing a single blit constrained to that clipping region. + */ + if (pScreenInfo->dwClipUpdatesNBoxes == 0 + || dwBox < pScreenInfo->dwClipUpdatesNBoxes) + { + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Assign damage box to source rectangle */ + rcSrc.left = pBox->x1; + rcSrc.top = pBox->y1; + rcSrc.right = pBox->x2; + rcSrc.bottom = pBox->y2; + + /* Calculate destination rectange */ + rcDest.left = ptOrigin.x + rcSrc.left; + rcDest.top = ptOrigin.y + rcSrc.top; + rcDest.right = ptOrigin.x + rcSrc.right; + rcDest.bottom = ptOrigin.y + rcSrc.bottom; + + /* Blit the damaged areas */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcDest, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + + /* Get a pointer to the next box */ + ++pBox; + } + } + else + { + BoxPtr pBoxExtents = RegionExtents(damage); + + /* Compute a GDI region from the damaged region */ + hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + dwBox--; + pBox++; + while (dwBox--) + { + hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); + DeleteObject (hrgnTemp); + pBox++; + } + + /* Install the GDI region as a clipping region */ + SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); + DeleteObject (hrgnCombined); + hrgnCombined = NULL; + + /* Calculating a bounding box for the source is easy */ + rcSrc.left = pBoxExtents->x1; + rcSrc.top = pBoxExtents->y1; + rcSrc.right = pBoxExtents->x2; + rcSrc.bottom = pBoxExtents->y2; + + /* Calculating a bounding box for the destination is trickier */ + rcDest.left = ptOrigin.x + rcSrc.left; + rcDest.top = ptOrigin.y + rcSrc.top; + rcDest.right = ptOrigin.x + rcSrc.right; + rcDest.bottom = ptOrigin.y + rcSrc.bottom; + + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcDest, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + + /* Reset the clip region */ + SelectClipRgn (pScreenPriv->hdcScreen, NULL); + } + + /* Relock the shadow surface */ + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winShadowUpdateDD - Lock failed\n"); + return; + } + + /* Has our memory pointer changed? */ + if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) + { + ErrorF ("winShadowUpdateDD - Memory location of the shadow " + "surface has changed, trying to update the root window " + "pixmap header to point to the new address. If you get " + "this message and "PROJECT_NAME" freezes or crashes " + "after this message then send a problem report and your " + "%s file to " BUILDERADDR "\n", g_pszLogFile); + + /* Location of shadow framebuffer has changed */ + winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface); + } +} + +static Bool +winInitScreenShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Get a device context for the screen */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + + return winAllocateFBShadowDD(pScreen); +} + +/* + * Call the wrapped CloseScreen function. + * + * Free our resources and private structures. + */ + +static Bool +winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + +#if CYGDEBUG + winDebug ("winCloseScreenShadowDD - Freeing screen resources\n"); +#endif + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + WIN_UNWRAP(CloseScreen); + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + winFreeFBShadowDD(pScreen); + + /* Free the screen DC */ + ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Delete tray icon, if we have one */ + if (!pScreenInfo->fNoTrayIcon) + winDeleteNotifyIcon (pScreenPriv); + + /* Free the exit confirmation dialog box, if it exists */ + if (g_hDlgExit != NULL) + { + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + } + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) + /* Destroy the thread startup mutex */ + pthread_mutex_destroy (&pScreenPriv->pmServerStarted); +#endif + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Free the screen privates for this screen */ + free ((pointer) pScreenPriv); + + return fReturn; +} + + +/* + * Tell mi what sort of visuals we need. + * + * Generally we only need one visual, as our screen can only + * handle one format at a time, I believe. You may want + * to verify that last sentence. + */ + +static Bool +winInitVisualsShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0) + pScreenPriv->dwBitsPerRGB = 8; + else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + ErrorF ("winInitVisualsShadowDD - Masks %08x %08x %08x BPRGB %d d %d " + "bpp %d\n", + (unsigned int) pScreenPriv->dwRedMask, + (unsigned int) pScreenPriv->dwGreenMask, + (unsigned int) pScreenPriv->dwBlueMask, + (int) pScreenPriv->dwBitsPerRGB, + (int) pScreenInfo->dwDepth, + (int) pScreenInfo->dwBPP); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 24: + case 16: + case 15: + /* Create the real visual */ + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " + "failed for TrueColor\n"); + return FALSE; + } + +#ifdef XWIN_EMULATEPSEUDO + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!miSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + -1, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " + "failed for PseudoColor\n"); + return FALSE; + } +#endif + break; + + case 8: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + pScreenInfo->fFullScreen + ? PseudoColorMask : StaticColorMask, + pScreenPriv->dwBitsPerRGB, + pScreenInfo->fFullScreen + ? PseudoColor : StaticColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks " + "failed\n"); + return FALSE; + } + break; + + default: + ErrorF ("winInitVisualsShadowDD - Unknown screen depth\n"); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winInitVisualsShadowDD - Returning\n"); +#endif + + return TRUE; +} + + +/* + * Adjust the user proposed video mode + */ + +static Bool +winAdjustVideoModeShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwBPP; + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModeShadowDD - GetDC () failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); + + /* DirectDraw can only change the depth in fullscreen mode */ + if (!(pScreenInfo->fFullScreen && + (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) + { + /* Otherwise, We'll use GDI's depth */ + pScreenInfo->dwBPP = dwBPP; + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + return TRUE; +} + + +/* + * Blt exposed regions to the screen + */ + +static Bool +winBltExposedRegionsShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RECT rcSrc, rcDest; + POINT ptOrigin; + HDC hdcUpdate = NULL; + PAINTSTRUCT ps; + HRESULT ddrval = DD_OK; + Bool fReturn = TRUE; + Bool fLocked = TRUE; + int i; + + /* BeginPaint gives us an hdc that clips to the invalidated region */ + hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); + if (hdcUpdate == NULL) + { + ErrorF ("winBltExposedRegionsShadowDD - BeginPaint () returned " + "a NULL device context handle. Aborting blit attempt.\n"); + return FALSE; + } + + /* Unlock the shadow surface, so we can blit */ + ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); + if (FAILED (ddrval)) + { + fReturn = FALSE; + goto winBltExposedRegionsShadowDD_Exit; + } + else + { + /* Flag that we have unlocked the shadow surface */ + fLocked = FALSE; + } + + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; + + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&ptOrigin, 1); + rcDest.left = ptOrigin.x; + rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; + rcDest.top = ptOrigin.y; + rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; + + /* Source can be enter shadow surface, as Blt should clip */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Try to regain the primary surface and blit again if we've lost it */ + for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) + { + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcDest, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + if (ddrval == DDERR_SURFACELOST) + { + /* Surface was lost */ + ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt " + "reported that the primary surface was lost, " + "trying to restore, retry: %d\n", i + 1); + + /* Try to restore the surface, once */ + ddrval = IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); + ErrorF ("winBltExposedRegionsShadowDD - " + "IDirectDrawSurface2_Restore returned: "); + if (ddrval == DD_OK) + ErrorF ("DD_OK\n"); + else if (ddrval == DDERR_WRONGMODE) + ErrorF ("DDERR_WRONGMODE\n"); + else if (ddrval == DDERR_INCOMPATIBLEPRIMARY) + ErrorF ("DDERR_INCOMPATIBLEPRIMARY\n"); + else if (ddrval == DDERR_UNSUPPORTED) + ErrorF ("DDERR_UNSUPPORTED\n"); + else if (ddrval == DDERR_INVALIDPARAMS) + ErrorF ("DDERR_INVALIDPARAMS\n"); + else if (ddrval == DDERR_INVALIDOBJECT) + ErrorF ("DDERR_INVALIDOBJECT\n"); + else + ErrorF ("unknown error: %08x\n", (unsigned int) ddrval); + + /* Loop around to try the blit one more time */ + continue; + } + else if (FAILED (ddrval)) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt " + "failed, but surface not lost: %08x %d\n", + (unsigned int) ddrval, (int) ddrval); + goto winBltExposedRegionsShadowDD_Exit; + } + else + { + /* Success, stop looping */ + break; + } + } + + /* Relock the shadow surface */ + ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); + if (FAILED (ddrval)) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Lock " + "failed\n"); + goto winBltExposedRegionsShadowDD_Exit; + } + else + { + /* Indicate that we have relocked the shadow surface */ + fLocked = TRUE; + } + + /* Has our memory pointer changed? */ + if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdShadow->lpSurface); + + winBltExposedRegionsShadowDD_Exit: + /* EndPaint frees the DC */ + if (hdcUpdate != NULL) + EndPaint (pScreenPriv->hwndScreen, &ps); + + /* + * Relock the surface if it is not locked. We don't care if locking fails, + * as it will cause the server to shutdown within a few more operations. + */ + if (!fLocked) + { + IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); + + /* Has our memory pointer changed? */ + if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdShadow->lpSurface); + + fLocked = TRUE; + } + return fReturn; +} + + +/* + * Do any engine-specific appliation-activation processing + */ + +static Bool +winActivateAppShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* + * Do we have a surface? + * Are we active? + * Are we fullscreen? + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary != NULL + && pScreenPriv->fActive) + { + /* Primary surface was lost, restore it */ + IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary); + } + + return TRUE; +} + + +/* + * Reblit the shadow framebuffer to the screen. + */ + +static Bool +winRedrawScreenShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + RECT rcSrc, rcDest; + POINT ptOrigin; + + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&ptOrigin, 1); + rcDest.left = ptOrigin.x; + rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; + rcDest.top = ptOrigin.y; + rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; + + /* Source can be entire shadow surface, as Blt should clip for us */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Redraw the whole window, to take account for the new colors */ + ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary, + &rcDest, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winRedrawScreenShadowDD - IDirectDrawSurface_Blt () " + "failed: %08x\n", + (unsigned int) ddrval); + } + + return TRUE; +} + + +/* + * Realize the currently installed colormap + */ + +static Bool +winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen) +{ + return TRUE; +} + + +/* + * Install the specified colormap + */ + +static Bool +winInstallColormapShadowDD (ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + HRESULT ddrval = DD_OK; + + /* Install the DirectDraw palette on the primary surface */ + ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary, + pCmapPriv->lpDDPalette); + if (FAILED (ddrval)) + { + ErrorF ("winInstallColormapShadowDD - Failed installing the " + "DirectDraw palette.\n"); + return FALSE; + } + + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; + + return TRUE; +} + + +/* + * Store the specified colors in the specified colormap + */ + +static Bool +winStoreColorsShadowDD (ColormapPtr pColormap, + int ndef, + xColorItem *pdefs) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + HRESULT ddrval = DD_OK; + + /* Put the X colormap entries into the Windows logical palette */ + ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette, + 0, + pdefs[0].pixel, + ndef, + pCmapPriv->peColors + + pdefs[0].pixel); + if (FAILED (ddrval)) + { + ErrorF ("winStoreColorsShadowDD - SetEntries () failed\n"); + return FALSE; + } + + /* Don't install the DirectDraw palette if the colormap is not installed */ + if (pColormap != curpmap) + { + return TRUE; + } + + if (!winInstallColormapShadowDD (pColormap)) + { + ErrorF ("winStoreColorsShadowDD - Failed installing colormap\n"); + return FALSE; + } + + return TRUE; +} + + +/* + * Colormap initialization procedure + */ + +static Bool +winCreateColormapShadowDD (ColormapPtr pColormap) +{ + HRESULT ddrval = DD_OK; + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + + /* Create a DirectDraw palette */ + ddrval = IDirectDraw2_CreatePalette (pScreenPriv->pdd, + DDPCAPS_8BIT | DDPCAPS_ALLOW256, + pCmapPriv->peColors, + &pCmapPriv->lpDDPalette, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winCreateColormapShadowDD - CreatePalette failed\n"); + return FALSE; + } + + return TRUE; +} + + +/* + * Colormap destruction procedure + */ + +static Bool +winDestroyColormapShadowDD (ColormapPtr pColormap) +{ + winScreenPriv(pColormap->pScreen); + winCmapPriv(pColormap); + HRESULT ddrval = DD_OK; + + /* + * Is colormap to be destroyed the default? + * + * Non-default colormaps should have had winUninstallColormap + * called on them before we get here. The default colormap + * will not have had winUninstallColormap called on it. Thus, + * we need to handle the default colormap in a special way. + */ + if (pColormap->flags & IsDefault) + { +#if CYGDEBUG + winDebug ("winDestroyColormapShadowDD - Destroying default " + "colormap\n"); +#endif + + /* + * FIXME: Walk the list of all screens, popping the default + * palette out of each screen device context. + */ + + /* Pop the palette out of the primary surface */ + ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winDestroyColormapShadowDD - Failed freeing the " + "default colormap DirectDraw palette.\n"); + return FALSE; + } + + /* Clear our private installed colormap pointer */ + pScreenPriv->pcmapInstalled = NULL; + } + + /* Release the palette */ + IDirectDrawPalette_Release (pCmapPriv->lpDDPalette); + + /* Invalidate the colormap privates */ + pCmapPriv->lpDDPalette = NULL; + + return TRUE; +} + + +/* + * Set engine specific functions + */ + +Bool +winSetEngineFunctionsShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD; + pScreenPriv->pwinFreeFB = winFreeFBShadowDD; + pScreenPriv->pwinShadowUpdate = winShadowUpdateDD; + pScreenPriv->pwinInitScreen = winInitScreenShadowDD; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDD; + pScreenPriv->pwinActivateApp = winActivateAppShadowDD; + pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDD; + pScreenPriv->pwinRealizeInstalledPalette + = winRealizeInstalledPaletteShadowDD; + pScreenPriv->pwinInstallColormap = winInstallColormapShadowDD; + pScreenPriv->pwinStoreColors = winStoreColorsShadowDD; + pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD; + pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD; + pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD; +#ifdef XWIN_MULTIWINDOW + pScreenPriv->pwinFinishCreateWindowsWindow = + (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA; +#endif + + return TRUE; +} diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c index 0ce5d8d85..0a0b4ae13 100644 --- a/xorg-server/hw/xwin/winshadddnl.c +++ b/xorg-server/hw/xwin/winshadddnl.c @@ -1,1412 +1,1396 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *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 XFREE86 PROJECT 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 XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Dakshinamurthy Karra - * Suhaib M Siddiqi - * Peter Busch - * Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - - -/* - * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, - * so we have to redefine it here. - */ -#ifdef DEFINE_GUID -#undef DEFINE_GUID -#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} -#endif /* DEFINE_GUID */ - -/* - * FIXME: Headers are broken, IID_IDirectDraw4 has to be defined - * here manually. Should be handled by ddraw.h - */ -#ifndef IID_IDirectDraw4 -DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); -#endif /* IID_IDirectDraw4 */ - -#define FAIL_MSG_MAX_BLT 10 - - -/* - * Local prototypes - */ - -static Bool -winAllocateFBShadowDDNL (ScreenPtr pScreen); - -static void -winShadowUpdateDDNL (ScreenPtr pScreen, - shadowBufPtr pBuf); - -static Bool -winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen); - -static Bool -winInitVisualsShadowDDNL (ScreenPtr pScreen); - -static Bool -winAdjustVideoModeShadowDDNL (ScreenPtr pScreen); - -static Bool -winBltExposedRegionsShadowDDNL (ScreenPtr pScreen); - -static Bool -winActivateAppShadowDDNL (ScreenPtr pScreen); - -static Bool -winRedrawScreenShadowDDNL (ScreenPtr pScreen); - -static Bool -winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen); - -static Bool -winInstallColormapShadowDDNL (ColormapPtr pColormap); - -static Bool -winStoreColorsShadowDDNL (ColormapPtr pmap, - int ndef, - xColorItem *pdefs); - -static Bool -winCreateColormapShadowDDNL (ColormapPtr pColormap); - -static Bool -winDestroyColormapShadowDDNL (ColormapPtr pColormap); - -static Bool -winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen); - -static Bool -winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen); - - -/* - * Create the primary surface and attach the clipper. - * Used for both the initial surface creation and during - * WM_DISPLAYCHANGE messages. - */ - -static Bool -winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - HRESULT ddrval = DD_OK; - DDSURFACEDESC2 ddsd; - - winDebug ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n"); - - /* Describe the primary surface */ - ZeroMemory (&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - /* Create the primary surface */ - ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, - &ddsd, - &pScreenPriv->pddsPrimary4, - NULL); - pScreenPriv->fRetryCreateSurface = FALSE; - if (FAILED (ddrval)) - { - if (ddrval == DDERR_NOEXCLUSIVEMODE) - { - /* Recreating the surface failed. Mark screen to retry later */ - pScreenPriv->fRetryCreateSurface = TRUE; - winDebug ("winCreatePrimarySurfaceShadowDDNL - Could not create " - "primary surface: DDERR_NOEXCLUSIVEMODE\n"); - } - else - { - ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create " - "primary surface: %08x\n", (unsigned int) ddrval); - } - return FALSE; - } - -#if 1 - winDebug ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n"); -#endif - - /* Attach our clipper to our primary surface handle */ - ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, - pScreenPriv->pddcPrimary); - if (FAILED (ddrval)) - { - ErrorF ("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper " - "failed: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if 1 - winDebug ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary " - "surface\n"); -#endif - - /* Everything was correct */ - return TRUE; -} - - -/* - * Detach the clipper and release the primary surface. - * Called from WM_DISPLAYCHANGE. - */ - -static Bool -winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - - winDebug ("winReleasePrimarySurfaceShadowDDNL - Hello\n"); - - /* Release the primary surface and clipper, if they exist */ - if (pScreenPriv->pddsPrimary4) - { - /* - * Detach the clipper from the primary surface. - * NOTE: We do this explicity for clarity. The Clipper is not released. - */ - IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, - NULL); - - winDebug ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n"); - - /* Release the primary surface */ - IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4); - pScreenPriv->pddsPrimary4 = NULL; - } - - winDebug ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n"); - - return TRUE; -} - - -/* - * Create a DirectDraw surface for the shadow framebuffer; also create - * a primary surface object so we can blit to the display. - * - * Install a DirectDraw clipper on our primary surface object - * that clips our blits to the unobscured client area of our display window. - */ - -Bool -winAllocateFBShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HRESULT ddrval = DD_OK; - DDSURFACEDESC2 ddsdShadow; - char *lpSurface = NULL; - DDPIXELFORMAT ddpfPrimary; - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDDNL - w %d h %d d %d\n", - pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth); -#endif - - /* Allocate memory for our shadow surface */ - lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); - if (lpSurface == NULL) - { - ErrorF ("winAllocateFBShadowDDNL - Could not allocate bits\n"); - return FALSE; - } - - /* - * Initialize the framebuffer memory so we don't get a - * strange display at startup - */ - ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); - - /* Create a clipper */ - ddrval = (*g_fpDirectDrawCreateClipper) (0, - &pScreenPriv->pddcPrimary, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDDNL - Created a clipper\n"); -#endif - - /* Get a device context for the screen */ - pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); - - /* Attach the clipper to our display window */ - ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, - 0, - pScreenPriv->hwndScreen); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Clipper not attached " - "to window: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDDNL - Attached clipper to window\n"); -#endif - - /* Create a DirectDraw object, store the address at lpdd */ - ddrval = (*g_fpDirectDrawCreate) (NULL, - (LPDIRECTDRAW*) &pScreenPriv->pdd, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not start " - "DirectDraw: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDDNL - Created and initialized DD\n"); -#endif - - /* Get a DirectDraw4 interface pointer */ - ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, - &IID_IDirectDraw4, - (LPVOID*) &pScreenPriv->pdd4); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - - /* Are we full screen? */ - if (pScreenInfo->fFullScreen) - { - DDSURFACEDESC2 ddsdCurrent; - DWORD dwRefreshRateCurrent = 0; - HDC hdc = NULL; - - /* Set the cooperative level to full screen */ - ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4, - pScreenPriv->hwndScreen, - DDSCL_EXCLUSIVE - | DDSCL_FULLSCREEN); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not set " - "cooperative level: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - - /* - * We only need to get the current refresh rate for comparison - * if a refresh rate has been passed on the command line. - */ - if (pScreenInfo->dwRefreshRate != 0) - { - ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent)); - ddsdCurrent.dwSize = sizeof (ddsdCurrent); - - /* Get information about current display settings */ - ddrval = IDirectDraw4_GetDisplayMode (pScreenPriv->pdd4, - &ddsdCurrent); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not get current " - "refresh rate: %08x. Continuing.\n", - (unsigned int) ddrval); - dwRefreshRateCurrent = 0; - } - else - { - /* Grab the current refresh rate */ - dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate; - } - } - - /* Clean up the refresh rate */ - if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) - { - /* - * Refresh rate is non-specified or equal to current. - */ - pScreenInfo->dwRefreshRate = 0; - } - - /* Grab a device context for the screen */ - hdc = GetDC (NULL); - if (hdc == NULL) - { - ErrorF ("winAllocateFBShadowDDNL - GetDC () failed\n"); - return FALSE; - } - - /* Only change the video mode when different than current mode */ - if (!pScreenInfo->fMultipleMonitors - && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) - || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) - || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL) - || pScreenInfo->dwRefreshRate != 0)) - { - winDebug ("winAllocateFBShadowDDNL - Changing video mode\n"); - - /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ - ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, - pScreenInfo->dwWidth, - pScreenInfo->dwHeight, - pScreenInfo->dwBPP, - pScreenInfo->dwRefreshRate, - 0); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not set " - "full screen display mode: %08x\n", - (unsigned int) ddrval); - ErrorF ("winAllocateFBShadowDDNL - Using default driver refresh rate\n"); - ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, - pScreenInfo->dwWidth, - pScreenInfo->dwHeight, - pScreenInfo->dwBPP, - 0, - 0); - if (FAILED(ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not set default refresh rate " - "full screen display mode: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - } - } - else - { - winDebug ("winAllocateFBShadowDDNL - Not changing video mode\n"); - } - - /* Release our DC */ - ReleaseDC (NULL, hdc); - hdc = NULL; - } - else - { - /* Set the cooperative level for windowed mode */ - ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4, - pScreenPriv->hwndScreen, - DDSCL_NORMAL); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not set " - "cooperative level: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - } - - /* Create the primary surface */ - if (!winCreatePrimarySurfaceShadowDDNL (pScreen)) - { - ErrorF ("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL " - "failed\n"); - return FALSE; - } - - /* Get primary surface's pixel format */ - ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary)); - ddpfPrimary.dwSize = sizeof (ddpfPrimary); - ddrval = IDirectDrawSurface4_GetPixelFormat (pScreenPriv->pddsPrimary4, - &ddpfPrimary); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not get primary " - "pixformat: %08x\n", - (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x " - "dwRGBBitCount: %d\n", - ddpfPrimary.u2.dwRBitMask, - ddpfPrimary.u3.dwGBitMask, - ddpfPrimary.u4.dwBBitMask, - ddpfPrimary.u1.dwRGBBitCount); -#endif - - /* Describe the shadow surface to be created */ - /* - * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, - * as drawing, locking, and unlocking take forever - * with video memory surfaces. In addition, - * video memory is a somewhat scarce resource, - * so you shouldn't be allocating video memory when - * you have the option of using system memory instead. - */ - ZeroMemory (&ddsdShadow, sizeof (ddsdShadow)); - ddsdShadow.dwSize = sizeof (ddsdShadow); - ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH - | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT; - ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - ddsdShadow.dwHeight = pScreenInfo->dwHeight; - ddsdShadow.dwWidth = pScreenInfo->dwWidth; - ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth; - ddsdShadow.lpSurface = lpSurface; - ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary; - - winDebug ("winAllocateFBShadowDDNL - lPitch: %d\n", - (int) pScreenInfo->dwPaddedWidth); - - /* Create the shadow surface */ - ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, - &ddsdShadow, - &pScreenPriv->pddsShadow4, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winAllocateFBShadowDDNL - Could not create shadow " - "surface: %08x\n", (unsigned int) ddrval); - return FALSE; - } - -#if CYGDEBUG || YES - winDebug ("winAllocateFBShadowDDNL - Created shadow pitch: %d\n", - (int) ddsdShadow.u1.lPitch); -#endif - - /* Grab the pitch from the surface desc */ - pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8) - / pScreenInfo->dwBPP; - -#if CYGDEBUG || YES - winDebug ("winAllocateFBShadowDDNL - Created shadow stride: %d\n", - (int) pScreenInfo->dwStride); -#endif - - /* Save the pointer to our surface memory */ - pScreenInfo->pfb = lpSurface; - - /* Grab the masks from the surface description */ - pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask; - pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask; - pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask; - -#if CYGDEBUG - winDebug ("winAllocateFBShadowDDNL - Returning\n"); -#endif - - return TRUE; -} - - -#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) -/* - * Create a DirectDraw surface for the new multi-window window - */ - -static -Bool -winFinishCreateWindowsWindowDDNL (WindowPtr pWin) -{ - winWindowPriv(pWin); - winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv; - HRESULT ddrval = DD_OK; - DDSURFACEDESC2 ddsd; - int iWidth, iHeight; - int iX, iY; - - winDebug ("winFinishCreateWindowsWindowDDNL!\n\n"); - - iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN); - iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN); - - iWidth = pWin->drawable.width; - iHeight = pWin->drawable.height; - - /* Describe the primary surface */ - ZeroMemory (&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - ddsd.dwHeight = iHeight; - ddsd.dwWidth = iWidth; - - /* Create the primary surface */ - ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, - &ddsd, - &pWinPriv->pddsPrimary4, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winFinishCreateWindowsWindowDDNL - Could not create primary " - "surface: %08x\n", - (unsigned int)ddrval); - return FALSE; - } - return TRUE; -} -#endif - - -/* - * Transfer the damaged regions of the shadow framebuffer to the display. - */ - -static void -winShadowUpdateDDNL (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = shadowDamage(pBuf); - HRESULT ddrval = DD_OK; - RECT rcDest, rcSrc; - POINT ptOrigin; - DWORD dwBox = RegionNumRects (damage); - BoxPtr pBox = RegionRects (damage); - HRGN hrgnTemp = NULL, hrgnCombined = NULL; - - /* - * Return immediately if the app is not active - * and we are fullscreen, or if we have a bad display depth - */ - if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) - || pScreenPriv->fBadDepth) return; - - /* Get the origin of the window in the screen coords */ - ptOrigin.x = pScreenInfo->dwXOffset; - ptOrigin.y = pScreenInfo->dwYOffset; - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&ptOrigin, 1); - - /* - * Handle small regions with multiple blits, - * handle large regions by creating a clipping region and - * doing a single blit constrained to that clipping region. - */ - if (pScreenInfo->dwClipUpdatesNBoxes == 0 - || dwBox < pScreenInfo->dwClipUpdatesNBoxes) - { - /* Loop through all boxes in the damaged region */ - while (dwBox--) - { - /* Assign damage box to source rectangle */ - rcSrc.left = pBox->x1; - rcSrc.top = pBox->y1; - rcSrc.right = pBox->x2; - rcSrc.bottom = pBox->y2; - - /* Calculate destination rectangle */ - rcDest.left = ptOrigin.x + rcSrc.left; - rcDest.top = ptOrigin.y + rcSrc.top; - rcDest.right = ptOrigin.x + rcSrc.right; - rcDest.bottom = ptOrigin.y + rcSrc.bottom; - - /* Blit the damaged areas */ - ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, - &rcDest, - pScreenPriv->pddsShadow4, - &rcSrc, - DDBLT_WAIT, - NULL); - if (FAILED (ddrval)) - { - static int s_iFailCount = 0; - - if (s_iFailCount < FAIL_MSG_MAX_BLT) - { - ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () " - "failed: %08x\n", - (unsigned int) ddrval); - - ++s_iFailCount; - - if (s_iFailCount == FAIL_MSG_MAX_BLT) - { - ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt " - "failure message maximum (%d) reached. No " - "more failure messages will be printed.\n", - FAIL_MSG_MAX_BLT); - } - } - } - - /* Get a pointer to the next box */ - ++pBox; - } - } - else - { - BoxPtr pBoxExtents = RegionExtents(damage); - - /* Compute a GDI region from the damaged region */ - hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); - dwBox--; - pBox++; - while (dwBox--) - { - hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); - CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); - DeleteObject (hrgnTemp); - pBox++; - } - - /* Install the GDI region as a clipping region */ - SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); - DeleteObject (hrgnCombined); - hrgnCombined = NULL; - -#if CYGDEBUG - winDebug ("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n", - pBoxExtents->x1, pBoxExtents->y1, - pBoxExtents->x2, pBoxExtents->y2); -#endif - - /* Calculating a bounding box for the source is easy */ - rcSrc.left = pBoxExtents->x1; - rcSrc.top = pBoxExtents->y1; - rcSrc.right = pBoxExtents->x2; - rcSrc.bottom = pBoxExtents->y2; - - /* Calculating a bounding box for the destination is trickier */ - rcDest.left = ptOrigin.x + rcSrc.left; - rcDest.top = ptOrigin.y + rcSrc.top; - rcDest.right = ptOrigin.x + rcSrc.right; - rcDest.bottom = ptOrigin.y + rcSrc.bottom; - - /* Our Blt should be clipped to the invalidated region */ - ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, - &rcDest, - pScreenPriv->pddsShadow4, - &rcSrc, - DDBLT_WAIT, - NULL); - - /* Reset the clip region */ - SelectClipRgn (pScreenPriv->hdcScreen, NULL); - } -} - - -/* - * Call the wrapped CloseScreen function. - * - * Free our resources and private structures. - */ - -static Bool -winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - Bool fReturn; - -#if CYGDEBUG - winDebug ("winCloseScreenShadowDDNL - Freeing screen resources\n"); -#endif - - /* Flag that the screen is closed */ - pScreenPriv->fClosed = TRUE; - pScreenPriv->fActive = FALSE; - - /* Call the wrapped CloseScreen procedure */ - WIN_UNWRAP(CloseScreen); - fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); - - /* Free the screen DC */ - ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); - - /* Delete the window property */ - RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - - /* Free the shadow surface, if there is one */ - if (pScreenPriv->pddsShadow4) - { - IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4); - free (pScreenInfo->pfb); - pScreenInfo->pfb = NULL; - pScreenPriv->pddsShadow4 = NULL; - } - - /* Detach the clipper from the primary surface and release the clipper. */ - if (pScreenPriv->pddcPrimary) - { - /* Detach the clipper */ - IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, - NULL); - - /* Release the clipper object */ - IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); - pScreenPriv->pddcPrimary = NULL; - } - - /* Release the primary surface, if there is one */ - if (pScreenPriv->pddsPrimary4) - { - IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4); - pScreenPriv->pddsPrimary4 = NULL; - } - - /* Free the DirectDraw4 object, if there is one */ - if (pScreenPriv->pdd4) - { - IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4); - IDirectDraw4_Release (pScreenPriv->pdd4); - pScreenPriv->pdd4 = NULL; - } - - /* Free the DirectDraw object, if there is one */ - if (pScreenPriv->pdd) - { - IDirectDraw_Release (pScreenPriv->pdd); - pScreenPriv->pdd = NULL; - } - - /* Delete tray icon, if we have one */ - if (!pScreenInfo->fNoTrayIcon) - winDeleteNotifyIcon (pScreenPriv); - - /* Free the exit confirmation dialog box, if it exists */ - if (g_hDlgExit != NULL) - { - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - } - - /* Kill our window */ - if (pScreenPriv->hwndScreen) - { - DestroyWindow (pScreenPriv->hwndScreen); - pScreenPriv->hwndScreen = NULL; - } - -#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) - /* Destroy the thread startup mutex */ - pthread_mutex_destroy (&pScreenPriv->pmServerStarted); -#endif - - /* Kill our screeninfo's pointer to the screen */ - pScreenInfo->pScreen = NULL; - - /* Invalidate the ScreenInfo's fb pointer */ - pScreenInfo->pfb = NULL; - - /* Free the screen privates for this screen */ - free ((pointer) pScreenPriv); - - return fReturn; -} - - -/* - * Tell mi what sort of visuals we need. - * - * Generally we only need one visual, as our screen can only - * handle one format at a time, I believe. You may want - * to verify that last sentence. - */ - -static Bool -winInitVisualsShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - DWORD dwRedBits, dwGreenBits, dwBlueBits; - - /* Count the number of ones in each color mask */ - dwRedBits = winCountBits (pScreenPriv->dwRedMask); - dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); - dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); - - /* Store the maximum number of ones in a color mask as the bitsPerRGB */ - if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0) - pScreenPriv->dwBitsPerRGB = 8; - else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) - pScreenPriv->dwBitsPerRGB = dwRedBits; - else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) - pScreenPriv->dwBitsPerRGB = dwGreenBits; - else - pScreenPriv->dwBitsPerRGB = dwBlueBits; - - winDebug ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d " - "bpp %d\n", - (unsigned int) pScreenPriv->dwRedMask, - (unsigned int) pScreenPriv->dwGreenMask, - (unsigned int) pScreenPriv->dwBlueMask, - (int) pScreenPriv->dwBitsPerRGB, - (int) pScreenInfo->dwDepth, - (int) pScreenInfo->dwBPP); - - /* Create a single visual according to the Windows screen depth */ - switch (pScreenInfo->dwDepth) - { - case 24: - case 16: - case 15: - /* Setup the real visual */ - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - TrueColorMask, - pScreenPriv->dwBitsPerRGB, - -1, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " - "failed for TrueColor\n"); - return FALSE; - } - -#ifdef XWIN_EMULATEPSEUDO - if (!pScreenInfo->fEmulatePseudo) - break; - - /* Setup a pseudocolor visual */ - if (!miSetVisualTypesAndMasks (8, - PseudoColorMask, - 8, - -1, - 0, - 0, - 0)) - { - ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " - "failed for PseudoColor\n"); - return FALSE; - } -#endif - break; - - case 8: - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - pScreenInfo->fFullScreen - ? PseudoColorMask : StaticColorMask, - pScreenPriv->dwBitsPerRGB, - pScreenInfo->fFullScreen - ? PseudoColor : StaticColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " - "failed\n"); - return FALSE; - } - break; - - default: - ErrorF ("winInitVisualsShadowDDNL - Unknown screen depth\n"); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winInitVisualsShadowDDNL - Returning\n"); -#endif - - return TRUE; -} - - -/* - * Adjust the user proposed video mode - */ - -static Bool -winAdjustVideoModeShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HDC hdc = NULL; - DWORD dwBPP; - - /* We're in serious trouble if we can't get a DC */ - hdc = GetDC (NULL); - if (hdc == NULL) - { - ErrorF ("winAdjustVideoModeShadowDDNL - GetDC () failed\n"); - return FALSE; - } - - /* Query GDI for current display depth */ - dwBPP = GetDeviceCaps (hdc, BITSPIXEL); - - /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) - { - /* No -depth parameter passed, let the user know the depth being used */ - winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Using Windows display " - "depth of %d bits per pixel\n", (int) dwBPP); - - /* Use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - else if (pScreenInfo->fFullScreen - && pScreenInfo->dwBPP != dwBPP) - { - /* FullScreen, and GDI depth differs from -depth parameter */ - winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - FullScreen, using command " - "line bpp: %d\n", (int) pScreenInfo->dwBPP); - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Windowed, and GDI depth differs from -depth parameter */ - winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Windowed, command line " - "bpp: %d, using bpp: %d\n", - (int) pScreenInfo->dwBPP, (int) dwBPP); - - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - - /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP - >= WIN_DIB_MAXIMUM_SIZE) - { - winErrorFVerb (1, "winAdjustVideoModeShadowDDNL - Requested DirectDraw surface " - "will be larger than %d MB. The surface may fail to be " - "allocated on Windows 95, 98, or Me, due to a %d MB limit in " - "DIB size. This limit does not apply to Windows NT/2000, and " - "this message may be ignored on those platforms.\n", - WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); - } - - /* Release our DC */ - ReleaseDC (NULL, hdc); - - return TRUE; -} - - -/* - * Blt exposed regions to the screen - */ - -static Bool -winBltExposedRegionsShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RECT rcSrc, rcDest; - POINT ptOrigin; - HDC hdcUpdate; - PAINTSTRUCT ps; - HRESULT ddrval = DD_OK; - Bool fReturn = TRUE; - int i; - - /* Quite common case. The primary surface was lost (maybe because of depth - * change). Try to create a new primary surface. Bail out if this fails */ - if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface && - !winCreatePrimarySurfaceShadowDDNL(pScreen)) - { - Sleep(100); - return FALSE; - } - if (pScreenPriv->pddsPrimary4 == NULL) - return FALSE; - - /* BeginPaint gives us an hdc that clips to the invalidated region */ - hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); - if (hdcUpdate == NULL) - { - fReturn = FALSE; - ErrorF ("winBltExposedRegionsShadowDDNL - BeginPaint () returned " - "a NULL device context handle. Aborting blit attempt.\n"); - goto winBltExposedRegionsShadowDDNL_Exit; - } - - /* Get the origin of the window in the screen coords */ - ptOrigin.x = pScreenInfo->dwXOffset; - ptOrigin.y = pScreenInfo->dwYOffset; - - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&ptOrigin, 1); - rcDest.left = ptOrigin.x; - rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; - rcDest.top = ptOrigin.y; - rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; - - /* Source can be entire shadow surface, as Blt should clip for us */ - rcSrc.left = 0; - rcSrc.top = 0; - rcSrc.right = pScreenInfo->dwWidth; - rcSrc.bottom = pScreenInfo->dwHeight; - - /* Try to regain the primary surface and blit again if we've lost it */ - for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) - { - /* Our Blt should be clipped to the invalidated region */ - ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, - &rcDest, - pScreenPriv->pddsShadow4, - &rcSrc, - DDBLT_WAIT, - NULL); - if (ddrval == DDERR_SURFACELOST) - { - /* Surface was lost */ - winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - " - "IDirectDrawSurface4_Blt reported that the primary " - "surface was lost, trying to restore, retry: %d\n", i + 1); - - /* Try to restore the surface, once */ - - ddrval = IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4); - winDebug ("winBltExposedRegionsShadowDDNL - " - "IDirectDrawSurface4_Restore returned: "); - if (ddrval == DD_OK) - winDebug ("DD_OK\n"); - else if (ddrval == DDERR_WRONGMODE) - winDebug ("DDERR_WRONGMODE\n"); - else if (ddrval == DDERR_INCOMPATIBLEPRIMARY) - winDebug ("DDERR_INCOMPATIBLEPRIMARY\n"); - else if (ddrval == DDERR_UNSUPPORTED) - winDebug ("DDERR_UNSUPPORTED\n"); - else if (ddrval == DDERR_INVALIDPARAMS) - winDebug ("DDERR_INVALIDPARAMS\n"); - else if (ddrval == DDERR_INVALIDOBJECT) - winDebug ("DDERR_INVALIDOBJECT\n"); - else - winDebug ("unknown error: %08x\n", (unsigned int) ddrval); - - /* Loop around to try the blit one more time */ - continue; - } - else if (FAILED (ddrval)) - { - fReturn = FALSE; - winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - " - "IDirectDrawSurface4_Blt failed, but surface not " - "lost: %08x %d\n", - (unsigned int) ddrval, (int) ddrval); - goto winBltExposedRegionsShadowDDNL_Exit; - } - else - { - /* Success, stop looping */ - break; - } - } - - winBltExposedRegionsShadowDDNL_Exit: - /* EndPaint frees the DC */ - if (hdcUpdate != NULL) - EndPaint (pScreenPriv->hwndScreen, &ps); - return fReturn; -} - - -/* - * Do any engine-specific application-activation processing - */ - -static Bool -winActivateAppShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - - /* - * Do we have a surface? - * Are we active? - * Are we full screen? - */ - if (pScreenPriv != NULL - && pScreenPriv->pddsPrimary4 != NULL - && pScreenPriv->fActive) - { - /* Primary surface was lost, restore it */ - IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4); - } - - return TRUE; -} - - -/* - * Reblit the shadow framebuffer to the screen. - */ - -static Bool -winRedrawScreenShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HRESULT ddrval = DD_OK; - RECT rcSrc, rcDest; - POINT ptOrigin; - - /* Get the origin of the window in the screen coords */ - ptOrigin.x = pScreenInfo->dwXOffset; - ptOrigin.y = pScreenInfo->dwYOffset; - MapWindowPoints (pScreenPriv->hwndScreen, - HWND_DESKTOP, - (LPPOINT)&ptOrigin, 1); - rcDest.left = ptOrigin.x; - rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; - rcDest.top = ptOrigin.y; - rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; - - /* Source can be entire shadow surface, as Blt should clip for us */ - rcSrc.left = 0; - rcSrc.top = 0; - rcSrc.right = pScreenInfo->dwWidth; - rcSrc.bottom = pScreenInfo->dwHeight; - - /* Redraw the whole window, to take account for the new colors */ - ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, - &rcDest, - pScreenPriv->pddsShadow4, - &rcSrc, - DDBLT_WAIT, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winRedrawScreenShadowDDNL - IDirectDrawSurface4_Blt () " - "failed: %08x\n", - (unsigned int) ddrval); - } - - return TRUE; -} - - -/* - * Realize the currently installed colormap - */ - -static Bool -winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen) -{ - return TRUE; -} - - -/* - * Install the specified colormap - */ - -static Bool -winInstallColormapShadowDDNL (ColormapPtr pColormap) -{ - ScreenPtr pScreen = pColormap->pScreen; - winScreenPriv(pScreen); - winCmapPriv(pColormap); - HRESULT ddrval = DD_OK; - - /* Install the DirectDraw palette on the primary surface */ - ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4, - pCmapPriv->lpDDPalette); - if (FAILED (ddrval)) - { - ErrorF ("winInstallColormapShadowDDNL - Failed installing the " - "DirectDraw palette.\n"); - return FALSE; - } - - /* Save a pointer to the newly installed colormap */ - pScreenPriv->pcmapInstalled = pColormap; - - return TRUE; -} - - -/* - * Store the specified colors in the specified colormap - */ - -static Bool -winStoreColorsShadowDDNL (ColormapPtr pColormap, - int ndef, - xColorItem *pdefs) -{ - ScreenPtr pScreen = pColormap->pScreen; - winScreenPriv(pScreen); - winCmapPriv(pColormap); - ColormapPtr curpmap = pScreenPriv->pcmapInstalled; - HRESULT ddrval = DD_OK; - - /* Put the X colormap entries into the Windows logical palette */ - ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette, - 0, - pdefs[0].pixel, - ndef, - pCmapPriv->peColors - + pdefs[0].pixel); - if (FAILED (ddrval)) - { - ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", (unsigned int) ddrval); - return FALSE; - } - - /* Don't install the DirectDraw palette if the colormap is not installed */ - if (pColormap != curpmap) - { - return TRUE; - } - - if (!winInstallColormapShadowDDNL (pColormap)) - { - ErrorF ("winStoreColorsShadowDDNL - Failed installing colormap\n"); - return FALSE; - } - - return TRUE; -} - - -/* - * Colormap initialization procedure - */ - -static Bool -winCreateColormapShadowDDNL (ColormapPtr pColormap) -{ - HRESULT ddrval = DD_OK; - ScreenPtr pScreen = pColormap->pScreen; - winScreenPriv(pScreen); - winCmapPriv(pColormap); - - /* Create a DirectDraw palette */ - ddrval = IDirectDraw4_CreatePalette (pScreenPriv->pdd4, - DDPCAPS_8BIT | DDPCAPS_ALLOW256, - pCmapPriv->peColors, - &pCmapPriv->lpDDPalette, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winCreateColormapShadowDDNL - CreatePalette failed\n"); - return FALSE; - } - - return TRUE; -} - - -/* - * Colormap destruction procedure - */ - -static Bool -winDestroyColormapShadowDDNL (ColormapPtr pColormap) -{ - winScreenPriv(pColormap->pScreen); - winCmapPriv(pColormap); - HRESULT ddrval = DD_OK; - - /* - * Is colormap to be destroyed the default? - * - * Non-default colormaps should have had winUninstallColormap - * called on them before we get here. The default colormap - * will not have had winUninstallColormap called on it. Thus, - * we need to handle the default colormap in a special way. - */ - if (pColormap->flags & IsDefault) - { -#if CYGDEBUG - winDebug ("winDestroyColormapShadowDDNL - Destroying default colormap\n"); -#endif - - /* - * FIXME: Walk the list of all screens, popping the default - * palette out of each screen device context. - */ - - /* Pop the palette out of the primary surface */ - ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4, - NULL); - if (FAILED (ddrval)) - { - ErrorF ("winDestroyColormapShadowDDNL - Failed freeing the " - "default colormap DirectDraw palette.\n"); - return FALSE; - } - - /* Clear our private installed colormap pointer */ - pScreenPriv->pcmapInstalled = NULL; - } - - /* Release the palette */ - IDirectDrawPalette_Release (pCmapPriv->lpDDPalette); - - /* Invalidate the colormap privates */ - pCmapPriv->lpDDPalette = NULL; - - return TRUE; -} - - -/* - * Set pointers to our engine specific functions - */ - -Bool -winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Set our pointers */ - pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL; - pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL; - pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL; - pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL; - pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL; - if (pScreenInfo->fFullScreen) - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; - else - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; - pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; - pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL; - pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL; - pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL; - pScreenPriv->pwinRealizeInstalledPalette - = winRealizeInstalledPaletteShadowDDNL; - pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL; - pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL; - pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL; - pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL; - pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; - pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL; - pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL; -#ifdef XWIN_MULTIWINDOW - pScreenPriv->pwinFinishCreateWindowsWindow - = winFinishCreateWindowsWindowDDNL; -#endif - - return TRUE; -} +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" + + +/* + * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, + * so we have to redefine it here. + */ +#ifdef DEFINE_GUID +#undef DEFINE_GUID +#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} +#endif /* DEFINE_GUID */ + +/* + * FIXME: Headers are broken, IID_IDirectDraw4 has to be defined + * here manually. Should be handled by ddraw.h + */ +#ifndef IID_IDirectDraw4 +DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +#endif /* IID_IDirectDraw4 */ + +#define FAIL_MSG_MAX_BLT 10 + + +/* + * Local prototypes + */ + +static Bool +winAllocateFBShadowDDNL (ScreenPtr pScreen); + +static void +winShadowUpdateDDNL (ScreenPtr pScreen, + shadowBufPtr pBuf); + +static Bool +winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen); + +static Bool +winInitVisualsShadowDDNL (ScreenPtr pScreen); + +static Bool +winAdjustVideoModeShadowDDNL (ScreenPtr pScreen); + +static Bool +winBltExposedRegionsShadowDDNL (ScreenPtr pScreen); + +static Bool +winActivateAppShadowDDNL (ScreenPtr pScreen); + +static Bool +winRedrawScreenShadowDDNL (ScreenPtr pScreen); + +static Bool +winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen); + +static Bool +winInstallColormapShadowDDNL (ColormapPtr pColormap); + +static Bool +winStoreColorsShadowDDNL (ColormapPtr pmap, + int ndef, + xColorItem *pdefs); + +static Bool +winCreateColormapShadowDDNL (ColormapPtr pColormap); + +static Bool +winDestroyColormapShadowDDNL (ColormapPtr pColormap); + +static Bool +winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen); + +static Bool +winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen); + + +/* + * Create the primary surface and attach the clipper. + * Used for both the initial surface creation and during + * WM_DISPLAYCHANGE messages. + */ + +static Bool +winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + HRESULT ddrval = DD_OK; + DDSURFACEDESC2 ddsd; + + winDebug ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n"); + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, + &ddsd, + &pScreenPriv->pddsPrimary4, + NULL); + pScreenPriv->fRetryCreateSurface = FALSE; + if (FAILED (ddrval)) + { + if (ddrval == DDERR_NOEXCLUSIVEMODE) + { + /* Recreating the surface failed. Mark screen to retry later */ + pScreenPriv->fRetryCreateSurface = TRUE; + winDebug ("winCreatePrimarySurfaceShadowDDNL - Could not create " + "primary surface: DDERR_NOEXCLUSIVEMODE\n"); + } + else + { + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create " + "primary surface: %08x\n", (unsigned int) ddrval); + } + return FALSE; + } + +#if 1 + winDebug ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n"); +#endif + + /* Attach our clipper to our primary surface handle */ + ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, + pScreenPriv->pddcPrimary); + if (FAILED (ddrval)) + { + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper " + "failed: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if 1 + winDebug ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary " + "surface\n"); +#endif + + /* Everything was correct */ + return TRUE; +} + + +/* + * Detach the clipper and release the primary surface. + * Called from WM_DISPLAYCHANGE. + */ + +static Bool +winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + winDebug ("winReleasePrimarySurfaceShadowDDNL - Hello\n"); + + /* Release the primary surface and clipper, if they exist */ + if (pScreenPriv->pddsPrimary4) + { + /* + * Detach the clipper from the primary surface. + * NOTE: We do this explicity for clarity. The Clipper is not released. + */ + IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, + NULL); + + winDebug ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n"); + + /* Release the primary surface */ + IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4); + pScreenPriv->pddsPrimary4 = NULL; + } + + winDebug ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n"); + + return TRUE; +} + + +/* + * Create a DirectDraw surface for the shadow framebuffer; also create + * a primary surface object so we can blit to the display. + * + * Install a DirectDraw clipper on our primary surface object + * that clips our blits to the unobscured client area of our display window. + */ + +Bool +winAllocateFBShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC2 ddsdShadow; + char *lpSurface = NULL; + DDPIXELFORMAT ddpfPrimary; + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDDNL - w %d h %d d %d\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth); +#endif + + /* Set the padded screen width */ + pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, + pScreenInfo->dwBPP); + + /* Allocate memory for our shadow surface */ + lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); + if (lpSurface == NULL) + { + ErrorF ("winAllocateFBShadowDDNL - Could not allocate bits\n"); + return FALSE; + } + + /* + * Initialize the framebuffer memory so we don't get a + * strange display at startup + */ + ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); + + /* Create a clipper */ + ddrval = (*g_fpDirectDrawCreateClipper) (0, + &pScreenPriv->pddcPrimary, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDDNL - Created a clipper\n"); +#endif + + /* Attach the clipper to our display window */ + ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, + 0, + pScreenPriv->hwndScreen); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Clipper not attached " + "to window: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDDNL - Attached clipper to window\n"); +#endif + + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = (*g_fpDirectDrawCreate) (NULL, + (LPDIRECTDRAW*) &pScreenPriv->pdd, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not start " + "DirectDraw: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDDNL - Created and initialized DD\n"); +#endif + + /* Get a DirectDraw4 interface pointer */ + ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, + &IID_IDirectDraw4, + (LPVOID*) &pScreenPriv->pdd4); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + + /* Are we full screen? */ + if (pScreenInfo->fFullScreen) + { + DDSURFACEDESC2 ddsdCurrent; + DWORD dwRefreshRateCurrent = 0; + HDC hdc = NULL; + + /* Set the cooperative level to full screen */ + ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4, + pScreenPriv->hwndScreen, + DDSCL_EXCLUSIVE + | DDSCL_FULLSCREEN); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not set " + "cooperative level: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + + /* + * We only need to get the current refresh rate for comparison + * if a refresh rate has been passed on the command line. + */ + if (pScreenInfo->dwRefreshRate != 0) + { + ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent)); + ddsdCurrent.dwSize = sizeof (ddsdCurrent); + + /* Get information about current display settings */ + ddrval = IDirectDraw4_GetDisplayMode (pScreenPriv->pdd4, + &ddsdCurrent); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not get current " + "refresh rate: %08x. Continuing.\n", + (unsigned int) ddrval); + dwRefreshRateCurrent = 0; + } + else + { + /* Grab the current refresh rate */ + dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate; + } + } + + /* Clean up the refresh rate */ + if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) + { + /* + * Refresh rate is non-specified or equal to current. + */ + pScreenInfo->dwRefreshRate = 0; + } + + /* Grab a device context for the screen */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAllocateFBShadowDDNL - GetDC () failed\n"); + return FALSE; + } + + /* Only change the video mode when different than current mode */ + if (!pScreenInfo->fMultipleMonitors + && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN) + || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN) + || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL) + || pScreenInfo->dwRefreshRate != 0)) + { + winDebug ("winAllocateFBShadowDDNL - Changing video mode\n"); + + /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */ + ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + pScreenInfo->dwRefreshRate, + 0); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not set " + "full screen display mode: %08x\n", + (unsigned int) ddrval); + ErrorF ("winAllocateFBShadowDDNL - Using default driver refresh rate\n"); + ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwBPP, + 0, + 0); + if (FAILED(ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not set default refresh rate " + "full screen display mode: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + } + } + else + { + winDebug ("winAllocateFBShadowDDNL - Not changing video mode\n"); + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + hdc = NULL; + } + else + { + /* Set the cooperative level for windowed mode */ + ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not set " + "cooperative level: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + } + + /* Create the primary surface */ + if (!winCreatePrimarySurfaceShadowDDNL (pScreen)) + { + ErrorF ("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL " + "failed\n"); + return FALSE; + } + + /* Get primary surface's pixel format */ + ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary)); + ddpfPrimary.dwSize = sizeof (ddpfPrimary); + ddrval = IDirectDrawSurface4_GetPixelFormat (pScreenPriv->pddsPrimary4, + &ddpfPrimary); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not get primary " + "pixformat: %08x\n", + (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x " + "dwRGBBitCount: %d\n", + ddpfPrimary.u2.dwRBitMask, + ddpfPrimary.u3.dwGBitMask, + ddpfPrimary.u4.dwBBitMask, + ddpfPrimary.u1.dwRGBBitCount); +#endif + + /* Describe the shadow surface to be created */ + /* + * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, + * as drawing, locking, and unlocking take forever + * with video memory surfaces. In addition, + * video memory is a somewhat scarce resource, + * so you shouldn't be allocating video memory when + * you have the option of using system memory instead. + */ + ZeroMemory (&ddsdShadow, sizeof (ddsdShadow)); + ddsdShadow.dwSize = sizeof (ddsdShadow); + ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH + | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT; + ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsdShadow.dwHeight = pScreenInfo->dwHeight; + ddsdShadow.dwWidth = pScreenInfo->dwWidth; + ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth; + ddsdShadow.lpSurface = lpSurface; + ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary; + + winDebug ("winAllocateFBShadowDDNL - lPitch: %d\n", + (int) pScreenInfo->dwPaddedWidth); + + /* Create the shadow surface */ + ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, + &ddsdShadow, + &pScreenPriv->pddsShadow4, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL - Could not create shadow " + "surface: %08x\n", (unsigned int) ddrval); + return FALSE; + } + +#if CYGDEBUG || YES + winDebug ("winAllocateFBShadowDDNL - Created shadow pitch: %d\n", + (int) ddsdShadow.u1.lPitch); +#endif + + /* Grab the pitch from the surface desc */ + pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8) + / pScreenInfo->dwBPP; + +#if CYGDEBUG || YES + winDebug ("winAllocateFBShadowDDNL - Created shadow stride: %d\n", + (int) pScreenInfo->dwStride); +#endif + + /* Save the pointer to our surface memory */ + pScreenInfo->pfb = lpSurface; + + /* Grab the masks from the surface description */ + pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask; + +#if CYGDEBUG + winDebug ("winAllocateFBShadowDDNL - Returning\n"); +#endif + + return TRUE; +} + +static void +winFreeFBShadowDDNL(ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Free the shadow surface, if there is one */ + if (pScreenPriv->pddsShadow4) + { + IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4); + free (pScreenInfo->pfb); + pScreenInfo->pfb = NULL; + pScreenPriv->pddsShadow4 = NULL; + } + + /* Detach the clipper from the primary surface and release the primary surface, if there is one */ + winReleasePrimarySurfaceShadowDDNL(pScreen); + + /* Release the clipper object */ + if (pScreenPriv->pddcPrimary) + { + IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); + pScreenPriv->pddcPrimary = NULL; + } + + /* Free the DirectDraw4 object, if there is one */ + if (pScreenPriv->pdd4) + { + IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4); + IDirectDraw4_Release (pScreenPriv->pdd4); + pScreenPriv->pdd4 = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; +} + +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) +/* + * Create a DirectDraw surface for the new multi-window window + */ + +static +Bool +winFinishCreateWindowsWindowDDNL (WindowPtr pWin) +{ + winWindowPriv(pWin); + winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv; + HRESULT ddrval = DD_OK; + DDSURFACEDESC2 ddsd; + int iWidth, iHeight; + int iX, iY; + + winDebug ("winFinishCreateWindowsWindowDDNL!\n\n"); + + iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN); + iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN); + + iWidth = pWin->drawable.width; + iHeight = pWin->drawable.height; + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + ddsd.dwHeight = iHeight; + ddsd.dwWidth = iWidth; + + /* Create the primary surface */ + ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4, + &ddsd, + &pWinPriv->pddsPrimary4, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winFinishCreateWindowsWindowDDNL - Could not create primary " + "surface: %08x\n", + (unsigned int)ddrval); + return FALSE; + } + return TRUE; +} +#endif + + +/* + * Transfer the damaged regions of the shadow framebuffer to the display. + */ + +static void +winShadowUpdateDDNL (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RegionPtr damage = shadowDamage(pBuf); + HRESULT ddrval = DD_OK; + RECT rcDest, rcSrc; + POINT ptOrigin; + DWORD dwBox = RegionNumRects (damage); + BoxPtr pBox = RegionRects (damage); + HRGN hrgnTemp = NULL, hrgnCombined = NULL; + + /* + * Return immediately if the app is not active + * and we are fullscreen, or if we have a bad display depth + */ + if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) + || pScreenPriv->fBadDepth) return; + + /* Return immediately if we didn't get needed surfaces */ + if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4) + return; + + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&ptOrigin, 1); + + /* + * Handle small regions with multiple blits, + * handle large regions by creating a clipping region and + * doing a single blit constrained to that clipping region. + */ + if (pScreenInfo->dwClipUpdatesNBoxes == 0 + || dwBox < pScreenInfo->dwClipUpdatesNBoxes) + { + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Assign damage box to source rectangle */ + rcSrc.left = pBox->x1; + rcSrc.top = pBox->y1; + rcSrc.right = pBox->x2; + rcSrc.bottom = pBox->y2; + + /* Calculate destination rectangle */ + rcDest.left = ptOrigin.x + rcSrc.left; + rcDest.top = ptOrigin.y + rcSrc.top; + rcDest.right = ptOrigin.x + rcSrc.right; + rcDest.bottom = ptOrigin.y + rcSrc.bottom; + + /* Blit the damaged areas */ + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + static int s_iFailCount = 0; + + if (s_iFailCount < FAIL_MSG_MAX_BLT) + { + ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () " + "failed: %08x\n", + (unsigned int) ddrval); + + ++s_iFailCount; + + if (s_iFailCount == FAIL_MSG_MAX_BLT) + { + ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt " + "failure message maximum (%d) reached. No " + "more failure messages will be printed.\n", + FAIL_MSG_MAX_BLT); + } + } + } + + /* Get a pointer to the next box */ + ++pBox; + } + } + else + { + BoxPtr pBoxExtents = RegionExtents(damage); + + /* Compute a GDI region from the damaged region */ + hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + dwBox--; + pBox++; + while (dwBox--) + { + hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); + DeleteObject (hrgnTemp); + pBox++; + } + + /* Install the GDI region as a clipping region */ + SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); + DeleteObject (hrgnCombined); + hrgnCombined = NULL; + +#if CYGDEBUG + winDebug ("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n", + pBoxExtents->x1, pBoxExtents->y1, + pBoxExtents->x2, pBoxExtents->y2); +#endif + + /* Calculating a bounding box for the source is easy */ + rcSrc.left = pBoxExtents->x1; + rcSrc.top = pBoxExtents->y1; + rcSrc.right = pBoxExtents->x2; + rcSrc.bottom = pBoxExtents->y2; + + /* Calculating a bounding box for the destination is trickier */ + rcDest.left = ptOrigin.x + rcSrc.left; + rcDest.top = ptOrigin.y + rcSrc.top; + rcDest.right = ptOrigin.x + rcSrc.right; + rcDest.bottom = ptOrigin.y + rcSrc.bottom; + + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + + /* Reset the clip region */ + SelectClipRgn (pScreenPriv->hdcScreen, NULL); + } +} + +static Bool +winInitScreenShadowDDNL(ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Get a device context for the screen */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + + return winAllocateFBShadowDDNL(pScreen); +} + +/* + * Call the wrapped CloseScreen function. + * + * Free our resources and private structures. + */ + +static Bool +winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + +#if CYGDEBUG + winDebug ("winCloseScreenShadowDDNL - Freeing screen resources\n"); +#endif + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + WIN_UNWRAP(CloseScreen); + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + winFreeFBShadowDDNL(pScreen); + + /* Free the screen DC */ + ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Delete tray icon, if we have one */ + if (!pScreenInfo->fNoTrayIcon) + winDeleteNotifyIcon (pScreenPriv); + + /* Free the exit confirmation dialog box, if it exists */ + if (g_hDlgExit != NULL) + { + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + } + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) + /* Destroy the thread startup mutex */ + pthread_mutex_destroy (&pScreenPriv->pmServerStarted); +#endif + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Free the screen privates for this screen */ + free ((pointer) pScreenPriv); + + return fReturn; +} + + +/* + * Tell mi what sort of visuals we need. + * + * Generally we only need one visual, as our screen can only + * handle one format at a time, I believe. You may want + * to verify that last sentence. + */ + +static Bool +winInitVisualsShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0) + pScreenPriv->dwBitsPerRGB = 8; + else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + winDebug ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d " + "bpp %d\n", + (unsigned int) pScreenPriv->dwRedMask, + (unsigned int) pScreenPriv->dwGreenMask, + (unsigned int) pScreenPriv->dwBlueMask, + (int) pScreenPriv->dwBitsPerRGB, + (int) pScreenInfo->dwDepth, + (int) pScreenInfo->dwBPP); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 24: + case 16: + case 15: + /* Setup the real visual */ + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + -1, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " + "failed for TrueColor\n"); + return FALSE; + } + +#ifdef XWIN_EMULATEPSEUDO + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!miSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + -1, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " + "failed for PseudoColor\n"); + return FALSE; + } +#endif + break; + + case 8: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + pScreenInfo->fFullScreen + ? PseudoColorMask : StaticColorMask, + pScreenPriv->dwBitsPerRGB, + pScreenInfo->fFullScreen + ? PseudoColor : StaticColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks " + "failed\n"); + return FALSE; + } + break; + + default: + ErrorF ("winInitVisualsShadowDDNL - Unknown screen depth\n"); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winInitVisualsShadowDDNL - Returning\n"); +#endif + + return TRUE; +} + + +/* + * Adjust the user proposed video mode + */ + +static Bool +winAdjustVideoModeShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwBPP; + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModeShadowDDNL - GetDC () failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); + + /* DirectDraw can only change the depth in fullscreen mode */ + if (!(pScreenInfo->fFullScreen && + (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) + { + /* Otherwise, We'll use GDI's depth */ + pScreenInfo->dwBPP = dwBPP; + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + + return TRUE; +} + + +/* + * Blt exposed regions to the screen + */ + +static Bool +winBltExposedRegionsShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RECT rcSrc, rcDest; + POINT ptOrigin; + HDC hdcUpdate; + PAINTSTRUCT ps; + HRESULT ddrval = DD_OK; + Bool fReturn = TRUE; + int i; + + /* Quite common case. The primary surface was lost (maybe because of depth + * change). Try to create a new primary surface. Bail out if this fails */ + if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface && + !winCreatePrimarySurfaceShadowDDNL(pScreen)) + { + Sleep(100); + return FALSE; + } + if (pScreenPriv->pddsPrimary4 == NULL) + return FALSE; + + /* BeginPaint gives us an hdc that clips to the invalidated region */ + hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); + if (hdcUpdate == NULL) + { + fReturn = FALSE; + ErrorF ("winBltExposedRegionsShadowDDNL - BeginPaint () returned " + "a NULL device context handle. Aborting blit attempt.\n"); + goto winBltExposedRegionsShadowDDNL_Exit; + } + + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; + + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&ptOrigin, 1); + rcDest.left = ptOrigin.x; + rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; + rcDest.top = ptOrigin.y; + rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; + + /* Source can be entire shadow surface, as Blt should clip for us */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Try to regain the primary surface and blit again if we've lost it */ + for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) + { + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (ddrval == DDERR_SURFACELOST) + { + /* Surface was lost */ + winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - " + "IDirectDrawSurface4_Blt reported that the primary " + "surface was lost, trying to restore, retry: %d\n", i + 1); + + /* Try to restore the surface, once */ + + ddrval = IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4); + winDebug ("winBltExposedRegionsShadowDDNL - " + "IDirectDrawSurface4_Restore returned: "); + if (ddrval == DD_OK) + winDebug ("DD_OK\n"); + else if (ddrval == DDERR_WRONGMODE) + winDebug ("DDERR_WRONGMODE\n"); + else if (ddrval == DDERR_INCOMPATIBLEPRIMARY) + winDebug ("DDERR_INCOMPATIBLEPRIMARY\n"); + else if (ddrval == DDERR_UNSUPPORTED) + winDebug ("DDERR_UNSUPPORTED\n"); + else if (ddrval == DDERR_INVALIDPARAMS) + winDebug ("DDERR_INVALIDPARAMS\n"); + else if (ddrval == DDERR_INVALIDOBJECT) + winDebug ("DDERR_INVALIDOBJECT\n"); + else + winDebug ("unknown error: %08x\n", (unsigned int) ddrval); + + /* Loop around to try the blit one more time */ + continue; + } + else if (FAILED (ddrval)) + { + fReturn = FALSE; + winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - " + "IDirectDrawSurface4_Blt failed, but surface not " + "lost: %08x %d\n", + (unsigned int) ddrval, (int) ddrval); + goto winBltExposedRegionsShadowDDNL_Exit; + } + else + { + /* Success, stop looping */ + break; + } + } + + winBltExposedRegionsShadowDDNL_Exit: + /* EndPaint frees the DC */ + if (hdcUpdate != NULL) + EndPaint (pScreenPriv->hwndScreen, &ps); + return fReturn; +} + + +/* + * Do any engine-specific application-activation processing + */ + +static Bool +winActivateAppShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* + * Do we have a surface? + * Are we active? + * Are we full screen? + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary4 != NULL + && pScreenPriv->fActive) + { + /* Primary surface was lost, restore it */ + IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4); + } + + return TRUE; +} + + +/* + * Reblit the shadow framebuffer to the screen. + */ + +static Bool +winRedrawScreenShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + RECT rcSrc, rcDest; + POINT ptOrigin; + + /* Get the origin of the window in the screen coords */ + ptOrigin.x = pScreenInfo->dwXOffset; + ptOrigin.y = pScreenInfo->dwYOffset; + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&ptOrigin, 1); + rcDest.left = ptOrigin.x; + rcDest.right = ptOrigin.x + pScreenInfo->dwWidth; + rcDest.top = ptOrigin.y; + rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight; + + /* Source can be entire shadow surface, as Blt should clip for us */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Redraw the whole window, to take account for the new colors */ + ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winRedrawScreenShadowDDNL - IDirectDrawSurface4_Blt () " + "failed: %08x\n", + (unsigned int) ddrval); + } + + return TRUE; +} + + +/* + * Realize the currently installed colormap + */ + +static Bool +winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen) +{ + return TRUE; +} + + +/* + * Install the specified colormap + */ + +static Bool +winInstallColormapShadowDDNL (ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + HRESULT ddrval = DD_OK; + + /* Install the DirectDraw palette on the primary surface */ + ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4, + pCmapPriv->lpDDPalette); + if (FAILED (ddrval)) + { + ErrorF ("winInstallColormapShadowDDNL - Failed installing the " + "DirectDraw palette.\n"); + return FALSE; + } + + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; + + return TRUE; +} + + +/* + * Store the specified colors in the specified colormap + */ + +static Bool +winStoreColorsShadowDDNL (ColormapPtr pColormap, + int ndef, + xColorItem *pdefs) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + HRESULT ddrval = DD_OK; + + /* Put the X colormap entries into the Windows logical palette */ + ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette, + 0, + pdefs[0].pixel, + ndef, + pCmapPriv->peColors + + pdefs[0].pixel); + if (FAILED (ddrval)) + { + ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", (unsigned int) ddrval); + return FALSE; + } + + /* Don't install the DirectDraw palette if the colormap is not installed */ + if (pColormap != curpmap) + { + return TRUE; + } + + if (!winInstallColormapShadowDDNL (pColormap)) + { + ErrorF ("winStoreColorsShadowDDNL - Failed installing colormap\n"); + return FALSE; + } + + return TRUE; +} + + +/* + * Colormap initialization procedure + */ + +static Bool +winCreateColormapShadowDDNL (ColormapPtr pColormap) +{ + HRESULT ddrval = DD_OK; + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + + /* Create a DirectDraw palette */ + ddrval = IDirectDraw4_CreatePalette (pScreenPriv->pdd4, + DDPCAPS_8BIT | DDPCAPS_ALLOW256, + pCmapPriv->peColors, + &pCmapPriv->lpDDPalette, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winCreateColormapShadowDDNL - CreatePalette failed\n"); + return FALSE; + } + + return TRUE; +} + + +/* + * Colormap destruction procedure + */ + +static Bool +winDestroyColormapShadowDDNL (ColormapPtr pColormap) +{ + winScreenPriv(pColormap->pScreen); + winCmapPriv(pColormap); + HRESULT ddrval = DD_OK; + + /* + * Is colormap to be destroyed the default? + * + * Non-default colormaps should have had winUninstallColormap + * called on them before we get here. The default colormap + * will not have had winUninstallColormap called on it. Thus, + * we need to handle the default colormap in a special way. + */ + if (pColormap->flags & IsDefault) + { +#if CYGDEBUG + winDebug ("winDestroyColormapShadowDDNL - Destroying default colormap\n"); +#endif + + /* + * FIXME: Walk the list of all screens, popping the default + * palette out of each screen device context. + */ + + /* Pop the palette out of the primary surface */ + ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winDestroyColormapShadowDDNL - Failed freeing the " + "default colormap DirectDraw palette.\n"); + return FALSE; + } + + /* Clear our private installed colormap pointer */ + pScreenPriv->pcmapInstalled = NULL; + } + + /* Release the palette */ + IDirectDrawPalette_Release (pCmapPriv->lpDDPalette); + + /* Invalidate the colormap privates */ + pCmapPriv->lpDDPalette = NULL; + + return TRUE; +} + + +/* + * Set pointers to our engine specific functions + */ + +Bool +winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL; + pScreenPriv->pwinFreeFB = winFreeFBShadowDDNL; + pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL; + pScreenPriv->pwinInitScreen = winInitScreenShadowDDNL; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL; + pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL; + pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL; + pScreenPriv->pwinRealizeInstalledPalette + = winRealizeInstalledPaletteShadowDDNL; + pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL; + pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL; + pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL; + pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL; + pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL; +#ifdef XWIN_MULTIWINDOW + pScreenPriv->pwinFinishCreateWindowsWindow + = winFinishCreateWindowsWindowDDNL; +#endif + + return TRUE; +} diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c index 4f36547f9..499037656 100644 --- a/xorg-server/hw/xwin/winshadgdi.c +++ b/xorg-server/hw/xwin/winshadgdi.c @@ -1,1267 +1,1259 @@ -/* - *Copyright (C) 2001-2004 Harold L Hunt II 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 HAROLD L HUNT II 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 Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - - -/* - * Local function prototypes - */ - -#ifdef XWIN_MULTIWINDOW -static wBOOL CALLBACK -winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam); - -static wBOOL CALLBACK -winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam); -#endif - -static Bool -winAllocateFBShadowGDI (ScreenPtr pScreen); - -static void -winShadowUpdateGDI (ScreenPtr pScreen, - shadowBufPtr pBuf); - -static Bool -winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen); - -static Bool -winInitVisualsShadowGDI (ScreenPtr pScreen); - -static Bool -winAdjustVideoModeShadowGDI (ScreenPtr pScreen); - -static Bool -winBltExposedRegionsShadowGDI (ScreenPtr pScreen); - -static Bool -winActivateAppShadowGDI (ScreenPtr pScreen); - -static Bool -winRedrawScreenShadowGDI (ScreenPtr pScreen); - -static Bool -winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen); - -static Bool -winInstallColormapShadowGDI (ColormapPtr pColormap); - -static Bool -winStoreColorsShadowGDI (ColormapPtr pmap, - int ndef, - xColorItem *pdefs); - -static Bool -winCreateColormapShadowGDI (ColormapPtr pColormap); - -static Bool -winDestroyColormapShadowGDI (ColormapPtr pColormap); - - -/* - * Internal function to get the DIB format that is compatible with the screen - */ - -static -Bool -winQueryScreenDIBFormat (ScreenPtr pScreen, BITMAPINFOHEADER *pbmih) -{ - winScreenPriv(pScreen); - HBITMAP hbmp; -#if CYGDEBUG - LPDWORD pdw = NULL; -#endif - - /* Create a memory bitmap compatible with the screen */ - hbmp = CreateCompatibleBitmap (pScreenPriv->hdcScreen, 1, 1); - if (hbmp == NULL) - { - ErrorF ("winQueryScreenDIBFormat - CreateCompatibleBitmap failed\n"); - return FALSE; - } - - /* Initialize our bitmap info header */ - ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); - pbmih->biSize = sizeof (BITMAPINFOHEADER); - - /* Get the biBitCount */ - if (!GetDIBits (pScreenPriv->hdcScreen, - hbmp, - 0, 1, - NULL, - (BITMAPINFO*) pbmih, - DIB_RGB_COLORS)) - { - ErrorF ("winQueryScreenDIBFormat - First call to GetDIBits failed\n"); - DeleteObject (hbmp); - return FALSE; - } - -#if CYGDEBUG - /* Get a pointer to bitfields */ - pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); - - winDebug ("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n", - pdw[0], pdw[1], pdw[2]); -#endif - - /* Get optimal color table, or the optimal bitfields */ - if (!GetDIBits (pScreenPriv->hdcScreen, - hbmp, - 0, 1, - NULL, - (BITMAPINFO*)pbmih, - DIB_RGB_COLORS)) - { - ErrorF ("winQueryScreenDIBFormat - Second call to GetDIBits " - "failed\n"); - DeleteObject (hbmp); - return FALSE; - } - - /* Free memory */ - DeleteObject (hbmp); - - return TRUE; -} - - -/* - * Internal function to determine the GDI bits per rgb and bit masks - */ - -static -Bool -winQueryRGBBitsAndMasks (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - BITMAPINFOHEADER *pbmih = NULL; - Bool fReturn = TRUE; - LPDWORD pdw = NULL; - DWORD dwRedBits, dwGreenBits, dwBlueBits; - - /* Color masks for 8 bpp are standardized */ - if (GetDeviceCaps (pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE) - { - /* - * RGB BPP for 8 bit palletes is always 8 - * and the color masks are always 0. - */ - pScreenPriv->dwBitsPerRGB = 8; - pScreenPriv->dwRedMask = 0x0L; - pScreenPriv->dwGreenMask = 0x0L; - pScreenPriv->dwBlueMask = 0x0L; - return TRUE; - } - - /* Color masks for 24 bpp are standardized */ - if (GetDeviceCaps (pScreenPriv->hdcScreen, PLANES) - * GetDeviceCaps (pScreenPriv->hdcScreen, BITSPIXEL) == 24) - { - ErrorF ("winQueryRGBBitsAndMasks - GetDeviceCaps (BITSPIXEL) " - "returned 24 for the screen. Using default 24bpp masks.\n"); - - /* 8 bits per primary color */ - pScreenPriv->dwBitsPerRGB = 8; - - /* Set screen privates masks */ - pScreenPriv->dwRedMask = WIN_24BPP_MASK_RED; - pScreenPriv->dwGreenMask = WIN_24BPP_MASK_GREEN; - pScreenPriv->dwBlueMask = WIN_24BPP_MASK_BLUE; - - return TRUE; - } - - /* Allocate a bitmap header and color table */ - pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) - + 256 * sizeof (RGBQUAD)); - if (pbmih == NULL) - { - ErrorF ("winQueryRGBBitsAndMasks - malloc failed\n"); - return FALSE; - } - - /* Get screen description */ - if (winQueryScreenDIBFormat (pScreen, pbmih)) - { - /* Get a pointer to bitfields */ - pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); - -#if CYGDEBUG - winDebug ("%s - Masks: %08x %08x %08x\n", __FUNCTION__, - pdw[0], pdw[1], pdw[2]); - winDebug ("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__, - pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount, pbmih->biPlanes); - winDebug ("%s - Compression: %d %s\n", __FUNCTION__, - pbmih->biCompression, - (pbmih->biCompression == BI_RGB?"(BI_RGB)": - (pbmih->biCompression == BI_RLE8?"(BI_RLE8)": - (pbmih->biCompression == BI_RLE4?"(BI_RLE4)": - (pbmih->biCompression == BI_BITFIELDS?"(BI_BITFIELDS)":"" - ))))); -#endif - - /* Handle BI_RGB case, which is returned by Wine */ - if (pbmih->biCompression == BI_RGB) - { - dwRedBits = 5; - dwGreenBits = 5; - dwBlueBits = 5; - - pScreenPriv->dwBitsPerRGB = 5; - - /* Set screen privates masks */ - pScreenPriv->dwRedMask = 0x7c00; - pScreenPriv->dwGreenMask = 0x03e0; - pScreenPriv->dwBlueMask = 0x001f; - } - else - { - /* Count the number of bits in each mask */ - dwRedBits = winCountBits (pdw[0]); - dwGreenBits = winCountBits (pdw[1]); - dwBlueBits = winCountBits (pdw[2]); - - /* Find maximum bits per red, green, blue */ - if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) - pScreenPriv->dwBitsPerRGB = dwRedBits; - else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) - pScreenPriv->dwBitsPerRGB = dwGreenBits; - else - pScreenPriv->dwBitsPerRGB = dwBlueBits; - - /* Set screen privates masks */ - pScreenPriv->dwRedMask = pdw[0]; - pScreenPriv->dwGreenMask = pdw[1]; - pScreenPriv->dwBlueMask = pdw[2]; - } - } - else - { - ErrorF ("winQueryRGBBitsAndMasks - winQueryScreenDIBFormat failed\n"); - free (pbmih); - fReturn = FALSE; - } - - /* Free memory */ - free (pbmih); - - return fReturn; -} - - -#ifdef XWIN_MULTIWINDOW -/* - * Redraw all ---? - */ - -static wBOOL CALLBACK -winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam) -{ - if (hwnd == (HWND)lParam) - return TRUE; - InvalidateRect (hwnd, NULL, FALSE); - UpdateWindow (hwnd); - return TRUE; -} - -static wBOOL CALLBACK -winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam) -{ - BoxPtr pDamage = (BoxPtr)lParam; - RECT rcClient, rcDamage, rcRedraw; - POINT topLeft, bottomRight; - - if (IsIconic (hwnd)) - return TRUE; /* Don't care minimized windows */ - - /* Convert the damaged area from Screen coords to Client coords */ - topLeft.x = pDamage->x1; topLeft.y = pDamage->y1; - bottomRight.x = pDamage->x2; bottomRight.y = pDamage->y2; - topLeft.x += GetSystemMetrics (SM_XVIRTUALSCREEN); - bottomRight.x += GetSystemMetrics (SM_XVIRTUALSCREEN); - topLeft.y += GetSystemMetrics (SM_YVIRTUALSCREEN); - bottomRight.y += GetSystemMetrics (SM_YVIRTUALSCREEN); - ScreenToClient (hwnd, &topLeft); - ScreenToClient (hwnd, &bottomRight); - SetRect (&rcDamage, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); - - GetClientRect (hwnd, &rcClient); - - if (IntersectRect (&rcRedraw, &rcClient, &rcDamage)) - { - InvalidateRect (hwnd, &rcRedraw, FALSE); - UpdateWindow (hwnd); - } - return TRUE; -} -#endif - - -/* - * Allocate a DIB for the shadow framebuffer GDI server - */ - -static Bool -winAllocateFBShadowGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - BITMAPINFOHEADER *pbmih = NULL; - DIBSECTION dibsection; - Bool fReturn = TRUE; - - /* Get device contexts for the screen and shadow bitmap */ - pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); - pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen); - - /* Allocate bitmap info header */ - pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) - + 256 * sizeof (RGBQUAD)); - if (pbmih == NULL) - { - ErrorF ("winAllocateFBShadowGDI - malloc () failed\n"); - return FALSE; - } - - /* Query the screen format */ - fReturn = winQueryScreenDIBFormat (pScreen, pbmih); - - /* Describe shadow bitmap to be created */ - pbmih->biWidth = pScreenInfo->dwWidth; - pbmih->biHeight = -pScreenInfo->dwHeight; - - ErrorF ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d " - "depth: %d\n", - (int) pbmih->biWidth, (int) -pbmih->biHeight, pbmih->biBitCount); - - /* Create a DI shadow bitmap with a bit pointer */ - pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen, - (BITMAPINFO *) pbmih, - DIB_RGB_COLORS, - (VOID**) &pScreenInfo->pfb, - NULL, - 0); - if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) - { - winW32Error (2, "winAllocateFBShadowGDI - CreateDIBSection failed:"); - return FALSE; - } - else - { -#if CYGDEBUG - winDebug ("winAllocateFBShadowGDI - Shadow buffer allocated\n"); -#endif - } - - /* Get information about the bitmap that was allocated */ - GetObject (pScreenPriv->hbmpShadow, - sizeof (dibsection), - &dibsection); - -#if CYGDEBUG || YES - /* Print information about bitmap allocated */ - winDebug ("winAllocateFBShadowGDI - Dibsection width: %d height: %d " - "depth: %d size image: %d\n", - (int) dibsection.dsBmih.biWidth, (int) dibsection.dsBmih.biHeight, - dibsection.dsBmih.biBitCount, - (int) dibsection.dsBmih.biSizeImage); -#endif - - /* Select the shadow bitmap into the shadow DC */ - SelectObject (pScreenPriv->hdcShadow, - pScreenPriv->hbmpShadow); - -#if CYGDEBUG - winDebug ("winAllocateFBShadowGDI - Attempting a shadow blit\n"); -#endif - - /* Do a test blit from the shadow to the screen, I think */ - fReturn = BitBlt (pScreenPriv->hdcScreen, - 0, 0, - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - pScreenPriv->hdcShadow, - 0, 0, - SRCCOPY); - if (fReturn) - { -#if CYGDEBUG - winDebug ("winAllocateFBShadowGDI - Shadow blit success\n"); -#endif - } - else - { - winW32Error (2, "winAllocateFBShadowGDI - Shadow blit failure\n"); -#if 0 - return FALSE; -#else - /* ago: ignore this error. The blit fails with wine, but does not - * cause any problems later. */ - - fReturn = TRUE; -#endif - } - - /* Look for height weirdness */ - if (dibsection.dsBmih.biHeight < 0) - { - dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight; - } - - /* Set screeninfo stride */ - pScreenInfo->dwStride = ((dibsection.dsBmih.biSizeImage - / dibsection.dsBmih.biHeight) - * 8) / pScreenInfo->dwBPP; - -#if CYGDEBUG || YES - winDebug ("winAllocateFBShadowGDI - Created shadow stride: %d\n", - (int) pScreenInfo->dwStride); -#endif - - /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP - >= WIN_DIB_MAXIMUM_SIZE) - { - ErrorF ("winAllocateFBShadowGDI - Requested DIB (bitmap) " - "will be larger than %d MB. The surface may fail to be " - "allocated on Windows 95, 98, or Me, due to a %d MB limit in " - "DIB size. This limit does not apply to Windows NT/2000, and " - "this message may be ignored on those platforms.\n", - WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); - } - - /* Determine our color masks */ - if (!winQueryRGBBitsAndMasks (pScreen)) - { - ErrorF ("winAllocateFBShadowGDI - winQueryRGBBitsAndMasks failed\n"); - return FALSE; - } - -#ifdef XWIN_MULTIWINDOW - /* Redraw all windows */ - if (pScreenInfo->fMultiWindow) - EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); -#endif - - return fReturn; -} - - -/* - * Blit the damaged regions of the shadow fb to the screen - */ - -static void -winShadowUpdateGDI (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - RegionPtr damage = shadowDamage(pBuf); - DWORD dwBox = RegionNumRects (damage); - BoxPtr pBox = RegionRects (damage); - int x, y, w, h; - HRGN hrgnTemp = NULL, hrgnCombined = NULL; -#ifdef XWIN_UPDATESTATS - static DWORD s_dwNonUnitRegions = 0; - static DWORD s_dwTotalUpdates = 0; - static DWORD s_dwTotalBoxes = 0; -#endif - BoxPtr pBoxExtents = RegionExtents(damage); - - /* - * Return immediately if the app is not active - * and we are fullscreen, or if we have a bad display depth - */ - if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) - || pScreenPriv->fBadDepth) return; - -#ifdef XWIN_UPDATESTATS - ++s_dwTotalUpdates; - s_dwTotalBoxes += dwBox; - - if (dwBox != 1) - { - ++s_dwNonUnitRegions; - ErrorF ("winShadowUpdatGDI - dwBox: %d\n", dwBox); - } - - if ((s_dwTotalUpdates % 100) == 0) - ErrorF ("winShadowUpdateGDI - %d%% non-unity regions, avg boxes: %d " - "nu: %d tu: %d\n", - (s_dwNonUnitRegions * 100) / s_dwTotalUpdates, - s_dwTotalBoxes / s_dwTotalUpdates, - s_dwNonUnitRegions, s_dwTotalUpdates); -#endif /* XWIN_UPDATESTATS */ - - /* - * Handle small regions with multiple blits, - * handle large regions by creating a clipping region and - * doing a single blit constrained to that clipping region. - */ - if (!pScreenInfo->fMultiWindow && - (pScreenInfo->dwClipUpdatesNBoxes == 0 || - dwBox < pScreenInfo->dwClipUpdatesNBoxes)) - { - /* Loop through all boxes in the damaged region */ - while (dwBox--) - { - /* - * Calculate x offset, y offset, width, and height for - * current damage box - */ - x = pBox->x1; - y = pBox->y1; - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - - BitBlt (pScreenPriv->hdcScreen, - x, y, - w, h, - pScreenPriv->hdcShadow, - x, y, - SRCCOPY); - - /* Get a pointer to the next box */ - ++pBox; - } - } - else if (!pScreenInfo->fMultiWindow) - { - /* Compute a GDI region from the damaged region */ - hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); - dwBox--; - pBox++; - while (dwBox--) - { - hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); - CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); - DeleteObject (hrgnTemp); - pBox++; - } - - /* Install the GDI region as a clipping region */ - SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); - DeleteObject (hrgnCombined); - hrgnCombined = NULL; - - /* - * Blit the shadow buffer to the screen, - * constrained to the clipping region. - */ - BitBlt (pScreenPriv->hdcScreen, - pBoxExtents->x1, pBoxExtents->y1, - pBoxExtents->x2 - pBoxExtents->x1, - pBoxExtents->y2 - pBoxExtents->y1, - pScreenPriv->hdcShadow, - pBoxExtents->x1, pBoxExtents->y1, - SRCCOPY); - - /* Reset the clip region */ - SelectClipRgn (pScreenPriv->hdcScreen, NULL); - } - -#ifdef XWIN_MULTIWINDOW - /* Redraw all multiwindow windows */ - if (pScreenInfo->fMultiWindow) - EnumThreadWindows (g_dwCurrentThreadID, - winRedrawDamagedWindowShadowGDI, - (LPARAM)pBoxExtents); -#endif -} - - -/* See Porting Layer Definition - p. 33 */ -/* - * We wrap whatever CloseScreen procedure was specified by fb; - * a pointer to said procedure is stored in our privates. - */ - -static Bool -winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - Bool fReturn; - -#if CYGDEBUG - winDebug ("winCloseScreenShadowGDI - Freeing screen resources\n"); -#endif - - /* Flag that the screen is closed */ - pScreenPriv->fClosed = TRUE; - pScreenPriv->fActive = FALSE; - - /* Call the wrapped CloseScreen procedure */ - WIN_UNWRAP(CloseScreen); - fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); - - /* Delete the window property */ - RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - - /* Free the shadow DC; which allows the bitmap to be freed */ - DeleteDC (pScreenPriv->hdcShadow); - - /* Free the shadow bitmap */ - DeleteObject (pScreenPriv->hbmpShadow); - - /* Free the screen DC */ - ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); - - /* Delete tray icon, if we have one */ - if (!pScreenInfo->fNoTrayIcon) - winDeleteNotifyIcon (pScreenPriv); - - /* Free the exit confirmation dialog box, if it exists */ - if (g_hDlgExit != NULL) - { - DestroyWindow (g_hDlgExit); - g_hDlgExit = NULL; - } - - /* Kill our window */ - if (pScreenPriv->hwndScreen) - { - DestroyWindow (pScreenPriv->hwndScreen); - pScreenPriv->hwndScreen = NULL; - } - -#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) - /* Destroy the thread startup mutex */ - pthread_mutex_destroy (&pScreenPriv->pmServerStarted); -#endif - - /* Invalidate our screeninfo's pointer to the screen */ - pScreenInfo->pScreen = NULL; - - /* Invalidate the ScreenInfo's fb pointer */ - pScreenInfo->pfb = NULL; - - /* Free the screen privates for this screen */ - free ((pointer) pScreenPriv); - - return fReturn; -} - - -/* - * Tell mi what sort of visuals we need. - * - * Generally we only need one visual, as our screen can only - * handle one format at a time, I believe. You may want - * to verify that last sentence. - */ - -static Bool -winInitVisualsShadowGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Display debugging information */ - ErrorF ("winInitVisualsShadowGDI - Masks %08x %08x %08x BPRGB %d d %d " - "bpp %d\n", - (unsigned int) pScreenPriv->dwRedMask, - (unsigned int) pScreenPriv->dwGreenMask, - (unsigned int) pScreenPriv->dwBlueMask, - (int) pScreenPriv->dwBitsPerRGB, - (int) pScreenInfo->dwDepth, - (int) pScreenInfo->dwBPP); - - /* Create a single visual according to the Windows screen depth */ - switch (pScreenInfo->dwDepth) - { - case 24: - case 16: - case 15: - /* Setup the real visual */ - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - TrueColorMask, - pScreenPriv->dwBitsPerRGB, - -1, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " - "failed\n"); - return FALSE; - } - -#ifdef XWIN_EMULATEPSEUDO - if (!pScreenInfo->fEmulatePseudo) - break; - - /* Setup a pseudocolor visual */ - if (!miSetVisualTypesAndMasks (8, - PseudoColorMask, - 8, - -1, - 0, - 0, - 0)) - { - ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " - "failed for PseudoColor\n"); - return FALSE; - } -#endif - break; - - case 8: - if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, - PseudoColorMask, - pScreenPriv->dwBitsPerRGB, - PseudoColor, - pScreenPriv->dwRedMask, - pScreenPriv->dwGreenMask, - pScreenPriv->dwBlueMask)) - { - ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " - "failed\n"); - return FALSE; - } - break; - - default: - ErrorF ("winInitVisualsShadowGDI - Unknown screen depth\n"); - return FALSE; - } - -#if CYGDEBUG - winDebug ("winInitVisualsShadowGDI - Returning\n"); -#endif - - return TRUE; -} - - -/* - * Adjust the proposed video mode - */ - -static Bool -winAdjustVideoModeShadowGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - HDC hdc; - DWORD dwBPP; - - hdc = GetDC (NULL); - - /* We're in serious trouble if we can't get a DC */ - if (hdc == NULL) - { - ErrorF ("winAdjustVideoModeShadowGDI - GetDC () failed\n"); - return FALSE; - } - - /* Query GDI for current display depth */ - dwBPP = GetDeviceCaps (hdc, BITSPIXEL); - - /* GDI cannot change the screen depth */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) - { - /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeShadowGDI - Using Windows display " - "depth of %d bits per pixel\n", (int) dwBPP); - - /* Use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Warn user if GDI depth is different than -depth parameter */ - ErrorF ("winAdjustVideoModeShadowGDI - Command line bpp: %d, "\ - "using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP); - - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - - /* Release our DC */ - ReleaseDC (NULL, hdc); - hdc = NULL; - - return TRUE; -} - - -/* - * Blt exposed regions to the screen - */ - -static Bool -winBltExposedRegionsShadowGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - winPrivCmapPtr pCmapPriv = NULL; - HDC hdcUpdate; - PAINTSTRUCT ps; - - /* BeginPaint gives us an hdc that clips to the invalidated region */ - hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); - - /* Realize the palette, if we have one */ - if (pScreenPriv->pcmapInstalled != NULL) - { - pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled); - - SelectPalette (hdcUpdate, pCmapPriv->hPalette, FALSE); - RealizePalette (hdcUpdate); - } - - /* Our BitBlt will be clipped to the invalidated region */ - BitBlt (hdcUpdate, - 0, 0, - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - pScreenPriv->hdcShadow, - 0, 0, - SRCCOPY); - - /* EndPaint frees the DC */ - EndPaint (pScreenPriv->hwndScreen, &ps); - -#ifdef XWIN_MULTIWINDOW - /* Redraw all windows */ - if (pScreenInfo->fMultiWindow) - EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, - (LPARAM)pScreenPriv->hwndScreen); -#endif - - return TRUE; -} - - -/* - * Do any engine-specific appliation-activation processing - */ - -static Bool -winActivateAppShadowGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* - * 2004/04/12 - Harold - We perform the restoring or minimizing - * manually for ShadowGDI in fullscreen modes so that this engine - * will perform just like ShadowDD and ShadowDDNL in fullscreen mode; - * if we do not do this then our fullscreen window will appear in the - * z-order when it is deactivated and it can be uncovered by resizing - * or minimizing another window that is on top of it, which is not how - * the DirectDraw engines work. Therefore we keep this code here to - * make sure that all engines work the same in fullscreen mode. - */ - - /* - * Are we active? - * Are we fullscreen? - */ - if (pScreenPriv->fActive - && pScreenInfo->fFullScreen) - { - /* - * Activating, attempt to bring our window - * to the top of the display - */ - ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE); - } - else if (!pScreenPriv->fActive - && pScreenInfo->fFullScreen) - { - /* - * Deactivating, stuff our window onto the - * task bar. - */ - ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); - } - - return TRUE; -} - - -/* - * Reblit the shadow framebuffer to the screen. - */ - -static Bool -winRedrawScreenShadowGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Redraw the whole window, to take account for the new colors */ - BitBlt (pScreenPriv->hdcScreen, - 0, 0, - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - pScreenPriv->hdcShadow, - 0, 0, - SRCCOPY); - -#ifdef XWIN_MULTIWINDOW - /* Redraw all windows */ - if (pScreenInfo->fMultiWindow) - EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); -#endif - - return TRUE; -} - - - -/* - * Realize the currently installed colormap - */ - -static Bool -winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winPrivCmapPtr pCmapPriv = NULL; - -#if CYGDEBUG - winDebug ("winRealizeInstalledPaletteShadowGDI\n"); -#endif - - /* Don't do anything if there is not a colormap */ - if (pScreenPriv->pcmapInstalled == NULL) - { -#if CYGDEBUG - winDebug ("winRealizeInstalledPaletteShadowGDI - No colormap " - "installed\n"); -#endif - return TRUE; - } - - pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled); - - /* Realize our palette for the screen */ - if (RealizePalette (pScreenPriv->hdcScreen) == GDI_ERROR) - { - ErrorF ("winRealizeInstalledPaletteShadowGDI - RealizePalette () " - "failed\n"); - return FALSE; - } - - /* Set the DIB color table */ - if (SetDIBColorTable (pScreenPriv->hdcShadow, - 0, - WIN_NUM_PALETTE_ENTRIES, - pCmapPriv->rgbColors) == 0) - { - ErrorF ("winRealizeInstalledPaletteShadowGDI - SetDIBColorTable () " - "failed\n"); - return FALSE; - } - - return TRUE; -} - - -/* - * Install the specified colormap - */ - -static Bool -winInstallColormapShadowGDI (ColormapPtr pColormap) -{ - ScreenPtr pScreen = pColormap->pScreen; - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - winCmapPriv(pColormap); - - /* - * Tell Windows to install the new colormap - */ - if (SelectPalette (pScreenPriv->hdcScreen, - pCmapPriv->hPalette, - FALSE) == NULL) - { - ErrorF ("winInstallColormapShadowGDI - SelectPalette () failed\n"); - return FALSE; - } - - /* Realize the palette */ - if (GDI_ERROR == RealizePalette (pScreenPriv->hdcScreen)) - { - ErrorF ("winInstallColormapShadowGDI - RealizePalette () failed\n"); - return FALSE; - } - - /* Set the DIB color table */ - if (SetDIBColorTable (pScreenPriv->hdcShadow, - 0, - WIN_NUM_PALETTE_ENTRIES, - pCmapPriv->rgbColors) == 0) - { - ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n"); - return FALSE; - } - - /* Redraw the whole window, to take account for the new colors */ - BitBlt (pScreenPriv->hdcScreen, - 0, 0, - pScreenInfo->dwWidth, pScreenInfo->dwHeight, - pScreenPriv->hdcShadow, - 0, 0, - SRCCOPY); - - /* Save a pointer to the newly installed colormap */ - pScreenPriv->pcmapInstalled = pColormap; - -#ifdef XWIN_MULTIWINDOW - /* Redraw all windows */ - if (pScreenInfo->fMultiWindow) - EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); -#endif - - return TRUE; -} - - -/* - * Store the specified colors in the specified colormap - */ - -static Bool -winStoreColorsShadowGDI (ColormapPtr pColormap, - int ndef, - xColorItem *pdefs) -{ - ScreenPtr pScreen = pColormap->pScreen; - winScreenPriv(pScreen); - winCmapPriv(pColormap); - ColormapPtr curpmap = pScreenPriv->pcmapInstalled; - - /* Put the X colormap entries into the Windows logical palette */ - if (SetPaletteEntries (pCmapPriv->hPalette, - pdefs[0].pixel, - ndef, - pCmapPriv->peColors + pdefs[0].pixel) == 0) - { - ErrorF ("winStoreColorsShadowGDI - SetPaletteEntries () failed\n"); - return FALSE; - } - - /* Don't install the Windows palette if the colormap is not installed */ - if (pColormap != curpmap) - { - return TRUE; - } - - /* Try to install the newly modified colormap */ - if (!winInstallColormapShadowGDI (pColormap)) - { - ErrorF ("winInstallColormapShadowGDI - winInstallColormapShadowGDI " - "failed\n"); - return FALSE; - } - -#if 0 - /* Tell Windows that the palette has changed */ - RealizePalette (pScreenPriv->hdcScreen); - - /* Set the DIB color table */ - if (SetDIBColorTable (pScreenPriv->hdcShadow, - pdefs[0].pixel, - ndef, - pCmapPriv->rgbColors + pdefs[0].pixel) == 0) - { - ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n"); - return FALSE; - } - - /* Save a pointer to the newly installed colormap */ - pScreenPriv->pcmapInstalled = pColormap; -#endif - - return TRUE; -} - - -/* - * Colormap initialization procedure - */ - -static Bool -winCreateColormapShadowGDI (ColormapPtr pColormap) -{ - LPLOGPALETTE lpPaletteNew = NULL; - DWORD dwEntriesMax; - VisualPtr pVisual; - HPALETTE hpalNew = NULL; - winCmapPriv(pColormap); - - /* Get a pointer to the visual that the colormap belongs to */ - pVisual = pColormap->pVisual; - - /* Get the maximum number of palette entries for this visual */ - dwEntriesMax = pVisual->ColormapEntries; - - /* Allocate a Windows logical color palette with max entries */ - lpPaletteNew = malloc (sizeof (LOGPALETTE) - + (dwEntriesMax - 1) * sizeof (PALETTEENTRY)); - if (lpPaletteNew == NULL) - { - ErrorF ("winCreateColormapShadowGDI - Couldn't allocate palette " - "with %d entries\n", - (int) dwEntriesMax); - return FALSE; - } - - /* Zero out the colormap */ - ZeroMemory (lpPaletteNew, sizeof (LOGPALETTE) - + (dwEntriesMax - 1) * sizeof (PALETTEENTRY)); - - /* Set the logical palette structure */ - lpPaletteNew->palVersion = 0x0300; - lpPaletteNew->palNumEntries = dwEntriesMax; - - /* Tell Windows to create the palette */ - hpalNew = CreatePalette (lpPaletteNew); - if (hpalNew == NULL) - { - ErrorF ("winCreateColormapShadowGDI - CreatePalette () failed\n"); - free (lpPaletteNew); - return FALSE; - } - - /* Save the Windows logical palette handle in the X colormaps' privates */ - pCmapPriv->hPalette = hpalNew; - - /* Free the palette initialization memory */ - free (lpPaletteNew); - - return TRUE; -} - - -/* - * Colormap destruction procedure - */ - -static Bool -winDestroyColormapShadowGDI (ColormapPtr pColormap) -{ - winScreenPriv(pColormap->pScreen); - winCmapPriv(pColormap); - - /* - * Is colormap to be destroyed the default? - * - * Non-default colormaps should have had winUninstallColormap - * called on them before we get here. The default colormap - * will not have had winUninstallColormap called on it. Thus, - * we need to handle the default colormap in a special way. - */ - if (pColormap->flags & IsDefault) - { -#if CYGDEBUG - winDebug ("winDestroyColormapShadowGDI - Destroying default " - "colormap\n"); -#endif - - /* - * FIXME: Walk the list of all screens, popping the default - * palette out of each screen device context. - */ - - /* Pop the palette out of the device context */ - SelectPalette (pScreenPriv->hdcScreen, - GetStockObject (DEFAULT_PALETTE), - FALSE); - - /* Clear our private installed colormap pointer */ - pScreenPriv->pcmapInstalled = NULL; - } - - /* Try to delete the logical palette */ - if (DeleteObject (pCmapPriv->hPalette) == 0) - { - ErrorF ("winDestroyColormap - DeleteObject () failed\n"); - return FALSE; - } - - /* Invalidate the colormap privates */ - pCmapPriv->hPalette = NULL; - - return TRUE; -} - - -/* - * Set engine specific funtions - */ - -Bool -winSetEngineFunctionsShadowGDI (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Set our pointers */ - pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI; - pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI; - pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI; - pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI; - pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI; - if (pScreenInfo->fFullScreen) - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; - else - pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; - pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; - pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI; - pScreenPriv->pwinActivateApp = winActivateAppShadowGDI; - pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowGDI; - pScreenPriv->pwinRealizeInstalledPalette = - winRealizeInstalledPaletteShadowGDI; - pScreenPriv->pwinInstallColormap = winInstallColormapShadowGDI; - pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI; - pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI; - pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI; - pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; - pScreenPriv->pwinCreatePrimarySurface - = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA; - pScreenPriv->pwinReleasePrimarySurface - = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA; -#ifdef XWIN_MULTIWINDOW - pScreenPriv->pwinFinishCreateWindowsWindow = - (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA; -#endif - - return TRUE; -} +/* + *Copyright (C) 2001-2004 Harold L Hunt II 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 HAROLD L HUNT II 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 Harold L Hunt II + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from Harold L Hunt II. + * + * Authors: Harold L Hunt II + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" + + +/* + * Local function prototypes + */ + +#ifdef XWIN_MULTIWINDOW +static wBOOL CALLBACK +winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam); + +static wBOOL CALLBACK +winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam); +#endif + +static Bool +winAllocateFBShadowGDI (ScreenPtr pScreen); + +static void +winShadowUpdateGDI (ScreenPtr pScreen, + shadowBufPtr pBuf); + +static Bool +winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen); + +static Bool +winInitVisualsShadowGDI (ScreenPtr pScreen); + +static Bool +winAdjustVideoModeShadowGDI (ScreenPtr pScreen); + +static Bool +winBltExposedRegionsShadowGDI (ScreenPtr pScreen); + +static Bool +winActivateAppShadowGDI (ScreenPtr pScreen); + +static Bool +winRedrawScreenShadowGDI (ScreenPtr pScreen); + +static Bool +winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen); + +static Bool +winInstallColormapShadowGDI (ColormapPtr pColormap); + +static Bool +winStoreColorsShadowGDI (ColormapPtr pmap, + int ndef, + xColorItem *pdefs); + +static Bool +winCreateColormapShadowGDI (ColormapPtr pColormap); + +static Bool +winDestroyColormapShadowGDI (ColormapPtr pColormap); + + +/* + * Internal function to get the DIB format that is compatible with the screen + */ + +static +Bool +winQueryScreenDIBFormat (ScreenPtr pScreen, BITMAPINFOHEADER *pbmih) +{ + winScreenPriv(pScreen); + HBITMAP hbmp; +#if CYGDEBUG + LPDWORD pdw = NULL; +#endif + + /* Create a memory bitmap compatible with the screen */ + hbmp = CreateCompatibleBitmap (pScreenPriv->hdcScreen, 1, 1); + if (hbmp == NULL) + { + ErrorF ("winQueryScreenDIBFormat - CreateCompatibleBitmap failed\n"); + return FALSE; + } + + /* Initialize our bitmap info header */ + ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); + pbmih->biSize = sizeof (BITMAPINFOHEADER); + + /* Get the biBitCount */ + if (!GetDIBits (pScreenPriv->hdcScreen, + hbmp, + 0, 1, + NULL, + (BITMAPINFO*) pbmih, + DIB_RGB_COLORS)) + { + ErrorF ("winQueryScreenDIBFormat - First call to GetDIBits failed\n"); + DeleteObject (hbmp); + return FALSE; + } + +#if CYGDEBUG + /* Get a pointer to bitfields */ + pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); + + winDebug ("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n", + pdw[0], pdw[1], pdw[2]); +#endif + + /* Get optimal color table, or the optimal bitfields */ + if (!GetDIBits (pScreenPriv->hdcScreen, + hbmp, + 0, 1, + NULL, + (BITMAPINFO*)pbmih, + DIB_RGB_COLORS)) + { + ErrorF ("winQueryScreenDIBFormat - Second call to GetDIBits " + "failed\n"); + DeleteObject (hbmp); + return FALSE; + } + + /* Free memory */ + DeleteObject (hbmp); + + return TRUE; +} + + +/* + * Internal function to determine the GDI bits per rgb and bit masks + */ + +static +Bool +winQueryRGBBitsAndMasks (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + BITMAPINFOHEADER *pbmih = NULL; + Bool fReturn = TRUE; + LPDWORD pdw = NULL; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Color masks for 8 bpp are standardized */ + if (GetDeviceCaps (pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE) + { + /* + * RGB BPP for 8 bit palletes is always 8 + * and the color masks are always 0. + */ + pScreenPriv->dwBitsPerRGB = 8; + pScreenPriv->dwRedMask = 0x0L; + pScreenPriv->dwGreenMask = 0x0L; + pScreenPriv->dwBlueMask = 0x0L; + return TRUE; + } + + /* Color masks for 24 bpp are standardized */ + if (GetDeviceCaps (pScreenPriv->hdcScreen, PLANES) + * GetDeviceCaps (pScreenPriv->hdcScreen, BITSPIXEL) == 24) + { + ErrorF ("winQueryRGBBitsAndMasks - GetDeviceCaps (BITSPIXEL) " + "returned 24 for the screen. Using default 24bpp masks.\n"); + + /* 8 bits per primary color */ + pScreenPriv->dwBitsPerRGB = 8; + + /* Set screen privates masks */ + pScreenPriv->dwRedMask = WIN_24BPP_MASK_RED; + pScreenPriv->dwGreenMask = WIN_24BPP_MASK_GREEN; + pScreenPriv->dwBlueMask = WIN_24BPP_MASK_BLUE; + + return TRUE; + } + + /* Allocate a bitmap header and color table */ + pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pbmih == NULL) + { + ErrorF ("winQueryRGBBitsAndMasks - malloc failed\n"); + return FALSE; + } + + /* Get screen description */ + if (winQueryScreenDIBFormat (pScreen, pbmih)) + { + /* Get a pointer to bitfields */ + pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); + +#if CYGDEBUG + winDebug ("%s - Masks: %08x %08x %08x\n", __FUNCTION__, + pdw[0], pdw[1], pdw[2]); + winDebug ("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__, + pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount, pbmih->biPlanes); + winDebug ("%s - Compression: %d %s\n", __FUNCTION__, + pbmih->biCompression, + (pbmih->biCompression == BI_RGB?"(BI_RGB)": + (pbmih->biCompression == BI_RLE8?"(BI_RLE8)": + (pbmih->biCompression == BI_RLE4?"(BI_RLE4)": + (pbmih->biCompression == BI_BITFIELDS?"(BI_BITFIELDS)":"" + ))))); +#endif + + /* Handle BI_RGB case, which is returned by Wine */ + if (pbmih->biCompression == BI_RGB) + { + dwRedBits = 5; + dwGreenBits = 5; + dwBlueBits = 5; + + pScreenPriv->dwBitsPerRGB = 5; + + /* Set screen privates masks */ + pScreenPriv->dwRedMask = 0x7c00; + pScreenPriv->dwGreenMask = 0x03e0; + pScreenPriv->dwBlueMask = 0x001f; + } + else + { + /* Count the number of bits in each mask */ + dwRedBits = winCountBits (pdw[0]); + dwGreenBits = winCountBits (pdw[1]); + dwBlueBits = winCountBits (pdw[2]); + + /* Find maximum bits per red, green, blue */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + /* Set screen privates masks */ + pScreenPriv->dwRedMask = pdw[0]; + pScreenPriv->dwGreenMask = pdw[1]; + pScreenPriv->dwBlueMask = pdw[2]; + } + } + else + { + ErrorF ("winQueryRGBBitsAndMasks - winQueryScreenDIBFormat failed\n"); + free (pbmih); + fReturn = FALSE; + } + + /* Free memory */ + free (pbmih); + + return fReturn; +} + + +#ifdef XWIN_MULTIWINDOW +/* + * Redraw all ---? + */ + +static wBOOL CALLBACK +winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam) +{ + if (hwnd == (HWND)lParam) + return TRUE; + InvalidateRect (hwnd, NULL, FALSE); + UpdateWindow (hwnd); + return TRUE; +} + +static wBOOL CALLBACK +winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam) +{ + BoxPtr pDamage = (BoxPtr)lParam; + RECT rcClient, rcDamage, rcRedraw; + POINT topLeft, bottomRight; + + if (IsIconic (hwnd)) + return TRUE; /* Don't care minimized windows */ + + /* Convert the damaged area from Screen coords to Client coords */ + topLeft.x = pDamage->x1; topLeft.y = pDamage->y1; + bottomRight.x = pDamage->x2; bottomRight.y = pDamage->y2; + topLeft.x += GetSystemMetrics (SM_XVIRTUALSCREEN); + bottomRight.x += GetSystemMetrics (SM_XVIRTUALSCREEN); + topLeft.y += GetSystemMetrics (SM_YVIRTUALSCREEN); + bottomRight.y += GetSystemMetrics (SM_YVIRTUALSCREEN); + ScreenToClient (hwnd, &topLeft); + ScreenToClient (hwnd, &bottomRight); + SetRect (&rcDamage, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); + + GetClientRect (hwnd, &rcClient); + + if (IntersectRect (&rcRedraw, &rcClient, &rcDamage)) + { + InvalidateRect (hwnd, &rcRedraw, FALSE); + UpdateWindow (hwnd); + } + return TRUE; +} +#endif + + +/* + * Allocate a DIB for the shadow framebuffer GDI server + */ + +static Bool +winAllocateFBShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DIBSECTION dibsection; + Bool fReturn = TRUE; + + /* Describe shadow bitmap to be created */ + pScreenPriv->pbmih->biWidth = pScreenInfo->dwWidth; + pScreenPriv->pbmih->biHeight = -pScreenInfo->dwHeight; + + ErrorF ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d " + "depth: %d\n", + (int) pScreenPriv->pbmih->biWidth, (int) -pScreenPriv->pbmih->biHeight, pScreenPriv->pbmih->biBitCount); + + /* Create a DI shadow bitmap with a bit pointer */ + pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen, + (BITMAPINFO *) pScreenPriv->pbmih, + DIB_RGB_COLORS, + (VOID**) &pScreenInfo->pfb, + NULL, + 0); + if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) + { + winW32Error (2, "winAllocateFBShadowGDI - CreateDIBSection failed:"); + return FALSE; + } + else + { +#if CYGDEBUG + winDebug ("winAllocateFBShadowGDI - Shadow buffer allocated\n"); +#endif + } + + /* Get information about the bitmap that was allocated */ + GetObject (pScreenPriv->hbmpShadow, + sizeof (dibsection), + &dibsection); + +#if CYGDEBUG || YES + /* Print information about bitmap allocated */ + winDebug ("winAllocateFBShadowGDI - Dibsection width: %d height: %d " + "depth: %d size image: %d\n", + (int) dibsection.dsBmih.biWidth, (int) dibsection.dsBmih.biHeight, + dibsection.dsBmih.biBitCount, + (int) dibsection.dsBmih.biSizeImage); +#endif + + /* Select the shadow bitmap into the shadow DC */ + SelectObject (pScreenPriv->hdcShadow, + pScreenPriv->hbmpShadow); + +#if CYGDEBUG + winDebug ("winAllocateFBShadowGDI - Attempting a shadow blit\n"); +#endif + + /* Do a test blit from the shadow to the screen, I think */ + fReturn = BitBlt (pScreenPriv->hdcScreen, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + if (fReturn) + { +#if CYGDEBUG + winDebug ("winAllocateFBShadowGDI - Shadow blit success\n"); +#endif + } + else + { + winW32Error (2, "winAllocateFBShadowGDI - Shadow blit failure\n"); +#if 0 + return FALSE; +#else + /* ago: ignore this error. The blit fails with wine, but does not + * cause any problems later. */ + + fReturn = TRUE; +#endif + } + + /* Look for height weirdness */ + if (dibsection.dsBmih.biHeight < 0) + { + dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight; + } + + /* Set screeninfo stride */ + pScreenInfo->dwStride = ((dibsection.dsBmih.biSizeImage + / dibsection.dsBmih.biHeight) + * 8) / pScreenInfo->dwBPP; + +#if CYGDEBUG || YES + winDebug ("winAllocateFBShadowGDI - Created shadow stride: %d\n", + (int) pScreenInfo->dwStride); +#endif + +#ifdef XWIN_MULTIWINDOW + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) + EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); +#endif + + return fReturn; +} + +static void +winFreeFBShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Free the shadow bitmap */ + DeleteObject (pScreenPriv->hbmpShadow); + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; +} + +/* + * Blit the damaged regions of the shadow fb to the screen + */ + +static void +winShadowUpdateGDI (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RegionPtr damage = shadowDamage(pBuf); + DWORD dwBox = RegionNumRects (damage); + BoxPtr pBox = RegionRects (damage); + int x, y, w, h; + HRGN hrgnTemp = NULL, hrgnCombined = NULL; +#ifdef XWIN_UPDATESTATS + static DWORD s_dwNonUnitRegions = 0; + static DWORD s_dwTotalUpdates = 0; + static DWORD s_dwTotalBoxes = 0; +#endif + BoxPtr pBoxExtents = RegionExtents(damage); + + /* + * Return immediately if the app is not active + * and we are fullscreen, or if we have a bad display depth + */ + if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) + || pScreenPriv->fBadDepth) return; + +#ifdef XWIN_UPDATESTATS + ++s_dwTotalUpdates; + s_dwTotalBoxes += dwBox; + + if (dwBox != 1) + { + ++s_dwNonUnitRegions; + ErrorF ("winShadowUpdatGDI - dwBox: %d\n", dwBox); + } + + if ((s_dwTotalUpdates % 100) == 0) + ErrorF ("winShadowUpdateGDI - %d%% non-unity regions, avg boxes: %d " + "nu: %d tu: %d\n", + (s_dwNonUnitRegions * 100) / s_dwTotalUpdates, + s_dwTotalBoxes / s_dwTotalUpdates, + s_dwNonUnitRegions, s_dwTotalUpdates); +#endif /* XWIN_UPDATESTATS */ + + /* + * Handle small regions with multiple blits, + * handle large regions by creating a clipping region and + * doing a single blit constrained to that clipping region. + */ + if (!pScreenInfo->fMultiWindow && + (pScreenInfo->dwClipUpdatesNBoxes == 0 || + dwBox < pScreenInfo->dwClipUpdatesNBoxes)) + { + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* + * Calculate x offset, y offset, width, and height for + * current damage box + */ + x = pBox->x1; + y = pBox->y1; + w = pBox->x2 - pBox->x1; + h = pBox->y2 - pBox->y1; + + BitBlt (pScreenPriv->hdcScreen, + x, y, + w, h, + pScreenPriv->hdcShadow, + x, y, + SRCCOPY); + + /* Get a pointer to the next box */ + ++pBox; + } + } + else if (!pScreenInfo->fMultiWindow) + { + /* Compute a GDI region from the damaged region */ + hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + dwBox--; + pBox++; + while (dwBox--) + { + hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2); + CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); + DeleteObject (hrgnTemp); + pBox++; + } + + /* Install the GDI region as a clipping region */ + SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined); + DeleteObject (hrgnCombined); + hrgnCombined = NULL; + + /* + * Blit the shadow buffer to the screen, + * constrained to the clipping region. + */ + BitBlt (pScreenPriv->hdcScreen, + pBoxExtents->x1, pBoxExtents->y1, + pBoxExtents->x2 - pBoxExtents->x1, + pBoxExtents->y2 - pBoxExtents->y1, + pScreenPriv->hdcShadow, + pBoxExtents->x1, pBoxExtents->y1, + SRCCOPY); + + /* Reset the clip region */ + SelectClipRgn (pScreenPriv->hdcScreen, NULL); + } + +#ifdef XWIN_MULTIWINDOW + /* Redraw all multiwindow windows */ + if (pScreenInfo->fMultiWindow) + EnumThreadWindows (g_dwCurrentThreadID, + winRedrawDamagedWindowShadowGDI, + (LPARAM)pBoxExtents); +#endif +} + + +static Bool +winInitScreenShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Get device contexts for the screen and shadow bitmap */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen); + + /* Allocate bitmap info header */ + pScreenPriv->pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pScreenPriv->pbmih == NULL) + { + ErrorF ("winInitScreenShadowGDI - malloc () failed\n"); + return FALSE; + } + + /* Query the screen format */ + if (!winQueryScreenDIBFormat (pScreen, pScreenPriv->pbmih)) + { + ErrorF ("winInitScreenShadowGDI - winQueryScreenDIBFormat failed\n"); + return FALSE; + } + + /* Determine our color masks */ + if (!winQueryRGBBitsAndMasks (pScreen)) + { + ErrorF ("winInitScreenShadowGDI - winQueryRGBBitsAndMasks failed\n"); + return FALSE; + } + + return winAllocateFBShadowGDI(pScreen); +} + +/* See Porting Layer Definition - p. 33 */ +/* + * We wrap whatever CloseScreen procedure was specified by fb; + * a pointer to said procedure is stored in our privates. + */ + +static Bool +winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + +#if CYGDEBUG + winDebug ("winCloseScreenShadowGDI - Freeing screen resources\n"); +#endif + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + WIN_UNWRAP(CloseScreen); + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the shadow DC; which allows the bitmap to be freed */ + DeleteDC (pScreenPriv->hdcShadow); + + winFreeFBShadowGDI(pScreen); + + /* Free the screen DC */ + ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); + + /* Delete tray icon, if we have one */ + if (!pScreenInfo->fNoTrayIcon) + winDeleteNotifyIcon (pScreenPriv); + + /* Free the exit confirmation dialog box, if it exists */ + if (g_hDlgExit != NULL) + { + DestroyWindow (g_hDlgExit); + g_hDlgExit = NULL; + } + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) + /* Destroy the thread startup mutex */ + pthread_mutex_destroy (&pScreenPriv->pmServerStarted); +#endif + + /* Invalidate our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Free the screen privates for this screen */ + free ((pointer) pScreenPriv); + + return fReturn; +} + + +/* + * Tell mi what sort of visuals we need. + * + * Generally we only need one visual, as our screen can only + * handle one format at a time, I believe. You may want + * to verify that last sentence. + */ + +static Bool +winInitVisualsShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Display debugging information */ + ErrorF ("winInitVisualsShadowGDI - Masks %08x %08x %08x BPRGB %d d %d " + "bpp %d\n", + (unsigned int) pScreenPriv->dwRedMask, + (unsigned int) pScreenPriv->dwGreenMask, + (unsigned int) pScreenPriv->dwBlueMask, + (int) pScreenPriv->dwBitsPerRGB, + (int) pScreenInfo->dwDepth, + (int) pScreenInfo->dwBPP); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 24: + case 16: + case 15: + /* Setup the real visual */ + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + -1, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " + "failed\n"); + return FALSE; + } + +#ifdef XWIN_EMULATEPSEUDO + if (!pScreenInfo->fEmulatePseudo) + break; + + /* Setup a pseudocolor visual */ + if (!miSetVisualTypesAndMasks (8, + PseudoColorMask, + 8, + -1, + 0, + 0, + 0)) + { + ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " + "failed for PseudoColor\n"); + return FALSE; + } +#endif + break; + + case 8: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks " + "failed\n"); + return FALSE; + } + break; + + default: + ErrorF ("winInitVisualsShadowGDI - Unknown screen depth\n"); + return FALSE; + } + +#if CYGDEBUG + winDebug ("winInitVisualsShadowGDI - Returning\n"); +#endif + + return TRUE; +} + + +/* + * Adjust the proposed video mode + */ + +static Bool +winAdjustVideoModeShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc; + DWORD dwBPP; + + hdc = GetDC (NULL); + + /* We're in serious trouble if we can't get a DC */ + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModeShadowGDI - GetDC () failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwBPP = GetDeviceCaps (hdc, BITSPIXEL); + + /* GDI cannot change the screen depth, so always use GDI's depth */ + pScreenInfo->dwBPP = dwBPP; + + /* Release our DC */ + ReleaseDC (NULL, hdc); + hdc = NULL; + + return TRUE; +} + + +/* + * Blt exposed regions to the screen + */ + +static Bool +winBltExposedRegionsShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + winPrivCmapPtr pCmapPriv = NULL; + HDC hdcUpdate; + PAINTSTRUCT ps; + + /* BeginPaint gives us an hdc that clips to the invalidated region */ + hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); + + /* Realize the palette, if we have one */ + if (pScreenPriv->pcmapInstalled != NULL) + { + pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled); + + SelectPalette (hdcUpdate, pCmapPriv->hPalette, FALSE); + RealizePalette (hdcUpdate); + } + + /* Our BitBlt will be clipped to the invalidated region */ + BitBlt (hdcUpdate, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + + /* EndPaint frees the DC */ + EndPaint (pScreenPriv->hwndScreen, &ps); + +#ifdef XWIN_MULTIWINDOW + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) + EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, + (LPARAM)pScreenPriv->hwndScreen); +#endif + + return TRUE; +} + + +/* + * Do any engine-specific appliation-activation processing + */ + +static Bool +winActivateAppShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* + * 2004/04/12 - Harold - We perform the restoring or minimizing + * manually for ShadowGDI in fullscreen modes so that this engine + * will perform just like ShadowDD and ShadowDDNL in fullscreen mode; + * if we do not do this then our fullscreen window will appear in the + * z-order when it is deactivated and it can be uncovered by resizing + * or minimizing another window that is on top of it, which is not how + * the DirectDraw engines work. Therefore we keep this code here to + * make sure that all engines work the same in fullscreen mode. + */ + + /* + * Are we active? + * Are we fullscreen? + */ + if (pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* + * Activating, attempt to bring our window + * to the top of the display + */ + ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE); + } + else if (!pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* + * Deactivating, stuff our window onto the + * task bar. + */ + ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); + } + + return TRUE; +} + + +/* + * Reblit the shadow framebuffer to the screen. + */ + +static Bool +winRedrawScreenShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Redraw the whole window, to take account for the new colors */ + BitBlt (pScreenPriv->hdcScreen, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + +#ifdef XWIN_MULTIWINDOW + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) + EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); +#endif + + return TRUE; +} + + + +/* + * Realize the currently installed colormap + */ + +static Bool +winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winPrivCmapPtr pCmapPriv = NULL; + +#if CYGDEBUG + winDebug ("winRealizeInstalledPaletteShadowGDI\n"); +#endif + + /* Don't do anything if there is not a colormap */ + if (pScreenPriv->pcmapInstalled == NULL) + { +#if CYGDEBUG + winDebug ("winRealizeInstalledPaletteShadowGDI - No colormap " + "installed\n"); +#endif + return TRUE; + } + + pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled); + + /* Realize our palette for the screen */ + if (RealizePalette (pScreenPriv->hdcScreen) == GDI_ERROR) + { + ErrorF ("winRealizeInstalledPaletteShadowGDI - RealizePalette () " + "failed\n"); + return FALSE; + } + + /* Set the DIB color table */ + if (SetDIBColorTable (pScreenPriv->hdcShadow, + 0, + WIN_NUM_PALETTE_ENTRIES, + pCmapPriv->rgbColors) == 0) + { + ErrorF ("winRealizeInstalledPaletteShadowGDI - SetDIBColorTable () " + "failed\n"); + return FALSE; + } + + return TRUE; +} + + +/* + * Install the specified colormap + */ + +static Bool +winInstallColormapShadowGDI (ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + winCmapPriv(pColormap); + + /* + * Tell Windows to install the new colormap + */ + if (SelectPalette (pScreenPriv->hdcScreen, + pCmapPriv->hPalette, + FALSE) == NULL) + { + ErrorF ("winInstallColormapShadowGDI - SelectPalette () failed\n"); + return FALSE; + } + + /* Realize the palette */ + if (GDI_ERROR == RealizePalette (pScreenPriv->hdcScreen)) + { + ErrorF ("winInstallColormapShadowGDI - RealizePalette () failed\n"); + return FALSE; + } + + /* Set the DIB color table */ + if (SetDIBColorTable (pScreenPriv->hdcShadow, + 0, + WIN_NUM_PALETTE_ENTRIES, + pCmapPriv->rgbColors) == 0) + { + ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n"); + return FALSE; + } + + /* Redraw the whole window, to take account for the new colors */ + BitBlt (pScreenPriv->hdcScreen, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; + +#ifdef XWIN_MULTIWINDOW + /* Redraw all windows */ + if (pScreenInfo->fMultiWindow) + EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0); +#endif + + return TRUE; +} + + +/* + * Store the specified colors in the specified colormap + */ + +static Bool +winStoreColorsShadowGDI (ColormapPtr pColormap, + int ndef, + xColorItem *pdefs) +{ + ScreenPtr pScreen = pColormap->pScreen; + winScreenPriv(pScreen); + winCmapPriv(pColormap); + ColormapPtr curpmap = pScreenPriv->pcmapInstalled; + + /* Put the X colormap entries into the Windows logical palette */ + if (SetPaletteEntries (pCmapPriv->hPalette, + pdefs[0].pixel, + ndef, + pCmapPriv->peColors + pdefs[0].pixel) == 0) + { + ErrorF ("winStoreColorsShadowGDI - SetPaletteEntries () failed\n"); + return FALSE; + } + + /* Don't install the Windows palette if the colormap is not installed */ + if (pColormap != curpmap) + { + return TRUE; + } + + /* Try to install the newly modified colormap */ + if (!winInstallColormapShadowGDI (pColormap)) + { + ErrorF ("winInstallColormapShadowGDI - winInstallColormapShadowGDI " + "failed\n"); + return FALSE; + } + +#if 0 + /* Tell Windows that the palette has changed */ + RealizePalette (pScreenPriv->hdcScreen); + + /* Set the DIB color table */ + if (SetDIBColorTable (pScreenPriv->hdcShadow, + pdefs[0].pixel, + ndef, + pCmapPriv->rgbColors + pdefs[0].pixel) == 0) + { + ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n"); + return FALSE; + } + + /* Save a pointer to the newly installed colormap */ + pScreenPriv->pcmapInstalled = pColormap; +#endif + + return TRUE; +} + + +/* + * Colormap initialization procedure + */ + +static Bool +winCreateColormapShadowGDI (ColormapPtr pColormap) +{ + LPLOGPALETTE lpPaletteNew = NULL; + DWORD dwEntriesMax; + VisualPtr pVisual; + HPALETTE hpalNew = NULL; + winCmapPriv(pColormap); + + /* Get a pointer to the visual that the colormap belongs to */ + pVisual = pColormap->pVisual; + + /* Get the maximum number of palette entries for this visual */ + dwEntriesMax = pVisual->ColormapEntries; + + /* Allocate a Windows logical color palette with max entries */ + lpPaletteNew = malloc (sizeof (LOGPALETTE) + + (dwEntriesMax - 1) * sizeof (PALETTEENTRY)); + if (lpPaletteNew == NULL) + { + ErrorF ("winCreateColormapShadowGDI - Couldn't allocate palette " + "with %d entries\n", + (int) dwEntriesMax); + return FALSE; + } + + /* Zero out the colormap */ + ZeroMemory (lpPaletteNew, sizeof (LOGPALETTE) + + (dwEntriesMax - 1) * sizeof (PALETTEENTRY)); + + /* Set the logical palette structure */ + lpPaletteNew->palVersion = 0x0300; + lpPaletteNew->palNumEntries = dwEntriesMax; + + /* Tell Windows to create the palette */ + hpalNew = CreatePalette (lpPaletteNew); + if (hpalNew == NULL) + { + ErrorF ("winCreateColormapShadowGDI - CreatePalette () failed\n"); + free (lpPaletteNew); + return FALSE; + } + + /* Save the Windows logical palette handle in the X colormaps' privates */ + pCmapPriv->hPalette = hpalNew; + + /* Free the palette initialization memory */ + free (lpPaletteNew); + + return TRUE; +} + + +/* + * Colormap destruction procedure + */ + +static Bool +winDestroyColormapShadowGDI (ColormapPtr pColormap) +{ + winScreenPriv(pColormap->pScreen); + winCmapPriv(pColormap); + + /* + * Is colormap to be destroyed the default? + * + * Non-default colormaps should have had winUninstallColormap + * called on them before we get here. The default colormap + * will not have had winUninstallColormap called on it. Thus, + * we need to handle the default colormap in a special way. + */ + if (pColormap->flags & IsDefault) + { +#if CYGDEBUG + winDebug ("winDestroyColormapShadowGDI - Destroying default " + "colormap\n"); +#endif + + /* + * FIXME: Walk the list of all screens, popping the default + * palette out of each screen device context. + */ + + /* Pop the palette out of the device context */ + SelectPalette (pScreenPriv->hdcScreen, + GetStockObject (DEFAULT_PALETTE), + FALSE); + + /* Clear our private installed colormap pointer */ + pScreenPriv->pcmapInstalled = NULL; + } + + /* Try to delete the logical palette */ + if (DeleteObject (pCmapPriv->hPalette) == 0) + { + ErrorF ("winDestroyColormap - DeleteObject () failed\n"); + return FALSE; + } + + /* Invalidate the colormap privates */ + pCmapPriv->hPalette = NULL; + + return TRUE; +} + + +/* + * Set engine specific funtions + */ + +Bool +winSetEngineFunctionsShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI; + pScreenPriv->pwinFreeFB = winFreeFBShadowGDI; + pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI; + pScreenPriv->pwinInitScreen = winInitScreenShadowGDI; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI; + pScreenPriv->pwinActivateApp = winActivateAppShadowGDI; + pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowGDI; + pScreenPriv->pwinRealizeInstalledPalette = + winRealizeInstalledPaletteShadowGDI; + pScreenPriv->pwinInstallColormap = winInstallColormapShadowGDI; + pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI; + pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI; + pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI; + pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinCreatePrimarySurface + = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinReleasePrimarySurface + = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA; +#ifdef XWIN_MULTIWINDOW + pScreenPriv->pwinFinishCreateWindowsWindow = + (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA; +#endif + + return TRUE; +} diff --git a/xorg-server/hw/xwin/winvalargs.c b/xorg-server/hw/xwin/winvalargs.c index f97bce610..04db777b0 100644 --- a/xorg-server/hw/xwin/winvalargs.c +++ b/xorg-server/hw/xwin/winvalargs.c @@ -1,180 +1,180 @@ -/* - *Copyright (C) 2003-2004 Harold L Hunt II 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 HAROLD L HUNT II 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 Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" -#include "winmsg.h" - - - - -/* - * Verify all screens have been explicitly specified - */ -static BOOL -isEveryScreenExplicit(void) -{ - int i; - - for (i = 0; i < g_iNumScreens; i++) - if (!g_ScreenInfo[i].fExplicitScreen) - return FALSE; - - return TRUE; -} - -/* - * winValidateArgs - Look for invalid argument combinations - */ - -Bool -winValidateArgs (void) -{ - int i; - int iMaxConsecutiveScreen = 0; - BOOL fHasNormalScreen0 = FALSE; - BOOL fImplicitScreenFound = FALSE; - - /* - * Check for a malformed set of -screen parameters. - * Examples of malformed parameters: - * XWin -screen 1 - * XWin -screen 0 -screen 2 - * XWin -screen 1 -screen 2 - */ - if (!isEveryScreenExplicit()) - { - ErrorF ("winValidateArgs - Malformed set of screen parameter(s). " - "Screens must be specified consecutively starting with " - "screen 0. That is, you cannot have only a screen 1, nor " - "could you have screen 0 and screen 2. You instead must " - "have screen 0, or screen 0 and screen 1, respectively. " - "You can specify as many screens as you want.\n"); - return FALSE; - } - - /* Loop through all screens */ - for (i = 0; i < g_iNumScreens; ++i) - { - /* - * Check for any combination of - * -multiwindow, -mwextwm, and -rootless. - */ - { - int iCount = 0; - - /* Count conflicting options */ -#ifdef XWIN_MULTIWINDOW - if (g_ScreenInfo[i].fMultiWindow) - ++iCount; -#endif -#ifdef XWIN_MULTIWINDOWEXTWM - if (g_ScreenInfo[i].fMWExtWM) - ++iCount; -#endif - if (g_ScreenInfo[i].fRootless) - ++iCount; - - /* Check if the first screen is without rootless and multiwindow */ - if (iCount == 0 && i == 0) - fHasNormalScreen0 = TRUE; - - /* Fail if two or more conflicting options */ - if (iCount > 1) - { - ErrorF ("winValidateArgs - Only one of -multiwindow, -mwextwm, " - "and -rootless can be specific at a time.\n"); - return FALSE; - } - } - - /* Check for -multiwindow or -mwextwm and Xdmcp */ - /* allow xdmcp if screen 0 is normal. */ - if (g_fXdmcpEnabled && !fHasNormalScreen0 - && (FALSE -#ifdef XWIN_MULTIWINDOW - || g_ScreenInfo[i].fMultiWindow -#endif -#ifdef XWIN_MULTIWINDOWEXTWM - || g_ScreenInfo[i].fMWExtWM -#endif - ) - ) - { - ErrorF ("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) " - "is invalid with -multiwindow or -mwextwm.\n"); - return FALSE; - } - - /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */ - if (g_ScreenInfo[i].fFullScreen - && (FALSE -#ifdef XWIN_MULTIWINDOW - || g_ScreenInfo[i].fMultiWindow -#endif -#ifdef XWIN_MULTIWINDOWEXTWM - || g_ScreenInfo[i].fMWExtWM -#endif - || g_ScreenInfo[i].fRootless) - ) - { - ErrorF ("winValidateArgs - -fullscreen is invalid with " - "-multiwindow, -mwextwm, or -rootless.\n"); - return FALSE; - } - - /* Check for !fullscreen and any fullscreen-only parameters */ - if (!g_ScreenInfo[i].fFullScreen - && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_BPP - || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_REFRESH)) - { - ErrorF ("winValidateArgs - -refresh and -depth are only valid " - "with -fullscreen.\n"); - return FALSE; - } - - /* Check for fullscreen and any non-fullscreen parameters */ - if (g_ScreenInfo[i].fFullScreen - && (g_ScreenInfo[i].fScrollbars - || !g_ScreenInfo[i].fDecoration - || g_ScreenInfo[i].fLessPointer)) - { - ErrorF ("winValidateArgs - -fullscreen is invalid with " - "-scrollbars, -nodecoration, or -lesspointer.\n"); - return FALSE; - } - } - - winDebug ("winValidateArgs - Returning.\n"); - - return TRUE; -} +/* + *Copyright (C) 2003-2004 Harold L Hunt II 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 HAROLD L HUNT II 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 Harold L Hunt II + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from Harold L Hunt II. + * + * Authors: Harold L Hunt II + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" +#include "winmsg.h" + + + + +/* + * Verify all screens have been explicitly specified + */ +static BOOL +isEveryScreenExplicit(void) +{ + int i; + + for (i = 0; i < g_iNumScreens; i++) + if (!g_ScreenInfo[i].fExplicitScreen) + return FALSE; + + return TRUE; +} + +/* + * winValidateArgs - Look for invalid argument combinations + */ + +Bool +winValidateArgs (void) +{ + int i; + int iMaxConsecutiveScreen = 0; + BOOL fHasNormalScreen0 = FALSE; + BOOL fImplicitScreenFound = FALSE; + + /* + * Check for a malformed set of -screen parameters. + * Examples of malformed parameters: + * XWin -screen 1 + * XWin -screen 0 -screen 2 + * XWin -screen 1 -screen 2 + */ + if (!isEveryScreenExplicit()) + { + ErrorF ("winValidateArgs - Malformed set of screen parameter(s). " + "Screens must be specified consecutively starting with " + "screen 0. That is, you cannot have only a screen 1, nor " + "could you have screen 0 and screen 2. You instead must " + "have screen 0, or screen 0 and screen 1, respectively. " + "You can specify as many screens as you want.\n"); + return FALSE; + } + + /* Loop through all screens */ + for (i = 0; i < g_iNumScreens; ++i) + { + /* + * Check for any combination of + * -multiwindow, -mwextwm, and -rootless. + */ + { + int iCount = 0; + + /* Count conflicting options */ +#ifdef XWIN_MULTIWINDOW + if (g_ScreenInfo[i].fMultiWindow) + ++iCount; +#endif +#ifdef XWIN_MULTIWINDOWEXTWM + if (g_ScreenInfo[i].fMWExtWM) + ++iCount; +#endif + if (g_ScreenInfo[i].fRootless) + ++iCount; + + /* Check if the first screen is without rootless and multiwindow */ + if (iCount == 0 && i == 0) + fHasNormalScreen0 = TRUE; + + /* Fail if two or more conflicting options */ + if (iCount > 1) + { + ErrorF ("winValidateArgs - Only one of -multiwindow, -mwextwm, " + "and -rootless can be specific at a time.\n"); + return FALSE; + } + } + + /* Check for -multiwindow or -mwextwm and Xdmcp */ + /* allow xdmcp if screen 0 is normal. */ + if (g_fXdmcpEnabled && !fHasNormalScreen0 + && (FALSE +#ifdef XWIN_MULTIWINDOW + || g_ScreenInfo[i].fMultiWindow +#endif +#ifdef XWIN_MULTIWINDOWEXTWM + || g_ScreenInfo[i].fMWExtWM +#endif + ) + ) + { + ErrorF ("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) " + "is invalid with -multiwindow or -mwextwm.\n"); + return FALSE; + } + + /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */ + if (g_ScreenInfo[i].fFullScreen + && (FALSE +#ifdef XWIN_MULTIWINDOW + || g_ScreenInfo[i].fMultiWindow +#endif +#ifdef XWIN_MULTIWINDOWEXTWM + || g_ScreenInfo[i].fMWExtWM +#endif + || g_ScreenInfo[i].fRootless) + ) + { + ErrorF ("winValidateArgs - -fullscreen is invalid with " + "-multiwindow, -mwextwm, or -rootless.\n"); + return FALSE; + } + + /* Check for !fullscreen and any fullscreen-only parameters */ + if (!g_ScreenInfo[i].fFullScreen + && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH + || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_BPP)) + { + ErrorF ("winValidateArgs - -refresh and -depth are only valid " + "with -fullscreen.\n"); + return FALSE; + } + + /* Check for fullscreen and any non-fullscreen parameters */ + if (g_ScreenInfo[i].fFullScreen + && ((g_ScreenInfo[i].iResizeMode != notAllowed) + || !g_ScreenInfo[i].fDecoration + || g_ScreenInfo[i].fLessPointer)) + { + ErrorF ("winValidateArgs - -fullscreen is invalid with " + "-scrollbars, -resize, -nodecoration, or -lesspointer.\n"); + return FALSE; + } + } + + winDebug ("winValidateArgs - Returning.\n"); + + return TRUE; +} diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c index f6371a65c..7975d71a9 100644 --- a/xorg-server/hw/xwin/winwindow.c +++ b/xorg-server/hw/xwin/winwindow.c @@ -1,636 +1,637 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *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 XFREE86 PROJECT 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 XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Harold L Hunt II - * Kensuke Matsuzaki - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" - - -/* - * Prototypes for local functions - */ - -static int -winAddRgn (WindowPtr pWindow, pointer data); - -static -void -winUpdateRgnRootless (WindowPtr pWindow); - -static -void -winReshapeRootless (WindowPtr pWin); - - -#ifdef XWIN_NATIVEGDI -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbCreateWindow() */ - -Bool -winCreateWindowNativeGDI (WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winCreateWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(CreateWindow); - fResult = (*pScreen->CreateWindow) (pWin); - WIN_WRAP(CreateWindow, winCreateWindowNativeGDI); - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbDestroyWindow() */ - -Bool -winDestroyWindowNativeGDI (WindowPtr pWin) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winDestroyWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(DestroyWindow); - fResult = (*pScreen->DestroyWindow)(pWin); - WIN_WRAP(DestroyWindow, winDestroyWindowNativeGDI); - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbPositionWindow() */ - -Bool -winPositionWindowNativeGDI (WindowPtr pWin, int x, int y) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winPositionWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(PositionWindow); - fResult = (*pScreen->PositionWindow)(pWin, x, y); - WIN_WRAP(PositionWindow, winPositionWindowNativeGDI); - - return fResult; -} - - -/* See Porting Layer Definition - p. 39 */ -/* See mfb/mfbwindow.c - mfbCopyWindow() */ - -void -winCopyWindowNativeGDI (WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc) -{ - DDXPointPtr pptSrc; - DDXPointPtr ppt; - RegionPtr prgnDst; - BoxPtr pBox; - int dx, dy; - int i, nbox; - WindowPtr pwinRoot; - BoxPtr pBoxDst; - ScreenPtr pScreen = pWin->drawable.pScreen; - winScreenPriv(pScreen); - -#if 0 - ErrorF ("winCopyWindow\n"); -#endif - - /* Get a pointer to the root window */ - pwinRoot = pWin->drawable.pScreen->root; - - /* Create a region for the destination */ - prgnDst = RegionCreate(NULL, 1); - - /* Calculate the shift from the source to the destination */ - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - - /* Translate the region from the destination to the source? */ - RegionTranslate(prgnSrc, -dx, -dy); - RegionIntersect(prgnDst, &pWin->borderClip, - prgnSrc); - - /* Get a pointer to the first box in the region to be copied */ - pBox = RegionRects(prgnDst); - - /* Get the number of boxes in the region */ - nbox = RegionNumRects(prgnDst); - - /* Allocate source points for each box */ - if(!(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) - return; - - /* Set an iterator pointer */ - ppt = pptSrc; - - /* Calculate the source point of each box? */ - for (i = nbox; --i >= 0; ppt++, pBox++) - { - ppt->x = pBox->x1 + dx; - ppt->y = pBox->y1 + dy; - } - - /* Setup loop pointers again */ - pBoxDst = RegionRects(prgnDst); - ppt = pptSrc; - -#if 0 - ErrorF ("winCopyWindow - x1\tx2\ty1\ty2\tx\ty\n"); -#endif - - /* BitBlt each source to the destination point */ - for (i = nbox; --i >= 0; pBoxDst++, ppt++) - { -#if 0 - ErrorF ("winCopyWindow - %d\t%d\t%d\t%d\t%d\t%d\n", - pBoxDst->x1, pBoxDst->x2, pBoxDst->y1, pBoxDst->y2, - ppt->x, ppt->y); -#endif - - BitBlt (pScreenPriv->hdcScreen, - pBoxDst->x1, pBoxDst->y1, - pBoxDst->x2 - pBoxDst->x1, pBoxDst->y2 - pBoxDst->y1, - pScreenPriv->hdcScreen, - ppt->x, ppt->y, - SRCCOPY); - } - - /* Cleanup the regions, etc. */ - free(pptSrc); - RegionDestroy(prgnDst); -} - - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ - -Bool -winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winChangeWindowAttributesNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(ChangeWindowAttributes); - fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask); - WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesNativeGDI); - - /* - * NOTE: We do not currently need to do anything here. - */ - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 - * Also referred to as UnrealizeWindow - */ - -Bool -winUnmapWindowNativeGDI (WindowPtr pWin) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winUnmapWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(UnrealizeWindow); - fResult = (*pScreen->UnrealizeWindow)(pWin); - WIN_WRAP(UnrealizeWindow, winUnmapWindowNativeGDI); - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 - * Also referred to as RealizeWindow - */ - -Bool -winMapWindowNativeGDI (WindowPtr pWin) -{ - Bool fResult = TRUE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winMapWindowNativeGDI (%p)\n", pWin); -#endif - - WIN_UNWRAP(RealizeWindow); - fResult = (*pScreen->RealizeWindow)(pWin); - WIN_WRAP(RealizeWindow, winMapWindowMultiWindow); - - return fResult; - -} -#endif - - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbCreateWindow() */ - -Bool -winCreateWindowRootless (WindowPtr pWin) -{ - Bool fResult = FALSE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winCreateWindowRootless (%p)\n", pWin); -#endif - - WIN_UNWRAP(CreateWindow); - fResult = (*pScreen->CreateWindow) (pWin); - WIN_WRAP(CreateWindow, winCreateWindowRootless); - - pWinPriv->hRgn = NULL; - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbDestroyWindow() */ - -Bool -winDestroyWindowRootless (WindowPtr pWin) -{ - Bool fResult = FALSE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winDestroyWindowRootless (%p)\n", pWin); -#endif - - WIN_UNWRAP(DestroyWindow); - fResult = (*pScreen->DestroyWindow)(pWin); - WIN_WRAP(DestroyWindow, winDestroyWindowRootless); - - if (pWinPriv->hRgn != NULL) - { - DeleteObject(pWinPriv->hRgn); - pWinPriv->hRgn = NULL; - } - - winUpdateRgnRootless (pWin); - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbPositionWindow() */ - -Bool -winPositionWindowRootless (WindowPtr pWin, int x, int y) -{ - Bool fResult = FALSE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winScreenPriv(pScreen); - - -#if CYGDEBUG - winTrace ("winPositionWindowRootless (%p)\n", pWin); -#endif - - WIN_UNWRAP(PositionWindow); - fResult = (*pScreen->PositionWindow)(pWin, x, y); - WIN_WRAP(PositionWindow, winPositionWindowRootless); - - winUpdateRgnRootless (pWin); - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 */ -/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ - -Bool -winChangeWindowAttributesRootless (WindowPtr pWin, unsigned long mask) -{ - Bool fResult = FALSE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winChangeWindowAttributesRootless (%p)\n", pWin); -#endif - - WIN_UNWRAP(ChangeWindowAttributes); - fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask); - WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless); - - winUpdateRgnRootless (pWin); - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 - * Also referred to as UnrealizeWindow - */ - -Bool -winUnmapWindowRootless (WindowPtr pWin) -{ - Bool fResult = FALSE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winUnmapWindowRootless (%p)\n", pWin); -#endif - - WIN_UNWRAP(UnrealizeWindow); - fResult = (*pScreen->UnrealizeWindow)(pWin); - WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless); - - if (pWinPriv->hRgn != NULL) - { - DeleteObject(pWinPriv->hRgn); - pWinPriv->hRgn = NULL; - } - - winUpdateRgnRootless (pWin); - - return fResult; -} - - -/* See Porting Layer Definition - p. 37 - * Also referred to as RealizeWindow - */ - -Bool -winMapWindowRootless (WindowPtr pWin) -{ - Bool fResult = FALSE; - ScreenPtr pScreen = pWin->drawable.pScreen; - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winMapWindowRootless (%p)\n", pWin); -#endif - - WIN_UNWRAP(RealizeWindow); - fResult = (*pScreen->RealizeWindow)(pWin); - WIN_WRAP(RealizeWindow, winMapWindowRootless); - - winReshapeRootless (pWin); - - winUpdateRgnRootless (pWin); - - return fResult; -} - - -void -winSetShapeRootless (WindowPtr pWin, int kind) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - winScreenPriv(pScreen); - -#if CYGDEBUG - winTrace ("winSetShapeRootless (%p, %i)\n", pWin, kind); -#endif - - WIN_UNWRAP(SetShape); - (*pScreen->SetShape)(pWin, kind); - WIN_WRAP(SetShape, winSetShapeRootless); - - winReshapeRootless (pWin); - winUpdateRgnRootless (pWin); - - return; -} - - -/* - * Local function for adding a region to the Windows window region - */ - -static -int -winAddRgn (WindowPtr pWin, pointer data) -{ - int iX, iY, iWidth, iHeight, iBorder; - HRGN hRgn = *(HRGN*)data; - HRGN hRgnWin; - winWindowPriv(pWin); - - /* If pWin is not Root */ - if (pWin->parent != NULL) - { -#if CYGDEBUG - winDebug ("winAddRgn ()\n"); -#endif - if (pWin->mapped) - { - iBorder = wBorderWidth (pWin); - - iX = pWin->drawable.x - iBorder; - iY = pWin->drawable.y - iBorder; - - iWidth = pWin->drawable.width + iBorder * 2; - iHeight = pWin->drawable.height + iBorder * 2; - - hRgnWin = CreateRectRgn (0, 0, iWidth, iHeight); - - if (hRgnWin == NULL) - { - ErrorF ("winAddRgn - CreateRectRgn () failed\n"); - ErrorF (" Rect %d %d %d %d\n", - iX, iY, iX + iWidth, iY + iHeight); - } - - if (pWinPriv->hRgn) - { - if (CombineRgn (hRgnWin, hRgnWin, pWinPriv->hRgn, RGN_AND) - == ERROR) - { - ErrorF ("winAddRgn - CombineRgn () failed\n"); - } - } - - OffsetRgn (hRgnWin, iX, iY); - - if (CombineRgn (hRgn, hRgn, hRgnWin, RGN_OR) == ERROR) - { - ErrorF ("winAddRgn - CombineRgn () failed\n"); - } - - DeleteObject (hRgnWin); - } - return WT_DONTWALKCHILDREN; - } - else - { - return WT_WALKCHILDREN; - } -} - - -/* - * Local function to update the Windows window's region - */ - -static -void -winUpdateRgnRootless (WindowPtr pWin) -{ - HRGN hRgn = CreateRectRgn (0, 0, 0, 0); - - if (hRgn != NULL) - { - WalkTree (pWin->drawable.pScreen, winAddRgn, &hRgn); - SetWindowRgn (winGetScreenPriv(pWin->drawable.pScreen)->hwndScreen, - hRgn, TRUE); - } - else - { - ErrorF ("winUpdateRgnRootless - CreateRectRgn failed.\n"); - } -} - - -static -void -winReshapeRootless (WindowPtr pWin) -{ - int nRects; - RegionRec rrNewShape; - BoxPtr pShape, pRects, pEnd; - HRGN hRgn, hRgnRect; - winWindowPriv(pWin); - -#if CYGDEBUG - winDebug ("winReshapeRootless ()\n"); -#endif - - /* Bail if the window is the root window */ - if (pWin->parent == NULL) - return; - - /* Bail if the window is not top level */ - if (pWin->parent->parent != NULL) - return; - - /* Free any existing window region stored in the window privates */ - if (pWinPriv->hRgn != NULL) - { - DeleteObject (pWinPriv->hRgn); - pWinPriv->hRgn = NULL; - } - - /* Bail if the window has no bounding region defined */ - if (!wBoundingShape (pWin)) - return; - - RegionNull(&rrNewShape); - RegionCopy(&rrNewShape, wBoundingShape(pWin)); - RegionTranslate(&rrNewShape, pWin->borderWidth, - pWin->borderWidth); - - nRects = RegionNumRects(&rrNewShape); - pShape = RegionRects(&rrNewShape); - - if (nRects > 0) - { - /* Create initial empty Windows region */ - hRgn = CreateRectRgn (0, 0, 0, 0); - - /* Loop through all rectangles in the X region */ - for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) - { - /* Create a Windows region for the X rectangle */ - hRgnRect = CreateRectRgn (pRects->x1, pRects->y1, - pRects->x2, pRects->y2); - if (hRgnRect == NULL) - { - ErrorF("winReshapeRootless - CreateRectRgn() failed\n"); - } - - /* Merge the Windows region with the accumulated region */ - if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) - { - ErrorF("winReshapeRootless - CombineRgn() failed\n"); - } - - /* Delete the temporary Windows region */ - DeleteObject (hRgnRect); - } - - /* Save a handle to the composite region in the window privates */ - pWinPriv->hRgn = hRgn; - } - - RegionUninit(&rrNewShape); - - return; -} +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + * Kensuke Matsuzaki + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" + + +/* + * Prototypes for local functions + */ + +static int +winAddRgn (WindowPtr pWindow, pointer data); + +static +void +winUpdateRgnRootless (WindowPtr pWindow); + +static +void +winReshapeRootless (WindowPtr pWin); + + +#ifdef XWIN_NATIVEGDI +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbCreateWindow() */ + +Bool +winCreateWindowNativeGDI (WindowPtr pWin) +{ + Bool fResult = TRUE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winCreateWindowNativeGDI (%p)\n", pWin); +#endif + + WIN_UNWRAP(CreateWindow); + fResult = (*pScreen->CreateWindow) (pWin); + WIN_WRAP(CreateWindow, winCreateWindowNativeGDI); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbDestroyWindow() */ + +Bool +winDestroyWindowNativeGDI (WindowPtr pWin) +{ + Bool fResult = TRUE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winDestroyWindowNativeGDI (%p)\n", pWin); +#endif + + WIN_UNWRAP(DestroyWindow); + fResult = (*pScreen->DestroyWindow)(pWin); + WIN_WRAP(DestroyWindow, winDestroyWindowNativeGDI); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbPositionWindow() */ + +Bool +winPositionWindowNativeGDI (WindowPtr pWin, int x, int y) +{ + Bool fResult = TRUE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winPositionWindowNativeGDI (%p)\n", pWin); +#endif + + WIN_UNWRAP(PositionWindow); + fResult = (*pScreen->PositionWindow)(pWin, x, y); + WIN_WRAP(PositionWindow, winPositionWindowNativeGDI); + + return fResult; +} + + +/* See Porting Layer Definition - p. 39 */ +/* See mfb/mfbwindow.c - mfbCopyWindow() */ + +void +winCopyWindowNativeGDI (WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc) +{ + DDXPointPtr pptSrc; + DDXPointPtr ppt; + RegionPtr prgnDst; + BoxPtr pBox; + int dx, dy; + int i, nbox; + WindowPtr pwinRoot; + BoxPtr pBoxDst; + ScreenPtr pScreen = pWin->drawable.pScreen; + winScreenPriv(pScreen); + +#if 0 + ErrorF ("winCopyWindow\n"); +#endif + + /* Get a pointer to the root window */ + pwinRoot = pWin->drawable.pScreen->root; + + /* Create a region for the destination */ + prgnDst = RegionCreate(NULL, 1); + + /* Calculate the shift from the source to the destination */ + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + + /* Translate the region from the destination to the source? */ + RegionTranslate(prgnSrc, -dx, -dy); + RegionIntersect(prgnDst, &pWin->borderClip, + prgnSrc); + + /* Get a pointer to the first box in the region to be copied */ + pBox = RegionRects(prgnDst); + + /* Get the number of boxes in the region */ + nbox = RegionNumRects(prgnDst); + + /* Allocate source points for each box */ + if(!(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) + return; + + /* Set an iterator pointer */ + ppt = pptSrc; + + /* Calculate the source point of each box? */ + for (i = nbox; --i >= 0; ppt++, pBox++) + { + ppt->x = pBox->x1 + dx; + ppt->y = pBox->y1 + dy; + } + + /* Setup loop pointers again */ + pBoxDst = RegionRects(prgnDst); + ppt = pptSrc; + +#if 0 + ErrorF ("winCopyWindow - x1\tx2\ty1\ty2\tx\ty\n"); +#endif + + /* BitBlt each source to the destination point */ + for (i = nbox; --i >= 0; pBoxDst++, ppt++) + { +#if 0 + ErrorF ("winCopyWindow - %d\t%d\t%d\t%d\t%d\t%d\n", + pBoxDst->x1, pBoxDst->x2, pBoxDst->y1, pBoxDst->y2, + ppt->x, ppt->y); +#endif + + BitBlt (pScreenPriv->hdcScreen, + pBoxDst->x1, pBoxDst->y1, + pBoxDst->x2 - pBoxDst->x1, pBoxDst->y2 - pBoxDst->y1, + pScreenPriv->hdcScreen, + ppt->x, ppt->y, + SRCCOPY); + } + + /* Cleanup the regions, etc. */ + free(pptSrc); + RegionDestroy(prgnDst); +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ + +Bool +winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask) +{ + Bool fResult = TRUE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winChangeWindowAttributesNativeGDI (%p)\n", pWin); +#endif + + WIN_UNWRAP(ChangeWindowAttributes); + fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask); + WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesNativeGDI); + + /* + * NOTE: We do not currently need to do anything here. + */ + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 + * Also referred to as UnrealizeWindow + */ + +Bool +winUnmapWindowNativeGDI (WindowPtr pWin) +{ + Bool fResult = TRUE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winUnmapWindowNativeGDI (%p)\n", pWin); +#endif + + WIN_UNWRAP(UnrealizeWindow); + fResult = (*pScreen->UnrealizeWindow)(pWin); + WIN_WRAP(UnrealizeWindow, winUnmapWindowNativeGDI); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 + * Also referred to as RealizeWindow + */ + +Bool +winMapWindowNativeGDI (WindowPtr pWin) +{ + Bool fResult = TRUE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winMapWindowNativeGDI (%p)\n", pWin); +#endif + + WIN_UNWRAP(RealizeWindow); + fResult = (*pScreen->RealizeWindow)(pWin); + WIN_WRAP(RealizeWindow, winMapWindowMultiWindow); + + return fResult; + +} +#endif + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbCreateWindow() */ + +Bool +winCreateWindowRootless (WindowPtr pWin) +{ + Bool fResult = FALSE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winCreateWindowRootless (%p)\n", pWin); +#endif + + WIN_UNWRAP(CreateWindow); + fResult = (*pScreen->CreateWindow) (pWin); + WIN_WRAP(CreateWindow, winCreateWindowRootless); + + pWinPriv->hRgn = NULL; + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbDestroyWindow() */ + +Bool +winDestroyWindowRootless (WindowPtr pWin) +{ + Bool fResult = FALSE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winDestroyWindowRootless (%p)\n", pWin); +#endif + + WIN_UNWRAP(DestroyWindow); + fResult = (*pScreen->DestroyWindow)(pWin); + WIN_WRAP(DestroyWindow, winDestroyWindowRootless); + + if (pWinPriv->hRgn != NULL) + { + DeleteObject(pWinPriv->hRgn); + pWinPriv->hRgn = NULL; + } + + winUpdateRgnRootless (pWin); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbPositionWindow() */ + +Bool +winPositionWindowRootless (WindowPtr pWin, int x, int y) +{ + Bool fResult = FALSE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winScreenPriv(pScreen); + + +#if CYGDEBUG + winTrace ("winPositionWindowRootless (%p)\n", pWin); +#endif + + WIN_UNWRAP(PositionWindow); + fResult = (*pScreen->PositionWindow)(pWin, x, y); + WIN_WRAP(PositionWindow, winPositionWindowRootless); + + winUpdateRgnRootless (pWin); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ + +Bool +winChangeWindowAttributesRootless (WindowPtr pWin, unsigned long mask) +{ + Bool fResult = FALSE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winChangeWindowAttributesRootless (%p)\n", pWin); +#endif + + WIN_UNWRAP(ChangeWindowAttributes); + fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask); + WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless); + + winUpdateRgnRootless (pWin); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 + * Also referred to as UnrealizeWindow + */ + +Bool +winUnmapWindowRootless (WindowPtr pWin) +{ + Bool fResult = FALSE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winWindowPriv(pWin); + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winUnmapWindowRootless (%p)\n", pWin); +#endif + + WIN_UNWRAP(UnrealizeWindow); + fResult = (*pScreen->UnrealizeWindow)(pWin); + WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless); + + if (pWinPriv->hRgn != NULL) + { + DeleteObject(pWinPriv->hRgn); + pWinPriv->hRgn = NULL; + } + + winUpdateRgnRootless (pWin); + + return fResult; +} + + +/* See Porting Layer Definition - p. 37 + * Also referred to as RealizeWindow + */ + +Bool +winMapWindowRootless (WindowPtr pWin) +{ + Bool fResult = FALSE; + ScreenPtr pScreen = pWin->drawable.pScreen; + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winMapWindowRootless (%p)\n", pWin); +#endif + + WIN_UNWRAP(RealizeWindow); + fResult = (*pScreen->RealizeWindow)(pWin); + WIN_WRAP(RealizeWindow, winMapWindowRootless); + + winReshapeRootless (pWin); + + winUpdateRgnRootless (pWin); + + return fResult; +} + + +void +winSetShapeRootless (WindowPtr pWin, int kind) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + winScreenPriv(pScreen); + +#if CYGDEBUG + winTrace ("winSetShapeRootless (%p, %i)\n", pWin, kind); +#endif + + WIN_UNWRAP(SetShape); + (*pScreen->SetShape)(pWin, kind); + WIN_WRAP(SetShape, winSetShapeRootless); + + winReshapeRootless (pWin); + winUpdateRgnRootless (pWin); + + return; +} + + +/* + * Local function for adding a region to the Windows window region + */ + +static +int +winAddRgn (WindowPtr pWin, pointer data) +{ + int iX, iY, iWidth, iHeight, iBorder; + HRGN hRgn = *(HRGN*)data; + HRGN hRgnWin; + winWindowPriv(pWin); + + /* If pWin is not Root */ + if (pWin->parent != NULL) + { +#if CYGDEBUG + winDebug ("winAddRgn ()\n"); +#endif + if (pWin->mapped) + { + iBorder = wBorderWidth (pWin); + + iX = pWin->drawable.x - iBorder; + iY = pWin->drawable.y - iBorder; + + iWidth = pWin->drawable.width + iBorder * 2; + iHeight = pWin->drawable.height + iBorder * 2; + + hRgnWin = CreateRectRgn (0, 0, iWidth, iHeight); + + if (hRgnWin == NULL) + { + ErrorF ("winAddRgn - CreateRectRgn () failed\n"); + ErrorF (" Rect %d %d %d %d\n", + iX, iY, iX + iWidth, iY + iHeight); + } + + if (pWinPriv->hRgn) + { + if (CombineRgn (hRgnWin, hRgnWin, pWinPriv->hRgn, RGN_AND) + == ERROR) + { + ErrorF ("winAddRgn - CombineRgn () failed\n"); + } + } + + OffsetRgn (hRgnWin, iX, iY); + + if (CombineRgn (hRgn, hRgn, hRgnWin, RGN_OR) == ERROR) + { + ErrorF ("winAddRgn - CombineRgn () failed\n"); + } + + DeleteObject (hRgnWin); + } + return WT_DONTWALKCHILDREN; + } + else + { + return WT_WALKCHILDREN; + } +} + + +/* + * Local function to update the Windows window's region + */ + +static +void +winUpdateRgnRootless (WindowPtr pWin) +{ + HRGN hRgn = CreateRectRgn (0, 0, 0, 0); + + if (hRgn != NULL) + { + WalkTree (pWin->drawable.pScreen, winAddRgn, &hRgn); + SetWindowRgn (winGetScreenPriv(pWin->drawable.pScreen)->hwndScreen, + hRgn, TRUE); + } + else + { + ErrorF ("winUpdateRgnRootless - CreateRectRgn failed.\n"); + } +} + + +static +void +winReshapeRootless (WindowPtr pWin) +{ + int nRects; + RegionRec rrNewShape; + BoxPtr pShape, pRects, pEnd; + HRGN hRgn, hRgnRect; + winWindowPriv(pWin); + +#if CYGDEBUG + winDebug ("winReshapeRootless ()\n"); +#endif + + /* Bail if the window is the root window */ + if (pWin->parent == NULL) + return; + + /* Bail if the window is not top level */ + if (pWin->parent->parent != NULL) + return; + + /* Free any existing window region stored in the window privates */ + if (pWinPriv->hRgn != NULL) + { + DeleteObject (pWinPriv->hRgn); + pWinPriv->hRgn = NULL; + } + + /* Bail if the window has no bounding region defined */ + if (!wBoundingShape (pWin)) + return; + + RegionNull(&rrNewShape); + RegionCopy(&rrNewShape, wBoundingShape(pWin)); + RegionTranslate(&rrNewShape, pWin->borderWidth, + pWin->borderWidth); + + nRects = RegionNumRects(&rrNewShape); + pShape = RegionRects(&rrNewShape); + + if (nRects > 0) + { + /* Create initial empty Windows region */ + hRgn = CreateRectRgn (0, 0, 0, 0); + + /* Loop through all rectangles in the X region */ + for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) + { + /* Create a Windows region for the X rectangle */ + hRgnRect = CreateRectRgn (pRects->x1, pRects->y1, + pRects->x2, pRects->y2); + if (hRgnRect == NULL) + { + ErrorF("winReshapeRootless - CreateRectRgn() failed\n"); + } + + /* Merge the Windows region with the accumulated region */ + if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) + { + ErrorF("winReshapeRootless - CombineRgn() failed\n"); + } + + /* Delete the temporary Windows region */ + DeleteObject (hRgnRect); + } + + /* Save a handle to the composite region in the window privates */ + pWinPriv->hRgn = hRgn; + } + + RegionUninit(&rrNewShape); + + return; +} diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c index 6d03de174..bccd6f9f2 100644 --- a/xorg-server/hw/xwin/winwndproc.c +++ b/xorg-server/hw/xwin/winwndproc.c @@ -1,1263 +1,1312 @@ -/* - *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *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 XFREE86 PROJECT 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 XFree86 Project - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from the XFree86 Project. - * - * Authors: Dakshinamurthy Karra - * Suhaib M Siddiqi - * Peter Busch - * Harold L Hunt II - * MATSUZAKI Kensuke - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include "win.h" -#include -#include "winprefs.h" -#include "winconfig.h" -#include "winmsg.h" -#include "inputstr.h" - -/* - * Global variables - */ - -Bool g_fCursor = TRUE; -Bool g_fButton[3] = { FALSE, FALSE, FALSE }; - - -/* - * Called by winWakeupHandler - * Processes current Windows message - */ - -LRESULT CALLBACK -winWindowProc (HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam) -{ - static winPrivScreenPtr s_pScreenPriv = NULL; - static winScreenInfo *s_pScreenInfo = NULL; - static ScreenPtr s_pScreen = NULL; - static HWND s_hwndLastPrivates = NULL; - static HINSTANCE s_hInstance; - static Bool s_fTracking = FALSE; - static unsigned long s_ulServerGeneration = 0; - static UINT s_uTaskbarRestart = 0; - int iScanCode; - int i; - -#if CYGDEBUG - winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam); -#endif - - /* Watch for server regeneration */ - if (g_ulServerGeneration != s_ulServerGeneration) - { - /* Store new server generation */ - s_ulServerGeneration = g_ulServerGeneration; - } - - /* Only retrieve new privates pointers if window handle is null or changed */ - if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates) - && (s_pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL) - { -#if CYGDEBUG - winDebug ("winWindowProc - Setting privates handle\n"); -#endif - s_pScreenInfo = s_pScreenPriv->pScreenInfo; - s_pScreen = s_pScreenInfo->pScreen; - s_hwndLastPrivates = hwnd; - } - else if (s_pScreenPriv == NULL) - { - /* For safety, handle case that should never happen */ - s_pScreenInfo = NULL; - s_pScreen = NULL; - s_hwndLastPrivates = NULL; - } - - /* Branch on message type */ - switch (message) - { - case WM_TRAYICON: - return winHandleIconMessage (hwnd, message, wParam, lParam, - s_pScreenPriv); - - case WM_CREATE: -#if CYGDEBUG - winDebug ("winWindowProc - WM_CREATE\n"); -#endif - - /* - * Add a property to our display window that references - * this screens' privates. - * - * This allows the window procedure to refer to the - * appropriate window DC and shadow DC for the window that - * it is processing. We use this to repaint exposed - * areas of our display window. - */ - s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams; - s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance; - s_pScreenInfo = s_pScreenPriv->pScreenInfo; - s_pScreen = s_pScreenInfo->pScreen; - s_hwndLastPrivates = hwnd; - s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); - SetProp (hwnd, WIN_SCR_PROP, s_pScreenPriv); - - /* Setup tray icon */ - if (!s_pScreenInfo->fNoTrayIcon) - { - /* - * NOTE: The WM_CREATE message is processed before CreateWindowEx - * returns, so s_pScreenPriv->hwndScreen is invalid at this point. - * We go ahead and copy our hwnd parameter over top of the screen - * privates hwndScreen so that we have a valid value for - * that member. Otherwise, the tray icon will disappear - * the first time you move the mouse over top of it. - */ - - s_pScreenPriv->hwndScreen = hwnd; - - winInitNotifyIcon (s_pScreenPriv); - } - return 0; - - case WM_DISPLAYCHANGE: - /* We cannot handle a display mode change during initialization */ - if (s_pScreenInfo == NULL) - FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display " - "mode changed while we were intializing. This is " - "very bad and unexpected. Exiting.\n"); - - /* - * We do not care about display changes with - * fullscreen DirectDraw engines, because those engines set - * their own mode when they become active. - */ - if (s_pScreenInfo->fFullScreen - && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD - || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL -#ifdef XWIN_PRIMARYFB - || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD -#endif - )) - { - /* - * Store the new display dimensions and depth. - * We do this here for future compatibility in case we - * ever allow switching from fullscreen to windowed mode. - */ - s_pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN); - s_pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN); - s_pScreenPriv->dwLastWindowsBitsPixel - = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL); - break; - } - - ErrorF ("winWindowProc - WM_DISPLAYCHANGE - orig bpp: %d, last bpp: %d, " - "new bpp: %d\n", - (int) s_pScreenInfo->dwBPP, - (int) s_pScreenPriv->dwLastWindowsBitsPixel, - wParam); - - ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d " - "new height: %d\n", - LOWORD (lParam), HIWORD (lParam)); - - /* - * TrueColor --> TrueColor depth changes are disruptive for: - * Windowed: - * Shadow DirectDraw - * Shadow DirectDraw Non-Locking - * Primary DirectDraw - * - * TrueColor --> TrueColor depth changes are non-optimal for: - * Windowed: - * Shadow GDI - * - * FullScreen: - * Shadow GDI - * - * TrueColor --> PseudoColor or vice versa are disruptive for: - * Windowed: - * Shadow DirectDraw - * Shadow DirectDraw Non-Locking - * Primary DirectDraw - * Shadow GDI - */ - - /* - * Check for a disruptive change in depth. - * We can only display a message for a disruptive depth change, - * we cannot do anything to correct the situation. - */ - if ((s_pScreenInfo->dwBPP != wParam) - && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD - || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL -#ifdef XWIN_PRIMARYFB - || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD -#endif - )) - { - /* Cannot display the visual until the depth is restored */ - ErrorF ("winWindowProc - Disruptive change in depth\n"); - - /* Display Exit dialog */ - winDisplayDepthChangeDialog (s_pScreenPriv); - - /* Flag that we have an invalid screen depth */ - s_pScreenPriv->fBadDepth = TRUE; - - /* Minimize the display window */ - ShowWindow (hwnd, SW_MINIMIZE); - } - else - { - /* Flag that we have a valid screen depth */ - s_pScreenPriv->fBadDepth = FALSE; - } - - /* - * Check for a change in display dimensions. - * We can simply recreate the same-sized primary surface when - * the display dimensions change. - */ - if (s_pScreenPriv->dwLastWindowsWidth != LOWORD (lParam) - || s_pScreenPriv->dwLastWindowsHeight != HIWORD (lParam)) - { - /* - * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface - * and CreatePrimarySurface function pointers to point - * to the no operation function, NoopDDA. This allows us - * to blindly call these functions, even if they are not - * relevant to the current engine (e.g., Shadow GDI). - */ - -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n"); -#endif - - /* Release the old primary surface */ - (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen); - -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Released " - "primary surface\n"); -#endif - - /* Create the new primary surface */ - (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen); - -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Recreated " - "primary surface\n"); -#endif - -#if 0 - /* Multi-Window mode uses RandR for resizes */ - if (s_pScreenInfo->fMultiWindow) - { - RRSetScreenConfig (); - } -#endif - } - else - { -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions did not " - "change\n"); -#endif - } - - /* Store the new display dimensions and depth */ - if (s_pScreenInfo->fMultipleMonitors) - { - s_pScreenPriv->dwLastWindowsWidth - = GetSystemMetrics (SM_CXVIRTUALSCREEN); - s_pScreenPriv->dwLastWindowsHeight - = GetSystemMetrics (SM_CYVIRTUALSCREEN); - } - else - { - s_pScreenPriv->dwLastWindowsWidth - = GetSystemMetrics (SM_CXSCREEN); - s_pScreenPriv->dwLastWindowsHeight - = GetSystemMetrics (SM_CYSCREEN); - } - s_pScreenPriv->dwLastWindowsBitsPixel - = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL); - break; - - case WM_SIZE: - { - SCROLLINFO si; - RECT rcWindow; - int iWidth, iHeight; - -#if CYGDEBUG - winDebug ("winWindowProc - WM_SIZE\n"); -#endif - - /* Break if we do not use scrollbars */ - if (!s_pScreenInfo->fScrollbars - || !s_pScreenInfo->fDecoration -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - || s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOW - || s_pScreenInfo->fMultiWindow -#endif - || s_pScreenInfo->fFullScreen) - break; - - /* No need to resize if we get minimized */ - if (wParam == SIZE_MINIMIZED) - return 0; - - /* - * Get the size of the whole window, including client area, - * scrollbars, and non-client area decorations (caption, borders). - * We do this because we need to check if the client area - * without scrollbars is large enough to display the whole visual. - * The new client area size passed by lParam already subtracts - * the size of the scrollbars if they are currently displayed. - * So checking is LOWORD(lParam) == visual_width and - * HIWORD(lParam) == visual_height will never tell us to hide - * the scrollbars because the client area would always be too small. - * GetClientRect returns the same sizes given by lParam, so we - * cannot use GetClientRect either. - */ - GetWindowRect (hwnd, &rcWindow); - iWidth = rcWindow.right - rcWindow.left; - iHeight = rcWindow.bottom - rcWindow.top; - - ErrorF ("winWindowProc - WM_SIZE - window w: %d h: %d, " - "new client area w: %d h: %d\n", - iWidth, iHeight, LOWORD (lParam), HIWORD (lParam)); - - /* Subtract the frame size from the window size. */ - iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME); - iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME) - + GetSystemMetrics (SM_CYCAPTION)); - - /* - * Update scrollbar page sizes. - * NOTE: If page size == range, then the scrollbar is - * automatically hidden. - */ - - /* Is the naked client area large enough to show the whole visual? */ - if (iWidth < s_pScreenInfo->dwWidth - || iHeight < s_pScreenInfo->dwHeight) - { - /* Client area too small to display visual, use scrollbars */ - iWidth -= GetSystemMetrics (SM_CXVSCROLL); - iHeight -= GetSystemMetrics (SM_CYHSCROLL); - } - - /* Set the horizontal scrollbar page size */ - si.cbSize = sizeof (si); - si.fMask = SIF_PAGE | SIF_RANGE; - si.nMin = 0; - si.nMax = s_pScreenInfo->dwWidth - 1; - si.nPage = iWidth; - SetScrollInfo (hwnd, SB_HORZ, &si, TRUE); - - /* Set the vertical scrollbar page size */ - si.cbSize = sizeof (si); - si.fMask = SIF_PAGE | SIF_RANGE; - si.nMin = 0; - si.nMax = s_pScreenInfo->dwHeight - 1; - si.nPage = iHeight; - SetScrollInfo (hwnd, SB_VERT, &si, TRUE); - - /* - * NOTE: Scrollbars may have moved if they were at the - * far right/bottom, so we query their current position. - */ - - /* Get the horizontal scrollbar position and set the offset */ - si.cbSize = sizeof (si); - si.fMask = SIF_POS; - GetScrollInfo (hwnd, SB_HORZ, &si); - s_pScreenInfo->dwXOffset = -si.nPos; - - /* Get the vertical scrollbar position and set the offset */ - si.cbSize = sizeof (si); - si.fMask = SIF_POS; - GetScrollInfo (hwnd, SB_VERT, &si); - s_pScreenInfo->dwYOffset = -si.nPos; - } - return 0; - - case WM_VSCROLL: - { - SCROLLINFO si; - int iVertPos; - -#if CYGDEBUG - winDebug ("winWindowProc - WM_VSCROLL\n"); -#endif - - /* Get vertical scroll bar info */ - si.cbSize = sizeof (si); - si.fMask = SIF_ALL; - GetScrollInfo (hwnd, SB_VERT, &si); - - /* Save the vertical position for comparison later */ - iVertPos = si.nPos; - - /* - * Don't forget: - * moving the scrollbar to the DOWN, scroll the content UP - */ - switch (LOWORD(wParam)) - { - case SB_TOP: - si.nPos = si.nMin; - break; - - case SB_BOTTOM: - si.nPos = si.nMax - si.nPage + 1; - break; - - case SB_LINEUP: - si.nPos -= 1; - break; - - case SB_LINEDOWN: - si.nPos += 1; - break; - - case SB_PAGEUP: - si.nPos -= si.nPage; - break; - - case SB_PAGEDOWN: - si.nPos += si.nPage; - break; - - case SB_THUMBTRACK: - si.nPos = si.nTrackPos; - break; - - default: - break; - } - - /* - * We retrieve the position after setting it, - * because Windows may adjust it. - */ - si.fMask = SIF_POS; - SetScrollInfo (hwnd, SB_VERT, &si, TRUE); - GetScrollInfo (hwnd, SB_VERT, &si); - - /* Scroll the window if the position has changed */ - if (si.nPos != iVertPos) - { - /* Save the new offset for bit block transfers, etc. */ - s_pScreenInfo->dwYOffset = -si.nPos; - - /* Change displayed region in the window */ - ScrollWindowEx (hwnd, - 0, - iVertPos - si.nPos, - NULL, - NULL, - NULL, - NULL, - SW_INVALIDATE); - - /* Redraw the window contents */ - UpdateWindow (hwnd); - } - } - return 0; - - case WM_HSCROLL: - { - SCROLLINFO si; - int iHorzPos; - -#if CYGDEBUG - winDebug ("winWindowProc - WM_HSCROLL\n"); -#endif - - /* Get horizontal scroll bar info */ - si.cbSize = sizeof (si); - si.fMask = SIF_ALL; - GetScrollInfo (hwnd, SB_HORZ, &si); - - /* Save the horizontal position for comparison later */ - iHorzPos = si.nPos; - - /* - * Don't forget: - * moving the scrollbar to the RIGHT, scroll the content LEFT - */ - switch (LOWORD(wParam)) - { - case SB_LEFT: - si.nPos = si.nMin; - break; - - case SB_RIGHT: - si.nPos = si.nMax - si.nPage + 1; - break; - - case SB_LINELEFT: - si.nPos -= 1; - break; - - case SB_LINERIGHT: - si.nPos += 1; - break; - - case SB_PAGELEFT: - si.nPos -= si.nPage; - break; - - case SB_PAGERIGHT: - si.nPos += si.nPage; - break; - - case SB_THUMBTRACK: - si.nPos = si.nTrackPos; - break; - - default: - break; - } - - /* - * We retrieve the position after setting it, - * because Windows may adjust it. - */ - si.fMask = SIF_POS; - SetScrollInfo (hwnd, SB_HORZ, &si, TRUE); - GetScrollInfo (hwnd, SB_HORZ, &si); - - /* Scroll the window if the position has changed */ - if (si.nPos != iHorzPos) - { - /* Save the new offset for bit block transfers, etc. */ - s_pScreenInfo->dwXOffset = -si.nPos; - - /* Change displayed region in the window */ - ScrollWindowEx (hwnd, - iHorzPos - si.nPos, - 0, - NULL, - NULL, - NULL, - NULL, - SW_INVALIDATE); - - /* Redraw the window contents */ - UpdateWindow (hwnd); - } - } - return 0; - - case WM_GETMINMAXINFO: - { - MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam; - int iCaptionHeight; - int iBorderHeight, iBorderWidth; - -#if CYGDEBUG - winDebug ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n", - s_pScreenInfo); -#endif - - /* Can't do anything without screen info */ - if (s_pScreenInfo == NULL - || !s_pScreenInfo->fScrollbars - || s_pScreenInfo->fFullScreen - || !s_pScreenInfo->fDecoration -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - || s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOW - || s_pScreenInfo->fMultiWindow -#endif - ) - break; - - /* - * Here we can override the maximum tracking size, which - * is the largest size that can be assigned to our window - * via the sizing border. - */ - - /* - * FIXME: Do we only need to do this once, since our visual size - * does not change? Does Windows store this value statically - * once we have set it once? - */ - - /* Get the border and caption sizes */ - iCaptionHeight = GetSystemMetrics (SM_CYCAPTION); - iBorderWidth = 2 * GetSystemMetrics (SM_CXSIZEFRAME); - iBorderHeight = 2 * GetSystemMetrics (SM_CYSIZEFRAME); - - /* Allow the full visual to be displayed */ - pMinMaxInfo->ptMaxTrackSize.x - = s_pScreenInfo->dwWidth + iBorderWidth; - pMinMaxInfo->ptMaxTrackSize.y - = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight; - } - return 0; - - case WM_ERASEBKGND: -#if CYGDEBUG - winDebug ("winWindowProc - WM_ERASEBKGND\n"); -#endif - /* - * Pretend that we did erase the background but we don't care, - * the application uses the full window estate. This avoids some - * flickering when resizing. - */ - return TRUE; - - case WM_PAINT: -#if CYGDEBUG - winDebug ("winWindowProc - WM_PAINT\n"); -#endif - /* Only paint if we have privates and the server is enabled */ - if (s_pScreenPriv == NULL - || !s_pScreenPriv->fEnabled - || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive) - || s_pScreenPriv->fBadDepth) - { - /* We don't want to paint */ - break; - } - - /* Break out here if we don't have a valid paint routine */ - if (s_pScreenPriv->pwinBltExposedRegions == NULL) - break; - - /* Call the engine dependent repainter */ - (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen); - return 0; - - case WM_PALETTECHANGED: - { -#if CYGDEBUG - winDebug ("winWindowProc - WM_PALETTECHANGED\n"); -#endif - /* - * Don't process if we don't have privates or a colormap, - * or if we have an invalid depth. - */ - if (s_pScreenPriv == NULL - || s_pScreenPriv->pcmapInstalled == NULL - || s_pScreenPriv->fBadDepth) - break; - - /* Return if we caused the palette to change */ - if ((HWND) wParam == hwnd) - { - /* Redraw the screen */ - (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen); - return 0; - } - - /* Reinstall the windows palette */ - (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen); - - /* Redraw the screen */ - (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen); - return 0; - } - - case WM_MOUSEMOVE: - /* We can't do anything without privates */ - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - - /* We can't do anything without g_pwinPointer */ - if (g_pwinPointer == NULL) - break; - - /* Has the mouse pointer crossed screens? */ - if (s_pScreen != miPointerGetScreen(g_pwinPointer)) - miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen, - GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, - GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); - - /* Are we tracking yet? */ - if (!s_fTracking) - { - TRACKMOUSEEVENT tme; - - /* Setup data structure */ - ZeroMemory (&tme, sizeof (tme)); - tme.cbSize = sizeof (tme); - tme.dwFlags = TME_LEAVE; - tme.hwndTrack = hwnd; - - /* Call the tracking function */ - if (!(*g_fpTrackMouseEvent) (&tme)) - ErrorF ("winWindowProc - _TrackMouseEvent failed\n"); - - /* Flag that we are tracking now */ - s_fTracking = TRUE; - } - - /* Hide or show the Windows mouse cursor */ - if (g_fSoftwareCursor && g_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer)) - { - /* Hide Windows cursor */ - g_fCursor = FALSE; - ShowCursor (FALSE); - } - else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive - && !s_pScreenInfo->fLessPointer) - { - /* Show Windows cursor */ - g_fCursor = TRUE; - ShowCursor (TRUE); - } - - /* Deliver absolute cursor position to X Server */ - winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, - GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); - return 0; - - case WM_NCMOUSEMOVE: - /* - * We break instead of returning 0 since we need to call - * DefWindowProc to get the mouse cursor changes - * and min/max/close button highlighting in Windows XP. - * The Platform SDK says that you should return 0 if you - * process this message, but it fails to mention that you - * will give up any default functionality if you do return 0. - */ - - /* We can't do anything without privates */ - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - - /* Non-client mouse movement, show Windows cursor */ - if (g_fSoftwareCursor && !g_fCursor) - { - g_fCursor = TRUE; - ShowCursor (TRUE); - } - break; - - case WM_MOUSELEAVE: - /* Mouse has left our client area */ - - /* Flag that we are no longer tracking */ - s_fTracking = FALSE; - - /* Show the mouse cursor, if necessary */ - if (g_fSoftwareCursor && !g_fCursor) - { - g_fCursor = TRUE; - ShowCursor (TRUE); - } - return 0; - - case WM_LBUTTONDBLCLK: - case WM_LBUTTONDOWN: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - if (s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - ) - SetCapture (hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); - - case WM_LBUTTONUP: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - if (s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - ) - ReleaseCapture (); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); - - case WM_MBUTTONDBLCLK: - case WM_MBUTTONDOWN: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - if (s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - ) - SetCapture (hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); - - case WM_MBUTTONUP: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - if (s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - ) - ReleaseCapture (); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); - - case WM_RBUTTONDBLCLK: - case WM_RBUTTONDOWN: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - if (s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - ) - SetCapture (hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); - - case WM_RBUTTONUP: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - if (s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - ) - ReleaseCapture (); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); - - case WM_XBUTTONDBLCLK: - case WM_XBUTTONDOWN: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - if (s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - ) - SetCapture (hwnd); - return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); - case WM_XBUTTONUP: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - if (s_pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOWEXTWM - || s_pScreenInfo->fMWExtWM -#endif - ) - ReleaseCapture (); - return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); - - case WM_TIMER: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - - /* Branch on the timer id */ - switch (wParam) - { - case WIN_E3B_TIMER_ID: - /* Send delayed button press */ - winMouseButtonsSendEvent (ButtonPress, - s_pScreenPriv->iE3BCachedPress); - - /* Kill this timer */ - KillTimer (s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); - - /* Clear screen privates flags */ - s_pScreenPriv->iE3BCachedPress = 0; - break; - - case WIN_POLLING_MOUSE_TIMER_ID: - { - POINT point; - WPARAM wL, wM, wR, wShift, wCtrl; - LPARAM lPos; - - /* Get the current position of the mouse cursor */ - GetCursorPos (&point); - - /* Map from screen (-X, -Y) to root (0, 0) */ - point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN); - point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); - - /* Deliver absolute cursor position to X Server */ - winEnqueueMotion(point.x , point.y); - - /* Check if a button was released but we didn't see it */ - GetCursorPos (&point); - wL = (GetKeyState (VK_LBUTTON) & 0x8000)?MK_LBUTTON:0; - wM = (GetKeyState (VK_MBUTTON) & 0x8000)?MK_MBUTTON:0; - wR = (GetKeyState (VK_RBUTTON) & 0x8000)?MK_RBUTTON:0; - wShift = (GetKeyState (VK_SHIFT) & 0x8000)?MK_SHIFT:0; - wCtrl = (GetKeyState (VK_CONTROL) & 0x8000)?MK_CONTROL:0; - lPos = MAKELPARAM(point.x, point.y); - if (g_fButton[0] & !wL) - PostMessage (hwnd, WM_LBUTTONUP, wCtrl|wM|wR|wShift, lPos); - if (g_fButton[1] & !wM) - PostMessage (hwnd, WM_MBUTTONUP, wCtrl|wL|wR|wShift, lPos); - if (g_fButton[2] & !wR) - PostMessage (hwnd, WM_RBUTTONUP, wCtrl|wL|wM|wShift, lPos); - } - } - return 0; - - case WM_CTLCOLORSCROLLBAR: - FatalError ("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not " - "supposed to get this message. Exiting.\n"); - return 0; - - case WM_MOUSEWHEEL: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; -#if CYGDEBUG - winDebug ("winWindowProc - WM_MOUSEWHEEL\n"); -#endif - winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam)); - break; - - case WM_SETFOCUS: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - - /* Restore the state of all mode keys */ - winRestoreModeKeyStates (); - - /* Add the keyboard hook if possible */ - if (g_fKeyboardHookLL) - g_fKeyboardHookLL = winInstallKeyboardHookLL (); - return 0; - - case WM_KILLFOCUS: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - - /* Release any pressed keys */ - winKeybdReleaseKeys (); - - /* Remove our keyboard hook if it is installed */ - winRemoveKeyboardHookLL (); - return 0; - - case WM_SYSKEYDOWN: - case WM_KEYDOWN: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - - /* - * FIXME: Catching Alt-F4 like this is really terrible. This should - * be generalized to handle other Windows keyboard signals. Actually, - * the list keys to catch and the actions to perform when caught should - * be configurable; that way user's can customize the keys that they - * need to have passed through to their window manager or apps, or they - * can remap certain actions to new key codes that do not conflict - * with the X apps that they are using. Yeah, that'll take awhile. - */ - if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4 - && (GetKeyState (VK_MENU) & 0x8000)) - || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK - && (GetKeyState (VK_MENU) & 0x8000) - && (GetKeyState (VK_CONTROL) & 0x8000))) - { - /* - * Better leave this message here, just in case some unsuspecting - * user enters Alt + F4 and is surprised when the application - * quits. - */ - ErrorF ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n"); - - /* Display Exit dialog */ - winDisplayExitDialog (s_pScreenPriv); - return 0; - } - - /* - * Don't do anything for the Windows keys, as focus will soon - * be returned to Windows. We may be able to trap the Windows keys, - * but we should determine if that is desirable before doing so. - */ - if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) - break; - - /* - * Discard presses generated from Windows auto-repeat - */ - if (lParam & (1<<30)) - { - switch (wParam) - { - /* ago: Pressing LControl while RControl is pressed is - * Indicated as repeat. Fix this! - */ - case VK_CONTROL: - case VK_SHIFT: - if (winCheckKeyPressed(wParam, lParam)) - return 0; - break; - default: - return 0; - } - } - - /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */ - if (winIsFakeCtrl_L (message, wParam, lParam)) - return 0; - - /* Translate Windows key code to X scan code */ - winTranslateKey (wParam, lParam, &iScanCode); - - /* Ignore repeats for CapsLock */ - if (wParam == VK_CAPITAL) - lParam = 1; - - /* Send the key event(s) */ - for (i = 0; i < LOWORD(lParam); ++i) - winSendKeyEvent (iScanCode, TRUE); - return 0; - - case WM_SYSKEYUP: - case WM_KEYUP: - if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) - break; - - /* - * Don't do anything for the Windows keys, as focus will soon - * be returned to Windows. We may be able to trap the Windows keys, - * but we should determine if that is desirable before doing so. - */ - if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) - break; - - /* Ignore the fake Ctrl_L that follows an AltGr release */ - if (winIsFakeCtrl_L (message, wParam, lParam)) - return 0; - - /* Enqueue a keyup event */ - winTranslateKey (wParam, lParam, &iScanCode); - winSendKeyEvent (iScanCode, FALSE); - - /* Release all pressed shift keys */ - if (wParam == VK_SHIFT) - winFixShiftKeys (iScanCode); - return 0; - - case WM_HOTKEY: - if (s_pScreenPriv == NULL) - break; - - /* Call the engine-specific hot key handler */ - (*s_pScreenPriv->pwinHotKeyAltTab) (s_pScreen); - return 0; - - case WM_ACTIVATE: - if (s_pScreenPriv == NULL - || s_pScreenInfo->fIgnoreInput) - break; - - /* TODO: Override display of window when we have a bad depth */ - if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth) - { - ErrorF ("winWindowProc - WM_ACTIVATE - Bad depth, trying " - "to override window activation\n"); - - /* Minimize the window */ - ShowWindow (hwnd, SW_MINIMIZE); - - /* Display dialog box */ - if (g_hDlgDepthChange != NULL) - { - /* Make the existing dialog box active */ - SetActiveWindow (g_hDlgDepthChange); - } - else - { - /* TODO: Recreate the dialog box and bring to the top */ - ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT); - } - - /* Don't do any other processing of this message */ - return 0; - } - -#if CYGDEBUG - winDebug ("winWindowProc - WM_ACTIVATE\n"); -#endif - - /* - * Focus is being changed to another window. - * The other window may or may not belong to - * our process. - */ - - /* Clear any lingering wheel delta */ - s_pScreenPriv->iDeltaZ = 0; - - /* Reshow the Windows mouse cursor if we are being deactivated */ - if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE - && !g_fCursor) - { - /* Show Windows cursor */ - g_fCursor = TRUE; - ShowCursor (TRUE); - } - return 0; - - case WM_ACTIVATEAPP: - if (s_pScreenPriv == NULL - || s_pScreenInfo->fIgnoreInput) - break; - -#if CYGDEBUG || TRUE - winDebug ("winWindowProc - WM_ACTIVATEAPP\n"); -#endif - - /* Activate or deactivate */ - s_pScreenPriv->fActive = wParam; - - /* Reshow the Windows mouse cursor if we are being deactivated */ - if (g_fSoftwareCursor && !s_pScreenPriv->fActive - && !g_fCursor) - { - /* Show Windows cursor */ - g_fCursor = TRUE; - ShowCursor (TRUE); - } - -#ifdef XWIN_CLIPBOARD - /* Make sure the clipboard chain is ok. */ - winFixClipboardChain (); -#endif - - /* Call engine specific screen activation/deactivation function */ - (*s_pScreenPriv->pwinActivateApp) (s_pScreen); - -#ifdef XWIN_MULTIWINDOWEXTWM - if (s_pScreenPriv->fActive) - { - /* Restack all window unless using built-in wm. */ - if (s_pScreenInfo->fInternalWM && s_pScreenInfo->fAnotherWMRunning) - winMWExtWMRestackWindows (s_pScreen); - } -#endif - - return 0; - - case WM_COMMAND: - switch (LOWORD (wParam)) - { - case ID_APP_EXIT: - /* Display Exit dialog */ - winDisplayExitDialog (s_pScreenPriv); - return 0; - -#ifdef XWIN_MULTIWINDOW - case ID_APP_HIDE_ROOT: - if (s_pScreenPriv->fRootWindowShown) - ShowWindow (s_pScreenPriv->hwndScreen, SW_HIDE); - else - ShowWindow (s_pScreenPriv->hwndScreen, SW_SHOW); - s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown; - return 0; -#endif - - case ID_APP_ABOUT: - /* Display the About box */ - winDisplayAboutDialog (s_pScreenPriv); - return 0; - - default: - /* It's probably one of the custom menus... */ - if (HandleCustomWM_COMMAND (0, LOWORD (wParam))) - return 0; - } - break; - - case WM_ENDSESSION: - case WM_GIVEUP: - /* Tell X that we are giving up */ -#ifdef XWIN_MULTIWINDOW - if (s_pScreenInfo->fMultiWindow) - winDeinitMultiWindowWM (); -#endif - GiveUp (0); - return 0; - - case WM_CLOSE: - /* Display Exit dialog */ - winDisplayExitDialog (s_pScreenPriv); - return 0; - - case WM_SETCURSOR: - if (LOWORD(lParam) == HTCLIENT) - { - if (!g_fSoftwareCursor) SetCursor (s_pScreenPriv->cursor.handle); - return TRUE; - } - break; - -#ifdef XWIN_MULTIWINDOWEXTWM - case WM_MANAGE: - ErrorF ("winWindowProc - WM_MANAGE\n"); - s_pScreenInfo->fAnotherWMRunning = FALSE; - - if (s_pScreenInfo->fInternalWM) - { - EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0); - //RootlessRepositionWindows (s_pScreen); - } - break; - - case WM_UNMANAGE: - ErrorF ("winWindowProc - WM_UNMANAGE\n"); - s_pScreenInfo->fAnotherWMRunning = TRUE; - - if (s_pScreenInfo->fInternalWM) - { - EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0); - winMWExtWMRestackWindows (s_pScreen); - } - break; -#endif - - default: - if(message == s_uTaskbarRestart) - { - winInitNotifyIcon (s_pScreenPriv); - } - break; - } - - return DefWindowProc (hwnd, message, wParam, lParam); -} +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + * MATSUZAKI Kensuke + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif +#include "win.h" +#include +#include "winprefs.h" +#include "winconfig.h" +#include "winmsg.h" +#include "winmonitors.h" +#include "inputstr.h" + +/* + * Global variables + */ + +Bool g_fCursor = TRUE; +Bool g_fButton[3] = { FALSE, FALSE, FALSE }; + + +/* + * Called by winWakeupHandler + * Processes current Windows message + */ + +LRESULT CALLBACK +winWindowProc (HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + static winPrivScreenPtr s_pScreenPriv = NULL; + static winScreenInfo *s_pScreenInfo = NULL; + static ScreenPtr s_pScreen = NULL; + static HWND s_hwndLastPrivates = NULL; + static HINSTANCE s_hInstance; + static Bool s_fTracking = FALSE; + static unsigned long s_ulServerGeneration = 0; + static UINT s_uTaskbarRestart = 0; + int iScanCode; + int i; + +#if CYGDEBUG + winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam); +#endif + + /* Watch for server regeneration */ + if (g_ulServerGeneration != s_ulServerGeneration) + { + /* Store new server generation */ + s_ulServerGeneration = g_ulServerGeneration; + } + + /* Only retrieve new privates pointers if window handle is null or changed */ + if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates) + && (s_pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL) + { +#if CYGDEBUG + winDebug ("winWindowProc - Setting privates handle\n"); +#endif + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + s_pScreen = s_pScreenInfo->pScreen; + s_hwndLastPrivates = hwnd; + } + else if (s_pScreenPriv == NULL) + { + /* For safety, handle case that should never happen */ + s_pScreenInfo = NULL; + s_pScreen = NULL; + s_hwndLastPrivates = NULL; + } + + /* Branch on message type */ + switch (message) + { + case WM_TRAYICON: + return winHandleIconMessage (hwnd, message, wParam, lParam, + s_pScreenPriv); + + case WM_CREATE: +#if CYGDEBUG + winDebug ("winWindowProc - WM_CREATE\n"); +#endif + + /* + * Add a property to our display window that references + * this screens' privates. + * + * This allows the window procedure to refer to the + * appropriate window DC and shadow DC for the window that + * it is processing. We use this to repaint exposed + * areas of our display window. + */ + s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams; + s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance; + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + s_pScreen = s_pScreenInfo->pScreen; + s_hwndLastPrivates = hwnd; + s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); + SetProp (hwnd, WIN_SCR_PROP, s_pScreenPriv); + + /* Setup tray icon */ + if (!s_pScreenInfo->fNoTrayIcon) + { + /* + * NOTE: The WM_CREATE message is processed before CreateWindowEx + * returns, so s_pScreenPriv->hwndScreen is invalid at this point. + * We go ahead and copy our hwnd parameter over top of the screen + * privates hwndScreen so that we have a valid value for + * that member. Otherwise, the tray icon will disappear + * the first time you move the mouse over top of it. + */ + + s_pScreenPriv->hwndScreen = hwnd; + + winInitNotifyIcon (s_pScreenPriv); + } + return 0; + + case WM_DISPLAYCHANGE: + /* + WM_DISPLAYCHANGE seems to be sent when the monitor layout or + any monitor's resolution or depth changes, but it's lParam and + wParam always indicate the resolution and bpp for the primary + monitor (so ignore that as we could be on any monitor...) + */ + + /* We cannot handle a display mode change during initialization */ + if (s_pScreenInfo == NULL) + FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display " + "mode changed while we were intializing. This is " + "very bad and unexpected. Exiting.\n"); + + /* + * We do not care about display changes with + * fullscreen DirectDraw engines, because those engines set + * their own mode when they become active. + */ + if (s_pScreenInfo->fFullScreen + && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL +#ifdef XWIN_PRIMARYFB + || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD +#endif + )) + { + break; + } + + ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d " + "new height: %d new bpp: %d\n", + LOWORD (lParam), HIWORD (lParam), wParam); + + /* + * Check for a disruptive change in depth. + * We can only display a message for a disruptive depth change, + * we cannot do anything to correct the situation. + */ + /* + XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT) + has changed as well... + */ + if (s_pScreenInfo->dwBPP != GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL)) + { + if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL +#ifdef XWIN_PRIMARYFB + || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD +#endif + )) + { + /* Cannot display the visual until the depth is restored */ + ErrorF ("winWindowProc - Disruptive change in depth\n"); + + /* Display depth change dialog */ + winDisplayDepthChangeDialog (s_pScreenPriv); + + /* Flag that we have an invalid screen depth */ + s_pScreenPriv->fBadDepth = TRUE; + + /* Minimize the display window */ + ShowWindow (hwnd, SW_MINIMIZE); + } + else + { + /* For GDI, performance may suffer until original depth is restored */ + ErrorF ("winWindowProc - Performance may be non-optimal after change in depth\n"); + } + } + else + { + /* Flag that we have a valid screen depth */ + s_pScreenPriv->fBadDepth = FALSE; + } + + /* + If we could cheaply check if this WM_DISPLAYCHANGE change + affects the monitor(s) which this X screen is displayed on + then we should do so here. For the moment, assume it does. + (this is probably usually the case so that might be an + overoptimization) + */ + { + /* + In rootless modes which are monitor or virtual desktop size + use RandR to resize the X screen + */ + if ((!s_pScreenInfo->fUserGaveHeightAndWidth) && + (s_pScreenInfo->iResizeMode == resizeWithRandr) && + (FALSE +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + || s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || s_pScreenInfo->fMultiWindow +#endif + )) + { + DWORD dwWidth, dwHeight; + + if (s_pScreenInfo->fMultipleMonitors) + { + /* resize to new virtual desktop size */ + dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); + dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); + } + else + { + /* resize to new size of specified monitor */ + struct GetMonitorInfoData data; + if (QueryMonitor(s_pScreenInfo->iMonitor, &data)) + { + if (data.bMonitorSpecifiedExists == TRUE) + { + dwWidth = data.monitorWidth; + dwHeight = data.monitorHeight; + /* + XXX: monitor may have changed position, + so we might need to update xinerama data + */ + } + else + { + ErrorF ("Monitor number %d no longer exists!\n", s_pScreenInfo->iMonitor); + } + } + } + + /* + XXX: probably a small bug here: we don't compute the work area + and allow for task bar + + XXX: generally, we don't allow for the task bar being moved after + the server is started + */ + + /* Set screen size to match new size, if it is different to current */ + if ((s_pScreenInfo->dwWidth != dwWidth) || + (s_pScreenInfo->dwHeight != dwHeight)) + { + winDoRandRScreenSetSize(s_pScreen, + dwWidth, + dwHeight, + (dwWidth * 25.4) / monitorResolution, + (dwHeight * 25.4) / monitorResolution); + } + } + else + { + /* + * We can simply recreate the same-sized primary surface when + * the display dimensions change. + */ + + /* + * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface + * and CreatePrimarySurface function pointers to point + * to the no operation function, NoopDDA. This allows us + * to blindly call these functions, even if they are not + * relevant to the current engine (e.g., Shadow GDI). + */ + + winDebug ("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n"); + + /* Release the old primary surface */ + (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen); + + /* Create the new primary surface */ + (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen); + } + } + + break; + + case WM_SIZE: + { + SCROLLINFO si; + RECT rcWindow; + int iWidth, iHeight; + +#if CYGDEBUG + winDebug ("winWindowProc - WM_SIZE\n"); +#endif + + /* Break if we do not allow resizing */ + if ((s_pScreenInfo->iResizeMode == notAllowed) + || !s_pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + || s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || s_pScreenInfo->fMultiWindow +#endif + || s_pScreenInfo->fFullScreen) + break; + + /* No need to resize if we get minimized */ + if (wParam == SIZE_MINIMIZED) + return 0; + + ErrorF ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n", + LOWORD (lParam), HIWORD (lParam)); + + if (s_pScreenInfo->iResizeMode == resizeWithRandr) + { + /* Actual resizing is done on WM_EXITSIZEMOVE */ + return 0; + } + + /* Otherwise iResizeMode == resizeWithScrollbars */ + + /* + * Get the size of the whole window, including client area, + * scrollbars, and non-client area decorations (caption, borders). + * We do this because we need to check if the client area + * without scrollbars is large enough to display the whole visual. + * The new client area size passed by lParam already subtracts + * the size of the scrollbars if they are currently displayed. + * So checking is LOWORD(lParam) == visual_width and + * HIWORD(lParam) == visual_height will never tell us to hide + * the scrollbars because the client area would always be too small. + * GetClientRect returns the same sizes given by lParam, so we + * cannot use GetClientRect either. + */ + GetWindowRect (hwnd, &rcWindow); + iWidth = rcWindow.right - rcWindow.left; + iHeight = rcWindow.bottom - rcWindow.top; + + /* Subtract the frame size from the window size. */ + iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME); + iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME) + + GetSystemMetrics (SM_CYCAPTION)); + + /* + * Update scrollbar page sizes. + * NOTE: If page size == range, then the scrollbar is + * automatically hidden. + */ + + /* Is the naked client area large enough to show the whole visual? */ + if (iWidth < s_pScreenInfo->dwWidth + || iHeight < s_pScreenInfo->dwHeight) + { + /* Client area too small to display visual, use scrollbars */ + iWidth -= GetSystemMetrics (SM_CXVSCROLL); + iHeight -= GetSystemMetrics (SM_CYHSCROLL); + } + + /* Set the horizontal scrollbar page size */ + si.cbSize = sizeof (si); + si.fMask = SIF_PAGE | SIF_RANGE; + si.nMin = 0; + si.nMax = s_pScreenInfo->dwWidth - 1; + si.nPage = iWidth; + SetScrollInfo (hwnd, SB_HORZ, &si, TRUE); + + /* Set the vertical scrollbar page size */ + si.cbSize = sizeof (si); + si.fMask = SIF_PAGE | SIF_RANGE; + si.nMin = 0; + si.nMax = s_pScreenInfo->dwHeight - 1; + si.nPage = iHeight; + SetScrollInfo (hwnd, SB_VERT, &si, TRUE); + + /* + * NOTE: Scrollbars may have moved if they were at the + * far right/bottom, so we query their current position. + */ + + /* Get the horizontal scrollbar position and set the offset */ + si.cbSize = sizeof (si); + si.fMask = SIF_POS; + GetScrollInfo (hwnd, SB_HORZ, &si); + s_pScreenInfo->dwXOffset = -si.nPos; + + /* Get the vertical scrollbar position and set the offset */ + si.cbSize = sizeof (si); + si.fMask = SIF_POS; + GetScrollInfo (hwnd, SB_VERT, &si); + s_pScreenInfo->dwYOffset = -si.nPos; + } + return 0; + + case WM_ENTERSIZEMOVE: + ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n"); + break; + + case WM_EXITSIZEMOVE: + ErrorF("winWindowProc - WM_EXITSIZEMOVE\n"); + + if (s_pScreenInfo->iResizeMode == resizeWithRandr) + { + /* Set screen size to match new client area, if it is different to current */ + RECT rcClient; + DWORD dwWidth, dwHeight; + + GetClientRect (hwnd, &rcClient); + dwWidth = rcClient.right - rcClient.left; + dwHeight = rcClient.bottom - rcClient.top; + + if ((s_pScreenInfo->dwWidth != dwWidth) || + (s_pScreenInfo->dwHeight != dwHeight)) + { + /* mm = dots * (25.4 mm / inch) / (dots / inch) */ + winDoRandRScreenSetSize(s_pScreen, + dwWidth, + dwHeight, + (dwWidth * 25.4) / monitorResolution, + (dwHeight * 25.4) / monitorResolution); + } + } + + break; + + case WM_VSCROLL: + { + SCROLLINFO si; + int iVertPos; + +#if CYGDEBUG + winDebug ("winWindowProc - WM_VSCROLL\n"); +#endif + + /* Get vertical scroll bar info */ + si.cbSize = sizeof (si); + si.fMask = SIF_ALL; + GetScrollInfo (hwnd, SB_VERT, &si); + + /* Save the vertical position for comparison later */ + iVertPos = si.nPos; + + /* + * Don't forget: + * moving the scrollbar to the DOWN, scroll the content UP + */ + switch (LOWORD(wParam)) + { + case SB_TOP: + si.nPos = si.nMin; + break; + + case SB_BOTTOM: + si.nPos = si.nMax - si.nPage + 1; + break; + + case SB_LINEUP: + si.nPos -= 1; + break; + + case SB_LINEDOWN: + si.nPos += 1; + break; + + case SB_PAGEUP: + si.nPos -= si.nPage; + break; + + case SB_PAGEDOWN: + si.nPos += si.nPage; + break; + + case SB_THUMBTRACK: + si.nPos = si.nTrackPos; + break; + + default: + break; + } + + /* + * We retrieve the position after setting it, + * because Windows may adjust it. + */ + si.fMask = SIF_POS; + SetScrollInfo (hwnd, SB_VERT, &si, TRUE); + GetScrollInfo (hwnd, SB_VERT, &si); + + /* Scroll the window if the position has changed */ + if (si.nPos != iVertPos) + { + /* Save the new offset for bit block transfers, etc. */ + s_pScreenInfo->dwYOffset = -si.nPos; + + /* Change displayed region in the window */ + ScrollWindowEx (hwnd, + 0, + iVertPos - si.nPos, + NULL, + NULL, + NULL, + NULL, + SW_INVALIDATE); + + /* Redraw the window contents */ + UpdateWindow (hwnd); + } + } + return 0; + + case WM_HSCROLL: + { + SCROLLINFO si; + int iHorzPos; + +#if CYGDEBUG + winDebug ("winWindowProc - WM_HSCROLL\n"); +#endif + + /* Get horizontal scroll bar info */ + si.cbSize = sizeof (si); + si.fMask = SIF_ALL; + GetScrollInfo (hwnd, SB_HORZ, &si); + + /* Save the horizontal position for comparison later */ + iHorzPos = si.nPos; + + /* + * Don't forget: + * moving the scrollbar to the RIGHT, scroll the content LEFT + */ + switch (LOWORD(wParam)) + { + case SB_LEFT: + si.nPos = si.nMin; + break; + + case SB_RIGHT: + si.nPos = si.nMax - si.nPage + 1; + break; + + case SB_LINELEFT: + si.nPos -= 1; + break; + + case SB_LINERIGHT: + si.nPos += 1; + break; + + case SB_PAGELEFT: + si.nPos -= si.nPage; + break; + + case SB_PAGERIGHT: + si.nPos += si.nPage; + break; + + case SB_THUMBTRACK: + si.nPos = si.nTrackPos; + break; + + default: + break; + } + + /* + * We retrieve the position after setting it, + * because Windows may adjust it. + */ + si.fMask = SIF_POS; + SetScrollInfo (hwnd, SB_HORZ, &si, TRUE); + GetScrollInfo (hwnd, SB_HORZ, &si); + + /* Scroll the window if the position has changed */ + if (si.nPos != iHorzPos) + { + /* Save the new offset for bit block transfers, etc. */ + s_pScreenInfo->dwXOffset = -si.nPos; + + /* Change displayed region in the window */ + ScrollWindowEx (hwnd, + iHorzPos - si.nPos, + 0, + NULL, + NULL, + NULL, + NULL, + SW_INVALIDATE); + + /* Redraw the window contents */ + UpdateWindow (hwnd); + } + } + return 0; + + case WM_GETMINMAXINFO: + { + MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam; + int iCaptionHeight; + int iBorderHeight, iBorderWidth; + +#if CYGDEBUG + winDebug ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n", + s_pScreenInfo); +#endif + + /* Can't do anything without screen info */ + if (s_pScreenInfo == NULL + || (s_pScreenInfo->iResizeMode != resizeWithScrollbars) + || s_pScreenInfo->fFullScreen + || !s_pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + || s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || s_pScreenInfo->fMultiWindow +#endif + ) + break; + + /* + * Here we can override the maximum tracking size, which + * is the largest size that can be assigned to our window + * via the sizing border. + */ + + /* + * FIXME: Do we only need to do this once, since our visual size + * does not change? Does Windows store this value statically + * once we have set it once? + */ + + /* Get the border and caption sizes */ + iCaptionHeight = GetSystemMetrics (SM_CYCAPTION); + iBorderWidth = 2 * GetSystemMetrics (SM_CXSIZEFRAME); + iBorderHeight = 2 * GetSystemMetrics (SM_CYSIZEFRAME); + + /* Allow the full visual to be displayed */ + pMinMaxInfo->ptMaxTrackSize.x + = s_pScreenInfo->dwWidth + iBorderWidth; + pMinMaxInfo->ptMaxTrackSize.y + = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight; + } + return 0; + + case WM_ERASEBKGND: +#if CYGDEBUG + winDebug ("winWindowProc - WM_ERASEBKGND\n"); +#endif + /* + * Pretend that we did erase the background but we don't care, + * the application uses the full window estate. This avoids some + * flickering when resizing. + */ + return TRUE; + + case WM_PAINT: +#if CYGDEBUG + winDebug ("winWindowProc - WM_PAINT\n"); +#endif + /* Only paint if we have privates and the server is enabled */ + if (s_pScreenPriv == NULL + || !s_pScreenPriv->fEnabled + || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive) + || s_pScreenPriv->fBadDepth) + { + /* We don't want to paint */ + break; + } + + /* Break out here if we don't have a valid paint routine */ + if (s_pScreenPriv->pwinBltExposedRegions == NULL) + break; + + /* Call the engine dependent repainter */ + (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen); + return 0; + + case WM_PALETTECHANGED: + { +#if CYGDEBUG + winDebug ("winWindowProc - WM_PALETTECHANGED\n"); +#endif + /* + * Don't process if we don't have privates or a colormap, + * or if we have an invalid depth. + */ + if (s_pScreenPriv == NULL + || s_pScreenPriv->pcmapInstalled == NULL + || s_pScreenPriv->fBadDepth) + break; + + /* Return if we caused the palette to change */ + if ((HWND) wParam == hwnd) + { + /* Redraw the screen */ + (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen); + return 0; + } + + /* Reinstall the windows palette */ + (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen); + + /* Redraw the screen */ + (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen); + return 0; + } + + case WM_MOUSEMOVE: + /* We can't do anything without privates */ + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* We can't do anything without g_pwinPointer */ + if (g_pwinPointer == NULL) + break; + + /* Has the mouse pointer crossed screens? */ + if (s_pScreen != miPointerGetScreen(g_pwinPointer)) + miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen, + GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, + GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); + + /* Are we tracking yet? */ + if (!s_fTracking) + { + TRACKMOUSEEVENT tme; + + /* Setup data structure */ + ZeroMemory (&tme, sizeof (tme)); + tme.cbSize = sizeof (tme); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = hwnd; + + /* Call the tracking function */ + if (!(*g_fpTrackMouseEvent) (&tme)) + ErrorF ("winWindowProc - _TrackMouseEvent failed\n"); + + /* Flag that we are tracking now */ + s_fTracking = TRUE; + } + + /* Hide or show the Windows mouse cursor */ + if (g_fSoftwareCursor && g_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer)) + { + /* Hide Windows cursor */ + g_fCursor = FALSE; + ShowCursor (FALSE); + } + else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive + && !s_pScreenInfo->fLessPointer) + { + /* Show Windows cursor */ + g_fCursor = TRUE; + ShowCursor (TRUE); + } + + /* Deliver absolute cursor position to X Server */ + winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset, + GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset); + return 0; + + case WM_NCMOUSEMOVE: + /* + * We break instead of returning 0 since we need to call + * DefWindowProc to get the mouse cursor changes + * and min/max/close button highlighting in Windows XP. + * The Platform SDK says that you should return 0 if you + * process this message, but it fails to mention that you + * will give up any default functionality if you do return 0. + */ + + /* We can't do anything without privates */ + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* Non-client mouse movement, show Windows cursor */ + if (g_fSoftwareCursor && !g_fCursor) + { + g_fCursor = TRUE; + ShowCursor (TRUE); + } + break; + + case WM_MOUSELEAVE: + /* Mouse has left our client area */ + + /* Flag that we are no longer tracking */ + s_fTracking = FALSE; + + /* Show the mouse cursor, if necessary */ + if (g_fSoftwareCursor && !g_fCursor) + { + g_fCursor = TRUE; + ShowCursor (TRUE); + } + return 0; + + case WM_LBUTTONDBLCLK: + case WM_LBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + SetCapture (hwnd); + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); + + case WM_LBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + ReleaseCapture (); + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); + + case WM_MBUTTONDBLCLK: + case WM_MBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + SetCapture (hwnd); + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); + + case WM_MBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + ReleaseCapture (); + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); + + case WM_RBUTTONDBLCLK: + case WM_RBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + SetCapture (hwnd); + return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); + + case WM_RBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + ReleaseCapture (); + return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); + + case WM_XBUTTONDBLCLK: + case WM_XBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + SetCapture (hwnd); + return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + case WM_XBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + ReleaseCapture (); + return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); + + case WM_TIMER: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* Branch on the timer id */ + switch (wParam) + { + case WIN_E3B_TIMER_ID: + /* Send delayed button press */ + winMouseButtonsSendEvent (ButtonPress, + s_pScreenPriv->iE3BCachedPress); + + /* Kill this timer */ + KillTimer (s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); + + /* Clear screen privates flags */ + s_pScreenPriv->iE3BCachedPress = 0; + break; + + case WIN_POLLING_MOUSE_TIMER_ID: + { + POINT point; + WPARAM wL, wM, wR, wShift, wCtrl; + LPARAM lPos; + + /* Get the current position of the mouse cursor */ + GetCursorPos (&point); + + /* Map from screen (-X, -Y) to root (0, 0) */ + point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN); + point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN); + + /* Deliver absolute cursor position to X Server */ + winEnqueueMotion(point.x , point.y); + + /* Check if a button was released but we didn't see it */ + GetCursorPos (&point); + wL = (GetKeyState (VK_LBUTTON) & 0x8000)?MK_LBUTTON:0; + wM = (GetKeyState (VK_MBUTTON) & 0x8000)?MK_MBUTTON:0; + wR = (GetKeyState (VK_RBUTTON) & 0x8000)?MK_RBUTTON:0; + wShift = (GetKeyState (VK_SHIFT) & 0x8000)?MK_SHIFT:0; + wCtrl = (GetKeyState (VK_CONTROL) & 0x8000)?MK_CONTROL:0; + lPos = MAKELPARAM(point.x, point.y); + if (g_fButton[0] & !wL) + PostMessage (hwnd, WM_LBUTTONUP, wCtrl|wM|wR|wShift, lPos); + if (g_fButton[1] & !wM) + PostMessage (hwnd, WM_MBUTTONUP, wCtrl|wL|wR|wShift, lPos); + if (g_fButton[2] & !wR) + PostMessage (hwnd, WM_RBUTTONUP, wCtrl|wL|wM|wShift, lPos); + } + } + return 0; + + case WM_CTLCOLORSCROLLBAR: + FatalError ("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not " + "supposed to get this message. Exiting.\n"); + return 0; + + case WM_MOUSEWHEEL: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; +#if CYGDEBUG + winDebug ("winWindowProc - WM_MOUSEWHEEL\n"); +#endif + winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam)); + break; + + case WM_SETFOCUS: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* Restore the state of all mode keys */ + winRestoreModeKeyStates (); + + /* Add the keyboard hook if possible */ + if (g_fKeyboardHookLL) + g_fKeyboardHookLL = winInstallKeyboardHookLL (); + return 0; + + case WM_KILLFOCUS: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* Release any pressed keys */ + winKeybdReleaseKeys (); + + /* Remove our keyboard hook if it is installed */ + winRemoveKeyboardHookLL (); + return 0; + + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* + * FIXME: Catching Alt-F4 like this is really terrible. This should + * be generalized to handle other Windows keyboard signals. Actually, + * the list keys to catch and the actions to perform when caught should + * be configurable; that way user's can customize the keys that they + * need to have passed through to their window manager or apps, or they + * can remap certain actions to new key codes that do not conflict + * with the X apps that they are using. Yeah, that'll take awhile. + */ + if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4 + && (GetKeyState (VK_MENU) & 0x8000)) + || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK + && (GetKeyState (VK_MENU) & 0x8000) + && (GetKeyState (VK_CONTROL) & 0x8000))) + { + /* + * Better leave this message here, just in case some unsuspecting + * user enters Alt + F4 and is surprised when the application + * quits. + */ + ErrorF ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n"); + + /* Display Exit dialog */ + winDisplayExitDialog (s_pScreenPriv); + return 0; + } + + /* + * Don't do anything for the Windows keys, as focus will soon + * be returned to Windows. We may be able to trap the Windows keys, + * but we should determine if that is desirable before doing so. + */ + if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) + break; + + /* + * Discard presses generated from Windows auto-repeat + */ + if (lParam & (1<<30)) + { + switch (wParam) + { + /* ago: Pressing LControl while RControl is pressed is + * Indicated as repeat. Fix this! + */ + case VK_CONTROL: + case VK_SHIFT: + if (winCheckKeyPressed(wParam, lParam)) + return 0; + break; + default: + return 0; + } + } + + /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */ + if (winIsFakeCtrl_L (message, wParam, lParam)) + return 0; + + /* Translate Windows key code to X scan code */ + winTranslateKey (wParam, lParam, &iScanCode); + + /* Ignore repeats for CapsLock */ + if (wParam == VK_CAPITAL) + lParam = 1; + + /* Send the key event(s) */ + for (i = 0; i < LOWORD(lParam); ++i) + winSendKeyEvent (iScanCode, TRUE); + return 0; + + case WM_SYSKEYUP: + case WM_KEYUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + + /* + * Don't do anything for the Windows keys, as focus will soon + * be returned to Windows. We may be able to trap the Windows keys, + * but we should determine if that is desirable before doing so. + */ + if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) + break; + + /* Ignore the fake Ctrl_L that follows an AltGr release */ + if (winIsFakeCtrl_L (message, wParam, lParam)) + return 0; + + /* Enqueue a keyup event */ + winTranslateKey (wParam, lParam, &iScanCode); + winSendKeyEvent (iScanCode, FALSE); + + /* Release all pressed shift keys */ + if (wParam == VK_SHIFT) + winFixShiftKeys (iScanCode); + return 0; + + case WM_HOTKEY: + if (s_pScreenPriv == NULL) + break; + + /* Call the engine-specific hot key handler */ + (*s_pScreenPriv->pwinHotKeyAltTab) (s_pScreen); + return 0; + + case WM_ACTIVATE: + if (s_pScreenPriv == NULL + || s_pScreenInfo->fIgnoreInput) + break; + + /* TODO: Override display of window when we have a bad depth */ + if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth) + { + ErrorF ("winWindowProc - WM_ACTIVATE - Bad depth, trying " + "to override window activation\n"); + + /* Minimize the window */ + ShowWindow (hwnd, SW_MINIMIZE); + + /* Display dialog box */ + if (g_hDlgDepthChange != NULL) + { + /* Make the existing dialog box active */ + SetActiveWindow (g_hDlgDepthChange); + } + else + { + /* TODO: Recreate the dialog box and bring to the top */ + ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT); + } + + /* Don't do any other processing of this message */ + return 0; + } + +#if CYGDEBUG + winDebug ("winWindowProc - WM_ACTIVATE\n"); +#endif + + /* + * Focus is being changed to another window. + * The other window may or may not belong to + * our process. + */ + + /* Clear any lingering wheel delta */ + s_pScreenPriv->iDeltaZ = 0; + + /* Reshow the Windows mouse cursor if we are being deactivated */ + if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE + && !g_fCursor) + { + /* Show Windows cursor */ + g_fCursor = TRUE; + ShowCursor (TRUE); + } + return 0; + + case WM_ACTIVATEAPP: + if (s_pScreenPriv == NULL + || s_pScreenInfo->fIgnoreInput) + break; + +#if CYGDEBUG || TRUE + winDebug ("winWindowProc - WM_ACTIVATEAPP\n"); +#endif + + /* Activate or deactivate */ + s_pScreenPriv->fActive = wParam; + + /* Reshow the Windows mouse cursor if we are being deactivated */ + if (g_fSoftwareCursor && !s_pScreenPriv->fActive + && !g_fCursor) + { + /* Show Windows cursor */ + g_fCursor = TRUE; + ShowCursor (TRUE); + } + +#ifdef XWIN_CLIPBOARD + /* Make sure the clipboard chain is ok. */ + winFixClipboardChain (); +#endif + + /* Call engine specific screen activation/deactivation function */ + (*s_pScreenPriv->pwinActivateApp) (s_pScreen); + +#ifdef XWIN_MULTIWINDOWEXTWM + if (s_pScreenPriv->fActive) + { + /* Restack all window unless using built-in wm. */ + if (s_pScreenInfo->fInternalWM && s_pScreenInfo->fAnotherWMRunning) + winMWExtWMRestackWindows (s_pScreen); + } +#endif + + return 0; + + case WM_COMMAND: + switch (LOWORD (wParam)) + { + case ID_APP_EXIT: + /* Display Exit dialog */ + winDisplayExitDialog (s_pScreenPriv); + return 0; + +#ifdef XWIN_MULTIWINDOW + case ID_APP_HIDE_ROOT: + if (s_pScreenPriv->fRootWindowShown) + ShowWindow (s_pScreenPriv->hwndScreen, SW_HIDE); + else + ShowWindow (s_pScreenPriv->hwndScreen, SW_SHOW); + s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown; + return 0; +#endif + + case ID_APP_ABOUT: + /* Display the About box */ + winDisplayAboutDialog (s_pScreenPriv); + return 0; + + default: + /* It's probably one of the custom menus... */ + if (HandleCustomWM_COMMAND (0, LOWORD (wParam))) + return 0; + } + break; + + case WM_ENDSESSION: + case WM_GIVEUP: + /* Tell X that we are giving up */ +#ifdef XWIN_MULTIWINDOW + if (s_pScreenInfo->fMultiWindow) + winDeinitMultiWindowWM (); +#endif + GiveUp (0); + return 0; + + case WM_CLOSE: + /* Display Exit dialog */ + winDisplayExitDialog (s_pScreenPriv); + return 0; + + case WM_SETCURSOR: + if (LOWORD(lParam) == HTCLIENT) + { + if (!g_fSoftwareCursor) SetCursor (s_pScreenPriv->cursor.handle); + return TRUE; + } + break; + +#ifdef XWIN_MULTIWINDOWEXTWM + case WM_MANAGE: + ErrorF ("winWindowProc - WM_MANAGE\n"); + s_pScreenInfo->fAnotherWMRunning = FALSE; + + if (s_pScreenInfo->fInternalWM) + { + EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0); + //RootlessRepositionWindows (s_pScreen); + } + break; + + case WM_UNMANAGE: + ErrorF ("winWindowProc - WM_UNMANAGE\n"); + s_pScreenInfo->fAnotherWMRunning = TRUE; + + if (s_pScreenInfo->fInternalWM) + { + EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0); + winMWExtWMRestackWindows (s_pScreen); + } + break; +#endif + + default: + if(message == s_uTaskbarRestart) + { + winInitNotifyIcon (s_pScreenPriv); + } + break; + } + + return DefWindowProc (hwnd, message, wParam, lParam); +} diff --git a/xorg-server/include/dix.h b/xorg-server/include/dix.h index ac19a9536..12e4b5977 100644 --- a/xorg-server/include/dix.h +++ b/xorg-server/include/dix.h @@ -1,602 +1,609 @@ -/*********************************************************** - -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. - -******************************************************************/ - -#ifndef DIX_H -#define DIX_H - -#include "callback.h" -#include "gc.h" -#include "window.h" -#include "input.h" -#include "cursor.h" -#include "geext.h" -#include "events.h" -#include - -#define EARLIER -1 -#define SAMETIME 0 -#define LATER 1 - -#define NullClient ((ClientPtr) 0) -#define REQUEST(type) \ - type *stuff = (type *)client->requestBuffer - - -#define REQUEST_SIZE_MATCH(req)\ - if ((sizeof(req) >> 2) != client->req_len)\ - return(BadLength) - -#define REQUEST_AT_LEAST_SIZE(req) \ - if ((sizeof(req) >> 2) > client->req_len )\ - return(BadLength) - -#define REQUEST_FIXED_SIZE(req, n)\ - if (((sizeof(req) >> 2) > client->req_len) || \ - (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \ - return(BadLength) - -#define LEGAL_NEW_RESOURCE(id,client)\ - if (!LegalNewID(id,client)) \ - {\ - client->errorValue = id;\ - return BadIDChoice;\ - } - -#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\ - {\ - int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\ - if (rc != Success)\ - return rc;\ - rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\ - if (rc != Success)\ - return rc;\ - if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\ - return BadMatch;\ - }\ - if (pGC->serialNumber != pDraw->serialNumber)\ - ValidateGC(pDraw, pGC); - - -#define WriteReplyToClient(pClient, size, pReply) { \ - if ((pClient)->swapped) \ - (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ - (pClient, (int)(size), pReply); \ - else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); } - -#define WriteSwappedDataToClient(pClient, size, pbuf) \ - if ((pClient)->swapped) \ - (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \ - else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf)); - -typedef struct _TimeStamp *TimeStampPtr; - -#ifndef _XTYPEDEF_CLIENTPTR -typedef struct _Client *ClientPtr; /* also in misc.h */ -#define _XTYPEDEF_CLIENTPTR -#endif - -typedef struct _WorkQueue *WorkQueuePtr; - -extern _X_EXPORT ClientPtr clients[MAXCLIENTS]; -extern _X_EXPORT ClientPtr serverClient; -extern _X_EXPORT int currentMaxClients; -extern _X_EXPORT char dispatchExceptionAtReset; - -typedef int HWEventQueueType; -typedef HWEventQueueType* HWEventQueuePtr; - -extern _X_EXPORT HWEventQueuePtr checkForInput[2]; - -typedef struct _TimeStamp { - CARD32 months; /* really ~49.7 days */ - CARD32 milliseconds; -} TimeStamp; - -/* dispatch.c */ - -extern _X_EXPORT void SetInputCheck( - HWEventQueuePtr /*c0*/, - HWEventQueuePtr /*c1*/); - -extern _X_EXPORT void CloseDownClient( - ClientPtr /*client*/); - -extern _X_EXPORT void UpdateCurrentTime(void); - -extern _X_EXPORT void UpdateCurrentTimeIf(void); - -extern _X_EXPORT int dixDestroyPixmap( - pointer /*value*/, - XID /*pid*/); - -extern _X_EXPORT void InitClient( - ClientPtr /*client*/, - int /*i*/, - pointer /*ospriv*/); - -extern _X_EXPORT ClientPtr NextAvailableClient( - pointer /*ospriv*/); - -extern _X_EXPORT void SendErrorToClient( - ClientPtr /*client*/, - unsigned int /*majorCode*/, - unsigned int /*minorCode*/, - XID /*resId*/, - int /*errorCode*/); - -extern _X_EXPORT void MarkClientException( - ClientPtr /*client*/); - -extern _X_HIDDEN Bool CreateConnectionBlock(void); -/* dixutils.c */ - -extern _X_EXPORT int CompareISOLatin1Lowered( - unsigned char * /*a*/, - int alen, - unsigned char * /*b*/, - int blen); - -extern _X_EXPORT int dixLookupWindow( - WindowPtr *result, - XID id, - ClientPtr client, - Mask access_mode); - -extern _X_EXPORT int dixLookupDrawable( - DrawablePtr *result, - XID id, - ClientPtr client, - Mask type_mask, - Mask access_mode); - -extern _X_EXPORT int dixLookupGC( - GCPtr *result, - XID id, - ClientPtr client, - Mask access_mode); - -extern _X_EXPORT int dixLookupFontable( - FontPtr *result, - XID id, - ClientPtr client, - Mask access_mode); - -extern _X_EXPORT int dixLookupClient( - ClientPtr *result, - XID id, - ClientPtr client, - Mask access_mode); - -extern _X_EXPORT void NoopDDA(void); - -extern _X_EXPORT int AlterSaveSetForClient( - ClientPtr /*client*/, - WindowPtr /*pWin*/, - unsigned /*mode*/, - Bool /*toRoot*/, - Bool /*map*/); - -extern _X_EXPORT void DeleteWindowFromAnySaveSet( - WindowPtr /*pWin*/); - -extern _X_EXPORT void BlockHandler( - pointer /*pTimeout*/, - pointer /*pReadmask*/); - -extern _X_EXPORT void WakeupHandler( - int /*result*/, - pointer /*pReadmask*/); - -void -EnableLimitedSchedulingLatency(void); - -void -DisableLimitedSchedulingLatency(void); - -typedef void (* WakeupHandlerProcPtr)( - pointer /* blockData */, - int /* result */, - pointer /* pReadmask */); - -extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers( - BlockHandlerProcPtr /*blockHandler*/, - WakeupHandlerProcPtr /*wakeupHandler*/, - pointer /*blockData*/); - -extern _X_EXPORT void RemoveBlockAndWakeupHandlers( - BlockHandlerProcPtr /*blockHandler*/, - WakeupHandlerProcPtr /*wakeupHandler*/, - pointer /*blockData*/); - -extern _X_EXPORT void InitBlockAndWakeupHandlers(void); - -extern _X_EXPORT void ProcessWorkQueue(void); - -extern _X_EXPORT void ProcessWorkQueueZombies(void); - -extern _X_EXPORT Bool QueueWorkProc( - Bool (* /*function*/)( - ClientPtr /*clientUnused*/, - pointer /*closure*/), - ClientPtr /*client*/, - pointer /*closure*/ -); - -typedef Bool (* ClientSleepProcPtr)( - ClientPtr /*client*/, - pointer /*closure*/); - -extern _X_EXPORT Bool ClientSleep( - ClientPtr /*client*/, - ClientSleepProcPtr /* function */, - pointer /*closure*/); - -#ifndef ___CLIENTSIGNAL_DEFINED___ -#define ___CLIENTSIGNAL_DEFINED___ -extern _X_EXPORT Bool ClientSignal( - ClientPtr /*client*/); -#endif /* ___CLIENTSIGNAL_DEFINED___ */ - -extern _X_EXPORT void ClientWakeup( - ClientPtr /*client*/); - -extern _X_EXPORT Bool ClientIsAsleep( - ClientPtr /*client*/); - -/* atom.c */ - -extern _X_EXPORT Atom MakeAtom( - const char * /*string*/, - unsigned /*len*/, - Bool /*makeit*/); - -extern _X_EXPORT Bool ValidAtom( - Atom /*atom*/); - -extern _X_EXPORT const char *NameForAtom( - Atom /*atom*/); - -extern _X_EXPORT void AtomError(void) _X_NORETURN; - -extern _X_EXPORT void FreeAllAtoms(void); - -extern _X_EXPORT void InitAtoms(void); - -/* main.c */ - -extern _X_EXPORT void SetVendorRelease(int release); - -extern _X_EXPORT void SetVendorString(char *string); - -/* events.c */ - -extern void SetMaskForEvent( - int /* deviceid */, - Mask /* mask */, - int /* event */); - -extern _X_EXPORT void ConfineToShape( - DeviceIntPtr /* pDev */, - RegionPtr /* shape */, - int* /* px */, - int* /* py */); - -extern _X_EXPORT Bool IsParent( - WindowPtr /* maybeparent */, - WindowPtr /* child */); - -extern _X_EXPORT WindowPtr GetCurrentRootWindow(DeviceIntPtr pDev); - -extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev); - - -extern _X_EXPORT void NoticeEventTime(InternalEvent *ev); - -extern void EnqueueEvent( - InternalEvent * /* ev */, - DeviceIntPtr /* device */); - -extern void ActivatePointerGrab( - DeviceIntPtr /* mouse */, - GrabPtr /* grab */, - TimeStamp /* time */, - Bool /* autoGrab */); - -extern void DeactivatePointerGrab( - DeviceIntPtr /* mouse */); - -extern void ActivateKeyboardGrab( - DeviceIntPtr /* keybd */, - GrabPtr /* grab */, - TimeStamp /* time */, - Bool /* passive */); - -extern void DeactivateKeyboardGrab( - DeviceIntPtr /* keybd */); - -extern BOOL ActivateFocusInGrab( - DeviceIntPtr /* dev */, - WindowPtr /* old */, - WindowPtr /* win */); - -extern void AllowSome( - ClientPtr /* client */, - TimeStamp /* time */, - DeviceIntPtr /* thisDev */, - int /* newState */); - -extern void ReleaseActiveGrabs( - ClientPtr client); - -extern _X_EXPORT int DeliverEventsToWindow( - DeviceIntPtr /* pWin */, - WindowPtr /* pWin */, - xEventPtr /* pEvents */, - int /* count */, - Mask /* filter */, - GrabPtr /* grab */); - -extern int DeliverDeviceEvents( - WindowPtr /* pWin */, - InternalEvent* /* event */, - GrabPtr /* grab */, - WindowPtr /* stopAt */, - DeviceIntPtr /* dev */); - -extern void InitializeSprite( - DeviceIntPtr /* pDev */, - WindowPtr /* pWin */); - -extern void UpdateSpriteForScreen( - DeviceIntPtr /* pDev */, - ScreenPtr /* pScreen */); - -extern _X_EXPORT void WindowHasNewCursor( - WindowPtr /* pWin */); - -extern Bool CheckDeviceGrabs( - DeviceIntPtr /* device */, - DeviceEvent* /* event */, - WindowPtr /* ancestor */); - -extern void DeliverFocusedEvent( - DeviceIntPtr /* keybd */, - InternalEvent* /* event */, - WindowPtr /* window */); - -extern void DeliverGrabbedEvent( - InternalEvent* /* event */, - DeviceIntPtr /* thisDev */, - Bool /* deactivateGrab */); - -extern void FixKeyState( - DeviceEvent* /* event */, - DeviceIntPtr /* keybd */); - -extern void RecalculateDeliverableEvents( - WindowPtr /* pWin */); - -extern _X_EXPORT int OtherClientGone( - pointer /* value */, - XID /* id */); - -extern void DoFocusEvents( - DeviceIntPtr /* dev */, - WindowPtr /* fromWin */, - WindowPtr /* toWin */, - int /* mode */); - -extern int SetInputFocus( - ClientPtr /* client */, - DeviceIntPtr /* dev */, - Window /* focusID */, - CARD8 /* revertTo */, - Time /* ctime */, - Bool /* followOK */); - -extern int GrabDevice( - ClientPtr /* client */, - DeviceIntPtr /* dev */, - unsigned /* this_mode */, - unsigned /* other_mode */, - Window /* grabWindow */, - unsigned /* ownerEvents */, - Time /* ctime */, - GrabMask* /* mask */, - int /* grabtype */, - Cursor /* curs */, - Window /* confineToWin */, - CARD8 * /* status */); - -extern void InitEvents(void); - -extern void CloseDownEvents(void); - -extern void DeleteWindowFromAnyEvents( - WindowPtr /* pWin */, - Bool /* freeResources */); - - -extern Mask EventMaskForClient( - WindowPtr /* pWin */, - ClientPtr /* client */); - - - -extern _X_EXPORT int DeliverEvents( - WindowPtr /*pWin*/, - xEventPtr /*xE*/, - int /*count*/, - WindowPtr /*otherParent*/); - -extern Bool CheckMotion( - DeviceEvent* /* ev */, - DeviceIntPtr /* pDev */); - -extern _X_EXPORT void WriteEventsToClient( - ClientPtr /*pClient*/, - int /*count*/, - xEventPtr /*events*/); - -extern _X_EXPORT int TryClientEvents( - ClientPtr /*client*/, - DeviceIntPtr /* device */, - xEventPtr /*pEvents*/, - int /*count*/, - Mask /*mask*/, - Mask /*filter*/, - GrabPtr /*grab*/); - -extern _X_EXPORT void WindowsRestructured(void); - -extern int SetClientPointer( - ClientPtr /* client */, - DeviceIntPtr /* device */); - -extern _X_EXPORT DeviceIntPtr PickPointer( - ClientPtr /* client */); - -extern _X_EXPORT DeviceIntPtr PickKeyboard( - ClientPtr /* client */); - -extern Bool IsInterferingGrab( - ClientPtr /* client */, - DeviceIntPtr /* dev */, - xEvent* /* events */); - -#ifdef PANORAMIX -extern _X_EXPORT void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff); -#endif - -#ifdef RANDR -extern _X_EXPORT void -ScreenRestructured (ScreenPtr pScreen); -#endif - -extern _X_EXPORT int ffs(int i); - - -/* - * ServerGrabCallback stuff - */ - -extern _X_EXPORT CallbackListPtr ServerGrabCallback; - -typedef enum {SERVER_GRABBED, SERVER_UNGRABBED, - CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState; - -typedef struct { - ClientPtr client; - ServerGrabState grabstate; -} ServerGrabInfoRec; - -/* - * EventCallback stuff - */ - -extern _X_EXPORT CallbackListPtr EventCallback; - -typedef struct { - ClientPtr client; - xEventPtr events; - int count; -} EventInfoRec; - -/* - * DeviceEventCallback stuff - */ - -extern _X_EXPORT CallbackListPtr DeviceEventCallback; - -typedef struct { - InternalEvent *event; - DeviceIntPtr device; -} DeviceEventInfoRec; - -extern int XItoCoreType(int xi_type); -extern Bool DevHasCursor(DeviceIntPtr pDev); -extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev); -extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev); -extern Bool IsPointerEvent(InternalEvent *event); -extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev); - -extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); -extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what); -extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what); - - -/* - * These are deprecated compatibility functions and will be removed soon! - * Please use the noted replacements instead. - */ -/* replaced by dixLookupWindow */ -extern _X_EXPORT WindowPtr SecurityLookupWindow( - XID id, - ClientPtr client, - Mask access_mode); -/* replaced by dixLookupWindow */ -extern _X_EXPORT WindowPtr LookupWindow( - XID id, - ClientPtr client); - -/* replaced by dixLookupDrawable */ -extern _X_EXPORT pointer SecurityLookupDrawable( - XID id, - ClientPtr client, - Mask access_mode); - -/* replaced by dixLookupDrawable */ -extern _X_EXPORT pointer LookupDrawable( - XID id, - ClientPtr client); - -/* replaced by dixLookupClient */ -extern _X_EXPORT ClientPtr LookupClient( - XID id, - ClientPtr client); - -#endif /* DIX_H */ +/*********************************************************** + +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. + +******************************************************************/ + +#ifndef DIX_H +#define DIX_H + +#include "callback.h" +#include "gc.h" +#include "window.h" +#include "input.h" +#include "cursor.h" +#include "geext.h" +#include "events.h" +#include + +#define EARLIER -1 +#define SAMETIME 0 +#define LATER 1 + +#define NullClient ((ClientPtr) 0) +#define REQUEST(type) \ + type *stuff = (type *)client->requestBuffer + + +#define REQUEST_SIZE_MATCH(req)\ + if ((sizeof(req) >> 2) != client->req_len)\ + return(BadLength) + +#define REQUEST_AT_LEAST_SIZE(req) \ + if ((sizeof(req) >> 2) > client->req_len )\ + return(BadLength) + +#define REQUEST_FIXED_SIZE(req, n)\ + if (((sizeof(req) >> 2) > client->req_len) || \ + (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \ + return(BadLength) + +#define LEGAL_NEW_RESOURCE(id,client)\ + if (!LegalNewID(id,client)) \ + {\ + client->errorValue = id;\ + return BadIDChoice;\ + } + +#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\ + {\ + int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\ + if (rc != Success)\ + return rc;\ + rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\ + if (rc != Success)\ + return rc;\ + if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\ + return BadMatch;\ + }\ + if (pGC->serialNumber != pDraw->serialNumber)\ + ValidateGC(pDraw, pGC); + + +#define WriteReplyToClient(pClient, size, pReply) { \ + if ((pClient)->swapped) \ + (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ + (pClient, (int)(size), pReply); \ + else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); } + +#define WriteSwappedDataToClient(pClient, size, pbuf) \ + if ((pClient)->swapped) \ + (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \ + else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf)); + +typedef struct _TimeStamp *TimeStampPtr; + +#ifndef _XTYPEDEF_CLIENTPTR +typedef struct _Client *ClientPtr; /* also in misc.h */ +#define _XTYPEDEF_CLIENTPTR +#endif + +typedef struct _WorkQueue *WorkQueuePtr; + +extern _X_EXPORT ClientPtr clients[MAXCLIENTS]; +extern _X_EXPORT ClientPtr serverClient; +extern _X_EXPORT int currentMaxClients; +extern _X_EXPORT char dispatchExceptionAtReset; + +typedef int HWEventQueueType; +typedef HWEventQueueType* HWEventQueuePtr; + +extern _X_EXPORT HWEventQueuePtr checkForInput[2]; + +typedef struct _TimeStamp { + CARD32 months; /* really ~49.7 days */ + CARD32 milliseconds; +} TimeStamp; + +/* dispatch.c */ + +extern _X_EXPORT void SetInputCheck( + HWEventQueuePtr /*c0*/, + HWEventQueuePtr /*c1*/); + +extern _X_EXPORT void CloseDownClient( + ClientPtr /*client*/); + +extern _X_EXPORT void UpdateCurrentTime(void); + +extern _X_EXPORT void UpdateCurrentTimeIf(void); + +extern _X_EXPORT int dixDestroyPixmap( + pointer /*value*/, + XID /*pid*/); + +extern _X_EXPORT void InitClient( + ClientPtr /*client*/, + int /*i*/, + pointer /*ospriv*/); + +extern _X_EXPORT ClientPtr NextAvailableClient( + pointer /*ospriv*/); + +extern _X_EXPORT void SendErrorToClient( + ClientPtr /*client*/, + unsigned int /*majorCode*/, + unsigned int /*minorCode*/, + XID /*resId*/, + int /*errorCode*/); + +extern _X_EXPORT void MarkClientException( + ClientPtr /*client*/); + +extern _X_HIDDEN Bool CreateConnectionBlock(void); +/* dixutils.c */ + +extern _X_EXPORT int CompareISOLatin1Lowered( + unsigned char * /*a*/, + int alen, + unsigned char * /*b*/, + int blen); + +extern _X_EXPORT int dixLookupWindow( + WindowPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern _X_EXPORT int dixLookupDrawable( + DrawablePtr *result, + XID id, + ClientPtr client, + Mask type_mask, + Mask access_mode); + +extern _X_EXPORT int dixLookupGC( + GCPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern _X_EXPORT int dixLookupFontable( + FontPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern _X_EXPORT int dixLookupClient( + ClientPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern _X_EXPORT void NoopDDA(void); + +extern _X_EXPORT int AlterSaveSetForClient( + ClientPtr /*client*/, + WindowPtr /*pWin*/, + unsigned /*mode*/, + Bool /*toRoot*/, + Bool /*map*/); + +extern _X_EXPORT void DeleteWindowFromAnySaveSet( + WindowPtr /*pWin*/); + +extern _X_EXPORT void BlockHandler( + pointer /*pTimeout*/, + pointer /*pReadmask*/); + +extern _X_EXPORT void WakeupHandler( + int /*result*/, + pointer /*pReadmask*/); + +void +EnableLimitedSchedulingLatency(void); + +void +DisableLimitedSchedulingLatency(void); + +typedef void (* WakeupHandlerProcPtr)( + pointer /* blockData */, + int /* result */, + pointer /* pReadmask */); + +extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers( + BlockHandlerProcPtr /*blockHandler*/, + WakeupHandlerProcPtr /*wakeupHandler*/, + pointer /*blockData*/); + +extern _X_EXPORT void RemoveBlockAndWakeupHandlers( + BlockHandlerProcPtr /*blockHandler*/, + WakeupHandlerProcPtr /*wakeupHandler*/, + pointer /*blockData*/); + +extern _X_EXPORT void InitBlockAndWakeupHandlers(void); + +extern _X_EXPORT void ProcessWorkQueue(void); + +extern _X_EXPORT void ProcessWorkQueueZombies(void); + +extern _X_EXPORT Bool QueueWorkProc( + Bool (* /*function*/)( + ClientPtr /*clientUnused*/, + pointer /*closure*/), + ClientPtr /*client*/, + pointer /*closure*/ +); + +typedef Bool (* ClientSleepProcPtr)( + ClientPtr /*client*/, + pointer /*closure*/); + +extern _X_EXPORT Bool ClientSleep( + ClientPtr /*client*/, + ClientSleepProcPtr /* function */, + pointer /*closure*/); + +#ifndef ___CLIENTSIGNAL_DEFINED___ +#define ___CLIENTSIGNAL_DEFINED___ +extern _X_EXPORT Bool ClientSignal( + ClientPtr /*client*/); +#endif /* ___CLIENTSIGNAL_DEFINED___ */ + +extern _X_EXPORT void ClientWakeup( + ClientPtr /*client*/); + +extern _X_EXPORT Bool ClientIsAsleep( + ClientPtr /*client*/); + +/* atom.c */ + +extern _X_EXPORT Atom MakeAtom( + const char * /*string*/, + unsigned /*len*/, + Bool /*makeit*/); + +extern _X_EXPORT Bool ValidAtom( + Atom /*atom*/); + +extern _X_EXPORT const char *NameForAtom( + Atom /*atom*/); + +extern _X_EXPORT void AtomError(void) _X_NORETURN; + +extern _X_EXPORT void FreeAllAtoms(void); + +extern _X_EXPORT void InitAtoms(void); + +/* main.c */ + +extern _X_EXPORT void SetVendorRelease(int release); + +extern _X_EXPORT void SetVendorString(char *string); + +/* events.c */ + +extern void SetMaskForEvent( + int /* deviceid */, + Mask /* mask */, + int /* event */); + +extern _X_EXPORT void ConfineToShape( + DeviceIntPtr /* pDev */, + RegionPtr /* shape */, + int* /* px */, + int* /* py */); + +extern _X_EXPORT Bool IsParent( + WindowPtr /* maybeparent */, + WindowPtr /* child */); + +extern _X_EXPORT WindowPtr GetCurrentRootWindow(DeviceIntPtr pDev); + +extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev); + + +extern _X_EXPORT void NoticeEventTime(InternalEvent *ev); + +extern void EnqueueEvent( + InternalEvent * /* ev */, + DeviceIntPtr /* device */); + +extern void ActivatePointerGrab( + DeviceIntPtr /* mouse */, + GrabPtr /* grab */, + TimeStamp /* time */, + Bool /* autoGrab */); + +extern void DeactivatePointerGrab( + DeviceIntPtr /* mouse */); + +extern void ActivateKeyboardGrab( + DeviceIntPtr /* keybd */, + GrabPtr /* grab */, + TimeStamp /* time */, + Bool /* passive */); + +extern void DeactivateKeyboardGrab( + DeviceIntPtr /* keybd */); + +extern BOOL ActivateFocusInGrab( + DeviceIntPtr /* dev */, + WindowPtr /* old */, + WindowPtr /* win */); + +extern void AllowSome( + ClientPtr /* client */, + TimeStamp /* time */, + DeviceIntPtr /* thisDev */, + int /* newState */); + +extern void ReleaseActiveGrabs( + ClientPtr client); + +extern GrabPtr CheckPassiveGrabsOnWindow( + WindowPtr /* pWin */, + DeviceIntPtr /* device */, + DeviceEvent * /* event */, + BOOL /* checkCore */, + BOOL /* activate */); + +extern _X_EXPORT int DeliverEventsToWindow( + DeviceIntPtr /* pWin */, + WindowPtr /* pWin */, + xEventPtr /* pEvents */, + int /* count */, + Mask /* filter */, + GrabPtr /* grab */); + +extern int DeliverDeviceEvents( + WindowPtr /* pWin */, + InternalEvent* /* event */, + GrabPtr /* grab */, + WindowPtr /* stopAt */, + DeviceIntPtr /* dev */); + +extern void InitializeSprite( + DeviceIntPtr /* pDev */, + WindowPtr /* pWin */); + +extern void UpdateSpriteForScreen( + DeviceIntPtr /* pDev */, + ScreenPtr /* pScreen */); + +extern _X_EXPORT void WindowHasNewCursor( + WindowPtr /* pWin */); + +extern Bool CheckDeviceGrabs( + DeviceIntPtr /* device */, + DeviceEvent* /* event */, + WindowPtr /* ancestor */); + +extern void DeliverFocusedEvent( + DeviceIntPtr /* keybd */, + InternalEvent* /* event */, + WindowPtr /* window */); + +extern void DeliverGrabbedEvent( + InternalEvent* /* event */, + DeviceIntPtr /* thisDev */, + Bool /* deactivateGrab */); + +extern void FixKeyState( + DeviceEvent* /* event */, + DeviceIntPtr /* keybd */); + +extern void RecalculateDeliverableEvents( + WindowPtr /* pWin */); + +extern _X_EXPORT int OtherClientGone( + pointer /* value */, + XID /* id */); + +extern void DoFocusEvents( + DeviceIntPtr /* dev */, + WindowPtr /* fromWin */, + WindowPtr /* toWin */, + int /* mode */); + +extern int SetInputFocus( + ClientPtr /* client */, + DeviceIntPtr /* dev */, + Window /* focusID */, + CARD8 /* revertTo */, + Time /* ctime */, + Bool /* followOK */); + +extern int GrabDevice( + ClientPtr /* client */, + DeviceIntPtr /* dev */, + unsigned /* this_mode */, + unsigned /* other_mode */, + Window /* grabWindow */, + unsigned /* ownerEvents */, + Time /* ctime */, + GrabMask* /* mask */, + int /* grabtype */, + Cursor /* curs */, + Window /* confineToWin */, + CARD8 * /* status */); + +extern void InitEvents(void); + +extern void CloseDownEvents(void); + +extern void DeleteWindowFromAnyEvents( + WindowPtr /* pWin */, + Bool /* freeResources */); + + +extern Mask EventMaskForClient( + WindowPtr /* pWin */, + ClientPtr /* client */); + + + +extern _X_EXPORT int DeliverEvents( + WindowPtr /*pWin*/, + xEventPtr /*xE*/, + int /*count*/, + WindowPtr /*otherParent*/); + +extern Bool CheckMotion( + DeviceEvent* /* ev */, + DeviceIntPtr /* pDev */); + +extern _X_EXPORT void WriteEventsToClient( + ClientPtr /*pClient*/, + int /*count*/, + xEventPtr /*events*/); + +extern _X_EXPORT int TryClientEvents( + ClientPtr /*client*/, + DeviceIntPtr /* device */, + xEventPtr /*pEvents*/, + int /*count*/, + Mask /*mask*/, + Mask /*filter*/, + GrabPtr /*grab*/); + +extern _X_EXPORT void WindowsRestructured(void); + +extern int SetClientPointer( + ClientPtr /* client */, + DeviceIntPtr /* device */); + +extern _X_EXPORT DeviceIntPtr PickPointer( + ClientPtr /* client */); + +extern _X_EXPORT DeviceIntPtr PickKeyboard( + ClientPtr /* client */); + +extern Bool IsInterferingGrab( + ClientPtr /* client */, + DeviceIntPtr /* dev */, + xEvent* /* events */); + +#ifdef PANORAMIX +extern _X_EXPORT void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff); +#endif + +#ifdef RANDR +extern _X_EXPORT void +ScreenRestructured (ScreenPtr pScreen); +#endif + +extern _X_EXPORT int ffs(int i); + + +/* + * ServerGrabCallback stuff + */ + +extern _X_EXPORT CallbackListPtr ServerGrabCallback; + +typedef enum {SERVER_GRABBED, SERVER_UNGRABBED, + CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState; + +typedef struct { + ClientPtr client; + ServerGrabState grabstate; +} ServerGrabInfoRec; + +/* + * EventCallback stuff + */ + +extern _X_EXPORT CallbackListPtr EventCallback; + +typedef struct { + ClientPtr client; + xEventPtr events; + int count; +} EventInfoRec; + +/* + * DeviceEventCallback stuff + */ + +extern _X_EXPORT CallbackListPtr DeviceEventCallback; + +typedef struct { + InternalEvent *event; + DeviceIntPtr device; +} DeviceEventInfoRec; + +extern int XItoCoreType(int xi_type); +extern Bool DevHasCursor(DeviceIntPtr pDev); +extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev); +extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev); +extern Bool IsPointerEvent(InternalEvent *event); +extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev); + +extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); +extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what); +extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what); + + +/* + * These are deprecated compatibility functions and will be removed soon! + * Please use the noted replacements instead. + */ +/* replaced by dixLookupWindow */ +extern _X_EXPORT WindowPtr SecurityLookupWindow( + XID id, + ClientPtr client, + Mask access_mode); +/* replaced by dixLookupWindow */ +extern _X_EXPORT WindowPtr LookupWindow( + XID id, + ClientPtr client); + +/* replaced by dixLookupDrawable */ +extern _X_EXPORT pointer SecurityLookupDrawable( + XID id, + ClientPtr client, + Mask access_mode); + +/* replaced by dixLookupDrawable */ +extern _X_EXPORT pointer LookupDrawable( + XID id, + ClientPtr client); + +/* replaced by dixLookupClient */ +extern _X_EXPORT ClientPtr LookupClient( + XID id, + ClientPtr client); + +#endif /* DIX_H */ diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h index 31aad9aa4..f96a0a988 100644 --- a/xorg-server/include/input.h +++ b/xorg-server/include/input.h @@ -1,585 +1,589 @@ -/************************************************************ - -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. - -********************************************************/ - -#ifndef INPUT_H -#define INPUT_H - -#include "misc.h" -#include "screenint.h" -#include -#include -#include -#include "window.h" /* for WindowPtr */ -#include "xkbrules.h" -#include "events.h" - -#define DEVICE_INIT 0 -#define DEVICE_ON 1 -#define DEVICE_OFF 2 -#define DEVICE_CLOSE 3 - -#define POINTER_RELATIVE (1 << 1) -#define POINTER_ABSOLUTE (1 << 2) -#define POINTER_ACCELERATE (1 << 3) -#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */ - -/*int constants for pointer acceleration schemes*/ -#define PtrAccelNoOp 0 -#define PtrAccelPredictable 1 -#define PtrAccelLightweight 2 -#define PtrAccelDefault PtrAccelPredictable - -#define MAX_VALUATORS 36 -/* Maximum number of valuators, divided by six, rounded up, to get number - * of events. */ -#define MAX_VALUATOR_EVENTS 6 -#define MAX_BUTTONS 256 /* completely arbitrarily chosen */ - -#define NO_AXIS_LIMITS -1 - -#define MAP_LENGTH 256 -#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ -#define NullGrab ((GrabPtr)NULL) -#define PointerRootWin ((WindowPtr)PointerRoot) -#define NoneWin ((WindowPtr)None) -#define NullDevice ((DevicePtr)NULL) - -#ifndef FollowKeyboard -#define FollowKeyboard 3 -#endif -#ifndef FollowKeyboardWin -#define FollowKeyboardWin ((WindowPtr) FollowKeyboard) -#endif -#ifndef RevertToFollowKeyboard -#define RevertToFollowKeyboard 3 -#endif - -typedef unsigned long Leds; -typedef struct _OtherClients *OtherClientsPtr; -typedef struct _InputClients *InputClientsPtr; -typedef struct _DeviceIntRec *DeviceIntPtr; -typedef struct _ClassesRec *ClassesPtr; -typedef union _GrabMask GrabMask; - -typedef struct _EventList { - xEvent* event; - int evlen; /* length of allocated memory for event in bytes. This is not - the actual length of the event. The event's actual length is - 32 for standard events or 32 + - ((xGenericEvent*)event)->length * 4 for GenericEvents. - For events in the EQ, the length is - ((InternalEvent*)event)->u.any.length */ -} EventList, *EventListPtr; - -/* The DIX stores incoming input events in this list */ -extern EventListPtr InputEventList; -extern int InputEventListLen; - -typedef int (*DeviceProc)( - DeviceIntPtr /*device*/, - int /*what*/); - -typedef void (*ProcessInputProc)( - InternalEvent * /*event*/, - DeviceIntPtr /*device*/); - -typedef Bool (*DeviceHandleProc)( - DeviceIntPtr /*device*/, - void* /*data*/ - ); - -typedef void (*DeviceUnwrapProc)( - DeviceIntPtr /*device*/, - DeviceHandleProc /*proc*/, - void* /*data*/ - ); - -/* pointer acceleration handling */ -typedef void (*PointerAccelSchemeProc)( - DeviceIntPtr /*pDev*/, - int /*first_valuator*/, - int /*num_valuators*/, - int* /*valuators*/, - int /*evtime*/); - -typedef void (*DeviceCallbackProc)( - DeviceIntPtr /*pDev*/); - -typedef struct _DeviceRec { - pointer devicePrivate; - ProcessInputProc processInputProc; /* current */ - ProcessInputProc realInputProc; /* deliver */ - ProcessInputProc enqueueInputProc; /* enqueue */ - Bool on; /* used by DDX to keep state */ -} DeviceRec, *DevicePtr; - -typedef struct _ValuatorMask ValuatorMask; - -typedef struct { - int click, bell, bell_pitch, bell_duration; - Bool autoRepeat; - unsigned char autoRepeats[32]; - Leds leds; - unsigned char id; -} KeybdCtrl; - -typedef struct { - KeySym *map; - KeyCode minKeyCode, - maxKeyCode; - int mapWidth; -} KeySymsRec, *KeySymsPtr; - -typedef struct { - int num, den, threshold; - unsigned char id; -} PtrCtrl; - -typedef struct { - int resolution, min_value, max_value; - int integer_displayed; - unsigned char id; -} IntegerCtrl; - -typedef struct { - int max_symbols, num_symbols_supported; - int num_symbols_displayed; - KeySym *symbols_supported; - KeySym *symbols_displayed; - unsigned char id; -} StringCtrl; - -typedef struct { - int percent, pitch, duration; - unsigned char id; -} BellCtrl; - -typedef struct { - Leds led_values; - Mask led_mask; - unsigned char id; -} LedCtrl; - -extern _X_EXPORT KeybdCtrl defaultKeyboardControl; -extern _X_EXPORT PtrCtrl defaultPointerControl; - -typedef struct _InputOption { - char *key; - char *value; - struct _InputOption *next; -} InputOption; - -typedef struct _InputAttributes { - char *product; - char *vendor; - char *device; - char *pnp_id; - char *usb_id; - char **tags; /* null-terminated */ - uint32_t flags; -} InputAttributes; - -#define ATTR_KEYBOARD (1<<0) -#define ATTR_POINTER (1<<1) -#define ATTR_JOYSTICK (1<<2) -#define ATTR_TABLET (1<<3) -#define ATTR_TOUCHPAD (1<<4) -#define ATTR_TOUCHSCREEN (1<<5) - -/* Key/Button has been run through all input processing and events sent to clients. */ -#define KEY_PROCESSED 1 -#define BUTTON_PROCESSED 1 -/* Key/Button has not been fully processed, no events have been sent. */ -#define KEY_POSTED 2 -#define BUTTON_POSTED 2 - -extern void set_key_down(DeviceIntPtr pDev, int key_code, int type); -extern void set_key_up(DeviceIntPtr pDev, int key_code, int type); -extern int key_is_down(DeviceIntPtr pDev, int key_code, int type); -extern void set_button_down(DeviceIntPtr pDev, int button, int type); -extern void set_button_up(DeviceIntPtr pDev, int button, int type); -extern int button_is_down(DeviceIntPtr pDev, int button, int type); - -extern void InitCoreDevices(void); -extern void InitXTestDevices(void); - -extern _X_EXPORT DeviceIntPtr AddInputDevice( - ClientPtr /*client*/, - DeviceProc /*deviceProc*/, - Bool /*autoStart*/); - -extern _X_EXPORT Bool EnableDevice( - DeviceIntPtr /*device*/, - BOOL /* sendevent */); - -extern _X_EXPORT Bool ActivateDevice( - DeviceIntPtr /*device*/, - BOOL /* sendevent */); - -extern _X_EXPORT Bool DisableDevice( - DeviceIntPtr /*device*/, - BOOL /* sendevent */); - -extern int InitAndStartDevices(void); - -extern void CloseDownDevices(void); - -extern void UndisplayDevices(void); - -extern _X_EXPORT int RemoveDevice( - DeviceIntPtr /*dev*/, - BOOL /* sendevent */); - -extern _X_EXPORT int NumMotionEvents(void); - -extern _X_EXPORT int dixLookupDevice( - DeviceIntPtr * /* dev */, - int /* id */, - ClientPtr /* client */, - Mask /* access_mode */); - -extern _X_EXPORT void QueryMinMaxKeyCodes( - KeyCode* /*minCode*/, - KeyCode* /*maxCode*/); - -extern _X_EXPORT Bool SetKeySymsMap( - KeySymsPtr /*dst*/, - KeySymsPtr /*src*/); - -extern _X_EXPORT Bool InitButtonClassDeviceStruct( - DeviceIntPtr /*device*/, - int /*numButtons*/, - Atom* /* labels */, - CARD8* /*map*/); - -extern _X_EXPORT Bool InitValuatorClassDeviceStruct( - DeviceIntPtr /*device*/, - int /*numAxes*/, - Atom* /* labels */, - int /*numMotionEvents*/, - int /*mode*/); - -extern _X_EXPORT Bool InitPointerAccelerationScheme( - DeviceIntPtr /*dev*/, - int /*scheme*/); - -extern _X_EXPORT Bool InitAbsoluteClassDeviceStruct( - DeviceIntPtr /*device*/); - -extern _X_EXPORT Bool InitFocusClassDeviceStruct( - DeviceIntPtr /*device*/); - -typedef void (*BellProcPtr)( - int /*percent*/, - DeviceIntPtr /*device*/, - pointer /*ctrl*/, - int); - -typedef void (*KbdCtrlProcPtr)( - DeviceIntPtr /*device*/, - KeybdCtrl * /*ctrl*/); - -typedef void (*PtrCtrlProcPtr)( - DeviceIntPtr /*device*/, - PtrCtrl * /*ctrl*/); - -extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - PtrCtrlProcPtr /*controlProc*/); - -typedef void (*StringCtrlProcPtr)( - DeviceIntPtr /*device*/, - StringCtrl * /*ctrl*/); - -extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - StringCtrlProcPtr /*controlProc*/, - int /*max_symbols*/, - int /*num_symbols_supported*/, - KeySym* /*symbols*/); - -typedef void (*BellCtrlProcPtr)( - DeviceIntPtr /*device*/, - BellCtrl * /*ctrl*/); - -extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - BellProcPtr /*bellProc*/, - BellCtrlProcPtr /*controlProc*/); - -typedef void (*LedCtrlProcPtr)( - DeviceIntPtr /*device*/, - LedCtrl * /*ctrl*/); - -extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - LedCtrlProcPtr /*controlProc*/); - -typedef void (*IntegerCtrlProcPtr)( - DeviceIntPtr /*device*/, - IntegerCtrl * /*ctrl*/); - - -extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - IntegerCtrlProcPtr /*controlProc*/); - -extern _X_EXPORT Bool InitPointerDeviceStruct( - DevicePtr /*device*/, - CARD8* /*map*/, - int /*numButtons*/, - Atom* /* btn_labels */, - PtrCtrlProcPtr /*controlProc*/, - int /*numMotionEvents*/, - int /*numAxes*/, - Atom* /* axes_labels */); - -extern _X_EXPORT Bool InitKeyboardDeviceStruct( - DeviceIntPtr /*device*/, - XkbRMLVOSet * /*rmlvo*/, - BellProcPtr /*bellProc*/, - KbdCtrlProcPtr /*controlProc*/); - -extern int ApplyPointerMapping( - DeviceIntPtr /* pDev */, - CARD8 * /* map */, - int /* len */, - ClientPtr /* client */); - -extern Bool BadDeviceMap( - BYTE* /*buff*/, - int /*length*/, - unsigned /*low*/, - unsigned /*high*/, - XID* /*errval*/); - -extern void NoteLedState( - DeviceIntPtr /*keybd*/, - int /*led*/, - Bool /*on*/); - -extern void MaybeStopHint( - DeviceIntPtr /*device*/, - ClientPtr /*client*/); - -extern void ProcessPointerEvent( - InternalEvent* /* ev */, - DeviceIntPtr /*mouse*/); - -extern void ProcessKeyboardEvent( - InternalEvent* /*ev*/, - DeviceIntPtr /*keybd*/); - -extern Bool LegalModifier( - unsigned int /*key*/, - DeviceIntPtr /*pDev*/); - -extern _X_EXPORT void ProcessInputEvents(void); - -extern _X_EXPORT void InitInput( - int /*argc*/, - char ** /*argv*/); -extern _X_EXPORT void CloseInput(void); - -extern _X_EXPORT int GetMaximumEventsNum(void); - -extern _X_EXPORT int GetEventList(EventListPtr* list); -extern _X_EXPORT EventListPtr InitEventList(int num_events); -extern _X_EXPORT void FreeEventList(EventListPtr list, int num_events); - -extern void CreateClassesChangedEvent(EventListPtr event, - DeviceIntPtr master, - DeviceIntPtr slave, - int type); -extern EventListPtr UpdateFromMaster( - EventListPtr events, - DeviceIntPtr pDev, - int type, - int *num_events); - -extern _X_EXPORT int GetPointerEvents( - EventListPtr events, - DeviceIntPtr pDev, - int type, - int buttons, - int flags, - const ValuatorMask *mask); - -extern _X_EXPORT int GetKeyboardEvents( - EventListPtr events, - DeviceIntPtr pDev, - int type, - int key_code); - -extern int GetKeyboardValuatorEvents( - EventListPtr events, - DeviceIntPtr pDev, - int type, - int key_code, - const ValuatorMask *mask); - -extern int GetProximityEvents( - EventListPtr events, - DeviceIntPtr pDev, - int type, - const ValuatorMask *mask); - -extern void PostSyntheticMotion( - DeviceIntPtr pDev, - int x, - int y, - int screen, - unsigned long time); - -extern _X_EXPORT int GetMotionHistorySize( - void); - -extern _X_EXPORT void AllocateMotionHistory( - DeviceIntPtr pDev); - -extern _X_EXPORT int GetMotionHistory( - DeviceIntPtr pDev, - xTimecoord **buff, - unsigned long start, - unsigned long stop, - ScreenPtr pScreen, - BOOL core); - -extern int AttachDevice(ClientPtr client, - DeviceIntPtr slave, - DeviceIntPtr master); - -extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); -extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); - -extern _X_EXPORT int AllocDevicePair(ClientPtr client, - char* name, - DeviceIntPtr* ptr, - DeviceIntPtr* keybd, - DeviceProc ptr_proc, - DeviceProc keybd_proc, - Bool master); -extern void DeepCopyDeviceClasses(DeviceIntPtr from, - DeviceIntPtr to, - DeviceChangedEvent *dce); - -/* Helper functions. */ -extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, - KeyCode **modkeymap, int *max_keys_per_mod); -extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map, - int max_keys_per_mod); -extern int AllocXTestDevice(ClientPtr client, - char* name, - DeviceIntPtr* ptr, - DeviceIntPtr* keybd, - DeviceIntPtr master_ptr, - DeviceIntPtr master_keybd); -extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master); -extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master); -extern void SendDevicePresenceEvent(int deviceid, int type); -extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs); -extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs); - -/* misc event helpers */ -extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); -extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev); -void FixUpEventFromWindow(DeviceIntPtr pDev, - xEvent *xE, - WindowPtr pWin, - Window child, - Bool calcChild); -extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, - WindowPtr win); -/** - * Return masks for EventIsDeliverable. - * @defgroup EventIsDeliverable return flags - * @{ - */ -#define XI_MASK (1 << 0) /**< XI mask set on window */ -#define CORE_MASK (1 << 1) /**< Core mask set on window */ -#define DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set on window */ -#define XI2_MASK (1 << 3) /**< XI2 mask set on window */ -/* @} */ - -/* Implemented by the DDX. */ -extern _X_EXPORT int NewInputDeviceRequest( - InputOption *options, - InputAttributes *attrs, - DeviceIntPtr *dev); -extern _X_EXPORT void DeleteInputDeviceRequest( - DeviceIntPtr dev); - -extern _X_EXPORT void DDXRingBell( - int volume, - int pitch, - int duration); - -#define VALUATOR_MODE_ALL_AXES -1 -extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis); -extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode); - -/* Set to TRUE by default - os/utils.c sets it to FALSE on user request, - xfixes/cursor.c uses it to determine if the cursor is enabled */ -extern Bool EnableCursor; - -extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators); -extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask, - int first_valuator, int num_valuators, - const int* valuators); -extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask, - int valuator, - int data); -extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask); -extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask); -extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit); -extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit); -extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask); -extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest, - const ValuatorMask *src); -extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum); - -#endif /* INPUT_H */ +/************************************************************ + +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. + +********************************************************/ + +#ifndef INPUT_H +#define INPUT_H + +#include "misc.h" +#include "screenint.h" +#include +#include +#include +#include "window.h" /* for WindowPtr */ +#include "xkbrules.h" +#include "events.h" + +#define DEVICE_INIT 0 +#define DEVICE_ON 1 +#define DEVICE_OFF 2 +#define DEVICE_CLOSE 3 + +#define POINTER_RELATIVE (1 << 1) +#define POINTER_ABSOLUTE (1 << 2) +#define POINTER_ACCELERATE (1 << 3) +#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */ + +/*int constants for pointer acceleration schemes*/ +#define PtrAccelNoOp 0 +#define PtrAccelPredictable 1 +#define PtrAccelLightweight 2 +#define PtrAccelDefault PtrAccelPredictable + +#define MAX_VALUATORS 36 +/* Maximum number of valuators, divided by six, rounded up, to get number + * of events. */ +#define MAX_VALUATOR_EVENTS 6 +#define MAX_BUTTONS 256 /* completely arbitrarily chosen */ + +#define NO_AXIS_LIMITS -1 + +#define MAP_LENGTH 256 +#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ +#define NullGrab ((GrabPtr)NULL) +#define PointerRootWin ((WindowPtr)PointerRoot) +#define NoneWin ((WindowPtr)None) +#define NullDevice ((DevicePtr)NULL) + +#ifndef FollowKeyboard +#define FollowKeyboard 3 +#endif +#ifndef FollowKeyboardWin +#define FollowKeyboardWin ((WindowPtr) FollowKeyboard) +#endif +#ifndef RevertToFollowKeyboard +#define RevertToFollowKeyboard 3 +#endif + +typedef unsigned long Leds; +typedef struct _OtherClients *OtherClientsPtr; +typedef struct _InputClients *InputClientsPtr; +typedef struct _DeviceIntRec *DeviceIntPtr; +typedef struct _ClassesRec *ClassesPtr; +typedef struct _SpriteRec *SpritePtr; +typedef union _GrabMask GrabMask; + +typedef struct _EventList { + xEvent* event; + int evlen; /* length of allocated memory for event in bytes. This is not + the actual length of the event. The event's actual length is + 32 for standard events or 32 + + ((xGenericEvent*)event)->length * 4 for GenericEvents. + For events in the EQ, the length is + ((InternalEvent*)event)->u.any.length */ +} EventList, *EventListPtr; + +/* The DIX stores incoming input events in this list */ +extern EventListPtr InputEventList; +extern int InputEventListLen; + +typedef int (*DeviceProc)( + DeviceIntPtr /*device*/, + int /*what*/); + +typedef void (*ProcessInputProc)( + InternalEvent * /*event*/, + DeviceIntPtr /*device*/); + +typedef Bool (*DeviceHandleProc)( + DeviceIntPtr /*device*/, + void* /*data*/ + ); + +typedef void (*DeviceUnwrapProc)( + DeviceIntPtr /*device*/, + DeviceHandleProc /*proc*/, + void* /*data*/ + ); + +/* pointer acceleration handling */ +typedef void (*PointerAccelSchemeProc)( + DeviceIntPtr /*pDev*/, + int /*first_valuator*/, + int /*num_valuators*/, + int* /*valuators*/, + int /*evtime*/); + +typedef void (*DeviceCallbackProc)( + DeviceIntPtr /*pDev*/); + +typedef struct _DeviceRec { + pointer devicePrivate; + ProcessInputProc processInputProc; /* current */ + ProcessInputProc realInputProc; /* deliver */ + ProcessInputProc enqueueInputProc; /* enqueue */ + Bool on; /* used by DDX to keep state */ +} DeviceRec, *DevicePtr; + +typedef struct _ValuatorMask ValuatorMask; + +typedef struct { + int click, bell, bell_pitch, bell_duration; + Bool autoRepeat; + unsigned char autoRepeats[32]; + Leds leds; + unsigned char id; +} KeybdCtrl; + +typedef struct { + KeySym *map; + KeyCode minKeyCode, + maxKeyCode; + int mapWidth; +} KeySymsRec, *KeySymsPtr; + +typedef struct { + int num, den, threshold; + unsigned char id; +} PtrCtrl; + +typedef struct { + int resolution, min_value, max_value; + int integer_displayed; + unsigned char id; +} IntegerCtrl; + +typedef struct { + int max_symbols, num_symbols_supported; + int num_symbols_displayed; + KeySym *symbols_supported; + KeySym *symbols_displayed; + unsigned char id; +} StringCtrl; + +typedef struct { + int percent, pitch, duration; + unsigned char id; +} BellCtrl; + +typedef struct { + Leds led_values; + Mask led_mask; + unsigned char id; +} LedCtrl; + +extern _X_EXPORT KeybdCtrl defaultKeyboardControl; +extern _X_EXPORT PtrCtrl defaultPointerControl; + +typedef struct _InputOption { + char *key; + char *value; + struct _InputOption *next; +} InputOption; + +typedef struct _InputAttributes { + char *product; + char *vendor; + char *device; + char *pnp_id; + char *usb_id; + char **tags; /* null-terminated */ + uint32_t flags; +} InputAttributes; + +#define ATTR_KEYBOARD (1<<0) +#define ATTR_POINTER (1<<1) +#define ATTR_JOYSTICK (1<<2) +#define ATTR_TABLET (1<<3) +#define ATTR_TOUCHPAD (1<<4) +#define ATTR_TOUCHSCREEN (1<<5) + +/* Key/Button has been run through all input processing and events sent to clients. */ +#define KEY_PROCESSED 1 +#define BUTTON_PROCESSED 1 +/* Key/Button has not been fully processed, no events have been sent. */ +#define KEY_POSTED 2 +#define BUTTON_POSTED 2 + +extern void set_key_down(DeviceIntPtr pDev, int key_code, int type); +extern void set_key_up(DeviceIntPtr pDev, int key_code, int type); +extern int key_is_down(DeviceIntPtr pDev, int key_code, int type); +extern void set_button_down(DeviceIntPtr pDev, int button, int type); +extern void set_button_up(DeviceIntPtr pDev, int button, int type); +extern int button_is_down(DeviceIntPtr pDev, int button, int type); + +extern void InitCoreDevices(void); +extern void InitXTestDevices(void); + +extern _X_EXPORT DeviceIntPtr AddInputDevice( + ClientPtr /*client*/, + DeviceProc /*deviceProc*/, + Bool /*autoStart*/); + +extern _X_EXPORT Bool EnableDevice( + DeviceIntPtr /*device*/, + BOOL /* sendevent */); + +extern _X_EXPORT Bool ActivateDevice( + DeviceIntPtr /*device*/, + BOOL /* sendevent */); + +extern _X_EXPORT Bool DisableDevice( + DeviceIntPtr /*device*/, + BOOL /* sendevent */); + +extern int InitAndStartDevices(void); + +extern void CloseDownDevices(void); + +extern void UndisplayDevices(void); + +extern _X_EXPORT int RemoveDevice( + DeviceIntPtr /*dev*/, + BOOL /* sendevent */); + +extern _X_EXPORT int NumMotionEvents(void); + +extern _X_EXPORT int dixLookupDevice( + DeviceIntPtr * /* dev */, + int /* id */, + ClientPtr /* client */, + Mask /* access_mode */); + +extern _X_EXPORT void QueryMinMaxKeyCodes( + KeyCode* /*minCode*/, + KeyCode* /*maxCode*/); + +extern _X_EXPORT Bool SetKeySymsMap( + KeySymsPtr /*dst*/, + KeySymsPtr /*src*/); + +extern _X_EXPORT Bool InitButtonClassDeviceStruct( + DeviceIntPtr /*device*/, + int /*numButtons*/, + Atom* /* labels */, + CARD8* /*map*/); + +extern _X_EXPORT Bool InitValuatorClassDeviceStruct( + DeviceIntPtr /*device*/, + int /*numAxes*/, + Atom* /* labels */, + int /*numMotionEvents*/, + int /*mode*/); + +extern _X_EXPORT Bool InitPointerAccelerationScheme( + DeviceIntPtr /*dev*/, + int /*scheme*/); + +extern _X_EXPORT Bool InitAbsoluteClassDeviceStruct( + DeviceIntPtr /*device*/); + +extern _X_EXPORT Bool InitFocusClassDeviceStruct( + DeviceIntPtr /*device*/); + +typedef void (*BellProcPtr)( + int /*percent*/, + DeviceIntPtr /*device*/, + pointer /*ctrl*/, + int); + +typedef void (*KbdCtrlProcPtr)( + DeviceIntPtr /*device*/, + KeybdCtrl * /*ctrl*/); + +typedef void (*PtrCtrlProcPtr)( + DeviceIntPtr /*device*/, + PtrCtrl * /*ctrl*/); + +extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + PtrCtrlProcPtr /*controlProc*/); + +typedef void (*StringCtrlProcPtr)( + DeviceIntPtr /*device*/, + StringCtrl * /*ctrl*/); + +extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + StringCtrlProcPtr /*controlProc*/, + int /*max_symbols*/, + int /*num_symbols_supported*/, + KeySym* /*symbols*/); + +typedef void (*BellCtrlProcPtr)( + DeviceIntPtr /*device*/, + BellCtrl * /*ctrl*/); + +extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + BellProcPtr /*bellProc*/, + BellCtrlProcPtr /*controlProc*/); + +typedef void (*LedCtrlProcPtr)( + DeviceIntPtr /*device*/, + LedCtrl * /*ctrl*/); + +extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + LedCtrlProcPtr /*controlProc*/); + +typedef void (*IntegerCtrlProcPtr)( + DeviceIntPtr /*device*/, + IntegerCtrl * /*ctrl*/); + + +extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + IntegerCtrlProcPtr /*controlProc*/); + +extern _X_EXPORT Bool InitPointerDeviceStruct( + DevicePtr /*device*/, + CARD8* /*map*/, + int /*numButtons*/, + Atom* /* btn_labels */, + PtrCtrlProcPtr /*controlProc*/, + int /*numMotionEvents*/, + int /*numAxes*/, + Atom* /* axes_labels */); + +extern _X_EXPORT Bool InitKeyboardDeviceStruct( + DeviceIntPtr /*device*/, + XkbRMLVOSet * /*rmlvo*/, + BellProcPtr /*bellProc*/, + KbdCtrlProcPtr /*controlProc*/); + +extern int ApplyPointerMapping( + DeviceIntPtr /* pDev */, + CARD8 * /* map */, + int /* len */, + ClientPtr /* client */); + +extern Bool BadDeviceMap( + BYTE* /*buff*/, + int /*length*/, + unsigned /*low*/, + unsigned /*high*/, + XID* /*errval*/); + +extern void NoteLedState( + DeviceIntPtr /*keybd*/, + int /*led*/, + Bool /*on*/); + +extern void MaybeStopHint( + DeviceIntPtr /*device*/, + ClientPtr /*client*/); + +extern void ProcessPointerEvent( + InternalEvent* /* ev */, + DeviceIntPtr /*mouse*/); + +extern void ProcessKeyboardEvent( + InternalEvent* /*ev*/, + DeviceIntPtr /*keybd*/); + +extern Bool LegalModifier( + unsigned int /*key*/, + DeviceIntPtr /*pDev*/); + +extern _X_EXPORT void ProcessInputEvents(void); + +extern _X_EXPORT void InitInput( + int /*argc*/, + char ** /*argv*/); +extern _X_EXPORT void CloseInput(void); + +extern _X_EXPORT int GetMaximumEventsNum(void); + +extern _X_EXPORT int GetEventList(EventListPtr* list); +extern _X_EXPORT EventListPtr InitEventList(int num_events); +extern _X_EXPORT void FreeEventList(EventListPtr list, int num_events); + +extern void CreateClassesChangedEvent(EventListPtr event, + DeviceIntPtr master, + DeviceIntPtr slave, + int type); +extern EventListPtr UpdateFromMaster( + EventListPtr events, + DeviceIntPtr pDev, + int type, + int *num_events); + +extern _X_EXPORT int GetPointerEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, + int buttons, + int flags, + const ValuatorMask *mask); + +extern _X_EXPORT int GetKeyboardEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, + int key_code); + +extern int GetKeyboardValuatorEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, + int key_code, + const ValuatorMask *mask); + +extern int GetProximityEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, + const ValuatorMask *mask); + +extern void PostSyntheticMotion( + DeviceIntPtr pDev, + int x, + int y, + int screen, + unsigned long time); + +extern _X_EXPORT int GetMotionHistorySize( + void); + +extern _X_EXPORT void AllocateMotionHistory( + DeviceIntPtr pDev); + +extern _X_EXPORT int GetMotionHistory( + DeviceIntPtr pDev, + xTimecoord **buff, + unsigned long start, + unsigned long stop, + ScreenPtr pScreen, + BOOL core); + +extern int AttachDevice(ClientPtr client, + DeviceIntPtr slave, + DeviceIntPtr master); + +extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); +extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); + +extern _X_EXPORT int AllocDevicePair(ClientPtr client, + char* name, + DeviceIntPtr* ptr, + DeviceIntPtr* keybd, + DeviceProc ptr_proc, + DeviceProc keybd_proc, + Bool master); +extern void DeepCopyDeviceClasses(DeviceIntPtr from, + DeviceIntPtr to, + DeviceChangedEvent *dce); + +/* Helper functions. */ +extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, + KeyCode **modkeymap, int *max_keys_per_mod); +extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map, + int max_keys_per_mod); +extern int AllocXTestDevice(ClientPtr client, + char* name, + DeviceIntPtr* ptr, + DeviceIntPtr* keybd, + DeviceIntPtr master_ptr, + DeviceIntPtr master_keybd); +extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master); +extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master); +extern void SendDevicePresenceEvent(int deviceid, int type); +extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs); +extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs); + +/* misc event helpers */ +extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients); +extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); +extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev); +void FixUpEventFromWindow(SpritePtr pSprite, + xEvent *xE, + WindowPtr pWin, + Window child, + Bool calcChild); +extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y); +extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, + WindowPtr win); +/** + * Return masks for EventIsDeliverable. + * @defgroup EventIsDeliverable return flags + * @{ + */ +#define XI_MASK (1 << 0) /**< XI mask set on window */ +#define CORE_MASK (1 << 1) /**< Core mask set on window */ +#define DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set on window */ +#define XI2_MASK (1 << 3) /**< XI2 mask set on window */ +/* @} */ + +/* Implemented by the DDX. */ +extern _X_EXPORT int NewInputDeviceRequest( + InputOption *options, + InputAttributes *attrs, + DeviceIntPtr *dev); +extern _X_EXPORT void DeleteInputDeviceRequest( + DeviceIntPtr dev); + +extern _X_EXPORT void DDXRingBell( + int volume, + int pitch, + int duration); + +#define VALUATOR_MODE_ALL_AXES -1 +extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis); +extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode); + +/* Set to TRUE by default - os/utils.c sets it to FALSE on user request, + xfixes/cursor.c uses it to determine if the cursor is enabled */ +extern Bool EnableCursor; + +extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators); +extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask); +extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask, + int first_valuator, int num_valuators, + const int* valuators); +extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask, + int valuator, + int data); +extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask); +extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask); +extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit); +extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit); +extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask); +extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest, + const ValuatorMask *src); +extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum); + +#endif /* INPUT_H */ diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h index 325d5934f..b74ee0454 100644 --- a/xorg-server/include/inputstr.h +++ b/xorg-server/include/inputstr.h @@ -1,615 +1,615 @@ -/************************************************************ - -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. - -********************************************************/ - - -#ifndef INPUTSTRUCT_H -#define INPUTSTRUCT_H - -#include -#include "input.h" -#include "window.h" -#include "dixstruct.h" -#include "cursorstr.h" -#include "geext.h" -#include "privates.h" - -#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) -#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) -#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) -extern _X_EXPORT int CountBits(const uint8_t *mask, int len); - -#define SameClient(obj,client) \ - (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) - -#define EMASKSIZE MAXDEVICES + 2 - -/* This is the last XI2 event supported by the server. If you add - * events to the protocol, the server will not support these events until - * this number here is bumped. - */ -#define XI2LASTEVENT 17 /* XI_RawMotion */ -#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */ - -/** - * This struct stores the core event mask for each client except the client - * that created the window. - * - * Each window that has events selected from other clients has at least one of - * these masks. If multiple clients selected for events on the same window, - * these masks are in a linked list. - * - * The event mask for the client that created the window is stored in - * win->eventMask instead. - * - * The resource id is simply a fake client ID to associate this mask with a - * client. - * - * Kludge: OtherClients and InputClients must be compatible, see code. - */ -typedef struct _OtherClients { - OtherClientsPtr next; /**< Pointer to the next mask */ - XID resource; /**< id for putting into resource manager */ - Mask mask; /**< Core event mask */ -} OtherClients; - -/** - * This struct stores the XI event mask for each client. - * - * Each window that has events selected has at least one of these masks. If - * multiple client selected for events on the same window, these masks are in - * a linked list. - */ -typedef struct _InputClients { - InputClientsPtr next; /**< Pointer to the next mask */ - XID resource; /**< id for putting into resource manager */ - Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */ - /** XI2 event masks. One per device, each bit is a mask of (1 << type) */ - unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; -} InputClients; - -/** - * Combined XI event masks from all devices. - * - * This is the XI equivalent of the deliverableEvents, eventMask and - * dontPropagate mask of the WindowRec (or WindowOptRec). - * - * A window that has an XI client selecting for events has exactly one - * OtherInputMasks struct and exactly one InputClients struct hanging off - * inputClients. Each further client appends to the inputClients list. - * Each Mask field is per-device, with the device id as the index. - * Exception: for non-device events (Presence events), the MAXDEVICES - * deviceid is used. - */ -typedef struct _OtherInputMasks { - /** - * Bitwise OR of all masks by all clients and the window's parent's masks. - */ - Mask deliverableEvents[EMASKSIZE]; - /** - * Bitwise OR of all masks by all clients on this window. - */ - Mask inputEvents[EMASKSIZE]; - /** The do-not-propagate masks for each device. */ - Mask dontPropagateMask[EMASKSIZE]; - /** The clients that selected for events */ - InputClientsPtr inputClients; - /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ - unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; -} OtherInputMasks; - -/* - * The following structure gets used for both active and passive grabs. For - * active grabs some of the fields (e.g. modifiers) are not used. However, - * that is not much waste since there aren't many active grabs (one per - * keyboard/pointer device) going at once in the server. - */ - -#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible - modifier combinations, but only - 3 buttons. */ - -typedef struct _DetailRec { /* Grab details may be bit masks */ - unsigned int exact; - Mask *pMask; -} DetailRec; - -typedef enum { - GRABTYPE_CORE, - GRABTYPE_XI, - GRABTYPE_XI2 -} GrabType; - -union _GrabMask { - Mask core; - Mask xi; - char xi2mask[EMASKSIZE][XI2MASKSIZE]; -}; - -/** - * Central struct for device grabs. - * The same struct is used for both core grabs and device grabs, with - * different fields being set. - * If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask - * is a combination of standard event masks (i.e. PointerMotionMask | - * ButtonPressMask). - * If the grab is a device grab (GrabDevice), then the eventMask is a - * combination of event masks for a given XI event type (see SetEventInfo). - * - * If the grab is a result of a ButtonPress, then eventMask is the core mask - * and deviceMask is set to the XI event mask for the grab. - */ -typedef struct _GrabRec { - GrabPtr next; /* for chain of passive grabs */ - XID resource; - DeviceIntPtr device; - WindowPtr window; - unsigned ownerEvents:1; - unsigned keyboardMode:1; - unsigned pointerMode:1; - GrabType grabtype; - CARD8 type; /* event type */ - DetailRec modifiersDetail; - DeviceIntPtr modifierDevice; - DetailRec detail; /* key or button */ - WindowPtr confineTo; /* always NULL for keyboards */ - CursorPtr cursor; /* always NULL for keyboards */ - Mask eventMask; - Mask deviceMask; - /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ - unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; -} GrabRec; - -typedef struct _KeyClassRec { - int sourceid; - CARD8 down[DOWN_LENGTH]; - CARD8 postdown[DOWN_LENGTH]; - int modifierKeyCount[8]; - struct _XkbSrvInfo *xkbInfo; -} KeyClassRec, *KeyClassPtr; - -typedef struct _AxisInfo { - int resolution; - int min_resolution; - int max_resolution; - int min_value; - int max_value; - Atom label; - CARD8 mode; -} AxisInfo, *AxisInfoPtr; - -typedef struct _ValuatorAccelerationRec { - int number; - PointerAccelSchemeProc AccelSchemeProc; - void *accelData; /* at disposal of AccelScheme */ - DeviceCallbackProc AccelCleanupProc; -} ValuatorAccelerationRec, *ValuatorAccelerationPtr; - -typedef struct _ValuatorClassRec { - int sourceid; - int numMotionEvents; - int first_motion; - int last_motion; - void *motion; /* motion history buffer. Different layout - for MDs and SDs!*/ - WindowPtr motionHintWindow; - - AxisInfoPtr axes; - unsigned short numAxes; - double *axisVal; /* always absolute, but device-coord system */ - ValuatorAccelerationRec accelScheme; -} ValuatorClassRec, *ValuatorClassPtr; - -typedef struct _ButtonClassRec { - int sourceid; - CARD8 numButtons; - CARD8 buttonsDown; /* number of buttons currently down - This counts logical buttons, not - physical ones, i.e if some buttons - are mapped to 0, they're not counted - here */ - unsigned short state; - Mask motionMask; - CARD8 down[DOWN_LENGTH]; - CARD8 postdown[DOWN_LENGTH]; - CARD8 map[MAP_LENGTH]; - union _XkbAction *xkb_acts; - Atom labels[MAX_BUTTONS]; -} ButtonClassRec, *ButtonClassPtr; - -typedef struct _FocusClassRec { - int sourceid; - WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */ - int revert; - TimeStamp time; - WindowPtr *trace; - int traceSize; - int traceGood; -} FocusClassRec, *FocusClassPtr; - -typedef struct _ProximityClassRec { - int sourceid; - char in_proximity; -} ProximityClassRec, *ProximityClassPtr; - -typedef struct _AbsoluteClassRec { - int sourceid; - /* Calibration. */ - int min_x; - int max_x; - int min_y; - int max_y; - int flip_x; - int flip_y; - int rotation; - int button_threshold; - - /* Area. */ - int offset_x; - int offset_y; - int width; - int height; - int screen; - XID following; -} AbsoluteClassRec, *AbsoluteClassPtr; - -typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr; -typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr; -typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr; -typedef struct _StringFeedbackClassRec *StringFeedbackPtr; -typedef struct _BellFeedbackClassRec *BellFeedbackPtr; -typedef struct _LedFeedbackClassRec *LedFeedbackPtr; - -typedef struct _KbdFeedbackClassRec { - BellProcPtr BellProc; - KbdCtrlProcPtr CtrlProc; - KeybdCtrl ctrl; - KbdFeedbackPtr next; - struct _XkbSrvLedInfo *xkb_sli; -} KbdFeedbackClassRec; - -typedef struct _PtrFeedbackClassRec { - PtrCtrlProcPtr CtrlProc; - PtrCtrl ctrl; - PtrFeedbackPtr next; -} PtrFeedbackClassRec; - -typedef struct _IntegerFeedbackClassRec { - IntegerCtrlProcPtr CtrlProc; - IntegerCtrl ctrl; - IntegerFeedbackPtr next; -} IntegerFeedbackClassRec; - -typedef struct _StringFeedbackClassRec { - StringCtrlProcPtr CtrlProc; - StringCtrl ctrl; - StringFeedbackPtr next; -} StringFeedbackClassRec; - -typedef struct _BellFeedbackClassRec { - BellProcPtr BellProc; - BellCtrlProcPtr CtrlProc; - BellCtrl ctrl; - BellFeedbackPtr next; -} BellFeedbackClassRec; - -typedef struct _LedFeedbackClassRec { - LedCtrlProcPtr CtrlProc; - LedCtrl ctrl; - LedFeedbackPtr next; - struct _XkbSrvLedInfo *xkb_sli; -} LedFeedbackClassRec; - - -typedef struct _ClassesRec { - KeyClassPtr key; - ValuatorClassPtr valuator; - ButtonClassPtr button; - FocusClassPtr focus; - ProximityClassPtr proximity; - AbsoluteClassPtr absolute; - KbdFeedbackPtr kbdfeed; - PtrFeedbackPtr ptrfeed; - IntegerFeedbackPtr intfeed; - StringFeedbackPtr stringfeed; - BellFeedbackPtr bell; - LedFeedbackPtr leds; -} ClassesRec; - - -/** - * Sprite information for a device. - */ -typedef struct { - CursorPtr current; - BoxRec hotLimits; /* logical constraints of hot spot */ - Bool confined; /* confined to screen */ - RegionPtr hotShape; /* additional logical shape constraint */ - BoxRec physLimits; /* physical constraints of hot spot */ - WindowPtr win; /* window of logical position */ - HotSpot hot; /* logical pointer position */ - HotSpot hotPhys; /* physical pointer position */ -#ifdef PANORAMIX - ScreenPtr screen; /* all others are in Screen 0 coordinates */ - RegionRec Reg1; /* Region 1 for confining motion */ - RegionRec Reg2; /* Region 2 for confining virtual motion */ - WindowPtr windows[MAXSCREENS]; - WindowPtr confineWin; /* confine window */ -#endif - /* The window trace information is used at dix/events.c to avoid having - * to compute all the windows between the root and the current pointer - * window each time a button or key goes down. The grabs on each of those - * windows must be checked. - * spriteTraces should only be used at dix/events.c! */ - WindowPtr *spriteTrace; - int spriteTraceSize; - int spriteTraceGood; - - /* Due to delays between event generation and event processing, it is - * possible that the pointer has crossed screen boundaries between the - * time in which it begins generating events and the time when - * those events are processed. - * - * pEnqueueScreen: screen the pointer was on when the event was generated - * pDequeueScreen: screen the pointer was on when the event is processed - */ - ScreenPtr pEnqueueScreen; - ScreenPtr pDequeueScreen; - -} SpriteRec, *SpritePtr; - -/* Device properties */ -typedef struct _XIPropertyValue -{ - Atom type; /* ignored by server */ - short format; /* format of data for swapping - 8,16,32 */ - long size; /* size of data in (format/8) bytes */ - pointer data; /* private to client */ -} XIPropertyValueRec; - -typedef struct _XIProperty -{ - struct _XIProperty *next; - Atom propertyName; - BOOL deletable; /* clients can delete this prop? */ - XIPropertyValueRec value; -} XIPropertyRec; - -typedef XIPropertyRec *XIPropertyPtr; -typedef XIPropertyValueRec *XIPropertyValuePtr; - - -typedef struct _XIPropertyHandler -{ - struct _XIPropertyHandler* next; - long id; - int (*SetProperty) (DeviceIntPtr dev, - Atom property, - XIPropertyValuePtr prop, - BOOL checkonly); - int (*GetProperty) (DeviceIntPtr dev, - Atom property); - int (*DeleteProperty) (DeviceIntPtr dev, - Atom property); -} XIPropertyHandler, *XIPropertyHandlerPtr; - -/* states for devices */ - -#define NOT_GRABBED 0 -#define THAWED 1 -#define THAWED_BOTH 2 /* not a real state */ -#define FREEZE_NEXT_EVENT 3 -#define FREEZE_BOTH_NEXT_EVENT 4 -#define FROZEN 5 /* any state >= has device frozen */ -#define FROZEN_NO_EVENT 5 -#define FROZEN_WITH_EVENT 6 -#define THAW_OTHERS 7 - - -typedef struct _GrabInfoRec { - TimeStamp grabTime; - Bool fromPassiveGrab; /* true if from passive grab */ - Bool implicitGrab; /* implicit from ButtonPress */ - GrabRec activeGrab; - GrabPtr grab; - CARD8 activatingKey; - void (*ActivateGrab) ( - DeviceIntPtr /*device*/, - GrabPtr /*grab*/, - TimeStamp /*time*/, - Bool /*autoGrab*/); - void (*DeactivateGrab)( - DeviceIntPtr /*device*/); - struct { - Bool frozen; - int state; - GrabPtr other; /* if other grab has this frozen */ - DeviceEvent *event; /* saved to be replayed */ - } sync; -} GrabInfoRec, *GrabInfoPtr; - -typedef struct _SpriteInfoRec { - /* sprite must always point to a valid sprite. For devices sharing the - * sprite, let sprite point to a paired spriteOwner's sprite. */ - SpritePtr sprite; /* sprite information */ - Bool spriteOwner; /* True if device owns the sprite */ - DeviceIntPtr paired; /* The paired device. Keyboard if - spriteOwner is TRUE, otherwise the - pointer that owns the sprite. */ - - /* keep states for animated cursor */ - struct { - CursorPtr pCursor; - ScreenPtr pScreen; - int elt; - CARD32 time; - } anim; -} SpriteInfoRec, *SpriteInfoPtr; - -/* device types */ -#define MASTER_POINTER 1 -#define MASTER_KEYBOARD 2 -#define SLAVE 3 - -typedef struct _DeviceIntRec { - DeviceRec public; - DeviceIntPtr next; - Bool startup; /* true if needs to be turned on at - server intialization time */ - DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is - used to initialize, turn on, or - turn off the device */ - Bool inited; /* TRUE if INIT returns Success */ - Bool enabled; /* TRUE if ON returns Success */ - Bool coreEvents; /* TRUE if device also sends core */ - GrabInfoRec deviceGrab; /* grab on the device */ - int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */ - Atom xinput_type; - char *name; - int id; - KeyClassPtr key; - ValuatorClassPtr valuator; - ButtonClassPtr button; - FocusClassPtr focus; - ProximityClassPtr proximity; - AbsoluteClassPtr absolute; - KbdFeedbackPtr kbdfeed; - PtrFeedbackPtr ptrfeed; - IntegerFeedbackPtr intfeed; - StringFeedbackPtr stringfeed; - BellFeedbackPtr bell; - LedFeedbackPtr leds; - struct _XkbInterest *xkb_interest; - char *config_info; /* used by the hotplug layer */ - ClassesPtr unused_classes; /* for master devices */ - int saved_master_id; /* for slaves while grabbed */ - PrivateRec *devPrivates; - DeviceUnwrapProc unwrapProc; - SpriteInfoPtr spriteInfo; - union { - DeviceIntPtr master; /* master device */ - DeviceIntPtr lastSlave; /* last slave device used */ - } u; - - /* last valuator values recorded, not posted to client; - * for slave devices, valuators is in device coordinates - * for master devices, valuators is in screen coordinates - * see dix/getevents.c - * remainder supports acceleration - */ - struct { - int valuators[MAX_VALUATORS]; - float remainder[MAX_VALUATORS]; - int numValuators; - DeviceIntPtr slave; - } last; - - /* Input device property handling. */ - struct { - XIPropertyPtr properties; - XIPropertyHandlerPtr handlers; /* NULL-terminated */ - } properties; - - /* coordinate transformation matrix for absolute input devices */ - struct pixman_f_transform transform; - - /* XTest related master device id */ - int xtest_master_id; -} DeviceIntRec; - -typedef struct { - int numDevices; /* total number of devices */ - DeviceIntPtr devices; /* all devices turned on */ - DeviceIntPtr off_devices; /* all devices turned off */ - DeviceIntPtr keyboard; /* the main one for the server */ - DeviceIntPtr pointer; - DeviceIntPtr all_devices; - DeviceIntPtr all_master_devices; -} InputInfo; - -extern _X_EXPORT InputInfo inputInfo; - -/* for keeping the events for devices grabbed synchronously */ -typedef struct _QdEvent *QdEventPtr; -typedef struct _QdEvent { - QdEventPtr next; - DeviceIntPtr device; - ScreenPtr pScreen; /* what screen the pointer was on */ - unsigned long months; /* milliseconds is in the event */ - InternalEvent *event; -} QdEventRec; - -/** - * syncEvents is the global structure for queued events. - * - * Devices can be frozen through GrabModeSync pointer grabs. If this is the - * case, events from these devices are added to "pending" instead of being - * processed normally. When the device is unfrozen, events in "pending" are - * replayed and processed as if they would come from the device directly. - */ -typedef struct _EventSyncInfo { - QdEventPtr pending, /**< list of queued events */ - *pendtail; /**< last event in list */ - /** The device to replay events for. Only set in AllowEvents(), in which - * case it is set to the device specified in the request. */ - DeviceIntPtr replayDev; /* kludgy rock to put flag for */ - - /** - * The window the events are supposed to be replayed on. - * This window may be set to the grab's window (but only when - * Replay{Pointer|Keyboard} is given in the XAllowEvents() - * request. */ - WindowPtr replayWin; /* ComputeFreezes */ - /** - * Flag to indicate whether we're in the process of - * replaying events. Only set in ComputeFreezes(). */ - Bool playingEvents; - TimeStamp time; -} EventSyncInfoRec, *EventSyncInfoPtr; - -extern EventSyncInfoRec syncEvents; - -#endif /* INPUTSTRUCT_H */ +/************************************************************ + +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. + +********************************************************/ + + +#ifndef INPUTSTRUCT_H +#define INPUTSTRUCT_H + +#include +#include "input.h" +#include "window.h" +#include "dixstruct.h" +#include "cursorstr.h" +#include "geext.h" +#include "privates.h" + +#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) +#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) +#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) +extern _X_EXPORT int CountBits(const uint8_t *mask, int len); + +#define SameClient(obj,client) \ + (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) + +#define EMASKSIZE MAXDEVICES + 2 + +/* This is the last XI2 event supported by the server. If you add + * events to the protocol, the server will not support these events until + * this number here is bumped. + */ +#define XI2LASTEVENT 17 /* XI_RawMotion */ +#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */ + +/** + * This struct stores the core event mask for each client except the client + * that created the window. + * + * Each window that has events selected from other clients has at least one of + * these masks. If multiple clients selected for events on the same window, + * these masks are in a linked list. + * + * The event mask for the client that created the window is stored in + * win->eventMask instead. + * + * The resource id is simply a fake client ID to associate this mask with a + * client. + * + * Kludge: OtherClients and InputClients must be compatible, see code. + */ +typedef struct _OtherClients { + OtherClientsPtr next; /**< Pointer to the next mask */ + XID resource; /**< id for putting into resource manager */ + Mask mask; /**< Core event mask */ +} OtherClients; + +/** + * This struct stores the XI event mask for each client. + * + * Each window that has events selected has at least one of these masks. If + * multiple client selected for events on the same window, these masks are in + * a linked list. + */ +typedef struct _InputClients { + InputClientsPtr next; /**< Pointer to the next mask */ + XID resource; /**< id for putting into resource manager */ + Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */ + /** XI2 event masks. One per device, each bit is a mask of (1 << type) */ + unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; +} InputClients; + +/** + * Combined XI event masks from all devices. + * + * This is the XI equivalent of the deliverableEvents, eventMask and + * dontPropagate mask of the WindowRec (or WindowOptRec). + * + * A window that has an XI client selecting for events has exactly one + * OtherInputMasks struct and exactly one InputClients struct hanging off + * inputClients. Each further client appends to the inputClients list. + * Each Mask field is per-device, with the device id as the index. + * Exception: for non-device events (Presence events), the MAXDEVICES + * deviceid is used. + */ +typedef struct _OtherInputMasks { + /** + * Bitwise OR of all masks by all clients and the window's parent's masks. + */ + Mask deliverableEvents[EMASKSIZE]; + /** + * Bitwise OR of all masks by all clients on this window. + */ + Mask inputEvents[EMASKSIZE]; + /** The do-not-propagate masks for each device. */ + Mask dontPropagateMask[EMASKSIZE]; + /** The clients that selected for events */ + InputClientsPtr inputClients; + /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ + unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; +} OtherInputMasks; + +/* + * The following structure gets used for both active and passive grabs. For + * active grabs some of the fields (e.g. modifiers) are not used. However, + * that is not much waste since there aren't many active grabs (one per + * keyboard/pointer device) going at once in the server. + */ + +#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible + modifier combinations, but only + 3 buttons. */ + +typedef struct _DetailRec { /* Grab details may be bit masks */ + unsigned int exact; + Mask *pMask; +} DetailRec; + +typedef enum { + GRABTYPE_CORE, + GRABTYPE_XI, + GRABTYPE_XI2 +} GrabType; + +union _GrabMask { + Mask core; + Mask xi; + char xi2mask[EMASKSIZE][XI2MASKSIZE]; +}; + +/** + * Central struct for device grabs. + * The same struct is used for both core grabs and device grabs, with + * different fields being set. + * If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask + * is a combination of standard event masks (i.e. PointerMotionMask | + * ButtonPressMask). + * If the grab is a device grab (GrabDevice), then the eventMask is a + * combination of event masks for a given XI event type (see SetEventInfo). + * + * If the grab is a result of a ButtonPress, then eventMask is the core mask + * and deviceMask is set to the XI event mask for the grab. + */ +typedef struct _GrabRec { + GrabPtr next; /* for chain of passive grabs */ + XID resource; + DeviceIntPtr device; + WindowPtr window; + unsigned ownerEvents:1; + unsigned keyboardMode:1; + unsigned pointerMode:1; + GrabType grabtype; + CARD8 type; /* event type */ + DetailRec modifiersDetail; + DeviceIntPtr modifierDevice; + DetailRec detail; /* key or button */ + WindowPtr confineTo; /* always NULL for keyboards */ + CursorPtr cursor; /* always NULL for keyboards */ + Mask eventMask; + Mask deviceMask; + /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ + unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; +} GrabRec; + +/** + * Sprite information for a device. + */ +typedef struct _SpriteRec { + CursorPtr current; + BoxRec hotLimits; /* logical constraints of hot spot */ + Bool confined; /* confined to screen */ + RegionPtr hotShape; /* additional logical shape constraint */ + BoxRec physLimits; /* physical constraints of hot spot */ + WindowPtr win; /* window of logical position */ + HotSpot hot; /* logical pointer position */ + HotSpot hotPhys; /* physical pointer position */ +#ifdef PANORAMIX + ScreenPtr screen; /* all others are in Screen 0 coordinates */ + RegionRec Reg1; /* Region 1 for confining motion */ + RegionRec Reg2; /* Region 2 for confining virtual motion */ + WindowPtr windows[MAXSCREENS]; + WindowPtr confineWin; /* confine window */ +#endif + /* The window trace information is used at dix/events.c to avoid having + * to compute all the windows between the root and the current pointer + * window each time a button or key goes down. The grabs on each of those + * windows must be checked. + * spriteTraces should only be used at dix/events.c! */ + WindowPtr *spriteTrace; + int spriteTraceSize; + int spriteTraceGood; + + /* Due to delays between event generation and event processing, it is + * possible that the pointer has crossed screen boundaries between the + * time in which it begins generating events and the time when + * those events are processed. + * + * pEnqueueScreen: screen the pointer was on when the event was generated + * pDequeueScreen: screen the pointer was on when the event is processed + */ + ScreenPtr pEnqueueScreen; + ScreenPtr pDequeueScreen; + +} SpriteRec; + +typedef struct _KeyClassRec { + int sourceid; + CARD8 down[DOWN_LENGTH]; + CARD8 postdown[DOWN_LENGTH]; + int modifierKeyCount[8]; + struct _XkbSrvInfo *xkbInfo; +} KeyClassRec, *KeyClassPtr; + +typedef struct _AxisInfo { + int resolution; + int min_resolution; + int max_resolution; + int min_value; + int max_value; + Atom label; + CARD8 mode; +} AxisInfo, *AxisInfoPtr; + +typedef struct _ValuatorAccelerationRec { + int number; + PointerAccelSchemeProc AccelSchemeProc; + void *accelData; /* at disposal of AccelScheme */ + DeviceCallbackProc AccelCleanupProc; +} ValuatorAccelerationRec, *ValuatorAccelerationPtr; + +typedef struct _ValuatorClassRec { + int sourceid; + int numMotionEvents; + int first_motion; + int last_motion; + void *motion; /* motion history buffer. Different layout + for MDs and SDs!*/ + WindowPtr motionHintWindow; + + AxisInfoPtr axes; + unsigned short numAxes; + double *axisVal; /* always absolute, but device-coord system */ + ValuatorAccelerationRec accelScheme; +} ValuatorClassRec, *ValuatorClassPtr; + +typedef struct _ButtonClassRec { + int sourceid; + CARD8 numButtons; + CARD8 buttonsDown; /* number of buttons currently down + This counts logical buttons, not + physical ones, i.e if some buttons + are mapped to 0, they're not counted + here */ + unsigned short state; + Mask motionMask; + CARD8 down[DOWN_LENGTH]; + CARD8 postdown[DOWN_LENGTH]; + CARD8 map[MAP_LENGTH]; + union _XkbAction *xkb_acts; + Atom labels[MAX_BUTTONS]; +} ButtonClassRec, *ButtonClassPtr; + +typedef struct _FocusClassRec { + int sourceid; + WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */ + int revert; + TimeStamp time; + WindowPtr *trace; + int traceSize; + int traceGood; +} FocusClassRec, *FocusClassPtr; + +typedef struct _ProximityClassRec { + int sourceid; + char in_proximity; +} ProximityClassRec, *ProximityClassPtr; + +typedef struct _AbsoluteClassRec { + int sourceid; + /* Calibration. */ + int min_x; + int max_x; + int min_y; + int max_y; + int flip_x; + int flip_y; + int rotation; + int button_threshold; + + /* Area. */ + int offset_x; + int offset_y; + int width; + int height; + int screen; + XID following; +} AbsoluteClassRec, *AbsoluteClassPtr; + +typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr; +typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr; +typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr; +typedef struct _StringFeedbackClassRec *StringFeedbackPtr; +typedef struct _BellFeedbackClassRec *BellFeedbackPtr; +typedef struct _LedFeedbackClassRec *LedFeedbackPtr; + +typedef struct _KbdFeedbackClassRec { + BellProcPtr BellProc; + KbdCtrlProcPtr CtrlProc; + KeybdCtrl ctrl; + KbdFeedbackPtr next; + struct _XkbSrvLedInfo *xkb_sli; +} KbdFeedbackClassRec; + +typedef struct _PtrFeedbackClassRec { + PtrCtrlProcPtr CtrlProc; + PtrCtrl ctrl; + PtrFeedbackPtr next; +} PtrFeedbackClassRec; + +typedef struct _IntegerFeedbackClassRec { + IntegerCtrlProcPtr CtrlProc; + IntegerCtrl ctrl; + IntegerFeedbackPtr next; +} IntegerFeedbackClassRec; + +typedef struct _StringFeedbackClassRec { + StringCtrlProcPtr CtrlProc; + StringCtrl ctrl; + StringFeedbackPtr next; +} StringFeedbackClassRec; + +typedef struct _BellFeedbackClassRec { + BellProcPtr BellProc; + BellCtrlProcPtr CtrlProc; + BellCtrl ctrl; + BellFeedbackPtr next; +} BellFeedbackClassRec; + +typedef struct _LedFeedbackClassRec { + LedCtrlProcPtr CtrlProc; + LedCtrl ctrl; + LedFeedbackPtr next; + struct _XkbSrvLedInfo *xkb_sli; +} LedFeedbackClassRec; + + +typedef struct _ClassesRec { + KeyClassPtr key; + ValuatorClassPtr valuator; + ButtonClassPtr button; + FocusClassPtr focus; + ProximityClassPtr proximity; + AbsoluteClassPtr absolute; + KbdFeedbackPtr kbdfeed; + PtrFeedbackPtr ptrfeed; + IntegerFeedbackPtr intfeed; + StringFeedbackPtr stringfeed; + BellFeedbackPtr bell; + LedFeedbackPtr leds; +} ClassesRec; + + +/* Device properties */ +typedef struct _XIPropertyValue +{ + Atom type; /* ignored by server */ + short format; /* format of data for swapping - 8,16,32 */ + long size; /* size of data in (format/8) bytes */ + pointer data; /* private to client */ +} XIPropertyValueRec; + +typedef struct _XIProperty +{ + struct _XIProperty *next; + Atom propertyName; + BOOL deletable; /* clients can delete this prop? */ + XIPropertyValueRec value; +} XIPropertyRec; + +typedef XIPropertyRec *XIPropertyPtr; +typedef XIPropertyValueRec *XIPropertyValuePtr; + + +typedef struct _XIPropertyHandler +{ + struct _XIPropertyHandler* next; + long id; + int (*SetProperty) (DeviceIntPtr dev, + Atom property, + XIPropertyValuePtr prop, + BOOL checkonly); + int (*GetProperty) (DeviceIntPtr dev, + Atom property); + int (*DeleteProperty) (DeviceIntPtr dev, + Atom property); +} XIPropertyHandler, *XIPropertyHandlerPtr; + +/* states for devices */ + +#define NOT_GRABBED 0 +#define THAWED 1 +#define THAWED_BOTH 2 /* not a real state */ +#define FREEZE_NEXT_EVENT 3 +#define FREEZE_BOTH_NEXT_EVENT 4 +#define FROZEN 5 /* any state >= has device frozen */ +#define FROZEN_NO_EVENT 5 +#define FROZEN_WITH_EVENT 6 +#define THAW_OTHERS 7 + + +typedef struct _GrabInfoRec { + TimeStamp grabTime; + Bool fromPassiveGrab; /* true if from passive grab */ + Bool implicitGrab; /* implicit from ButtonPress */ + GrabRec activeGrab; + GrabPtr grab; + CARD8 activatingKey; + void (*ActivateGrab) ( + DeviceIntPtr /*device*/, + GrabPtr /*grab*/, + TimeStamp /*time*/, + Bool /*autoGrab*/); + void (*DeactivateGrab)( + DeviceIntPtr /*device*/); + struct { + Bool frozen; + int state; + GrabPtr other; /* if other grab has this frozen */ + DeviceEvent *event; /* saved to be replayed */ + } sync; +} GrabInfoRec, *GrabInfoPtr; + +typedef struct _SpriteInfoRec { + /* sprite must always point to a valid sprite. For devices sharing the + * sprite, let sprite point to a paired spriteOwner's sprite. */ + SpritePtr sprite; /* sprite information */ + Bool spriteOwner; /* True if device owns the sprite */ + DeviceIntPtr paired; /* The paired device. Keyboard if + spriteOwner is TRUE, otherwise the + pointer that owns the sprite. */ + + /* keep states for animated cursor */ + struct { + CursorPtr pCursor; + ScreenPtr pScreen; + int elt; + CARD32 time; + } anim; +} SpriteInfoRec, *SpriteInfoPtr; + +/* device types */ +#define MASTER_POINTER 1 +#define MASTER_KEYBOARD 2 +#define SLAVE 3 + +typedef struct _DeviceIntRec { + DeviceRec public; + DeviceIntPtr next; + Bool startup; /* true if needs to be turned on at + server intialization time */ + DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is + used to initialize, turn on, or + turn off the device */ + Bool inited; /* TRUE if INIT returns Success */ + Bool enabled; /* TRUE if ON returns Success */ + Bool coreEvents; /* TRUE if device also sends core */ + GrabInfoRec deviceGrab; /* grab on the device */ + int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */ + Atom xinput_type; + char *name; + int id; + KeyClassPtr key; + ValuatorClassPtr valuator; + ButtonClassPtr button; + FocusClassPtr focus; + ProximityClassPtr proximity; + AbsoluteClassPtr absolute; + KbdFeedbackPtr kbdfeed; + PtrFeedbackPtr ptrfeed; + IntegerFeedbackPtr intfeed; + StringFeedbackPtr stringfeed; + BellFeedbackPtr bell; + LedFeedbackPtr leds; + struct _XkbInterest *xkb_interest; + char *config_info; /* used by the hotplug layer */ + ClassesPtr unused_classes; /* for master devices */ + int saved_master_id; /* for slaves while grabbed */ + PrivateRec *devPrivates; + DeviceUnwrapProc unwrapProc; + SpriteInfoPtr spriteInfo; + union { + DeviceIntPtr master; /* master device */ + DeviceIntPtr lastSlave; /* last slave device used */ + } u; + + /* last valuator values recorded, not posted to client; + * for slave devices, valuators is in device coordinates + * for master devices, valuators is in screen coordinates + * see dix/getevents.c + * remainder supports acceleration + */ + struct { + int valuators[MAX_VALUATORS]; + float remainder[MAX_VALUATORS]; + int numValuators; + DeviceIntPtr slave; + } last; + + /* Input device property handling. */ + struct { + XIPropertyPtr properties; + XIPropertyHandlerPtr handlers; /* NULL-terminated */ + } properties; + + /* coordinate transformation matrix for absolute input devices */ + struct pixman_f_transform transform; + + /* XTest related master device id */ + int xtest_master_id; +} DeviceIntRec; + +typedef struct { + int numDevices; /* total number of devices */ + DeviceIntPtr devices; /* all devices turned on */ + DeviceIntPtr off_devices; /* all devices turned off */ + DeviceIntPtr keyboard; /* the main one for the server */ + DeviceIntPtr pointer; + DeviceIntPtr all_devices; + DeviceIntPtr all_master_devices; +} InputInfo; + +extern _X_EXPORT InputInfo inputInfo; + +/* for keeping the events for devices grabbed synchronously */ +typedef struct _QdEvent *QdEventPtr; +typedef struct _QdEvent { + QdEventPtr next; + DeviceIntPtr device; + ScreenPtr pScreen; /* what screen the pointer was on */ + unsigned long months; /* milliseconds is in the event */ + InternalEvent *event; +} QdEventRec; + +/** + * syncEvents is the global structure for queued events. + * + * Devices can be frozen through GrabModeSync pointer grabs. If this is the + * case, events from these devices are added to "pending" instead of being + * processed normally. When the device is unfrozen, events in "pending" are + * replayed and processed as if they would come from the device directly. + */ +typedef struct _EventSyncInfo { + QdEventPtr pending, /**< list of queued events */ + *pendtail; /**< last event in list */ + /** The device to replay events for. Only set in AllowEvents(), in which + * case it is set to the device specified in the request. */ + DeviceIntPtr replayDev; /* kludgy rock to put flag for */ + + /** + * The window the events are supposed to be replayed on. + * This window may be set to the grab's window (but only when + * Replay{Pointer|Keyboard} is given in the XAllowEvents() + * request. */ + WindowPtr replayWin; /* ComputeFreezes */ + /** + * Flag to indicate whether we're in the process of + * replaying events. Only set in ComputeFreezes(). */ + Bool playingEvents; + TimeStamp time; +} EventSyncInfoRec, *EventSyncInfoPtr; + +extern EventSyncInfoRec syncEvents; + +#endif /* INPUTSTRUCT_H */ diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c index a7441c9a8..4499f377c 100644 --- a/xorg-server/mi/miinitext.c +++ b/xorg-server/mi/miinitext.c @@ -389,9 +389,7 @@ InitExtensions(int argc, char *argv[]) if (!noGEExtension) GEExtensionInit(); #ifdef PANORAMIX -# if !defined(NO_PANORAMIX) if (!noPanoramiXExtension) PanoramiXExtensionInit(); -# endif #endif #ifdef INXQUARTZ if(!noPseudoramiXExtension) PseudoramiXExtensionInit(); diff --git a/xorg-server/os/WaitFor.c b/xorg-server/os/WaitFor.c index ac4b58e48..867cb04b8 100644 --- a/xorg-server/os/WaitFor.c +++ b/xorg-server/os/WaitFor.c @@ -1,681 +1,687 @@ -/*********************************************************** - -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. - -******************************************************************/ - - -/***************************************************************** - * OS Dependent input routines: - * - * WaitForSomething - * TimerForce, TimerSet, TimerCheck, TimerFree - * - *****************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifdef WIN32 -#include -#endif -#include /* for strings, fcntl, time */ -#include -#include -#include -#include "misc.h" - -#include "osdep.h" -#include -#include "dixstruct.h" -#include "opaque.h" -#ifdef DPMSExtension -#include "dpmsproc.h" -#endif - -#ifdef WIN32 -/* Error codes from windows sockets differ from fileio error codes */ -#undef EINTR -#define EINTR WSAEINTR -#undef EINVAL -#define EINVAL WSAEINVAL -#undef EBADF -#define EBADF WSAENOTSOCK -/* Windows select does not set errno. Use GetErrno as wrapper for - WSAGetLastError */ -#define GetErrno WSAGetLastError -#else -/* This is just a fallback to errno to hide the differences between unix and - Windows in the code */ -#define GetErrno() errno -#endif - -/* like ffs, but uses fd_mask instead of int as argument, so it works - when fd_mask is longer than an int, such as common 64-bit platforms */ -/* modifications by raphael */ -int -mffs(fd_mask mask) -{ - int i; - - if (!mask) return 0; - i = 1; - while (!(mask & 1)) - { - i++; - mask >>= 1; - } - return i; -} - -#ifdef DPMSExtension -#include -#endif - -struct _OsTimerRec { - OsTimerPtr next; - CARD32 expires; - CARD32 delta; - OsTimerCallback callback; - pointer arg; -}; - -static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); -static void CheckAllTimers(void); -static OsTimerPtr timers = NULL; - -/***************** - * WaitForSomething: - * Make the server suspend until there is - * 1. data from clients or - * 2. input events available or - * 3. ddx notices something of interest (graphics - * queue ready, etc.) or - * 4. clients that have buffered replies/events are ready - * - * If the time between INPUT events is - * greater than ScreenSaverTime, the display is turned off (or - * saved, depending on the hardware). So, WaitForSomething() - * has to handle this also (that's why the select() has a timeout. - * For more info on ClientsWithInput, see ReadRequestFromClient(). - * pClientsReady is an array to store ready client->index values into. - *****************/ - -int -WaitForSomething(int *pClientsReady) -{ - int i; - struct timeval waittime, *wt; - INT32 timeout = 0; - fd_set clientsReadable; - fd_set clientsWritable; - int curclient; - int selecterr; - int nready; - fd_set devicesReadable; - CARD32 now = 0; - Bool someReady = FALSE; - - FD_ZERO(&clientsReadable); - - /* We need a while loop here to handle - crashed connections and the screen saver timeout */ - while (1) - { - /* deal with any blocked jobs */ - if (workQueue) - ProcessWorkQueue(); - if (XFD_ANYSET (&ClientsWithInput)) - { - if (!SmartScheduleDisable) - { - someReady = TRUE; - waittime.tv_sec = 0; - waittime.tv_usec = 0; - wt = &waittime; - } - else - { - XFD_COPYSET (&ClientsWithInput, &clientsReadable); - break; - } - } - if (someReady) - { - XFD_COPYSET(&AllSockets, &LastSelectMask); - XFD_UNSET(&LastSelectMask, &ClientsWithInput); - } - else - { - wt = NULL; - if (timers) - { - now = GetTimeInMillis(); - timeout = timers->expires - now; - if (timeout > 0 && timeout > timers->delta + 250) { - /* time has rewound. reset the timers. */ - CheckAllTimers(); - } - - if (timers) { - timeout = timers->expires - now; - if (timeout < 0) - timeout = 0; - waittime.tv_sec = timeout / MILLI_PER_SECOND; - waittime.tv_usec = (timeout % MILLI_PER_SECOND) * - (1000000 / MILLI_PER_SECOND); - wt = &waittime; - } - } - XFD_COPYSET(&AllSockets, &LastSelectMask); - } - SmartScheduleStopTimer (); - - BlockHandler((pointer)&wt, (pointer)&LastSelectMask); - if (NewOutputPending) - FlushAllOutput(); - /* keep this check close to select() call to minimize race */ - if (dispatchException) - i = -1; - else if (AnyClientsWriteBlocked) - { - XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable); - i = Select (MaxClients, &LastSelectMask, &clientsWritable, NULL, wt); - } - else - { - i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt); - } - selecterr = GetErrno(); - WakeupHandler(i, (pointer)&LastSelectMask); - SmartScheduleStartTimer (); - if (i <= 0) /* An error or timeout occurred */ - { - if (dispatchException) - return 0; - if (i < 0) - { - if (selecterr == EBADF) /* Some client disconnected */ - { - CheckConnections (); - if (! XFD_ANYSET (&AllClients)) - return 0; - } - else if (selecterr == EINVAL) - { - FatalError("WaitForSomething(): select: %s\n", - strerror(selecterr)); - } - else if (selecterr != EINTR && selecterr != EAGAIN) - { - ErrorF("WaitForSomething(): select: %s\n", - strerror(selecterr)); - } - } - else if (someReady) - { - /* - * If no-one else is home, bail quickly - */ - XFD_COPYSET(&ClientsWithInput, &LastSelectMask); - XFD_COPYSET(&ClientsWithInput, &clientsReadable); - break; - } - if (*checkForInput[0] != *checkForInput[1]) - return 0; - - if (timers) - { - int expired = 0; - now = GetTimeInMillis(); - if ((int) (timers->expires - now) <= 0) - expired = 1; - - while (timers && (int) (timers->expires - now) <= 0) - DoTimer(timers, now, &timers); - - if (expired) - return 0; - } - } - else - { - fd_set tmp_set; - - if (*checkForInput[0] == *checkForInput[1]) { - if (timers) - { - int expired = 0; - now = GetTimeInMillis(); - if ((int) (timers->expires - now) <= 0) - expired = 1; - - while (timers && (int) (timers->expires - now) <= 0) - DoTimer(timers, now, &timers); - - if (expired) - return 0; - } - } - if (someReady) - XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask); - if (AnyClientsWriteBlocked && XFD_ANYSET (&clientsWritable)) - { - NewOutputPending = TRUE; - XFD_ORSET(&OutputPending, &clientsWritable, &OutputPending); - XFD_UNSET(&ClientsWriteBlocked, &clientsWritable); - if (! XFD_ANYSET(&ClientsWriteBlocked)) - AnyClientsWriteBlocked = FALSE; - } - - XFD_ANDSET(&devicesReadable, &LastSelectMask, &EnabledDevices); - XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients); - XFD_ANDSET(&tmp_set, &LastSelectMask, &WellKnownConnections); - if (XFD_ANYSET(&tmp_set)) - QueueWorkProc(EstablishNewConnections, NULL, - (pointer)&LastSelectMask); - - if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable)) - break; - /* check here for DDXes that queue events during Block/Wakeup */ - if (*checkForInput[0] != *checkForInput[1]) - return 0; - } - } - - nready = 0; - if (XFD_ANYSET (&clientsReadable)) - { -#ifndef WIN32 - for (i=0; ipriority; - if (nready == 0 || client_priority > highest_priority) - { - /* Either we found the first client, or we found - * a client whose priority is greater than all others - * that have been found so far. Either way, we want - * to initialize the list of clients to contain just - * this client. - */ - pClientsReady[0] = client_index; - highest_priority = client_priority; - nready = 1; - } - /* the following if makes sure that multiple same-priority - * clients get batched together - */ - else if (client_priority == highest_priority) - { - pClientsReady[nready++] = client_index; - } -#ifndef WIN32 - clientsReadable.fds_bits[i] &= ~(((fd_mask)1L) << curclient); - } -#else - FD_CLR(curclient, &clientsReadable); -#endif - } - } - return nready; -} - -/* If time has rewound, re-run every affected timer. - * Timers might drop out of the list, so we have to restart every time. */ -static void -CheckAllTimers(void) -{ - OsTimerPtr timer; - CARD32 now; - -start: - now = GetTimeInMillis(); - - for (timer = timers; timer; timer = timer->next) { - if (timer->expires - now > timer->delta + 250) { - TimerForce(timer); - goto start; - } - } -} - -static void -DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev) -{ - CARD32 newTime; - - *prev = timer->next; - timer->next = NULL; - newTime = (*timer->callback)(timer, now, timer->arg); - if (newTime) - TimerSet(timer, 0, newTime, timer->callback, timer->arg); -} - -OsTimerPtr -TimerSet(OsTimerPtr timer, int flags, CARD32 millis, - OsTimerCallback func, pointer arg) -{ - register OsTimerPtr *prev; - CARD32 now = GetTimeInMillis(); - - if (!timer) - { - timer = malloc(sizeof(struct _OsTimerRec)); - if (!timer) - return NULL; - } - else - { - for (prev = &timers; *prev; prev = &(*prev)->next) - { - if (*prev == timer) - { - *prev = timer->next; - if (flags & TimerForceOld) - (void)(*timer->callback)(timer, now, timer->arg); - break; - } - } - } - if (!millis) - return timer; - if (flags & TimerAbsolute) { - timer->delta = millis - now; - } - else { - timer->delta = millis; - millis += now; - } - timer->expires = millis; - timer->callback = func; - timer->arg = arg; - if ((int) (millis - now) <= 0) - { - timer->next = NULL; - millis = (*timer->callback)(timer, now, timer->arg); - if (!millis) - return timer; - } - for (prev = &timers; - *prev && (int) ((*prev)->expires - millis) <= 0; - prev = &(*prev)->next) - ; - timer->next = *prev; - *prev = timer; - return timer; -} - -Bool -TimerForce(OsTimerPtr timer) -{ - OsTimerPtr *prev; - - for (prev = &timers; *prev; prev = &(*prev)->next) - { - if (*prev == timer) - { - DoTimer(timer, GetTimeInMillis(), prev); - return TRUE; - } - } - return FALSE; -} - - -void -TimerCancel(OsTimerPtr timer) -{ - OsTimerPtr *prev; - - if (!timer) - return; - for (prev = &timers; *prev; prev = &(*prev)->next) - { - if (*prev == timer) - { - *prev = timer->next; - break; - } - } -} - -void -TimerFree(OsTimerPtr timer) -{ - if (!timer) - return; - TimerCancel(timer); - free(timer); -} - -void -TimerCheck(void) -{ - CARD32 now = GetTimeInMillis(); - - while (timers && (int) (timers->expires - now) <= 0) - DoTimer(timers, now, &timers); -} - -void -TimerInit(void) -{ - OsTimerPtr timer; - - while ((timer = timers)) - { - timers = timer->next; - free(timer); - } -} - -#ifdef DPMSExtension - -#define DPMS_CHECK_MODE(mode,time)\ - if (time > 0 && DPMSPowerLevel < mode && timeout >= time)\ - DPMSSet(serverClient, mode); - -#define DPMS_CHECK_TIMEOUT(time)\ - if (time > 0 && (time - timeout) > 0)\ - return time - timeout; - -static CARD32 -NextDPMSTimeout(INT32 timeout) -{ - /* - * Return the amount of time remaining until we should set - * the next power level. Fallthroughs are intentional. - */ - switch (DPMSPowerLevel) - { - case DPMSModeOn: - DPMS_CHECK_TIMEOUT(DPMSStandbyTime) - - case DPMSModeStandby: - DPMS_CHECK_TIMEOUT(DPMSSuspendTime) - - case DPMSModeSuspend: - DPMS_CHECK_TIMEOUT(DPMSOffTime) - - default: /* DPMSModeOff */ - return 0; - } -} -#endif /* DPMSExtension */ - -static CARD32 -ScreenSaverTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg) -{ - INT32 timeout = now - lastDeviceEventTime.milliseconds; - CARD32 nextTimeout = 0; - -#ifdef DPMSExtension - /* - * Check each mode lowest to highest, since a lower mode can - * have the same timeout as a higher one. - */ - if (DPMSEnabled) - { - DPMS_CHECK_MODE(DPMSModeOff, DPMSOffTime) - DPMS_CHECK_MODE(DPMSModeSuspend, DPMSSuspendTime) - DPMS_CHECK_MODE(DPMSModeStandby, DPMSStandbyTime) - - nextTimeout = NextDPMSTimeout(timeout); - } - - /* - * Only do the screensaver checks if we're not in a DPMS - * power saving mode - */ - if (DPMSPowerLevel != DPMSModeOn) - return nextTimeout; -#endif /* DPMSExtension */ - - if (!ScreenSaverTime) - return nextTimeout; - - if (timeout < ScreenSaverTime) - { - return nextTimeout > 0 ? - min(ScreenSaverTime - timeout, nextTimeout) : - ScreenSaverTime - timeout; - } - - ResetOsBuffers(); /* not ideal, but better than nothing */ - dixSaveScreens(serverClient, SCREEN_SAVER_ON, ScreenSaverActive); - - if (ScreenSaverInterval > 0) - { - nextTimeout = nextTimeout > 0 ? - min(ScreenSaverInterval, nextTimeout) : - ScreenSaverInterval; - } - - return nextTimeout; -} - -static OsTimerPtr ScreenSaverTimer = NULL; - -void -FreeScreenSaverTimer(void) -{ - if (ScreenSaverTimer) { - TimerFree(ScreenSaverTimer); - ScreenSaverTimer = NULL; - } -} - -void -SetScreenSaverTimer(void) -{ - CARD32 timeout = 0; - -#ifdef DPMSExtension - if (DPMSEnabled) - { - /* - * A higher DPMS level has a timeout that's either less - * than or equal to that of a lower DPMS level. - */ - if (DPMSStandbyTime > 0) - timeout = DPMSStandbyTime; - - else if (DPMSSuspendTime > 0) - timeout = DPMSSuspendTime; - - else if (DPMSOffTime > 0) - timeout = DPMSOffTime; - } -#endif - - if (ScreenSaverTime > 0) - { - timeout = timeout > 0 ? - min(ScreenSaverTime, timeout) : - ScreenSaverTime; - } - -#ifdef SCREENSAVER - if (timeout && !screenSaverSuspended) { -#else - if (timeout) { -#endif - ScreenSaverTimer = TimerSet(ScreenSaverTimer, 0, timeout, - ScreenSaverTimeoutExpire, NULL); - } - else if (ScreenSaverTimer) { - FreeScreenSaverTimer(); - } -} - +/*********************************************************** + +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. + +******************************************************************/ + + +/***************************************************************** + * OS Dependent input routines: + * + * WaitForSomething + * TimerForce, TimerSet, TimerCheck, TimerFree + * + *****************************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#ifdef WIN32 +#include +#endif +#include /* for strings, fcntl, time */ +#include +#include +#include +#include "misc.h" + +#include "osdep.h" +#include +#include "dixstruct.h" +#include "opaque.h" +#ifdef DPMSExtension +#include "dpmsproc.h" +#endif + +#ifdef WIN32 +/* Error codes from windows sockets differ from fileio error codes */ +#undef EINTR +#define EINTR WSAEINTR +#undef EINVAL +#define EINVAL WSAEINVAL +#undef EBADF +#define EBADF WSAENOTSOCK +/* Windows select does not set errno. Use GetErrno as wrapper for + WSAGetLastError */ +#define GetErrno WSAGetLastError +#else +/* This is just a fallback to errno to hide the differences between unix and + Windows in the code */ +#define GetErrno() errno +#endif + +/* like ffs, but uses fd_mask instead of int as argument, so it works + when fd_mask is longer than an int, such as common 64-bit platforms */ +/* modifications by raphael */ +int +mffs(fd_mask mask) +{ + int i; + + if (!mask) return 0; + i = 1; + while (!(mask & 1)) + { + i++; + mask >>= 1; + } + return i; +} + +#ifdef DPMSExtension +#include +#endif + +struct _OsTimerRec { + OsTimerPtr next; + CARD32 expires; + CARD32 delta; + OsTimerCallback callback; + pointer arg; +}; + +static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); +static void CheckAllTimers(void); +static OsTimerPtr timers = NULL; + +/***************** + * WaitForSomething: + * Make the server suspend until there is + * 1. data from clients or + * 2. input events available or + * 3. ddx notices something of interest (graphics + * queue ready, etc.) or + * 4. clients that have buffered replies/events are ready + * + * If the time between INPUT events is + * greater than ScreenSaverTime, the display is turned off (or + * saved, depending on the hardware). So, WaitForSomething() + * has to handle this also (that's why the select() has a timeout. + * For more info on ClientsWithInput, see ReadRequestFromClient(). + * pClientsReady is an array to store ready client->index values into. + *****************/ + +int +WaitForSomething(int *pClientsReady) +{ + int i; + struct timeval waittime, *wt; + INT32 timeout = 0; + fd_set clientsReadable; + fd_set clientsWritable; + int curclient; + int selecterr; + static int nready; + fd_set devicesReadable; + CARD32 now = 0; + Bool someReady = FALSE; + + FD_ZERO(&clientsReadable); + + if (nready) + SmartScheduleStopTimer(); + nready = 0; + + /* We need a while loop here to handle + crashed connections and the screen saver timeout */ + while (1) + { + /* deal with any blocked jobs */ + if (workQueue) + ProcessWorkQueue(); + if (XFD_ANYSET (&ClientsWithInput)) + { + if (!SmartScheduleDisable) + { + someReady = TRUE; + waittime.tv_sec = 0; + waittime.tv_usec = 0; + wt = &waittime; + } + else + { + XFD_COPYSET (&ClientsWithInput, &clientsReadable); + break; + } + } + if (someReady) + { + XFD_COPYSET(&AllSockets, &LastSelectMask); + XFD_UNSET(&LastSelectMask, &ClientsWithInput); + } + else + { + wt = NULL; + if (timers) + { + now = GetTimeInMillis(); + timeout = timers->expires - now; + if (timeout > 0 && timeout > timers->delta + 250) { + /* time has rewound. reset the timers. */ + CheckAllTimers(); + } + + if (timers) { + timeout = timers->expires - now; + if (timeout < 0) + timeout = 0; + waittime.tv_sec = timeout / MILLI_PER_SECOND; + waittime.tv_usec = (timeout % MILLI_PER_SECOND) * + (1000000 / MILLI_PER_SECOND); + wt = &waittime; + } + } + XFD_COPYSET(&AllSockets, &LastSelectMask); + } + + BlockHandler((pointer)&wt, (pointer)&LastSelectMask); + if (NewOutputPending) + FlushAllOutput(); + /* keep this check close to select() call to minimize race */ + if (dispatchException) + i = -1; + else if (AnyClientsWriteBlocked) + { + XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable); + i = Select (MaxClients, &LastSelectMask, &clientsWritable, NULL, wt); + } + else + { + i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt); + } + selecterr = GetErrno(); + WakeupHandler(i, (pointer)&LastSelectMask); + if (i <= 0) /* An error or timeout occurred */ + { + if (dispatchException) + return 0; + if (i < 0) + { + if (selecterr == EBADF) /* Some client disconnected */ + { + CheckConnections (); + if (! XFD_ANYSET (&AllClients)) + return 0; + } + else if (selecterr == EINVAL) + { + FatalError("WaitForSomething(): select: %s\n", + strerror(selecterr)); + } + else if (selecterr != EINTR && selecterr != EAGAIN) + { + ErrorF("WaitForSomething(): select: %s\n", + strerror(selecterr)); + } + } + else if (someReady) + { + /* + * If no-one else is home, bail quickly + */ + XFD_COPYSET(&ClientsWithInput, &LastSelectMask); + XFD_COPYSET(&ClientsWithInput, &clientsReadable); + break; + } + if (*checkForInput[0] != *checkForInput[1]) + return 0; + + if (timers) + { + int expired = 0; + now = GetTimeInMillis(); + if ((int) (timers->expires - now) <= 0) + expired = 1; + + while (timers && (int) (timers->expires - now) <= 0) + DoTimer(timers, now, &timers); + + if (expired) + return 0; + } + } + else + { + fd_set tmp_set; + + if (*checkForInput[0] == *checkForInput[1]) { + if (timers) + { + int expired = 0; + now = GetTimeInMillis(); + if ((int) (timers->expires - now) <= 0) + expired = 1; + + while (timers && (int) (timers->expires - now) <= 0) + DoTimer(timers, now, &timers); + + if (expired) + return 0; + } + } + if (someReady) + XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask); + if (AnyClientsWriteBlocked && XFD_ANYSET (&clientsWritable)) + { + NewOutputPending = TRUE; + XFD_ORSET(&OutputPending, &clientsWritable, &OutputPending); + XFD_UNSET(&ClientsWriteBlocked, &clientsWritable); + if (! XFD_ANYSET(&ClientsWriteBlocked)) + AnyClientsWriteBlocked = FALSE; + } + + XFD_ANDSET(&devicesReadable, &LastSelectMask, &EnabledDevices); + XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients); + XFD_ANDSET(&tmp_set, &LastSelectMask, &WellKnownConnections); + if (XFD_ANYSET(&tmp_set)) + QueueWorkProc(EstablishNewConnections, NULL, + (pointer)&LastSelectMask); + + if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable)) + break; + /* check here for DDXes that queue events during Block/Wakeup */ + if (*checkForInput[0] != *checkForInput[1]) + return 0; + } + } + + nready = 0; + if (XFD_ANYSET (&clientsReadable)) + { +#ifndef WIN32 + for (i=0; ipriority; + if (nready == 0 || client_priority > highest_priority) + { + /* Either we found the first client, or we found + * a client whose priority is greater than all others + * that have been found so far. Either way, we want + * to initialize the list of clients to contain just + * this client. + */ + pClientsReady[0] = client_index; + highest_priority = client_priority; + nready = 1; + } + /* the following if makes sure that multiple same-priority + * clients get batched together + */ + else if (client_priority == highest_priority) + { + pClientsReady[nready++] = client_index; + } +#ifndef WIN32 + clientsReadable.fds_bits[i] &= ~(((fd_mask)1L) << curclient); + } +#else + FD_CLR(curclient, &clientsReadable); +#endif + } + } + + if (nready) + SmartScheduleStartTimer(); + + return nready; +} + +/* If time has rewound, re-run every affected timer. + * Timers might drop out of the list, so we have to restart every time. */ +static void +CheckAllTimers(void) +{ + OsTimerPtr timer; + CARD32 now; + +start: + now = GetTimeInMillis(); + + for (timer = timers; timer; timer = timer->next) { + if (timer->expires - now > timer->delta + 250) { + TimerForce(timer); + goto start; + } + } +} + +static void +DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev) +{ + CARD32 newTime; + + *prev = timer->next; + timer->next = NULL; + newTime = (*timer->callback)(timer, now, timer->arg); + if (newTime) + TimerSet(timer, 0, newTime, timer->callback, timer->arg); +} + +OsTimerPtr +TimerSet(OsTimerPtr timer, int flags, CARD32 millis, + OsTimerCallback func, pointer arg) +{ + register OsTimerPtr *prev; + CARD32 now = GetTimeInMillis(); + + if (!timer) + { + timer = malloc(sizeof(struct _OsTimerRec)); + if (!timer) + return NULL; + } + else + { + for (prev = &timers; *prev; prev = &(*prev)->next) + { + if (*prev == timer) + { + *prev = timer->next; + if (flags & TimerForceOld) + (void)(*timer->callback)(timer, now, timer->arg); + break; + } + } + } + if (!millis) + return timer; + if (flags & TimerAbsolute) { + timer->delta = millis - now; + } + else { + timer->delta = millis; + millis += now; + } + timer->expires = millis; + timer->callback = func; + timer->arg = arg; + if ((int) (millis - now) <= 0) + { + timer->next = NULL; + millis = (*timer->callback)(timer, now, timer->arg); + if (!millis) + return timer; + } + for (prev = &timers; + *prev && (int) ((*prev)->expires - millis) <= 0; + prev = &(*prev)->next) + ; + timer->next = *prev; + *prev = timer; + return timer; +} + +Bool +TimerForce(OsTimerPtr timer) +{ + OsTimerPtr *prev; + + for (prev = &timers; *prev; prev = &(*prev)->next) + { + if (*prev == timer) + { + DoTimer(timer, GetTimeInMillis(), prev); + return TRUE; + } + } + return FALSE; +} + + +void +TimerCancel(OsTimerPtr timer) +{ + OsTimerPtr *prev; + + if (!timer) + return; + for (prev = &timers; *prev; prev = &(*prev)->next) + { + if (*prev == timer) + { + *prev = timer->next; + break; + } + } +} + +void +TimerFree(OsTimerPtr timer) +{ + if (!timer) + return; + TimerCancel(timer); + free(timer); +} + +void +TimerCheck(void) +{ + CARD32 now = GetTimeInMillis(); + + while (timers && (int) (timers->expires - now) <= 0) + DoTimer(timers, now, &timers); +} + +void +TimerInit(void) +{ + OsTimerPtr timer; + + while ((timer = timers)) + { + timers = timer->next; + free(timer); + } +} + +#ifdef DPMSExtension + +#define DPMS_CHECK_MODE(mode,time)\ + if (time > 0 && DPMSPowerLevel < mode && timeout >= time)\ + DPMSSet(serverClient, mode); + +#define DPMS_CHECK_TIMEOUT(time)\ + if (time > 0 && (time - timeout) > 0)\ + return time - timeout; + +static CARD32 +NextDPMSTimeout(INT32 timeout) +{ + /* + * Return the amount of time remaining until we should set + * the next power level. Fallthroughs are intentional. + */ + switch (DPMSPowerLevel) + { + case DPMSModeOn: + DPMS_CHECK_TIMEOUT(DPMSStandbyTime) + + case DPMSModeStandby: + DPMS_CHECK_TIMEOUT(DPMSSuspendTime) + + case DPMSModeSuspend: + DPMS_CHECK_TIMEOUT(DPMSOffTime) + + default: /* DPMSModeOff */ + return 0; + } +} +#endif /* DPMSExtension */ + +static CARD32 +ScreenSaverTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg) +{ + INT32 timeout = now - lastDeviceEventTime.milliseconds; + CARD32 nextTimeout = 0; + +#ifdef DPMSExtension + /* + * Check each mode lowest to highest, since a lower mode can + * have the same timeout as a higher one. + */ + if (DPMSEnabled) + { + DPMS_CHECK_MODE(DPMSModeOff, DPMSOffTime) + DPMS_CHECK_MODE(DPMSModeSuspend, DPMSSuspendTime) + DPMS_CHECK_MODE(DPMSModeStandby, DPMSStandbyTime) + + nextTimeout = NextDPMSTimeout(timeout); + } + + /* + * Only do the screensaver checks if we're not in a DPMS + * power saving mode + */ + if (DPMSPowerLevel != DPMSModeOn) + return nextTimeout; +#endif /* DPMSExtension */ + + if (!ScreenSaverTime) + return nextTimeout; + + if (timeout < ScreenSaverTime) + { + return nextTimeout > 0 ? + min(ScreenSaverTime - timeout, nextTimeout) : + ScreenSaverTime - timeout; + } + + ResetOsBuffers(); /* not ideal, but better than nothing */ + dixSaveScreens(serverClient, SCREEN_SAVER_ON, ScreenSaverActive); + + if (ScreenSaverInterval > 0) + { + nextTimeout = nextTimeout > 0 ? + min(ScreenSaverInterval, nextTimeout) : + ScreenSaverInterval; + } + + return nextTimeout; +} + +static OsTimerPtr ScreenSaverTimer = NULL; + +void +FreeScreenSaverTimer(void) +{ + if (ScreenSaverTimer) { + TimerFree(ScreenSaverTimer); + ScreenSaverTimer = NULL; + } +} + +void +SetScreenSaverTimer(void) +{ + CARD32 timeout = 0; + +#ifdef DPMSExtension + if (DPMSEnabled) + { + /* + * A higher DPMS level has a timeout that's either less + * than or equal to that of a lower DPMS level. + */ + if (DPMSStandbyTime > 0) + timeout = DPMSStandbyTime; + + else if (DPMSSuspendTime > 0) + timeout = DPMSSuspendTime; + + else if (DPMSOffTime > 0) + timeout = DPMSOffTime; + } +#endif + + if (ScreenSaverTime > 0) + { + timeout = timeout > 0 ? + min(ScreenSaverTime, timeout) : + ScreenSaverTime; + } + +#ifdef SCREENSAVER + if (timeout && !screenSaverSuspended) { +#else + if (timeout) { +#endif + ScreenSaverTimer = TimerSet(ScreenSaverTimer, 0, timeout, + ScreenSaverTimeoutExpire, NULL); + } + else if (ScreenSaverTimer) { + FreeScreenSaverTimer(); + } +} + diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c index 877e9776b..879e14f2f 100644 --- a/xorg-server/test/input.c +++ b/xorg-server/test/input.c @@ -1,1089 +1,1083 @@ -/** - * Copyright © 2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "misc.h" -#include "resource.h" -#include -#include -#include -#include "windowstr.h" -#include "inputstr.h" -#include "eventconvert.h" -#include "exevents.h" -#include "dixgrabs.h" -#include "eventstr.h" -#include "inpututils.h" -#include - -/** - * Init a device with axes. - * Verify values set on the device. - * - * Result: All axes set to default values (usually 0). - */ -static void dix_init_valuators(void) -{ - DeviceIntRec dev; - ValuatorClassPtr val; - const int num_axes = 2; - int i; - Atom atoms[MAX_VALUATORS] = { 0 }; - - - memset(&dev, 0, sizeof(DeviceIntRec)); - dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ - - g_assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE); - g_assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute)); - - val = dev.valuator; - g_assert(val); - g_assert(val->numAxes == num_axes); - g_assert(val->numMotionEvents == 0); - g_assert(val->axisVal); - - for (i = 0; i < num_axes; i++) - { - g_assert(val->axisVal[i] == 0); - g_assert(val->axes->min_value == NO_AXIS_LIMITS); - g_assert(val->axes->max_value == NO_AXIS_LIMITS); - g_assert(val->axes->mode == Absolute); - } - - g_assert(dev.last.numValuators == num_axes); -} - -/* just check the known success cases, and that error cases set the client's - * error value correctly. */ -static void dix_check_grab_values(void) -{ - ClientRec client; - GrabParameters param; - int rc; - - memset(&client, 0, sizeof(client)); - - param.grabtype = GRABTYPE_CORE; - param.this_device_mode = GrabModeSync; - param.other_devices_mode = GrabModeSync; - param.modifiers = AnyModifier; - param.ownerEvents = FALSE; - - rc = CheckGrabValues(&client, ¶m); - g_assert(rc == Success); - - param.this_device_mode = GrabModeAsync; - rc = CheckGrabValues(&client, ¶m); - g_assert(rc == Success); - - param.this_device_mode = GrabModeAsync + 1; - rc = CheckGrabValues(&client, ¶m); - g_assert(rc == BadValue); - g_assert(client.errorValue == param.this_device_mode); - g_assert(client.errorValue == GrabModeAsync + 1); - - param.this_device_mode = GrabModeSync; - param.other_devices_mode = GrabModeAsync; - rc = CheckGrabValues(&client, ¶m); - g_assert(rc == Success); - - param.other_devices_mode = GrabModeAsync + 1; - rc = CheckGrabValues(&client, ¶m); - g_assert(rc == BadValue); - g_assert(client.errorValue == param.other_devices_mode); - g_assert(client.errorValue == GrabModeAsync + 1); - - param.other_devices_mode = GrabModeSync; - - param.modifiers = 1 << 13; - rc = CheckGrabValues(&client, ¶m); - g_assert(rc == BadValue); - g_assert(client.errorValue == param.modifiers); - g_assert(client.errorValue == (1 << 13)); - - - param.modifiers = AnyModifier; - param.ownerEvents = TRUE; - rc = CheckGrabValues(&client, ¶m); - g_assert(rc == Success); - - param.ownerEvents = 3; - rc = CheckGrabValues(&client, ¶m); - g_assert(rc == BadValue); - g_assert(client.errorValue == param.ownerEvents); - g_assert(client.errorValue == 3); -} - - -/** - * Convert various internal events to the matching core event and verify the - * parameters. - */ -static void dix_event_to_core(int type) -{ - DeviceEvent ev; - xEvent core; - int time; - int x, y; - int rc; - int state; - int detail; - const int ROOT_WINDOW_ID = 0x100; - - /* EventToCore memsets the event to 0 */ -#define test_event() \ - g_assert(rc == Success); \ - g_assert(core.u.u.type == type); \ - g_assert(core.u.u.detail == detail); \ - g_assert(core.u.keyButtonPointer.time == time); \ - g_assert(core.u.keyButtonPointer.rootX == x); \ - g_assert(core.u.keyButtonPointer.rootY == y); \ - g_assert(core.u.keyButtonPointer.state == state); \ - g_assert(core.u.keyButtonPointer.eventX == 0); \ - g_assert(core.u.keyButtonPointer.eventY == 0); \ - g_assert(core.u.keyButtonPointer.root == ROOT_WINDOW_ID); \ - g_assert(core.u.keyButtonPointer.event == 0); \ - g_assert(core.u.keyButtonPointer.child == 0); \ - g_assert(core.u.keyButtonPointer.sameScreen == FALSE); - - x = 0; - y = 0; - time = 12345; - state = 0; - detail = 0; - - ev.header = 0xFF; - ev.length = sizeof(DeviceEvent); - ev.time = time; - ev.root_y = x; - ev.root_x = y; - SetBit(ev.valuators.mask, 0); - SetBit(ev.valuators.mask, 1); - ev.root = ROOT_WINDOW_ID; - ev.corestate = state; - ev.detail.key = detail; - - ev.type = type; - ev.detail.key = 0; - rc = EventToCore((InternalEvent*)&ev, &core); - test_event(); - - x = 1; - y = 2; - ev.root_x = x; - ev.root_y = y; - rc = EventToCore((InternalEvent*)&ev, &core); - test_event(); - - x = 0x7FFF; - y = 0x7FFF; - ev.root_x = x; - ev.root_y = y; - rc = EventToCore((InternalEvent*)&ev, &core); - test_event(); - - x = 0x8000; /* too high */ - y = 0x8000; /* too high */ - ev.root_x = x; - ev.root_y = y; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(core.u.keyButtonPointer.rootX != x); - g_assert(core.u.keyButtonPointer.rootY != y); - - x = 0x7FFF; - y = 0x7FFF; - ev.root_x = x; - ev.root_y = y; - time = 0; - ev.time = time; - rc = EventToCore((InternalEvent*)&ev, &core); - test_event(); - - detail = 1; - ev.detail.key = detail; - rc = EventToCore((InternalEvent*)&ev, &core); - test_event(); - - detail = 0xFF; /* highest value */ - ev.detail.key = detail; - rc = EventToCore((InternalEvent*)&ev, &core); - test_event(); - - detail = 0xFFF; /* too big */ - ev.detail.key = detail; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadMatch); - - detail = 0xFF; /* too big */ - ev.detail.key = detail; - state = 0xFFFF; /* highest value */ - ev.corestate = state; - rc = EventToCore((InternalEvent*)&ev, &core); - test_event(); - - state = 0x10000; /* too big */ - ev.corestate = state; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(core.u.keyButtonPointer.state != state); - g_assert(core.u.keyButtonPointer.state == (state & 0xFFFF)); - -#undef test_event -} - -static void dix_event_to_core_conversion(void) -{ - DeviceEvent ev; - xEvent core; - int rc; - - ev.header = 0xFF; - ev.length = sizeof(DeviceEvent); - - ev.type = 0; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadImplementation); - - ev.type = 1; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadImplementation); - - ev.type = ET_ProximityOut + 1; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadImplementation); - - ev.type = ET_ProximityIn; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadMatch); - - ev.type = ET_ProximityOut; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadMatch); - - dix_event_to_core(ET_KeyPress); - dix_event_to_core(ET_KeyRelease); - dix_event_to_core(ET_ButtonPress); - dix_event_to_core(ET_ButtonRelease); - dix_event_to_core(ET_Motion); -} - -static void xi2_struct_sizes(void) -{ -#define compare(req) \ - g_assert(sizeof(req) == sz_##req); - - compare(xXIQueryVersionReq); - compare(xXIWarpPointerReq); - compare(xXIChangeCursorReq); - compare(xXIChangeHierarchyReq); - compare(xXISetClientPointerReq); - compare(xXIGetClientPointerReq); - compare(xXISelectEventsReq); - compare(xXIQueryVersionReq); - compare(xXIQueryDeviceReq); - compare(xXISetFocusReq); - compare(xXIGetFocusReq); - compare(xXIGrabDeviceReq); - compare(xXIUngrabDeviceReq); - compare(xXIAllowEventsReq); - compare(xXIPassiveGrabDeviceReq); - compare(xXIPassiveUngrabDeviceReq); - compare(xXIListPropertiesReq); - compare(xXIChangePropertyReq); - compare(xXIDeletePropertyReq); - compare(xXIGetPropertyReq); - compare(xXIGetSelectedEventsReq); -#undef compare -} - - -static void dix_grab_matching(void) -{ - DeviceIntRec xi_all_devices, xi_all_master_devices, dev1, dev2; - GrabRec a, b; - BOOL rc; - - memset(&a, 0, sizeof(a)); - memset(&b, 0, sizeof(b)); - - /* different grabtypes must fail */ - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_XI2; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI2; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_CORE; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - /* XI2 grabs for different devices must fail, regardless of ignoreDevice - * XI2 grabs for master devices must fail against a slave */ - memset(&xi_all_devices, 0, sizeof(DeviceIntRec)); - memset(&xi_all_master_devices, 0, sizeof(DeviceIntRec)); - memset(&dev1, 0, sizeof(DeviceIntRec)); - memset(&dev2, 0, sizeof(DeviceIntRec)); - - xi_all_devices.id = XIAllDevices; - xi_all_master_devices.id = XIAllMasterDevices; - dev1.id = 10; - dev1.type = SLAVE; - dev2.id = 11; - dev2.type = SLAVE; - - inputInfo.all_devices = &xi_all_devices; - inputInfo.all_master_devices = &xi_all_master_devices; - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.device = &dev1; - b.device = &dev2; - - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - - a.device = &dev2; - b.device = &dev1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&a, &b, TRUE); - g_assert(rc == FALSE); - - a.device = inputInfo.all_master_devices; - b.device = &dev1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&a, &b, TRUE); - g_assert(rc == FALSE); - - a.device = &dev1; - b.device = inputInfo.all_master_devices; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&a, &b, TRUE); - g_assert(rc == FALSE); - - /* ignoreDevice FALSE must fail for different devices for CORE and XI */ - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - a.device = &dev1; - b.device = &dev2; - a.modifierDevice = &dev1; - b.modifierDevice = &dev1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - a.device = &dev1; - b.device = &dev2; - a.modifierDevice = &dev1; - b.modifierDevice = &dev1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - - /* ignoreDevice FALSE must fail for different modifier devices for CORE - * and XI */ - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - a.device = &dev1; - b.device = &dev1; - a.modifierDevice = &dev1; - b.modifierDevice = &dev2; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - a.device = &dev1; - b.device = &dev1; - a.modifierDevice = &dev1; - b.modifierDevice = &dev2; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - - /* different event type must fail */ - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.device = &dev1; - b.device = &dev1; - a.modifierDevice = &dev1; - b.modifierDevice = &dev1; - a.type = XI_KeyPress; - b.type = XI_KeyRelease; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&a, &b, TRUE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - a.device = &dev1; - b.device = &dev1; - a.modifierDevice = &dev1; - b.modifierDevice = &dev1; - a.type = XI_KeyPress; - b.type = XI_KeyRelease; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&a, &b, TRUE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - a.device = &dev1; - b.device = &dev1; - a.modifierDevice = &dev1; - b.modifierDevice = &dev1; - a.type = XI_KeyPress; - b.type = XI_KeyRelease; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&a, &b, TRUE); - g_assert(rc == FALSE); - - /* different modifiers must fail */ - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.device = &dev1; - b.device = &dev1; - a.modifierDevice = &dev1; - b.modifierDevice = &dev1; - a.type = XI_KeyPress; - b.type = XI_KeyPress; - a.modifiersDetail.exact = 1; - b.modifiersDetail.exact = 2; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - /* AnyModifier must fail for XI2 */ - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.modifiersDetail.exact = AnyModifier; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - /* XIAnyModifier must fail for CORE and XI */ - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - a.modifiersDetail.exact = XIAnyModifier; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - a.modifiersDetail.exact = XIAnyModifier; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - /* different detail must fail */ - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.detail.exact = 1; - b.detail.exact = 2; - a.modifiersDetail.exact = 1; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - /* detail of AnyModifier must fail */ - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.detail.exact = AnyModifier; - b.detail.exact = 1; - a.modifiersDetail.exact = 1; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - /* detail of XIAnyModifier must fail */ - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.detail.exact = XIAnyModifier; - b.detail.exact = 1; - a.modifiersDetail.exact = 1; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == FALSE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == FALSE); - - /* XIAnyModifier or AnyModifer must succeed */ - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.detail.exact = 1; - b.detail.exact = 1; - a.modifiersDetail.exact = XIAnyModifier; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == TRUE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == TRUE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - a.detail.exact = 1; - b.detail.exact = 1; - a.modifiersDetail.exact = AnyModifier; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == TRUE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == TRUE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - a.detail.exact = 1; - b.detail.exact = 1; - a.modifiersDetail.exact = AnyModifier; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == TRUE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == TRUE); - - /* AnyKey or XIAnyKeycode must succeed */ - a.grabtype = GRABTYPE_XI2; - b.grabtype = GRABTYPE_XI2; - a.detail.exact = XIAnyKeycode; - b.detail.exact = 1; - a.modifiersDetail.exact = 1; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == TRUE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == TRUE); - - a.grabtype = GRABTYPE_CORE; - b.grabtype = GRABTYPE_CORE; - a.detail.exact = AnyKey; - b.detail.exact = 1; - a.modifiersDetail.exact = 1; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == TRUE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == TRUE); - - a.grabtype = GRABTYPE_XI; - b.grabtype = GRABTYPE_XI; - a.detail.exact = AnyKey; - b.detail.exact = 1; - a.modifiersDetail.exact = 1; - b.modifiersDetail.exact = 1; - rc = GrabMatchesSecond(&a, &b, FALSE); - g_assert(rc == TRUE); - rc = GrabMatchesSecond(&b, &a, FALSE); - g_assert(rc == TRUE); -} - -static void test_bits_to_byte(int i) -{ - int expected_bytes; - expected_bytes = (i + 7)/8; - - g_assert(bits_to_bytes(i) >= i/8); - g_assert((bits_to_bytes(i) * 8) - i <= 7); - g_assert(expected_bytes == bits_to_bytes(i)); -} - -static void test_bytes_to_int32(int i) -{ - int expected_4byte; - expected_4byte = (i + 3)/4; - - g_assert(bytes_to_int32(i) <= i); - g_assert((bytes_to_int32(i) * 4) - i <= 3); - g_assert(expected_4byte == bytes_to_int32(i)); -} - -static void test_pad_to_int32(int i) -{ - int expected_bytes; - expected_bytes = ((i + 3)/4) * 4; - - g_assert(pad_to_int32(i) >= i); - g_assert(pad_to_int32(i) - i <= 3); - g_assert(expected_bytes == pad_to_int32(i)); -} -static void include_byte_padding_macros(void) -{ - g_test_message("Testing bits_to_bytes()"); - - /* the macros don't provide overflow protection */ - test_bits_to_byte(0); - test_bits_to_byte(1); - test_bits_to_byte(2); - test_bits_to_byte(7); - test_bits_to_byte(8); - test_bits_to_byte(0xFF); - test_bits_to_byte(0x100); - test_bits_to_byte(INT_MAX - 9); - test_bits_to_byte(INT_MAX - 8); - - g_test_message("Testing bytes_to_int32()"); - - test_bytes_to_int32(0); - test_bytes_to_int32(1); - test_bytes_to_int32(2); - test_bytes_to_int32(7); - test_bytes_to_int32(8); - test_bytes_to_int32(0xFF); - test_bytes_to_int32(0x100); - test_bytes_to_int32(0xFFFF); - test_bytes_to_int32(0x10000); - test_bytes_to_int32(0xFFFFFF); - test_bytes_to_int32(0x1000000); - test_bytes_to_int32(INT_MAX - 4); - test_bytes_to_int32(INT_MAX - 3); - - g_test_message("Testing pad_to_int32"); - - test_pad_to_int32(0); - test_pad_to_int32(0); - test_pad_to_int32(1); - test_pad_to_int32(2); - test_pad_to_int32(7); - test_pad_to_int32(8); - test_pad_to_int32(0xFF); - test_pad_to_int32(0x100); - test_pad_to_int32(0xFFFF); - test_pad_to_int32(0x10000); - test_pad_to_int32(0xFFFFFF); - test_pad_to_int32(0x1000000); - test_pad_to_int32(INT_MAX - 4); - test_pad_to_int32(INT_MAX - 3); -} - -static void xi_unregister_handlers(void) -{ - DeviceIntRec dev; - int handler; - - memset(&dev, 0, sizeof(dev)); - - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 1); - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 2); - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 3); - - g_test_message("Unlinking from front."); - - XIUnregisterPropertyHandler(&dev, 4); /* NOOP */ - g_assert(dev.properties.handlers->id == 3); - XIUnregisterPropertyHandler(&dev, 3); - g_assert(dev.properties.handlers->id == 2); - XIUnregisterPropertyHandler(&dev, 2); - g_assert(dev.properties.handlers->id == 1); - XIUnregisterPropertyHandler(&dev, 1); - g_assert(dev.properties.handlers == NULL); - - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 4); - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 5); - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 6); - XIUnregisterPropertyHandler(&dev, 3); /* NOOP */ - g_assert(dev.properties.handlers->next->next->next == NULL); - XIUnregisterPropertyHandler(&dev, 4); - g_assert(dev.properties.handlers->next->next == NULL); - XIUnregisterPropertyHandler(&dev, 5); - g_assert(dev.properties.handlers->next == NULL); - XIUnregisterPropertyHandler(&dev, 6); - g_assert(dev.properties.handlers == NULL); - - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 7); - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 8); - handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); - g_assert(handler == 9); - - XIDeleteAllDeviceProperties(&dev); - g_assert(dev.properties.handlers == NULL); - XIUnregisterPropertyHandler(&dev, 7); /* NOOP */ - -} - -static void cmp_attr_fields(InputAttributes *attr1, - InputAttributes *attr2) -{ - char **tags1, **tags2; - - g_assert(attr1 && attr2); - g_assert(attr1 != attr2); - g_assert(attr1->flags == attr2->flags); - - if (attr1->product != NULL) - { - g_assert(attr1->product != attr2->product); - g_assert(strcmp(attr1->product, attr2->product) == 0); - } else - g_assert(attr2->product == NULL); - - if (attr1->vendor != NULL) - { - g_assert(attr1->vendor != attr2->vendor); - g_assert(strcmp(attr1->vendor, attr2->vendor) == 0); - } else - g_assert(attr2->vendor == NULL); - - if (attr1->device != NULL) - { - g_assert(attr1->device != attr2->device); - g_assert(strcmp(attr1->device, attr2->device) == 0); - } else - g_assert(attr2->device == NULL); - - if (attr1->pnp_id != NULL) - { - g_assert(attr1->pnp_id != attr2->pnp_id); - g_assert(strcmp(attr1->pnp_id, attr2->pnp_id) == 0); - } else - g_assert(attr2->pnp_id == NULL); - - if (attr1->usb_id != NULL) - { - g_assert(attr1->usb_id != attr2->usb_id); - g_assert(strcmp(attr1->usb_id, attr2->usb_id) == 0); - } else - g_assert(attr2->usb_id == NULL); - - tags1 = attr1->tags; - tags2 = attr2->tags; - - /* if we don't have any tags, skip the tag checking bits */ - if (!tags1) - { - g_assert(!tags2); - return; - } - - /* Don't lug around empty arrays */ - g_assert(*tags1); - g_assert(*tags2); - - /* check for identical content, but duplicated */ - while (*tags1) - { - g_assert(*tags1 != *tags2); - g_assert(strcmp(*tags1, *tags2) == 0); - tags1++; - tags2++; - } - - /* ensure tags1 and tags2 have the same no of elements */ - g_assert(!*tags2); - - /* check for not sharing memory */ - tags1 = attr1->tags; - while (*tags1) - { - tags2 = attr2->tags; - while (*tags2) - g_assert(*tags1 != *tags2++); - - tags1++; - } -} - -static void dix_input_attributes(void) -{ - InputAttributes orig = {0}; - InputAttributes *new; - char *tags[4] = {"tag1", "tag2", "tag2", NULL}; - - new = DuplicateInputAttributes(NULL); - g_assert(!new); - - new = DuplicateInputAttributes(&orig); - g_assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0); - - orig.product = "product name"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); - FreeInputAttributes(new); - - orig.vendor = "vendor name"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); - FreeInputAttributes(new); - - orig.device = "device path"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); - FreeInputAttributes(new); - - orig.pnp_id = "PnPID"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); - FreeInputAttributes(new); - - orig.usb_id = "USBID"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); - FreeInputAttributes(new); - - orig.flags = 0xF0; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); - FreeInputAttributes(new); - - orig.tags = tags; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); - FreeInputAttributes(new); -} - -static void dix_input_valuator_masks(void) -{ - ValuatorMask *mask = NULL, *copy; - int nvaluators = MAX_VALUATORS; - int valuators[nvaluators]; - int i; - int first_val, num_vals; - - for (i = 0; i < nvaluators; i++) - valuators[i] = i; - - mask = valuator_mask_new(nvaluators); - g_assert(mask != NULL); - g_assert(valuator_mask_size(mask) == 0); - g_assert(valuator_mask_num_valuators(mask) == 0); - - for (i = 0; i < nvaluators; i++) - { - g_assert(!valuator_mask_isset(mask, i)); - valuator_mask_set(mask, i, valuators[i]); - g_assert(valuator_mask_isset(mask, i)); - g_assert(valuator_mask_get(mask, i) == valuators[i]); - g_assert(valuator_mask_size(mask) == i + 1); - g_assert(valuator_mask_num_valuators(mask) == i + 1); - } - - for (i = 0; i < nvaluators; i++) - { - g_assert(valuator_mask_isset(mask, i)); - valuator_mask_unset(mask, i); - /* we're removing valuators from the front, so size should stay the - * same until the last bit is removed */ - if (i < nvaluators - 1) - g_assert(valuator_mask_size(mask) == nvaluators); - g_assert(!valuator_mask_isset(mask, i)); - } - - g_assert(valuator_mask_size(mask) == 0); - valuator_mask_zero(mask); - g_assert(valuator_mask_size(mask) == 0); - g_assert(valuator_mask_num_valuators(mask) == 0); - for (i = 0; i < nvaluators; i++) - g_assert(!valuator_mask_isset(mask, i)); - - first_val = 5; - num_vals = 6; - - valuator_mask_set_range(mask, first_val, num_vals, valuators); - g_assert(valuator_mask_size(mask) == first_val + num_vals); - g_assert(valuator_mask_num_valuators(mask) == num_vals); - for (i = 0; i < nvaluators; i++) - { - if (i < first_val || i >= first_val + num_vals) - g_assert(!valuator_mask_isset(mask, i)); - else - { - g_assert(valuator_mask_isset(mask, i)); - g_assert(valuator_mask_get(mask, i) == valuators[i - first_val]); - } - } - - copy = valuator_mask_new(nvaluators); - valuator_mask_copy(copy, mask); - g_assert(mask != copy); - g_assert(valuator_mask_size(mask) == valuator_mask_size(copy)); - g_assert(valuator_mask_num_valuators(mask) == valuator_mask_num_valuators(copy)); - - for (i = 0; i < nvaluators; i++) - { - g_assert(valuator_mask_isset(mask, i) == valuator_mask_isset(copy, i)); - g_assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i)); - } - - free(mask); -} - -static void dix_valuator_mode(void) -{ - DeviceIntRec dev; - const int num_axes = MAX_VALUATORS; - int i; - Atom atoms[MAX_VALUATORS] = { 0 }; - - memset(&dev, 0, sizeof(DeviceIntRec)); - dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ - - g_assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE); - g_assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute)); - - for (i = 0; i < num_axes; i++) - { - g_assert(valuator_get_mode(&dev, i) == Absolute); - valuator_set_mode(&dev, i, Relative); - g_assert(dev.valuator->axes[i].mode == Relative); - g_assert(valuator_get_mode(&dev, i) == Relative); - } - - valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Absolute); - for (i = 0; i < num_axes; i++) - g_assert(valuator_get_mode(&dev, i) == Absolute); - - valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Relative); - for (i = 0; i < num_axes; i++) - g_assert(valuator_get_mode(&dev, i) == Relative); -} - -static void include_bit_test_macros(void) -{ - uint8_t mask[9] = { 0 }; - int i; - - for (i = 0; i < sizeof(mask)/sizeof(mask[0]); i++) - { - g_assert(BitIsOn(mask, i) == 0); - SetBit(mask, i); - g_assert(BitIsOn(mask, i) == 1); - g_assert(!!(mask[i/8] & (1 << (i % 8)))); - g_assert(CountBits(mask, sizeof(mask)) == 1); - ClearBit(mask, i); - g_assert(BitIsOn(mask, i) == 0); - } -} - -int main(int argc, char** argv) -{ - g_test_init(&argc, &argv,NULL); - g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id="); - - g_test_add_func("/dix/input/valuator-masks", dix_input_valuator_masks); - g_test_add_func("/dix/input/attributes", dix_input_attributes); - g_test_add_func("/dix/input/init-valuators", dix_init_valuators); - g_test_add_func("/dix/input/event-core-conversion", dix_event_to_core_conversion); - g_test_add_func("/dix/input/check-grab-values", dix_check_grab_values); - g_test_add_func("/dix/input/xi2-struct-sizes", xi2_struct_sizes); - g_test_add_func("/dix/input/grab_matching", dix_grab_matching); - g_test_add_func("/dix/input/valuator_mode", dix_valuator_mode); - g_test_add_func("/include/byte_padding_macros", include_byte_padding_macros); - g_test_add_func("/include/bit_test_macros", include_bit_test_macros); - g_test_add_func("/Xi/xiproperty/register-unregister", xi_unregister_handlers); - - - return g_test_run(); -} +/** + * Copyright © 2009 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include +#include "misc.h" +#include "resource.h" +#include +#include +#include +#include "windowstr.h" +#include "inputstr.h" +#include "eventconvert.h" +#include "exevents.h" +#include "dixgrabs.h" +#include "eventstr.h" +#include "inpututils.h" +#include + +/** + * Init a device with axes. + * Verify values set on the device. + * + * Result: All axes set to default values (usually 0). + */ +static void dix_init_valuators(void) +{ + DeviceIntRec dev; + ValuatorClassPtr val; + const int num_axes = 2; + int i; + Atom atoms[MAX_VALUATORS] = { 0 }; + + + memset(&dev, 0, sizeof(DeviceIntRec)); + dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ + + g_assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE); + g_assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute)); + + val = dev.valuator; + g_assert(val); + g_assert(val->numAxes == num_axes); + g_assert(val->numMotionEvents == 0); + g_assert(val->axisVal); + + for (i = 0; i < num_axes; i++) + { + g_assert(val->axisVal[i] == 0); + g_assert(val->axes->min_value == NO_AXIS_LIMITS); + g_assert(val->axes->max_value == NO_AXIS_LIMITS); + g_assert(val->axes->mode == Absolute); + } + + g_assert(dev.last.numValuators == num_axes); +} + +/* just check the known success cases, and that error cases set the client's + * error value correctly. */ +static void dix_check_grab_values(void) +{ + ClientRec client; + GrabParameters param; + int rc; + + memset(&client, 0, sizeof(client)); + + param.grabtype = GRABTYPE_CORE; + param.this_device_mode = GrabModeSync; + param.other_devices_mode = GrabModeSync; + param.modifiers = AnyModifier; + param.ownerEvents = FALSE; + + rc = CheckGrabValues(&client, ¶m); + g_assert(rc == Success); + + param.this_device_mode = GrabModeAsync; + rc = CheckGrabValues(&client, ¶m); + g_assert(rc == Success); + + param.this_device_mode = GrabModeAsync + 1; + rc = CheckGrabValues(&client, ¶m); + g_assert(rc == BadValue); + g_assert(client.errorValue == param.this_device_mode); + g_assert(client.errorValue == GrabModeAsync + 1); + + param.this_device_mode = GrabModeSync; + param.other_devices_mode = GrabModeAsync; + rc = CheckGrabValues(&client, ¶m); + g_assert(rc == Success); + + param.other_devices_mode = GrabModeAsync + 1; + rc = CheckGrabValues(&client, ¶m); + g_assert(rc == BadValue); + g_assert(client.errorValue == param.other_devices_mode); + g_assert(client.errorValue == GrabModeAsync + 1); + + param.other_devices_mode = GrabModeSync; + + param.modifiers = 1 << 13; + rc = CheckGrabValues(&client, ¶m); + g_assert(rc == BadValue); + g_assert(client.errorValue == param.modifiers); + g_assert(client.errorValue == (1 << 13)); + + + param.modifiers = AnyModifier; + param.ownerEvents = TRUE; + rc = CheckGrabValues(&client, ¶m); + g_assert(rc == Success); + + param.ownerEvents = 3; + rc = CheckGrabValues(&client, ¶m); + g_assert(rc == BadValue); + g_assert(client.errorValue == param.ownerEvents); + g_assert(client.errorValue == 3); +} + + +/** + * Convert various internal events to the matching core event and verify the + * parameters. + */ +static void dix_event_to_core(int type) +{ + DeviceEvent ev; + xEvent core; + int time; + int x, y; + int rc; + int state; + int detail; + const int ROOT_WINDOW_ID = 0x100; + + /* EventToCore memsets the event to 0 */ +#define test_event() \ + g_assert(rc == Success); \ + g_assert(core.u.u.type == type); \ + g_assert(core.u.u.detail == detail); \ + g_assert(core.u.keyButtonPointer.time == time); \ + g_assert(core.u.keyButtonPointer.rootX == x); \ + g_assert(core.u.keyButtonPointer.rootY == y); \ + g_assert(core.u.keyButtonPointer.state == state); \ + g_assert(core.u.keyButtonPointer.eventX == 0); \ + g_assert(core.u.keyButtonPointer.eventY == 0); \ + g_assert(core.u.keyButtonPointer.root == ROOT_WINDOW_ID); \ + g_assert(core.u.keyButtonPointer.event == 0); \ + g_assert(core.u.keyButtonPointer.child == 0); \ + g_assert(core.u.keyButtonPointer.sameScreen == FALSE); + + x = 0; + y = 0; + time = 12345; + state = 0; + detail = 0; + + ev.header = 0xFF; + ev.length = sizeof(DeviceEvent); + ev.time = time; + ev.root_y = x; + ev.root_x = y; + SetBit(ev.valuators.mask, 0); + SetBit(ev.valuators.mask, 1); + ev.root = ROOT_WINDOW_ID; + ev.corestate = state; + ev.detail.key = detail; + + ev.type = type; + ev.detail.key = 0; + rc = EventToCore((InternalEvent*)&ev, &core); + test_event(); + + x = 1; + y = 2; + ev.root_x = x; + ev.root_y = y; + rc = EventToCore((InternalEvent*)&ev, &core); + test_event(); + + x = 0x7FFF; + y = 0x7FFF; + ev.root_x = x; + ev.root_y = y; + rc = EventToCore((InternalEvent*)&ev, &core); + test_event(); + + x = 0x8000; /* too high */ + y = 0x8000; /* too high */ + ev.root_x = x; + ev.root_y = y; + rc = EventToCore((InternalEvent*)&ev, &core); + g_assert(core.u.keyButtonPointer.rootX != x); + g_assert(core.u.keyButtonPointer.rootY != y); + + x = 0x7FFF; + y = 0x7FFF; + ev.root_x = x; + ev.root_y = y; + time = 0; + ev.time = time; + rc = EventToCore((InternalEvent*)&ev, &core); + test_event(); + + detail = 1; + ev.detail.key = detail; + rc = EventToCore((InternalEvent*)&ev, &core); + test_event(); + + detail = 0xFF; /* highest value */ + ev.detail.key = detail; + rc = EventToCore((InternalEvent*)&ev, &core); + test_event(); + + detail = 0xFFF; /* too big */ + ev.detail.key = detail; + rc = EventToCore((InternalEvent*)&ev, &core); + g_assert(rc == BadMatch); + + detail = 0xFF; /* too big */ + ev.detail.key = detail; + state = 0xFFFF; /* highest value */ + ev.corestate = state; + rc = EventToCore((InternalEvent*)&ev, &core); + test_event(); + + state = 0x10000; /* too big */ + ev.corestate = state; + rc = EventToCore((InternalEvent*)&ev, &core); + g_assert(core.u.keyButtonPointer.state != state); + g_assert(core.u.keyButtonPointer.state == (state & 0xFFFF)); + +#undef test_event +} + +static void dix_event_to_core_fail(int evtype, int expected_rc) +{ + DeviceEvent ev; + xEvent core; + int rc; + + ev.header = 0xFF; + ev.length = sizeof(DeviceEvent); + + ev.type = evtype; + rc = EventToCore((InternalEvent*)&ev, &core); + g_assert(rc == expected_rc); +} + +static void dix_event_to_core_conversion(void) +{ + dix_event_to_core_fail(0, BadImplementation); + dix_event_to_core_fail(1, BadImplementation); + dix_event_to_core_fail(ET_ProximityOut + 1, BadImplementation); + dix_event_to_core_fail(ET_ProximityIn, BadMatch); + dix_event_to_core_fail(ET_ProximityOut, BadMatch); + + dix_event_to_core(ET_KeyPress); + dix_event_to_core(ET_KeyRelease); + dix_event_to_core(ET_ButtonPress); + dix_event_to_core(ET_ButtonRelease); + dix_event_to_core(ET_Motion); +} + +static void xi2_struct_sizes(void) +{ +#define compare(req) \ + g_assert(sizeof(req) == sz_##req); + + compare(xXIQueryVersionReq); + compare(xXIWarpPointerReq); + compare(xXIChangeCursorReq); + compare(xXIChangeHierarchyReq); + compare(xXISetClientPointerReq); + compare(xXIGetClientPointerReq); + compare(xXISelectEventsReq); + compare(xXIQueryVersionReq); + compare(xXIQueryDeviceReq); + compare(xXISetFocusReq); + compare(xXIGetFocusReq); + compare(xXIGrabDeviceReq); + compare(xXIUngrabDeviceReq); + compare(xXIAllowEventsReq); + compare(xXIPassiveGrabDeviceReq); + compare(xXIPassiveUngrabDeviceReq); + compare(xXIListPropertiesReq); + compare(xXIChangePropertyReq); + compare(xXIDeletePropertyReq); + compare(xXIGetPropertyReq); + compare(xXIGetSelectedEventsReq); +#undef compare +} + + +static void dix_grab_matching(void) +{ + DeviceIntRec xi_all_devices, xi_all_master_devices, dev1, dev2; + GrabRec a, b; + BOOL rc; + + memset(&a, 0, sizeof(a)); + memset(&b, 0, sizeof(b)); + + /* different grabtypes must fail */ + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_XI2; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI2; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_CORE; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + /* XI2 grabs for different devices must fail, regardless of ignoreDevice + * XI2 grabs for master devices must fail against a slave */ + memset(&xi_all_devices, 0, sizeof(DeviceIntRec)); + memset(&xi_all_master_devices, 0, sizeof(DeviceIntRec)); + memset(&dev1, 0, sizeof(DeviceIntRec)); + memset(&dev2, 0, sizeof(DeviceIntRec)); + + xi_all_devices.id = XIAllDevices; + xi_all_master_devices.id = XIAllMasterDevices; + dev1.id = 10; + dev1.type = SLAVE; + dev2.id = 11; + dev2.type = SLAVE; + + inputInfo.all_devices = &xi_all_devices; + inputInfo.all_master_devices = &xi_all_master_devices; + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.device = &dev1; + b.device = &dev2; + + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + + a.device = &dev2; + b.device = &dev1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&a, &b, TRUE); + g_assert(rc == FALSE); + + a.device = inputInfo.all_master_devices; + b.device = &dev1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&a, &b, TRUE); + g_assert(rc == FALSE); + + a.device = &dev1; + b.device = inputInfo.all_master_devices; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&a, &b, TRUE); + g_assert(rc == FALSE); + + /* ignoreDevice FALSE must fail for different devices for CORE and XI */ + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + a.device = &dev1; + b.device = &dev2; + a.modifierDevice = &dev1; + b.modifierDevice = &dev1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + a.device = &dev1; + b.device = &dev2; + a.modifierDevice = &dev1; + b.modifierDevice = &dev1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + + /* ignoreDevice FALSE must fail for different modifier devices for CORE + * and XI */ + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + a.device = &dev1; + b.device = &dev1; + a.modifierDevice = &dev1; + b.modifierDevice = &dev2; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + a.device = &dev1; + b.device = &dev1; + a.modifierDevice = &dev1; + b.modifierDevice = &dev2; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + + /* different event type must fail */ + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.device = &dev1; + b.device = &dev1; + a.modifierDevice = &dev1; + b.modifierDevice = &dev1; + a.type = XI_KeyPress; + b.type = XI_KeyRelease; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&a, &b, TRUE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + a.device = &dev1; + b.device = &dev1; + a.modifierDevice = &dev1; + b.modifierDevice = &dev1; + a.type = XI_KeyPress; + b.type = XI_KeyRelease; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&a, &b, TRUE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + a.device = &dev1; + b.device = &dev1; + a.modifierDevice = &dev1; + b.modifierDevice = &dev1; + a.type = XI_KeyPress; + b.type = XI_KeyRelease; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&a, &b, TRUE); + g_assert(rc == FALSE); + + /* different modifiers must fail */ + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.device = &dev1; + b.device = &dev1; + a.modifierDevice = &dev1; + b.modifierDevice = &dev1; + a.type = XI_KeyPress; + b.type = XI_KeyPress; + a.modifiersDetail.exact = 1; + b.modifiersDetail.exact = 2; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + /* AnyModifier must fail for XI2 */ + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.modifiersDetail.exact = AnyModifier; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + /* XIAnyModifier must fail for CORE and XI */ + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + a.modifiersDetail.exact = XIAnyModifier; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + a.modifiersDetail.exact = XIAnyModifier; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + /* different detail must fail */ + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.detail.exact = 1; + b.detail.exact = 2; + a.modifiersDetail.exact = 1; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + /* detail of AnyModifier must fail */ + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.detail.exact = AnyModifier; + b.detail.exact = 1; + a.modifiersDetail.exact = 1; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + /* detail of XIAnyModifier must fail */ + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.detail.exact = XIAnyModifier; + b.detail.exact = 1; + a.modifiersDetail.exact = 1; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == FALSE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == FALSE); + + /* XIAnyModifier or AnyModifer must succeed */ + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.detail.exact = 1; + b.detail.exact = 1; + a.modifiersDetail.exact = XIAnyModifier; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == TRUE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == TRUE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + a.detail.exact = 1; + b.detail.exact = 1; + a.modifiersDetail.exact = AnyModifier; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == TRUE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == TRUE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + a.detail.exact = 1; + b.detail.exact = 1; + a.modifiersDetail.exact = AnyModifier; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == TRUE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == TRUE); + + /* AnyKey or XIAnyKeycode must succeed */ + a.grabtype = GRABTYPE_XI2; + b.grabtype = GRABTYPE_XI2; + a.detail.exact = XIAnyKeycode; + b.detail.exact = 1; + a.modifiersDetail.exact = 1; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == TRUE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == TRUE); + + a.grabtype = GRABTYPE_CORE; + b.grabtype = GRABTYPE_CORE; + a.detail.exact = AnyKey; + b.detail.exact = 1; + a.modifiersDetail.exact = 1; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == TRUE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == TRUE); + + a.grabtype = GRABTYPE_XI; + b.grabtype = GRABTYPE_XI; + a.detail.exact = AnyKey; + b.detail.exact = 1; + a.modifiersDetail.exact = 1; + b.modifiersDetail.exact = 1; + rc = GrabMatchesSecond(&a, &b, FALSE); + g_assert(rc == TRUE); + rc = GrabMatchesSecond(&b, &a, FALSE); + g_assert(rc == TRUE); +} + +static void test_bits_to_byte(int i) +{ + int expected_bytes; + expected_bytes = (i + 7)/8; + + g_assert(bits_to_bytes(i) >= i/8); + g_assert((bits_to_bytes(i) * 8) - i <= 7); + g_assert(expected_bytes == bits_to_bytes(i)); +} + +static void test_bytes_to_int32(int i) +{ + int expected_4byte; + expected_4byte = (i + 3)/4; + + g_assert(bytes_to_int32(i) <= i); + g_assert((bytes_to_int32(i) * 4) - i <= 3); + g_assert(expected_4byte == bytes_to_int32(i)); +} + +static void test_pad_to_int32(int i) +{ + int expected_bytes; + expected_bytes = ((i + 3)/4) * 4; + + g_assert(pad_to_int32(i) >= i); + g_assert(pad_to_int32(i) - i <= 3); + g_assert(expected_bytes == pad_to_int32(i)); +} +static void include_byte_padding_macros(void) +{ + g_test_message("Testing bits_to_bytes()"); + + /* the macros don't provide overflow protection */ + test_bits_to_byte(0); + test_bits_to_byte(1); + test_bits_to_byte(2); + test_bits_to_byte(7); + test_bits_to_byte(8); + test_bits_to_byte(0xFF); + test_bits_to_byte(0x100); + test_bits_to_byte(INT_MAX - 9); + test_bits_to_byte(INT_MAX - 8); + + g_test_message("Testing bytes_to_int32()"); + + test_bytes_to_int32(0); + test_bytes_to_int32(1); + test_bytes_to_int32(2); + test_bytes_to_int32(7); + test_bytes_to_int32(8); + test_bytes_to_int32(0xFF); + test_bytes_to_int32(0x100); + test_bytes_to_int32(0xFFFF); + test_bytes_to_int32(0x10000); + test_bytes_to_int32(0xFFFFFF); + test_bytes_to_int32(0x1000000); + test_bytes_to_int32(INT_MAX - 4); + test_bytes_to_int32(INT_MAX - 3); + + g_test_message("Testing pad_to_int32"); + + test_pad_to_int32(0); + test_pad_to_int32(0); + test_pad_to_int32(1); + test_pad_to_int32(2); + test_pad_to_int32(7); + test_pad_to_int32(8); + test_pad_to_int32(0xFF); + test_pad_to_int32(0x100); + test_pad_to_int32(0xFFFF); + test_pad_to_int32(0x10000); + test_pad_to_int32(0xFFFFFF); + test_pad_to_int32(0x1000000); + test_pad_to_int32(INT_MAX - 4); + test_pad_to_int32(INT_MAX - 3); +} + +static void xi_unregister_handlers(void) +{ + DeviceIntRec dev; + int handler; + + memset(&dev, 0, sizeof(dev)); + + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 1); + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 2); + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 3); + + g_test_message("Unlinking from front."); + + XIUnregisterPropertyHandler(&dev, 4); /* NOOP */ + g_assert(dev.properties.handlers->id == 3); + XIUnregisterPropertyHandler(&dev, 3); + g_assert(dev.properties.handlers->id == 2); + XIUnregisterPropertyHandler(&dev, 2); + g_assert(dev.properties.handlers->id == 1); + XIUnregisterPropertyHandler(&dev, 1); + g_assert(dev.properties.handlers == NULL); + + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 4); + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 5); + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 6); + XIUnregisterPropertyHandler(&dev, 3); /* NOOP */ + g_assert(dev.properties.handlers->next->next->next == NULL); + XIUnregisterPropertyHandler(&dev, 4); + g_assert(dev.properties.handlers->next->next == NULL); + XIUnregisterPropertyHandler(&dev, 5); + g_assert(dev.properties.handlers->next == NULL); + XIUnregisterPropertyHandler(&dev, 6); + g_assert(dev.properties.handlers == NULL); + + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 7); + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 8); + handler = XIRegisterPropertyHandler(&dev, NULL, NULL, NULL); + g_assert(handler == 9); + + XIDeleteAllDeviceProperties(&dev); + g_assert(dev.properties.handlers == NULL); + XIUnregisterPropertyHandler(&dev, 7); /* NOOP */ + +} + +static void cmp_attr_fields(InputAttributes *attr1, + InputAttributes *attr2) +{ + char **tags1, **tags2; + + g_assert(attr1 && attr2); + g_assert(attr1 != attr2); + g_assert(attr1->flags == attr2->flags); + + if (attr1->product != NULL) + { + g_assert(attr1->product != attr2->product); + g_assert(strcmp(attr1->product, attr2->product) == 0); + } else + g_assert(attr2->product == NULL); + + if (attr1->vendor != NULL) + { + g_assert(attr1->vendor != attr2->vendor); + g_assert(strcmp(attr1->vendor, attr2->vendor) == 0); + } else + g_assert(attr2->vendor == NULL); + + if (attr1->device != NULL) + { + g_assert(attr1->device != attr2->device); + g_assert(strcmp(attr1->device, attr2->device) == 0); + } else + g_assert(attr2->device == NULL); + + if (attr1->pnp_id != NULL) + { + g_assert(attr1->pnp_id != attr2->pnp_id); + g_assert(strcmp(attr1->pnp_id, attr2->pnp_id) == 0); + } else + g_assert(attr2->pnp_id == NULL); + + if (attr1->usb_id != NULL) + { + g_assert(attr1->usb_id != attr2->usb_id); + g_assert(strcmp(attr1->usb_id, attr2->usb_id) == 0); + } else + g_assert(attr2->usb_id == NULL); + + tags1 = attr1->tags; + tags2 = attr2->tags; + + /* if we don't have any tags, skip the tag checking bits */ + if (!tags1) + { + g_assert(!tags2); + return; + } + + /* Don't lug around empty arrays */ + g_assert(*tags1); + g_assert(*tags2); + + /* check for identical content, but duplicated */ + while (*tags1) + { + g_assert(*tags1 != *tags2); + g_assert(strcmp(*tags1, *tags2) == 0); + tags1++; + tags2++; + } + + /* ensure tags1 and tags2 have the same no of elements */ + g_assert(!*tags2); + + /* check for not sharing memory */ + tags1 = attr1->tags; + while (*tags1) + { + tags2 = attr2->tags; + while (*tags2) + g_assert(*tags1 != *tags2++); + + tags1++; + } +} + +static void dix_input_attributes(void) +{ + InputAttributes orig = {0}; + InputAttributes *new; + char *tags[4] = {"tag1", "tag2", "tag2", NULL}; + + new = DuplicateInputAttributes(NULL); + g_assert(!new); + + new = DuplicateInputAttributes(&orig); + g_assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0); + + orig.product = "product name"; + new = DuplicateInputAttributes(&orig); + cmp_attr_fields(&orig, new); + FreeInputAttributes(new); + + orig.vendor = "vendor name"; + new = DuplicateInputAttributes(&orig); + cmp_attr_fields(&orig, new); + FreeInputAttributes(new); + + orig.device = "device path"; + new = DuplicateInputAttributes(&orig); + cmp_attr_fields(&orig, new); + FreeInputAttributes(new); + + orig.pnp_id = "PnPID"; + new = DuplicateInputAttributes(&orig); + cmp_attr_fields(&orig, new); + FreeInputAttributes(new); + + orig.usb_id = "USBID"; + new = DuplicateInputAttributes(&orig); + cmp_attr_fields(&orig, new); + FreeInputAttributes(new); + + orig.flags = 0xF0; + new = DuplicateInputAttributes(&orig); + cmp_attr_fields(&orig, new); + FreeInputAttributes(new); + + orig.tags = tags; + new = DuplicateInputAttributes(&orig); + cmp_attr_fields(&orig, new); + FreeInputAttributes(new); +} + +static void dix_input_valuator_masks(void) +{ + ValuatorMask *mask = NULL, *copy; + int nvaluators = MAX_VALUATORS; + int valuators[nvaluators]; + int i; + int first_val, num_vals; + + for (i = 0; i < nvaluators; i++) + valuators[i] = i; + + mask = valuator_mask_new(nvaluators); + g_assert(mask != NULL); + g_assert(valuator_mask_size(mask) == 0); + g_assert(valuator_mask_num_valuators(mask) == 0); + + for (i = 0; i < nvaluators; i++) + { + g_assert(!valuator_mask_isset(mask, i)); + valuator_mask_set(mask, i, valuators[i]); + g_assert(valuator_mask_isset(mask, i)); + g_assert(valuator_mask_get(mask, i) == valuators[i]); + g_assert(valuator_mask_size(mask) == i + 1); + g_assert(valuator_mask_num_valuators(mask) == i + 1); + } + + for (i = 0; i < nvaluators; i++) + { + g_assert(valuator_mask_isset(mask, i)); + valuator_mask_unset(mask, i); + /* we're removing valuators from the front, so size should stay the + * same until the last bit is removed */ + if (i < nvaluators - 1) + g_assert(valuator_mask_size(mask) == nvaluators); + g_assert(!valuator_mask_isset(mask, i)); + } + + g_assert(valuator_mask_size(mask) == 0); + valuator_mask_zero(mask); + g_assert(valuator_mask_size(mask) == 0); + g_assert(valuator_mask_num_valuators(mask) == 0); + for (i = 0; i < nvaluators; i++) + g_assert(!valuator_mask_isset(mask, i)); + + first_val = 5; + num_vals = 6; + + valuator_mask_set_range(mask, first_val, num_vals, valuators); + g_assert(valuator_mask_size(mask) == first_val + num_vals); + g_assert(valuator_mask_num_valuators(mask) == num_vals); + for (i = 0; i < nvaluators; i++) + { + if (i < first_val || i >= first_val + num_vals) + g_assert(!valuator_mask_isset(mask, i)); + else + { + g_assert(valuator_mask_isset(mask, i)); + g_assert(valuator_mask_get(mask, i) == valuators[i - first_val]); + } + } + + copy = valuator_mask_new(nvaluators); + valuator_mask_copy(copy, mask); + g_assert(mask != copy); + g_assert(valuator_mask_size(mask) == valuator_mask_size(copy)); + g_assert(valuator_mask_num_valuators(mask) == valuator_mask_num_valuators(copy)); + + for (i = 0; i < nvaluators; i++) + { + g_assert(valuator_mask_isset(mask, i) == valuator_mask_isset(copy, i)); + g_assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i)); + } + + valuator_mask_free(&mask); + g_assert(mask == NULL); +} + +static void dix_valuator_mode(void) +{ + DeviceIntRec dev; + const int num_axes = MAX_VALUATORS; + int i; + Atom atoms[MAX_VALUATORS] = { 0 }; + + memset(&dev, 0, sizeof(DeviceIntRec)); + dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ + + g_assert(InitValuatorClassDeviceStruct(NULL, 0, atoms, 0, 0) == FALSE); + g_assert(InitValuatorClassDeviceStruct(&dev, num_axes, atoms, 0, Absolute)); + + for (i = 0; i < num_axes; i++) + { + g_assert(valuator_get_mode(&dev, i) == Absolute); + valuator_set_mode(&dev, i, Relative); + g_assert(dev.valuator->axes[i].mode == Relative); + g_assert(valuator_get_mode(&dev, i) == Relative); + } + + valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Absolute); + for (i = 0; i < num_axes; i++) + g_assert(valuator_get_mode(&dev, i) == Absolute); + + valuator_set_mode(&dev, VALUATOR_MODE_ALL_AXES, Relative); + for (i = 0; i < num_axes; i++) + g_assert(valuator_get_mode(&dev, i) == Relative); +} + +static void include_bit_test_macros(void) +{ + uint8_t mask[9] = { 0 }; + int i; + + for (i = 0; i < sizeof(mask)/sizeof(mask[0]); i++) + { + g_assert(BitIsOn(mask, i) == 0); + SetBit(mask, i); + g_assert(BitIsOn(mask, i) == 1); + g_assert(!!(mask[i/8] & (1 << (i % 8)))); + g_assert(CountBits(mask, sizeof(mask)) == 1); + ClearBit(mask, i); + g_assert(BitIsOn(mask, i) == 0); + } +} + +int main(int argc, char** argv) +{ + g_test_init(&argc, &argv,NULL); + g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id="); + + g_test_add_func("/dix/input/valuator-masks", dix_input_valuator_masks); + g_test_add_func("/dix/input/attributes", dix_input_attributes); + g_test_add_func("/dix/input/init-valuators", dix_init_valuators); + g_test_add_func("/dix/input/event-core-conversion", dix_event_to_core_conversion); + g_test_add_func("/dix/input/check-grab-values", dix_check_grab_values); + g_test_add_func("/dix/input/xi2-struct-sizes", xi2_struct_sizes); + g_test_add_func("/dix/input/grab_matching", dix_grab_matching); + g_test_add_func("/dix/input/valuator_mode", dix_valuator_mode); + g_test_add_func("/include/byte_padding_macros", include_byte_padding_macros); + g_test_add_func("/include/bit_test_macros", include_bit_test_macros); + g_test_add_func("/Xi/xiproperty/register-unregister", xi_unregister_handlers); + + + return g_test_run(); +} diff --git a/xorg-server/test/xi2/protocol-eventconvert.c b/xorg-server/test/xi2/protocol-eventconvert.c index 8184886c0..0478c33fe 100644 --- a/xorg-server/test/xi2/protocol-eventconvert.c +++ b/xorg-server/test/xi2/protocol-eventconvert.c @@ -1,907 +1,917 @@ -/** - * Copyright © 2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include - -#include "inputstr.h" -#include "eventstr.h" -#include "eventconvert.h" -#include "exevents.h" -#include - - -static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out, - BOOL swap) -{ - int i; - unsigned char *ptr; - FP3232 *value, *raw_value; - int nvals = 0; - int bits_set; - int len; - - if (swap) - { - char n; - - swaps(&out->sequenceNumber, n); - swapl(&out->length, n); - swaps(&out->evtype, n); - swaps(&out->deviceid, n); - swapl(&out->time, n); - swapl(&out->detail, n); - swaps(&out->valuators_len, n); - } - - - g_assert(out->type == GenericEvent); - g_assert(out->extension == 0); /* IReqCode defaults to 0 */ - g_assert(out->evtype == GetXI2Type((InternalEvent*)in)); - g_assert(out->time == in->time); - g_assert(out->detail == in->detail.button); - g_assert(out->deviceid == in->deviceid); - g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask)))); - g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */ - - ptr = (unsigned char*)&out[1]; - bits_set = 0; - - for (i = 0; out->valuators_len && i < sizeof(in->valuators.mask) * 8; i++) - { - g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i)); - if (XIMaskIsSet(in->valuators.mask, i)) - bits_set++; - } - - /* length is len of valuator mask (in 4-byte units) + the number of bits - * set. Each bit set represents 2 8-byte values, hence the - * 'bits_set * 4' */ - len = out->valuators_len + bits_set * 4; - g_assert(out->length == len); - - nvals = 0; - - for (i = 0; out->valuators_len && i < MAX_VALUATORS; i++) - { - g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i)); - if (XIMaskIsSet(in->valuators.mask, i)) - { - FP3232 vi, vo; - value = (FP3232*)(((unsigned char*)&out[1]) + out->valuators_len * 4); - value += nvals; - - vi.integral = in->valuators.data[i]; - vi.frac = in->valuators.data_frac[i]; - - vo.integral = value->integral; - vo.frac = value->frac; - if (swap) - { - char n; - swapl(&vo.integral, n); - swapl(&vo.frac, n); - } - - g_assert(vi.integral == vo.integral); - g_assert(vi.frac == vo.frac); - - raw_value = value + bits_set; - - vi.integral = in->valuators.data_raw[i]; - vi.frac = in->valuators.data_raw_frac[i]; - - vo.integral = raw_value->integral; - vo.frac = raw_value->frac; - if (swap) - { - char n; - swapl(&vo.integral, n); - swapl(&vo.frac, n); - } - - g_assert(vi.integral == vo.integral); - g_assert(vi.frac == vo.frac); - - nvals++; - } - } -} - -static void test_XIRawEvent(RawDeviceEvent *in) -{ - xXIRawEvent *out, *swapped; - int rc; - - rc = EventToXI2((InternalEvent*)in, (xEvent**)&out); - g_assert(rc == Success); - - test_values_XIRawEvent(in, out, FALSE); - - swapped = calloc(1, sizeof(xEvent) + out->length * 4); - XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped); - test_values_XIRawEvent(in, swapped, TRUE); - - free(out); - free(swapped); -} - -static void test_convert_XIFocusEvent(void) -{ - xEvent *out; - DeviceEvent in; - int rc; - - in.header = ET_Internal; - in.type = ET_Enter; - rc = EventToXI2((InternalEvent*)&in, &out); - g_assert(rc == Success); - g_assert(out == NULL); - - in.header = ET_Internal; - in.type = ET_FocusIn; - rc = EventToXI2((InternalEvent*)&in, &out); - g_assert(rc == Success); - g_assert(out == NULL); - - in.header = ET_Internal; - in.type = ET_FocusOut; - rc = EventToXI2((InternalEvent*)&in, &out); - g_assert(rc == BadImplementation); - - in.header = ET_Internal; - in.type = ET_Leave; - rc = EventToXI2((InternalEvent*)&in, &out); - g_assert(rc == BadImplementation); -} - - -static void test_convert_XIRawEvent(void) -{ - RawDeviceEvent in; - int i; - - memset(&in, 0, sizeof(in)); - - g_test_message("Testing all event types"); - in.header = ET_Internal; - in.type = ET_RawMotion; - test_XIRawEvent(&in); - - in.header = ET_Internal; - in.type = ET_RawKeyPress; - test_XIRawEvent(&in); - - in.header = ET_Internal; - in.type = ET_RawKeyRelease; - test_XIRawEvent(&in); - - in.header = ET_Internal; - in.type = ET_RawButtonPress; - test_XIRawEvent(&in); - - in.header = ET_Internal; - in.type = ET_RawButtonRelease; - test_XIRawEvent(&in); - - g_test_message("Testing details and other fields"); - in.detail.button = 1L; - test_XIRawEvent(&in); - in.detail.button = 1L << 8; - test_XIRawEvent(&in); - in.detail.button = 1L << 16; - test_XIRawEvent(&in); - in.detail.button = 1L << 24; - test_XIRawEvent(&in); - in.detail.button = ~0L; - test_XIRawEvent(&in); - - in.detail.button = 0; - - in.time = 1L; - test_XIRawEvent(&in); - in.time = 1L << 8; - test_XIRawEvent(&in); - in.time = 1L << 16; - test_XIRawEvent(&in); - in.time = 1L << 24; - test_XIRawEvent(&in); - in.time = ~0L; - test_XIRawEvent(&in); - - in.deviceid = 1; - test_XIRawEvent(&in); - in.deviceid = 1 << 8; - test_XIRawEvent(&in); - in.deviceid = ~0 & 0xFF; - test_XIRawEvent(&in); - - g_test_message("Testing valuator masks"); - for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) - { - XISetMask(in.valuators.mask, i); - test_XIRawEvent(&in); - XIClearMask(in.valuators.mask, i); - } - - for (i = 0; i < MAX_VALUATORS; i++) - { - XISetMask(in.valuators.mask, i); - - in.valuators.data[i] = i; - in.valuators.data_raw[i] = i + 10; - in.valuators.data_frac[i] = i + 20; - in.valuators.data_raw_frac[i] = i + 30; - test_XIRawEvent(&in); - XIClearMask(in.valuators.mask, i); - } - - for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) - { - XISetMask(in.valuators.mask, i); - test_XIRawEvent(&in); - } -} - -static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out, - BOOL swap) -{ - int buttons, valuators; - int i; - unsigned char *ptr; - FP3232 *values; - - if (swap) { - char n; - - swaps(&out->sequenceNumber, n); - swapl(&out->length, n); - swaps(&out->evtype, n); - swaps(&out->deviceid, n); - swaps(&out->sourceid, n); - swapl(&out->time, n); - swapl(&out->detail, n); - swapl(&out->root, n); - swapl(&out->event, n); - swapl(&out->child, n); - swapl(&out->root_x, n); - swapl(&out->root_y, n); - swapl(&out->event_x, n); - swapl(&out->event_y, n); - swaps(&out->buttons_len, n); - swaps(&out->valuators_len, n); - swapl(&out->mods.base_mods, n); - swapl(&out->mods.latched_mods, n); - swapl(&out->mods.locked_mods, n); - swapl(&out->mods.effective_mods, n); - } - - g_assert(out->extension == 0); /* IReqCode defaults to 0 */ - g_assert(out->evtype == GetXI2Type((InternalEvent*)in)); - g_assert(out->time == in->time); - g_assert(out->detail == in->detail.button); - g_assert(out->length >= 12); - - g_assert(out->deviceid == in->deviceid); - g_assert(out->sourceid == in->sourceid); - - g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */ - - g_assert(out->root == in->root); - g_assert(out->event == None); /* set in FixUpEventFromWindow */ - g_assert(out->child == None); /* set in FixUpEventFromWindow */ - - g_assert(out->mods.base_mods == in->mods.base); - g_assert(out->mods.latched_mods == in->mods.latched); - g_assert(out->mods.locked_mods == in->mods.locked); - g_assert(out->mods.effective_mods == in->mods.effective); - - g_assert(out->group.base_group == in->group.base); - g_assert(out->group.latched_group == in->group.latched); - g_assert(out->group.locked_group == in->group.locked); - g_assert(out->group.effective_group == in->group.effective); - - g_assert(out->event_x == 0); /* set in FixUpEventFromWindow */ - g_assert(out->event_y == 0); /* set in FixUpEventFromWindow */ - - g_assert(out->root_x == FP1616(in->root_x, in->root_x_frac)); - g_assert(out->root_y == FP1616(in->root_y, in->root_y_frac)); - - buttons = 0; - for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++) - { - if (XIMaskIsSet(in->buttons, i)) - { - g_assert(out->buttons_len >= bytes_to_int32(bits_to_bytes(i))); - buttons++; - } - } - - ptr = (unsigned char*)&out[1]; - for (i = 0; i < sizeof(in->buttons) * 8; i++) - g_assert(XIMaskIsSet(in->buttons, i) == XIMaskIsSet(ptr, i)); - - - valuators = 0; - for (i = 0; i < sizeof(in->valuators.mask) * 8; i++) - if (XIMaskIsSet(in->valuators.mask, i)) - valuators++; - - g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(valuators))); - - ptr += out->buttons_len * 4; - values = (FP3232*)(ptr + out->valuators_len * 4); - for (i = 0; i < sizeof(in->valuators.mask) * 8 || - i < (out->valuators_len * 4) * 8; i++) - { - if (i > sizeof(in->valuators.mask) * 8) - g_assert(!XIMaskIsSet(ptr, i)); - else if (i > out->valuators_len * 4 * 8) - g_assert(!XIMaskIsSet(in->valuators.mask, i)); - else { - g_assert(XIMaskIsSet(in->valuators.mask, i) == - XIMaskIsSet(ptr, i)); - - if (XIMaskIsSet(ptr, i)) - { - FP3232 vi, vo; - - vi.integral = in->valuators.data[i]; - vi.frac = in->valuators.data_frac[i]; - - vo = *values; - - if (swap) - { - char n; - swapl(&vo.integral, n); - swapl(&vo.frac, n); - } - - - g_assert(vi.integral == vo.integral); - g_assert(vi.frac == vo.frac); - values++; - } - } - } -} - -static void test_XIDeviceEvent(DeviceEvent *in) -{ - xXIDeviceEvent *out, *swapped; - int rc; - - rc = EventToXI2((InternalEvent*)in, (xEvent**)&out); - g_assert(rc == Success); - - test_values_XIDeviceEvent(in, out, FALSE); - - swapped = calloc(1, sizeof(xEvent) + out->length * 4); - XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped); - test_values_XIDeviceEvent(in, swapped, TRUE); - - free(out); - free(swapped); -} - -static void test_convert_XIDeviceEvent(void) -{ - DeviceEvent in; - int i; - - memset(&in, 0, sizeof(in)); - - g_test_message("Testing simple field values"); - in.header = ET_Internal; - in.type = ET_Motion; - in.length = sizeof(DeviceEvent); - in.time = 0; - in.deviceid = 1; - in.sourceid = 2; - in.root = 3; - in.root_x = 4; - in.root_x_frac = 5; - in.root_y = 6; - in.root_y_frac = 7; - in.detail.button = 8; - in.mods.base = 9; - in.mods.latched = 10; - in.mods.locked = 11; - in.mods.effective = 11; - in.group.base = 12; - in.group.latched = 13; - in.group.locked = 14; - in.group.effective = 15; - - test_XIDeviceEvent(&in); - - g_test_message("Testing field ranges"); - /* 32 bit */ - in.detail.button = 1L; - test_XIDeviceEvent(&in); - in.detail.button = 1L << 8; - test_XIDeviceEvent(&in); - in.detail.button = 1L << 16; - test_XIDeviceEvent(&in); - in.detail.button = 1L << 24; - test_XIDeviceEvent(&in); - in.detail.button = ~0L; - test_XIDeviceEvent(&in); - - /* 32 bit */ - in.time = 1L; - test_XIDeviceEvent(&in); - in.time = 1L << 8; - test_XIDeviceEvent(&in); - in.time = 1L << 16; - test_XIDeviceEvent(&in); - in.time = 1L << 24; - test_XIDeviceEvent(&in); - in.time = ~0L; - test_XIDeviceEvent(&in); - - /* 16 bit */ - in.deviceid = 1; - test_XIDeviceEvent(&in); - in.deviceid = 1 << 8; - test_XIDeviceEvent(&in); - in.deviceid = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - /* 16 bit */ - in.sourceid = 1; - test_XIDeviceEvent(&in); - in.deviceid = 1 << 8; - test_XIDeviceEvent(&in); - in.deviceid = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - /* 32 bit */ - in.root = 1L; - test_XIDeviceEvent(&in); - in.root = 1L << 8; - test_XIDeviceEvent(&in); - in.root = 1L << 16; - test_XIDeviceEvent(&in); - in.root = 1L << 24; - test_XIDeviceEvent(&in); - in.root = ~0L; - test_XIDeviceEvent(&in); - - /* 16 bit */ - in.root_x = 1; - test_XIDeviceEvent(&in); - in.root_x = 1 << 8; - test_XIDeviceEvent(&in); - in.root_x = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - in.root_x_frac = 1; - test_XIDeviceEvent(&in); - in.root_x_frac = 1 << 8; - test_XIDeviceEvent(&in); - in.root_x_frac = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - in.root_y = 1; - test_XIDeviceEvent(&in); - in.root_y = 1 << 8; - test_XIDeviceEvent(&in); - in.root_y = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - in.root_y_frac = 1; - test_XIDeviceEvent(&in); - in.root_y_frac = 1 << 8; - test_XIDeviceEvent(&in); - in.root_y_frac = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - /* 32 bit */ - in.mods.base = 1L; - test_XIDeviceEvent(&in); - in.mods.base = 1L << 8; - test_XIDeviceEvent(&in); - in.mods.base = 1L << 16; - test_XIDeviceEvent(&in); - in.mods.base = 1L << 24; - test_XIDeviceEvent(&in); - in.mods.base = ~0L; - test_XIDeviceEvent(&in); - - in.mods.latched = 1L; - test_XIDeviceEvent(&in); - in.mods.latched = 1L << 8; - test_XIDeviceEvent(&in); - in.mods.latched = 1L << 16; - test_XIDeviceEvent(&in); - in.mods.latched = 1L << 24; - test_XIDeviceEvent(&in); - in.mods.latched = ~0L; - test_XIDeviceEvent(&in); - - in.mods.locked = 1L; - test_XIDeviceEvent(&in); - in.mods.locked = 1L << 8; - test_XIDeviceEvent(&in); - in.mods.locked = 1L << 16; - test_XIDeviceEvent(&in); - in.mods.locked = 1L << 24; - test_XIDeviceEvent(&in); - in.mods.locked = ~0L; - test_XIDeviceEvent(&in); - - in.mods.effective = 1L; - test_XIDeviceEvent(&in); - in.mods.effective = 1L << 8; - test_XIDeviceEvent(&in); - in.mods.effective = 1L << 16; - test_XIDeviceEvent(&in); - in.mods.effective = 1L << 24; - test_XIDeviceEvent(&in); - in.mods.effective = ~0L; - test_XIDeviceEvent(&in); - - /* 8 bit */ - in.group.base = 1; - test_XIDeviceEvent(&in); - in.group.base = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - in.group.latched = 1; - test_XIDeviceEvent(&in); - in.group.latched = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - in.group.locked = 1; - test_XIDeviceEvent(&in); - in.group.locked = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - in.mods.effective = 1; - test_XIDeviceEvent(&in); - in.mods.effective = ~0 & 0xFF; - test_XIDeviceEvent(&in); - - g_test_message("Testing button masks"); - for (i = 0; i < sizeof(in.buttons) * 8; i++) - { - XISetMask(in.buttons, i); - test_XIDeviceEvent(&in); - XIClearMask(in.buttons, i); - } - - for (i = 0; i < sizeof(in.buttons) * 8; i++) - { - XISetMask(in.buttons, i); - test_XIDeviceEvent(&in); - } - - g_test_message("Testing valuator masks"); - for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) - { - XISetMask(in.valuators.mask, i); - test_XIDeviceEvent(&in); - XIClearMask(in.valuators.mask, i); - } - - for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) - { - XISetMask(in.valuators.mask, i); - - in.valuators.data[i] = i; - in.valuators.data_frac[i] = i + 20; - test_XIDeviceEvent(&in); - XIClearMask(in.valuators.mask, i); - } - - for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) - { - XISetMask(in.valuators.mask, i); - test_XIDeviceEvent(&in); - } -} - -static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in, - xXIDeviceChangedEvent *out, - BOOL swap) -{ - int i, j; - unsigned char *ptr; - - if (swap) - { - char n; - - swaps(&out->sequenceNumber, n); - swapl(&out->length, n); - swaps(&out->evtype, n); - swaps(&out->deviceid, n); - swaps(&out->sourceid, n); - swapl(&out->time, n); - swaps(&out->num_classes, n); - } - - g_assert(out->type == GenericEvent); - g_assert(out->extension == 0); /* IReqCode defaults to 0 */ - g_assert(out->evtype == GetXI2Type((InternalEvent*)in)); - g_assert(out->time == in->time); - g_assert(out->deviceid == in->deviceid); - g_assert(out->sourceid == in->sourceid); - - ptr = (unsigned char*)&out[1]; - for (i = 0; i < out->num_classes; i++) - { - xXIAnyInfo* any = (xXIAnyInfo*)ptr; - - if (swap) - { - char n; - swaps(&any->length, n); - swaps(&any->type, n); - swaps(&any->sourceid, n); - } - - switch(any->type) - { - case XIButtonClass: - { - xXIButtonInfo *b = (xXIButtonInfo*)any; - Atom *names; - - if (swap) - { - char n; - swaps(&b->num_buttons, n); - } - - g_assert(b->length == - bytes_to_int32(sizeof(xXIButtonInfo)) + - bytes_to_int32(bits_to_bytes(b->num_buttons)) + - b->num_buttons); - g_assert(b->num_buttons == in->buttons.num_buttons); - - names = (Atom*)((char*)&b[1] + - pad_to_int32(bits_to_bytes(b->num_buttons))); - for (j = 0; j < b->num_buttons; j++) - { - if (swap) - { - char n; - swapl(&names[j], n); - } - g_assert(names[j] == in->buttons.names[j]); - } - } - break; - case XIKeyClass: - { - xXIKeyInfo *k = (xXIKeyInfo*)any; - uint32_t *kc; - - if (swap) - { - char n; - swaps(&k->num_keycodes, n); - } - - g_assert(k->length == - bytes_to_int32(sizeof(xXIKeyInfo)) + - k->num_keycodes); - g_assert(k->num_keycodes == in->keys.max_keycode - - in->keys.min_keycode + 1); - - kc = (uint32_t*)&k[1]; - for (j = 0; j < k->num_keycodes; j++) - { - if (swap) - { - char n; - swapl(&kc[j], n); - } - g_assert(kc[j] >= in->keys.min_keycode); - g_assert(kc[j] <= in->keys.max_keycode); - } - } - break; - case XIValuatorClass: - { - xXIValuatorInfo *v = (xXIValuatorInfo*)any; - g_assert(v->length == - bytes_to_int32(sizeof(xXIValuatorInfo))); - - } - break; - default: - g_error("Invalid class type.\n"); - break; - } - - ptr += any->length * 4; - } - -} - -static void test_XIDeviceChangedEvent(DeviceChangedEvent *in) -{ - xXIDeviceChangedEvent *out, *swapped; - int rc; - - rc = EventToXI2((InternalEvent*)in, (xEvent**)&out); - g_assert(rc == Success); - - test_values_XIDeviceChangedEvent(in, out, FALSE); - - swapped = calloc(1, sizeof(xEvent) + out->length * 4); - XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped); - test_values_XIDeviceChangedEvent(in, swapped, TRUE); - - free(out); - free(swapped); -} - -static void test_convert_XIDeviceChangedEvent(void) -{ - DeviceChangedEvent in; - int i; - - g_test_message("Testing simple field values"); - memset(&in, 0, sizeof(in)); - in.header = ET_Internal; - in.type = ET_DeviceChanged; - in.length = sizeof(DeviceChangedEvent); - in.time = 0; - in.deviceid = 1; - in.sourceid = 2; - in.masterid = 3; - in.num_valuators = 4; - in.flags = DEVCHANGE_SLAVE_SWITCH | DEVCHANGE_POINTER_EVENT | DEVCHANGE_KEYBOARD_EVENT; - - for (i = 0; i < MAX_BUTTONS; i++) - in.buttons.names[i] = i + 10; - - in.keys.min_keycode = 8; - in.keys.max_keycode = 255; - - test_XIDeviceChangedEvent(&in); - - in.time = 1L; - test_XIDeviceChangedEvent(&in); - in.time = 1L << 8; - test_XIDeviceChangedEvent(&in); - in.time = 1L << 16; - test_XIDeviceChangedEvent(&in); - in.time = 1L << 24; - test_XIDeviceChangedEvent(&in); - in.time = ~0L; - test_XIDeviceChangedEvent(&in); - - in.deviceid = 1L; - test_XIDeviceChangedEvent(&in); - in.deviceid = 1L << 8; - test_XIDeviceChangedEvent(&in); - in.deviceid = ~0 & 0xFFFF; - test_XIDeviceChangedEvent(&in); - - in.sourceid = 1L; - test_XIDeviceChangedEvent(&in); - in.sourceid = 1L << 8; - test_XIDeviceChangedEvent(&in); - in.sourceid = ~0 & 0xFFFF; - test_XIDeviceChangedEvent(&in); - - in.masterid = 1L; - test_XIDeviceChangedEvent(&in); - in.masterid = 1L << 8; - test_XIDeviceChangedEvent(&in); - in.masterid = ~0 & 0xFFFF; - test_XIDeviceChangedEvent(&in); - - in.buttons.num_buttons = 0; - test_XIDeviceChangedEvent(&in); - - in.buttons.num_buttons = 1; - test_XIDeviceChangedEvent(&in); - - in.buttons.num_buttons = MAX_BUTTONS; - test_XIDeviceChangedEvent(&in); - - in.keys.min_keycode = 0; - in.keys.max_keycode = 0; - test_XIDeviceChangedEvent(&in); - - in.keys.max_keycode = 1 << 8; - test_XIDeviceChangedEvent(&in); - - in.keys.max_keycode = 0xFFFC; /* highest range, above that the length - field gives up */ - test_XIDeviceChangedEvent(&in); - - in.keys.min_keycode = 1 << 8; - in.keys.max_keycode = 1 << 8; - test_XIDeviceChangedEvent(&in); - - in.keys.min_keycode = 1 << 8; - in.keys.max_keycode = 0; - test_XIDeviceChangedEvent(&in); - - in.num_valuators = 0; - test_XIDeviceChangedEvent(&in); - - in.num_valuators = 1; - test_XIDeviceChangedEvent(&in); - - in.num_valuators = MAX_VALUATORS; - test_XIDeviceChangedEvent(&in); - - for (i = 0; i < MAX_VALUATORS; i++) - { - in.valuators[i].min = 0; - in.valuators[i].max = 0; - test_XIDeviceChangedEvent(&in); - - in.valuators[i].max = 1 << 8; - test_XIDeviceChangedEvent(&in); - in.valuators[i].max = 1 << 16; - test_XIDeviceChangedEvent(&in); - in.valuators[i].max = 1 << 24; - test_XIDeviceChangedEvent(&in); - in.valuators[i].max = abs(~0); - test_XIDeviceChangedEvent(&in); - - in.valuators[i].resolution = 1 << 8; - test_XIDeviceChangedEvent(&in); - in.valuators[i].resolution = 1 << 16; - test_XIDeviceChangedEvent(&in); - in.valuators[i].resolution = 1 << 24; - test_XIDeviceChangedEvent(&in); - in.valuators[i].resolution = abs(~0); - test_XIDeviceChangedEvent(&in); - - in.valuators[i].name = i; - test_XIDeviceChangedEvent(&in); - - in.valuators[i].mode = Relative; - test_XIDeviceChangedEvent(&in); - - in.valuators[i].mode = Absolute; - test_XIDeviceChangedEvent(&in); - } -} - -int main(int argc, char** argv) -{ - g_test_init(&argc, &argv,NULL); - g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id="); - - g_test_add_func("/xi2/eventconvert/XIRawEvent", test_convert_XIRawEvent); - g_test_add_func("/xi2/eventconvert/XIFocusEvent", test_convert_XIFocusEvent); - g_test_add_func("/xi2/eventconvert/XIDeviceEvent", test_convert_XIDeviceEvent); - g_test_add_func("/xi2/eventconvert/XIDeviceChangedEvent", test_convert_XIDeviceChangedEvent); - - return g_test_run(); -} +/** + * Copyright © 2009 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include + +#include "inputstr.h" +#include "eventstr.h" +#include "eventconvert.h" +#include "exevents.h" +#include + + +static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out, + BOOL swap) +{ + int i; + unsigned char *ptr; + FP3232 *value, *raw_value; + int nvals = 0; + int bits_set; + int len; + + if (swap) + { + char n; + + swaps(&out->sequenceNumber, n); + swapl(&out->length, n); + swaps(&out->evtype, n); + swaps(&out->deviceid, n); + swapl(&out->time, n); + swapl(&out->detail, n); + swaps(&out->valuators_len, n); + } + + + g_assert(out->type == GenericEvent); + g_assert(out->extension == 0); /* IReqCode defaults to 0 */ + g_assert(out->evtype == GetXI2Type((InternalEvent*)in)); + g_assert(out->time == in->time); + g_assert(out->detail == in->detail.button); + g_assert(out->deviceid == in->deviceid); + g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask)))); + g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */ + + ptr = (unsigned char*)&out[1]; + bits_set = 0; + + for (i = 0; out->valuators_len && i < sizeof(in->valuators.mask) * 8; i++) + { + g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i)); + if (XIMaskIsSet(in->valuators.mask, i)) + bits_set++; + } + + /* length is len of valuator mask (in 4-byte units) + the number of bits + * set. Each bit set represents 2 8-byte values, hence the + * 'bits_set * 4' */ + len = out->valuators_len + bits_set * 4; + g_assert(out->length == len); + + nvals = 0; + + for (i = 0; out->valuators_len && i < MAX_VALUATORS; i++) + { + g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i)); + if (XIMaskIsSet(in->valuators.mask, i)) + { + FP3232 vi, vo; + value = (FP3232*)(((unsigned char*)&out[1]) + out->valuators_len * 4); + value += nvals; + + vi.integral = in->valuators.data[i]; + vi.frac = in->valuators.data_frac[i]; + + vo.integral = value->integral; + vo.frac = value->frac; + if (swap) + { + char n; + swapl(&vo.integral, n); + swapl(&vo.frac, n); + } + + g_assert(vi.integral == vo.integral); + g_assert(vi.frac == vo.frac); + + raw_value = value + bits_set; + + vi.integral = in->valuators.data_raw[i]; + vi.frac = in->valuators.data_raw_frac[i]; + + vo.integral = raw_value->integral; + vo.frac = raw_value->frac; + if (swap) + { + char n; + swapl(&vo.integral, n); + swapl(&vo.frac, n); + } + + g_assert(vi.integral == vo.integral); + g_assert(vi.frac == vo.frac); + + nvals++; + } + } +} + +static void test_XIRawEvent(RawDeviceEvent *in) +{ + xXIRawEvent *out, *swapped; + int rc; + + rc = EventToXI2((InternalEvent*)in, (xEvent**)&out); + g_assert(rc == Success); + + test_values_XIRawEvent(in, out, FALSE); + + swapped = calloc(1, sizeof(xEvent) + out->length * 4); + XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped); + test_values_XIRawEvent(in, swapped, TRUE); + + free(out); + free(swapped); +} + +static void test_convert_XIFocusEvent(void) +{ + xEvent *out; + DeviceEvent in; + int rc; + + in.header = ET_Internal; + in.type = ET_Enter; + rc = EventToXI2((InternalEvent*)&in, &out); + g_assert(rc == Success); + g_assert(out == NULL); + + in.header = ET_Internal; + in.type = ET_FocusIn; + rc = EventToXI2((InternalEvent*)&in, &out); + g_assert(rc == Success); + g_assert(out == NULL); + + in.header = ET_Internal; + in.type = ET_FocusOut; + rc = EventToXI2((InternalEvent*)&in, &out); + g_assert(rc == BadImplementation); + + in.header = ET_Internal; + in.type = ET_Leave; + rc = EventToXI2((InternalEvent*)&in, &out); + g_assert(rc == BadImplementation); +} + + +static void test_convert_XIRawEvent(void) +{ + RawDeviceEvent in; + int i; + + memset(&in, 0, sizeof(in)); + + g_test_message("Testing all event types"); + in.header = ET_Internal; + in.type = ET_RawMotion; + test_XIRawEvent(&in); + + in.header = ET_Internal; + in.type = ET_RawKeyPress; + test_XIRawEvent(&in); + + in.header = ET_Internal; + in.type = ET_RawKeyRelease; + test_XIRawEvent(&in); + + in.header = ET_Internal; + in.type = ET_RawButtonPress; + test_XIRawEvent(&in); + + in.header = ET_Internal; + in.type = ET_RawButtonRelease; + test_XIRawEvent(&in); + + g_test_message("Testing details and other fields"); + in.detail.button = 1L; + test_XIRawEvent(&in); + in.detail.button = 1L << 8; + test_XIRawEvent(&in); + in.detail.button = 1L << 16; + test_XIRawEvent(&in); + in.detail.button = 1L << 24; + test_XIRawEvent(&in); + in.detail.button = ~0L; + test_XIRawEvent(&in); + + in.detail.button = 0; + + in.time = 1L; + test_XIRawEvent(&in); + in.time = 1L << 8; + test_XIRawEvent(&in); + in.time = 1L << 16; + test_XIRawEvent(&in); + in.time = 1L << 24; + test_XIRawEvent(&in); + in.time = ~0L; + test_XIRawEvent(&in); + + in.deviceid = 1; + test_XIRawEvent(&in); + in.deviceid = 1 << 8; + test_XIRawEvent(&in); + in.deviceid = ~0 & 0xFF; + test_XIRawEvent(&in); + + g_test_message("Testing valuator masks"); + for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) + { + XISetMask(in.valuators.mask, i); + test_XIRawEvent(&in); + XIClearMask(in.valuators.mask, i); + } + + for (i = 0; i < MAX_VALUATORS; i++) + { + XISetMask(in.valuators.mask, i); + + in.valuators.data[i] = i; + in.valuators.data_raw[i] = i + 10; + in.valuators.data_frac[i] = i + 20; + in.valuators.data_raw_frac[i] = i + 30; + test_XIRawEvent(&in); + XIClearMask(in.valuators.mask, i); + } + + for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) + { + XISetMask(in.valuators.mask, i); + test_XIRawEvent(&in); + } +} + +static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out, + BOOL swap) +{ + int buttons, valuators; + int i; + unsigned char *ptr; + uint32_t flagmask = 0; + FP3232 *values; + + if (swap) { + char n; + + swaps(&out->sequenceNumber, n); + swapl(&out->length, n); + swaps(&out->evtype, n); + swaps(&out->deviceid, n); + swaps(&out->sourceid, n); + swapl(&out->time, n); + swapl(&out->detail, n); + swapl(&out->root, n); + swapl(&out->event, n); + swapl(&out->child, n); + swapl(&out->root_x, n); + swapl(&out->root_y, n); + swapl(&out->event_x, n); + swapl(&out->event_y, n); + swaps(&out->buttons_len, n); + swaps(&out->valuators_len, n); + swapl(&out->mods.base_mods, n); + swapl(&out->mods.latched_mods, n); + swapl(&out->mods.locked_mods, n); + swapl(&out->mods.effective_mods, n); + swapl(&out->flags, n); + } + + g_assert(out->extension == 0); /* IReqCode defaults to 0 */ + g_assert(out->evtype == GetXI2Type((InternalEvent*)in)); + g_assert(out->time == in->time); + g_assert(out->detail == in->detail.button); + g_assert(out->length >= 12); + + g_assert(out->deviceid == in->deviceid); + g_assert(out->sourceid == in->sourceid); + + switch (in->type) { + case ET_KeyPress: + flagmask = XIKeyRepeat; + break; + default: + flagmask = 0; + break; + } + g_assert((out->flags & ~flagmask) == 0); + + g_assert(out->root == in->root); + g_assert(out->event == None); /* set in FixUpEventFromWindow */ + g_assert(out->child == None); /* set in FixUpEventFromWindow */ + + g_assert(out->mods.base_mods == in->mods.base); + g_assert(out->mods.latched_mods == in->mods.latched); + g_assert(out->mods.locked_mods == in->mods.locked); + g_assert(out->mods.effective_mods == in->mods.effective); + + g_assert(out->group.base_group == in->group.base); + g_assert(out->group.latched_group == in->group.latched); + g_assert(out->group.locked_group == in->group.locked); + g_assert(out->group.effective_group == in->group.effective); + + g_assert(out->event_x == 0); /* set in FixUpEventFromWindow */ + g_assert(out->event_y == 0); /* set in FixUpEventFromWindow */ + + g_assert(out->root_x == FP1616(in->root_x, in->root_x_frac)); + g_assert(out->root_y == FP1616(in->root_y, in->root_y_frac)); + + buttons = 0; + for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++) + { + if (XIMaskIsSet(in->buttons, i)) + { + g_assert(out->buttons_len >= bytes_to_int32(bits_to_bytes(i))); + buttons++; + } + } + + ptr = (unsigned char*)&out[1]; + for (i = 0; i < sizeof(in->buttons) * 8; i++) + g_assert(XIMaskIsSet(in->buttons, i) == XIMaskIsSet(ptr, i)); + + + valuators = 0; + for (i = 0; i < sizeof(in->valuators.mask) * 8; i++) + if (XIMaskIsSet(in->valuators.mask, i)) + valuators++; + + g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(valuators))); + + ptr += out->buttons_len * 4; + values = (FP3232*)(ptr + out->valuators_len * 4); + for (i = 0; i < sizeof(in->valuators.mask) * 8 || + i < (out->valuators_len * 4) * 8; i++) + { + if (i > sizeof(in->valuators.mask) * 8) + g_assert(!XIMaskIsSet(ptr, i)); + else if (i > out->valuators_len * 4 * 8) + g_assert(!XIMaskIsSet(in->valuators.mask, i)); + else { + g_assert(XIMaskIsSet(in->valuators.mask, i) == + XIMaskIsSet(ptr, i)); + + if (XIMaskIsSet(ptr, i)) + { + FP3232 vi, vo; + + vi.integral = in->valuators.data[i]; + vi.frac = in->valuators.data_frac[i]; + + vo = *values; + + if (swap) + { + char n; + swapl(&vo.integral, n); + swapl(&vo.frac, n); + } + + + g_assert(vi.integral == vo.integral); + g_assert(vi.frac == vo.frac); + values++; + } + } + } +} + +static void test_XIDeviceEvent(DeviceEvent *in) +{ + xXIDeviceEvent *out, *swapped; + int rc; + + rc = EventToXI2((InternalEvent*)in, (xEvent**)&out); + g_assert(rc == Success); + + test_values_XIDeviceEvent(in, out, FALSE); + + swapped = calloc(1, sizeof(xEvent) + out->length * 4); + XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped); + test_values_XIDeviceEvent(in, swapped, TRUE); + + free(out); + free(swapped); +} + +static void test_convert_XIDeviceEvent(void) +{ + DeviceEvent in; + int i; + + memset(&in, 0, sizeof(in)); + + g_test_message("Testing simple field values"); + in.header = ET_Internal; + in.type = ET_Motion; + in.length = sizeof(DeviceEvent); + in.time = 0; + in.deviceid = 1; + in.sourceid = 2; + in.root = 3; + in.root_x = 4; + in.root_x_frac = 5; + in.root_y = 6; + in.root_y_frac = 7; + in.detail.button = 8; + in.mods.base = 9; + in.mods.latched = 10; + in.mods.locked = 11; + in.mods.effective = 11; + in.group.base = 12; + in.group.latched = 13; + in.group.locked = 14; + in.group.effective = 15; + + test_XIDeviceEvent(&in); + + g_test_message("Testing field ranges"); + /* 32 bit */ + in.detail.button = 1L; + test_XIDeviceEvent(&in); + in.detail.button = 1L << 8; + test_XIDeviceEvent(&in); + in.detail.button = 1L << 16; + test_XIDeviceEvent(&in); + in.detail.button = 1L << 24; + test_XIDeviceEvent(&in); + in.detail.button = ~0L; + test_XIDeviceEvent(&in); + + /* 32 bit */ + in.time = 1L; + test_XIDeviceEvent(&in); + in.time = 1L << 8; + test_XIDeviceEvent(&in); + in.time = 1L << 16; + test_XIDeviceEvent(&in); + in.time = 1L << 24; + test_XIDeviceEvent(&in); + in.time = ~0L; + test_XIDeviceEvent(&in); + + /* 16 bit */ + in.deviceid = 1; + test_XIDeviceEvent(&in); + in.deviceid = 1 << 8; + test_XIDeviceEvent(&in); + in.deviceid = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + /* 16 bit */ + in.sourceid = 1; + test_XIDeviceEvent(&in); + in.deviceid = 1 << 8; + test_XIDeviceEvent(&in); + in.deviceid = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + /* 32 bit */ + in.root = 1L; + test_XIDeviceEvent(&in); + in.root = 1L << 8; + test_XIDeviceEvent(&in); + in.root = 1L << 16; + test_XIDeviceEvent(&in); + in.root = 1L << 24; + test_XIDeviceEvent(&in); + in.root = ~0L; + test_XIDeviceEvent(&in); + + /* 16 bit */ + in.root_x = 1; + test_XIDeviceEvent(&in); + in.root_x = 1 << 8; + test_XIDeviceEvent(&in); + in.root_x = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + in.root_x_frac = 1; + test_XIDeviceEvent(&in); + in.root_x_frac = 1 << 8; + test_XIDeviceEvent(&in); + in.root_x_frac = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + in.root_y = 1; + test_XIDeviceEvent(&in); + in.root_y = 1 << 8; + test_XIDeviceEvent(&in); + in.root_y = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + in.root_y_frac = 1; + test_XIDeviceEvent(&in); + in.root_y_frac = 1 << 8; + test_XIDeviceEvent(&in); + in.root_y_frac = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + /* 32 bit */ + in.mods.base = 1L; + test_XIDeviceEvent(&in); + in.mods.base = 1L << 8; + test_XIDeviceEvent(&in); + in.mods.base = 1L << 16; + test_XIDeviceEvent(&in); + in.mods.base = 1L << 24; + test_XIDeviceEvent(&in); + in.mods.base = ~0L; + test_XIDeviceEvent(&in); + + in.mods.latched = 1L; + test_XIDeviceEvent(&in); + in.mods.latched = 1L << 8; + test_XIDeviceEvent(&in); + in.mods.latched = 1L << 16; + test_XIDeviceEvent(&in); + in.mods.latched = 1L << 24; + test_XIDeviceEvent(&in); + in.mods.latched = ~0L; + test_XIDeviceEvent(&in); + + in.mods.locked = 1L; + test_XIDeviceEvent(&in); + in.mods.locked = 1L << 8; + test_XIDeviceEvent(&in); + in.mods.locked = 1L << 16; + test_XIDeviceEvent(&in); + in.mods.locked = 1L << 24; + test_XIDeviceEvent(&in); + in.mods.locked = ~0L; + test_XIDeviceEvent(&in); + + in.mods.effective = 1L; + test_XIDeviceEvent(&in); + in.mods.effective = 1L << 8; + test_XIDeviceEvent(&in); + in.mods.effective = 1L << 16; + test_XIDeviceEvent(&in); + in.mods.effective = 1L << 24; + test_XIDeviceEvent(&in); + in.mods.effective = ~0L; + test_XIDeviceEvent(&in); + + /* 8 bit */ + in.group.base = 1; + test_XIDeviceEvent(&in); + in.group.base = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + in.group.latched = 1; + test_XIDeviceEvent(&in); + in.group.latched = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + in.group.locked = 1; + test_XIDeviceEvent(&in); + in.group.locked = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + in.mods.effective = 1; + test_XIDeviceEvent(&in); + in.mods.effective = ~0 & 0xFF; + test_XIDeviceEvent(&in); + + g_test_message("Testing button masks"); + for (i = 0; i < sizeof(in.buttons) * 8; i++) + { + XISetMask(in.buttons, i); + test_XIDeviceEvent(&in); + XIClearMask(in.buttons, i); + } + + for (i = 0; i < sizeof(in.buttons) * 8; i++) + { + XISetMask(in.buttons, i); + test_XIDeviceEvent(&in); + } + + g_test_message("Testing valuator masks"); + for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) + { + XISetMask(in.valuators.mask, i); + test_XIDeviceEvent(&in); + XIClearMask(in.valuators.mask, i); + } + + for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) + { + XISetMask(in.valuators.mask, i); + + in.valuators.data[i] = i; + in.valuators.data_frac[i] = i + 20; + test_XIDeviceEvent(&in); + XIClearMask(in.valuators.mask, i); + } + + for (i = 0; i < sizeof(in.valuators.mask) * 8; i++) + { + XISetMask(in.valuators.mask, i); + test_XIDeviceEvent(&in); + } +} + +static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in, + xXIDeviceChangedEvent *out, + BOOL swap) +{ + int i, j; + unsigned char *ptr; + + if (swap) + { + char n; + + swaps(&out->sequenceNumber, n); + swapl(&out->length, n); + swaps(&out->evtype, n); + swaps(&out->deviceid, n); + swaps(&out->sourceid, n); + swapl(&out->time, n); + swaps(&out->num_classes, n); + } + + g_assert(out->type == GenericEvent); + g_assert(out->extension == 0); /* IReqCode defaults to 0 */ + g_assert(out->evtype == GetXI2Type((InternalEvent*)in)); + g_assert(out->time == in->time); + g_assert(out->deviceid == in->deviceid); + g_assert(out->sourceid == in->sourceid); + + ptr = (unsigned char*)&out[1]; + for (i = 0; i < out->num_classes; i++) + { + xXIAnyInfo* any = (xXIAnyInfo*)ptr; + + if (swap) + { + char n; + swaps(&any->length, n); + swaps(&any->type, n); + swaps(&any->sourceid, n); + } + + switch(any->type) + { + case XIButtonClass: + { + xXIButtonInfo *b = (xXIButtonInfo*)any; + Atom *names; + + if (swap) + { + char n; + swaps(&b->num_buttons, n); + } + + g_assert(b->length == + bytes_to_int32(sizeof(xXIButtonInfo)) + + bytes_to_int32(bits_to_bytes(b->num_buttons)) + + b->num_buttons); + g_assert(b->num_buttons == in->buttons.num_buttons); + + names = (Atom*)((char*)&b[1] + + pad_to_int32(bits_to_bytes(b->num_buttons))); + for (j = 0; j < b->num_buttons; j++) + { + if (swap) + { + char n; + swapl(&names[j], n); + } + g_assert(names[j] == in->buttons.names[j]); + } + } + break; + case XIKeyClass: + { + xXIKeyInfo *k = (xXIKeyInfo*)any; + uint32_t *kc; + + if (swap) + { + char n; + swaps(&k->num_keycodes, n); + } + + g_assert(k->length == + bytes_to_int32(sizeof(xXIKeyInfo)) + + k->num_keycodes); + g_assert(k->num_keycodes == in->keys.max_keycode - + in->keys.min_keycode + 1); + + kc = (uint32_t*)&k[1]; + for (j = 0; j < k->num_keycodes; j++) + { + if (swap) + { + char n; + swapl(&kc[j], n); + } + g_assert(kc[j] >= in->keys.min_keycode); + g_assert(kc[j] <= in->keys.max_keycode); + } + } + break; + case XIValuatorClass: + { + xXIValuatorInfo *v = (xXIValuatorInfo*)any; + g_assert(v->length == + bytes_to_int32(sizeof(xXIValuatorInfo))); + + } + break; + default: + g_error("Invalid class type.\n"); + break; + } + + ptr += any->length * 4; + } + +} + +static void test_XIDeviceChangedEvent(DeviceChangedEvent *in) +{ + xXIDeviceChangedEvent *out, *swapped; + int rc; + + rc = EventToXI2((InternalEvent*)in, (xEvent**)&out); + g_assert(rc == Success); + + test_values_XIDeviceChangedEvent(in, out, FALSE); + + swapped = calloc(1, sizeof(xEvent) + out->length * 4); + XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped); + test_values_XIDeviceChangedEvent(in, swapped, TRUE); + + free(out); + free(swapped); +} + +static void test_convert_XIDeviceChangedEvent(void) +{ + DeviceChangedEvent in; + int i; + + g_test_message("Testing simple field values"); + memset(&in, 0, sizeof(in)); + in.header = ET_Internal; + in.type = ET_DeviceChanged; + in.length = sizeof(DeviceChangedEvent); + in.time = 0; + in.deviceid = 1; + in.sourceid = 2; + in.masterid = 3; + in.num_valuators = 4; + in.flags = DEVCHANGE_SLAVE_SWITCH | DEVCHANGE_POINTER_EVENT | DEVCHANGE_KEYBOARD_EVENT; + + for (i = 0; i < MAX_BUTTONS; i++) + in.buttons.names[i] = i + 10; + + in.keys.min_keycode = 8; + in.keys.max_keycode = 255; + + test_XIDeviceChangedEvent(&in); + + in.time = 1L; + test_XIDeviceChangedEvent(&in); + in.time = 1L << 8; + test_XIDeviceChangedEvent(&in); + in.time = 1L << 16; + test_XIDeviceChangedEvent(&in); + in.time = 1L << 24; + test_XIDeviceChangedEvent(&in); + in.time = ~0L; + test_XIDeviceChangedEvent(&in); + + in.deviceid = 1L; + test_XIDeviceChangedEvent(&in); + in.deviceid = 1L << 8; + test_XIDeviceChangedEvent(&in); + in.deviceid = ~0 & 0xFFFF; + test_XIDeviceChangedEvent(&in); + + in.sourceid = 1L; + test_XIDeviceChangedEvent(&in); + in.sourceid = 1L << 8; + test_XIDeviceChangedEvent(&in); + in.sourceid = ~0 & 0xFFFF; + test_XIDeviceChangedEvent(&in); + + in.masterid = 1L; + test_XIDeviceChangedEvent(&in); + in.masterid = 1L << 8; + test_XIDeviceChangedEvent(&in); + in.masterid = ~0 & 0xFFFF; + test_XIDeviceChangedEvent(&in); + + in.buttons.num_buttons = 0; + test_XIDeviceChangedEvent(&in); + + in.buttons.num_buttons = 1; + test_XIDeviceChangedEvent(&in); + + in.buttons.num_buttons = MAX_BUTTONS; + test_XIDeviceChangedEvent(&in); + + in.keys.min_keycode = 0; + in.keys.max_keycode = 0; + test_XIDeviceChangedEvent(&in); + + in.keys.max_keycode = 1 << 8; + test_XIDeviceChangedEvent(&in); + + in.keys.max_keycode = 0xFFFC; /* highest range, above that the length + field gives up */ + test_XIDeviceChangedEvent(&in); + + in.keys.min_keycode = 1 << 8; + in.keys.max_keycode = 1 << 8; + test_XIDeviceChangedEvent(&in); + + in.keys.min_keycode = 1 << 8; + in.keys.max_keycode = 0; + test_XIDeviceChangedEvent(&in); + + in.num_valuators = 0; + test_XIDeviceChangedEvent(&in); + + in.num_valuators = 1; + test_XIDeviceChangedEvent(&in); + + in.num_valuators = MAX_VALUATORS; + test_XIDeviceChangedEvent(&in); + + for (i = 0; i < MAX_VALUATORS; i++) + { + in.valuators[i].min = 0; + in.valuators[i].max = 0; + test_XIDeviceChangedEvent(&in); + + in.valuators[i].max = 1 << 8; + test_XIDeviceChangedEvent(&in); + in.valuators[i].max = 1 << 16; + test_XIDeviceChangedEvent(&in); + in.valuators[i].max = 1 << 24; + test_XIDeviceChangedEvent(&in); + in.valuators[i].max = abs(~0); + test_XIDeviceChangedEvent(&in); + + in.valuators[i].resolution = 1 << 8; + test_XIDeviceChangedEvent(&in); + in.valuators[i].resolution = 1 << 16; + test_XIDeviceChangedEvent(&in); + in.valuators[i].resolution = 1 << 24; + test_XIDeviceChangedEvent(&in); + in.valuators[i].resolution = abs(~0); + test_XIDeviceChangedEvent(&in); + + in.valuators[i].name = i; + test_XIDeviceChangedEvent(&in); + + in.valuators[i].mode = Relative; + test_XIDeviceChangedEvent(&in); + + in.valuators[i].mode = Absolute; + test_XIDeviceChangedEvent(&in); + } +} + +int main(int argc, char** argv) +{ + g_test_init(&argc, &argv,NULL); + g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id="); + + g_test_add_func("/xi2/eventconvert/XIRawEvent", test_convert_XIRawEvent); + g_test_add_func("/xi2/eventconvert/XIFocusEvent", test_convert_XIFocusEvent); + g_test_add_func("/xi2/eventconvert/XIDeviceEvent", test_convert_XIDeviceEvent); + g_test_add_func("/xi2/eventconvert/XIDeviceChangedEvent", test_convert_XIDeviceChangedEvent); + + return g_test_run(); +} diff --git a/xorg-server/test/xi2/protocol-xiselectevents.c b/xorg-server/test/xi2/protocol-xiselectevents.c index fe1c26df8..f951a14fe 100644 --- a/xorg-server/test/xi2/protocol-xiselectevents.c +++ b/xorg-server/test/xi2/protocol-xiselectevents.c @@ -131,7 +131,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) { int i, j; xXIEventMask *mask; - int nmasks = (XI_LASTEVENT + 7)/8; + int nmasks = (XI2LASTEVENT + 7)/8; unsigned char *bits; mask = (xXIEventMask*)&req[1]; @@ -150,14 +150,14 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) request_XISelectEvent(req, Success); /* Test 1: - * mask may be larger than needed for XI_LASTEVENT. + * mask may be larger than needed for XI2LASTEVENT. * Test setting each valid mask bit, while leaving unneeded bits 0. * -> Success */ bits = (unsigned char*)&mask[1]; mask->mask_len = (nmasks + 3)/4 * 10; memset(bits, 0, mask->mask_len * 4); - for (j = 0; j <= XI_LASTEVENT; j++) + for (j = 0; j <= XI2LASTEVENT; j++) { SetBit(bits, j); request_XISelectEvent(req, Success); @@ -165,7 +165,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) } /* Test 2: - * mask may be larger than needed for XI_LASTEVENT. + * mask may be larger than needed for XI2LASTEVENT. * Test setting all valid mask bits, while leaving unneeded bits 0. * -> Success */ @@ -173,21 +173,21 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) mask->mask_len = (nmasks + 3)/4 * 10; memset(bits, 0, mask->mask_len * 4); - for (j = 0; j <= XI_LASTEVENT; j++) + for (j = 0; j <= XI2LASTEVENT; j++) { SetBit(bits, j); request_XISelectEvent(req, Success); } /* Test 3: - * mask is larger than needed for XI_LASTEVENT. If any unneeded bit + * mask is larger than needed for XI2LASTEVENT. If any unneeded bit * is set -> BadValue */ bits = (unsigned char*)&mask[1]; mask->mask_len = (nmasks + 3)/4 * 10; memset(bits, 0, mask->mask_len * 4); - for (j = XI_LASTEVENT + 1; j < mask->mask_len * 4; j++) + for (j = XI2LASTEVENT + 1; j < mask->mask_len * 4; j++) { SetBit(bits, j); request_XISelectEvent(req, BadValue); @@ -200,7 +200,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) bits = (unsigned char*)&mask[1]; mask->mask_len = (nmasks + 3)/4; memset(bits, 0, mask->mask_len * 4); - for (j = 0; j <= XI_LASTEVENT; j++) + for (j = 0; j <= XI2LASTEVENT; j++) { SetBit(bits, j); request_XISelectEvent(req, Success); @@ -228,7 +228,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) bits = (unsigned char*)&mask[1]; mask->mask_len = (nmasks + 3)/4; memset(bits, 0, mask->mask_len * 4); - for (j = 0; j <= XI_LASTEVENT; j++) + for (j = 0; j <= XI2LASTEVENT; j++) SetBit(bits, j); ClearBit(bits, XI_HierarchyChanged); for (j = 1; j < 6; j++) diff --git a/xorg-server/xkb/XKBMisc.c b/xorg-server/xkb/XKBMisc.c index f983466ea..96688be18 100644 --- a/xorg-server/xkb/XKBMisc.c +++ b/xorg-server/xkb/XKBMisc.c @@ -1,839 +1,840 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#elif defined(HAVE_CONFIG_H) -#include -#endif - -#include -#include -#include -#include "misc.h" -#include "inputstr.h" -#include -#define XKBSRV_NEED_FILE_FUNCS -#include - -/***====================================================================***/ - -#define CORE_SYM(i) (imap->num_types)) { - nSyms[i]= xkb->map->types[types_inout[i]].num_levels; - if (nSyms[i]>groupsWidth) - groupsWidth= nSyms[i]; - } - else { - types_inout[i]= XkbTwoLevelIndex; /* don't really know, yet */ - nSyms[i]= 2; - } - } - if (nSyms[XkbGroup1Index]<2) - nSyms[XkbGroup1Index]= 2; - if (nSyms[XkbGroup2Index]<2) - nSyms[XkbGroup2Index]= 2; - /* Step 2: Copy the symbols from the core ordering to XKB ordering */ - /* symbols in the core are in the order: */ - /* G1L1 G1L2 G2L1 G2L2 [G1L[3-n]] [G2L[3-n]] [G3L*] [G3L*] */ - xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,0)]= CORE_SYM(0); - xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,1)]= CORE_SYM(1); - for (i=2;i 0 && CORE_SYM(0) != CORE_SYM(2)) || - (width > 1 && CORE_SYM(1) != CORE_SYM(3))) - replicated = FALSE; - - /* Check CDECDE in ABABCDECDEABCDE */ - for (i = 2; i < width && replicated; i++) - { - if (CORE_SYM(2 + i) != CORE_SYM(i + width)) - replicated = FALSE; - } - - /* Check ABCDE in ABABCDECDEABCDE */ - for (j = 2; replicated && - j < XkbNumKbdGroups && - map_width >= width * (j + 1); j++) - { - for (i = 0; i < width && replicated; i++) - { - if (CORE_SYM(((i < 2) ? i : 2 + i)) != CORE_SYM(i + width * j)) - replicated = FALSE; - } - } - } - - if (replicated) - { - nSyms[XkbGroup2Index]= 0; - nSyms[XkbGroup3Index]= 0; - nSyms[XkbGroup4Index]= 0; - nGroups= 1; - } else - { - tmp= nSyms[XkbGroup1Index]+nSyms[XkbGroup2Index]; - if ((tmp>=map_width)&& - ((protected&(XkbExplicitKeyType3Mask|XkbExplicitKeyType4Mask))==0)) { - nSyms[XkbGroup3Index]= 0; - nSyms[XkbGroup4Index]= 0; - nGroups= 2; - } else - { - nGroups= 3; - for (i=0;i1)&&(syms[1]==NoSymbol)&&(syms[0]!=NoSymbol)) { - KeySym upper,lower; - XkbConvertCase(syms[0],&lower,&upper); - if (upper!=lower) { - xkb_syms_rtrn[XKB_OFFSET(i,0)]= lower; - xkb_syms_rtrn[XKB_OFFSET(i,1)]= upper; - if ((protected&(1<=0;i--) { - if (((empty&(1<1)&&((empty&(XkbGroup1Mask|XkbGroup2Mask))==XkbGroup2Mask)) { - if ((protected&(XkbExplicitKeyType1Mask|XkbExplicitKeyType2Mask))==0) { - nSyms[XkbGroup2Index]= nSyms[XkbGroup1Index]; - types_inout[XkbGroup2Index]= types_inout[XkbGroup1Index]; - memcpy((char *)&xkb_syms_rtrn[2],(char *)xkb_syms_rtrn, - 2*sizeof(KeySym)); - } - else if (types_inout[XkbGroup1Index]==types_inout[XkbGroup2Index]) { - memcpy((char *)&xkb_syms_rtrn[nSyms[XkbGroup1Index]], - (char *)xkb_syms_rtrn, - nSyms[XkbGroup1Index]*sizeof(KeySym)); - } - } - - /* step 7: check for all groups identical or all width 1 - * - * Special feature: if group 1 has an explicit type and all other groups - * have canonical types with same symbols, we assume it's info lost from - * the core replication. - */ - if (nGroups>1) { - Bool sameType,allOneLevel, canonical = TRUE; - allOneLevel= (xkb->map->types[types_inout[0]].num_levels==1); - for (i=1,sameType=TRUE;(allOneLevel||sameType)&&(imap->types[types_inout[i]].num_levels==1); - if (types_inout[i] > XkbLastRequiredType) - canonical = FALSE; - } - if (((sameType) || canonical)&& - (!(protected&(XkbExplicitKeyTypesMask&~XkbExplicitKeyType1Mask)))){ - register int s; - Bool identical; - for (i=1,identical=TRUE;identical&&(i1)) { - KeySym *syms; - syms= &xkb_syms_rtrn[nSyms[XkbGroup1Index]]; - nSyms[XkbGroup1Index]= 1; - for (i=1;icompat->sym_interpret; - for (i=0;icompat->num_si;i++,interp++) { - if ((interp->sym==NoSymbol)||(sym==interp->sym)) { - int match; - if ((level==0)||((interp->match&XkbSI_LevelOneOnly)==0)) - mods= real_mods; - else mods= 0; - switch (interp->match&XkbSI_OpMask) { - case XkbSI_NoneOf: - match= ((interp->mods&mods)==0); - break; - case XkbSI_AnyOfOrNone: - match= ((mods==0)||((interp->mods&mods)!=0)); - break; - case XkbSI_AnyOf: - match= ((interp->mods&mods)!=0); - break; - case XkbSI_AllOf: - match= ((interp->mods&mods)==interp->mods); - break; - case XkbSI_Exactly: - match= (interp->mods==mods); - break; - default: - match= 0; - break; - } - if (match) { - if (interp->sym!=NoSymbol) { - return interp; - } - else if (rtrn==NULL) { - rtrn= interp; - } - } - } - } - return rtrn; -} - -static void -_XkbAddKeyChange(KeyCode *pFirst,unsigned char *pNum,KeyCode newKey) -{ -KeyCode last; - - last= (*pFirst)+(*pNum); - if (newKey<*pFirst) { - *pFirst= newKey; - *pNum= (last-newKey)+1; - } - else if (newKey>last) { - *pNum= (last-*pFirst)+1; - } - return; -} - -static void -_XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods) -{ -unsigned tmp; - - switch (act->type) { - case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: - if (act->mods.flags&XkbSA_UseModMapMods) - act->mods.real_mods= act->mods.mask= mods; - if ((tmp= XkbModActionVMods(&act->mods))!=0) { - XkbVirtualModsToReal(xkb,tmp,&tmp); - act->mods.mask|= tmp; - } - break; - case XkbSA_ISOLock: - if (act->iso.flags&XkbSA_UseModMapMods) - act->iso.real_mods= act->iso.mask= mods; - if ((tmp= XkbModActionVMods(&act->iso))!=0) { - XkbVirtualModsToReal(xkb,tmp,&tmp); - act->iso.mask|= tmp; - } - break; - } - return; -} - -#define IBUF_SIZE 8 - -Bool -XkbApplyCompatMapToKey(XkbDescPtr xkb,KeyCode key,XkbChangesPtr changes) -{ -KeySym * syms; -unsigned char explicit,mods; -XkbSymInterpretPtr *interps,ibuf[IBUF_SIZE]; -int n,nSyms,found; -unsigned changed,tmp; - - if ((!xkb)||(!xkb->map)||(!xkb->map->key_sym_map)|| - (!xkb->compat)||(!xkb->compat->sym_interpret)|| - (keymin_key_code)||(key>xkb->max_key_code)) { - return FALSE; - } - if (((!xkb->server)||(!xkb->server->key_acts))&& - (XkbAllocServerMap(xkb,XkbAllServerInfoMask,0)!=Success)) { - return FALSE; - } - changed= 0; /* keeps track of what has changed in _this_ call */ - explicit= xkb->server->explicit[key]; - if (explicit&XkbExplicitInterpretMask) /* nothing to do */ - return TRUE; - mods= (xkb->map->modmap?xkb->map->modmap[key]:0); - nSyms= XkbKeyNumSyms(xkb,key); - syms= XkbKeySymsPtr(xkb,key); - if (nSyms>IBUF_SIZE) { - interps= calloc(nSyms, sizeof(XkbSymInterpretPtr)); - if (interps==NULL) { - interps= ibuf; - nSyms= IBUF_SIZE; - } - } - else { - interps= ibuf; - } - found= 0; - for (n=0;nact.type!=XkbSA_NoAction) - found++; - else interps[n]= NULL; - } - } - /* 1/28/96 (ef) -- XXX! WORKING HERE */ - if (!found) { - if (xkb->server->key_acts[key]!=0) { - xkb->server->key_acts[key]= 0; - changed|= XkbKeyActionsMask; - } - } - else { - XkbAction *pActs; - unsigned int new_vmodmask; - changed|= XkbKeyActionsMask; - pActs= XkbResizeKeyActions(xkb,key,nSyms); - if (!pActs) { - if (nSyms > IBUF_SIZE) - free(interps); - return FALSE; - } - new_vmodmask= 0; - for (n=0;nact); - if ((n==0)||((interps[n]->match&XkbSI_LevelOneOnly)==0)) { - effMods= mods; - if (interps[n]->virtual_mod!=XkbNoModifier) - new_vmodmask|= (1<virtual_mod); - } - else effMods= 0; - _XkbSetActionKeyMods(xkb,&pActs[n],effMods); - } - else pActs[n].type= XkbSA_NoAction; - } - if (((explicit&XkbExplicitVModMapMask)==0)&& - (xkb->server->vmodmap[key]!=new_vmodmask)) { - changed|= XkbVirtualModMapMask; - xkb->server->vmodmap[key]= new_vmodmask; - } - if (interps[0]) { - if ((interps[0]->flags&XkbSI_LockingKey)&& - ((explicit&XkbExplicitBehaviorMask)==0)) { - xkb->server->behaviors[key].type= XkbKB_Lock; - changed|= XkbKeyBehaviorsMask; - } - if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { - CARD8 old; - old= xkb->ctrls->per_key_repeat[key/8]; - if (interps[0]->flags&XkbSI_AutoRepeat) - xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); - else xkb->ctrls->per_key_repeat[key/8]&= ~(1<<(key%8)); - if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) - changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; - } - } - } - if ((!found)||(interps[0]==NULL)) { - if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { - CARD8 old; - old= xkb->ctrls->per_key_repeat[key/8]; - xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); - if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) - changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; - } - if (((explicit&XkbExplicitBehaviorMask)==0)&& - (xkb->server->behaviors[key].type==XkbKB_Lock)) { - xkb->server->behaviors[key].type= XkbKB_Default; - changed|= XkbKeyBehaviorsMask; - } - } - if (changes) { - XkbMapChangesPtr mc; - mc= &changes->map; - tmp= (changed&mc->changed); - if (tmp&XkbKeyActionsMask) - _XkbAddKeyChange(&mc->first_key_act,&mc->num_key_acts,key); - else if (changed&XkbKeyActionsMask) { - mc->changed|= XkbKeyActionsMask; - mc->first_key_act= key; - mc->num_key_acts= 1; - } - if (tmp&XkbKeyBehaviorsMask) { - _XkbAddKeyChange(&mc->first_key_behavior,&mc->num_key_behaviors, - key); - } - else if (changed&XkbKeyBehaviorsMask) { - mc->changed|= XkbKeyBehaviorsMask; - mc->first_key_behavior= key; - mc->num_key_behaviors= 1; - } - if (tmp&XkbVirtualModMapMask) - _XkbAddKeyChange(&mc->first_vmodmap_key,&mc->num_vmodmap_keys,key); - else if (changed&XkbVirtualModMapMask) { - mc->changed|= XkbVirtualModMapMask; - mc->first_vmodmap_key= key; - mc->num_vmodmap_keys= 1; - } - mc->changed|= changed; - } - if (interps!=ibuf) - free(interps); - return TRUE; -} - -Status -XkbChangeTypesOfKey( XkbDescPtr xkb, - int key, - int nGroups, - unsigned groups, - int * newTypesIn, - XkbMapChangesPtr changes) -{ -XkbKeyTypePtr pOldType,pNewType; -register int i; -int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups]; - - if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) || - (!xkb->map->types)||(!newTypesIn)||((groups&XkbAllGroupsMask)==0)|| - (nGroups>XkbNumKbdGroups)) { - return BadMatch; - } - if (nGroups==0) { - for (i=0;imap->key_sym_map[key].kt_index[i]= XkbOneLevelIndex; - } - i= xkb->map->key_sym_map[key].group_info; - i= XkbSetNumGroups(i,0); - xkb->map->key_sym_map[key].group_info= i; - XkbResizeKeySyms(xkb,key,0); - return Success; - } - - nOldGroups= XkbKeyNumGroups(xkb,key); - oldWidth= XkbKeyGroupsWidth(xkb,key); - for (width=i=0;i0) - newTypes[i]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); - else newTypes[i]= XkbTwoLevelIndex; - if (newTypes[i]>xkb->map->num_types) - return BadMatch; - pNewType= &xkb->map->types[newTypes[i]]; - if (pNewType->num_levels>width) - width= pNewType->num_levels; - } - if ((xkb->ctrls)&&(nGroups>xkb->ctrls->num_groups)) - xkb->ctrls->num_groups= nGroups; - if ((width!=oldWidth)||(nGroups!=nOldGroups)) { - KeySym oldSyms[XkbMaxSymsPerKey],*pSyms; - int nCopy; - - if (nOldGroups==0) { - pSyms= XkbResizeKeySyms(xkb,key,width*nGroups); - if (pSyms!=NULL) { - i= xkb->map->key_sym_map[key].group_info; - i= XkbSetNumGroups(i,nGroups); - xkb->map->key_sym_map[key].group_info= i; - xkb->map->key_sym_map[key].width= width; - for (i=0;imap->key_sym_map[key].kt_index[i]= newTypes[i]; - } - return Success; - } - return BadAlloc; - } - pSyms= XkbKeySymsPtr(xkb,key); - memcpy(oldSyms,pSyms,XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); - pSyms= XkbResizeKeySyms(xkb,key,width*nGroups); - if (pSyms==NULL) - return BadAlloc; - memset(pSyms, 0, width*nGroups*sizeof(KeySym)); - for (i=0;(imap->types[newTypes[i]]; - if (pNewType->num_levels>pOldType->num_levels) - nCopy= pOldType->num_levels; - else nCopy= pNewType->num_levels; - memcpy(&pSyms[i*width],&oldSyms[i*oldWidth],nCopy*sizeof(KeySym)); - } - if (XkbKeyHasActions(xkb,key)) { - XkbAction oldActs[XkbMaxSymsPerKey],*pActs; - pActs= XkbKeyActionsPtr(xkb,key); - memcpy(oldActs,pActs,XkbKeyNumSyms(xkb,key)*sizeof(XkbAction)); - pActs= XkbResizeKeyActions(xkb,key,width*nGroups); - if (pActs==NULL) - return BadAlloc; - memset(pActs, 0, width*nGroups*sizeof(XkbAction)); - for (i=0;(imap->types[newTypes[i]]; - if (pNewType->num_levels>pOldType->num_levels) - nCopy= pOldType->num_levels; - else nCopy= pNewType->num_levels; - memcpy(&pActs[i*width],&oldActs[i*oldWidth], - nCopy*sizeof(XkbAction)); - } - } - i= xkb->map->key_sym_map[key].group_info; - i= XkbSetNumGroups(i,nGroups); - xkb->map->key_sym_map[key].group_info= i; - xkb->map->key_sym_map[key].width= width; - } - width= 0; - for (i=0;imap->key_sym_map[key].kt_index[i]= newTypes[i]; - if (xkb->map->types[newTypes[i]].num_levels>width) - width= xkb->map->types[newTypes[i]].num_levels; - } - xkb->map->key_sym_map[key].width= width; - if (changes!=NULL) { - if (changes->changed&XkbKeySymsMask) { - _XkbAddKeyChange(&changes->first_key_sym,&changes->num_key_syms, - key); - } - else { - changes->changed|= XkbKeySymsMask; - changes->first_key_sym= key; - changes->num_key_syms= 1; - } - } - return Success; -} - -/***====================================================================***/ - -Bool -XkbVirtualModsToReal(XkbDescPtr xkb,unsigned virtual_mask,unsigned *mask_rtrn) -{ -register int i,bit; -register unsigned mask; - - if (xkb==NULL) - return FALSE; - if (virtual_mask==0) { - *mask_rtrn= 0; - return TRUE; - } - if (xkb->server==NULL) - return FALSE; - for (i=mask=0,bit=1;iserver->vmods[i]; - } - *mask_rtrn= mask; - return TRUE; -} - -/***====================================================================***/ - -static Bool -XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed) -{ -unsigned int tmp; - - switch (act->type) { - case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: - if (((tmp= XkbModActionVMods(&act->mods))&changed)!=0) { - XkbVirtualModsToReal(xkb,tmp,&tmp); - act->mods.mask= act->mods.real_mods; - act->mods.mask|= tmp; - return TRUE; - } - break; - case XkbSA_ISOLock: - if ((((tmp= XkbModActionVMods(&act->iso))!=0)&changed)!=0) { - XkbVirtualModsToReal(xkb,tmp,&tmp); - act->iso.mask= act->iso.real_mods; - act->iso.mask|= tmp; - return TRUE; - } - break; - } - return FALSE; -} - -static void -XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb, - XkbKeyTypePtr type, - unsigned int changed, - XkbChangesPtr changes) -{ -register unsigned int i; -unsigned int mask; - - XkbVirtualModsToReal(xkb,type->mods.vmods,&mask); - type->mods.mask= type->mods.real_mods|mask; - if ((type->map_count>0)&&(type->mods.vmods!=0)) { - XkbKTMapEntryPtr entry; - for (i=0,entry=type->map;imap_count;i++,entry++) { - if (entry->mods.vmods!=0) { - XkbVirtualModsToReal(xkb,entry->mods.vmods,&mask); - entry->mods.mask=entry->mods.real_mods|mask; - /* entry is active if vmods are bound*/ - entry->active= (mask!=0); - } - else entry->active= 1; - } - } - if (changes) { - int type_ndx; - type_ndx= type-xkb->map->types; - if ((type_ndx<0)||(type_ndx>xkb->map->num_types)) - return; - if (changes->map.changed&XkbKeyTypesMask) { - int last; - last= changes->map.first_type+changes->map.num_types-1; - if (type_ndxmap.first_type) { - changes->map.first_type= type_ndx; - changes->map.num_types= (last-type_ndx)+1; - } - else if (type_ndx>last) { - changes->map.num_types= (type_ndx-changes->map.first_type)+1; - } - } - else { - changes->map.changed|= XkbKeyTypesMask; - changes->map.first_type= type_ndx; - changes->map.num_types= 1; - } - } - return; -} - -Bool -XkbApplyVirtualModChanges(XkbDescPtr xkb,unsigned changed,XkbChangesPtr changes) -{ -register int i; -unsigned int checkState = 0; - - if ((!xkb) || (!xkb->map) || (changed==0)) - return FALSE; - for (i=0;imap->num_types;i++) { - if (xkb->map->types[i].mods.vmods & changed) - XkbUpdateKeyTypeVirtualMods(xkb,&xkb->map->types[i],changed,changes); - } - if (changed&xkb->ctrls->internal.vmods) { - unsigned int newMask; - XkbVirtualModsToReal(xkb,xkb->ctrls->internal.vmods,&newMask); - newMask|= xkb->ctrls->internal.real_mods; - if (xkb->ctrls->internal.mask!=newMask) { - xkb->ctrls->internal.mask= newMask; - if (changes) { - changes->ctrls.changed_ctrls|= XkbInternalModsMask; - checkState= TRUE; - } - } - } - if (changed&xkb->ctrls->ignore_lock.vmods) { - unsigned int newMask; - XkbVirtualModsToReal(xkb,xkb->ctrls->ignore_lock.vmods,&newMask); - newMask|= xkb->ctrls->ignore_lock.real_mods; - if (xkb->ctrls->ignore_lock.mask!=newMask) { - xkb->ctrls->ignore_lock.mask= newMask; - if (changes) { - changes->ctrls.changed_ctrls|= XkbIgnoreLockModsMask; - checkState= TRUE; - } - } - } - if (xkb->indicators!=NULL) { - XkbIndicatorMapPtr map; - map= &xkb->indicators->maps[0]; - for (i=0;imods.vmods&changed) { - unsigned int newMask; - XkbVirtualModsToReal(xkb,map->mods.vmods,&newMask); - newMask|= map->mods.real_mods; - if (newMask!=map->mods.mask) { - map->mods.mask= newMask; - if (changes) { - changes->indicators.map_changes|= (1<compat!=NULL) { - XkbCompatMapPtr compat; - compat= xkb->compat; - for (i=0;igroups[i].vmods,&newMask); - newMask|= compat->groups[i].real_mods; - if (compat->groups[i].mask!=newMask) { - compat->groups[i].mask= newMask; - if (changes) { - changes->compat.changed_groups|= (1<map && xkb->server) { - int highChange = 0, lowChange = -1; - for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { - if (XkbKeyHasActions(xkb,i)) { - register XkbAction *pAct; - register int n; - - pAct= XkbKeyActionsPtr(xkb,i); - for (n=XkbKeyNumActions(xkb,i);n>0;n--,pAct++) { - if ((pAct->type!=XkbSA_NoAction)&& - XkbUpdateActionVirtualMods(xkb,pAct,changed)) { - if (lowChange<0) - lowChange= i; - highChange= i; - } - } - } - } - if (changes && (lowChange>0)) { /* something changed */ - if (changes->map.changed&XkbKeyActionsMask) { - int last; - if (changes->map.first_key_actmap.first_key_act; - last= changes->map.first_key_act+changes->map.num_key_acts-1; - if (last>highChange) - highChange= last; - } - changes->map.changed|= XkbKeyActionsMask; - changes->map.first_key_act= lowChange; - changes->map.num_key_acts= (highChange-lowChange)+1; - } - } - return checkState; -} +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include +#elif defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include "misc.h" +#include "inputstr.h" +#include +#define XKBSRV_NEED_FILE_FUNCS +#include + +/***====================================================================***/ + +#define CORE_SYM(i) (imap->num_types)) { + nSyms[i]= xkb->map->types[types_inout[i]].num_levels; + if (nSyms[i]>groupsWidth) + groupsWidth= nSyms[i]; + } + else { + types_inout[i]= XkbTwoLevelIndex; /* don't really know, yet */ + nSyms[i]= 2; + } + } + if (nSyms[XkbGroup1Index]<2) + nSyms[XkbGroup1Index]= 2; + if (nSyms[XkbGroup2Index]<2) + nSyms[XkbGroup2Index]= 2; + /* Step 2: Copy the symbols from the core ordering to XKB ordering */ + /* symbols in the core are in the order: */ + /* G1L1 G1L2 G2L1 G2L2 [G1L[3-n]] [G2L[3-n]] [G3L*] [G3L*] */ + xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,0)]= CORE_SYM(0); + xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,1)]= CORE_SYM(1); + for (i=2;i 0 && CORE_SYM(0) != CORE_SYM(2)) || + (width > 1 && CORE_SYM(1) != CORE_SYM(3))) + replicated = FALSE; + + /* Check CDECDE in ABABCDECDEABCDE */ + for (i = 2; i < width && replicated; i++) + { + if (CORE_SYM(2 + i) != CORE_SYM(i + width)) + replicated = FALSE; + } + + /* Check ABCDE in ABABCDECDEABCDE */ + for (j = 2; replicated && + j < XkbNumKbdGroups && + map_width >= width * (j + 1); j++) + { + for (i = 0; i < width && replicated; i++) + { + if (CORE_SYM(((i < 2) ? i : 2 + i)) != CORE_SYM(i + width * j)) + replicated = FALSE; + } + } + } + + if (replicated) + { + nSyms[XkbGroup2Index]= 0; + nSyms[XkbGroup3Index]= 0; + nSyms[XkbGroup4Index]= 0; + nGroups= 1; + } else + { + tmp= nSyms[XkbGroup1Index]+nSyms[XkbGroup2Index]; + if ((tmp>=map_width)&& + ((protected&(XkbExplicitKeyType3Mask|XkbExplicitKeyType4Mask))==0)) { + nSyms[XkbGroup3Index]= 0; + nSyms[XkbGroup4Index]= 0; + nGroups= 2; + } else + { + nGroups= 3; + for (i=0;i1)&&(syms[1]==NoSymbol)&&(syms[0]!=NoSymbol)) { + KeySym upper,lower; + XkbConvertCase(syms[0],&lower,&upper); + if (upper!=lower) { + xkb_syms_rtrn[XKB_OFFSET(i,0)]= lower; + xkb_syms_rtrn[XKB_OFFSET(i,1)]= upper; + if ((protected&(1<=0;i--) { + if (((empty&(1<1)&&((empty&(XkbGroup1Mask|XkbGroup2Mask))==XkbGroup2Mask)) { + if ((protected&(XkbExplicitKeyType1Mask|XkbExplicitKeyType2Mask))==0) { + nSyms[XkbGroup2Index]= nSyms[XkbGroup1Index]; + types_inout[XkbGroup2Index]= types_inout[XkbGroup1Index]; + memcpy((char *)&xkb_syms_rtrn[2],(char *)xkb_syms_rtrn, + 2*sizeof(KeySym)); + } + else if (types_inout[XkbGroup1Index]==types_inout[XkbGroup2Index]) { + memcpy((char *)&xkb_syms_rtrn[nSyms[XkbGroup1Index]], + (char *)xkb_syms_rtrn, + nSyms[XkbGroup1Index]*sizeof(KeySym)); + } + } + + /* step 7: check for all groups identical or all width 1 + * + * Special feature: if group 1 has an explicit type and all other groups + * have canonical types with same symbols, we assume it's info lost from + * the core replication. + */ + if (nGroups>1) { + Bool sameType,allOneLevel, canonical = TRUE; + allOneLevel= (xkb->map->types[types_inout[0]].num_levels==1); + for (i=1,sameType=TRUE;(allOneLevel||sameType)&&(imap->types[types_inout[i]].num_levels==1); + if (types_inout[i] > XkbLastRequiredType) + canonical = FALSE; + } + if (((sameType) || canonical)&& + (!(protected&(XkbExplicitKeyTypesMask&~XkbExplicitKeyType1Mask)))){ + register int s; + Bool identical; + for (i=1,identical=TRUE;identical&&(i1)) { + KeySym *syms; + syms= &xkb_syms_rtrn[nSyms[XkbGroup1Index]]; + nSyms[XkbGroup1Index]= 1; + for (i=1;icompat->sym_interpret; + for (i=0;icompat->num_si;i++,interp++) { + if ((interp->sym==NoSymbol)||(sym==interp->sym)) { + int match; + if ((level==0)||((interp->match&XkbSI_LevelOneOnly)==0)) + mods= real_mods; + else mods= 0; + switch (interp->match&XkbSI_OpMask) { + case XkbSI_NoneOf: + match= ((interp->mods&mods)==0); + break; + case XkbSI_AnyOfOrNone: + match= ((mods==0)||((interp->mods&mods)!=0)); + break; + case XkbSI_AnyOf: + match= ((interp->mods&mods)!=0); + break; + case XkbSI_AllOf: + match= ((interp->mods&mods)==interp->mods); + break; + case XkbSI_Exactly: + match= (interp->mods==mods); + break; + default: + match= 0; + break; + } + if (match) { + if (interp->sym!=NoSymbol) { + return interp; + } + else if (rtrn==NULL) { + rtrn= interp; + } + } + } + } + return rtrn; +} + +static void +_XkbAddKeyChange(KeyCode *pFirst,unsigned char *pNum,KeyCode newKey) +{ +KeyCode last; + + last= (*pFirst)+(*pNum); + if (newKey<*pFirst) { + *pFirst= newKey; + *pNum= (last-newKey)+1; + } + else if (newKey>last) { + *pNum= (last-*pFirst)+1; + } + return; +} + +static void +_XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods) +{ +unsigned tmp; + + switch (act->type) { + case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: + if (act->mods.flags&XkbSA_UseModMapMods) + act->mods.real_mods= act->mods.mask= mods; + if ((tmp= XkbModActionVMods(&act->mods))!=0) { + XkbVirtualModsToReal(xkb,tmp,&tmp); + act->mods.mask|= tmp; + } + break; + case XkbSA_ISOLock: + if (act->iso.flags&XkbSA_UseModMapMods) + act->iso.real_mods= act->iso.mask= mods; + if ((tmp= XkbModActionVMods(&act->iso))!=0) { + XkbVirtualModsToReal(xkb,tmp,&tmp); + act->iso.mask|= tmp; + } + break; + } + return; +} + +#define IBUF_SIZE 8 + +Bool +XkbApplyCompatMapToKey(XkbDescPtr xkb,KeyCode key,XkbChangesPtr changes) +{ +KeySym * syms; +unsigned char explicit,mods; +XkbSymInterpretPtr *interps,ibuf[IBUF_SIZE]; +int n,nSyms,found; +unsigned changed,tmp; + + if ((!xkb)||(!xkb->map)||(!xkb->map->key_sym_map)|| + (!xkb->compat)||(!xkb->compat->sym_interpret)|| + (keymin_key_code)||(key>xkb->max_key_code)) { + return FALSE; + } + if (((!xkb->server)||(!xkb->server->key_acts))&& + (XkbAllocServerMap(xkb,XkbAllServerInfoMask,0)!=Success)) { + return FALSE; + } + changed= 0; /* keeps track of what has changed in _this_ call */ + explicit= xkb->server->explicit[key]; + if (explicit&XkbExplicitInterpretMask) /* nothing to do */ + return TRUE; + mods= (xkb->map->modmap?xkb->map->modmap[key]:0); + nSyms= XkbKeyNumSyms(xkb,key); + syms= XkbKeySymsPtr(xkb,key); + if (nSyms>IBUF_SIZE) { + interps= calloc(nSyms, sizeof(XkbSymInterpretPtr)); + if (interps==NULL) { + interps= ibuf; + nSyms= IBUF_SIZE; + } + } + else { + interps= ibuf; + } + found= 0; + for (n=0;nact.type!=XkbSA_NoAction) + found++; + else interps[n]= NULL; + } + } + /* 1/28/96 (ef) -- XXX! WORKING HERE */ + if (!found) { + if (xkb->server->key_acts[key]!=0) { + xkb->server->key_acts[key]= 0; + changed|= XkbKeyActionsMask; + } + } + else { + XkbAction *pActs; + unsigned int new_vmodmask; + changed|= XkbKeyActionsMask; + pActs= XkbResizeKeyActions(xkb,key,nSyms); + if (!pActs) { + if (nSyms > IBUF_SIZE) + free(interps); + return FALSE; + } + new_vmodmask= 0; + for (n=0;nact); + if ((n==0)||((interps[n]->match&XkbSI_LevelOneOnly)==0)) { + effMods= mods; + if (interps[n]->virtual_mod!=XkbNoModifier) + new_vmodmask|= (1<virtual_mod); + } + else effMods= 0; + _XkbSetActionKeyMods(xkb,&pActs[n],effMods); + } + else pActs[n].type= XkbSA_NoAction; + } + if (((explicit&XkbExplicitVModMapMask)==0)&& + (xkb->server->vmodmap[key]!=new_vmodmask)) { + changed|= XkbVirtualModMapMask; + xkb->server->vmodmap[key]= new_vmodmask; + } + if (interps[0]) { + if ((interps[0]->flags&XkbSI_LockingKey)&& + ((explicit&XkbExplicitBehaviorMask)==0)) { + xkb->server->behaviors[key].type= XkbKB_Lock; + changed|= XkbKeyBehaviorsMask; + } + if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { + CARD8 old; + old= BitIsOn(xkb->ctrls->per_key_repeat, key); + if (interps[0]->flags&XkbSI_AutoRepeat) + SetBit(xkb->ctrls->per_key_repeat, key); + else + ClearBit(xkb->ctrls->per_key_repeat, key); + if (changes && old != BitIsOn(xkb->ctrls->per_key_repeat, key)) + changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; + } + } + } + if ((!found)||(interps[0]==NULL)) { + if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { + CARD8 old; + old = BitIsOn(xkb->ctrls->per_key_repeat, key); + SetBit(xkb->ctrls->per_key_repeat, key); + if (changes && (old != BitIsOn(xkb->ctrls->per_key_repeat, key))) + changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; + } + if (((explicit&XkbExplicitBehaviorMask)==0)&& + (xkb->server->behaviors[key].type==XkbKB_Lock)) { + xkb->server->behaviors[key].type= XkbKB_Default; + changed|= XkbKeyBehaviorsMask; + } + } + if (changes) { + XkbMapChangesPtr mc; + mc= &changes->map; + tmp= (changed&mc->changed); + if (tmp&XkbKeyActionsMask) + _XkbAddKeyChange(&mc->first_key_act,&mc->num_key_acts,key); + else if (changed&XkbKeyActionsMask) { + mc->changed|= XkbKeyActionsMask; + mc->first_key_act= key; + mc->num_key_acts= 1; + } + if (tmp&XkbKeyBehaviorsMask) { + _XkbAddKeyChange(&mc->first_key_behavior,&mc->num_key_behaviors, + key); + } + else if (changed&XkbKeyBehaviorsMask) { + mc->changed|= XkbKeyBehaviorsMask; + mc->first_key_behavior= key; + mc->num_key_behaviors= 1; + } + if (tmp&XkbVirtualModMapMask) + _XkbAddKeyChange(&mc->first_vmodmap_key,&mc->num_vmodmap_keys,key); + else if (changed&XkbVirtualModMapMask) { + mc->changed|= XkbVirtualModMapMask; + mc->first_vmodmap_key= key; + mc->num_vmodmap_keys= 1; + } + mc->changed|= changed; + } + if (interps!=ibuf) + free(interps); + return TRUE; +} + +Status +XkbChangeTypesOfKey( XkbDescPtr xkb, + int key, + int nGroups, + unsigned groups, + int * newTypesIn, + XkbMapChangesPtr changes) +{ +XkbKeyTypePtr pOldType,pNewType; +register int i; +int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups]; + + if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) || + (!xkb->map->types)||(!newTypesIn)||((groups&XkbAllGroupsMask)==0)|| + (nGroups>XkbNumKbdGroups)) { + return BadMatch; + } + if (nGroups==0) { + for (i=0;imap->key_sym_map[key].kt_index[i]= XkbOneLevelIndex; + } + i= xkb->map->key_sym_map[key].group_info; + i= XkbSetNumGroups(i,0); + xkb->map->key_sym_map[key].group_info= i; + XkbResizeKeySyms(xkb,key,0); + return Success; + } + + nOldGroups= XkbKeyNumGroups(xkb,key); + oldWidth= XkbKeyGroupsWidth(xkb,key); + for (width=i=0;i0) + newTypes[i]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); + else newTypes[i]= XkbTwoLevelIndex; + if (newTypes[i]>xkb->map->num_types) + return BadMatch; + pNewType= &xkb->map->types[newTypes[i]]; + if (pNewType->num_levels>width) + width= pNewType->num_levels; + } + if ((xkb->ctrls)&&(nGroups>xkb->ctrls->num_groups)) + xkb->ctrls->num_groups= nGroups; + if ((width!=oldWidth)||(nGroups!=nOldGroups)) { + KeySym oldSyms[XkbMaxSymsPerKey],*pSyms; + int nCopy; + + if (nOldGroups==0) { + pSyms= XkbResizeKeySyms(xkb,key,width*nGroups); + if (pSyms!=NULL) { + i= xkb->map->key_sym_map[key].group_info; + i= XkbSetNumGroups(i,nGroups); + xkb->map->key_sym_map[key].group_info= i; + xkb->map->key_sym_map[key].width= width; + for (i=0;imap->key_sym_map[key].kt_index[i]= newTypes[i]; + } + return Success; + } + return BadAlloc; + } + pSyms= XkbKeySymsPtr(xkb,key); + memcpy(oldSyms,pSyms,XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); + pSyms= XkbResizeKeySyms(xkb,key,width*nGroups); + if (pSyms==NULL) + return BadAlloc; + memset(pSyms, 0, width*nGroups*sizeof(KeySym)); + for (i=0;(imap->types[newTypes[i]]; + if (pNewType->num_levels>pOldType->num_levels) + nCopy= pOldType->num_levels; + else nCopy= pNewType->num_levels; + memcpy(&pSyms[i*width],&oldSyms[i*oldWidth],nCopy*sizeof(KeySym)); + } + if (XkbKeyHasActions(xkb,key)) { + XkbAction oldActs[XkbMaxSymsPerKey],*pActs; + pActs= XkbKeyActionsPtr(xkb,key); + memcpy(oldActs,pActs,XkbKeyNumSyms(xkb,key)*sizeof(XkbAction)); + pActs= XkbResizeKeyActions(xkb,key,width*nGroups); + if (pActs==NULL) + return BadAlloc; + memset(pActs, 0, width*nGroups*sizeof(XkbAction)); + for (i=0;(imap->types[newTypes[i]]; + if (pNewType->num_levels>pOldType->num_levels) + nCopy= pOldType->num_levels; + else nCopy= pNewType->num_levels; + memcpy(&pActs[i*width],&oldActs[i*oldWidth], + nCopy*sizeof(XkbAction)); + } + } + i= xkb->map->key_sym_map[key].group_info; + i= XkbSetNumGroups(i,nGroups); + xkb->map->key_sym_map[key].group_info= i; + xkb->map->key_sym_map[key].width= width; + } + width= 0; + for (i=0;imap->key_sym_map[key].kt_index[i]= newTypes[i]; + if (xkb->map->types[newTypes[i]].num_levels>width) + width= xkb->map->types[newTypes[i]].num_levels; + } + xkb->map->key_sym_map[key].width= width; + if (changes!=NULL) { + if (changes->changed&XkbKeySymsMask) { + _XkbAddKeyChange(&changes->first_key_sym,&changes->num_key_syms, + key); + } + else { + changes->changed|= XkbKeySymsMask; + changes->first_key_sym= key; + changes->num_key_syms= 1; + } + } + return Success; +} + +/***====================================================================***/ + +Bool +XkbVirtualModsToReal(XkbDescPtr xkb,unsigned virtual_mask,unsigned *mask_rtrn) +{ +register int i,bit; +register unsigned mask; + + if (xkb==NULL) + return FALSE; + if (virtual_mask==0) { + *mask_rtrn= 0; + return TRUE; + } + if (xkb->server==NULL) + return FALSE; + for (i=mask=0,bit=1;iserver->vmods[i]; + } + *mask_rtrn= mask; + return TRUE; +} + +/***====================================================================***/ + +static Bool +XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed) +{ +unsigned int tmp; + + switch (act->type) { + case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: + if (((tmp= XkbModActionVMods(&act->mods))&changed)!=0) { + XkbVirtualModsToReal(xkb,tmp,&tmp); + act->mods.mask= act->mods.real_mods; + act->mods.mask|= tmp; + return TRUE; + } + break; + case XkbSA_ISOLock: + if ((((tmp= XkbModActionVMods(&act->iso))!=0)&changed)!=0) { + XkbVirtualModsToReal(xkb,tmp,&tmp); + act->iso.mask= act->iso.real_mods; + act->iso.mask|= tmp; + return TRUE; + } + break; + } + return FALSE; +} + +static void +XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb, + XkbKeyTypePtr type, + unsigned int changed, + XkbChangesPtr changes) +{ +register unsigned int i; +unsigned int mask; + + XkbVirtualModsToReal(xkb,type->mods.vmods,&mask); + type->mods.mask= type->mods.real_mods|mask; + if ((type->map_count>0)&&(type->mods.vmods!=0)) { + XkbKTMapEntryPtr entry; + for (i=0,entry=type->map;imap_count;i++,entry++) { + if (entry->mods.vmods!=0) { + XkbVirtualModsToReal(xkb,entry->mods.vmods,&mask); + entry->mods.mask=entry->mods.real_mods|mask; + /* entry is active if vmods are bound*/ + entry->active= (mask!=0); + } + else entry->active= 1; + } + } + if (changes) { + int type_ndx; + type_ndx= type-xkb->map->types; + if ((type_ndx<0)||(type_ndx>xkb->map->num_types)) + return; + if (changes->map.changed&XkbKeyTypesMask) { + int last; + last= changes->map.first_type+changes->map.num_types-1; + if (type_ndxmap.first_type) { + changes->map.first_type= type_ndx; + changes->map.num_types= (last-type_ndx)+1; + } + else if (type_ndx>last) { + changes->map.num_types= (type_ndx-changes->map.first_type)+1; + } + } + else { + changes->map.changed|= XkbKeyTypesMask; + changes->map.first_type= type_ndx; + changes->map.num_types= 1; + } + } + return; +} + +Bool +XkbApplyVirtualModChanges(XkbDescPtr xkb,unsigned changed,XkbChangesPtr changes) +{ +register int i; +unsigned int checkState = 0; + + if ((!xkb) || (!xkb->map) || (changed==0)) + return FALSE; + for (i=0;imap->num_types;i++) { + if (xkb->map->types[i].mods.vmods & changed) + XkbUpdateKeyTypeVirtualMods(xkb,&xkb->map->types[i],changed,changes); + } + if (changed&xkb->ctrls->internal.vmods) { + unsigned int newMask; + XkbVirtualModsToReal(xkb,xkb->ctrls->internal.vmods,&newMask); + newMask|= xkb->ctrls->internal.real_mods; + if (xkb->ctrls->internal.mask!=newMask) { + xkb->ctrls->internal.mask= newMask; + if (changes) { + changes->ctrls.changed_ctrls|= XkbInternalModsMask; + checkState= TRUE; + } + } + } + if (changed&xkb->ctrls->ignore_lock.vmods) { + unsigned int newMask; + XkbVirtualModsToReal(xkb,xkb->ctrls->ignore_lock.vmods,&newMask); + newMask|= xkb->ctrls->ignore_lock.real_mods; + if (xkb->ctrls->ignore_lock.mask!=newMask) { + xkb->ctrls->ignore_lock.mask= newMask; + if (changes) { + changes->ctrls.changed_ctrls|= XkbIgnoreLockModsMask; + checkState= TRUE; + } + } + } + if (xkb->indicators!=NULL) { + XkbIndicatorMapPtr map; + map= &xkb->indicators->maps[0]; + for (i=0;imods.vmods&changed) { + unsigned int newMask; + XkbVirtualModsToReal(xkb,map->mods.vmods,&newMask); + newMask|= map->mods.real_mods; + if (newMask!=map->mods.mask) { + map->mods.mask= newMask; + if (changes) { + changes->indicators.map_changes|= (1<compat!=NULL) { + XkbCompatMapPtr compat; + compat= xkb->compat; + for (i=0;igroups[i].vmods,&newMask); + newMask|= compat->groups[i].real_mods; + if (compat->groups[i].mask!=newMask) { + compat->groups[i].mask= newMask; + if (changes) { + changes->compat.changed_groups|= (1<map && xkb->server) { + int highChange = 0, lowChange = -1; + for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { + if (XkbKeyHasActions(xkb,i)) { + register XkbAction *pAct; + register int n; + + pAct= XkbKeyActionsPtr(xkb,i); + for (n=XkbKeyNumActions(xkb,i);n>0;n--,pAct++) { + if ((pAct->type!=XkbSA_NoAction)&& + XkbUpdateActionVirtualMods(xkb,pAct,changed)) { + if (lowChange<0) + lowChange= i; + highChange= i; + } + } + } + } + if (changes && (lowChange>0)) { /* something changed */ + if (changes->map.changed&XkbKeyActionsMask) { + int last; + if (changes->map.first_key_actmap.first_key_act; + last= changes->map.first_key_act+changes->map.num_key_acts-1; + if (last>highChange) + highChange= last; + } + changes->map.changed|= XkbKeyActionsMask; + changes->map.first_key_act= lowChange; + changes->map.num_key_acts= (highChange-lowChange)+1; + } + } + return checkState; +} diff --git a/xorg-server/xkb/xkbUtils.c b/xorg-server/xkb/xkbUtils.c index 9db94773f..3a56bea4c 100644 --- a/xorg-server/xkb/xkbUtils.c +++ b/xorg-server/xkb/xkbUtils.c @@ -1,2122 +1,2125 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ -/* - -Copyright © 2008 Red Hat Inc. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "os.h" -#include -#include -#include -#include -#include -#define XK_CYRILLIC -#include -#include "misc.h" -#include "inputstr.h" -#include "eventstr.h" - -#define XKBSRV_NEED_FILE_FUNCS -#include -#include "xkbgeom.h" -#include "xkb.h" - -/***====================================================================***/ - -int -_XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client, - Mask access_mode, int *xkb_err) -{ - int rc = XkbKeyboardErrorCode; - - if (id == XkbUseCoreKbd) - id = PickKeyboard(client)->id; - else if (id == XkbUseCorePtr) - id = PickPointer(client)->id; - - rc = dixLookupDevice(pDev, id, client, access_mode); - if (rc != Success) - *xkb_err = XkbErr_BadDevice; - - return rc; -} - -int -_XkbLookupKeyboard(DeviceIntPtr *pDev, int id, ClientPtr client, - Mask access_mode, int *xkb_err) -{ - DeviceIntPtr dev; - int rc; - - if (id == XkbDfltXIId) - id = XkbUseCoreKbd; - - rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); - if (rc != Success) - return rc; - - dev = *pDev; - if (!dev->key || !dev->key->xkbInfo) { - *pDev = NULL; - *xkb_err= XkbErr_BadClass; - return XkbKeyboardErrorCode; - } - return Success; -} - -int -_XkbLookupBellDevice(DeviceIntPtr *pDev, int id, ClientPtr client, - Mask access_mode, int *xkb_err) -{ - DeviceIntPtr dev; - int rc; - - rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); - if (rc != Success) - return rc; - - dev = *pDev; - if (!dev->kbdfeed && !dev->bell) { - *pDev = NULL; - *xkb_err= XkbErr_BadClass; - return XkbKeyboardErrorCode; - } - return Success; -} - -int -_XkbLookupLedDevice(DeviceIntPtr *pDev, int id, ClientPtr client, - Mask access_mode, int *xkb_err) -{ - DeviceIntPtr dev; - int rc; - - if (id == XkbDfltXIId) - id = XkbUseCorePtr; - - rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); - if (rc != Success) - return rc; - - dev = *pDev; - if (!dev->kbdfeed && !dev->leds) { - *pDev = NULL; - *xkb_err= XkbErr_BadClass; - return XkbKeyboardErrorCode; - } - return Success; -} - -int -_XkbLookupButtonDevice(DeviceIntPtr *pDev, int id, ClientPtr client, - Mask access_mode, int *xkb_err) -{ - DeviceIntPtr dev; - int rc; - - rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); - if (rc != Success) - return rc; - - dev = *pDev; - if (!dev->button) { - *pDev = NULL; - *xkb_err= XkbErr_BadClass; - return XkbKeyboardErrorCode; - } - return Success; -} - -void -XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods) -{ -register unsigned tmp; - - switch (act->type) { - case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: - if (act->mods.flags&XkbSA_UseModMapMods) - act->mods.real_mods= act->mods.mask= mods; - if ((tmp= XkbModActionVMods(&act->mods))!=0) - act->mods.mask|= XkbMaskForVMask(xkb,tmp); - break; - case XkbSA_ISOLock: - if (act->iso.flags&XkbSA_UseModMapMods) - act->iso.real_mods= act->iso.mask= mods; - if ((tmp= XkbModActionVMods(&act->iso))!=0) - act->iso.mask|= XkbMaskForVMask(xkb,tmp); - break; - } - return; -} - -unsigned -XkbMaskForVMask(XkbDescPtr xkb,unsigned vmask) -{ -register int i,bit; -register unsigned mask; - - for (mask=i=0,bit=1;iserver->vmods[i]; - } - return mask; -} - -/***====================================================================***/ - -void -XkbUpdateKeyTypesFromCore( DeviceIntPtr pXDev, - KeySymsPtr pCore, - KeyCode first, - CARD8 num, - XkbChangesPtr changes) -{ -XkbDescPtr xkb; -unsigned key,nG,explicit; -int types[XkbNumKbdGroups]; -KeySym tsyms[XkbMaxSymsPerKey],*syms; -XkbMapChangesPtr mc; - - xkb= pXDev->key->xkbInfo->desc; - if (first+num-1>xkb->max_key_code) { - /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */ - num= xkb->max_key_code-first+1; - } - - mc= (changes?(&changes->map):NULL); - - syms= &pCore->map[(first - pCore->minKeyCode) * pCore->mapWidth]; - for (key=first; key<(first+num); key++,syms+= pCore->mapWidth) { - explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask; - types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); - types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index); - types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index); - types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index); - nG= XkbKeyTypesForCoreSymbols(xkb,pCore->mapWidth,syms,explicit,types, - tsyms); - XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc); - memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms, - XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); - } - if (changes->map.changed&XkbKeySymsMask) { - CARD8 oldLast,newLast; - oldLast = changes->map.first_key_sym+changes->map.num_key_syms-1; - newLast = first+num-1; - - if (firstmap.first_key_sym) - changes->map.first_key_sym = first; - if (oldLast>newLast) - newLast= oldLast; - changes->map.num_key_syms = newLast-changes->map.first_key_sym+1; - } - else { - changes->map.changed|= XkbKeySymsMask; - changes->map.first_key_sym = first; - changes->map.num_key_syms = num; - } - return; -} - -void -XkbUpdateDescActions( XkbDescPtr xkb, - KeyCode first, - CARD8 num, - XkbChangesPtr changes) -{ -register unsigned key; - - for (key=first;key<(first+num);key++) { - XkbApplyCompatMapToKey(xkb,key,changes); - } - - if (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask)) { - unsigned char newVMods[XkbNumVirtualMods]; - register unsigned bit,i; - unsigned present; - - memset(newVMods, 0, XkbNumVirtualMods); - present= 0; - for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { - if (xkb->server->vmodmap[key]==0) - continue; - for (i=0,bit=1;iserver->vmodmap[key]) { - present|= bit; - newVMods[i]|= xkb->map->modmap[key]; - } - } - } - for (i=0,bit=1;iserver->vmods[i])) { - changes->map.changed|= XkbVirtualModsMask; - changes->map.vmods|= bit; - xkb->server->vmods[i]= newVMods[i]; - } - } - } - if (changes->map.changed&XkbVirtualModsMask) - XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes); - - if (changes->map.changed&XkbKeyActionsMask) { - CARD8 oldLast,newLast; - oldLast= changes->map.first_key_act+changes->map.num_key_acts-1; - newLast = first+num-1; - - if (firstmap.first_key_act) - changes->map.first_key_act = first; - if (newLast>oldLast) - newLast= oldLast; - changes->map.num_key_acts= newLast-changes->map.first_key_act+1; - } - else { - changes->map.changed|= XkbKeyActionsMask; - changes->map.first_key_act = first; - changes->map.num_key_acts = num; - } - return; -} - -void -XkbUpdateActions( DeviceIntPtr pXDev, - KeyCode first, - CARD8 num, - XkbChangesPtr changes, - unsigned * needChecksRtrn, - XkbEventCausePtr cause) -{ -XkbSrvInfoPtr xkbi; -XkbDescPtr xkb; -CARD8 * repeat; - - if (needChecksRtrn) - *needChecksRtrn= 0; - xkbi= pXDev->key->xkbInfo; - xkb= xkbi->desc; - repeat= xkb->ctrls->per_key_repeat; - - if (pXDev->kbdfeed) - memcpy(repeat,pXDev->kbdfeed->ctrl.autoRepeats,XkbPerKeyBitArraySize); - - XkbUpdateDescActions(xkb,first,num,changes); - - if ((pXDev->kbdfeed)&& - (changes->ctrls.enabled_ctrls_changes&XkbPerKeyRepeatMask)) { - memcpy(pXDev->kbdfeed->ctrl.autoRepeats,repeat, XkbPerKeyBitArraySize); - (*pXDev->kbdfeed->CtrlProc)(pXDev, &pXDev->kbdfeed->ctrl); - } - return; -} - -KeySymsPtr -XkbGetCoreMap(DeviceIntPtr keybd) -{ -register int key,tmp; -int maxSymsPerKey, maxGroup1Width; -XkbDescPtr xkb; -KeySymsPtr syms; -int maxNumberOfGroups; - - if (!keybd || !keybd->key || !keybd->key->xkbInfo) - return NULL; - - xkb= keybd->key->xkbInfo->desc; - maxSymsPerKey= maxGroup1Width= 0; - maxNumberOfGroups = 0; - - /* determine sizes */ - for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { - if (XkbKeycodeInRange(xkb,key)) { - int nGroups; - int w; - nGroups= XkbKeyNumGroups(xkb,key); - tmp= 0; - if (nGroups>0) { - if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup1Index))<=2) - tmp+= 2; - else tmp+= w + 2; - /* remember highest G1 width */ - if (w > maxGroup1Width) - maxGroup1Width = w; - } - if (nGroups>1) { - if (tmp <= 2) { - if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup2Index))<2) - tmp+= 2; - else tmp+= w; - } else { - if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup2Index))>2) - tmp+= w - 2; - } - } - if (nGroups>2) - tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup3Index); - if (nGroups>3) - tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup4Index); - if (tmp>maxSymsPerKey) - maxSymsPerKey= tmp; - if (nGroups > maxNumberOfGroups) - maxNumberOfGroups = nGroups; - } - } - - if (maxSymsPerKey <= 0) - return NULL; - - syms = calloc(1, sizeof(*syms)); - if (!syms) - return NULL; - - /* See Section 12.4 of the XKB Protocol spec. Because of the - * single-group distribution for multi-group keyboards, we have to - * have enough symbols for the largest group 1 to replicate across the - * number of groups on the keyboard. e.g. a single-group key with 4 - * symbols on a keyboard that has 3 groups -> 12 syms per key */ - if (maxSymsPerKey < maxNumberOfGroups * maxGroup1Width) - maxSymsPerKey = maxNumberOfGroups * maxGroup1Width; - - syms->mapWidth = maxSymsPerKey; - syms->minKeyCode = xkb->min_key_code; - syms->maxKeyCode = xkb->max_key_code; - - tmp = syms->mapWidth * (xkb->max_key_code - xkb->min_key_code + 1); - syms->map = calloc(tmp, sizeof(*syms->map)); - if (!syms->map) { - free(syms); - return NULL; - } - - for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { - KeySym *pCore,*pXKB; - unsigned nGroups,groupWidth,n,nOut; - - nGroups= XkbKeyNumGroups(xkb,key); - n= (key-xkb->min_key_code)*syms->mapWidth; - pCore= &syms->map[n]; - pXKB= XkbKeySymsPtr(xkb,key); - nOut= 2; - if (nGroups>0) { - groupWidth= XkbKeyGroupWidth(xkb,key,XkbGroup1Index); - if (groupWidth>0) pCore[0]= pXKB[0]; - if (groupWidth>1) pCore[1]= pXKB[1]; - for (n=2;n2) - nOut= groupWidth; - } - - /* See XKB Protocol Sec, Section 12.4. - A 1-group key with ABCDE on a 2 group keyboard must be - duplicated across all groups as ABABCDECDE. - */ - if (nGroups == 1) - { - int idx, j; - - groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup1Index); - - /* AB..CDE... -> ABABCDE... */ - if (groupWidth > 0 && syms->mapWidth >= 3) - pCore[2] = pCore[0]; - if (groupWidth > 1 && syms->mapWidth >= 4) - pCore[3] = pCore[1]; - - /* ABABCDE... -> ABABCDECDE */ - idx = 2 + groupWidth; - while (groupWidth > 2 && idx < syms->mapWidth && - idx < groupWidth * 2) - { - pCore[idx] = pCore[idx - groupWidth + 2]; - idx++; - } - idx = 2 * groupWidth; - if (idx < 4) - idx = 4; - /* 3 or more groups: ABABCDECDEABCDEABCDE */ - for (j = 3; j <= maxNumberOfGroups; j++) - for (n = 0; n < groupWidth && idx < maxSymsPerKey; n++) - pCore[idx++] = pXKB[n]; - } - - pXKB+= XkbKeyGroupsWidth(xkb,key); - nOut+= 2; - if (nGroups>1) { - groupWidth= XkbKeyGroupWidth(xkb,key,XkbGroup2Index); - if (groupWidth>0) pCore[2]= pXKB[0]; - if (groupWidth>1) pCore[3]= pXKB[1]; - for (n=2;n2) - nOut+= (groupWidth-2); - } - pXKB+= XkbKeyGroupsWidth(xkb,key); - for (n=XkbGroup3Index;nkey && pXDev->key->xkbInfo) { - xkbControlsNotify cn; - XkbControlsPtr ctrls = pXDev->key->xkbInfo->desc->ctrls; - XkbControlsRec old; - old = *ctrls; - - if (key== -1) { /* global autorepeat setting changed */ - if (onoff) ctrls->enabled_ctrls |= XkbRepeatKeysMask; - else ctrls->enabled_ctrls &= ~XkbRepeatKeysMask; - } - else if (pXDev->kbdfeed) { - ctrls->per_key_repeat[key/8] = - pXDev->kbdfeed->ctrl.autoRepeats[key/8]; - } - - if (XkbComputeControlsNotify(pXDev,&old,ctrls,&cn,TRUE)) - XkbSendControlsNotify(pXDev,&cn); - } - return; -} - -/* Applies a change to a single device, does not traverse the device tree. */ -void -XkbApplyMappingChange(DeviceIntPtr kbd, KeySymsPtr map, KeyCode first_key, - CARD8 num_keys, CARD8 *modmap, ClientPtr client) -{ - XkbDescPtr xkb = kbd->key->xkbInfo->desc; - XkbEventCauseRec cause; - XkbChangesRec changes; - unsigned int check; - - memset(&changes, 0, sizeof(changes)); - memset(&cause, 0, sizeof(cause)); - - if (map && first_key && num_keys) { - check = 0; - XkbSetCauseCoreReq(&cause, X_ChangeKeyboardMapping, client); - - XkbUpdateKeyTypesFromCore(kbd, map, first_key, num_keys, &changes); - XkbUpdateActions(kbd, first_key, num_keys, &changes, &check, &cause); - - if (check) - XkbCheckSecondaryEffects(kbd->key->xkbInfo, 1, &changes, &cause); - } - - if (modmap) { - /* A keymap change can imply a modmap change, se we prefer the - * former. */ - if (!cause.mjr) - XkbSetCauseCoreReq(&cause,X_SetModifierMapping,client); - - check = 0; - num_keys = xkb->max_key_code - xkb->min_key_code + 1; - changes.map.changed |= XkbModifierMapMask; - changes.map.first_modmap_key = xkb->min_key_code; - changes.map.num_modmap_keys = num_keys; - memcpy(kbd->key->xkbInfo->desc->map->modmap, modmap, MAP_LENGTH); - XkbUpdateActions(kbd, xkb->min_key_code, num_keys, &changes, &check, - &cause); - - if (check) - XkbCheckSecondaryEffects(kbd->key->xkbInfo, 1, &changes, &cause); - } - - XkbSendNotification(kbd, &changes, &cause); -} - -void -XkbDisableComputedAutoRepeats(DeviceIntPtr dev,unsigned key) -{ -XkbSrvInfoPtr xkbi = dev->key->xkbInfo; -xkbMapNotify mn; - - xkbi->desc->server->explicit[key]|= XkbExplicitAutoRepeatMask; - memset(&mn, 0, sizeof(mn)); - mn.changed= XkbExplicitComponentsMask; - mn.firstKeyExplicit= key; - mn.nKeyExplicit= 1; - XkbSendMapNotify(dev,&mn); - return; -} - -unsigned -XkbStateChangedFlags(XkbStatePtr old,XkbStatePtr new) -{ -int changed; - - changed=(old->group!=new->group?XkbGroupStateMask:0); - changed|=(old->base_group!=new->base_group?XkbGroupBaseMask:0); - changed|=(old->latched_group!=new->latched_group?XkbGroupLatchMask:0); - changed|=(old->locked_group!=new->locked_group?XkbGroupLockMask:0); - changed|=(old->mods!=new->mods?XkbModifierStateMask:0); - changed|=(old->base_mods!=new->base_mods?XkbModifierBaseMask:0); - changed|=(old->latched_mods!=new->latched_mods?XkbModifierLatchMask:0); - changed|=(old->locked_mods!=new->locked_mods?XkbModifierLockMask:0); - changed|=(old->compat_state!=new->compat_state?XkbCompatStateMask:0); - changed|=(old->grab_mods!=new->grab_mods?XkbGrabModsMask:0); - if (old->compat_grab_mods!=new->compat_grab_mods) - changed|= XkbCompatGrabModsMask; - changed|=(old->lookup_mods!=new->lookup_mods?XkbLookupModsMask:0); - if (old->compat_lookup_mods!=new->compat_lookup_mods) - changed|= XkbCompatLookupModsMask; - changed|=(old->ptr_buttons!=new->ptr_buttons?XkbPointerButtonMask:0); - return changed; -} - -static void -XkbComputeCompatState(XkbSrvInfoPtr xkbi) -{ -CARD16 grp_mask; -XkbStatePtr state= &xkbi->state; -XkbCompatMapPtr map; - - if (!state || !xkbi->desc || !xkbi->desc->ctrls || !xkbi->desc->compat) - return; - - map= xkbi->desc->compat; - grp_mask= map->groups[state->group].mask; - state->compat_state = state->mods|grp_mask; - state->compat_lookup_mods= state->lookup_mods|grp_mask; - - if (xkbi->desc->ctrls->enabled_ctrls&XkbIgnoreGroupLockMask) - grp_mask= map->groups[state->base_group].mask; - state->compat_grab_mods= state->grab_mods|grp_mask; - return; -} - -unsigned -XkbAdjustGroup(int group,XkbControlsPtr ctrls) -{ -unsigned act; - - act= XkbOutOfRangeGroupAction(ctrls->groups_wrap); - if (group<0) { - while ( group < 0 ) { - if (act==XkbClampIntoRange) { - group= XkbGroup1Index; - } - else if (act==XkbRedirectIntoRange) { - int newGroup; - newGroup= XkbOutOfRangeGroupNumber(ctrls->groups_wrap); - if (newGroup>=ctrls->num_groups) - group= XkbGroup1Index; - else group= newGroup; - } - else { - group+= ctrls->num_groups; - } - } - } - else if (group>=ctrls->num_groups) { - if (act==XkbClampIntoRange) { - group= ctrls->num_groups-1; - } - else if (act==XkbRedirectIntoRange) { - int newGroup; - newGroup= XkbOutOfRangeGroupNumber(ctrls->groups_wrap); - if (newGroup>=ctrls->num_groups) - group= XkbGroup1Index; - else group= newGroup; - } - else { - group%= ctrls->num_groups; - } - } - return group; -} - -void -XkbComputeDerivedState(XkbSrvInfoPtr xkbi) -{ -XkbStatePtr state= &xkbi->state; -XkbControlsPtr ctrls= xkbi->desc->ctrls; -unsigned char grp; - - if (!state || !ctrls) - return; - - state->mods= (state->base_mods|state->latched_mods|state->locked_mods); - state->lookup_mods= state->mods&(~ctrls->internal.mask); - state->grab_mods= state->lookup_mods&(~ctrls->ignore_lock.mask); - state->grab_mods|= - ((state->base_mods|state->latched_mods)&ctrls->ignore_lock.mask); - - - grp= state->locked_group; - if (grp>=ctrls->num_groups) - state->locked_group= XkbAdjustGroup(XkbCharToInt(grp),ctrls); - - grp= state->locked_group+state->base_group+state->latched_group; - if (grp>=ctrls->num_groups) - state->group= XkbAdjustGroup(XkbCharToInt(grp),ctrls); - else state->group= grp; - XkbComputeCompatState(xkbi); - return; -} - -/***====================================================================***/ - -void -XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi, - unsigned which, - XkbChangesPtr changes, - XkbEventCausePtr cause) -{ - if (which&XkbStateNotifyMask) { - XkbStateRec old; - old= xkbi->state; - changes->state_changes|= XkbStateChangedFlags(&old,&xkbi->state); - XkbComputeDerivedState(xkbi); - } - if (which&XkbIndicatorStateNotifyMask) - XkbUpdateIndicators(xkbi->device,XkbAllIndicatorsMask,TRUE,changes, - cause); - return; -} - -/***====================================================================***/ - -Bool -XkbEnableDisableControls( XkbSrvInfoPtr xkbi, - unsigned long change, - unsigned long newValues, - XkbChangesPtr changes, - XkbEventCausePtr cause) -{ -XkbControlsPtr ctrls; -unsigned old; -XkbSrvLedInfoPtr sli; - - ctrls= xkbi->desc->ctrls; - old= ctrls->enabled_ctrls; - ctrls->enabled_ctrls&= ~change; - ctrls->enabled_ctrls|= (change&newValues); - if (old==ctrls->enabled_ctrls) - return FALSE; - if (cause!=NULL) { - xkbControlsNotify cn; - cn.numGroups= ctrls->num_groups; - cn.changedControls= XkbControlsEnabledMask; - cn.enabledControls= ctrls->enabled_ctrls; - cn.enabledControlChanges= (ctrls->enabled_ctrls^old); - cn.keycode= cause->kc; - cn.eventType= cause->event; - cn.requestMajor= cause->mjr; - cn.requestMinor= cause->mnr; - XkbSendControlsNotify(xkbi->device,&cn); - } - else { - /* Yes, this really should be an XOR. If ctrls->enabled_ctrls_changes*/ - /* is non-zero, the controls in question changed already in "this" */ - /* request and this change merely undoes the previous one. By the */ - /* same token, we have to figure out whether or not ControlsEnabled */ - /* should be set or not in the changes structure */ - changes->ctrls.enabled_ctrls_changes^= (ctrls->enabled_ctrls^old); - if (changes->ctrls.enabled_ctrls_changes) - changes->ctrls.changed_ctrls|= XkbControlsEnabledMask; - else changes->ctrls.changed_ctrls&= ~XkbControlsEnabledMask; - } - sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0); - XkbUpdateIndicators(xkbi->device,sli->usesControls,TRUE,changes,cause); - return TRUE; -} - -/***====================================================================***/ - -#define MAX_TOC 16 - -XkbGeometryPtr -XkbLookupNamedGeometry(DeviceIntPtr dev,Atom name,Bool *shouldFree) -{ -XkbSrvInfoPtr xkbi= dev->key->xkbInfo; -XkbDescPtr xkb= xkbi->desc; - - *shouldFree= 0; - if (name==None) { - if (xkb->geom!=NULL) - return xkb->geom; - name= xkb->names->geometry; - } - if ((xkb->geom!=NULL)&&(xkb->geom->name==name)) - return xkb->geom; - *shouldFree= 1; - return NULL; -} - -void -XkbConvertCase(register KeySym sym, KeySym *lower, KeySym *upper) -{ - *lower = sym; - *upper = sym; - switch(sym >> 8) { - case 0: /* Latin 1 */ - if ((sym >= XK_A) && (sym <= XK_Z)) - *lower += (XK_a - XK_A); - else if ((sym >= XK_a) && (sym <= XK_z)) - *upper -= (XK_a - XK_A); - else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis)) - *lower += (XK_agrave - XK_Agrave); - else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis)) - *upper -= (XK_agrave - XK_Agrave); - else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn)) - *lower += (XK_oslash - XK_Ooblique); - else if ((sym >= XK_oslash) && (sym <= XK_thorn)) - *upper -= (XK_oslash - XK_Ooblique); - break; - case 1: /* Latin 2 */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym == XK_Aogonek) - *lower = XK_aogonek; - else if (sym >= XK_Lstroke && sym <= XK_Sacute) - *lower += (XK_lstroke - XK_Lstroke); - else if (sym >= XK_Scaron && sym <= XK_Zacute) - *lower += (XK_scaron - XK_Scaron); - else if (sym >= XK_Zcaron && sym <= XK_Zabovedot) - *lower += (XK_zcaron - XK_Zcaron); - else if (sym == XK_aogonek) - *upper = XK_Aogonek; - else if (sym >= XK_lstroke && sym <= XK_sacute) - *upper -= (XK_lstroke - XK_Lstroke); - else if (sym >= XK_scaron && sym <= XK_zacute) - *upper -= (XK_scaron - XK_Scaron); - else if (sym >= XK_zcaron && sym <= XK_zabovedot) - *upper -= (XK_zcaron - XK_Zcaron); - else if (sym >= XK_Racute && sym <= XK_Tcedilla) - *lower += (XK_racute - XK_Racute); - else if (sym >= XK_racute && sym <= XK_tcedilla) - *upper -= (XK_racute - XK_Racute); - break; - case 2: /* Latin 3 */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym >= XK_Hstroke && sym <= XK_Hcircumflex) - *lower += (XK_hstroke - XK_Hstroke); - else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex) - *lower += (XK_gbreve - XK_Gbreve); - else if (sym >= XK_hstroke && sym <= XK_hcircumflex) - *upper -= (XK_hstroke - XK_Hstroke); - else if (sym >= XK_gbreve && sym <= XK_jcircumflex) - *upper -= (XK_gbreve - XK_Gbreve); - else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex) - *lower += (XK_cabovedot - XK_Cabovedot); - else if (sym >= XK_cabovedot && sym <= XK_scircumflex) - *upper -= (XK_cabovedot - XK_Cabovedot); - break; - case 3: /* Latin 4 */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym >= XK_Rcedilla && sym <= XK_Tslash) - *lower += (XK_rcedilla - XK_Rcedilla); - else if (sym >= XK_rcedilla && sym <= XK_tslash) - *upper -= (XK_rcedilla - XK_Rcedilla); - else if (sym == XK_ENG) - *lower = XK_eng; - else if (sym == XK_eng) - *upper = XK_ENG; - else if (sym >= XK_Amacron && sym <= XK_Umacron) - *lower += (XK_amacron - XK_Amacron); - else if (sym >= XK_amacron && sym <= XK_umacron) - *upper -= (XK_amacron - XK_Amacron); - break; - case 6: /* Cyrillic */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE) - *lower -= (XK_Serbian_DJE - XK_Serbian_dje); - else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze) - *upper += (XK_Serbian_DJE - XK_Serbian_dje); - else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN) - *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu); - else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign) - *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu); - break; - case 7: /* Greek */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent) - *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); - else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent && - sym != XK_Greek_iotaaccentdieresis && - sym != XK_Greek_upsilonaccentdieresis) - *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); - else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA) - *lower += (XK_Greek_alpha - XK_Greek_ALPHA); - else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega && - sym != XK_Greek_finalsmallsigma) - *upper -= (XK_Greek_alpha - XK_Greek_ALPHA); - break; - } -} - -static Bool -_XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) -{ - void *tmp = NULL; - int i; - XkbKeyTypePtr stype = NULL, dtype = NULL; - - /* client map */ - if (src->map) { - if (!dst->map) { - tmp = calloc(1, sizeof(XkbClientMapRec)); - if (!tmp) - return FALSE; - dst->map = tmp; - } - - if (src->map->syms) { - if (src->map->size_syms != dst->map->size_syms) { - tmp = realloc(dst->map->syms, - src->map->size_syms * sizeof(KeySym)); - if (!tmp) - return FALSE; - dst->map->syms = tmp; - - } - memcpy(dst->map->syms, src->map->syms, - src->map->size_syms * sizeof(KeySym)); - } - else { - free(dst->map->syms); - dst->map->syms = NULL; - } - dst->map->num_syms = src->map->num_syms; - dst->map->size_syms = src->map->size_syms; - - if (src->map->key_sym_map) { - if (src->max_key_code != dst->max_key_code) { - tmp = realloc(dst->map->key_sym_map, - (src->max_key_code + 1) * sizeof(XkbSymMapRec)); - if (!tmp) - return FALSE; - dst->map->key_sym_map = tmp; - } - memcpy(dst->map->key_sym_map, src->map->key_sym_map, - (src->max_key_code + 1) * sizeof(XkbSymMapRec)); - } - else { - free(dst->map->key_sym_map); - dst->map->key_sym_map = NULL; - } - - if (src->map->types && src->map->num_types) { - if (src->map->num_types > dst->map->size_types || - !dst->map->types || !dst->map->size_types) { - if (dst->map->types && dst->map->size_types) { - tmp = realloc(dst->map->types, - src->map->num_types * sizeof(XkbKeyTypeRec)); - if (!tmp) - return FALSE; - dst->map->types = tmp; - memset(dst->map->types + dst->map->num_types, 0, - (src->map->num_types - dst->map->num_types) * - sizeof(XkbKeyTypeRec)); - } - else { - tmp = calloc(src->map->num_types, sizeof(XkbKeyTypeRec)); - if (!tmp) - return FALSE; - dst->map->types = tmp; - } - } - else if (src->map->num_types < dst->map->num_types && - dst->map->types) { - for (i = src->map->num_types, dtype = (dst->map->types + i); - i < dst->map->num_types; i++, dtype++) { - free(dtype->level_names); - dtype->level_names = NULL; - dtype->num_levels = 0; - if (dtype->map_count) { - free(dtype->map); - free(dtype->preserve); - } - } - } - - stype = src->map->types; - dtype = dst->map->types; - for (i = 0; i < src->map->num_types; i++, dtype++, stype++) { - if (stype->num_levels && stype->level_names) { - if (stype->num_levels != dtype->num_levels && - dtype->num_levels && dtype->level_names && - i < dst->map->num_types) { - tmp = realloc(dtype->level_names, - stype->num_levels * sizeof(Atom)); - if (!tmp) - continue; - dtype->level_names = tmp; - } - else if (!dtype->num_levels || !dtype->level_names || - i >= dst->map->num_types) { - tmp = malloc(stype->num_levels * sizeof(Atom)); - if (!tmp) - continue; - dtype->level_names = tmp; - } - dtype->num_levels = stype->num_levels; - memcpy(dtype->level_names, stype->level_names, - stype->num_levels * sizeof(Atom)); - } - else { - if (dtype->num_levels && dtype->level_names && - i < dst->map->num_types) - free(dtype->level_names); - dtype->num_levels = 0; - dtype->level_names = NULL; - } - - dtype->name = stype->name; - memcpy(&dtype->mods, &stype->mods, sizeof(XkbModsRec)); - - if (stype->map_count) { - if (stype->map) { - if (stype->map_count != dtype->map_count && - dtype->map_count && dtype->map && - i < dst->map->num_types) { - tmp = realloc(dtype->map, - stype->map_count * - sizeof(XkbKTMapEntryRec)); - if (!tmp) - return FALSE; - dtype->map = tmp; - } - else if (!dtype->map_count || !dtype->map || - i >= dst->map->num_types) { - tmp = malloc(stype->map_count * - sizeof(XkbKTMapEntryRec)); - if (!tmp) - return FALSE; - dtype->map = tmp; - } - - memcpy(dtype->map, stype->map, - stype->map_count * sizeof(XkbKTMapEntryRec)); - } - else { - if (dtype->map && i < dst->map->num_types) - free(dtype->map); - dtype->map = NULL; - } - - if (stype->preserve) { - if (stype->map_count != dtype->map_count && - dtype->map_count && dtype->preserve && - i < dst->map->num_types) { - tmp = realloc(dtype->preserve, - stype->map_count * - sizeof(XkbModsRec)); - if (!tmp) - return FALSE; - dtype->preserve = tmp; - } - else if (!dtype->preserve || !dtype->map_count || - i >= dst->map->num_types) { - tmp = malloc(stype->map_count * - sizeof(XkbModsRec)); - if (!tmp) - return FALSE; - dtype->preserve = tmp; - } - - memcpy(dtype->preserve, stype->preserve, - stype->map_count * sizeof(XkbModsRec)); - } - else { - if (dtype->preserve && i < dst->map->num_types) - free(dtype->preserve); - dtype->preserve = NULL; - } - - dtype->map_count = stype->map_count; - } - else { - if (dtype->map_count && i < dst->map->num_types) { - free(dtype->map); - free(dtype->preserve); - } - dtype->map_count = 0; - dtype->map = NULL; - dtype->preserve = NULL; - } - } - - dst->map->size_types = src->map->num_types; - dst->map->num_types = src->map->num_types; - } - else { - if (dst->map->types) { - for (i = 0, dtype = dst->map->types; i < dst->map->num_types; - i++, dtype++) { - free(dtype->level_names); - if (dtype->map && dtype->map_count) - free(dtype->map); - if (dtype->preserve && dtype->map_count) - free(dtype->preserve); - } - } - free(dst->map->types); - dst->map->types = NULL; - dst->map->num_types = 0; - dst->map->size_types = 0; - } - - if (src->map->modmap) { - if (src->max_key_code != dst->max_key_code) { - tmp = realloc(dst->map->modmap, src->max_key_code + 1); - if (!tmp) - return FALSE; - dst->map->modmap = tmp; - } - memcpy(dst->map->modmap, src->map->modmap, src->max_key_code + 1); - } - else { - free(dst->map->modmap); - dst->map->modmap = NULL; - } - } - else { - if (dst->map) - XkbFreeClientMap(dst, XkbAllClientInfoMask, TRUE); - } - - return TRUE; -} - -static Bool -_XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) -{ - void *tmp = NULL; - - /* server map */ - if (src->server) { - if (!dst->server) { - tmp = calloc(1, sizeof(XkbServerMapRec)); - if (!tmp) - return FALSE; - dst->server = tmp; - } - - if (src->server->explicit) { - if (src->max_key_code != dst->max_key_code) { - tmp = realloc(dst->server->explicit, src->max_key_code + 1); - if (!tmp) - return FALSE; - dst->server->explicit = tmp; - } - memcpy(dst->server->explicit, src->server->explicit, - src->max_key_code + 1); - } - else { - free(dst->server->explicit); - dst->server->explicit = NULL; - } - - if (src->server->acts) { - if (src->server->size_acts != dst->server->size_acts) { - tmp = realloc(dst->server->acts, - src->server->size_acts * sizeof(XkbAction)); - if (!tmp) - return FALSE; - dst->server->acts = tmp; - } - memcpy(dst->server->acts, src->server->acts, - src->server->size_acts * sizeof(XkbAction)); - } - else { - free(dst->server->acts); - dst->server->acts = NULL; - } - dst->server->size_acts = src->server->size_acts; - dst->server->num_acts = src->server->num_acts; - - if (src->server->key_acts) { - if (src->max_key_code != dst->max_key_code) { - tmp = realloc(dst->server->key_acts, - (src->max_key_code + 1) * sizeof(unsigned short)); - if (!tmp) - return FALSE; - dst->server->key_acts = tmp; - } - memcpy(dst->server->key_acts, src->server->key_acts, - (src->max_key_code + 1) * sizeof(unsigned short)); - } - else { - free(dst->server->key_acts); - dst->server->key_acts = NULL; - } - - if (src->server->behaviors) { - if (src->max_key_code != dst->max_key_code) { - tmp = realloc(dst->server->behaviors, - (src->max_key_code + 1) * sizeof(XkbBehavior)); - if (!tmp) - return FALSE; - dst->server->behaviors = tmp; - } - memcpy(dst->server->behaviors, src->server->behaviors, - (src->max_key_code + 1) * sizeof(XkbBehavior)); - } - else { - free(dst->server->behaviors); - dst->server->behaviors = NULL; - } - - memcpy(dst->server->vmods, src->server->vmods, XkbNumVirtualMods); - - if (src->server->vmodmap) { - if (src->max_key_code != dst->max_key_code) { - tmp = realloc(dst->server->vmodmap, - (src->max_key_code + 1) * sizeof(unsigned short)); - if (!tmp) - return FALSE; - dst->server->vmodmap = tmp; - } - memcpy(dst->server->vmodmap, src->server->vmodmap, - (src->max_key_code + 1) * sizeof(unsigned short)); - } - else { - free(dst->server->vmodmap); - dst->server->vmodmap = NULL; - } - } - else { - if (dst->server) - XkbFreeServerMap(dst, XkbAllServerInfoMask, TRUE); - } - - return TRUE; -} - -static Bool -_XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) -{ - void *tmp = NULL; - - /* names */ - if (src->names) { - if (!dst->names) { - dst->names = calloc(1, sizeof(XkbNamesRec)); - if (!dst->names) - return FALSE; - } - - if (src->names->keys) { - if (src->max_key_code != dst->max_key_code) { - tmp = realloc(dst->names->keys, - (src->max_key_code + 1) * sizeof(XkbKeyNameRec)); - if (!tmp) - return FALSE; - dst->names->keys = tmp; - } - memcpy(dst->names->keys, src->names->keys, - (src->max_key_code + 1) * sizeof(XkbKeyNameRec)); - } - else { - free(dst->names->keys); - dst->names->keys = NULL; - } - - if (src->names->num_key_aliases) { - if (src->names->num_key_aliases != dst->names->num_key_aliases) { - tmp = realloc(dst->names->key_aliases, - src->names->num_key_aliases * - sizeof(XkbKeyAliasRec)); - if (!tmp) - return FALSE; - dst->names->key_aliases = tmp; - } - memcpy(dst->names->key_aliases, src->names->key_aliases, - src->names->num_key_aliases * sizeof(XkbKeyAliasRec)); - } - else { - free(dst->names->key_aliases); - dst->names->key_aliases = NULL; - } - dst->names->num_key_aliases = src->names->num_key_aliases; - - if (src->names->num_rg) { - if (src->names->num_rg != dst->names->num_rg) { - tmp = realloc(dst->names->radio_groups, - src->names->num_rg * sizeof(Atom)); - if (!tmp) - return FALSE; - dst->names->radio_groups = tmp; - } - memcpy(dst->names->radio_groups, src->names->radio_groups, - src->names->num_rg * sizeof(Atom)); - } - else { - free(dst->names->radio_groups); - } - dst->names->num_rg = src->names->num_rg; - - dst->names->keycodes = src->names->keycodes; - dst->names->geometry = src->names->geometry; - dst->names->symbols = src->names->symbols; - dst->names->types = src->names->types; - dst->names->compat = src->names->compat; - dst->names->phys_symbols = src->names->phys_symbols; - - memcpy(dst->names->vmods, src->names->vmods, - XkbNumVirtualMods * sizeof(Atom)); - memcpy(dst->names->indicators, src->names->indicators, - XkbNumIndicators * sizeof(Atom)); - memcpy(dst->names->groups, src->names->groups, - XkbNumKbdGroups * sizeof(Atom)); - } - else { - if (dst->names) - XkbFreeNames(dst, XkbAllNamesMask, TRUE); - } - - return TRUE; -} - -static Bool -_XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst) -{ - void *tmp = NULL; - - /* compat */ - if (src->compat) { - if (!dst->compat) { - dst->compat = calloc(1, sizeof(XkbCompatMapRec)); - if (!dst->compat) - return FALSE; - } - - if (src->compat->sym_interpret && src->compat->num_si) { - if (src->compat->num_si != dst->compat->size_si) { - tmp = realloc(dst->compat->sym_interpret, - src->compat->num_si * sizeof(XkbSymInterpretRec)); - if (!tmp) - return FALSE; - dst->compat->sym_interpret = tmp; - } - memcpy(dst->compat->sym_interpret, src->compat->sym_interpret, - src->compat->num_si * sizeof(XkbSymInterpretRec)); - - dst->compat->num_si = src->compat->num_si; - dst->compat->size_si = src->compat->num_si; - } - else { - if (dst->compat->sym_interpret && dst->compat->size_si) - free(dst->compat->sym_interpret); - - dst->compat->sym_interpret = NULL; - dst->compat->num_si = 0; - dst->compat->size_si = 0; - } - - memcpy(dst->compat->groups, src->compat->groups, - XkbNumKbdGroups * sizeof(XkbModsRec)); - } - else { - if (dst->compat) - XkbFreeCompatMap(dst, XkbAllCompatMask, TRUE); - } - - return TRUE; -} - -static Bool -_XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) -{ - void *tmp = NULL; - int i = 0, j = 0, k = 0; - XkbColorPtr scolor = NULL, dcolor = NULL; - XkbDoodadPtr sdoodad = NULL, ddoodad = NULL; - XkbOutlinePtr soutline = NULL, doutline = NULL; - XkbPropertyPtr sprop = NULL, dprop = NULL; - XkbRowPtr srow = NULL, drow = NULL; - XkbSectionPtr ssection = NULL, dsection = NULL; - XkbShapePtr sshape = NULL, dshape = NULL; - - /* geometry */ - if (src->geom) { - if (!dst->geom) { - dst->geom = calloc(sizeof(XkbGeometryRec), 1); - if (!dst->geom) - return FALSE; - } - - /* properties */ - if (src->geom->num_properties) { - if (src->geom->num_properties != dst->geom->sz_properties) { - /* If we've got more properties in the destination than - * the source, run through and free all the excess ones - * first. */ - if (src->geom->num_properties < dst->geom->sz_properties) { - for (i = src->geom->num_properties, - dprop = dst->geom->properties + i; - i < dst->geom->num_properties; - i++, dprop++) { - free(dprop->name); - free(dprop->value); - } - } - - if (dst->geom->sz_properties) - tmp = realloc(dst->geom->properties, - src->geom->num_properties * - sizeof(XkbPropertyRec)); - else - tmp = malloc(src->geom->num_properties * - sizeof(XkbPropertyRec)); - if (!tmp) - return FALSE; - dst->geom->properties = tmp; - } - - /* We don't set num_properties as we need it to try and avoid - * too much reallocing. */ - dst->geom->sz_properties = src->geom->num_properties; - - if (dst->geom->sz_properties > dst->geom->num_properties) { - memset(dst->geom->properties + dst->geom->num_properties, 0, - (dst->geom->sz_properties - dst->geom->num_properties) * - sizeof(XkbPropertyRec)); - } - - for (i = 0, - sprop = src->geom->properties, - dprop = dst->geom->properties; - i < src->geom->num_properties; - i++, sprop++, dprop++) { - if (i < dst->geom->num_properties) { - if (strlen(sprop->name) != strlen(dprop->name)) { - tmp = realloc(dprop->name, strlen(sprop->name) + 1); - if (!tmp) - return FALSE; - dprop->name = tmp; - } - if (strlen(sprop->value) != strlen(dprop->value)) { - tmp = realloc(dprop->value, strlen(sprop->value) + 1); - if (!tmp) - return FALSE; - dprop->value = tmp; - } - strcpy(dprop->name, sprop->name); - strcpy(dprop->value, sprop->value); - } - else { - dprop->name = xstrdup(sprop->name); - dprop->value = xstrdup(sprop->value); - } - } - - /* ... which is already src->geom->num_properties. */ - dst->geom->num_properties = dst->geom->sz_properties; - } - else { - if (dst->geom->sz_properties) { - for (i = 0, dprop = dst->geom->properties; - i < dst->geom->num_properties; - i++, dprop++) { - free(dprop->name); - free(dprop->value); - } - free(dst->geom->properties); - dst->geom->properties = NULL; - } - - dst->geom->num_properties = 0; - dst->geom->sz_properties = 0; - } - - /* colors */ - if (src->geom->num_colors) { - if (src->geom->num_colors != dst->geom->sz_colors) { - if (src->geom->num_colors < dst->geom->sz_colors) { - for (i = src->geom->num_colors, - dcolor = dst->geom->colors + i; - i < dst->geom->num_colors; - i++, dcolor++) { - free(dcolor->spec); - } - } - - if (dst->geom->sz_colors) - tmp = realloc(dst->geom->colors, - src->geom->num_colors * - sizeof(XkbColorRec)); - else - tmp = malloc(src->geom->num_colors * - sizeof(XkbColorRec)); - if (!tmp) - return FALSE; - dst->geom->colors = tmp; - } - - dst->geom->sz_colors = src->geom->num_colors; - - if (dst->geom->sz_colors > dst->geom->num_colors) { - memset(dst->geom->colors + dst->geom->num_colors, 0, - (dst->geom->sz_colors - dst->geom->num_colors) * - sizeof(XkbColorRec)); - } - - for (i = 0, - scolor = src->geom->colors, - dcolor = dst->geom->colors; - i < src->geom->num_colors; - i++, scolor++, dcolor++) { - if (i < dst->geom->num_colors) { - if (strlen(scolor->spec) != strlen(dcolor->spec)) { - tmp = realloc(dcolor->spec, strlen(scolor->spec) + 1); - if (!tmp) - return FALSE; - dcolor->spec = tmp; - } - strcpy(dcolor->spec, scolor->spec); - } - else { - dcolor->spec = xstrdup(scolor->spec); - } - dcolor->pixel = scolor->pixel; - } - - dst->geom->num_colors = dst->geom->sz_colors; - } - else { - if (dst->geom->sz_colors) { - for (i = 0, dcolor = dst->geom->colors; - i < dst->geom->num_colors; - i++, dcolor++) { - free(dcolor->spec); - } - free(dst->geom->colors); - dst->geom->colors = NULL; - } - - dst->geom->num_colors = 0; - dst->geom->sz_colors = 0; - } - - /* shapes */ - /* shapes break down into outlines, which break down into points. */ - if (dst->geom->num_shapes) { - for (i = 0, dshape = dst->geom->shapes; - i < dst->geom->num_shapes; - i++, dshape++) { - for (j = 0, doutline = dshape->outlines; - j < dshape->num_outlines; - j++, doutline++) { - if (doutline->sz_points) - free(doutline->points); - } - - if (dshape->sz_outlines) { - free(dshape->outlines); - dshape->outlines = NULL; - } - - dshape->num_outlines = 0; - dshape->sz_outlines = 0; - } - } - - if (src->geom->num_shapes) { - tmp = calloc(src->geom->num_shapes, sizeof(XkbShapeRec)); - if (!tmp) - return FALSE; - dst->geom->shapes = tmp; - - for (i = 0, sshape = src->geom->shapes, dshape = dst->geom->shapes; - i < src->geom->num_shapes; - i++, sshape++, dshape++) { - if (sshape->num_outlines) { - tmp = calloc(sshape->num_outlines, sizeof(XkbOutlineRec)); - if (!tmp) - return FALSE; - dshape->outlines = tmp; - - for (j = 0, - soutline = sshape->outlines, - doutline = dshape->outlines; - j < sshape->num_outlines; - j++, soutline++, doutline++) { - if (soutline->num_points) { - tmp = malloc(soutline->num_points * - sizeof(XkbPointRec)); - if (!tmp) - return FALSE; - doutline->points = tmp; - - memcpy(doutline->points, soutline->points, - soutline->num_points * sizeof(XkbPointRec)); - - doutline->corner_radius = soutline->corner_radius; - } - - doutline->num_points = soutline->num_points; - doutline->sz_points = soutline->num_points; - } - } - - dshape->num_outlines = sshape->num_outlines; - dshape->sz_outlines = sshape->num_outlines; - dshape->name = sshape->name; - dshape->bounds = sshape->bounds; - - dshape->approx = NULL; - if (sshape->approx && sshape->num_outlines > 0) { - - const ptrdiff_t approx_idx = - sshape->approx - sshape->outlines; - - if (approx_idx < dshape->num_outlines) { - dshape->approx = dshape->outlines + approx_idx; - } else { - LogMessage(X_WARNING, "XKB: approx outline " - "index is out of range\n"); - } - } - - dshape->primary = NULL; - if (sshape->primary && sshape->num_outlines > 0) { - - const ptrdiff_t primary_idx = - sshape->primary - sshape->outlines; - - if (primary_idx < dshape->num_outlines) { - dshape->primary = dshape->outlines + primary_idx; - } else { - LogMessage(X_WARNING, "XKB: primary outline " - "index is out of range\n"); - } - } - } - - dst->geom->num_shapes = src->geom->num_shapes; - dst->geom->sz_shapes = src->geom->num_shapes; - } - else { - if (dst->geom->sz_shapes) { - free(dst->geom->shapes); - } - dst->geom->shapes = NULL; - dst->geom->num_shapes = 0; - dst->geom->sz_shapes = 0; - } - - /* sections */ - /* sections break down into doodads, and also into rows, which break - * down into keys. */ - if (dst->geom->num_sections) { - for (i = 0, dsection = dst->geom->sections; - i < dst->geom->num_sections; - i++, dsection++) { - for (j = 0, drow = dsection->rows; - j < dsection->num_rows; - j++, drow++) { - if (drow->num_keys) - free(drow->keys); - } - - if (dsection->num_rows) - free(dsection->rows); - - /* cut and waste from geom/doodad below. */ - for (j = 0, ddoodad = dsection->doodads; - j < dsection->num_doodads; - j++, ddoodad++) { - if (ddoodad->any.type == XkbTextDoodad) { - free(ddoodad->text.text); - ddoodad->text.text = NULL; - free(ddoodad->text.font); - ddoodad->text.font = NULL; - } - else if (ddoodad->any.type == XkbLogoDoodad) { - free(ddoodad->logo.logo_name); - ddoodad->logo.logo_name = NULL; - } - } - - free(dsection->doodads); - } - - dst->geom->num_sections = 0; - dst->geom->sections = NULL; - } - - if (src->geom->num_sections) { - if (dst->geom->sz_sections) - tmp = realloc(dst->geom->sections, - src->geom->num_sections * - sizeof(XkbSectionRec)); - else - tmp = malloc(src->geom->num_sections * sizeof(XkbSectionRec)); - if (!tmp) - return FALSE; - memset(tmp, 0, src->geom->num_sections * sizeof(XkbSectionRec)); - dst->geom->sections = tmp; - dst->geom->num_sections = src->geom->num_sections; - dst->geom->sz_sections = src->geom->num_sections; - - for (i = 0, - ssection = src->geom->sections, - dsection = dst->geom->sections; - i < src->geom->num_sections; - i++, ssection++, dsection++) { - *dsection = *ssection; - if (ssection->num_rows) { - tmp = calloc(ssection->num_rows, sizeof(XkbRowRec)); - if (!tmp) - return FALSE; - dsection->rows = tmp; - } - dsection->num_rows = ssection->num_rows; - dsection->sz_rows = ssection->num_rows; - - for (j = 0, srow = ssection->rows, drow = dsection->rows; - j < ssection->num_rows; - j++, srow++, drow++) { - if (srow->num_keys) { - tmp = malloc(srow->num_keys * sizeof(XkbKeyRec)); - if (!tmp) - return FALSE; - drow->keys = tmp; - memcpy(drow->keys, srow->keys, - srow->num_keys * sizeof(XkbKeyRec)); - } - drow->num_keys = srow->num_keys; - drow->sz_keys = srow->num_keys; - drow->top = srow->top; - drow->left = srow->left; - drow->vertical = srow->vertical; - drow->bounds = srow->bounds; - } - - if (ssection->num_doodads) { - tmp = calloc(ssection->num_doodads, sizeof(XkbDoodadRec)); - if (!tmp) - return FALSE; - dsection->doodads = tmp; - } - else { - dsection->doodads = NULL; - } - - dsection->sz_doodads = ssection->num_doodads; - for (k = 0, - sdoodad = ssection->doodads, - ddoodad = dsection->doodads; - k < ssection->num_doodads; - k++, sdoodad++, ddoodad++) { - memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec)); - if (sdoodad->any.type == XkbTextDoodad) { - if (sdoodad->text.text) - ddoodad->text.text = - strdup(sdoodad->text.text); - if (sdoodad->text.font) - ddoodad->text.font = - strdup(sdoodad->text.font); - } - else if (sdoodad->any.type == XkbLogoDoodad) { - if (sdoodad->logo.logo_name) - ddoodad->logo.logo_name = - strdup(sdoodad->logo.logo_name); - } - } - dsection->overlays = NULL; - dsection->sz_overlays = 0; - dsection->num_overlays = 0; - } - } - else { - if (dst->geom->sz_sections) { - free(dst->geom->sections); - } - - dst->geom->sections = NULL; - dst->geom->num_sections = 0; - dst->geom->sz_sections = 0; - } - - /* doodads */ - if (dst->geom->num_doodads) { - for (i = src->geom->num_doodads, - ddoodad = dst->geom->doodads + - src->geom->num_doodads; - i < dst->geom->num_doodads; - i++, ddoodad++) { - if (ddoodad->any.type == XkbTextDoodad) { - free(ddoodad->text.text); - ddoodad->text.text = NULL; - free(ddoodad->text.font); - ddoodad->text.font = NULL; - } - else if (ddoodad->any.type == XkbLogoDoodad) { - free(ddoodad->logo.logo_name); - ddoodad->logo.logo_name = NULL; - } - } - dst->geom->num_doodads = 0; - dst->geom->doodads = NULL; - } - - if (src->geom->num_doodads) { - if (dst->geom->sz_doodads) - tmp = realloc(dst->geom->doodads, - src->geom->num_doodads * - sizeof(XkbDoodadRec)); - else - tmp = malloc(src->geom->num_doodads * - sizeof(XkbDoodadRec)); - if (!tmp) - return FALSE; - memset(tmp, 0, src->geom->num_doodads * sizeof(XkbDoodadRec)); - dst->geom->doodads = tmp; - - dst->geom->sz_doodads = src->geom->num_doodads; - - for (i = 0, - sdoodad = src->geom->doodads, - ddoodad = dst->geom->doodads; - i < src->geom->num_doodads; - i++, sdoodad++, ddoodad++) { - memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec)); - if (sdoodad->any.type == XkbTextDoodad) { - if (sdoodad->text.text) - ddoodad->text.text = strdup(sdoodad->text.text); - if (sdoodad->text.font) - ddoodad->text.font = strdup(sdoodad->text.font); - } - else if (sdoodad->any.type == XkbLogoDoodad) { - if (sdoodad->logo.logo_name) - ddoodad->logo.logo_name = - strdup(sdoodad->logo.logo_name); - } - } - - dst->geom->num_doodads = dst->geom->sz_doodads; - } - else { - if (dst->geom->sz_doodads) { - free(dst->geom->doodads); - } - - dst->geom->doodads = NULL; - dst->geom->num_doodads = 0; - dst->geom->sz_doodads = 0; - } - - /* key aliases */ - if (src->geom->num_key_aliases) { - if (src->geom->num_key_aliases != dst->geom->sz_key_aliases) { - if (dst->geom->sz_key_aliases) - tmp = realloc(dst->geom->key_aliases, - src->geom->num_key_aliases * - 2 * XkbKeyNameLength); - else - tmp = malloc(src->geom->num_key_aliases * - 2 * XkbKeyNameLength); - if (!tmp) - return FALSE; - dst->geom->key_aliases = tmp; - - dst->geom->sz_key_aliases = src->geom->num_key_aliases; - } - - memcpy(dst->geom->key_aliases, src->geom->key_aliases, - src->geom->num_key_aliases * 2 * XkbKeyNameLength); - - dst->geom->num_key_aliases = dst->geom->sz_key_aliases; - } - else { - free(dst->geom->key_aliases); - dst->geom->key_aliases = NULL; - dst->geom->num_key_aliases = 0; - dst->geom->sz_key_aliases = 0; - } - - /* font */ - if (src->geom->label_font) { - if (!dst->geom->label_font) { - tmp = malloc(strlen(src->geom->label_font) + 1); - if (!tmp) - return FALSE; - dst->geom->label_font = tmp; - } - else if (strlen(src->geom->label_font) != - strlen(dst->geom->label_font)) { - tmp = realloc(dst->geom->label_font, - strlen(src->geom->label_font) + 1); - if (!tmp) - return FALSE; - dst->geom->label_font = tmp; - } - - strcpy(dst->geom->label_font, src->geom->label_font); - i = XkbGeomColorIndex(src->geom, src->geom->label_color); - dst->geom->label_color = &(dst->geom->colors[i]); - i = XkbGeomColorIndex(src->geom, src->geom->base_color); - dst->geom->base_color = &(dst->geom->colors[i]); - } - else { - free(dst->geom->label_font); - dst->geom->label_font = NULL; - dst->geom->label_color = NULL; - dst->geom->base_color = NULL; - } - - dst->geom->name = src->geom->name; - dst->geom->width_mm = src->geom->width_mm; - dst->geom->height_mm = src->geom->height_mm; - } - else - { - if (dst->geom) { - /* I LOVE THE DIFFERENT CALL SIGNATURE. REALLY, I DO. */ - XkbFreeGeometry(dst->geom, XkbGeomAllMask, TRUE); - dst->geom = NULL; - } - } - - return TRUE; -} - -static Bool -_XkbCopyIndicators(XkbDescPtr src, XkbDescPtr dst) -{ - /* indicators */ - if (src->indicators) { - if (!dst->indicators) { - dst->indicators = malloc(sizeof(XkbIndicatorRec)); - if (!dst->indicators) - return FALSE; - } - memcpy(dst->indicators, src->indicators, sizeof(XkbIndicatorRec)); - } - else { - free(dst->indicators); - dst->indicators = NULL; - } - return TRUE; -} - -static Bool -_XkbCopyControls(XkbDescPtr src, XkbDescPtr dst) -{ - /* controls */ - if (src->ctrls) { - if (!dst->ctrls) { - dst->ctrls = malloc(sizeof(XkbControlsRec)); - if (!dst->ctrls) - return FALSE; - } - memcpy(dst->ctrls, src->ctrls, sizeof(XkbControlsRec)); - } - else { - free(dst->ctrls); - dst->ctrls = NULL; - } - return TRUE; -} - -/** - * Copy an XKB map from src to dst, reallocating when necessary: if some - * map components are present in one, but not in the other, the destination - * components will be allocated or freed as necessary. - * - * Basic map consistency is assumed on both sides, so maps with random - * uninitialised data (e.g. names->radio_grous == NULL, names->num_rg == 19) - * _will_ cause failures. You've been warned. - * - * Returns TRUE on success, or FALSE on failure. If this function fails, - * dst may be in an inconsistent state: all its pointers are guaranteed - * to remain valid, but part of the map may be from src and part from dst. - * - */ - -Bool -XkbCopyKeymap(XkbDescPtr dst, XkbDescPtr src) -{ - - if (!src || !dst) { - DebugF("XkbCopyKeymap: src (%p) or dst (%p) is NULL\n", src, dst); - return FALSE; - } - - if (src == dst) - return TRUE; - - if (!_XkbCopyClientMap(src, dst)) { - DebugF("XkbCopyKeymap: failed to copy client map\n"); - return FALSE; - } - if (!_XkbCopyServerMap(src, dst)) { - DebugF("XkbCopyKeymap: failed to copy server map\n"); - return FALSE; - } - if (!_XkbCopyIndicators(src, dst)) { - DebugF("XkbCopyKeymap: failed to copy indicators\n"); - return FALSE; - } - if (!_XkbCopyControls(src, dst)) { - DebugF("XkbCopyKeymap: failed to copy controls\n"); - return FALSE; - } - if (!_XkbCopyNames(src, dst)) { - DebugF("XkbCopyKeymap: failed to copy names\n"); - return FALSE; - } - if (!_XkbCopyCompat(src, dst)) { - DebugF("XkbCopyKeymap: failed to copy compat map\n"); - return FALSE; - } - if (!_XkbCopyGeom(src, dst)) { - DebugF("XkbCopyKeymap: failed to copy geometry\n"); - return FALSE; - } - - dst->min_key_code = src->min_key_code; - dst->max_key_code = src->max_key_code; - - return TRUE; -} - -Bool -XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) -{ - xkbNewKeyboardNotify nkn; - Bool ret; - - if (!dst->key || !src->key) - return FALSE; - - memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); - nkn.oldMinKeyCode = dst->key->xkbInfo->desc->min_key_code; - nkn.oldMaxKeyCode = dst->key->xkbInfo->desc->max_key_code; - nkn.deviceID = dst->id; - nkn.oldDeviceID = dst->id; /* maybe src->id? */ - nkn.minKeyCode = src->key->xkbInfo->desc->min_key_code; - nkn.maxKeyCode = src->key->xkbInfo->desc->max_key_code; - nkn.requestMajor = XkbReqCode; - nkn.requestMinor = X_kbSetMap; /* Near enough's good enough. */ - nkn.changed = XkbNKN_KeycodesMask; - if (src->key->xkbInfo->desc->geom) - nkn.changed |= XkbNKN_GeometryMask; - - ret = XkbCopyKeymap(dst->key->xkbInfo->desc, src->key->xkbInfo->desc); - if (ret) - XkbSendNewKeyboardNotify(dst, &nkn); - - return ret; -} - -int -XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode) -{ - XkbDescPtr xkb = xkbi->desc; - int effectiveGroup = xkbState->group; - - if (!XkbKeycodeInRange(xkb, keycode)) - return -1; - - if (effectiveGroup == XkbGroup1Index) - return effectiveGroup; - - if (XkbKeyNumGroups(xkb,keycode) > 1U) { - if (effectiveGroup >= XkbKeyNumGroups(xkb,keycode)) { - unsigned int gi = XkbKeyGroupInfo(xkb,keycode); - switch (XkbOutOfRangeGroupAction(gi)) { - default: - case XkbWrapIntoRange: - effectiveGroup %= XkbKeyNumGroups(xkb, keycode); - break; - case XkbClampIntoRange: - effectiveGroup = XkbKeyNumGroups(xkb, keycode) - 1; - break; - case XkbRedirectIntoRange: - effectiveGroup = XkbOutOfRangeGroupInfo(gi); - if (effectiveGroup >= XkbKeyNumGroups(xkb, keycode)) - effectiveGroup = 0; - break; - } - } - } - else effectiveGroup = XkbGroup1Index; - - return effectiveGroup; -} - -/* Merge the lockedPtrButtons from all attached SDs for the given master - * device into the MD's state. - */ -void -XkbMergeLockedPtrBtns(DeviceIntPtr master) -{ - DeviceIntPtr d = inputInfo.devices; - XkbSrvInfoPtr xkbi = NULL; - - if (!IsMaster(master)) - return; - - if (!master->key) - return; - - xkbi = master->key->xkbInfo; - xkbi->lockedPtrButtons = 0; - - for (; d; d = d->next) { - if (IsMaster(d) || GetMaster(d, MASTER_KEYBOARD) != master || !d->key) - continue; - - xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons; - } -} +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ +/* + +Copyright © 2008 Red Hat Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +*/ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "os.h" +#include +#include +#include +#include +#include +#define XK_CYRILLIC +#include +#include "misc.h" +#include "inputstr.h" +#include "eventstr.h" + +#define XKBSRV_NEED_FILE_FUNCS +#include +#include "xkbgeom.h" +#include "xkb.h" + +/***====================================================================***/ + +int +_XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) +{ + int rc = XkbKeyboardErrorCode; + + if (id == XkbUseCoreKbd) + id = PickKeyboard(client)->id; + else if (id == XkbUseCorePtr) + id = PickPointer(client)->id; + + rc = dixLookupDevice(pDev, id, client, access_mode); + if (rc != Success) + *xkb_err = XkbErr_BadDevice; + + return rc; +} + +int +_XkbLookupKeyboard(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) +{ + DeviceIntPtr dev; + int rc; + + if (id == XkbDfltXIId) + id = XkbUseCoreKbd; + + rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); + if (rc != Success) + return rc; + + dev = *pDev; + if (!dev->key || !dev->key->xkbInfo) { + *pDev = NULL; + *xkb_err= XkbErr_BadClass; + return XkbKeyboardErrorCode; + } + return Success; +} + +int +_XkbLookupBellDevice(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) +{ + DeviceIntPtr dev; + int rc; + + rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); + if (rc != Success) + return rc; + + dev = *pDev; + if (!dev->kbdfeed && !dev->bell) { + *pDev = NULL; + *xkb_err= XkbErr_BadClass; + return XkbKeyboardErrorCode; + } + return Success; +} + +int +_XkbLookupLedDevice(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) +{ + DeviceIntPtr dev; + int rc; + + if (id == XkbDfltXIId) + id = XkbUseCorePtr; + + rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); + if (rc != Success) + return rc; + + dev = *pDev; + if (!dev->kbdfeed && !dev->leds) { + *pDev = NULL; + *xkb_err= XkbErr_BadClass; + return XkbKeyboardErrorCode; + } + return Success; +} + +int +_XkbLookupButtonDevice(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) +{ + DeviceIntPtr dev; + int rc; + + rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); + if (rc != Success) + return rc; + + dev = *pDev; + if (!dev->button) { + *pDev = NULL; + *xkb_err= XkbErr_BadClass; + return XkbKeyboardErrorCode; + } + return Success; +} + +void +XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods) +{ +register unsigned tmp; + + switch (act->type) { + case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: + if (act->mods.flags&XkbSA_UseModMapMods) + act->mods.real_mods= act->mods.mask= mods; + if ((tmp= XkbModActionVMods(&act->mods))!=0) + act->mods.mask|= XkbMaskForVMask(xkb,tmp); + break; + case XkbSA_ISOLock: + if (act->iso.flags&XkbSA_UseModMapMods) + act->iso.real_mods= act->iso.mask= mods; + if ((tmp= XkbModActionVMods(&act->iso))!=0) + act->iso.mask|= XkbMaskForVMask(xkb,tmp); + break; + } + return; +} + +unsigned +XkbMaskForVMask(XkbDescPtr xkb,unsigned vmask) +{ +register int i,bit; +register unsigned mask; + + for (mask=i=0,bit=1;iserver->vmods[i]; + } + return mask; +} + +/***====================================================================***/ + +void +XkbUpdateKeyTypesFromCore( DeviceIntPtr pXDev, + KeySymsPtr pCore, + KeyCode first, + CARD8 num, + XkbChangesPtr changes) +{ +XkbDescPtr xkb; +unsigned key,nG,explicit; +int types[XkbNumKbdGroups]; +KeySym tsyms[XkbMaxSymsPerKey],*syms; +XkbMapChangesPtr mc; + + xkb= pXDev->key->xkbInfo->desc; + if (first+num-1>xkb->max_key_code) { + /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */ + num= xkb->max_key_code-first+1; + } + + mc= (changes?(&changes->map):NULL); + + syms= &pCore->map[(first - pCore->minKeyCode) * pCore->mapWidth]; + for (key=first; key<(first+num); key++,syms+= pCore->mapWidth) { + explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask; + types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); + types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index); + types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index); + types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index); + nG= XkbKeyTypesForCoreSymbols(xkb,pCore->mapWidth,syms,explicit,types, + tsyms); + XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc); + memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms, + XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); + } + if (changes->map.changed&XkbKeySymsMask) { + CARD8 oldLast,newLast; + oldLast = changes->map.first_key_sym+changes->map.num_key_syms-1; + newLast = first+num-1; + + if (firstmap.first_key_sym) + changes->map.first_key_sym = first; + if (oldLast>newLast) + newLast= oldLast; + changes->map.num_key_syms = newLast-changes->map.first_key_sym+1; + } + else { + changes->map.changed|= XkbKeySymsMask; + changes->map.first_key_sym = first; + changes->map.num_key_syms = num; + } + return; +} + +void +XkbUpdateDescActions( XkbDescPtr xkb, + KeyCode first, + CARD8 num, + XkbChangesPtr changes) +{ +register unsigned key; + + for (key=first;key<(first+num);key++) { + XkbApplyCompatMapToKey(xkb,key,changes); + } + + if (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask)) { + unsigned char newVMods[XkbNumVirtualMods]; + register unsigned bit,i; + unsigned present; + + memset(newVMods, 0, XkbNumVirtualMods); + present= 0; + for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { + if (xkb->server->vmodmap[key]==0) + continue; + for (i=0,bit=1;iserver->vmodmap[key]) { + present|= bit; + newVMods[i]|= xkb->map->modmap[key]; + } + } + } + for (i=0,bit=1;iserver->vmods[i])) { + changes->map.changed|= XkbVirtualModsMask; + changes->map.vmods|= bit; + xkb->server->vmods[i]= newVMods[i]; + } + } + } + if (changes->map.changed&XkbVirtualModsMask) + XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes); + + if (changes->map.changed&XkbKeyActionsMask) { + CARD8 oldLast,newLast; + oldLast= changes->map.first_key_act+changes->map.num_key_acts-1; + newLast = first+num-1; + + if (firstmap.first_key_act) + changes->map.first_key_act = first; + if (newLast>oldLast) + newLast= oldLast; + changes->map.num_key_acts= newLast-changes->map.first_key_act+1; + } + else { + changes->map.changed|= XkbKeyActionsMask; + changes->map.first_key_act = first; + changes->map.num_key_acts = num; + } + return; +} + +void +XkbUpdateActions( DeviceIntPtr pXDev, + KeyCode first, + CARD8 num, + XkbChangesPtr changes, + unsigned * needChecksRtrn, + XkbEventCausePtr cause) +{ +XkbSrvInfoPtr xkbi; +XkbDescPtr xkb; +CARD8 * repeat; + + if (needChecksRtrn) + *needChecksRtrn= 0; + xkbi= pXDev->key->xkbInfo; + xkb= xkbi->desc; + repeat= xkb->ctrls->per_key_repeat; + + /* before letting XKB do any changes, copy the current core values */ + if (pXDev->kbdfeed) + memcpy(repeat,pXDev->kbdfeed->ctrl.autoRepeats,XkbPerKeyBitArraySize); + + XkbUpdateDescActions(xkb,first,num,changes); + + if ((pXDev->kbdfeed)&& + (changes->ctrls.changed_ctrls&XkbPerKeyRepeatMask)) { + /* now copy the modified changes back to core */ + memcpy(pXDev->kbdfeed->ctrl.autoRepeats,repeat, XkbPerKeyBitArraySize); + if (pXDev->kbdfeed->CtrlProc) + (*pXDev->kbdfeed->CtrlProc)(pXDev, &pXDev->kbdfeed->ctrl); + } + return; +} + +KeySymsPtr +XkbGetCoreMap(DeviceIntPtr keybd) +{ +register int key,tmp; +int maxSymsPerKey, maxGroup1Width; +XkbDescPtr xkb; +KeySymsPtr syms; +int maxNumberOfGroups; + + if (!keybd || !keybd->key || !keybd->key->xkbInfo) + return NULL; + + xkb= keybd->key->xkbInfo->desc; + maxSymsPerKey= maxGroup1Width= 0; + maxNumberOfGroups = 0; + + /* determine sizes */ + for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { + if (XkbKeycodeInRange(xkb,key)) { + int nGroups; + int w; + nGroups= XkbKeyNumGroups(xkb,key); + tmp= 0; + if (nGroups>0) { + if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup1Index))<=2) + tmp+= 2; + else tmp+= w + 2; + /* remember highest G1 width */ + if (w > maxGroup1Width) + maxGroup1Width = w; + } + if (nGroups>1) { + if (tmp <= 2) { + if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup2Index))<2) + tmp+= 2; + else tmp+= w; + } else { + if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup2Index))>2) + tmp+= w - 2; + } + } + if (nGroups>2) + tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup3Index); + if (nGroups>3) + tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup4Index); + if (tmp>maxSymsPerKey) + maxSymsPerKey= tmp; + if (nGroups > maxNumberOfGroups) + maxNumberOfGroups = nGroups; + } + } + + if (maxSymsPerKey <= 0) + return NULL; + + syms = calloc(1, sizeof(*syms)); + if (!syms) + return NULL; + + /* See Section 12.4 of the XKB Protocol spec. Because of the + * single-group distribution for multi-group keyboards, we have to + * have enough symbols for the largest group 1 to replicate across the + * number of groups on the keyboard. e.g. a single-group key with 4 + * symbols on a keyboard that has 3 groups -> 12 syms per key */ + if (maxSymsPerKey < maxNumberOfGroups * maxGroup1Width) + maxSymsPerKey = maxNumberOfGroups * maxGroup1Width; + + syms->mapWidth = maxSymsPerKey; + syms->minKeyCode = xkb->min_key_code; + syms->maxKeyCode = xkb->max_key_code; + + tmp = syms->mapWidth * (xkb->max_key_code - xkb->min_key_code + 1); + syms->map = calloc(tmp, sizeof(*syms->map)); + if (!syms->map) { + free(syms); + return NULL; + } + + for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { + KeySym *pCore,*pXKB; + unsigned nGroups,groupWidth,n,nOut; + + nGroups= XkbKeyNumGroups(xkb,key); + n= (key-xkb->min_key_code)*syms->mapWidth; + pCore= &syms->map[n]; + pXKB= XkbKeySymsPtr(xkb,key); + nOut= 2; + if (nGroups>0) { + groupWidth= XkbKeyGroupWidth(xkb,key,XkbGroup1Index); + if (groupWidth>0) pCore[0]= pXKB[0]; + if (groupWidth>1) pCore[1]= pXKB[1]; + for (n=2;n2) + nOut= groupWidth; + } + + /* See XKB Protocol Sec, Section 12.4. + A 1-group key with ABCDE on a 2 group keyboard must be + duplicated across all groups as ABABCDECDE. + */ + if (nGroups == 1) + { + int idx, j; + + groupWidth = XkbKeyGroupWidth(xkb, key, XkbGroup1Index); + + /* AB..CDE... -> ABABCDE... */ + if (groupWidth > 0 && syms->mapWidth >= 3) + pCore[2] = pCore[0]; + if (groupWidth > 1 && syms->mapWidth >= 4) + pCore[3] = pCore[1]; + + /* ABABCDE... -> ABABCDECDE */ + idx = 2 + groupWidth; + while (groupWidth > 2 && idx < syms->mapWidth && + idx < groupWidth * 2) + { + pCore[idx] = pCore[idx - groupWidth + 2]; + idx++; + } + idx = 2 * groupWidth; + if (idx < 4) + idx = 4; + /* 3 or more groups: ABABCDECDEABCDEABCDE */ + for (j = 3; j <= maxNumberOfGroups; j++) + for (n = 0; n < groupWidth && idx < maxSymsPerKey; n++) + pCore[idx++] = pXKB[n]; + } + + pXKB+= XkbKeyGroupsWidth(xkb,key); + nOut+= 2; + if (nGroups>1) { + groupWidth= XkbKeyGroupWidth(xkb,key,XkbGroup2Index); + if (groupWidth>0) pCore[2]= pXKB[0]; + if (groupWidth>1) pCore[3]= pXKB[1]; + for (n=2;n2) + nOut+= (groupWidth-2); + } + pXKB+= XkbKeyGroupsWidth(xkb,key); + for (n=XkbGroup3Index;nkey && pXDev->key->xkbInfo) { + xkbControlsNotify cn; + XkbControlsPtr ctrls = pXDev->key->xkbInfo->desc->ctrls; + XkbControlsRec old; + old = *ctrls; + + if (key== -1) { /* global autorepeat setting changed */ + if (onoff) ctrls->enabled_ctrls |= XkbRepeatKeysMask; + else ctrls->enabled_ctrls &= ~XkbRepeatKeysMask; + } + else if (pXDev->kbdfeed) { + ctrls->per_key_repeat[key/8] = + pXDev->kbdfeed->ctrl.autoRepeats[key/8]; + } + + if (XkbComputeControlsNotify(pXDev,&old,ctrls,&cn,TRUE)) + XkbSendControlsNotify(pXDev,&cn); + } + return; +} + +/* Applies a change to a single device, does not traverse the device tree. */ +void +XkbApplyMappingChange(DeviceIntPtr kbd, KeySymsPtr map, KeyCode first_key, + CARD8 num_keys, CARD8 *modmap, ClientPtr client) +{ + XkbDescPtr xkb = kbd->key->xkbInfo->desc; + XkbEventCauseRec cause; + XkbChangesRec changes; + unsigned int check; + + memset(&changes, 0, sizeof(changes)); + memset(&cause, 0, sizeof(cause)); + + if (map && first_key && num_keys) { + check = 0; + XkbSetCauseCoreReq(&cause, X_ChangeKeyboardMapping, client); + + XkbUpdateKeyTypesFromCore(kbd, map, first_key, num_keys, &changes); + XkbUpdateActions(kbd, first_key, num_keys, &changes, &check, &cause); + + if (check) + XkbCheckSecondaryEffects(kbd->key->xkbInfo, 1, &changes, &cause); + } + + if (modmap) { + /* A keymap change can imply a modmap change, se we prefer the + * former. */ + if (!cause.mjr) + XkbSetCauseCoreReq(&cause,X_SetModifierMapping,client); + + check = 0; + num_keys = xkb->max_key_code - xkb->min_key_code + 1; + changes.map.changed |= XkbModifierMapMask; + changes.map.first_modmap_key = xkb->min_key_code; + changes.map.num_modmap_keys = num_keys; + memcpy(kbd->key->xkbInfo->desc->map->modmap, modmap, MAP_LENGTH); + XkbUpdateActions(kbd, xkb->min_key_code, num_keys, &changes, &check, + &cause); + + if (check) + XkbCheckSecondaryEffects(kbd->key->xkbInfo, 1, &changes, &cause); + } + + XkbSendNotification(kbd, &changes, &cause); +} + +void +XkbDisableComputedAutoRepeats(DeviceIntPtr dev,unsigned key) +{ +XkbSrvInfoPtr xkbi = dev->key->xkbInfo; +xkbMapNotify mn; + + xkbi->desc->server->explicit[key]|= XkbExplicitAutoRepeatMask; + memset(&mn, 0, sizeof(mn)); + mn.changed= XkbExplicitComponentsMask; + mn.firstKeyExplicit= key; + mn.nKeyExplicit= 1; + XkbSendMapNotify(dev,&mn); + return; +} + +unsigned +XkbStateChangedFlags(XkbStatePtr old,XkbStatePtr new) +{ +int changed; + + changed=(old->group!=new->group?XkbGroupStateMask:0); + changed|=(old->base_group!=new->base_group?XkbGroupBaseMask:0); + changed|=(old->latched_group!=new->latched_group?XkbGroupLatchMask:0); + changed|=(old->locked_group!=new->locked_group?XkbGroupLockMask:0); + changed|=(old->mods!=new->mods?XkbModifierStateMask:0); + changed|=(old->base_mods!=new->base_mods?XkbModifierBaseMask:0); + changed|=(old->latched_mods!=new->latched_mods?XkbModifierLatchMask:0); + changed|=(old->locked_mods!=new->locked_mods?XkbModifierLockMask:0); + changed|=(old->compat_state!=new->compat_state?XkbCompatStateMask:0); + changed|=(old->grab_mods!=new->grab_mods?XkbGrabModsMask:0); + if (old->compat_grab_mods!=new->compat_grab_mods) + changed|= XkbCompatGrabModsMask; + changed|=(old->lookup_mods!=new->lookup_mods?XkbLookupModsMask:0); + if (old->compat_lookup_mods!=new->compat_lookup_mods) + changed|= XkbCompatLookupModsMask; + changed|=(old->ptr_buttons!=new->ptr_buttons?XkbPointerButtonMask:0); + return changed; +} + +static void +XkbComputeCompatState(XkbSrvInfoPtr xkbi) +{ +CARD16 grp_mask; +XkbStatePtr state= &xkbi->state; +XkbCompatMapPtr map; + + if (!state || !xkbi->desc || !xkbi->desc->ctrls || !xkbi->desc->compat) + return; + + map= xkbi->desc->compat; + grp_mask= map->groups[state->group].mask; + state->compat_state = state->mods|grp_mask; + state->compat_lookup_mods= state->lookup_mods|grp_mask; + + if (xkbi->desc->ctrls->enabled_ctrls&XkbIgnoreGroupLockMask) + grp_mask= map->groups[state->base_group].mask; + state->compat_grab_mods= state->grab_mods|grp_mask; + return; +} + +unsigned +XkbAdjustGroup(int group,XkbControlsPtr ctrls) +{ +unsigned act; + + act= XkbOutOfRangeGroupAction(ctrls->groups_wrap); + if (group<0) { + while ( group < 0 ) { + if (act==XkbClampIntoRange) { + group= XkbGroup1Index; + } + else if (act==XkbRedirectIntoRange) { + int newGroup; + newGroup= XkbOutOfRangeGroupNumber(ctrls->groups_wrap); + if (newGroup>=ctrls->num_groups) + group= XkbGroup1Index; + else group= newGroup; + } + else { + group+= ctrls->num_groups; + } + } + } + else if (group>=ctrls->num_groups) { + if (act==XkbClampIntoRange) { + group= ctrls->num_groups-1; + } + else if (act==XkbRedirectIntoRange) { + int newGroup; + newGroup= XkbOutOfRangeGroupNumber(ctrls->groups_wrap); + if (newGroup>=ctrls->num_groups) + group= XkbGroup1Index; + else group= newGroup; + } + else { + group%= ctrls->num_groups; + } + } + return group; +} + +void +XkbComputeDerivedState(XkbSrvInfoPtr xkbi) +{ +XkbStatePtr state= &xkbi->state; +XkbControlsPtr ctrls= xkbi->desc->ctrls; +unsigned char grp; + + if (!state || !ctrls) + return; + + state->mods= (state->base_mods|state->latched_mods|state->locked_mods); + state->lookup_mods= state->mods&(~ctrls->internal.mask); + state->grab_mods= state->lookup_mods&(~ctrls->ignore_lock.mask); + state->grab_mods|= + ((state->base_mods|state->latched_mods)&ctrls->ignore_lock.mask); + + + grp= state->locked_group; + if (grp>=ctrls->num_groups) + state->locked_group= XkbAdjustGroup(XkbCharToInt(grp),ctrls); + + grp= state->locked_group+state->base_group+state->latched_group; + if (grp>=ctrls->num_groups) + state->group= XkbAdjustGroup(XkbCharToInt(grp),ctrls); + else state->group= grp; + XkbComputeCompatState(xkbi); + return; +} + +/***====================================================================***/ + +void +XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi, + unsigned which, + XkbChangesPtr changes, + XkbEventCausePtr cause) +{ + if (which&XkbStateNotifyMask) { + XkbStateRec old; + old= xkbi->state; + changes->state_changes|= XkbStateChangedFlags(&old,&xkbi->state); + XkbComputeDerivedState(xkbi); + } + if (which&XkbIndicatorStateNotifyMask) + XkbUpdateIndicators(xkbi->device,XkbAllIndicatorsMask,TRUE,changes, + cause); + return; +} + +/***====================================================================***/ + +Bool +XkbEnableDisableControls( XkbSrvInfoPtr xkbi, + unsigned long change, + unsigned long newValues, + XkbChangesPtr changes, + XkbEventCausePtr cause) +{ +XkbControlsPtr ctrls; +unsigned old; +XkbSrvLedInfoPtr sli; + + ctrls= xkbi->desc->ctrls; + old= ctrls->enabled_ctrls; + ctrls->enabled_ctrls&= ~change; + ctrls->enabled_ctrls|= (change&newValues); + if (old==ctrls->enabled_ctrls) + return FALSE; + if (cause!=NULL) { + xkbControlsNotify cn; + cn.numGroups= ctrls->num_groups; + cn.changedControls= XkbControlsEnabledMask; + cn.enabledControls= ctrls->enabled_ctrls; + cn.enabledControlChanges= (ctrls->enabled_ctrls^old); + cn.keycode= cause->kc; + cn.eventType= cause->event; + cn.requestMajor= cause->mjr; + cn.requestMinor= cause->mnr; + XkbSendControlsNotify(xkbi->device,&cn); + } + else { + /* Yes, this really should be an XOR. If ctrls->enabled_ctrls_changes*/ + /* is non-zero, the controls in question changed already in "this" */ + /* request and this change merely undoes the previous one. By the */ + /* same token, we have to figure out whether or not ControlsEnabled */ + /* should be set or not in the changes structure */ + changes->ctrls.enabled_ctrls_changes^= (ctrls->enabled_ctrls^old); + if (changes->ctrls.enabled_ctrls_changes) + changes->ctrls.changed_ctrls|= XkbControlsEnabledMask; + else changes->ctrls.changed_ctrls&= ~XkbControlsEnabledMask; + } + sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0); + XkbUpdateIndicators(xkbi->device,sli->usesControls,TRUE,changes,cause); + return TRUE; +} + +/***====================================================================***/ + +#define MAX_TOC 16 + +XkbGeometryPtr +XkbLookupNamedGeometry(DeviceIntPtr dev,Atom name,Bool *shouldFree) +{ +XkbSrvInfoPtr xkbi= dev->key->xkbInfo; +XkbDescPtr xkb= xkbi->desc; + + *shouldFree= 0; + if (name==None) { + if (xkb->geom!=NULL) + return xkb->geom; + name= xkb->names->geometry; + } + if ((xkb->geom!=NULL)&&(xkb->geom->name==name)) + return xkb->geom; + *shouldFree= 1; + return NULL; +} + +void +XkbConvertCase(register KeySym sym, KeySym *lower, KeySym *upper) +{ + *lower = sym; + *upper = sym; + switch(sym >> 8) { + case 0: /* Latin 1 */ + if ((sym >= XK_A) && (sym <= XK_Z)) + *lower += (XK_a - XK_A); + else if ((sym >= XK_a) && (sym <= XK_z)) + *upper -= (XK_a - XK_A); + else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis)) + *lower += (XK_agrave - XK_Agrave); + else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis)) + *upper -= (XK_agrave - XK_Agrave); + else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn)) + *lower += (XK_oslash - XK_Ooblique); + else if ((sym >= XK_oslash) && (sym <= XK_thorn)) + *upper -= (XK_oslash - XK_Ooblique); + break; + case 1: /* Latin 2 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym == XK_Aogonek) + *lower = XK_aogonek; + else if (sym >= XK_Lstroke && sym <= XK_Sacute) + *lower += (XK_lstroke - XK_Lstroke); + else if (sym >= XK_Scaron && sym <= XK_Zacute) + *lower += (XK_scaron - XK_Scaron); + else if (sym >= XK_Zcaron && sym <= XK_Zabovedot) + *lower += (XK_zcaron - XK_Zcaron); + else if (sym == XK_aogonek) + *upper = XK_Aogonek; + else if (sym >= XK_lstroke && sym <= XK_sacute) + *upper -= (XK_lstroke - XK_Lstroke); + else if (sym >= XK_scaron && sym <= XK_zacute) + *upper -= (XK_scaron - XK_Scaron); + else if (sym >= XK_zcaron && sym <= XK_zabovedot) + *upper -= (XK_zcaron - XK_Zcaron); + else if (sym >= XK_Racute && sym <= XK_Tcedilla) + *lower += (XK_racute - XK_Racute); + else if (sym >= XK_racute && sym <= XK_tcedilla) + *upper -= (XK_racute - XK_Racute); + break; + case 2: /* Latin 3 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= XK_Hstroke && sym <= XK_Hcircumflex) + *lower += (XK_hstroke - XK_Hstroke); + else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex) + *lower += (XK_gbreve - XK_Gbreve); + else if (sym >= XK_hstroke && sym <= XK_hcircumflex) + *upper -= (XK_hstroke - XK_Hstroke); + else if (sym >= XK_gbreve && sym <= XK_jcircumflex) + *upper -= (XK_gbreve - XK_Gbreve); + else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex) + *lower += (XK_cabovedot - XK_Cabovedot); + else if (sym >= XK_cabovedot && sym <= XK_scircumflex) + *upper -= (XK_cabovedot - XK_Cabovedot); + break; + case 3: /* Latin 4 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= XK_Rcedilla && sym <= XK_Tslash) + *lower += (XK_rcedilla - XK_Rcedilla); + else if (sym >= XK_rcedilla && sym <= XK_tslash) + *upper -= (XK_rcedilla - XK_Rcedilla); + else if (sym == XK_ENG) + *lower = XK_eng; + else if (sym == XK_eng) + *upper = XK_ENG; + else if (sym >= XK_Amacron && sym <= XK_Umacron) + *lower += (XK_amacron - XK_Amacron); + else if (sym >= XK_amacron && sym <= XK_umacron) + *upper -= (XK_amacron - XK_Amacron); + break; + case 6: /* Cyrillic */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE) + *lower -= (XK_Serbian_DJE - XK_Serbian_dje); + else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze) + *upper += (XK_Serbian_DJE - XK_Serbian_dje); + else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN) + *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu); + else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign) + *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu); + break; + case 7: /* Greek */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent) + *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); + else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent && + sym != XK_Greek_iotaaccentdieresis && + sym != XK_Greek_upsilonaccentdieresis) + *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); + else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA) + *lower += (XK_Greek_alpha - XK_Greek_ALPHA); + else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega && + sym != XK_Greek_finalsmallsigma) + *upper -= (XK_Greek_alpha - XK_Greek_ALPHA); + break; + } +} + +static Bool +_XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; + int i; + XkbKeyTypePtr stype = NULL, dtype = NULL; + + /* client map */ + if (src->map) { + if (!dst->map) { + tmp = calloc(1, sizeof(XkbClientMapRec)); + if (!tmp) + return FALSE; + dst->map = tmp; + } + + if (src->map->syms) { + if (src->map->size_syms != dst->map->size_syms) { + tmp = realloc(dst->map->syms, + src->map->size_syms * sizeof(KeySym)); + if (!tmp) + return FALSE; + dst->map->syms = tmp; + + } + memcpy(dst->map->syms, src->map->syms, + src->map->size_syms * sizeof(KeySym)); + } + else { + free(dst->map->syms); + dst->map->syms = NULL; + } + dst->map->num_syms = src->map->num_syms; + dst->map->size_syms = src->map->size_syms; + + if (src->map->key_sym_map) { + if (src->max_key_code != dst->max_key_code) { + tmp = realloc(dst->map->key_sym_map, + (src->max_key_code + 1) * sizeof(XkbSymMapRec)); + if (!tmp) + return FALSE; + dst->map->key_sym_map = tmp; + } + memcpy(dst->map->key_sym_map, src->map->key_sym_map, + (src->max_key_code + 1) * sizeof(XkbSymMapRec)); + } + else { + free(dst->map->key_sym_map); + dst->map->key_sym_map = NULL; + } + + if (src->map->types && src->map->num_types) { + if (src->map->num_types > dst->map->size_types || + !dst->map->types || !dst->map->size_types) { + if (dst->map->types && dst->map->size_types) { + tmp = realloc(dst->map->types, + src->map->num_types * sizeof(XkbKeyTypeRec)); + if (!tmp) + return FALSE; + dst->map->types = tmp; + memset(dst->map->types + dst->map->num_types, 0, + (src->map->num_types - dst->map->num_types) * + sizeof(XkbKeyTypeRec)); + } + else { + tmp = calloc(src->map->num_types, sizeof(XkbKeyTypeRec)); + if (!tmp) + return FALSE; + dst->map->types = tmp; + } + } + else if (src->map->num_types < dst->map->num_types && + dst->map->types) { + for (i = src->map->num_types, dtype = (dst->map->types + i); + i < dst->map->num_types; i++, dtype++) { + free(dtype->level_names); + dtype->level_names = NULL; + dtype->num_levels = 0; + if (dtype->map_count) { + free(dtype->map); + free(dtype->preserve); + } + } + } + + stype = src->map->types; + dtype = dst->map->types; + for (i = 0; i < src->map->num_types; i++, dtype++, stype++) { + if (stype->num_levels && stype->level_names) { + if (stype->num_levels != dtype->num_levels && + dtype->num_levels && dtype->level_names && + i < dst->map->num_types) { + tmp = realloc(dtype->level_names, + stype->num_levels * sizeof(Atom)); + if (!tmp) + continue; + dtype->level_names = tmp; + } + else if (!dtype->num_levels || !dtype->level_names || + i >= dst->map->num_types) { + tmp = malloc(stype->num_levels * sizeof(Atom)); + if (!tmp) + continue; + dtype->level_names = tmp; + } + dtype->num_levels = stype->num_levels; + memcpy(dtype->level_names, stype->level_names, + stype->num_levels * sizeof(Atom)); + } + else { + if (dtype->num_levels && dtype->level_names && + i < dst->map->num_types) + free(dtype->level_names); + dtype->num_levels = 0; + dtype->level_names = NULL; + } + + dtype->name = stype->name; + memcpy(&dtype->mods, &stype->mods, sizeof(XkbModsRec)); + + if (stype->map_count) { + if (stype->map) { + if (stype->map_count != dtype->map_count && + dtype->map_count && dtype->map && + i < dst->map->num_types) { + tmp = realloc(dtype->map, + stype->map_count * + sizeof(XkbKTMapEntryRec)); + if (!tmp) + return FALSE; + dtype->map = tmp; + } + else if (!dtype->map_count || !dtype->map || + i >= dst->map->num_types) { + tmp = malloc(stype->map_count * + sizeof(XkbKTMapEntryRec)); + if (!tmp) + return FALSE; + dtype->map = tmp; + } + + memcpy(dtype->map, stype->map, + stype->map_count * sizeof(XkbKTMapEntryRec)); + } + else { + if (dtype->map && i < dst->map->num_types) + free(dtype->map); + dtype->map = NULL; + } + + if (stype->preserve) { + if (stype->map_count != dtype->map_count && + dtype->map_count && dtype->preserve && + i < dst->map->num_types) { + tmp = realloc(dtype->preserve, + stype->map_count * + sizeof(XkbModsRec)); + if (!tmp) + return FALSE; + dtype->preserve = tmp; + } + else if (!dtype->preserve || !dtype->map_count || + i >= dst->map->num_types) { + tmp = malloc(stype->map_count * + sizeof(XkbModsRec)); + if (!tmp) + return FALSE; + dtype->preserve = tmp; + } + + memcpy(dtype->preserve, stype->preserve, + stype->map_count * sizeof(XkbModsRec)); + } + else { + if (dtype->preserve && i < dst->map->num_types) + free(dtype->preserve); + dtype->preserve = NULL; + } + + dtype->map_count = stype->map_count; + } + else { + if (dtype->map_count && i < dst->map->num_types) { + free(dtype->map); + free(dtype->preserve); + } + dtype->map_count = 0; + dtype->map = NULL; + dtype->preserve = NULL; + } + } + + dst->map->size_types = src->map->num_types; + dst->map->num_types = src->map->num_types; + } + else { + if (dst->map->types) { + for (i = 0, dtype = dst->map->types; i < dst->map->num_types; + i++, dtype++) { + free(dtype->level_names); + if (dtype->map && dtype->map_count) + free(dtype->map); + if (dtype->preserve && dtype->map_count) + free(dtype->preserve); + } + } + free(dst->map->types); + dst->map->types = NULL; + dst->map->num_types = 0; + dst->map->size_types = 0; + } + + if (src->map->modmap) { + if (src->max_key_code != dst->max_key_code) { + tmp = realloc(dst->map->modmap, src->max_key_code + 1); + if (!tmp) + return FALSE; + dst->map->modmap = tmp; + } + memcpy(dst->map->modmap, src->map->modmap, src->max_key_code + 1); + } + else { + free(dst->map->modmap); + dst->map->modmap = NULL; + } + } + else { + if (dst->map) + XkbFreeClientMap(dst, XkbAllClientInfoMask, TRUE); + } + + return TRUE; +} + +static Bool +_XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; + + /* server map */ + if (src->server) { + if (!dst->server) { + tmp = calloc(1, sizeof(XkbServerMapRec)); + if (!tmp) + return FALSE; + dst->server = tmp; + } + + if (src->server->explicit) { + if (src->max_key_code != dst->max_key_code) { + tmp = realloc(dst->server->explicit, src->max_key_code + 1); + if (!tmp) + return FALSE; + dst->server->explicit = tmp; + } + memcpy(dst->server->explicit, src->server->explicit, + src->max_key_code + 1); + } + else { + free(dst->server->explicit); + dst->server->explicit = NULL; + } + + if (src->server->acts) { + if (src->server->size_acts != dst->server->size_acts) { + tmp = realloc(dst->server->acts, + src->server->size_acts * sizeof(XkbAction)); + if (!tmp) + return FALSE; + dst->server->acts = tmp; + } + memcpy(dst->server->acts, src->server->acts, + src->server->size_acts * sizeof(XkbAction)); + } + else { + free(dst->server->acts); + dst->server->acts = NULL; + } + dst->server->size_acts = src->server->size_acts; + dst->server->num_acts = src->server->num_acts; + + if (src->server->key_acts) { + if (src->max_key_code != dst->max_key_code) { + tmp = realloc(dst->server->key_acts, + (src->max_key_code + 1) * sizeof(unsigned short)); + if (!tmp) + return FALSE; + dst->server->key_acts = tmp; + } + memcpy(dst->server->key_acts, src->server->key_acts, + (src->max_key_code + 1) * sizeof(unsigned short)); + } + else { + free(dst->server->key_acts); + dst->server->key_acts = NULL; + } + + if (src->server->behaviors) { + if (src->max_key_code != dst->max_key_code) { + tmp = realloc(dst->server->behaviors, + (src->max_key_code + 1) * sizeof(XkbBehavior)); + if (!tmp) + return FALSE; + dst->server->behaviors = tmp; + } + memcpy(dst->server->behaviors, src->server->behaviors, + (src->max_key_code + 1) * sizeof(XkbBehavior)); + } + else { + free(dst->server->behaviors); + dst->server->behaviors = NULL; + } + + memcpy(dst->server->vmods, src->server->vmods, XkbNumVirtualMods); + + if (src->server->vmodmap) { + if (src->max_key_code != dst->max_key_code) { + tmp = realloc(dst->server->vmodmap, + (src->max_key_code + 1) * sizeof(unsigned short)); + if (!tmp) + return FALSE; + dst->server->vmodmap = tmp; + } + memcpy(dst->server->vmodmap, src->server->vmodmap, + (src->max_key_code + 1) * sizeof(unsigned short)); + } + else { + free(dst->server->vmodmap); + dst->server->vmodmap = NULL; + } + } + else { + if (dst->server) + XkbFreeServerMap(dst, XkbAllServerInfoMask, TRUE); + } + + return TRUE; +} + +static Bool +_XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; + + /* names */ + if (src->names) { + if (!dst->names) { + dst->names = calloc(1, sizeof(XkbNamesRec)); + if (!dst->names) + return FALSE; + } + + if (src->names->keys) { + if (src->max_key_code != dst->max_key_code) { + tmp = realloc(dst->names->keys, + (src->max_key_code + 1) * sizeof(XkbKeyNameRec)); + if (!tmp) + return FALSE; + dst->names->keys = tmp; + } + memcpy(dst->names->keys, src->names->keys, + (src->max_key_code + 1) * sizeof(XkbKeyNameRec)); + } + else { + free(dst->names->keys); + dst->names->keys = NULL; + } + + if (src->names->num_key_aliases) { + if (src->names->num_key_aliases != dst->names->num_key_aliases) { + tmp = realloc(dst->names->key_aliases, + src->names->num_key_aliases * + sizeof(XkbKeyAliasRec)); + if (!tmp) + return FALSE; + dst->names->key_aliases = tmp; + } + memcpy(dst->names->key_aliases, src->names->key_aliases, + src->names->num_key_aliases * sizeof(XkbKeyAliasRec)); + } + else { + free(dst->names->key_aliases); + dst->names->key_aliases = NULL; + } + dst->names->num_key_aliases = src->names->num_key_aliases; + + if (src->names->num_rg) { + if (src->names->num_rg != dst->names->num_rg) { + tmp = realloc(dst->names->radio_groups, + src->names->num_rg * sizeof(Atom)); + if (!tmp) + return FALSE; + dst->names->radio_groups = tmp; + } + memcpy(dst->names->radio_groups, src->names->radio_groups, + src->names->num_rg * sizeof(Atom)); + } + else { + free(dst->names->radio_groups); + } + dst->names->num_rg = src->names->num_rg; + + dst->names->keycodes = src->names->keycodes; + dst->names->geometry = src->names->geometry; + dst->names->symbols = src->names->symbols; + dst->names->types = src->names->types; + dst->names->compat = src->names->compat; + dst->names->phys_symbols = src->names->phys_symbols; + + memcpy(dst->names->vmods, src->names->vmods, + XkbNumVirtualMods * sizeof(Atom)); + memcpy(dst->names->indicators, src->names->indicators, + XkbNumIndicators * sizeof(Atom)); + memcpy(dst->names->groups, src->names->groups, + XkbNumKbdGroups * sizeof(Atom)); + } + else { + if (dst->names) + XkbFreeNames(dst, XkbAllNamesMask, TRUE); + } + + return TRUE; +} + +static Bool +_XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; + + /* compat */ + if (src->compat) { + if (!dst->compat) { + dst->compat = calloc(1, sizeof(XkbCompatMapRec)); + if (!dst->compat) + return FALSE; + } + + if (src->compat->sym_interpret && src->compat->num_si) { + if (src->compat->num_si != dst->compat->size_si) { + tmp = realloc(dst->compat->sym_interpret, + src->compat->num_si * sizeof(XkbSymInterpretRec)); + if (!tmp) + return FALSE; + dst->compat->sym_interpret = tmp; + } + memcpy(dst->compat->sym_interpret, src->compat->sym_interpret, + src->compat->num_si * sizeof(XkbSymInterpretRec)); + + dst->compat->num_si = src->compat->num_si; + dst->compat->size_si = src->compat->num_si; + } + else { + if (dst->compat->sym_interpret && dst->compat->size_si) + free(dst->compat->sym_interpret); + + dst->compat->sym_interpret = NULL; + dst->compat->num_si = 0; + dst->compat->size_si = 0; + } + + memcpy(dst->compat->groups, src->compat->groups, + XkbNumKbdGroups * sizeof(XkbModsRec)); + } + else { + if (dst->compat) + XkbFreeCompatMap(dst, XkbAllCompatMask, TRUE); + } + + return TRUE; +} + +static Bool +_XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) +{ + void *tmp = NULL; + int i = 0, j = 0, k = 0; + XkbColorPtr scolor = NULL, dcolor = NULL; + XkbDoodadPtr sdoodad = NULL, ddoodad = NULL; + XkbOutlinePtr soutline = NULL, doutline = NULL; + XkbPropertyPtr sprop = NULL, dprop = NULL; + XkbRowPtr srow = NULL, drow = NULL; + XkbSectionPtr ssection = NULL, dsection = NULL; + XkbShapePtr sshape = NULL, dshape = NULL; + + /* geometry */ + if (src->geom) { + if (!dst->geom) { + dst->geom = calloc(sizeof(XkbGeometryRec), 1); + if (!dst->geom) + return FALSE; + } + + /* properties */ + if (src->geom->num_properties) { + if (src->geom->num_properties != dst->geom->sz_properties) { + /* If we've got more properties in the destination than + * the source, run through and free all the excess ones + * first. */ + if (src->geom->num_properties < dst->geom->sz_properties) { + for (i = src->geom->num_properties, + dprop = dst->geom->properties + i; + i < dst->geom->num_properties; + i++, dprop++) { + free(dprop->name); + free(dprop->value); + } + } + + if (dst->geom->sz_properties) + tmp = realloc(dst->geom->properties, + src->geom->num_properties * + sizeof(XkbPropertyRec)); + else + tmp = malloc(src->geom->num_properties * + sizeof(XkbPropertyRec)); + if (!tmp) + return FALSE; + dst->geom->properties = tmp; + } + + /* We don't set num_properties as we need it to try and avoid + * too much reallocing. */ + dst->geom->sz_properties = src->geom->num_properties; + + if (dst->geom->sz_properties > dst->geom->num_properties) { + memset(dst->geom->properties + dst->geom->num_properties, 0, + (dst->geom->sz_properties - dst->geom->num_properties) * + sizeof(XkbPropertyRec)); + } + + for (i = 0, + sprop = src->geom->properties, + dprop = dst->geom->properties; + i < src->geom->num_properties; + i++, sprop++, dprop++) { + if (i < dst->geom->num_properties) { + if (strlen(sprop->name) != strlen(dprop->name)) { + tmp = realloc(dprop->name, strlen(sprop->name) + 1); + if (!tmp) + return FALSE; + dprop->name = tmp; + } + if (strlen(sprop->value) != strlen(dprop->value)) { + tmp = realloc(dprop->value, strlen(sprop->value) + 1); + if (!tmp) + return FALSE; + dprop->value = tmp; + } + strcpy(dprop->name, sprop->name); + strcpy(dprop->value, sprop->value); + } + else { + dprop->name = xstrdup(sprop->name); + dprop->value = xstrdup(sprop->value); + } + } + + /* ... which is already src->geom->num_properties. */ + dst->geom->num_properties = dst->geom->sz_properties; + } + else { + if (dst->geom->sz_properties) { + for (i = 0, dprop = dst->geom->properties; + i < dst->geom->num_properties; + i++, dprop++) { + free(dprop->name); + free(dprop->value); + } + free(dst->geom->properties); + dst->geom->properties = NULL; + } + + dst->geom->num_properties = 0; + dst->geom->sz_properties = 0; + } + + /* colors */ + if (src->geom->num_colors) { + if (src->geom->num_colors != dst->geom->sz_colors) { + if (src->geom->num_colors < dst->geom->sz_colors) { + for (i = src->geom->num_colors, + dcolor = dst->geom->colors + i; + i < dst->geom->num_colors; + i++, dcolor++) { + free(dcolor->spec); + } + } + + if (dst->geom->sz_colors) + tmp = realloc(dst->geom->colors, + src->geom->num_colors * + sizeof(XkbColorRec)); + else + tmp = malloc(src->geom->num_colors * + sizeof(XkbColorRec)); + if (!tmp) + return FALSE; + dst->geom->colors = tmp; + } + + dst->geom->sz_colors = src->geom->num_colors; + + if (dst->geom->sz_colors > dst->geom->num_colors) { + memset(dst->geom->colors + dst->geom->num_colors, 0, + (dst->geom->sz_colors - dst->geom->num_colors) * + sizeof(XkbColorRec)); + } + + for (i = 0, + scolor = src->geom->colors, + dcolor = dst->geom->colors; + i < src->geom->num_colors; + i++, scolor++, dcolor++) { + if (i < dst->geom->num_colors) { + if (strlen(scolor->spec) != strlen(dcolor->spec)) { + tmp = realloc(dcolor->spec, strlen(scolor->spec) + 1); + if (!tmp) + return FALSE; + dcolor->spec = tmp; + } + strcpy(dcolor->spec, scolor->spec); + } + else { + dcolor->spec = xstrdup(scolor->spec); + } + dcolor->pixel = scolor->pixel; + } + + dst->geom->num_colors = dst->geom->sz_colors; + } + else { + if (dst->geom->sz_colors) { + for (i = 0, dcolor = dst->geom->colors; + i < dst->geom->num_colors; + i++, dcolor++) { + free(dcolor->spec); + } + free(dst->geom->colors); + dst->geom->colors = NULL; + } + + dst->geom->num_colors = 0; + dst->geom->sz_colors = 0; + } + + /* shapes */ + /* shapes break down into outlines, which break down into points. */ + if (dst->geom->num_shapes) { + for (i = 0, dshape = dst->geom->shapes; + i < dst->geom->num_shapes; + i++, dshape++) { + for (j = 0, doutline = dshape->outlines; + j < dshape->num_outlines; + j++, doutline++) { + if (doutline->sz_points) + free(doutline->points); + } + + if (dshape->sz_outlines) { + free(dshape->outlines); + dshape->outlines = NULL; + } + + dshape->num_outlines = 0; + dshape->sz_outlines = 0; + } + } + + if (src->geom->num_shapes) { + tmp = calloc(src->geom->num_shapes, sizeof(XkbShapeRec)); + if (!tmp) + return FALSE; + dst->geom->shapes = tmp; + + for (i = 0, sshape = src->geom->shapes, dshape = dst->geom->shapes; + i < src->geom->num_shapes; + i++, sshape++, dshape++) { + if (sshape->num_outlines) { + tmp = calloc(sshape->num_outlines, sizeof(XkbOutlineRec)); + if (!tmp) + return FALSE; + dshape->outlines = tmp; + + for (j = 0, + soutline = sshape->outlines, + doutline = dshape->outlines; + j < sshape->num_outlines; + j++, soutline++, doutline++) { + if (soutline->num_points) { + tmp = malloc(soutline->num_points * + sizeof(XkbPointRec)); + if (!tmp) + return FALSE; + doutline->points = tmp; + + memcpy(doutline->points, soutline->points, + soutline->num_points * sizeof(XkbPointRec)); + + doutline->corner_radius = soutline->corner_radius; + } + + doutline->num_points = soutline->num_points; + doutline->sz_points = soutline->num_points; + } + } + + dshape->num_outlines = sshape->num_outlines; + dshape->sz_outlines = sshape->num_outlines; + dshape->name = sshape->name; + dshape->bounds = sshape->bounds; + + dshape->approx = NULL; + if (sshape->approx && sshape->num_outlines > 0) { + + const ptrdiff_t approx_idx = + sshape->approx - sshape->outlines; + + if (approx_idx < dshape->num_outlines) { + dshape->approx = dshape->outlines + approx_idx; + } else { + LogMessage(X_WARNING, "XKB: approx outline " + "index is out of range\n"); + } + } + + dshape->primary = NULL; + if (sshape->primary && sshape->num_outlines > 0) { + + const ptrdiff_t primary_idx = + sshape->primary - sshape->outlines; + + if (primary_idx < dshape->num_outlines) { + dshape->primary = dshape->outlines + primary_idx; + } else { + LogMessage(X_WARNING, "XKB: primary outline " + "index is out of range\n"); + } + } + } + + dst->geom->num_shapes = src->geom->num_shapes; + dst->geom->sz_shapes = src->geom->num_shapes; + } + else { + if (dst->geom->sz_shapes) { + free(dst->geom->shapes); + } + dst->geom->shapes = NULL; + dst->geom->num_shapes = 0; + dst->geom->sz_shapes = 0; + } + + /* sections */ + /* sections break down into doodads, and also into rows, which break + * down into keys. */ + if (dst->geom->num_sections) { + for (i = 0, dsection = dst->geom->sections; + i < dst->geom->num_sections; + i++, dsection++) { + for (j = 0, drow = dsection->rows; + j < dsection->num_rows; + j++, drow++) { + if (drow->num_keys) + free(drow->keys); + } + + if (dsection->num_rows) + free(dsection->rows); + + /* cut and waste from geom/doodad below. */ + for (j = 0, ddoodad = dsection->doodads; + j < dsection->num_doodads; + j++, ddoodad++) { + if (ddoodad->any.type == XkbTextDoodad) { + free(ddoodad->text.text); + ddoodad->text.text = NULL; + free(ddoodad->text.font); + ddoodad->text.font = NULL; + } + else if (ddoodad->any.type == XkbLogoDoodad) { + free(ddoodad->logo.logo_name); + ddoodad->logo.logo_name = NULL; + } + } + + free(dsection->doodads); + } + + dst->geom->num_sections = 0; + dst->geom->sections = NULL; + } + + if (src->geom->num_sections) { + if (dst->geom->sz_sections) + tmp = realloc(dst->geom->sections, + src->geom->num_sections * + sizeof(XkbSectionRec)); + else + tmp = malloc(src->geom->num_sections * sizeof(XkbSectionRec)); + if (!tmp) + return FALSE; + memset(tmp, 0, src->geom->num_sections * sizeof(XkbSectionRec)); + dst->geom->sections = tmp; + dst->geom->num_sections = src->geom->num_sections; + dst->geom->sz_sections = src->geom->num_sections; + + for (i = 0, + ssection = src->geom->sections, + dsection = dst->geom->sections; + i < src->geom->num_sections; + i++, ssection++, dsection++) { + *dsection = *ssection; + if (ssection->num_rows) { + tmp = calloc(ssection->num_rows, sizeof(XkbRowRec)); + if (!tmp) + return FALSE; + dsection->rows = tmp; + } + dsection->num_rows = ssection->num_rows; + dsection->sz_rows = ssection->num_rows; + + for (j = 0, srow = ssection->rows, drow = dsection->rows; + j < ssection->num_rows; + j++, srow++, drow++) { + if (srow->num_keys) { + tmp = malloc(srow->num_keys * sizeof(XkbKeyRec)); + if (!tmp) + return FALSE; + drow->keys = tmp; + memcpy(drow->keys, srow->keys, + srow->num_keys * sizeof(XkbKeyRec)); + } + drow->num_keys = srow->num_keys; + drow->sz_keys = srow->num_keys; + drow->top = srow->top; + drow->left = srow->left; + drow->vertical = srow->vertical; + drow->bounds = srow->bounds; + } + + if (ssection->num_doodads) { + tmp = calloc(ssection->num_doodads, sizeof(XkbDoodadRec)); + if (!tmp) + return FALSE; + dsection->doodads = tmp; + } + else { + dsection->doodads = NULL; + } + + dsection->sz_doodads = ssection->num_doodads; + for (k = 0, + sdoodad = ssection->doodads, + ddoodad = dsection->doodads; + k < ssection->num_doodads; + k++, sdoodad++, ddoodad++) { + memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec)); + if (sdoodad->any.type == XkbTextDoodad) { + if (sdoodad->text.text) + ddoodad->text.text = + strdup(sdoodad->text.text); + if (sdoodad->text.font) + ddoodad->text.font = + strdup(sdoodad->text.font); + } + else if (sdoodad->any.type == XkbLogoDoodad) { + if (sdoodad->logo.logo_name) + ddoodad->logo.logo_name = + strdup(sdoodad->logo.logo_name); + } + } + dsection->overlays = NULL; + dsection->sz_overlays = 0; + dsection->num_overlays = 0; + } + } + else { + if (dst->geom->sz_sections) { + free(dst->geom->sections); + } + + dst->geom->sections = NULL; + dst->geom->num_sections = 0; + dst->geom->sz_sections = 0; + } + + /* doodads */ + if (dst->geom->num_doodads) { + for (i = src->geom->num_doodads, + ddoodad = dst->geom->doodads + + src->geom->num_doodads; + i < dst->geom->num_doodads; + i++, ddoodad++) { + if (ddoodad->any.type == XkbTextDoodad) { + free(ddoodad->text.text); + ddoodad->text.text = NULL; + free(ddoodad->text.font); + ddoodad->text.font = NULL; + } + else if (ddoodad->any.type == XkbLogoDoodad) { + free(ddoodad->logo.logo_name); + ddoodad->logo.logo_name = NULL; + } + } + dst->geom->num_doodads = 0; + dst->geom->doodads = NULL; + } + + if (src->geom->num_doodads) { + if (dst->geom->sz_doodads) + tmp = realloc(dst->geom->doodads, + src->geom->num_doodads * + sizeof(XkbDoodadRec)); + else + tmp = malloc(src->geom->num_doodads * + sizeof(XkbDoodadRec)); + if (!tmp) + return FALSE; + memset(tmp, 0, src->geom->num_doodads * sizeof(XkbDoodadRec)); + dst->geom->doodads = tmp; + + dst->geom->sz_doodads = src->geom->num_doodads; + + for (i = 0, + sdoodad = src->geom->doodads, + ddoodad = dst->geom->doodads; + i < src->geom->num_doodads; + i++, sdoodad++, ddoodad++) { + memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec)); + if (sdoodad->any.type == XkbTextDoodad) { + if (sdoodad->text.text) + ddoodad->text.text = strdup(sdoodad->text.text); + if (sdoodad->text.font) + ddoodad->text.font = strdup(sdoodad->text.font); + } + else if (sdoodad->any.type == XkbLogoDoodad) { + if (sdoodad->logo.logo_name) + ddoodad->logo.logo_name = + strdup(sdoodad->logo.logo_name); + } + } + + dst->geom->num_doodads = dst->geom->sz_doodads; + } + else { + if (dst->geom->sz_doodads) { + free(dst->geom->doodads); + } + + dst->geom->doodads = NULL; + dst->geom->num_doodads = 0; + dst->geom->sz_doodads = 0; + } + + /* key aliases */ + if (src->geom->num_key_aliases) { + if (src->geom->num_key_aliases != dst->geom->sz_key_aliases) { + if (dst->geom->sz_key_aliases) + tmp = realloc(dst->geom->key_aliases, + src->geom->num_key_aliases * + 2 * XkbKeyNameLength); + else + tmp = malloc(src->geom->num_key_aliases * + 2 * XkbKeyNameLength); + if (!tmp) + return FALSE; + dst->geom->key_aliases = tmp; + + dst->geom->sz_key_aliases = src->geom->num_key_aliases; + } + + memcpy(dst->geom->key_aliases, src->geom->key_aliases, + src->geom->num_key_aliases * 2 * XkbKeyNameLength); + + dst->geom->num_key_aliases = dst->geom->sz_key_aliases; + } + else { + free(dst->geom->key_aliases); + dst->geom->key_aliases = NULL; + dst->geom->num_key_aliases = 0; + dst->geom->sz_key_aliases = 0; + } + + /* font */ + if (src->geom->label_font) { + if (!dst->geom->label_font) { + tmp = malloc(strlen(src->geom->label_font) + 1); + if (!tmp) + return FALSE; + dst->geom->label_font = tmp; + } + else if (strlen(src->geom->label_font) != + strlen(dst->geom->label_font)) { + tmp = realloc(dst->geom->label_font, + strlen(src->geom->label_font) + 1); + if (!tmp) + return FALSE; + dst->geom->label_font = tmp; + } + + strcpy(dst->geom->label_font, src->geom->label_font); + i = XkbGeomColorIndex(src->geom, src->geom->label_color); + dst->geom->label_color = &(dst->geom->colors[i]); + i = XkbGeomColorIndex(src->geom, src->geom->base_color); + dst->geom->base_color = &(dst->geom->colors[i]); + } + else { + free(dst->geom->label_font); + dst->geom->label_font = NULL; + dst->geom->label_color = NULL; + dst->geom->base_color = NULL; + } + + dst->geom->name = src->geom->name; + dst->geom->width_mm = src->geom->width_mm; + dst->geom->height_mm = src->geom->height_mm; + } + else + { + if (dst->geom) { + /* I LOVE THE DIFFERENT CALL SIGNATURE. REALLY, I DO. */ + XkbFreeGeometry(dst->geom, XkbGeomAllMask, TRUE); + dst->geom = NULL; + } + } + + return TRUE; +} + +static Bool +_XkbCopyIndicators(XkbDescPtr src, XkbDescPtr dst) +{ + /* indicators */ + if (src->indicators) { + if (!dst->indicators) { + dst->indicators = malloc(sizeof(XkbIndicatorRec)); + if (!dst->indicators) + return FALSE; + } + memcpy(dst->indicators, src->indicators, sizeof(XkbIndicatorRec)); + } + else { + free(dst->indicators); + dst->indicators = NULL; + } + return TRUE; +} + +static Bool +_XkbCopyControls(XkbDescPtr src, XkbDescPtr dst) +{ + /* controls */ + if (src->ctrls) { + if (!dst->ctrls) { + dst->ctrls = malloc(sizeof(XkbControlsRec)); + if (!dst->ctrls) + return FALSE; + } + memcpy(dst->ctrls, src->ctrls, sizeof(XkbControlsRec)); + } + else { + free(dst->ctrls); + dst->ctrls = NULL; + } + return TRUE; +} + +/** + * Copy an XKB map from src to dst, reallocating when necessary: if some + * map components are present in one, but not in the other, the destination + * components will be allocated or freed as necessary. + * + * Basic map consistency is assumed on both sides, so maps with random + * uninitialised data (e.g. names->radio_grous == NULL, names->num_rg == 19) + * _will_ cause failures. You've been warned. + * + * Returns TRUE on success, or FALSE on failure. If this function fails, + * dst may be in an inconsistent state: all its pointers are guaranteed + * to remain valid, but part of the map may be from src and part from dst. + * + */ + +Bool +XkbCopyKeymap(XkbDescPtr dst, XkbDescPtr src) +{ + + if (!src || !dst) { + DebugF("XkbCopyKeymap: src (%p) or dst (%p) is NULL\n", src, dst); + return FALSE; + } + + if (src == dst) + return TRUE; + + if (!_XkbCopyClientMap(src, dst)) { + DebugF("XkbCopyKeymap: failed to copy client map\n"); + return FALSE; + } + if (!_XkbCopyServerMap(src, dst)) { + DebugF("XkbCopyKeymap: failed to copy server map\n"); + return FALSE; + } + if (!_XkbCopyIndicators(src, dst)) { + DebugF("XkbCopyKeymap: failed to copy indicators\n"); + return FALSE; + } + if (!_XkbCopyControls(src, dst)) { + DebugF("XkbCopyKeymap: failed to copy controls\n"); + return FALSE; + } + if (!_XkbCopyNames(src, dst)) { + DebugF("XkbCopyKeymap: failed to copy names\n"); + return FALSE; + } + if (!_XkbCopyCompat(src, dst)) { + DebugF("XkbCopyKeymap: failed to copy compat map\n"); + return FALSE; + } + if (!_XkbCopyGeom(src, dst)) { + DebugF("XkbCopyKeymap: failed to copy geometry\n"); + return FALSE; + } + + dst->min_key_code = src->min_key_code; + dst->max_key_code = src->max_key_code; + + return TRUE; +} + +Bool +XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) +{ + xkbNewKeyboardNotify nkn; + Bool ret; + + if (!dst->key || !src->key) + return FALSE; + + memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); + nkn.oldMinKeyCode = dst->key->xkbInfo->desc->min_key_code; + nkn.oldMaxKeyCode = dst->key->xkbInfo->desc->max_key_code; + nkn.deviceID = dst->id; + nkn.oldDeviceID = dst->id; /* maybe src->id? */ + nkn.minKeyCode = src->key->xkbInfo->desc->min_key_code; + nkn.maxKeyCode = src->key->xkbInfo->desc->max_key_code; + nkn.requestMajor = XkbReqCode; + nkn.requestMinor = X_kbSetMap; /* Near enough's good enough. */ + nkn.changed = XkbNKN_KeycodesMask; + if (src->key->xkbInfo->desc->geom) + nkn.changed |= XkbNKN_GeometryMask; + + ret = XkbCopyKeymap(dst->key->xkbInfo->desc, src->key->xkbInfo->desc); + if (ret) + XkbSendNewKeyboardNotify(dst, &nkn); + + return ret; +} + +int +XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode) +{ + XkbDescPtr xkb = xkbi->desc; + int effectiveGroup = xkbState->group; + + if (!XkbKeycodeInRange(xkb, keycode)) + return -1; + + if (effectiveGroup == XkbGroup1Index) + return effectiveGroup; + + if (XkbKeyNumGroups(xkb,keycode) > 1U) { + if (effectiveGroup >= XkbKeyNumGroups(xkb,keycode)) { + unsigned int gi = XkbKeyGroupInfo(xkb,keycode); + switch (XkbOutOfRangeGroupAction(gi)) { + default: + case XkbWrapIntoRange: + effectiveGroup %= XkbKeyNumGroups(xkb, keycode); + break; + case XkbClampIntoRange: + effectiveGroup = XkbKeyNumGroups(xkb, keycode) - 1; + break; + case XkbRedirectIntoRange: + effectiveGroup = XkbOutOfRangeGroupInfo(gi); + if (effectiveGroup >= XkbKeyNumGroups(xkb, keycode)) + effectiveGroup = 0; + break; + } + } + } + else effectiveGroup = XkbGroup1Index; + + return effectiveGroup; +} + +/* Merge the lockedPtrButtons from all attached SDs for the given master + * device into the MD's state. + */ +void +XkbMergeLockedPtrBtns(DeviceIntPtr master) +{ + DeviceIntPtr d = inputInfo.devices; + XkbSrvInfoPtr xkbi = NULL; + + if (!IsMaster(master)) + return; + + if (!master->key) + return; + + xkbi = master->key->xkbInfo; + xkbi->lockedPtrButtons = 0; + + for (; d; d = d->next) { + if (IsMaster(d) || GetMaster(d, MASTER_KEYBOARD) != master || !d->key) + continue; + + xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons; + } +} -- cgit v1.2.3