[X2Go-Commits] [vcxsrv] 10/13: Merge remote-tracking branch 'origin/released'

git-admin at x2go.org git-admin at x2go.org
Mon Mar 9 05:11:46 CET 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to annotated tag 1.16.2.0
in repository vcxsrv.

commit 7147e58c389cffeb930bdd8e3a2fdfc5d5bb3a0c
Merge: 0dbe845 a1011d6
Author: marha <marha at users.sourceforge.net>
Date:   Sat Nov 29 16:13:30 2014 +0100

    Merge remote-tracking branch 'origin/released'
    
    Conflicts:
    	xorg-server/dix/dispatch.c
    	xorg-server/hw/xwin/ddraw.h
    	xorg-server/hw/xwin/glx/glshim.c
    	xorg-server/hw/xwin/winclipboard/xevents.c
    	xorg-server/hw/xwin/windialogs.c
    	xorg-server/hw/xwin/winmultiwindowshape.c
    	xorg-server/hw/xwin/winmultiwindowwindow.c
    	xorg-server/hw/xwin/winprefslex.l
    	xorg-server/hw/xwin/winshadddnl.c
    	xorg-server/hw/xwin/winshadgdi.c
    	xorg-server/hw/xwin/winwndproc.c
    	xorg-server/mi/miarc.c
    	xorg-server/os/connection.c

 fontconfig/conf.d/30-metric-aliases.conf           |   94 +-
 fontconfig/conf.d/45-latin.conf                    |   12 +
 fontconfig/conf.d/60-latin.conf                    |    3 +
 libX11/nls/compose.dir.pre                         |   21 +-
 libX11/nls/en_US.UTF-8/Compose.pre                 |   41 +-
 libxcb/src/c_client.py                             |   52 +-
 libxcb/xcb-proto/src/xinput.xml                    |   37 +-
 mesalib/VERSION                                    |    2 +-
 mesalib/configure.ac                               |  166 +-
 mesalib/docs/GL3.txt                               |   18 +-
 mesalib/docs/egl.html                              |    7 -
 mesalib/docs/index.html                            |   12 +
 mesalib/docs/llvmpipe.html                         |    2 +-
 mesalib/docs/relnotes.html                         |    2 +
 mesalib/docs/relnotes/10.3.3.html                  |  209 +++
 mesalib/docs/relnotes/10.3.4.html                  |  106 ++
 mesalib/docs/relnotes/10.4.html                    |    4 +-
 mesalib/docs/relnotes/{10.4.html => 10.5.0.html}   |   11 +-
 mesalib/include/D3D9/d3d9.h                        | 1858 ++++++++++++++++++++
 mesalib/include/D3D9/d3d9caps.h                    |  387 ++++
 mesalib/include/D3D9/d3d9types.h                   | 1797 +++++++++++++++++++
 mesalib/include/GLES2/gl2ext.h                     |  313 +++-
 mesalib/include/d3dadapter/d3dadapter9.h           |  101 ++
 mesalib/include/d3dadapter/drm.h                   |   44 +
 mesalib/include/d3dadapter/present.h               |  136 ++
 mesalib/scons/gallium.py                           |   15 +-
 mesalib/src/gallium/Automake.inc                   |    3 +-
 mesalib/src/gallium/Makefile.am                    |   13 +-
 mesalib/src/gallium/auxiliary/Android.mk           |    4 +-
 mesalib/src/gallium/auxiliary/Makefile.am          |   42 +-
 mesalib/src/gallium/auxiliary/Makefile.sources     |  336 +++-
 mesalib/src/gallium/auxiliary/SConscript           |    2 +-
 mesalib/src/gallium/auxiliary/hud/hud_context.c    |    2 -
 mesalib/src/gallium/auxiliary/util/u_atomic.h      |   56 +-
 mesalib/src/gallium/auxiliary/util/u_blit.c        |    4 +-
 mesalib/src/gallium/auxiliary/util/u_blitter.c     |    7 +-
 mesalib/src/gallium/auxiliary/util/u_box.h         |  118 ++
 .../src/gallium/auxiliary/util/u_format_pack.py    |   35 +-
 mesalib/src/gallium/auxiliary/util/u_pstipple.c    |  228 +--
 mesalib/src/gallium/auxiliary/util/u_pstipple.h    |    5 +-
 mesalib/src/gallium/auxiliary/util/u_rect.h        |   18 +
 .../src/gallium/auxiliary/util/u_simple_shaders.c  |   80 +-
 .../src/gallium/auxiliary/util/u_simple_shaders.h  |   10 +-
 mesalib/src/gallium/auxiliary/util/u_snprintf.c    |    2 +-
 mesalib/src/gallium/auxiliary/util/u_tests.c       |  268 +++
 .../strtod.h => gallium/auxiliary/util/u_tests.h}  |   31 +-
 mesalib/src/glsl/Makefile.sources                  |    4 +-
 mesalib/src/glsl/ast.h                             |   29 -
 mesalib/src/glsl/glsl_lexer.ll                     |   23 +-
 mesalib/src/glsl/glsl_parser_extras.cpp            |   10 +-
 mesalib/src/glsl/glsl_types.cpp                    |   59 +-
 mesalib/src/glsl/glsl_types.h                      |   33 +-
 mesalib/src/glsl/ir.cpp                            |   48 -
 mesalib/src/glsl/ir.h                              |   30 +-
 mesalib/src/glsl/ir_optimization.h                 |    1 +
 mesalib/src/glsl/ir_reader.cpp                     |    2 +-
 mesalib/src/glsl/ir_uniform.h                      |    6 +
 mesalib/src/glsl/link_uniforms.cpp                 |   50 +
 mesalib/src/glsl/linker.cpp                        |   44 +-
 mesalib/src/glsl/list.h                            |   21 +
 mesalib/src/glsl/loop_unroll.cpp                   |   13 +-
 .../src/glsl/lower_const_arrays_to_uniforms.cpp    |  111 ++
 mesalib/src/glsl/main.cpp                          |   10 +
 mesalib/src/glsl/opt_algebraic.cpp                 |   49 +-
 mesalib/src/glsl/opt_cse.cpp                       |    9 +-
 mesalib/src/glsl/s_expression.cpp                  |    2 +-
 mesalib/src/glsl/s_expression.h                    |    2 +-
 mesalib/src/mapi/glapi/SConscript                  |    1 +
 .../mapi/glapi/gen/KHR_context_flush_control.xml   |   11 +
 mesalib/src/mapi/glapi/gen/Makefile.am             |    3 -
 mesalib/src/mapi/glapi/gen/extension_helper.py     |  324 ----
 mesalib/src/mapi/glapi/gen/gl_API.xml              |    2 +
 mesalib/src/mapi/glapi/gen/gl_offsets.py           |  120 --
 mesalib/src/mapi/glapi/gen/mesadef.py              |  215 ---
 mesalib/src/mesa/Android.libmesa_dricore.mk        |    8 +-
 mesalib/src/mesa/Android.libmesa_st_mesa.mk        |    5 +
 mesalib/src/mesa/Makefile.am                       |    3 +-
 mesalib/src/mesa/drivers/dri/common/dri_util.c     |   22 +-
 .../mesa/drivers/dri/common/xmlpool/t_options.h    |   18 +
 mesalib/src/mesa/drivers/windows/gdi/mesa.def      |  839 ++-------
 mesalib/src/mesa/main/api_validate.c               |   56 +-
 mesalib/src/mesa/main/api_validate.h               |    6 -
 mesalib/src/mesa/main/attrib.c                     |    3 +-
 mesalib/src/mesa/main/context.c                    |   11 +-
 mesalib/src/mesa/main/errors.c                     |  172 +-
 mesalib/src/mesa/main/extensions.c                 |    1 +
 mesalib/src/mesa/main/get_hash_params.py           |    5 +-
 mesalib/src/mesa/main/imports.c                    |   19 -
 mesalib/src/mesa/main/imports.h                    |    3 -
 mesalib/src/mesa/main/mtypes.h                     |    5 +
 mesalib/src/mesa/main/shaderapi.c                  |    6 +-
 mesalib/src/mesa/main/sse_minmax.c                 |   97 +
 .../src/mesa/main/sse_minmax.h                     |   44 +-
 mesalib/src/mesa/main/streaming-load-memcpy.c      |    3 -
 mesalib/src/mesa/main/texformat.c                  |    3 +
 mesalib/src/mesa/main/texstore.c                   |    4 +-
 mesalib/src/mesa/main/uniform_query.cpp            |  260 +--
 mesalib/src/mesa/main/uniforms.c                   |   98 +-
 mesalib/src/mesa/main/uniforms.h                   |    4 +-
 mesalib/src/mesa/main/viewport.c                   |    8 +-
 mesalib/src/mesa/program/prog_execute.c            |  156 --
 mesalib/src/mesa/program/prog_instruction.c        |   12 -
 mesalib/src/mesa/program/prog_instruction.h        |   12 -
 mesalib/src/mesa/program/program_lexer.l           |   14 +-
 .../src/mesa/state_tracker/st_atom_rasterizer.c    |   11 +-
 mesalib/src/mesa/state_tracker/st_atom_viewport.c  |    2 -
 mesalib/src/mesa/state_tracker/st_cb_bitmap.c      |    5 +-
 mesalib/src/mesa/state_tracker/st_cb_clear.c       |   30 +-
 mesalib/src/mesa/state_tracker/st_cb_drawpixels.c  |    2 -
 mesalib/src/mesa/state_tracker/st_cb_drawtex.c     |    4 +-
 mesalib/src/mesa/state_tracker/st_context.h        |    1 +
 mesalib/src/mesa/state_tracker/st_extensions.c     |    3 +-
 mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   19 +-
 mesalib/src/mesa/state_tracker/st_manager.c        |    3 +-
 mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c   |   12 +-
 mesalib/src/mesa/state_tracker/st_program.c        |   23 +-
 mesalib/src/mesa/vbo/vbo_exec_array.c              |   14 +-
 mesalib/src/mesa/x86/common_x86_features.h         |   26 +
 mesalib/src/util/Makefile.sources                  |    3 +-
 mesalib/src/util/hash_table.c                      |   10 +-
 mesalib/src/util/macros.h                          |   18 +-
 mesalib/src/{glsl/strtod.c => util/strtod.cpp}     |   32 +-
 mesalib/src/{glsl => util}/strtod.h                |    4 +-
 .../glsl_apps_compile/glsl_apps_compile.vcxproj    |    6 +-
 .../glsl_apps_compile.vcxproj.filters              |   12 +-
 mesalib/windows/VC8/mesa/mesa/mesa.vcxproj         |    6 +-
 mesalib/windows/VC8/mesa/mesa/mesa.vcxproj.filters |   12 +-
 xkbcomp/configure.ac                               |    2 +-
 xkbcomp/xkbcomp.c                                  |   32 +-
 xorg-server/Xext/dpms.c                            |   10 +-
 xorg-server/Xext/dpmsstubs.c                       |   10 +-
 xorg-server/Xext/panoramiX.c                       |    2 +-
 xorg-server/Xext/panoramiX.h                       |    2 +-
 xorg-server/Xext/panoramiXprocs.c                  |    4 +-
 xorg-server/Xext/security.c                        |    4 +-
 xorg-server/Xext/shm.c                             |   21 +-
 xorg-server/Xext/sync.c                            |    2 +-
 xorg-server/Xext/syncsrv.h                         |    8 +-
 xorg-server/Xext/xres.c                            |   12 +-
 xorg-server/Xext/xvdisp.c                          |    8 +-
 xorg-server/Xext/xvdix.h                           |   14 +-
 xorg-server/Xext/xvmain.c                          |   20 +-
 xorg-server/composite/compalloc.c                  |    8 +-
 xorg-server/composite/compext.c                    |    4 +-
 xorg-server/composite/compinit.c                   |   21 +-
 xorg-server/composite/compint.h                    |    3 +-
 xorg-server/composite/compoverlay.c                |    4 +-
 xorg-server/composite/compwindow.c                 |    7 +-
 xorg-server/configure.ac                           |   14 +-
 xorg-server/dbe/dbe.c                              |   16 +-
 xorg-server/dbe/dbestruct.h                        |   12 +-
 xorg-server/dbe/midbe.c                            |   14 +-
 xorg-server/dbe/midbe.h                            |    8 +-
 xorg-server/dix/atom.c                             |    8 +-
 xorg-server/dix/colormap.c                         |   34 +-
 xorg-server/dix/cursor.c                           |    8 +-
 xorg-server/dix/devices.c                          |    2 +-
 xorg-server/dix/dispatch.c                         |   16 +-
 xorg-server/dix/dispatch.h                         |    2 +-
 xorg-server/dix/dixfonts.c                         |    6 +-
 xorg-server/dix/dixutils.c                         |   12 +-
 xorg-server/dix/extension.c                        |    8 +-
 xorg-server/dix/gc.c                               |   25 +-
 xorg-server/dix/getevents.c                        |   22 +-
 xorg-server/dix/globals.c                          |    8 +-
 xorg-server/dix/glyphcurs.c                        |    8 +-
 xorg-server/dix/grabs.c                            |   16 +-
 xorg-server/dix/inpututils.c                       |    2 +
 xorg-server/dix/main.c                             |    8 +-
 xorg-server/dix/property.c                         |    8 +-
 xorg-server/dix/region.c                           |   22 +-
 xorg-server/dix/resource.c                         |   16 +-
 xorg-server/dix/selection.c                        |   10 +-
 xorg-server/dix/swaprep.c                          |    8 +-
 xorg-server/dix/swapreq.c                          |    8 +-
 xorg-server/dix/tables.c                           |    8 +-
 xorg-server/dix/window.c                           |   38 +-
 xorg-server/exa/exa.c                              |    2 +-
 xorg-server/exa/exa.h                              |    8 +-
 xorg-server/exa/exa_accel.c                        |   20 +-
 xorg-server/exa/exa_glyphs.c                       |    8 +-
 xorg-server/exa/exa_priv.h                         |    7 +-
 xorg-server/exa/exa_render.c                       |    4 +-
 xorg-server/exa/exa_unaccel.c                      |   11 +-
 xorg-server/fb/Makefile.am                         |    2 -
 xorg-server/fb/fb.h                                |  338 +---
 xorg-server/fb/fb24_32.c                           |    2 +-
 xorg-server/fb/fb24_32.h                           |    2 +-
 xorg-server/fb/fbbits.c                            |   12 -
 xorg-server/fb/fbblt.c                             |  271 +--
 xorg-server/fb/fbbltone.c                          |  320 ++--
 xorg-server/fb/fbfill.c                            |   84 +-
 xorg-server/fb/fbfillrect.c                        |    2 +-
 xorg-server/fb/fbgc.c                              |   85 +-
 xorg-server/fb/fbglyph.c                           |   10 +-
 xorg-server/fb/fbline.c                            |    4 +-
 xorg-server/fb/fboverlay.c                         |    2 +-
 xorg-server/fb/fboverlay.h                         |    2 +-
 xorg-server/fb/fbpict.c                            |   16 +-
 xorg-server/fb/fbpict.h                            |    4 -
 xorg-server/fb/fbpixmap.c                          |    6 +-
 xorg-server/fb/fbpoint.c                           |    2 +-
 xorg-server/fb/fbpush.c                            |    4 +-
 xorg-server/fb/fbrop.h                             |   12 +-
 xorg-server/fb/fbseg.c                             |   42 +-
 xorg-server/fb/fbstipple.c                         |  264 ---
 xorg-server/fb/fbtile.c                            |  163 --
 xorg-server/fb/fbutil.c                            |  308 ----
 xorg-server/fb/wfbrename.h                         |   23 -
 xorg-server/glamor/glamor.c                        |    1 +
 xorg-server/glamor/glamor_fbo.c                    |    3 +-
 xorg-server/glamor/glamor_picture.c                |    2 +-
 xorg-server/glamor/glamor_pixmap.c                 |   75 +-
 xorg-server/glamor/glamor_priv.h                   |    2 +
 xorg-server/glx/glxbyteorder.h                     |    8 +-
 xorg-server/glx/glxcmds.c                          |   22 +-
 xorg-server/glx/glxdri2.c                          |    2 +-
 xorg-server/glx/glxscreens.c                       |    2 +-
 xorg-server/glx/glxscreens.h                       |    2 +-
 xorg-server/glx/indirect_program.c                 |    6 +-
 xorg-server/glx/indirect_table.h                   |    6 +-
 xorg-server/glx/indirect_texture_compression.c     |    6 +-
 xorg-server/glx/indirect_util.c                    |    8 +-
 xorg-server/glx/indirect_util.h                    |    6 +-
 xorg-server/glx/rensize.c                          |    4 +-
 xorg-server/hw/dmx/config/Canvas.c                 |    2 +-
 xorg-server/hw/dmx/config/dmxprint.c               |    2 +-
 xorg-server/hw/dmx/dmxgc.c                         |   12 +-
 xorg-server/hw/dmx/dmxpict.h                       |    2 +-
 xorg-server/hw/dmx/glxProxy/glxcmds.c              |   16 +-
 xorg-server/hw/dmx/glxProxy/glxsingle.c            |    4 +-
 xorg-server/hw/dmx/glxProxy/glxvendor.c            |    4 +-
 xorg-server/hw/dmx/input/ChkNotMaskEv.c            |    2 +-
 xorg-server/hw/dmx/input/lnx-keyboard.c            |   20 +-
 xorg-server/hw/dmx/input/lnx-ms.c                  |    2 +-
 xorg-server/hw/kdrive/ephyr/ephyr.c                |   14 +-
 xorg-server/hw/kdrive/ephyr/ephyr.h                |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrdri.c             |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrdri.h             |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrdriext.c          |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrdriext.h          |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrglxext.c          |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrglxext.h          |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrhostglx.c         |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrhostglx.h         |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrinit.c            |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrlog.h             |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyrvideo.c           |    4 +-
 xorg-server/hw/kdrive/ephyr/hostx.c                |   12 +-
 xorg-server/hw/kdrive/ephyr/hostx.h                |    4 +-
 xorg-server/hw/kdrive/ephyr/os.c                   |    4 +-
 xorg-server/hw/kdrive/src/kxv.c                    |    2 +-
 xorg-server/hw/xfree86/Makefile.am                 |    2 +-
 xorg-server/hw/xfree86/common/Makefile.am          |    4 +
 xorg-server/hw/xfree86/common/compiler.h           |    4 +-
 xorg-server/hw/xfree86/common/xf86AutoConfig.c     |    8 +-
 xorg-server/hw/xfree86/common/xf86Bus.c            |    2 +-
 xorg-server/hw/xfree86/common/xf86Config.c         |    4 +-
 xorg-server/hw/xfree86/common/xf86Configure.c      |    4 +-
 xorg-server/hw/xfree86/common/xf86Mode.c           |    8 +-
 xorg-server/hw/xfree86/common/xf86Module.h         |    4 +-
 xorg-server/hw/xfree86/common/xf86PciInfo.h        |    2 +-
 xorg-server/hw/xfree86/common/xf86Xinput.c         |   16 +-
 xorg-server/hw/xfree86/common/xf86Xinput.h         |    6 +-
 xorg-server/hw/xfree86/common/xf86cmap.c           |    4 +-
 xorg-server/hw/xfree86/common/xf86fbman.c          |    6 +-
 xorg-server/hw/xfree86/common/xf86platformBus.c    |    2 +-
 xorg-server/hw/xfree86/common/xf86str.h            |    2 +-
 xorg-server/hw/xfree86/common/xf86vmode.c          |    8 +-
 xorg-server/hw/xfree86/common/xf86xv.c             |    2 +-
 xorg-server/hw/xfree86/common/xf86xvmc.h           |   10 +-
 xorg-server/hw/xfree86/ddc/ddc.c                   |   10 +-
 xorg-server/hw/xfree86/ddc/edid.h                  |    8 +-
 xorg-server/hw/xfree86/ddc/print_edid.c            |    2 +-
 xorg-server/hw/xfree86/ddc/xf86DDC.h               |    6 +-
 xorg-server/hw/xfree86/dixmods/xkbKillSrv.c        |   16 +-
 xorg-server/hw/xfree86/dixmods/xkbVT.c             |   16 +-
 xorg-server/hw/xfree86/dri/dri.c                   |    4 +-
 xorg-server/hw/xfree86/dri/sarea.h                 |   10 +-
 xorg-server/hw/xfree86/dri2/Makefile.am            |    2 +
 xorg-server/hw/xfree86/dri2/dri2.c                 |   62 +-
 xorg-server/hw/xfree86/dri2/pci_ids/Makefile.am    |   11 +
 xorg-server/hw/xfree86/dri2/pci_ids/i810_pci_ids.h |    4 +
 xorg-server/hw/xfree86/dri2/pci_ids/i915_pci_ids.h |   15 +
 xorg-server/hw/xfree86/dri2/pci_ids/i965_pci_ids.h |  115 ++
 .../hw/xfree86/dri2/pci_ids/pci_id_driver_map.h    |   80 +
 xorg-server/hw/xfree86/dri2/pci_ids/r200_pci_ids.h |   24 +
 xorg-server/hw/xfree86/dri2/pci_ids/r300_pci_ids.h |  227 +++
 xorg-server/hw/xfree86/dri2/pci_ids/r600_pci_ids.h |  327 ++++
 .../hw/xfree86/dri2/pci_ids/radeon_pci_ids.h       |   23 +
 .../hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h     |  157 ++
 .../hw/xfree86/dri2/pci_ids/vmwgfx_pci_ids.h       |    1 +
 .../hw/xfree86/drivers/modesetting/Makefile.am     |    6 +-
 xorg-server/hw/xfree86/drivers/modesetting/dri2.c  |  863 +++++++++
 .../hw/xfree86/drivers/modesetting/driver.c        |   29 +-
 .../hw/xfree86/drivers/modesetting/driver.h        |   44 +
 .../xfree86/drivers/modesetting/drmmode_display.c  |   25 +-
 .../xfree86/drivers/modesetting/drmmode_display.h  |   31 +-
 .../hw/xfree86/drivers/modesetting/vblank.c        |  383 ++++
 xorg-server/hw/xfree86/fbdevhw/fbdevhw.c           |    2 +-
 xorg-server/hw/xfree86/i2c/xf86i2c.c               |   40 +-
 xorg-server/hw/xfree86/i2c/xf86i2c.h               |    2 +-
 xorg-server/hw/xfree86/loader/loadmod.c            |    4 +-
 xorg-server/hw/xfree86/modes/xf86Crtc.c            |    4 +-
 xorg-server/hw/xfree86/modes/xf86Crtc.h            |   10 +-
 xorg-server/hw/xfree86/modes/xf86RandR12.c         |    4 +-
 xorg-server/hw/xfree86/modes/xf86cvt.c             |    4 +-
 xorg-server/hw/xfree86/modes/xf86gtf.c             |   10 +-
 .../hw/xfree86/os-support/bsd/alpha_video.c        |   20 +-
 xorg-server/hw/xfree86/os-support/bsd/arm_video.c  |   28 +-
 xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c    |    2 +-
 xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c   |   20 +-
 xorg-server/hw/xfree86/os-support/bsd/bsd_init.c   |   24 +-
 .../hw/xfree86/os-support/bsd/bsd_kqueue_apm.c     |   16 +-
 xorg-server/hw/xfree86/os-support/bsd/i386_video.c |   22 +-
 xorg-server/hw/xfree86/os-support/bsd/ppc_video.c  |   20 +-
 .../hw/xfree86/os-support/bsd/sparc64_video.c      |   20 +-
 .../hw/xfree86/os-support/hurd/hurd_video.c        |    4 +-
 xorg-server/hw/xfree86/os-support/linux/lnx_agp.c  |    4 +-
 xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c |    2 +-
 .../hw/xfree86/os-support/linux/systemd-logind.c   |    2 +-
 xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c |    8 +-
 .../hw/xfree86/os-support/shared/ioperm_noop.c     |    2 +-
 xorg-server/hw/xfree86/os-support/shared/sigio.c   |    6 +-
 .../hw/xfree86/os-support/solaris/sun_apm.c        |    2 +-
 xorg-server/hw/xfree86/os-support/xf86_OSlib.h     |   30 +-
 xorg-server/hw/xfree86/os-support/xf86_OSproc.h    |   28 +-
 xorg-server/hw/xfree86/parser/Configint.h          |   18 +-
 xorg-server/hw/xfree86/parser/DRI.c                |    8 +-
 xorg-server/hw/xfree86/parser/Device.c             |   16 +-
 xorg-server/hw/xfree86/parser/Files.c              |   14 +-
 xorg-server/hw/xfree86/parser/Flags.c              |   16 +-
 xorg-server/hw/xfree86/parser/Input.c              |   16 +-
 xorg-server/hw/xfree86/parser/Layout.c             |   16 +-
 xorg-server/hw/xfree86/parser/Module.c             |   16 +-
 xorg-server/hw/xfree86/parser/Monitor.c            |   18 +-
 xorg-server/hw/xfree86/parser/Pointer.c            |   16 +-
 xorg-server/hw/xfree86/parser/Screen.c             |   16 +-
 xorg-server/hw/xfree86/parser/Vendor.c             |   16 +-
 xorg-server/hw/xfree86/parser/Video.c              |   16 +-
 xorg-server/hw/xfree86/parser/read.c               |   22 +-
 xorg-server/hw/xfree86/parser/scan.c               |   36 +-
 xorg-server/hw/xfree86/parser/write.c              |   14 +-
 xorg-server/hw/xfree86/parser/xf86Optrec.h         |   18 +-
 xorg-server/hw/xfree86/parser/xf86Parser.h         |   18 +-
 xorg-server/hw/xfree86/parser/xf86tokens.h         |   18 +-
 xorg-server/hw/xfree86/ramdac/IBM.c                |    4 +-
 xorg-server/hw/xfree86/ramdac/TI.c                 |    2 +-
 xorg-server/hw/xfree86/ramdac/xf86Cursor.c         |    6 +-
 xorg-server/hw/xfree86/ramdac/xf86HWCurs.c         |    2 +-
 xorg-server/hw/xfree86/ramdac/xf86RamDac.h         |    4 +-
 xorg-server/hw/xfree86/sdksyms.sh                  |    3 -
 xorg-server/hw/xfree86/shadowfb/shadowfb.h         |    2 +-
 xorg-server/hw/xfree86/utils/gtf/gtf.c             |   26 +-
 xorg-server/hw/xfree86/vbe/vbe.c                   |    4 +-
 xorg-server/hw/xfree86/vbe/vbe.h                   |    4 +-
 xorg-server/hw/xfree86/vgahw/vgaHW.c               |    8 +-
 xorg-server/hw/xfree86/vgahw/vgaHW.h               |    2 +-
 xorg-server/hw/xfree86/x86emu/debug.c              |    4 +-
 xorg-server/hw/xfree86/x86emu/ops.c                |   22 +-
 xorg-server/hw/xfree86/x86emu/prim_ops.c           |   70 +-
 xorg-server/hw/xfree86/x86emu/sys.c                |    6 +-
 xorg-server/hw/xfree86/x86emu/x86emu/regs.h        |   10 +-
 xorg-server/hw/xnest/Color.c                       |    2 +-
 xorg-server/hw/xnest/GC.c                          |   56 +-
 xorg-server/hw/xnest/XNGC.h                        |    1 -
 xorg-server/hw/xnest/Xnest.h                       |    2 +-
 xorg-server/hw/xquartz/darwin.c                    |    8 +-
 xorg-server/hw/xquartz/darwinEvents.c              |    4 +-
 xorg-server/hw/xwayland/xwayland.c                 |    1 +
 xorg-server/hw/xwin/InitInput.c                    |    2 +-
 xorg-server/hw/xwin/InitOutput.c                   |   10 +-
 xorg-server/hw/xwin/win.h                          |    2 +-
 xorg-server/hw/xwin/winSetAppUserModelID.c         |    2 +-
 xorg-server/hw/xwin/wincmap.c                      |    2 +-
 xorg-server/hw/xwin/winconfig.c                    |   10 +-
 xorg-server/hw/xwin/wincreatewnd.c                 |    4 +-
 xorg-server/hw/xwin/wincursor.c                    |   10 +-
 xorg-server/hw/xwin/windialogs.c                   |   12 +-
 xorg-server/hw/xwin/winlayouts.h                   |    2 +-
 xorg-server/hw/xwin/winmsgwindow.c                 |    5 +-
 xorg-server/hw/xwin/winmultiwindowicons.c          |    4 +-
 xorg-server/hw/xwin/winmultiwindowshape.c          |    2 +-
 xorg-server/hw/xwin/winmultiwindowwindow.c         |   20 +-
 xorg-server/hw/xwin/winmultiwindowwm.c             |    2 +-
 xorg-server/hw/xwin/winmultiwindowwndproc.c        |    4 +-
 xorg-server/hw/xwin/winprefs.c                     |    2 +-
 xorg-server/hw/xwin/winprefslex.l                  |    2 -
 xorg-server/hw/xwin/winprefsyacc.y                 |   11 +-
 xorg-server/hw/xwin/winscrinit.c                   |    4 +-
 xorg-server/hw/xwin/winshaddd.c                    |    8 +-
 xorg-server/hw/xwin/winshadddnl.c                  |    6 +-
 xorg-server/hw/xwin/winshadgdi.c                   |   10 +-
 xorg-server/hw/xwin/winwin32rootlesswndproc.c      |    2 +-
 xorg-server/hw/xwin/winwindowswm.c                 |    2 +-
 xorg-server/hw/xwin/winwndproc.c                   |    8 +-
 xorg-server/include/closure.h                      |    8 +-
 xorg-server/include/colormap.h                     |    8 +-
 xorg-server/include/colormapst.h                   |    8 +-
 xorg-server/include/cursor.h                       |    8 +-
 xorg-server/include/cursorstr.h                    |   10 +-
 xorg-server/include/dbus-core.h                    |    2 +-
 xorg-server/include/dix.h                          |    8 +-
 xorg-server/include/extension.h                    |    8 +-
 xorg-server/include/extnsionst.h                   |   10 +-
 xorg-server/include/gc.h                           |    8 +-
 xorg-server/include/gcstruct.h                     |   25 +-
 xorg-server/include/input.h                        |    8 +-
 xorg-server/include/inputstr.h                     |   14 +-
 xorg-server/include/list.h                         |    2 +-
 xorg-server/include/misc.h                         |   18 +-
 xorg-server/include/miscstruct.h                   |    8 +-
 xorg-server/include/os.h                           |    8 +-
 xorg-server/include/pixmap.h                       |    8 +-
 xorg-server/include/pixmapstr.h                    |   10 +-
 xorg-server/include/property.h                     |    8 +-
 xorg-server/include/propertyst.h                   |   10 +-
 xorg-server/include/region.h                       |    8 +-
 xorg-server/include/regionstr.h                    |    2 +-
 xorg-server/include/resource.h                     |   10 +-
 xorg-server/include/rgb.h                          |    8 +-
 xorg-server/include/screenint.h                    |    8 +-
 xorg-server/include/scrnintstr.h                   |    8 +-
 xorg-server/include/selection.h                    |   10 +-
 xorg-server/include/servermd.h                     |   10 +-
 xorg-server/include/site.h                         |   14 +-
 xorg-server/include/window.h                       |    8 +-
 xorg-server/include/windowstr.h                    |    8 +-
 xorg-server/include/xkbfile.h                      |   18 +-
 xorg-server/include/xkbsrv.h                       |   16 +-
 xorg-server/include/xkbstr.h                       |   24 +-
 xorg-server/include/xsha1.h                        |    2 +-
 xorg-server/mi/Makefile.am                         |   11 +-
 xorg-server/mi/mi.h                                |   24 +-
 xorg-server/mi/miarc.c                             |  244 ++-
 xorg-server/mi/mibitblt.c                          |   30 +-
 xorg-server/mi/micopy.c                            |    5 +-
 xorg-server/mi/micursor.c                          |   68 -
 xorg-server/mi/midash.c                            |    9 +-
 xorg-server/mi/midispcur.c                         |    4 +-
 xorg-server/mi/miexpose.c                          |   18 +-
 xorg-server/mi/mifillarc.c                         |    5 +-
 xorg-server/mi/mifillarc.h                         |    9 -
 xorg-server/mi/mifillrct.c                         |    8 +-
 xorg-server/mi/mifpoly.h                           |   50 +-
 xorg-server/mi/mifpolycon.c                        |  249 ---
 xorg-server/mi/migc.c                              |   45 +-
 xorg-server/mi/miglblt.c                           |    8 +-
 xorg-server/mi/miinitext.c                         |    8 +-
 xorg-server/mi/mioverlay.c                         |    2 +-
 xorg-server/mi/mipointer.c                         |   19 +
 xorg-server/mi/mipoly.c                            |  627 ++++++-
 xorg-server/mi/mipoly.h                            |   22 +-
 xorg-server/mi/mipolycon.c                         |  235 ---
 xorg-server/mi/mipolygen.c                         |  213 ---
 xorg-server/mi/mipolypnt.c                         |    8 +-
 xorg-server/mi/mipolyrect.c                        |    8 +-
 xorg-server/mi/mipolyseg.c                         |   10 +-
 xorg-server/mi/mipolytext.c                        |    8 +-
 xorg-server/mi/mipolyutil.c                        |  369 ----
 xorg-server/mi/mipushpxl.c                         |    8 +-
 xorg-server/mi/miscrinit.c                         |    2 +-
 xorg-server/mi/mispans.c                           |  526 ------
 xorg-server/mi/mispans.h                           |   87 -
 xorg-server/mi/mistruct.h                          |    8 +-
 xorg-server/mi/mivaltree.c                         |   20 +-
 xorg-server/mi/miwideline.c                        |  526 +++++-
 xorg-server/mi/miwideline.h                        |   26 -
 xorg-server/mi/miwindow.c                          |    8 +-
 xorg-server/mi/mizerclip.c                         |    8 +-
 xorg-server/mi/mizerline.c                         |   12 +-
 xorg-server/miext/damage/damage.c                  |    2 +-
 xorg-server/miext/rootless/rootless.h              |    2 +-
 xorg-server/miext/rootless/rootlessGC.c            |    2 +-
 xorg-server/miext/rootless/rootlessValTree.c       |   32 +-
 xorg-server/miext/rootless/rootlessWindow.c        |    6 +-
 xorg-server/miext/shadow/shrotate.c                |    2 +-
 xorg-server/miext/sync/misyncfd.c                  |    4 +-
 xorg-server/os/WaitFor.c                           |   18 +-
 xorg-server/os/access.c                            |   58 +-
 xorg-server/os/busfault.c                          |    2 +-
 xorg-server/os/connection.c                        |   18 +-
 xorg-server/os/io.c                                |   10 +-
 xorg-server/os/log.c                               |    2 +-
 xorg-server/os/oscolor.c                           |    8 +-
 xorg-server/os/osdep.h                             |    8 +-
 xorg-server/os/osinit.c                            |   14 +-
 xorg-server/os/xdmcp.c                             |    2 +-
 xorg-server/present/present.c                      |    8 +-
 xorg-server/randr/randrstr.h                       |   20 +-
 xorg-server/randr/rrprovider.c                     |    2 +-
 xorg-server/randr/rrtransform.c                    |    2 +-
 xorg-server/randr/rrtransform.h                    |    2 +-
 xorg-server/randr/rrxinerama.c                     |    2 +-
 xorg-server/record/record.c                        |   20 +-
 xorg-server/render/animcur.c                       |    2 +-
 xorg-server/render/glyph.c                         |    2 +-
 xorg-server/render/glyphstr.h                      |    2 +-
 xorg-server/render/mipict.h                        |    2 +-
 xorg-server/render/picture.c                       |    2 +-
 xorg-server/render/picture.h                       |    8 +-
 xorg-server/render/render.c                        |    4 +-
 xorg-server/xfixes/cursor.c                        |   22 +-
 xorg-server/xfixes/region.c                        |   13 +-
 xorg-server/xkb/XKBAlloc.c                         |   16 +-
 xorg-server/xkb/XKBGAlloc.c                        |   16 +-
 xorg-server/xkb/XKBMAlloc.c                        |   18 +-
 xorg-server/xkb/XKBMisc.c                          |   16 +-
 xorg-server/xkb/ddxBeep.c                          |   16 +-
 xorg-server/xkb/ddxCtrls.c                         |   16 +-
 xorg-server/xkb/ddxKillSrv.c                       |   16 +-
 xorg-server/xkb/ddxLEDs.c                          |   16 +-
 xorg-server/xkb/ddxLoad.c                          |   16 +-
 xorg-server/xkb/ddxVT.c                            |   16 +-
 xorg-server/xkb/maprules.c                         |   18 +-
 xorg-server/xkb/xkb.c                              |   18 +-
 xorg-server/xkb/xkbAccessX.c                       |   18 +-
 xorg-server/xkb/xkbActions.c                       |   16 +-
 xorg-server/xkb/xkbEvents.c                        |   16 +-
 xorg-server/xkb/xkbInit.c                          |   22 +-
 xorg-server/xkb/xkbLEDs.c                          |   44 +-
 xorg-server/xkb/xkbPrKeyEv.c                       |   16 +-
 xorg-server/xkb/xkbSwap.c                          |   16 +-
 xorg-server/xkb/xkbUtils.c                         |   16 +-
 xorg-server/xkb/xkbfmisc.c                         |   18 +-
 xorg-server/xkb/xkbgeom.h                          |   16 +-
 xorg-server/xkb/xkbout.c                           |   18 +-
 xorg-server/xkb/xkbtext.c                          |   18 +-
 xorg-server/xkb/xkmread.c                          |   18 +-
 xorg-server/xkeyboard-config/README                |   54 +-
 530 files changed, 13309 insertions(+), 8075 deletions(-)

diff --cc libxcb/src/c_client.py
index 27cae36,56a1766..b9f47db
mode 100755,100644..100755
--- a/libxcb/src/c_client.py
+++ b/libxcb/src/c_client.py
diff --cc mesalib/src/glsl/ir.cpp
index 5907854,fe5601a..f6aeb61
mode 100755,100644..100755
--- a/mesalib/src/glsl/ir.cpp
+++ b/mesalib/src/glsl/ir.cpp
diff --cc mesalib/src/mapi/glapi/gen/gl_API.xml
index 43e5d35,e1b1246..96146b7
mode 100755,100644..100755
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
diff --cc mesalib/src/mesa/drivers/dri/common/dri_util.c
index f18fac6,d6e875f..2892331
mode 100755,100644..100755
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
diff --cc mesalib/src/mesa/main/imports.h
index 725416d,0fcba4f..e984cfb
mode 100755,100644..100755
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
diff --cc mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcxproj
index 4b4c6bc,0000000..55ec5b2
mode 100644,000000..100644
--- a/mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcxproj
+++ b/mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcxproj
@@@ -1,303 -1,0 +1,301 @@@
 +<?xml version="1.0" encoding="utf-8"?>
 +<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +  <ItemGroup Label="ProjectConfigurations">
 +    <ProjectConfiguration Include="Debug|Win32">
 +      <Configuration>Debug</Configuration>
 +      <Platform>Win32</Platform>
 +    </ProjectConfiguration>
 +    <ProjectConfiguration Include="Debug|x64">
 +      <Configuration>Debug</Configuration>
 +      <Platform>x64</Platform>
 +    </ProjectConfiguration>
 +    <ProjectConfiguration Include="Release|Win32">
 +      <Configuration>Release</Configuration>
 +      <Platform>Win32</Platform>
 +    </ProjectConfiguration>
 +    <ProjectConfiguration Include="Release|x64">
 +      <Configuration>Release</Configuration>
 +      <Platform>x64</Platform>
 +    </ProjectConfiguration>
 +  </ItemGroup>
 +  <PropertyGroup Label="Globals">
 +    <ProjectGuid>{98AB3D51-1820-4D14-9195-75FCA6997784}</ProjectGuid>
 +    <RootNamespace>glsl_apps_compile</RootNamespace>
 +    <Keyword>Win32Proj</Keyword>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
 +    <ConfigurationType>Application</ConfigurationType>
 +    <CharacterSet>MultiByte</CharacterSet>
 +    <WholeProgramOptimization>true</WholeProgramOptimization>
 +    <PlatformToolset>v120</PlatformToolset>
 +  </PropertyGroup>
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
 +    <ConfigurationType>Application</ConfigurationType>
 +    <CharacterSet>MultiByte</CharacterSet>
 +    <WholeProgramOptimization>true</WholeProgramOptimization>
 +    <PlatformToolset>v120</PlatformToolset>
 +  </PropertyGroup>
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
 +    <ConfigurationType>Application</ConfigurationType>
 +    <CharacterSet>MultiByte</CharacterSet>
 +    <PlatformToolset>v120</PlatformToolset>
 +  </PropertyGroup>
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
 +    <ConfigurationType>Application</ConfigurationType>
 +    <CharacterSet>MultiByte</CharacterSet>
 +    <PlatformToolset>v120</PlatformToolset>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
 +  <ImportGroup Label="ExtensionSettings">
 +  </ImportGroup>
 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 +  </ImportGroup>
 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 +  </ImportGroup>
 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 +  </ImportGroup>
 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 +  </ImportGroup>
 +  <PropertyGroup Label="UserMacros" />
 +  <PropertyGroup>
 +    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
 +    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
 +    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
 +    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
 +    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
 +    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">compile</TargetName>
 +    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">compile</TargetName>
 +    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">compile</TargetName>
 +    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">compile</TargetName>
 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
 +  </PropertyGroup>
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 +    <ClCompile>
 +      <Optimization>Disabled</Optimization>
 +      <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;INSERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <MinimalRebuild>true</MinimalRebuild>
 +      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
 +      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
 +      <PrecompiledHeader>
 +      </PrecompiledHeader>
 +      <WarningLevel>Level3</WarningLevel>
 +      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
 +      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\src\mesa;..\..\..\..\src\glsl;..\..\..\..\src\mapi;..\..\..\..\..\include;..\..\..\..\..;..\..\..\..\src</AdditionalIncludeDirectories>
 +    </ClCompile>
 +    <Link>
 +      <GenerateDebugInformation>true</GenerateDebugInformation>
 +      <SubSystem>Console</SubSystem>
 +      <RandomizedBaseAddress>false</RandomizedBaseAddress>
 +      <DataExecutionPrevention>
 +      </DataExecutionPrevention>
 +      <TargetMachine>MachineX86</TargetMachine>
 +    </Link>
 +  </ItemDefinitionGroup>
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
 +    <ClCompile>
 +      <Optimization>Disabled</Optimization>
 +      <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;INSERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
 +      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
 +      <PrecompiledHeader>
 +      </PrecompiledHeader>
 +      <WarningLevel>Level3</WarningLevel>
 +      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
 +      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\src\mesa;..\..\..\..\src\glsl;..\..\..\..\src\mapi;..\..\..\..\..\include;..\..\..\..\..;..\..\..\..\src</AdditionalIncludeDirectories>
 +    </ClCompile>
 +    <Link>
 +      <GenerateDebugInformation>true</GenerateDebugInformation>
 +      <SubSystem>Console</SubSystem>
 +      <RandomizedBaseAddress>false</RandomizedBaseAddress>
 +      <DataExecutionPrevention>
 +      </DataExecutionPrevention>
 +    </Link>
 +  </ItemDefinitionGroup>
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 +    <ClCompile>
 +      <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;INSERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
 +      <PrecompiledHeader>
 +      </PrecompiledHeader>
 +      <WarningLevel>Level3</WarningLevel>
 +      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
 +      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\src\mesa;..\..\..\..\src\glsl;..\..\..\..\src\mapi;..\..\..\..\..\include;..\..\..\..\..;..\..\..\..\src</AdditionalIncludeDirectories>
 +    </ClCompile>
 +    <Link>
 +      <GenerateDebugInformation>true</GenerateDebugInformation>
 +      <SubSystem>Console</SubSystem>
 +      <OptimizeReferences>true</OptimizeReferences>
 +      <EnableCOMDATFolding>true</EnableCOMDATFolding>
 +      <RandomizedBaseAddress>false</RandomizedBaseAddress>
 +      <DataExecutionPrevention>
 +      </DataExecutionPrevention>
 +      <TargetMachine>MachineX86</TargetMachine>
 +    </Link>
 +  </ItemDefinitionGroup>
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
 +    <ClCompile>
 +      <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;INSERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
 +      <PrecompiledHeader>
 +      </PrecompiledHeader>
 +      <WarningLevel>Level3</WarningLevel>
 +      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
 +      <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\src\mesa;..\..\..\..\src\glsl;..\..\..\..\src\mapi;..\..\..\..\..\include;..\..\..\..\..;..\..\..\..\src</AdditionalIncludeDirectories>
 +    </ClCompile>
 +    <Link>
 +      <GenerateDebugInformation>true</GenerateDebugInformation>
 +      <SubSystem>Console</SubSystem>
 +      <OptimizeReferences>true</OptimizeReferences>
 +      <EnableCOMDATFolding>true</EnableCOMDATFolding>
 +      <RandomizedBaseAddress>false</RandomizedBaseAddress>
 +      <DataExecutionPrevention>
 +      </DataExecutionPrevention>
 +    </Link>
 +  </ItemDefinitionGroup>
 +  <ItemGroup>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_array_index.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_expr.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_function.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_to_hir.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_type.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_functions.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_types.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\getopt.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\glcpp-lex.c" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\glcpp-parse.c" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\pp.c" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_lexer.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_parser.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_parser_extras.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_symbol_table.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_types.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\hir_field_selection.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_basic_block.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_builder.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_clone.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_constant_expression.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_equals.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_expression_flattening.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function_can_inline.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function_detect_recursion.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_hierarchical_visitor.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_hv_accept.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_import_prototypes.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_print_visitor.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_reader.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_rvalue_visitor.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_set_program_inouts.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_validate.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_variables.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_variable_refcount.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\linker.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_atomics.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_functions.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_interface_blocks.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniforms.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_blocks.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_block_active_visitor.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_initializers.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_varyings.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_analysis.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_controls.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_unroll.cpp" />
++    <ClCompile Include="..\..\..\..\src\glsl\lower_const_arrays_to_uniforms.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_discard.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_discard_flow.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_if_to_cond_assign.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_instructions.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_jumps.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_clip_distance.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_mat_op_to_vec.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_named_interface_blocks.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_noise.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_packed_varyings.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_texture_projection.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_variable_index_to_cond_assign.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vector.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vector_insert.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vec_index_to_cond_assign.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vec_index_to_swizzle.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vertex_id.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\main.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_algebraic.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_array_splitting.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_folding.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_propagation.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_variable.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_copy_propagation.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_copy_propagation_elements.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_cse.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_builtin_variables.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_builtin_varyings.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_code.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_code_local.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_functions.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_flatten_nested_if_blocks.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_flip_matrices.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_function_inlining.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_if_simplification.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_minmax.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_noop_swizzle.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_rebalance_tree.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_redundant_jumps.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_structure_splitting.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_swizzle_swizzle.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_tree_grafting.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_vectorize.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\standalone_scaffolding.cpp" />
-     <ClCompile Include="..\..\..\..\src\glsl\strtod.c" />
 +    <ClCompile Include="..\..\..\..\src\glsl\s_expression.cpp" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\imports.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_hash_table.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\symbol_table.c" />
 +    <ClCompile Include="..\..\..\..\src\util\hash_table.c" />
 +    <ClCompile Include="..\..\..\..\src\util\ralloc.c" />
-   </ItemGroup>
-   <ItemGroup>
-     <ClInclude Include="..\..\..\..\src\glsl\strtod.h" />
++    <ClCompile Include="..\..\..\..\src\util\strtod.cpp" />
 +  </ItemGroup>
 +  <ItemGroup>
 +    <CustomBuild Include="..\..\..\..\src\glsl\glsl_lexer.ll">
 +      <FileType>Document</FileType>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\glsl\doflexbison.bat</Command>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\glsl\doflexbison.bat</Command>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\glsl\glsl_lexer.cpp;..\..\..\..\src\glsl\glcpp\glcpp-lex.c;..\..\..\..\src\glsl\glsl_parser.cpp;..\..\..\..\src\glsl\glsl_parser.h;..\..\..\..\src\glsl\glcpp\glcpp-parse.c;..\..\..\..\src\glsl\glcpp\glcpp-parse.h</Outputs>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\glsl\glsl_lexer.cpp;..\..\..\..\src\glsl\glcpp\glcpp-lex.c;..\..\..\..\src\glsl\glsl_parser.cpp;..\..\..\..\src\glsl\glsl_parser.h;..\..\..\..\src\glsl\glcpp\glcpp-parse.c;..\..\..\..\src\glsl\glcpp\glcpp-parse.h</Outputs>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\glsl\doflexbison.bat</Command>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\glsl\doflexbison.bat</Command>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\glsl\glsl_lexer.cpp;..\..\..\..\src\glsl\glcpp\glcpp-lex.c;..\..\..\..\src\glsl\glsl_parser.cpp;..\..\..\..\src\glsl\glsl_parser.h;..\..\..\..\src\glsl\glcpp\glcpp-parse.c;..\..\..\..\src\glsl\glcpp\glcpp-parse.h</Outputs>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\glsl\glsl_lexer.cpp;..\..\..\..\src\glsl\glcpp\glcpp-lex.c;..\..\..\..\src\glsl\glsl_parser.cpp;..\..\..\..\src\glsl\glsl_parser.h;..\..\..\..\src\glsl\glcpp\glcpp-parse.c;..\..\..\..\src\glsl\glcpp\glcpp-parse.h</Outputs>
 +      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\glsl\glsl_parser.yy;%(AdditionalInputs)</AdditionalInputs>
 +      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\glsl\glsl_parser.yy;%(AdditionalInputs)</AdditionalInputs>
 +      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\glsl\glsl_parser.yy;%(AdditionalInputs)</AdditionalInputs>
 +      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\glsl\glsl_parser.yy;%(AdditionalInputs)</AdditionalInputs>
 +    </CustomBuild>
 +    <None Include="..\..\..\..\src\glsl\glsl_parser.yy">
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\glsl\dobison.bat</Command>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\glsl\dobison.bat</Command>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\glsl\glsl_parser.cpp;..\..\..\..\src\glsl\glsl_parser.h;..\..\..\..\src\glsl\glcpp\glcpp-parse.c;..\..\..\..\src\glsl\glcpp\glcpp-parse.h</Outputs>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\glsl\glsl_parser.cpp;..\..\..\..\src\glsl\glsl_parser.h;..\..\..\..\src\glsl\glcpp\glcpp-parse.c;..\..\..\..\src\glsl\glcpp\glcpp-parse.h</Outputs>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\glsl\dobison.bat</Command>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\glsl\dobison.bat</Command>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\glsl\glsl_parser.cpp;..\..\..\..\src\glsl\glsl_parser.h;..\..\..\..\src\glsl\glcpp\glcpp-parse.c;..\..\..\..\src\glsl\glcpp\glcpp-parse.h</Outputs>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\glsl\glsl_parser.cpp;..\..\..\..\src\glsl\glsl_parser.h;..\..\..\..\src\glsl\glcpp\glcpp-parse.c;..\..\..\..\src\glsl\glcpp\glcpp-parse.h</Outputs>
 +      <FileType>Document</FileType>
 +    </None>
 +  </ItemGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 +  <ImportGroup Label="ExtensionTargets">
 +  </ImportGroup>
 +</Project>
diff --cc mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcxproj.filters
index 1f603e9,0000000..bbf3c6d
mode 100644,000000..100644
--- a/mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcxproj.filters
+++ b/mesalib/windows/VC8/mesa/glsl_apps_compile/glsl_apps_compile.vcxproj.filters
@@@ -1,334 -1,0 +1,332 @@@
 +<?xml version="1.0" encoding="utf-8"?>
 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +  <ItemGroup>
 +    <Filter Include="Source Files">
 +      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
 +      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
 +    </Filter>
 +    <Filter Include="Header Files">
 +      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
 +      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
 +    </Filter>
 +    <Filter Include="Resource Files">
 +      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
 +      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
 +    </Filter>
 +  </ItemGroup>
 +  <ItemGroup>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_expr.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_function.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_to_hir.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_type.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_lexer.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_parser.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_parser_extras.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_symbol_table.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_types.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\hir_field_selection.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_basic_block.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_clone.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_constant_expression.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_expression_flattening.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function_can_inline.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function_detect_recursion.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_hierarchical_visitor.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_hv_accept.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_import_prototypes.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_print_visitor.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_reader.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_rvalue_visitor.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_set_program_inouts.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_validate.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_variables.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_variable_refcount.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_functions.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniforms.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\linker.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_analysis.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_controls.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_unroll.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_noise.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_variable_index_to_cond_assign.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\main.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_redundant_jumps.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\s_expression.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\symbol_table.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\pp.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\glcpp-lex.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\glcpp-parse.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\getopt.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vec_index_to_swizzle.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_folding.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_structure_splitting.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_variable.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_algebraic.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_if_simplification.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_instructions.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_code_local.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vec_index_to_cond_assign.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_function_inlining.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_texture_projection.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_functions.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vector.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
-     <ClCompile Include="..\..\..\..\src\glsl\strtod.c">
-       <Filter>Source Files</Filter>
-     </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_copy_propagation.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_code.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_discard.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_mat_op_to_vec.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_tree_grafting.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\standalone_scaffolding.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_noop_swizzle.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_jumps.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_clip_distance.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_propagation.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_if_to_cond_assign.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_swizzle_swizzle.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_copy_propagation_elements.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_array_splitting.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_builder.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_discard_flow.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_initializers.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_hash_table.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_packed_varyings.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_varyings.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_blocks.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\imports.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_block_active_visitor.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_flatten_nested_if_blocks.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_array_index.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vector_insert.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_flip_matrices.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_named_interface_blocks.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_interface_blocks.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_types.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_builtin_varyings.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_functions.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_cse.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_atomics.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_equals.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_vectorize.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_rebalance_tree.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\util\hash_table.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\util\ralloc.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vertex_id.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_builtin_variables.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_minmax.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
-   </ItemGroup>
-   <ItemGroup>
-     <ClInclude Include="..\..\..\..\src\glsl\strtod.h">
++    <ClCompile Include="..\..\..\..\src\util\strtod.cpp">
 +      <Filter>Source Files</Filter>
-     </ClInclude>
++    </ClCompile>
++    <ClCompile Include="..\..\..\..\src\glsl\lower_const_arrays_to_uniforms.cpp">
++      <Filter>Source Files</Filter>
++    </ClCompile>
 +  </ItemGroup>
 +  <ItemGroup>
 +    <CustomBuild Include="..\..\..\..\src\glsl\glsl_lexer.ll">
 +      <Filter>Source Files</Filter>
 +    </CustomBuild>
 +  </ItemGroup>
 +  <ItemGroup>
 +    <None Include="..\..\..\..\src\glsl\glsl_parser.yy">
 +      <Filter>Source Files</Filter>
 +    </None>
 +  </ItemGroup>
 +</Project>
diff --cc mesalib/windows/VC8/mesa/mesa/mesa.vcxproj
index 6b0694a,0000000..1a5af42
mode 100644,000000..100644
--- a/mesalib/windows/VC8/mesa/mesa/mesa.vcxproj
+++ b/mesalib/windows/VC8/mesa/mesa/mesa.vcxproj
@@@ -1,513 -1,0 +1,511 @@@
 +<?xml version="1.0" encoding="utf-8"?>
 +<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +  <ItemGroup Label="ProjectConfigurations">
 +    <ProjectConfiguration Include="Debug|Win32">
 +      <Configuration>Debug</Configuration>
 +      <Platform>Win32</Platform>
 +    </ProjectConfiguration>
 +    <ProjectConfiguration Include="Debug|x64">
 +      <Configuration>Debug</Configuration>
 +      <Platform>x64</Platform>
 +    </ProjectConfiguration>
 +    <ProjectConfiguration Include="Release|Win32">
 +      <Configuration>Release</Configuration>
 +      <Platform>Win32</Platform>
 +    </ProjectConfiguration>
 +    <ProjectConfiguration Include="Release|x64">
 +      <Configuration>Release</Configuration>
 +      <Platform>x64</Platform>
 +    </ProjectConfiguration>
 +  </ItemGroup>
 +  <PropertyGroup Label="Globals">
 +    <ProjectGuid>{2120C974-2717-4709-B44F-D6E6D0A56448}</ProjectGuid>
 +    <RootNamespace>mesa</RootNamespace>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
 +    <ConfigurationType>StaticLibrary</ConfigurationType>
 +    <UseOfMfc>false</UseOfMfc>
 +    <CharacterSet>MultiByte</CharacterSet>
 +    <PlatformToolset>v120</PlatformToolset>
 +  </PropertyGroup>
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
 +    <ConfigurationType>StaticLibrary</ConfigurationType>
 +    <UseOfMfc>false</UseOfMfc>
 +    <CharacterSet>MultiByte</CharacterSet>
 +    <PlatformToolset>v120</PlatformToolset>
 +  </PropertyGroup>
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
 +    <ConfigurationType>StaticLibrary</ConfigurationType>
 +    <UseOfMfc>false</UseOfMfc>
 +    <CharacterSet>MultiByte</CharacterSet>
 +    <PlatformToolset>v120</PlatformToolset>
 +  </PropertyGroup>
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
 +    <ConfigurationType>StaticLibrary</ConfigurationType>
 +    <UseOfMfc>false</UseOfMfc>
 +    <CharacterSet>MultiByte</CharacterSet>
 +    <PlatformToolset>v120</PlatformToolset>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
 +  <ImportGroup Label="ExtensionSettings">
 +  </ImportGroup>
 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 +    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
 +  </ImportGroup>
 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 +    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
 +  </ImportGroup>
 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 +    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
 +  </ImportGroup>
 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 +    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
 +  </ImportGroup>
 +  <PropertyGroup Label="UserMacros" />
 +  <PropertyGroup>
 +    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
 +    <PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreBuildEventUseInBuild>
 +    <PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PreBuildEventUseInBuild>
 +    <PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</PreLinkEventUseInBuild>
 +    <PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</PreLinkEventUseInBuild>
 +    <PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</PostBuildEventUseInBuild>
 +    <PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</PostBuildEventUseInBuild>
 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
 +  </PropertyGroup>
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 +    <ClCompile>
 +      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
 +      <OmitFramePointers>true</OmitFramePointers>
 +      <WholeProgramOptimization>true</WholeProgramOptimization>
 +      <AdditionalIncludeDirectories>../../../../include;../../../../src/mesa;../../../../src/glsl;../../../../src/mapi;../../../../src/mesa/main;../../../../src/mesa/shader;../../../../src/mesa/shader/slang;../../../../../include;../../../../..;../../../../src/gallium/auxiliary;../../../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 +      <PreprocessorDefinitions>NDEBUG;WIN32;_LIB;_DLL;_GDI32_;BUILD_GL32;WIN32_THREADS;MESA_MINWARN;_CRT_SECURE_NO_DEPRECATE;INSERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <StringPooling>true</StringPooling>
 +      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
 +      <FunctionLevelLinking>true</FunctionLevelLinking>
 +      <PrecompiledHeader>
 +      </PrecompiledHeader>
 +      <WarningLevel>Level3</WarningLevel>
 +      <SuppressStartupBanner>true</SuppressStartupBanner>
 +      <ForcedIncludeFiles>../../../../src/mesa/main/compiler.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
 +      <BufferSecurityCheck>false</BufferSecurityCheck>
 +      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
 +    </ClCompile>
 +    <ResourceCompile>
 +      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <Culture>0x0409</Culture>
 +    </ResourceCompile>
 +    <Lib>
 +      <SuppressStartupBanner>true</SuppressStartupBanner>
 +      <LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
 +    </Lib>
 +  </ItemDefinitionGroup>
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
 +    <ClCompile>
 +      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
 +      <OmitFramePointers>true</OmitFramePointers>
 +      <WholeProgramOptimization>true</WholeProgramOptimization>
 +      <AdditionalIncludeDirectories>../../../../include;../../../../src/mesa;../../../../src/glsl;../../../../src/mapi;../../../../src/mesa/main;../../../../src/mesa/shader;../../../../src/mesa/shader/slang;../../../../../include;../../../../..;../../../../src/gallium/auxiliary;../../../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 +      <PreprocessorDefinitions>NDEBUG;WIN32;_LIB;_DLL;_GDI32_;BUILD_GL32;WIN32_THREADS;MESA_MINWARN;_CRT_SECURE_NO_DEPRECATE;INSERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <StringPooling>true</StringPooling>
 +      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
 +      <FunctionLevelLinking>true</FunctionLevelLinking>
 +      <PrecompiledHeader>
 +      </PrecompiledHeader>
 +      <WarningLevel>Level3</WarningLevel>
 +      <SuppressStartupBanner>true</SuppressStartupBanner>
 +      <ForcedIncludeFiles>../../../../src/mesa/main/compiler.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
 +      <BufferSecurityCheck>false</BufferSecurityCheck>
 +      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
 +    </ClCompile>
 +    <ResourceCompile>
 +      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <Culture>0x0409</Culture>
 +    </ResourceCompile>
 +    <Lib>
 +      <SuppressStartupBanner>true</SuppressStartupBanner>
 +      <LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
 +    </Lib>
 +  </ItemDefinitionGroup>
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 +    <ClCompile>
 +      <Optimization>Disabled</Optimization>
 +      <AdditionalIncludeDirectories>../../../../include;../../../../src/mesa;../../../../src/glsl;../../../../src/mapi;../../../../src/mesa/main;../../../../src/mesa/shader;../../../../src/mesa/shader/slang;../../../../../include;../../../../..;../../../../src/gallium/auxiliary;../../../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 +      <PreprocessorDefinitions>_DEBUG;DEBUG;WIN32;_LIB;_DLL;_GDI32_;BUILD_GL32;WIN32_THREADS;MESA_MINWARN;_CRT_SECURE_NO_DEPRECATE;INSERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
 +      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
 +      <BrowseInformation>true</BrowseInformation>
 +      <WarningLevel>Level3</WarningLevel>
 +      <SuppressStartupBanner>true</SuppressStartupBanner>
 +      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
 +      <ForcedIncludeFiles>../../../../src/mesa/main/compiler.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
 +    </ClCompile>
 +    <ResourceCompile>
 +      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <Culture>0x0409</Culture>
 +    </ResourceCompile>
 +    <Lib>
 +      <SuppressStartupBanner>true</SuppressStartupBanner>
 +    </Lib>
 +  </ItemDefinitionGroup>
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
 +    <ClCompile>
 +      <Optimization>Disabled</Optimization>
 +      <AdditionalIncludeDirectories>../../../../include;../../../../src/mesa;../../../../src/glsl;../../../../src/mapi;../../../../src/mesa/main;../../../../src/mesa/shader;../../../../src/mesa/shader/slang;../../../../../include;../../../../..;../../../../src/gallium/auxiliary;../../../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 +      <PreprocessorDefinitions>_DEBUG;DEBUG;WIN32;_LIB;_DLL;_GDI32_;BUILD_GL32;WIN32_THREADS;MESA_MINWARN;_CRT_SECURE_NO_DEPRECATE;INSERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
 +      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
 +      <BrowseInformation>true</BrowseInformation>
 +      <WarningLevel>Level3</WarningLevel>
 +      <SuppressStartupBanner>true</SuppressStartupBanner>
 +      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
 +      <ForcedIncludeFiles>../../../../src/mesa/main/compiler.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
 +    </ClCompile>
 +    <ResourceCompile>
 +      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 +      <Culture>0x0409</Culture>
 +    </ResourceCompile>
 +    <Lib>
 +      <SuppressStartupBanner>true</SuppressStartupBanner>
 +    </Lib>
 +  </ItemDefinitionGroup>
 +  <ItemGroup>
 +    <ProjectReference Include="..\glsl_apps_compile\glsl_apps_compile.vcxproj">
 +      <Project>{98ab3d51-1820-4d14-9195-75fca6997784}</Project>
 +      <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
 +      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
 +    </ProjectReference>
 +  </ItemGroup>
 +  <ItemGroup>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_array_index.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_expr.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_function.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_to_hir.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_type.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_functions.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_types.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\glcpp-lex.c" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\glcpp-parse.c" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\pp.c" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_lexer.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_parser.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_parser_extras.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_symbol_table.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_types.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\hir_field_selection.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_basic_block.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_builder.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_clone.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_constant_expression.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_equals.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_expression_flattening.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function_can_inline.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function_detect_recursion.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_hierarchical_visitor.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_hv_accept.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_import_prototypes.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_print_visitor.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_reader.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_rvalue_visitor.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_set_program_inouts.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_validate.cpp">
 +      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 +      </ForcedIncludeFiles>
 +      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
 +      </ForcedIncludeFiles>
 +      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 +      </ForcedIncludeFiles>
 +      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
 +      </ForcedIncludeFiles>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_variables.cpp">
 +      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 +      </ForcedIncludeFiles>
 +      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
 +      </ForcedIncludeFiles>
 +      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 +      </ForcedIncludeFiles>
 +      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
 +      </ForcedIncludeFiles>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_variable_refcount.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\linker.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_atomics.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_functions.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_interface_blocks.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniforms.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_blocks.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_block_active_visitor.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_initializers.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\link_varyings.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_analysis.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_controls.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_unroll.cpp" />
++    <ClCompile Include="..\..\..\..\src\glsl\lower_const_arrays_to_uniforms.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_discard.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_discard_flow.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_if_to_cond_assign.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_instructions.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_jumps.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_clip_distance.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_mat_op_to_vec.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_named_interface_blocks.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_noise.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_packed_varyings.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_texture_projection.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_variable_index_to_cond_assign.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vector.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vector_insert.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vec_index_to_cond_assign.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vec_index_to_swizzle.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vertex_id.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_algebraic.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_array_splitting.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_folding.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_propagation.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_variable.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_copy_propagation.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_copy_propagation_elements.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_cse.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_builtin_variables.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_builtin_varyings.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_code.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_code_local.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_functions.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_flatten_nested_if_blocks.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_flip_matrices.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_function_inlining.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_if_simplification.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_minmax.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_noop_swizzle.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_rebalance_tree.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_redundant_jumps.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_structure_splitting.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_swizzle_swizzle.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_tree_grafting.cpp" />
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_vectorize.cpp" />
-     <ClCompile Include="..\..\..\..\src\glsl\strtod.c" />
 +    <ClCompile Include="..\..\..\..\src\glsl\s_expression.cpp" />
 +    <ClCompile Include="..\..\..\..\src\mesa\drivers\common\meta_blit.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\accum.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\api_arrayelt.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\api_exec.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\api_loopback.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\api_validate.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\arbprogram.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\atifragshader.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\blit.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\compute.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\copyimage.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\drawtex.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\errors.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\es1_conversion.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\formatquery.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\format_pack.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\format_utils.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\genmipmap.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\glformats.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\objectlabel.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pack.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\performance_monitor.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pipelineobj.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pixeltransfer.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\querymatrix.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\remap.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\set.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shaderapi.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shaderimage.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shaderobj.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shader_query.cpp" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_bptc.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_cpal.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texstorage.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\textureview.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\uniform_query.cpp" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\transformfeedback.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\uniforms.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\vdpau.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\arbprogparse.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\arrayobj.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\attrib.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\blend.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\bufferobj.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\buffers.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\ff_fragment_shader.cpp" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\clear.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\clip.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\colortab.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\condrender.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\context.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\convolve.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\cpuinfo.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\debug.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\depth.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\dlist.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\drawpix.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\enable.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\enums.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\eval.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\execmem.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\extensions.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texturebarrier.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\fbobject.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\feedback.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\ffvertex_prog.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\fog.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\formats.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\format_unpack.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\framebuffer.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\get.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\getstring.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\hash.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\ir_to_mesa.cpp" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_hash_table.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\string_to_uint_map.cpp" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\lex.yy.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\program.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\programopt.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\program_parse.tab.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\program_parse_extra.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_cache.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_execute.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_instruction.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_noise.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_optimize.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_opt_constant_fold.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_parameter.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_parameter_layout.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_print.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_statevars.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\sampler.cpp" />
 +    <ClCompile Include="..\..\..\..\src\mesa\program\symbol_table.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\hint.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\histogram.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\image.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\imports.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\light.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\lines.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_eval.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_matrix.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_translate.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_vector.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_xform.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\matrix.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\mipmap.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\mm.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\multisample.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pbo.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pixel.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pixelstore.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\points.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\polygon.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\queryobj.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\rastpos.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\readpix.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\renderbuffer.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\scissor.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shared.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\state.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\stencil.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\syncobj.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_context.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_draw.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_pipeline.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_rasterpos.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_fog.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_light.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_normals.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_points.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_program.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_render.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_texgen.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_texmat.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_vertex.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vertex.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vertex_generic.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vp_build.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_fxt1.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_rgtc.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_s3tc.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_etc.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texenv.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\samplerobj.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texformat.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texgen.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texgetimage.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\teximage.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texobj.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texparam.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texstate.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texstore.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\varray.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_noop.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_context.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec_api.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec_array.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec_draw.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec_eval.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_primitive_restart.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_rebase.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_save.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_save_api.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_save_draw.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_save_loopback.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_split.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_split_copy.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_split_inplace.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\version.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\viewport.c" />
 +    <ClCompile Include="..\..\..\..\src\mesa\main\vtxfmt.c" />
 +    <ClCompile Include="..\..\..\..\src\util\format_srgb.c" />
 +    <ClCompile Include="..\..\..\..\src\util\hash_table.c" />
 +    <ClCompile Include="..\..\..\..\src\util\ralloc.c" />
 +    <ClCompile Include="..\..\..\..\src\util\rgtc.c" />
-   </ItemGroup>
-   <ItemGroup>
-     <ClInclude Include="..\..\..\..\src\glsl\strtod.h" />
++    <ClCompile Include="..\..\..\..\src\util\strtod.cpp" />
 +  </ItemGroup>
 +  <ItemGroup>
 +    <CustomBuild Include="..\..\..\..\src\mesa\program\program_lexer.l">
 +      <FileType>Document</FileType>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\mesa\program\doflexbison.bat</Command>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\mesa\program\doflexbison.bat</Command>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\mesa\program\lex.yy.c;..\..\..\..\src\mesa\program\program_parse.tab.c;..\..\..\..\src\mesa\program\program_parse.tab.h;%(Outputs)</Outputs>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\mesa\program\lex.yy.c;..\..\..\..\src\mesa\program\program_parse.tab.c;..\..\..\..\src\mesa\program\program_parse.tab.h;%(Outputs)</Outputs>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\mesa\program\doflexbison.bat</Command>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\mesa\program\doflexbison.bat</Command>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\mesa\program\lex.yy.c;..\..\..\..\src\mesa\program\program_parse.tab.c;..\..\..\..\src\mesa\program\program_parse.tab.h;%(Outputs)</Outputs>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\mesa\program\lex.yy.c;..\..\..\..\src\mesa\program\program_parse.tab.c;..\..\..\..\src\mesa\program\program_parse.tab.h;%(Outputs)</Outputs>
 +      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\mesa\program\program_parse.y;%(AdditionalInputs)</AdditionalInputs>
 +      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\mesa\program\program_parse.y;%(AdditionalInputs)</AdditionalInputs>
 +      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\mesa\program\program_parse.y;%(AdditionalInputs)</AdditionalInputs>
 +      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\mesa\program\program_parse.y;%(AdditionalInputs)</AdditionalInputs>
 +    </CustomBuild>
 +    <None Include="..\..\..\..\src\mesa\program\program_parse.y">
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\mesa\program\dobison.bat</Command>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\mesa\program\dobison.bat</Command>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\src\mesa\program\program_parse.tab.c;..\..\..\..\src\mesa\program\program_parse.tab.h;%(Outputs)</Outputs>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\src\mesa\program\program_parse.tab.c;..\..\..\..\src\mesa\program\program_parse.tab.h;%(Outputs)</Outputs>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\mesa\program\dobison.bat</Command>
 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\mesa\program\dobison.bat</Command>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\src\mesa\program\program_parse.tab.c;..\..\..\..\src\mesa\program\program_parse.tab.h;%(Outputs)</Outputs>
 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\src\mesa\program\program_parse.tab.c;..\..\..\..\src\mesa\program\program_parse.tab.h;%(Outputs)</Outputs>
 +      <FileType>Document</FileType>
 +    </None>
 +  </ItemGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 +  <ImportGroup Label="ExtensionTargets">
 +  </ImportGroup>
 +</Project>
diff --cc mesalib/windows/VC8/mesa/mesa/mesa.vcxproj.filters
index fdd8481,0000000..68199cc
mode 100644,000000..100644
--- a/mesalib/windows/VC8/mesa/mesa/mesa.vcxproj.filters
+++ b/mesalib/windows/VC8/mesa/mesa/mesa.vcxproj.filters
@@@ -1,837 -1,0 +1,835 @@@
 +<?xml version="1.0" encoding="utf-8"?>
 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +  <ItemGroup>
 +    <Filter Include="Source Files">
 +      <UniqueIdentifier>{8411a2f0-9621-4bb9-9aec-30713df37794}</UniqueIdentifier>
 +      <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
 +    </Filter>
 +    <Filter Include="Header Files">
 +      <UniqueIdentifier>{82940400-de84-4aa3-8c90-a68fc32ae059}</UniqueIdentifier>
 +      <Extensions>h;hpp;hxx;hm;inl</Extensions>
 +    </Filter>
 +  </ItemGroup>
 +  <ItemGroup>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\api_arrayelt.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\api_exec.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\api_loopback.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\api_validate.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\arrayobj.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\attrib.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\blend.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\bufferobj.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\ff_fragment_shader.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\buffers.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\clear.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\clip.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\colortab.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\condrender.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\context.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\convolve.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\cpuinfo.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\debug.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\depth.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\dlist.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\drawpix.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\enable.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\enums.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\eval.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\execmem.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\extensions.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texturebarrier.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\fbobject.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\feedback.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\ffvertex_prog.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\fog.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\formats.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\format_unpack.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\framebuffer.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\get.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\getstring.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\hash.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\hint.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\histogram.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\image.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\imports.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\light.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\lines.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_eval.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_matrix.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_translate.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_vector.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\math\m_xform.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\matrix.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\mipmap.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\mm.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\multisample.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pixel.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pixelstore.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\points.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\polygon.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\queryobj.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\rastpos.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\readpix.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\renderbuffer.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\scissor.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shared.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\state.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\stencil.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\syncobj.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_context.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_draw.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_pipeline.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_rasterpos.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_fog.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_light.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_normals.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_points.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_program.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_render.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_texgen.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_texmat.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vb_vertex.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vertex.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vertex_generic.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\tnl\t_vp_build.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_fxt1.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_s3tc.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_etc.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texenv.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\samplerobj.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texformat.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texgen.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texgetimage.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\teximage.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texobj.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texparam.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texstate.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texstore.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\varray.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_noop.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_context.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec_api.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec_array.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec_draw.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_exec_eval.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_rebase.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_save.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_save_api.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_save_draw.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_save_loopback.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_split.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_split_copy.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_split_inplace.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\version.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\viewport.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\vtxfmt.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\arbprogparse.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\arbprogram.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\atifragshader.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\symbol_table.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\programopt.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\program.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\program_parse_extra.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_cache.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_execute.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_instruction.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_noise.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_optimize.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_opt_constant_fold.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_parameter.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_parameter_layout.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_print.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_statevars.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\lex.yy.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\program_parse.tab.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\transformfeedback.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shaderobj.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shader_query.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\uniform_query.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shaderapi.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\accum.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\querymatrix.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\uniforms.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\ir_to_mesa.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\string_to_uint_map.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_variable_index_to_cond_assign.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_hierarchical_visitor.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_types.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_variables.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function_can_inline.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_function_detect_recursion.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_rvalue_visitor.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_hv_accept.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_symbol_table.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_constant_expression.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_clone.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\linker.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_parser_extras.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_variable_refcount.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_basic_block.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_analysis.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_controls.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_expression_flattening.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_import_prototypes.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_functions.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniforms.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\loop_unroll.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_redundant_jumps.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_to_hir.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_expr.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\hir_field_selection.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_lexer.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_type.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\pp.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\glcpp-parse.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glcpp\glcpp-lex.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_reader.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\glsl_parser.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_print_visitor.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_validate.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_set_program_inouts.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_noise.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_function.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\s_expression.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pack.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pixeltransfer.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vec_index_to_swizzle.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_folding.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_structure_splitting.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_variable.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_algebraic.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_if_simplification.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_instructions.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_code_local.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vec_index_to_cond_assign.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_function_inlining.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_texture_projection.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_functions.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vector.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
-     <ClCompile Include="..\..\..\..\src\glsl\strtod.c">
-       <Filter>Source Files</Filter>
-     </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_copy_propagation.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_code.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_discard.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_mat_op_to_vec.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_tree_grafting.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_noop_swizzle.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_jumps.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_clip_distance.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_constant_propagation.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_if_to_cond_assign.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_swizzle_swizzle.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\sampler.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_copy_propagation_elements.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pbo.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_rgtc.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texstorage.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\format_pack.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\errors.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_array_splitting.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_builder.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_discard_flow.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\vbo\vbo_primitive_restart.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_initializers.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\glformats.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_cpal.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\es1_conversion.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\drawtex.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\program\prog_hash_table.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\set.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_packed_varyings.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_varyings.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\formatquery.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_blocks.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_uniform_block_active_visitor.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_flatten_nested_if_blocks.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\remap.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vector_insert.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_named_interface_blocks.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_interface_blocks.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_flip_matrices.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ast_array_index.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_types.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_builtin_varyings.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\objectlabel.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\builtin_functions.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\performance_monitor.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\vdpau.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_cse.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\link_atomics.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\ir_equals.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\textureview.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\shaderimage.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_vectorize.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\blit.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\compute.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\genmipmap.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\drivers\common\meta_blit.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\pipelineobj.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_rebalance_tree.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\util\hash_table.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\util\ralloc.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\util\format_srgb.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\format_utils.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\copyimage.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\mesa\main\texcompress_bptc.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\util\rgtc.c">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\lower_vertex_id.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_dead_builtin_variables.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
 +    <ClCompile Include="..\..\..\..\src\glsl\opt_minmax.cpp">
 +      <Filter>Source Files</Filter>
 +    </ClCompile>
-   </ItemGroup>
-   <ItemGroup>
-     <ClInclude Include="..\..\..\..\src\glsl\strtod.h">
++    <ClCompile Include="..\..\..\..\src\util\strtod.cpp">
 +      <Filter>Source Files</Filter>
-     </ClInclude>
++    </ClCompile>
++    <ClCompile Include="..\..\..\..\src\glsl\lower_const_arrays_to_uniforms.cpp">
++      <Filter>Source Files</Filter>
++    </ClCompile>
 +  </ItemGroup>
 +  <ItemGroup>
 +    <CustomBuild Include="..\..\..\..\src\mesa\program\program_lexer.l">
 +      <Filter>Source Files</Filter>
 +    </CustomBuild>
 +  </ItemGroup>
 +  <ItemGroup>
 +    <None Include="..\..\..\..\src\mesa\program\program_parse.y">
 +      <Filter>Source Files</Filter>
 +    </None>
 +  </ItemGroup>
 +</Project>
diff --cc xorg-server/Xext/xvmain.c
index 607560e,0abf190..8e4c26c
mode 100755,100644..100755
--- a/xorg-server/Xext/xvmain.c
+++ b/xorg-server/Xext/xvmain.c
diff --cc xorg-server/dix/dispatch.c
index 36f9418,d844a09..ff59ad2
mode 100755,100644..100755
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@@ -1,4038 -1,3996 +1,4038 @@@
 -/************************************************************
 -
 -Copyright 1987, 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 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
 -
 -                        All Rights Reserved
 -
 -Permission to use, copy, modify, and distribute this software and its
 -documentation for any purpose and without fee is hereby granted,
 -provided that the above copyright notice appear in all copies and that
 -both that copyright notice and this permission notice appear in
 -supporting documentation, and that the name of Digital not be
 -used in advertising or publicity pertaining to distribution of the
 -software without specific, written prior permission.
 -
 -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 -SOFTWARE.
 -
 -********************************************************/
 -
 -/* The panoramix components contained the following notice */
 -/*****************************************************************
 -
 -Copyright (c) 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.
 - */
 -
 -#ifdef HAVE_DIX_CONFIG_H
 -#include <dix-config.h>
 -#include <version-config.h>
 -#endif
 -
 -#ifdef PANORAMIX_DEBUG
 -#include <stdio.h>
 -int ProcInitialConnection();
 -#endif
 -
 -#include "windowstr.h"
 -#include <X11/fonts/fontstruct.h>
 -#include "dixfontstr.h"
 -#include "gcstruct.h"
 -#include "selection.h"
 -#include "colormapst.h"
 -#include "cursorstr.h"
 -#include "scrnintstr.h"
 -#include "opaque.h"
 -#include "input.h"
 -#include "servermd.h"
 -#include "extnsionst.h"
 -#include "dixfont.h"
 -#include "dispatch.h"
 -#include "swaprep.h"
 -#include "swapreq.h"
 -#include "privates.h"
 -#include "xace.h"
 -#include "inputstr.h"
 -#include "xkbsrv.h"
 -#include "site.h"
 -#include "client.h"
 -
 -#ifdef XSERVER_DTRACE
 -#include "registry.h"
 -#include <sys/types.h>
 -typedef const char *string;
 -
 -#include "Xserver-dtrace.h"
 -#endif
 -
 -#define mskcnt ((MAXCLIENTS + 31) / 32)
 -#define BITMASK(i) (1U << ((i) & 31))
 -#define MASKIDX(i) ((i) >> 5)
 -#define MASKWORD(buf, i) buf[MASKIDX(i)]
 -#define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i)
 -#define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i)
 -#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
 -
 -xConnSetupPrefix connSetupPrefix;
 -
 -PaddingInfo PixmapWidthPaddingInfo[33];
 -
 -static ClientPtr grabClient;
 -
 -#define GrabNone 0
 -#define GrabActive 1
 -#define GrabKickout 2
 -static int grabState = GrabNone;
 -static long grabWaiters[mskcnt];
 -CallbackListPtr ServerGrabCallback = NULL;
 -HWEventQueuePtr checkForInput[2];
 -int connBlockScreenStart;
 -
 -static void KillAllClients(void);
 -
 -static int nextFreeClientID;    /* always MIN free client ID */
 -
 -static int nClients;            /* number of authorized clients */
 -
 -CallbackListPtr ClientStateCallback;
 -
 -/* dispatchException & isItTimeToYield must be declared volatile since they
 - * are modified by signal handlers - otherwise optimizer may assume it doesn't
 - * need to actually check value in memory when used and may miss changes from
 - * signal handlers.
 - */
 -volatile char dispatchException = 0;
 -volatile char isItTimeToYield;
 -
 -#define SAME_SCREENS(a, b) (\
 -    (a.pScreen == b.pScreen))
 -
 -void
 -SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1)
 -{
 -    checkForInput[0] = c0;
 -    checkForInput[1] = c1;
 -}
 -
 -void
 -UpdateCurrentTime(void)
 -{
 -    TimeStamp systime;
 -
 -    /* To avoid time running backwards, we must call GetTimeInMillis before
 -     * calling ProcessInputEvents.
 -     */
 -    systime.months = currentTime.months;
 -    systime.milliseconds = GetTimeInMillis();
 -    if (systime.milliseconds < currentTime.milliseconds)
 -        systime.months++;
 -    if (*checkForInput[0] != *checkForInput[1])
 -        ProcessInputEvents();
 -    if (CompareTimeStamps(systime, currentTime) == LATER)
 -        currentTime = systime;
 -}
 -
 -/* Like UpdateCurrentTime, but can't call ProcessInputEvents */
 -void
 -UpdateCurrentTimeIf(void)
 -{
 -    TimeStamp systime;
 -
 -    systime.months = currentTime.months;
 -    systime.milliseconds = GetTimeInMillis();
 -    if (systime.milliseconds < currentTime.milliseconds)
 -        systime.months++;
 -    if (CompareTimeStamps(systime, currentTime) == LATER)
 -        currentTime = systime;
 -}
 -
 -#undef SMART_DEBUG
 -
 -/* in milliseconds */
 -#define SMART_SCHEDULE_DEFAULT_INTERVAL	5
 -#define SMART_SCHEDULE_MAX_SLICE	15
 -
 -#if defined(WIN32) && !defined(__CYGWIN__)
 -Bool SmartScheduleDisable = TRUE;
 -#else
 -Bool SmartScheduleDisable = FALSE;
 -#endif
 -long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
 -long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
 -long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
 -long SmartScheduleTime;
 -int SmartScheduleLatencyLimited = 0;
 -static ClientPtr SmartLastClient;
 -static int SmartLastIndex[SMART_MAX_PRIORITY - SMART_MIN_PRIORITY + 1];
 -
 -#ifdef SMART_DEBUG
 -long SmartLastPrint;
 -#endif
 -
 -void Dispatch(void);
 -
 -static int
 -SmartScheduleClient(int *clientReady, int nready)
 -{
 -    ClientPtr pClient;
 -    int i;
 -    int client;
 -    int bestPrio, best = 0;
 -    int bestRobin, robin;
 -    long now = SmartScheduleTime;
 -    long idle;
 -
 -    bestPrio = -0x7fffffff;
 -    bestRobin = 0;
 -    idle = 2 * SmartScheduleSlice;
 -    for (i = 0; i < nready; i++) {
 -        client = clientReady[i];
 -        pClient = clients[client];
 -        /* Praise clients which haven't run in a while */
 -        if ((now - pClient->smart_stop_tick) >= idle) {
 -            if (pClient->smart_priority < 0)
 -                pClient->smart_priority++;
 -        }
 -
 -        /* check priority to select best client */
 -        robin =
 -            (pClient->index -
 -             SmartLastIndex[pClient->smart_priority -
 -                            SMART_MIN_PRIORITY]) & 0xff;
 -        if (pClient->smart_priority > bestPrio ||
 -            (pClient->smart_priority == bestPrio && robin > bestRobin)) {
 -            bestPrio = pClient->smart_priority;
 -            bestRobin = robin;
 -            best = client;
 -        }
 -#ifdef SMART_DEBUG
 -        if ((now - SmartLastPrint) >= 5000)
 -            fprintf(stderr, " %2d: %3d", client, pClient->smart_priority);
 -#endif
 -    }
 -#ifdef SMART_DEBUG
 -    if ((now - SmartLastPrint) >= 5000) {
 -        fprintf(stderr, " use %2d\n", best);
 -        SmartLastPrint = now;
 -    }
 -#endif
 -    pClient = clients[best];
 -    SmartLastIndex[bestPrio - SMART_MIN_PRIORITY] = pClient->index;
 -    /*
 -     * Set current client pointer
 -     */
 -    if (SmartLastClient != pClient) {
 -        pClient->smart_start_tick = now;
 -        SmartLastClient = pClient;
 -    }
 -    /*
 -     * Adjust slice
 -     */
 -    if (nready == 1 && SmartScheduleLatencyLimited == 0) {
 -        /*
 -         * If it's been a long time since another client
 -         * has run, bump the slice up to get maximal
 -         * performance from a single client
 -         */
 -        if ((now - pClient->smart_start_tick) > 1000 &&
 -            SmartScheduleSlice < SmartScheduleMaxSlice) {
 -            SmartScheduleSlice += SmartScheduleInterval;
 -        }
 -    }
 -    else {
 -        SmartScheduleSlice = SmartScheduleInterval;
 -    }
 -    return best;
 -}
 -
 -void
 -EnableLimitedSchedulingLatency(void)
 -{
 -    ++SmartScheduleLatencyLimited;
 -    SmartScheduleSlice = SmartScheduleInterval;
 -}
 -
 -void
 -DisableLimitedSchedulingLatency(void)
 -{
 -    --SmartScheduleLatencyLimited;
 -
 -    /* protect against bugs */
 -    if (SmartScheduleLatencyLimited < 0)
 -        SmartScheduleLatencyLimited = 0;
 -}
 -
 -void
 -Dispatch(void)
 -{
 -    int *clientReady;           /* array of request ready clients */
 -    int result;
 -    ClientPtr client;
 -    int nready;
 -    HWEventQueuePtr *icheck = checkForInput;
 -    long start_tick;
 -
 -    nextFreeClientID = 1;
 -    nClients = 0;
 -
 -    clientReady = malloc(sizeof(int) * MaxClients);
 -    if (!clientReady)
 -        return;
 -
 -    SmartScheduleSlice = SmartScheduleInterval;
 -    while (!dispatchException) {
 -        if (*icheck[0] != *icheck[1]) {
 -            ProcessInputEvents();
 -            FlushIfCriticalOutputPending();
 -        }
 -
 -        nready = WaitForSomething(clientReady);
 -
 -        if (nready && !SmartScheduleDisable) {
 -            clientReady[0] = SmartScheduleClient(clientReady, nready);
 -            nready = 1;
 -        }
 -       /*****************
 -	*  Handle events in round robin fashion, doing input between
 -	*  each round
 -	*****************/
 -
 -        while (!dispatchException && (--nready >= 0)) {
 -            client = clients[clientReady[nready]];
 -            if (!client) {
 -                /* KillClient can cause this to happen */
 -                continue;
 -            }
 -            /* GrabServer activation can cause this to be true */
 -            if (grabState == GrabKickout) {
 -                grabState = GrabActive;
 -                break;
 -            }
 -            isItTimeToYield = FALSE;
 -
 -            start_tick = SmartScheduleTime;
 -            while (!isItTimeToYield) {
 -                if (*icheck[0] != *icheck[1])
 -                    ProcessInputEvents();
 -
 -                FlushIfCriticalOutputPending();
 -                if (!SmartScheduleDisable &&
 -                    (SmartScheduleTime - start_tick) >= SmartScheduleSlice) {
 -                    /* Penalize clients which consume ticks */
 -                    if (client->smart_priority > SMART_MIN_PRIORITY)
 -                        client->smart_priority--;
 -                    break;
 -                }
 -                /* now, finally, deal with client requests */
 -
 -                /* Update currentTime so request time checks, such as for input
 -                 * device grabs, are calculated correctly */
 -                UpdateCurrentTimeIf();
 -                result = ReadRequestFromClient(client);
 -                if (result <= 0) {
 -                    if (result < 0)
 -                        CloseDownClient(client);
 -                    break;
 -                }
 -
 -                client->sequence++;
 -                client->majorOp = ((xReq *) client->requestBuffer)->reqType;
 -                client->minorOp = 0;
 -                if (client->majorOp >= EXTENSION_BASE) {
 -                    ExtensionEntry *ext = GetExtensionEntry(client->majorOp);
 -
 -                    if (ext)
 -                        client->minorOp = ext->MinorOpcode(client);
 -                }
 -#ifdef XSERVER_DTRACE
 -                if (XSERVER_REQUEST_START_ENABLED())
 -                    XSERVER_REQUEST_START(LookupMajorName(client->majorOp),
 -                                          client->majorOp,
 -                                          ((xReq *) client->requestBuffer)->length,
 -                                          client->index,
 -                                          client->requestBuffer);
 -#endif
 -                if (result > (maxBigRequestSize << 2))
 -                    result = BadLength;
 -                else {
 -                    result = XaceHookDispatch(client, client->majorOp);
 -                    if (result == Success)
 -                        result =
 -                            (*client->requestVector[client->majorOp]) (client);
 -                    XaceHookAuditEnd(client, result);
 -                }
 -#ifdef XSERVER_DTRACE
 -                if (XSERVER_REQUEST_DONE_ENABLED())
 -                    XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp),
 -                                         client->majorOp, client->sequence,
 -                                         client->index, result);
 -#endif
 -
 -                if (client->noClientException != Success) {
 -                    CloseDownClient(client);
 -                    break;
 -                }
 -                else if (result != Success) {
 -                    SendErrorToClient(client, client->majorOp,
 -                                      client->minorOp,
 -                                      client->errorValue, result);
 -                    break;
 -                }
 -            }
 -            FlushAllOutput();
 -            client = clients[clientReady[nready]];
 -            if (client)
 -                client->smart_stop_tick = SmartScheduleTime;
 -        }
 -        dispatchException &= ~DE_PRIORITYCHANGE;
 -    }
 -#if defined(DDXBEFORERESET)
 -    ddxBeforeReset();
 -#endif
 -    KillAllClients();
 -    free(clientReady);
 -    dispatchException &= ~DE_RESET;
 -    SmartScheduleLatencyLimited = 0;
 -    ResetOsBuffers();
 -}
 -
 -static int VendorRelease = VENDOR_RELEASE;
 -static const char *VendorString = VENDOR_NAME;
 -
 -void
 -SetVendorRelease(int release)
 -{
 -    VendorRelease = release;
 -}
 -
 -void
 -SetVendorString(const char *vendor)
 -{
 -    VendorString = vendor;
 -}
 -
 -Bool
 -CreateConnectionBlock(void)
 -{
 -    xConnSetup setup;
 -    xWindowRoot root;
 -    xDepth depth;
 -    xVisualType visual;
 -    xPixmapFormat format;
 -    unsigned long vid;
 -    int i, j, k, lenofblock, sizesofar = 0;
 -    char *pBuf;
 -
 -    memset(&setup, 0, sizeof(xConnSetup));
 -    /* Leave off the ridBase and ridMask, these must be sent with
 -       connection */
 -
 -    setup.release = VendorRelease;
 -    /*
 -     * per-server image and bitmap parameters are defined in Xmd.h
 -     */
 -    setup.imageByteOrder = screenInfo.imageByteOrder;
 -
 -    setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit;
 -    setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad;
 -
 -    setup.bitmapBitOrder = screenInfo.bitmapBitOrder;
 -    setup.motionBufferSize = NumMotionEvents();
 -    setup.numRoots = screenInfo.numScreens;
 -    setup.nbytesVendor = strlen(VendorString);
 -    setup.numFormats = screenInfo.numPixmapFormats;
 -    setup.maxRequestSize = MAX_REQUEST_SIZE;
 -    QueryMinMaxKeyCodes(&setup.minKeyCode, &setup.maxKeyCode);
 -
 -    lenofblock = sizeof(xConnSetup) +
 -        pad_to_int32(setup.nbytesVendor) +
 -        (setup.numFormats * sizeof(xPixmapFormat)) +
 -        (setup.numRoots * sizeof(xWindowRoot));
 -    ConnectionInfo = malloc(lenofblock);
 -    if (!ConnectionInfo)
 -        return FALSE;
 -
 -    memmove(ConnectionInfo, (char *) &setup, sizeof(xConnSetup));
 -    sizesofar = sizeof(xConnSetup);
 -    pBuf = ConnectionInfo + sizeof(xConnSetup);
 -
 -    memmove(pBuf, VendorString, (int) setup.nbytesVendor);
 -    sizesofar += setup.nbytesVendor;
 -    pBuf += setup.nbytesVendor;
 -    i = padding_for_int32(setup.nbytesVendor);
 -    sizesofar += i;
 -    while (--i >= 0)
 -        *pBuf++ = 0;
 -
 -    memset(&format, 0, sizeof(xPixmapFormat));
 -    for (i = 0; i < screenInfo.numPixmapFormats; i++) {
 -        format.depth = screenInfo.formats[i].depth;
 -        format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
 -        format.scanLinePad = screenInfo.formats[i].scanlinePad;
 -        memmove(pBuf, (char *) &format, sizeof(xPixmapFormat));
 -        pBuf += sizeof(xPixmapFormat);
 -        sizesofar += sizeof(xPixmapFormat);
 -    }
 -
 -    connBlockScreenStart = sizesofar;
 -    memset(&depth, 0, sizeof(xDepth));
 -    memset(&visual, 0, sizeof(xVisualType));
 -    for (i = 0; i < screenInfo.numScreens; i++) {
 -        ScreenPtr pScreen;
 -        DepthPtr pDepth;
 -        VisualPtr pVisual;
 -
 -        pScreen = screenInfo.screens[i];
 -        root.windowId = pScreen->root->drawable.id;
 -        root.defaultColormap = pScreen->defColormap;
 -        root.whitePixel = pScreen->whitePixel;
 -        root.blackPixel = pScreen->blackPixel;
 -        root.currentInputMask = 0;      /* filled in when sent */
 -        root.pixWidth = pScreen->width;
 -        root.pixHeight = pScreen->height;
 -        root.mmWidth = pScreen->mmWidth;
 -        root.mmHeight = pScreen->mmHeight;
 -        root.minInstalledMaps = pScreen->minInstalledCmaps;
 -        root.maxInstalledMaps = pScreen->maxInstalledCmaps;
 -        root.rootVisualID = pScreen->rootVisual;
 -        root.backingStore = pScreen->backingStoreSupport;
 -        root.saveUnders = FALSE;
 -        root.rootDepth = pScreen->rootDepth;
 -        root.nDepths = pScreen->numDepths;
 -        memmove(pBuf, (char *) &root, sizeof(xWindowRoot));
 -        sizesofar += sizeof(xWindowRoot);
 -        pBuf += sizeof(xWindowRoot);
 -
 -        pDepth = pScreen->allowedDepths;
 -        for (j = 0; j < pScreen->numDepths; j++, pDepth++) {
 -            lenofblock += sizeof(xDepth) +
 -                (pDepth->numVids * sizeof(xVisualType));
 -            pBuf = (char *) realloc(ConnectionInfo, lenofblock);
 -            if (!pBuf) {
 -                free(ConnectionInfo);
 -                return FALSE;
 -            }
 -            ConnectionInfo = pBuf;
 -            pBuf += sizesofar;
 -            depth.depth = pDepth->depth;
 -            depth.nVisuals = pDepth->numVids;
 -            memmove(pBuf, (char *) &depth, sizeof(xDepth));
 -            pBuf += sizeof(xDepth);
 -            sizesofar += sizeof(xDepth);
 -            for (k = 0; k < pDepth->numVids; k++) {
 -                vid = pDepth->vids[k];
 -                for (pVisual = pScreen->visuals;
 -                     pVisual->vid != vid; pVisual++);
 -                visual.visualID = vid;
 -                visual.class = pVisual->class;
 -                visual.bitsPerRGB = pVisual->bitsPerRGBValue;
 -                visual.colormapEntries = pVisual->ColormapEntries;
 -                visual.redMask = pVisual->redMask;
 -                visual.greenMask = pVisual->greenMask;
 -                visual.blueMask = pVisual->blueMask;
 -                memmove(pBuf, (char *) &visual, sizeof(xVisualType));
 -                pBuf += sizeof(xVisualType);
 -                sizesofar += sizeof(xVisualType);
 -            }
 -        }
 -    }
 -    connSetupPrefix.success = xTrue;
 -    connSetupPrefix.length = lenofblock / 4;
 -    connSetupPrefix.majorVersion = X_PROTOCOL;
 -    connSetupPrefix.minorVersion = X_PROTOCOL_REVISION;
 -    return TRUE;
 -}
 -
 -int
 -ProcBadRequest(ClientPtr client)
 -{
 -    return BadRequest;
 -}
 -
 -int
 -ProcCreateWindow(ClientPtr client)
 -{
 -    WindowPtr pParent, pWin;
 -
 -    REQUEST(xCreateWindowReq);
 -    int len, rc;
 -
 -    REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
 -
 -    LEGAL_NEW_RESOURCE(stuff->wid, client);
 -    rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
 -    if (rc != Success)
 -        return rc;
 -    len = client->req_len - bytes_to_int32(sizeof(xCreateWindowReq));
 -    if (Ones(stuff->mask) != len)
 -        return BadLength;
 -    if (!stuff->width || !stuff->height) {
 -        client->errorValue = 0;
 -        return BadValue;
 -    }
 -    pWin = CreateWindow(stuff->wid, pParent, stuff->x,
 -                        stuff->y, stuff->width, stuff->height,
 -                        stuff->borderWidth, stuff->class,
 -                        stuff->mask, (XID *) &stuff[1],
 -                        (int) stuff->depth, client, stuff->visual, &rc);
 -    if (pWin) {
 -        Mask mask = pWin->eventMask;
 -
 -        pWin->eventMask = 0;    /* subterfuge in case AddResource fails */
 -        if (!AddResource(stuff->wid, RT_WINDOW, (void *) pWin))
 -            return BadAlloc;
 -        pWin->eventMask = mask;
 -    }
 -    return rc;
 -}
 -
 -int
 -ProcChangeWindowAttributes(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xChangeWindowAttributesReq);
 -    int len, rc;
 -    Mask access_mode = 0;
 -
 -    REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
 -    access_mode |= (stuff->valueMask & CWEventMask) ? DixReceiveAccess : 0;
 -    access_mode |= (stuff->valueMask & ~CWEventMask) ? DixSetAttrAccess : 0;
 -    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
 -    if (rc != Success)
 -        return rc;
 -    len = client->req_len - bytes_to_int32(sizeof(xChangeWindowAttributesReq));
 -    if (len != Ones(stuff->valueMask))
 -        return BadLength;
 -    return ChangeWindowAttributes(pWin,
 -                                  stuff->valueMask, (XID *) &stuff[1], client);
 -}
 -
 -int
 -ProcGetWindowAttributes(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xResourceReq);
 -    xGetWindowAttributesReply wa;
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -    memset(&wa, 0, sizeof(xGetWindowAttributesReply));
 -    GetWindowAttributes(pWin, client, &wa);
 -    WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
 -    return Success;
 -}
 -
 -int
 -ProcDestroyWindow(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xResourceReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
 -    if (rc != Success)
 -        return rc;
 -    if (pWin->parent) {
 -        rc = dixLookupWindow(&pWin, pWin->parent->drawable.id, client,
 -                             DixRemoveAccess);
 -        if (rc != Success)
 -            return rc;
 -        FreeResource(stuff->id, RT_NONE);
 -    }
 -    return Success;
 -}
 -
 -int
 -ProcDestroySubwindows(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xResourceReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixRemoveAccess);
 -    if (rc != Success)
 -        return rc;
 -    DestroySubwindows(pWin, client);
 -    return Success;
 -}
 -
 -int
 -ProcChangeSaveSet(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xChangeSaveSetReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xChangeSaveSetReq);
 -    rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
 -    if (rc != Success)
 -        return rc;
 -    if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
 -        return BadMatch;
 -    if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete))
 -        return AlterSaveSetForClient(client, pWin, stuff->mode, FALSE, TRUE);
 -    client->errorValue = stuff->mode;
 -    return BadValue;
 -}
 -
 -int
 -ProcReparentWindow(ClientPtr client)
 -{
 -    WindowPtr pWin, pParent;
 -
 -    REQUEST(xReparentWindowReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xReparentWindowReq);
 -    rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
 -    if (rc != Success)
 -        return rc;
 -    rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
 -    if (rc != Success)
 -        return rc;
 -    if (!SAME_SCREENS(pWin->drawable, pParent->drawable))
 -        return BadMatch;
 -    if ((pWin->backgroundState == ParentRelative) &&
 -        (pParent->drawable.depth != pWin->drawable.depth))
 -        return BadMatch;
 -    if ((pWin->drawable.class != InputOnly) &&
 -        (pParent->drawable.class == InputOnly))
 -        return BadMatch;
 -    return ReparentWindow(pWin, pParent,
 -                          (short) stuff->x, (short) stuff->y, client);
 -}
 -
 -int
 -ProcMapWindow(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xResourceReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixShowAccess);
 -    if (rc != Success)
 -        return rc;
 -    MapWindow(pWin, client);
 -    /* update cache to say it is mapped */
 -    return Success;
 -}
 -
 -int
 -ProcMapSubwindows(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xResourceReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
 -    if (rc != Success)
 -        return rc;
 -    MapSubwindows(pWin, client);
 -    /* update cache to say it is mapped */
 -    return Success;
 -}
 -
 -int
 -ProcUnmapWindow(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xResourceReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixHideAccess);
 -    if (rc != Success)
 -        return rc;
 -    UnmapWindow(pWin, FALSE);
 -    /* update cache to say it is mapped */
 -    return Success;
 -}
 -
 -int
 -ProcUnmapSubwindows(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xResourceReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
 -    if (rc != Success)
 -        return rc;
 -    UnmapSubwindows(pWin);
 -    return Success;
 -}
 -
 -int
 -ProcConfigureWindow(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xConfigureWindowReq);
 -    int len, rc;
 -
 -    REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
 -    rc = dixLookupWindow(&pWin, stuff->window, client,
 -                         DixManageAccess | DixSetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -    len = client->req_len - bytes_to_int32(sizeof(xConfigureWindowReq));
 -    if (Ones((Mask) stuff->mask) != len)
 -        return BadLength;
 -    return ConfigureWindow(pWin, (Mask) stuff->mask, (XID *) &stuff[1], client);
 -}
 -
 -int
 -ProcCirculateWindow(ClientPtr client)
 -{
 -    WindowPtr pWin;
 -
 -    REQUEST(xCirculateWindowReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xCirculateWindowReq);
 -    if ((stuff->direction != RaiseLowest) && (stuff->direction != LowerHighest)) {
 -        client->errorValue = stuff->direction;
 -        return BadValue;
 -    }
 -    rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
 -    if (rc != Success)
 -        return rc;
 -    CirculateWindow(pWin, (int) stuff->direction, client);
 -    return Success;
 -}
 -
 -static int
 -GetGeometry(ClientPtr client, xGetGeometryReply * rep)
 -{
 -    DrawablePtr pDraw;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -
 -    rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    rep->type = X_Reply;
 -    rep->length = 0;
 -    rep->sequenceNumber = client->sequence;
 -    rep->root = pDraw->pScreen->root->drawable.id;
 -    rep->depth = pDraw->depth;
 -    rep->width = pDraw->width;
 -    rep->height = pDraw->height;
 -
 -    if (WindowDrawable(pDraw->type)) {
 -        WindowPtr pWin = (WindowPtr) pDraw;
 -
 -        rep->x = pWin->origin.x - wBorderWidth(pWin);
 -        rep->y = pWin->origin.y - wBorderWidth(pWin);
 -        rep->borderWidth = pWin->borderWidth;
 -    }
 -    else {                      /* DRAWABLE_PIXMAP */
 -
 -        rep->x = rep->y = rep->borderWidth = 0;
 -    }
 -
 -    return Success;
 -}
 -
 -int
 -ProcGetGeometry(ClientPtr client)
 -{
 -    xGetGeometryReply rep = { .type = X_Reply };
 -    int status;
 -
 -    if ((status = GetGeometry(client, &rep)) != Success)
 -        return status;
 -
 -    WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
 -    return Success;
 -}
 -
 -int
 -ProcQueryTree(ClientPtr client)
 -{
 -    xQueryTreeReply reply;
 -    int rc, numChildren = 0;
 -    WindowPtr pChild, pWin, pHead;
 -    Window *childIDs = (Window *) NULL;
 -
 -    REQUEST(xResourceReq);
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    reply = (xQueryTreeReply) {
 -        .type = X_Reply,
 -        .sequenceNumber = client->sequence,
 -        .root = pWin->drawable.pScreen->root->drawable.id,
 -        .parent = (pWin->parent) ? pWin->parent->drawable.id : (Window) None
 -    };
 -    pHead = RealChildHead(pWin);
 -    for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
 -        numChildren++;
 -    if (numChildren) {
 -        int curChild = 0;
 -
 -        childIDs = malloc(numChildren * sizeof(Window));
 -        if (!childIDs)
 -            return BadAlloc;
 -        for (pChild = pWin->lastChild; pChild != pHead;
 -             pChild = pChild->prevSib)
 -            childIDs[curChild++] = pChild->drawable.id;
 -    }
 -
 -    reply.nChildren = numChildren;
 -    reply.length = bytes_to_int32(numChildren * sizeof(Window));
 -
 -    WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply);
 -    if (numChildren) {
 -        client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 -        WriteSwappedDataToClient(client, numChildren * sizeof(Window),
 -                                 childIDs);
 -        free(childIDs);
 -    }
 -
 -    return Success;
 -}
 -
 -int
 -ProcInternAtom(ClientPtr client)
 -{
 -    Atom atom;
 -    char *tchar;
 -
 -    REQUEST(xInternAtomReq);
 -
 -    REQUEST_FIXED_SIZE(xInternAtomReq, stuff->nbytes);
 -    if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse)) {
 -        client->errorValue = stuff->onlyIfExists;
 -        return BadValue;
 -    }
 -    tchar = (char *) &stuff[1];
 -    atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
 -    if (atom != BAD_RESOURCE) {
 -        xInternAtomReply reply = {
 -            .type = X_Reply,
 -            .sequenceNumber = client->sequence,
 -            .length = 0,
 -            .atom = atom
 -        };
 -        WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
 -        return Success;
 -    }
 -    else
 -        return BadAlloc;
 -}
 -
 -int
 -ProcGetAtomName(ClientPtr client)
 -{
 -    const char *str;
 -
 -    REQUEST(xResourceReq);
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    if ((str = NameForAtom(stuff->id))) {
 -        int len = strlen(str);
 -        xGetAtomNameReply reply = {
 -            .type = X_Reply,
 -            .sequenceNumber = client->sequence,
 -            .length = bytes_to_int32(len),
 -            .nameLength = len
 -        };
 -
 -        WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
 -        WriteToClient(client, len, str);
 -        return Success;
 -    }
 -    else {
 -        client->errorValue = stuff->id;
 -        return BadAtom;
 -    }
 -}
 -
 -int
 -ProcGrabServer(ClientPtr client)
 -{
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xReq);
 -    if (grabState != GrabNone && client != grabClient) {
 -        ResetCurrentRequest(client);
 -        client->sequence--;
 -        BITSET(grabWaiters, client->index);
 -        IgnoreClient(client);
 -        return Success;
 -    }
 -    rc = OnlyListenToOneClient(client);
 -    if (rc != Success)
 -        return rc;
 -    grabState = GrabKickout;
 -    grabClient = client;
 -
 -    if (ServerGrabCallback) {
 -        ServerGrabInfoRec grabinfo;
 -
 -        grabinfo.client = client;
 -        grabinfo.grabstate = SERVER_GRABBED;
 -        CallCallbacks(&ServerGrabCallback, (void *) &grabinfo);
 -    }
 -
 -    return Success;
 -}
 -
 -static void
 -UngrabServer(ClientPtr client)
 -{
 -    int i;
 -
 -    grabState = GrabNone;
 -    ListenToAllClients();
 -    for (i = mskcnt; --i >= 0 && !grabWaiters[i];);
 -    if (i >= 0) {
 -        i <<= 5;
 -        while (!GETBIT(grabWaiters, i))
 -            i++;
 -        BITCLEAR(grabWaiters, i);
 -        AttendClient(clients[i]);
 -    }
 -
 -    if (ServerGrabCallback) {
 -        ServerGrabInfoRec grabinfo;
 -
 -        grabinfo.client = client;
 -        grabinfo.grabstate = SERVER_UNGRABBED;
 -        CallCallbacks(&ServerGrabCallback, (void *) &grabinfo);
 -    }
 -}
 -
 -int
 -ProcUngrabServer(ClientPtr client)
 -{
 -    REQUEST_SIZE_MATCH(xReq);
 -    UngrabServer(client);
 -    return Success;
 -}
 -
 -int
 -ProcTranslateCoords(ClientPtr client)
 -{
 -    REQUEST(xTranslateCoordsReq);
 -
 -    WindowPtr pWin, pDst;
 -    xTranslateCoordsReply rep;
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xTranslateCoordsReq);
 -    rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -    rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    rep = (xTranslateCoordsReply) {
 -        .type = X_Reply,
 -        .sequenceNumber = client->sequence,
 -        .length = 0
 -    };
 -    if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) {
 -        rep.sameScreen = xFalse;
 -        rep.child = None;
 -        rep.dstX = rep.dstY = 0;
 -    }
 -    else {
 -        INT16 x, y;
 -
 -        rep.sameScreen = xTrue;
 -        rep.child = None;
 -        /* computing absolute coordinates -- adjust to destination later */
 -        x = pWin->drawable.x + stuff->srcX;
 -        y = pWin->drawable.y + stuff->srcY;
 -        pWin = pDst->firstChild;
 -        while (pWin) {
 -            BoxRec box;
 -
 -            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) ||
 -                    RegionContainsPoint(&pWin->borderSize, x, y, &box))
 -
 -                && (!wInputShape(pWin) ||
 -                    RegionContainsPoint(wInputShape(pWin),
 -                                        x - pWin->drawable.x,
 -                                        y - pWin->drawable.y, &box))
 -                ) {
 -                rep.child = pWin->drawable.id;
 -                pWin = (WindowPtr) NULL;
 -            }
 -            else
 -                pWin = pWin->nextSib;
 -        }
 -        /* adjust to destination coordinates */
 -        rep.dstX = x - pDst->drawable.x;
 -        rep.dstY = y - pDst->drawable.y;
 -    }
 -    WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
 -    return Success;
 -}
 -
 -int
 -ProcOpenFont(ClientPtr client)
 -{
 -    int err;
 -
 -    REQUEST(xOpenFontReq);
 -
 -    REQUEST_FIXED_SIZE(xOpenFontReq, stuff->nbytes);
 -    client->errorValue = stuff->fid;
 -    LEGAL_NEW_RESOURCE(stuff->fid, client);
 -    err = OpenFont(client, stuff->fid, (Mask) 0,
 -                   stuff->nbytes, (char *) &stuff[1]);
 -    if (err == Success) {
 -        return Success;
 -    }
 -    else
 -        return err;
 -}
 -
 -int
 -ProcCloseFont(ClientPtr client)
 -{
 -    FontPtr pFont;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupResourceByType((void **) &pFont, stuff->id, RT_FONT,
 -                                 client, DixDestroyAccess);
 -    if (rc == Success) {
 -        FreeResource(stuff->id, RT_NONE);
 -        return Success;
 -    }
 -    else {
 -        client->errorValue = stuff->id;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcQueryFont(ClientPtr client)
 -{
 -    xQueryFontReply *reply;
 -    FontPtr pFont;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -
 -    rc = dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    {
 -        xCharInfo *pmax = FONTINKMAX(pFont);
 -        xCharInfo *pmin = FONTINKMIN(pFont);
 -        int nprotoxcistructs;
 -        int rlength;
 -
 -        nprotoxcistructs = (pmax->rightSideBearing == pmin->rightSideBearing &&
 -                            pmax->leftSideBearing == pmin->leftSideBearing &&
 -                            pmax->descent == pmin->descent &&
 -                            pmax->ascent == pmin->ascent &&
 -                            pmax->characterWidth == pmin->characterWidth) ?
 -            0 : N2dChars(pFont);
 -
 -        rlength = sizeof(xQueryFontReply) +
 -            FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
 -            nprotoxcistructs * sizeof(xCharInfo);
 -        reply = calloc(1, rlength);
 -        if (!reply) {
 -            return BadAlloc;
 -        }
 -
 -        reply->type = X_Reply;
 -        reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
 -        reply->sequenceNumber = client->sequence;
 -        QueryFont(pFont, reply, nprotoxcistructs);
 -
 -        WriteReplyToClient(client, rlength, reply);
 -        free(reply);
 -        return Success;
 -    }
 -}
 -
 -int
 -ProcQueryTextExtents(ClientPtr client)
 -{
 -    xQueryTextExtentsReply reply;
 -    FontPtr pFont;
 -    ExtentInfoRec info;
 -    unsigned long length;
 -    int rc;
 -
 -    REQUEST(xQueryTextExtentsReq);
 -    REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
 -
 -    rc = dixLookupFontable(&pFont, stuff->fid, client, DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    length = client->req_len - bytes_to_int32(sizeof(xQueryTextExtentsReq));
 -    length = length << 1;
 -    if (stuff->oddLength) {
 -        if (length == 0)
 -            return BadLength;
 -        length--;
 -    }
 -    if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
 -        return BadAlloc;
 -    reply = (xQueryTextExtentsReply) {
 -        .type = X_Reply,
 -        .drawDirection = info.drawDirection,
 -        .sequenceNumber = client->sequence,
 -        .length = 0,
 -        .fontAscent = info.fontAscent,
 -        .fontDescent = info.fontDescent,
 -        .overallAscent = info.overallAscent,
 -        .overallDescent = info.overallDescent,
 -        .overallWidth = info.overallWidth,
 -        .overallLeft = info.overallLeft,
 -        .overallRight = info.overallRight
 -    };
 -    WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
 -    return Success;
 -}
 -
 -int
 -ProcListFonts(ClientPtr client)
 -{
 -    REQUEST(xListFontsReq);
 -
 -    REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes);
 -
 -    return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes,
 -                     stuff->maxNames);
 -}
 -
 -int
 -ProcListFontsWithInfo(ClientPtr client)
 -{
 -    REQUEST(xListFontsWithInfoReq);
 -
 -    REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes);
 -
 -    return StartListFontsWithInfo(client, stuff->nbytes,
 -                                  (unsigned char *) &stuff[1], stuff->maxNames);
 -}
 -
 -/**
 - *
 - *  \param value must conform to DeleteType
 - */
 -int
 -dixDestroyPixmap(void *value, XID pid)
 -{
 -    PixmapPtr pPixmap = (PixmapPtr) value;
 -
 -    return (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
 -}
 -
 -int
 -ProcCreatePixmap(ClientPtr client)
 -{
 -    PixmapPtr pMap;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xCreatePixmapReq);
 -    DepthPtr pDepth;
 -    int i, rc;
 -
 -    REQUEST_SIZE_MATCH(xCreatePixmapReq);
 -    client->errorValue = stuff->pid;
 -    LEGAL_NEW_RESOURCE(stuff->pid, client);
 -
 -    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
 -                           DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    if (!stuff->width || !stuff->height) {
 -        client->errorValue = 0;
 -        return BadValue;
 -    }
 -    if (stuff->width > 32767 || stuff->height > 32767) {
 -        /* It is allowed to try and allocate a pixmap which is larger than
 -         * 32767 in either dimension. However, all of the framebuffer code
 -         * is buggy and does not reliably draw to such big pixmaps, basically
 -         * because the Region data structure operates with signed shorts
 -         * for the rectangles in it.
 -         *
 -         * Furthermore, several places in the X server computes the
 -         * size in bytes of the pixmap and tries to store it in an
 -         * integer. This integer can overflow and cause the allocated size
 -         * to be much smaller.
 -         *
 -         * So, such big pixmaps are rejected here with a BadAlloc
 -         */
 -        return BadAlloc;
 -    }
 -    if (stuff->depth != 1) {
 -        pDepth = pDraw->pScreen->allowedDepths;
 -        for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
 -            if (pDepth->depth == stuff->depth)
 -                goto CreatePmap;
 -        client->errorValue = stuff->depth;
 -        return BadValue;
 -    }
 - CreatePmap:
 -    pMap = (PixmapPtr) (*pDraw->pScreen->CreatePixmap)
 -        (pDraw->pScreen, stuff->width, stuff->height, stuff->depth, 0);
 -    if (pMap) {
 -        pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
 -        pMap->drawable.id = stuff->pid;
 -        /* security creation/labeling check */
 -        rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
 -                      pMap, RT_NONE, NULL, DixCreateAccess);
 -        if (rc != Success) {
 -            (*pDraw->pScreen->DestroyPixmap) (pMap);
 -            return rc;
 -        }
 -        if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap))
 -            return Success;
 -    }
 -    return BadAlloc;
 -}
 -
 -int
 -ProcFreePixmap(ClientPtr client)
 -{
 -    PixmapPtr pMap;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -
 -    rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP,
 -                                 client, DixDestroyAccess);
 -    if (rc == Success) {
 -        FreeResource(stuff->id, RT_NONE);
 -        return Success;
 -    }
 -    else {
 -        client->errorValue = stuff->id;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcCreateGC(ClientPtr client)
 -{
 -    int error, rc;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -    unsigned len;
 -
 -    REQUEST(xCreateGCReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xCreateGCReq);
 -    client->errorValue = stuff->gc;
 -    LEGAL_NEW_RESOURCE(stuff->gc, client);
 -    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
 -                           DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
 -    if (len != Ones(stuff->mask))
 -        return BadLength;
 -    pGC = (GC *) CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error,
 -                          stuff->gc, client);
 -    if (error != Success)
 -        return error;
 -    if (!AddResource(stuff->gc, RT_GC, (void *) pGC))
 -        return BadAlloc;
 -    return Success;
 -}
 -
 -int
 -ProcChangeGC(ClientPtr client)
 -{
 -    GC *pGC;
 -    int result;
 -    unsigned len;
 -
 -    REQUEST(xChangeGCReq);
 -    REQUEST_AT_LEAST_SIZE(xChangeGCReq);
 -
 -    result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
 -    if (result != Success)
 -        return result;
 -
 -    len = client->req_len - bytes_to_int32(sizeof(xChangeGCReq));
 -    if (len != Ones(stuff->mask))
 -        return BadLength;
 -
 -    return ChangeGCXIDs(client, pGC, stuff->mask, (CARD32 *) &stuff[1]);
 -}
 -
 -int
 -ProcCopyGC(ClientPtr client)
 -{
 -    GC *dstGC;
 -    GC *pGC;
 -    int result;
 -
 -    REQUEST(xCopyGCReq);
 -    REQUEST_SIZE_MATCH(xCopyGCReq);
 -
 -    result = dixLookupGC(&pGC, stuff->srcGC, client, DixGetAttrAccess);
 -    if (result != Success)
 -        return result;
 -    result = dixLookupGC(&dstGC, stuff->dstGC, client, DixSetAttrAccess);
 -    if (result != Success)
 -        return result;
 -    if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
 -        return BadMatch;
 -    if (stuff->mask & ~GCAllBits) {
 -        client->errorValue = stuff->mask;
 -        return BadValue;
 -    }
 -    return CopyGC(pGC, dstGC, stuff->mask);
 -}
 -
 -int
 -ProcSetDashes(ClientPtr client)
 -{
 -    GC *pGC;
 -    int result;
 -
 -    REQUEST(xSetDashesReq);
 -
 -    REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
 -    if (stuff->nDashes == 0) {
 -        client->errorValue = 0;
 -        return BadValue;
 -    }
 -
 -    result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
 -    if (result != Success)
 -        return result;
 -
 -    /* If there's an error, either there's no sensible errorValue,
 -     * or there was a dash segment of 0. */
 -    client->errorValue = 0;
 -    return SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
 -                     (unsigned char *) &stuff[1]);
 -}
 -
 -int
 -ProcSetClipRectangles(ClientPtr client)
 -{
 -    int nr, result;
 -    GC *pGC;
 -
 -    REQUEST(xSetClipRectanglesReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
 -    if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
 -        (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
 -        client->errorValue = stuff->ordering;
 -        return BadValue;
 -    }
 -    result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
 -    if (result != Success)
 -        return result;
 -
 -    nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);
 -    if (nr & 4)
 -        return BadLength;
 -    nr >>= 3;
 -    return SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,
 -                        nr, (xRectangle *) &stuff[1], (int) stuff->ordering);
 -}
 -
 -int
 -ProcFreeGC(ClientPtr client)
 -{
 -    GC *pGC;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -
 -    rc = dixLookupGC(&pGC, stuff->id, client, DixDestroyAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    FreeResource(stuff->id, RT_NONE);
 -    return Success;
 -}
 -
 -int
 -ProcClearToBackground(ClientPtr client)
 -{
 -    REQUEST(xClearAreaReq);
 -    WindowPtr pWin;
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xClearAreaReq);
 -    rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
 -    if (rc != Success)
 -        return rc;
 -    if (pWin->drawable.class == InputOnly) {
 -        client->errorValue = stuff->window;
 -        return BadMatch;
 -    }
 -    if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) {
 -        client->errorValue = stuff->exposures;
 -        return BadValue;
 -    }
 -    (*pWin->drawable.pScreen->ClearToBackground) (pWin, stuff->x, stuff->y,
 -                                                  stuff->width, stuff->height,
 -                                                  (Bool) stuff->exposures);
 -    return Success;
 -}
 -
 -/* send GraphicsExpose events, or a NoExpose event, based on the region */
 -void
 -SendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable,
 -                     int major, int minor)
 -{
 -    if (pRgn && !RegionNil(pRgn)) {
 -        xEvent *pEvent;
 -        xEvent *pe;
 -        BoxPtr pBox;
 -        int i;
 -        int numRects;
 -
 -        numRects = RegionNumRects(pRgn);
 -        pBox = RegionRects(pRgn);
 -        if (!(pEvent = calloc(numRects, sizeof(xEvent))))
 -            return;
 -        pe = pEvent;
 -
 -        for (i = 1; i <= numRects; i++, pe++, pBox++) {
 -            pe->u.u.type = GraphicsExpose;
 -            pe->u.graphicsExposure.drawable = drawable;
 -            pe->u.graphicsExposure.x = pBox->x1;
 -            pe->u.graphicsExposure.y = pBox->y1;
 -            pe->u.graphicsExposure.width = pBox->x2 - pBox->x1;
 -            pe->u.graphicsExposure.height = pBox->y2 - pBox->y1;
 -            pe->u.graphicsExposure.count = numRects - i;
 -            pe->u.graphicsExposure.majorEvent = major;
 -            pe->u.graphicsExposure.minorEvent = minor;
 -        }
 -        /* GraphicsExpose is a "critical event", which TryClientEvents
 -         * handles specially. */
 -        TryClientEvents(client, NULL, pEvent, numRects,
 -                        (Mask) 0, NoEventMask, NullGrab);
 -        free(pEvent);
 -    }
 -    else {
 -        xEvent event = {
 -            .u.noExposure.drawable = drawable,
 -            .u.noExposure.majorEvent = major,
 -            .u.noExposure.minorEvent = minor
 -        };
 -        event.u.u.type = NoExpose;
 -        WriteEventsToClient(client, 1, &event);
 -    }
 -}
 -
 -int
 -ProcCopyArea(ClientPtr client)
 -{
 -    DrawablePtr pDst;
 -    DrawablePtr pSrc;
 -    GC *pGC;
 -
 -    REQUEST(xCopyAreaReq);
 -    RegionPtr pRgn;
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xCopyAreaReq);
 -
 -    VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
 -    if (stuff->dstDrawable != stuff->srcDrawable) {
 -        rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
 -                               DixReadAccess);
 -        if (rc != Success)
 -            return rc;
 -        if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) {
 -            client->errorValue = stuff->dstDrawable;
 -            return BadMatch;
 -        }
 -    }
 -    else
 -        pSrc = pDst;
 -
 -    pRgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, stuff->srcX, stuff->srcY,
 -                                  stuff->width, stuff->height,
 -                                  stuff->dstX, stuff->dstY);
 -    if (pGC->graphicsExposures) {
 -        SendGraphicsExpose(client, pRgn, stuff->dstDrawable, X_CopyArea, 0);
 -        if (pRgn)
 -            RegionDestroy(pRgn);
 -    }
 -
 -    return Success;
 -}
 -
 -int
 -ProcCopyPlane(ClientPtr client)
 -{
 -    DrawablePtr psrcDraw, pdstDraw;
 -    GC *pGC;
 -
 -    REQUEST(xCopyPlaneReq);
 -    RegionPtr pRgn;
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xCopyPlaneReq);
 -
 -    VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
 -    if (stuff->dstDrawable != stuff->srcDrawable) {
 -        rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
 -                               DixReadAccess);
 -        if (rc != Success)
 -            return rc;
 -
 -        if (pdstDraw->pScreen != psrcDraw->pScreen) {
 -            client->errorValue = stuff->dstDrawable;
 -            return BadMatch;
 -        }
 -    }
 -    else
 -        psrcDraw = pdstDraw;
 -
 -    /* Check to see if stuff->bitPlane has exactly ONE good bit set */
 -    if (stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
 -        (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) {
 -        client->errorValue = stuff->bitPlane;
 -        return BadValue;
 -    }
 -
 -    pRgn =
 -        (*pGC->ops->CopyPlane) (psrcDraw, pdstDraw, pGC, stuff->srcX,
 -                                stuff->srcY, stuff->width, stuff->height,
 -                                stuff->dstX, stuff->dstY, stuff->bitPlane);
 -    if (pGC->graphicsExposures) {
 -        SendGraphicsExpose(client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);
 -        if (pRgn)
 -            RegionDestroy(pRgn);
 -    }
 -    return Success;
 -}
 -
 -int
 -ProcPolyPoint(ClientPtr client)
 -{
 -    int npoint;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xPolyPointReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xPolyPointReq);
 -    if ((stuff->coordMode != CoordModeOrigin) &&
 -        (stuff->coordMode != CoordModePrevious)) {
 -        client->errorValue = stuff->coordMode;
 -        return BadValue;
 -    }
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
 -    if (npoint)
 -        (*pGC->ops->PolyPoint) (pDraw, pGC, stuff->coordMode, npoint,
 -                                (xPoint *) &stuff[1]);
 -    return Success;
 -}
 -
 -int
 -ProcPolyLine(ClientPtr client)
 -{
 -    int npoint;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xPolyLineReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xPolyLineReq);
 -    if ((stuff->coordMode != CoordModeOrigin) &&
 -        (stuff->coordMode != CoordModePrevious)) {
 -        client->errorValue = stuff->coordMode;
 -        return BadValue;
 -    }
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
 -    if (npoint > 1)
 -        (*pGC->ops->Polylines) (pDraw, pGC, stuff->coordMode, npoint,
 -                                (DDXPointPtr) &stuff[1]);
 -    return Success;
 -}
 -
 -int
 -ProcPolySegment(ClientPtr client)
 -{
 -    int nsegs;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xPolySegmentReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
 -    if (nsegs & 4)
 -        return BadLength;
 -    nsegs >>= 3;
 -    if (nsegs)
 -        (*pGC->ops->PolySegment) (pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
 -    return Success;
 -}
 -
 -int
 -ProcPolyRectangle(ClientPtr client)
 -{
 -    int nrects;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xPolyRectangleReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
 -    if (nrects & 4)
 -        return BadLength;
 -    nrects >>= 3;
 -    if (nrects)
 -        (*pGC->ops->PolyRectangle) (pDraw, pGC,
 -                                    nrects, (xRectangle *) &stuff[1]);
 -    return Success;
 -}
 -
 -int
 -ProcPolyArc(ClientPtr client)
 -{
 -    int narcs;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xPolyArcReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xPolyArcReq);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
 -    if (narcs % sizeof(xArc))
 -        return BadLength;
 -    narcs /= sizeof(xArc);
 -    if (narcs)
 -        (*pGC->ops->PolyArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
 -    return Success;
 -}
 -
 -int
 -ProcFillPoly(ClientPtr client)
 -{
 -    int things;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xFillPolyReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xFillPolyReq);
 -    if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) &&
 -        (stuff->shape != Convex)) {
 -        client->errorValue = stuff->shape;
 -        return BadValue;
 -    }
 -    if ((stuff->coordMode != CoordModeOrigin) &&
 -        (stuff->coordMode != CoordModePrevious)) {
 -        client->errorValue = stuff->coordMode;
 -        return BadValue;
 -    }
 -
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    things = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
 -    if (things)
 -        (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,
 -                                  stuff->coordMode, things,
 -                                  (DDXPointPtr) &stuff[1]);
 -    return Success;
 -}
 -
 -int
 -ProcPolyFillRectangle(ClientPtr client)
 -{
 -    int things;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xPolyFillRectangleReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
 -    if (things & 4)
 -        return BadLength;
 -    things >>= 3;
 -
 -    if (things)
 -        (*pGC->ops->PolyFillRect) (pDraw, pGC, things,
 -                                   (xRectangle *) &stuff[1]);
 -    return Success;
 -}
 -
 -int
 -ProcPolyFillArc(ClientPtr client)
 -{
 -    int narcs;
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -
 -    REQUEST(xPolyFillArcReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
 -    if (narcs % sizeof(xArc))
 -        return BadLength;
 -    narcs /= sizeof(xArc);
 -    if (narcs)
 -        (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
 -    return Success;
 -}
 -
 -#ifdef MATCH_CLIENT_ENDIAN
 -
 -int
 -ServerOrder(void)
 -{
 -    int whichbyte = 1;
 -
 -    if (*((char *) &whichbyte))
 -        return LSBFirst;
 -    return MSBFirst;
 -}
 -
 -#define ClientOrder(client) ((client)->swapped ? !ServerOrder() : ServerOrder())
 -
 -void
 -ReformatImage(char *base, int nbytes, int bpp, int order)
 -{
 -    switch (bpp) {
 -    case 1:                    /* yuck */
 -        if (BITMAP_BIT_ORDER != order)
 -            BitOrderInvert((unsigned char *) base, nbytes);
 -#if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8
 -        ReformatImage(base, nbytes, BITMAP_SCANLINE_UNIT, order);
 -#endif
 -        break;
 -    case 4:
 -        break;                  /* yuck */
 -    case 8:
 -        break;
 -    case 16:
 -        if (IMAGE_BYTE_ORDER != order)
 -            TwoByteSwap((unsigned char *) base, nbytes);
 -        break;
 -    case 32:
 -        if (IMAGE_BYTE_ORDER != order)
 -            FourByteSwap((unsigned char *) base, nbytes);
 -        break;
 -    }
 -}
 -#else
 -#define ReformatImage(b,n,bpp,o)
 -#endif
 -
 -/* 64-bit server notes: the protocol restricts padding of images to
 - * 8-, 16-, or 32-bits. We would like to have 64-bits for the server
 - * to use internally. Removes need for internal alignment checking.
 - * All of the PutImage functions could be changed individually, but
 - * as currently written, they call other routines which require things
 - * to be 64-bit padded on scanlines, so we changed things here.
 - * If an image would be padded differently for 64- versus 32-, then
 - * copy each scanline to a 64-bit padded scanline.
 - * Also, we need to make sure that the image is aligned on a 64-bit
 - * boundary, even if the scanlines are padded to our satisfaction.
 - */
 -int
 -ProcPutImage(ClientPtr client)
 -{
 -    GC *pGC;
 -    DrawablePtr pDraw;
 -    long length;                /* length of scanline server padded */
 -    long lengthProto;           /* length of scanline protocol padded */
 -    char *tmpImage;
 -
 -    REQUEST(xPutImageReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xPutImageReq);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -    if (stuff->format == XYBitmap) {
 -        if ((stuff->depth != 1) ||
 -            (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad))
 -            return BadMatch;
 -        length = BitmapBytePad(stuff->width + stuff->leftPad);
 -    }
 -    else if (stuff->format == XYPixmap) {
 -        if ((pDraw->depth != stuff->depth) ||
 -            (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad))
 -            return BadMatch;
 -        length = BitmapBytePad(stuff->width + stuff->leftPad);
 -        length *= stuff->depth;
 -    }
 -    else if (stuff->format == ZPixmap) {
 -        if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))
 -            return BadMatch;
 -        length = PixmapBytePad(stuff->width, stuff->depth);
 -    }
 -    else {
 -        client->errorValue = stuff->format;
 -        return BadValue;
 -    }
 -
 -    tmpImage = (char *) &stuff[1];
 -    lengthProto = length;
 -
 -    if ((bytes_to_int32(lengthProto * stuff->height) +
 -         bytes_to_int32(sizeof(xPutImageReq))) != client->req_len)
 -        return BadLength;
 -
 -    ReformatImage(tmpImage, lengthProto * stuff->height,
 -                  stuff->format == ZPixmap ? BitsPerPixel(stuff->depth) : 1,
 -                  ClientOrder(client));
 -
 -    (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,
 -                           stuff->width, stuff->height,
 -                           stuff->leftPad, stuff->format, tmpImage);
 -
 -    return Success;
 -}
 -
 -static int
 -DoGetImage(ClientPtr client, int format, Drawable drawable,
 -           int x, int y, int width, int height,
 -           Mask planemask)
 -{
 -    DrawablePtr pDraw, pBoundingDraw;
 -    int nlines, linesPerBuf, rc;
 -    int linesDone;
 -
 -    /* coordinates relative to the bounding drawable */
 -    int relx, rely;
 -    long widthBytesLine, length;
 -    Mask plane = 0;
 -    char *pBuf;
 -    xGetImageReply xgi;
 -    RegionPtr pVisibleRegion = NULL;
 -
 -    if ((format != XYPixmap) && (format != ZPixmap)) {
 -        client->errorValue = format;
 -        return BadValue;
 -    }
 -    rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    memset(&xgi, 0, sizeof(xGetImageReply));
 -
 -    relx = x;
 -    rely = y;
 -
 -    if (pDraw->type == DRAWABLE_WINDOW) {
 -        WindowPtr pWin = (WindowPtr) pDraw;
 -
 -        /* "If the drawable is a window, the window must be viewable ... or a
 -         * BadMatch error results" */
 -        if (!pWin->viewable)
 -            return BadMatch;
 -
 -        /* If the drawable is a window, the rectangle must be contained within
 -         * its bounds (including the border). */
 -        if (x < -wBorderWidth(pWin) ||
 -            x + width > wBorderWidth(pWin) + (int) pDraw->width ||
 -            y < -wBorderWidth(pWin) ||
 -            y + height > wBorderWidth(pWin) + (int) pDraw->height)
 -            return BadMatch;
 -
 -        relx += pDraw->x;
 -        rely += pDraw->y;
 -
 -        if (pDraw->pScreen->GetWindowPixmap) {
 -            PixmapPtr pPix = (*pDraw->pScreen->GetWindowPixmap) (pWin);
 -
 -            pBoundingDraw = &pPix->drawable;
 -#ifdef COMPOSITE
 -            relx -= pPix->screen_x;
 -            rely -= pPix->screen_y;
 -#endif
 -        }
 -        else {
 -            pBoundingDraw = (DrawablePtr) pDraw->pScreen->root;
 -        }
 -
 -        xgi.visual = wVisual(pWin);
 -    }
 -    else {
 -        pBoundingDraw = pDraw;
 -        xgi.visual = None;
 -    }
 -
 -    /* "If the drawable is a pixmap, the given rectangle must be wholly
 -     *  contained within the pixmap, or a BadMatch error results.  If the
 -     *  drawable is a window [...] it must be the case that if there were no
 -     *  inferiors or overlapping windows, the specified rectangle of the window
 -     *  would be fully visible on the screen and wholly contained within the
 -     *  outside edges of the window, or a BadMatch error results."
 -     *
 -     * We relax the window case slightly to mean that the rectangle must exist
 -     * within the bounds of the window's backing pixmap.  In particular, this
 -     * means that a GetImage request may succeed or fail with BadMatch depending
 -     * on whether any of its ancestor windows are redirected.  */
 -    if (relx < 0 || relx + width > (int) pBoundingDraw->width ||
 -        rely < 0 || rely + height > (int) pBoundingDraw->height)
 -        return BadMatch;
 -
 -    xgi.type = X_Reply;
 -    xgi.sequenceNumber = client->sequence;
 -    xgi.depth = pDraw->depth;
 -    if (format == ZPixmap) {
 -        widthBytesLine = PixmapBytePad(width, pDraw->depth);
 -        length = widthBytesLine * height;
 -
 -    }
 -    else {
 -        widthBytesLine = BitmapBytePad(width);
 -        plane = ((Mask) 1) << (pDraw->depth - 1);
 -        /* only planes asked for */
 -        length = widthBytesLine * height *
 -            Ones(planemask & (plane | (plane - 1)));
 -
 -    }
 -
 -    xgi.length = length;
 -
 -    xgi.length = bytes_to_int32(xgi.length);
 -    if (widthBytesLine == 0 || height == 0)
 -        linesPerBuf = 0;
 -    else if (widthBytesLine >= IMAGE_BUFSIZE)
 -        linesPerBuf = 1;
 -    else {
 -        linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
 -        if (linesPerBuf > height)
 -            linesPerBuf = height;
 -    }
 -    length = linesPerBuf * widthBytesLine;
 -    if (linesPerBuf < height) {
 -        /* we have to make sure intermediate buffers don't need padding */
 -        while ((linesPerBuf > 1) &&
 -               (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
 -            linesPerBuf--;
 -            length -= widthBytesLine;
 -        }
 -        while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
 -            linesPerBuf++;
 -            length += widthBytesLine;
 -        }
 -    }
 -    if (!(pBuf = calloc(1, length)))
 -        return BadAlloc;
 -    WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
 -
 -    if (pDraw->type == DRAWABLE_WINDOW) {
 -        pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
 -        if (pVisibleRegion) {
 -            RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
 -        }
 -    }
 -
 -    if (linesPerBuf == 0) {
 -        /* nothing to do */
 -    }
 -    else if (format == ZPixmap) {
 -        linesDone = 0;
 -        while (height - linesDone > 0) {
 -            nlines = min(linesPerBuf, height - linesDone);
 -            (*pDraw->pScreen->GetImage) (pDraw,
 -                                         x,
 -                                         y + linesDone,
 -                                         width,
 -                                         nlines,
 -                                         format, planemask, (void *) pBuf);
 -            if (pVisibleRegion)
 -                XaceCensorImage(client, pVisibleRegion, widthBytesLine,
 -                                pDraw, x, y + linesDone, width,
 -                                nlines, format, pBuf);
 -
 -            /* Note that this is NOT a call to WriteSwappedDataToClient,
 -               as we do NOT byte swap */
 -            ReformatImage(pBuf, (int) (nlines * widthBytesLine),
 -                          BitsPerPixel(pDraw->depth), ClientOrder(client));
 -
 -            WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
 -            linesDone += nlines;
 -        }
 -    }
 -    else {                      /* XYPixmap */
 -
 -        for (; plane; plane >>= 1) {
 -            if (planemask & plane) {
 -                linesDone = 0;
 -                while (height - linesDone > 0) {
 -                    nlines = min(linesPerBuf, height - linesDone);
 -                    (*pDraw->pScreen->GetImage) (pDraw,
 -                                                 x,
 -                                                 y + linesDone,
 -                                                 width,
 -                                                 nlines,
 -                                                 format, plane, (void *) pBuf);
 -                    if (pVisibleRegion)
 -                        XaceCensorImage(client, pVisibleRegion,
 -                                        widthBytesLine,
 -                                        pDraw, x, y + linesDone, width,
 -                                        nlines, format, pBuf);
 -
 -                    /* Note: NOT a call to WriteSwappedDataToClient,
 -                       as we do NOT byte swap */
 -                    ReformatImage(pBuf, (int) (nlines * widthBytesLine),
 -                                  1, ClientOrder(client));
 -
 -                    WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
 -                    linesDone += nlines;
 -                }
 -            }
 -        }
 -    }
 -    if (pVisibleRegion)
 -        RegionDestroy(pVisibleRegion);
 -    free(pBuf);
 -    return Success;
 -}
 -
 -int
 -ProcGetImage(ClientPtr client)
 -{
 -    REQUEST(xGetImageReq);
 -
 -    REQUEST_SIZE_MATCH(xGetImageReq);
 -
 -    return DoGetImage(client, stuff->format, stuff->drawable,
 -                      stuff->x, stuff->y,
 -                      (int) stuff->width, (int) stuff->height,
 -                      stuff->planeMask);
 -}
 -
 -int
 -ProcPolyText(ClientPtr client)
 -{
 -    int err;
 -
 -    REQUEST(xPolyTextReq);
 -    DrawablePtr pDraw;
 -    GC *pGC;
 -
 -    REQUEST_AT_LEAST_SIZE(xPolyTextReq);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -
 -    err = PolyText(client,
 -                   pDraw,
 -                   pGC,
 -                   (unsigned char *) &stuff[1],
 -                   ((unsigned char *) stuff) + (client->req_len << 2),
 -                   stuff->x, stuff->y, stuff->reqType, stuff->drawable);
 -
 -    if (err == Success) {
 -        return Success;
 -    }
 -    else
 -        return err;
 -}
 -
 -int
 -ProcImageText8(ClientPtr client)
 -{
 -    int err;
 -    DrawablePtr pDraw;
 -    GC *pGC;
 -
 -    REQUEST(xImageTextReq);
 -
 -    REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -
 -    err = ImageText(client,
 -                    pDraw,
 -                    pGC,
 -                    stuff->nChars,
 -                    (unsigned char *) &stuff[1],
 -                    stuff->x, stuff->y, stuff->reqType, stuff->drawable);
 -
 -    if (err == Success) {
 -        return Success;
 -    }
 -    else
 -        return err;
 -}
 -
 -int
 -ProcImageText16(ClientPtr client)
 -{
 -    int err;
 -    DrawablePtr pDraw;
 -    GC *pGC;
 -
 -    REQUEST(xImageTextReq);
 -
 -    REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
 -    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 -
 -    err = ImageText(client,
 -                    pDraw,
 -                    pGC,
 -                    stuff->nChars,
 -                    (unsigned char *) &stuff[1],
 -                    stuff->x, stuff->y, stuff->reqType, stuff->drawable);
 -
 -    if (err == Success) {
 -        return Success;
 -    }
 -    else
 -        return err;
 -}
 -
 -int
 -ProcCreateColormap(ClientPtr client)
 -{
 -    VisualPtr pVisual;
 -    ColormapPtr pmap;
 -    Colormap mid;
 -    WindowPtr pWin;
 -    ScreenPtr pScreen;
 -
 -    REQUEST(xCreateColormapReq);
 -    int i, result;
 -
 -    REQUEST_SIZE_MATCH(xCreateColormapReq);
 -
 -    if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll)) {
 -        client->errorValue = stuff->alloc;
 -        return BadValue;
 -    }
 -    mid = stuff->mid;
 -    LEGAL_NEW_RESOURCE(mid, client);
 -    result = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
 -    if (result != Success)
 -        return result;
 -
 -    pScreen = pWin->drawable.pScreen;
 -    for (i = 0, pVisual = pScreen->visuals;
 -         i < pScreen->numVisuals; i++, pVisual++) {
 -        if (pVisual->vid != stuff->visual)
 -            continue;
 -        return CreateColormap(mid, pScreen, pVisual, &pmap,
 -                              (int) stuff->alloc, client->index);
 -    }
 -    client->errorValue = stuff->visual;
 -    return BadMatch;
 -}
 -
 -int
 -ProcFreeColormap(ClientPtr client)
 -{
 -    ColormapPtr pmap;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupResourceByType((void **) &pmap, stuff->id, RT_COLORMAP,
 -                                 client, DixDestroyAccess);
 -    if (rc == Success) {
 -        /* Freeing a default colormap is a no-op */
 -        if (!(pmap->flags & IsDefault))
 -            FreeResource(stuff->id, RT_NONE);
 -        return Success;
 -    }
 -    else {
 -        client->errorValue = stuff->id;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcCopyColormapAndFree(ClientPtr client)
 -{
 -    Colormap mid;
 -    ColormapPtr pSrcMap;
 -
 -    REQUEST(xCopyColormapAndFreeReq);
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
 -    mid = stuff->mid;
 -    LEGAL_NEW_RESOURCE(mid, client);
 -    rc = dixLookupResourceByType((void **) &pSrcMap, stuff->srcCmap,
 -                                 RT_COLORMAP, client,
 -                                 DixReadAccess | DixRemoveAccess);
 -    if (rc == Success)
 -        return CopyColormapAndFree(mid, pSrcMap, client->index);
 -    client->errorValue = stuff->srcCmap;
 -    return rc;
 -}
 -
 -int
 -ProcInstallColormap(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
 -                                 client, DixInstallAccess);
 -    if (rc != Success)
 -        goto out;
 -
 -    rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
 -    if (rc != Success) {
 -        if (rc == BadValue)
 -            rc = BadColor;
 -        goto out;
 -    }
 -
 -    (*(pcmp->pScreen->InstallColormap)) (pcmp);
 -    return Success;
 -
 - out:
 -    client->errorValue = stuff->id;
 -    return rc;
 -}
 -
 -int
 -ProcUninstallColormap(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
 -                                 client, DixUninstallAccess);
 -    if (rc != Success)
 -        goto out;
 -
 -    rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
 -    if (rc != Success) {
 -        if (rc == BadValue)
 -            rc = BadColor;
 -        goto out;
 -    }
 -
 -    if (pcmp->mid != pcmp->pScreen->defColormap)
 -        (*(pcmp->pScreen->UninstallColormap)) (pcmp);
 -    return Success;
 -
 - out:
 -    client->errorValue = stuff->id;
 -    return rc;
 -}
 -
 -int
 -ProcListInstalledColormaps(ClientPtr client)
 -{
 -    xListInstalledColormapsReply *preply;
 -    int nummaps, rc;
 -    WindowPtr pWin;
 -
 -    REQUEST(xResourceReq);
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -
 -    rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
 -                  DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    preply = malloc(sizeof(xListInstalledColormapsReply) +
 -                    pWin->drawable.pScreen->maxInstalledCmaps *
 -                    sizeof(Colormap));
 -    if (!preply)
 -        return BadAlloc;
 -
 -    preply->type = X_Reply;
 -    preply->sequenceNumber = client->sequence;
 -    nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
 -        (pWin->drawable.pScreen, (Colormap *) &preply[1]);
 -    preply->nColormaps = nummaps;
 -    preply->length = nummaps;
 -    WriteReplyToClient(client, sizeof(xListInstalledColormapsReply), preply);
 -    client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 -    WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
 -    free(preply);
 -    return Success;
 -}
 -
 -int
 -ProcAllocColor(ClientPtr client)
 -{
 -    ColormapPtr pmap;
 -    int rc;
 -
 -    REQUEST(xAllocColorReq);
 -
 -    REQUEST_SIZE_MATCH(xAllocColorReq);
 -    rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, RT_COLORMAP,
 -                                 client, DixAddAccess);
 -    if (rc == Success) {
 -        xAllocColorReply acr = {
 -            .type = X_Reply,
 -            .sequenceNumber = client->sequence,
 -            .length = 0,
 -            .red = stuff->red,
 -            .green = stuff->green,
 -            .blue = stuff->blue,
 -            .pixel = 0
 -        };
 -        if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
 -                             &acr.pixel, client->index)))
 -            return rc;
 -#ifdef PANORAMIX
 -        if (noPanoramiXExtension || !pmap->pScreen->myNum)
 -#endif
 -            WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
 -        return Success;
 -
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcAllocNamedColor(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xAllocNamedColorReq);
 -
 -    REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 -                                 client, DixAddAccess);
 -    if (rc == Success) {
 -        xAllocNamedColorReply ancr = {
 -            .type = X_Reply,
 -            .sequenceNumber = client->sequence,
 -            .length = 0
 -        };
 -        if (OsLookupColor
 -            (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
 -             &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
 -            ancr.screenRed = ancr.exactRed;
 -            ancr.screenGreen = ancr.exactGreen;
 -            ancr.screenBlue = ancr.exactBlue;
 -            ancr.pixel = 0;
 -            if ((rc = AllocColor(pcmp,
 -                                 &ancr.screenRed, &ancr.screenGreen,
 -                                 &ancr.screenBlue, &ancr.pixel, client->index)))
 -                return rc;
 -#ifdef PANORAMIX
 -            if (noPanoramiXExtension || !pcmp->pScreen->myNum)
 -#endif
 -                WriteReplyToClient(client, sizeof(xAllocNamedColorReply),
 -                                   &ancr);
 -            return Success;
 -        }
 -        else
 -            return BadName;
 -
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcAllocColorCells(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xAllocColorCellsReq);
 -
 -    REQUEST_SIZE_MATCH(xAllocColorCellsReq);
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 -                                 client, DixAddAccess);
 -    if (rc == Success) {
 -        int npixels, nmasks;
 -        long length;
 -        Pixel *ppixels, *pmasks;
 -
 -        npixels = stuff->colors;
 -        if (!npixels) {
 -            client->errorValue = npixels;
 -            return BadValue;
 -        }
 -        if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) {
 -            client->errorValue = stuff->contiguous;
 -            return BadValue;
 -        }
 -        nmasks = stuff->planes;
 -        length = ((long) npixels + (long) nmasks) * sizeof(Pixel);
 -        ppixels = malloc(length);
 -        if (!ppixels)
 -            return BadAlloc;
 -        pmasks = ppixels + npixels;
 -
 -        if ((rc = AllocColorCells(client->index, pcmp, npixels, nmasks,
 -                                  (Bool) stuff->contiguous, ppixels, pmasks))) {
 -            free(ppixels);
 -            return rc;
 -        }
 -#ifdef PANORAMIX
 -        if (noPanoramiXExtension || !pcmp->pScreen->myNum)
 -#endif
 -        {
 -            xAllocColorCellsReply accr = {
 -                .type = X_Reply,
 -                .sequenceNumber = client->sequence,
 -                .length = bytes_to_int32(length),
 -                .nPixels = npixels,
 -                .nMasks = nmasks
 -            };
 -            WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
 -            client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 -            WriteSwappedDataToClient(client, length, ppixels);
 -        }
 -        free(ppixels);
 -        return Success;
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcAllocColorPlanes(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xAllocColorPlanesReq);
 -
 -    REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 -                                 client, DixAddAccess);
 -    if (rc == Success) {
 -        xAllocColorPlanesReply acpr;
 -        int npixels;
 -        long length;
 -        Pixel *ppixels;
 -
 -        npixels = stuff->colors;
 -        if (!npixels) {
 -            client->errorValue = npixels;
 -            return BadValue;
 -        }
 -        if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) {
 -            client->errorValue = stuff->contiguous;
 -            return BadValue;
 -        }
 -        acpr = (xAllocColorPlanesReply) {
 -            .type = X_Reply,
 -            .sequenceNumber = client->sequence,
 -            .nPixels = npixels
 -        };
 -        length = (long) npixels *sizeof(Pixel);
 -
 -        ppixels = malloc(length);
 -        if (!ppixels)
 -            return BadAlloc;
 -        if ((rc = AllocColorPlanes(client->index, pcmp, npixels,
 -                                   (int) stuff->red, (int) stuff->green,
 -                                   (int) stuff->blue, (Bool) stuff->contiguous,
 -                                   ppixels, &acpr.redMask, &acpr.greenMask,
 -                                   &acpr.blueMask))) {
 -            free(ppixels);
 -            return rc;
 -        }
 -        acpr.length = bytes_to_int32(length);
 -#ifdef PANORAMIX
 -        if (noPanoramiXExtension || !pcmp->pScreen->myNum)
 -#endif
 -        {
 -            WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
 -            client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 -            WriteSwappedDataToClient(client, length, ppixels);
 -        }
 -        free(ppixels);
 -        return Success;
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcFreeColors(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xFreeColorsReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 -                                 client, DixRemoveAccess);
 -    if (rc == Success) {
 -        int count;
 -
 -        if (pcmp->flags & AllAllocated)
 -            return BadAccess;
 -        count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
 -        return FreeColors(pcmp, client->index, count,
 -                          (Pixel *) &stuff[1], (Pixel) stuff->planeMask);
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcStoreColors(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xStoreColorsReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 -                                 client, DixWriteAccess);
 -    if (rc == Success) {
 -        int count;
 -
 -        count = (client->req_len << 2) - sizeof(xStoreColorsReq);
 -        if (count % sizeof(xColorItem))
 -            return BadLength;
 -        count /= sizeof(xColorItem);
 -        return StoreColors(pcmp, count, (xColorItem *) &stuff[1], client);
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcStoreNamedColor(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xStoreNamedColorReq);
 -
 -    REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 -                                 client, DixWriteAccess);
 -    if (rc == Success) {
 -        xColorItem def;
 -
 -        if (OsLookupColor(pcmp->pScreen->myNum, (char *) &stuff[1],
 -                          stuff->nbytes, &def.red, &def.green, &def.blue)) {
 -            def.flags = stuff->flags;
 -            def.pixel = stuff->pixel;
 -            return StoreColors(pcmp, 1, &def, client);
 -        }
 -        return BadName;
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcQueryColors(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xQueryColorsReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 -                                 client, DixReadAccess);
 -    if (rc == Success) {
 -        int count;
 -        xrgb *prgbs;
 -        xQueryColorsReply qcr;
 -
 -        count =
 -            bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
 -        prgbs = calloc(1, count * sizeof(xrgb));
 -        if (!prgbs && count)
 -            return BadAlloc;
 -        if ((rc =
 -             QueryColors(pcmp, count, (Pixel *) &stuff[1], prgbs, client))) {
 -            free(prgbs);
 -            return rc;
 -        }
 -        qcr = (xQueryColorsReply) {
 -            .type = X_Reply,
 -            .sequenceNumber = client->sequence,
 -            .length = bytes_to_int32(count * sizeof(xrgb)),
 -            .nColors = count
 -        };
 -        WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
 -        if (count) {
 -            client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
 -            WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
 -        }
 -        free(prgbs);
 -        return Success;
 -
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcLookupColor(ClientPtr client)
 -{
 -    ColormapPtr pcmp;
 -    int rc;
 -
 -    REQUEST(xLookupColorReq);
 -
 -    REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
 -    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 -                                 client, DixReadAccess);
 -    if (rc == Success) {
 -        CARD16 exactRed, exactGreen, exactBlue;
 -
 -        if (OsLookupColor
 -            (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
 -             &exactRed, &exactGreen, &exactBlue)) {
 -            xLookupColorReply lcr = {
 -                .type = X_Reply,
 -                .sequenceNumber = client->sequence,
 -                .length = 0,
 -                .exactRed = exactRed,
 -                .exactGreen = exactGreen,
 -                .exactBlue = exactBlue,
 -                .screenRed = exactRed,
 -                .screenGreen = exactGreen,
 -                .screenBlue = exactBlue
 -            };
 -            (*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
 -                                            &lcr.screenGreen,
 -                                            &lcr.screenBlue, pcmp->pVisual);
 -            WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
 -            return Success;
 -        }
 -        return BadName;
 -    }
 -    else {
 -        client->errorValue = stuff->cmap;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcCreateCursor(ClientPtr client)
 -{
 -    CursorPtr pCursor;
 -    PixmapPtr src;
 -    PixmapPtr msk;
 -    unsigned char *srcbits;
 -    unsigned char *mskbits;
 -    unsigned short width, height;
 -    long n;
 -    CursorMetricRec cm;
 -    int rc;
 -
 -    REQUEST(xCreateCursorReq);
 -
 -    REQUEST_SIZE_MATCH(xCreateCursorReq);
 -    LEGAL_NEW_RESOURCE(stuff->cid, client);
 -
 -    rc = dixLookupResourceByType((void **) &src, stuff->source, RT_PIXMAP,
 -                                 client, DixReadAccess);
 -    if (rc != Success) {
 -        client->errorValue = stuff->source;
 -        return rc;
 -    }
 -
 -    if (src->drawable.depth != 1)
 -        return (BadMatch);
 -
 -    /* Find and validate cursor mask pixmap, if one is provided */
 -    if (stuff->mask != None) {
 -        rc = dixLookupResourceByType((void **) &msk, stuff->mask, RT_PIXMAP,
 -                                     client, DixReadAccess);
 -        if (rc != Success) {
 -            client->errorValue = stuff->mask;
 -            return rc;
 -        }
 -
 -        if (src->drawable.width != msk->drawable.width
 -            || src->drawable.height != msk->drawable.height
 -            || src->drawable.depth != 1 || msk->drawable.depth != 1)
 -            return BadMatch;
 -    }
 -    else
 -        msk = NULL;
 -
 -    width = src->drawable.width;
 -    height = src->drawable.height;
 -
 -    if (stuff->x > width || stuff->y > height)
 -        return BadMatch;
 -
 -    n = BitmapBytePad(width) * height;
 -    srcbits = calloc(1, n);
 -    if (!srcbits)
 -        return BadAlloc;
 -    mskbits = malloc(n);
 -    if (!mskbits) {
 -        free(srcbits);
 -        return BadAlloc;
 -    }
 -
 -    (*src->drawable.pScreen->GetImage) ((DrawablePtr) src, 0, 0, width, height,
 -                                        XYPixmap, 1, (void *) srcbits);
 -    if (msk == (PixmapPtr) NULL) {
 -        unsigned char *bits = mskbits;
 -
 -        while (--n >= 0)
 -            *bits++ = ~0;
 -    }
 -    else {
 -        /* zeroing the (pad) bits helps some ddx cursor handling */
 -        memset((char *) mskbits, 0, n);
 -        (*msk->drawable.pScreen->GetImage) ((DrawablePtr) msk, 0, 0, width,
 -                                            height, XYPixmap, 1,
 -                                            (void *) mskbits);
 -    }
 -    cm.width = width;
 -    cm.height = height;
 -    cm.xhot = stuff->x;
 -    cm.yhot = stuff->y;
 -    rc = AllocARGBCursor(srcbits, mskbits, NULL, &cm,
 -                         stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
 -                         stuff->backRed, stuff->backGreen, stuff->backBlue,
 -                         &pCursor, client, stuff->cid);
 -
 -    if (rc != Success)
 -        goto bail;
 -    if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
 -        rc = BadAlloc;
 -        goto bail;
 -    }
 -
 -    return Success;
 - bail:
 -    free(srcbits);
 -    free(mskbits);
 -    return rc;
 -}
 -
 -int
 -ProcCreateGlyphCursor(ClientPtr client)
 -{
 -    CursorPtr pCursor;
 -    int res;
 -
 -    REQUEST(xCreateGlyphCursorReq);
 -
 -    REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
 -    LEGAL_NEW_RESOURCE(stuff->cid, client);
 -
 -    res = AllocGlyphCursor(stuff->source, stuff->sourceChar,
 -                           stuff->mask, stuff->maskChar,
 -                           stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
 -                           stuff->backRed, stuff->backGreen, stuff->backBlue,
 -                           &pCursor, client, stuff->cid);
 -    if (res != Success)
 -        return res;
 -    if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
 -        return Success;
 -    return BadAlloc;
 -}
 -
 -int
 -ProcFreeCursor(ClientPtr client)
 -{
 -    CursorPtr pCursor;
 -    int rc;
 -
 -    REQUEST(xResourceReq);
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR,
 -                                 client, DixDestroyAccess);
 -    if (rc == Success) {
 -        FreeResource(stuff->id, RT_NONE);
 -        return Success;
 -    }
 -    else {
 -        client->errorValue = stuff->id;
 -        return rc;
 -    }
 -}
 -
 -int
 -ProcQueryBestSize(ClientPtr client)
 -{
 -    xQueryBestSizeReply reply;
 -    DrawablePtr pDraw;
 -    ScreenPtr pScreen;
 -    int rc;
 -
 -    REQUEST(xQueryBestSizeReq);
 -    REQUEST_SIZE_MATCH(xQueryBestSizeReq);
 -
 -    if ((stuff->class != CursorShape) &&
 -        (stuff->class != TileShape) && (stuff->class != StippleShape)) {
 -        client->errorValue = stuff->class;
 -        return BadValue;
 -    }
 -
 -    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
 -                           DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -    if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
 -        return BadMatch;
 -    pScreen = pDraw->pScreen;
 -    rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
 -    if (rc != Success)
 -        return rc;
 -    (*pScreen->QueryBestSize) (stuff->class, &stuff->width,
 -                               &stuff->height, pScreen);
 -    reply = (xQueryBestSizeReply) {
 -        .type = X_Reply,
 -        .sequenceNumber = client->sequence,
 -        .length = 0,
 -        .width = stuff->width,
 -        .height = stuff->height
 -    };
 -    WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
 -    return Success;
 -}
 -
 -int
 -ProcSetScreenSaver(ClientPtr client)
 -{
 -    int rc, i, blankingOption, exposureOption;
 -
 -    REQUEST(xSetScreenSaverReq);
 -    REQUEST_SIZE_MATCH(xSetScreenSaverReq);
 -
 -    for (i = 0; i < screenInfo.numScreens; i++) {
 -        rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
 -                      DixSetAttrAccess);
 -        if (rc != Success)
 -            return rc;
 -    }
 -
 -    blankingOption = stuff->preferBlank;
 -    if ((blankingOption != DontPreferBlanking) &&
 -        (blankingOption != PreferBlanking) &&
 -        (blankingOption != DefaultBlanking)) {
 -        client->errorValue = blankingOption;
 -        return BadValue;
 -    }
 -    exposureOption = stuff->allowExpose;
 -    if ((exposureOption != DontAllowExposures) &&
 -        (exposureOption != AllowExposures) &&
 -        (exposureOption != DefaultExposures)) {
 -        client->errorValue = exposureOption;
 -        return BadValue;
 -    }
 -    if (stuff->timeout < -1) {
 -        client->errorValue = stuff->timeout;
 -        return BadValue;
 -    }
 -    if (stuff->interval < -1) {
 -        client->errorValue = stuff->interval;
 -        return BadValue;
 -    }
 -
 -    if (blankingOption == DefaultBlanking)
 -        ScreenSaverBlanking = defaultScreenSaverBlanking;
 -    else
 -        ScreenSaverBlanking = blankingOption;
 -    if (exposureOption == DefaultExposures)
 -        ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
 -    else
 -        ScreenSaverAllowExposures = exposureOption;
 -
 -    if (stuff->timeout >= 0)
 -        ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND;
 -    else
 -        ScreenSaverTime = defaultScreenSaverTime;
 -    if (stuff->interval >= 0)
 -        ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND;
 -    else
 -        ScreenSaverInterval = defaultScreenSaverInterval;
 -
 -    SetScreenSaverTimer();
 -    return Success;
 -}
 -
 -int
 -ProcGetScreenSaver(ClientPtr client)
 -{
 -    xGetScreenSaverReply rep;
 -    int rc, i;
 -
 -    REQUEST_SIZE_MATCH(xReq);
 -
 -    for (i = 0; i < screenInfo.numScreens; i++) {
 -        rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
 -                      DixGetAttrAccess);
 -        if (rc != Success)
 -            return rc;
 -    }
 -
 -    rep = (xGetScreenSaverReply) {
 -        .type = X_Reply,
 -        .sequenceNumber = client->sequence,
 -        .length = 0,
 -        .timeout = ScreenSaverTime / MILLI_PER_SECOND,
 -        .interval = ScreenSaverInterval / MILLI_PER_SECOND,
 -        .preferBlanking = ScreenSaverBlanking,
 -        .allowExposures = ScreenSaverAllowExposures
 -    };
 -    WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep);
 -    return Success;
 -}
 -
 -int
 -ProcChangeHosts(ClientPtr client)
 -{
 -    REQUEST(xChangeHostsReq);
 -
 -    REQUEST_FIXED_SIZE(xChangeHostsReq, stuff->hostLength);
 -
 -    if (stuff->mode == HostInsert)
 -        return AddHost(client, (int) stuff->hostFamily,
 -                       stuff->hostLength, (void *) &stuff[1]);
 -    if (stuff->mode == HostDelete)
 -        return RemoveHost(client, (int) stuff->hostFamily,
 -                          stuff->hostLength, (void *) &stuff[1]);
 -    client->errorValue = stuff->mode;
 -    return BadValue;
 -}
 -
 -int
 -ProcListHosts(ClientPtr client)
 -{
 -    xListHostsReply reply;
 -    int len, nHosts, result;
 -    BOOL enabled;
 -    void *pdata;
 -
 -    /* REQUEST(xListHostsReq); */
 -
 -    REQUEST_SIZE_MATCH(xListHostsReq);
 -
 -    /* untrusted clients can't list hosts */
 -    result = XaceHook(XACE_SERVER_ACCESS, client, DixReadAccess);
 -    if (result != Success)
 -        return result;
 -
 -    result = GetHosts(&pdata, &nHosts, &len, &enabled);
 -    if (result != Success)
 -        return result;
 -
 -    reply = (xListHostsReply) {
 -        .type = X_Reply,
 -        .enabled = enabled,
 -        .sequenceNumber = client->sequence,
 -        .length = bytes_to_int32(len),
 -        .nHosts = nHosts
 -    };
 -    WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
 -    if (nHosts) {
 -        client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
 -        WriteSwappedDataToClient(client, len, pdata);
 -    }
 -    free(pdata);
 -    return Success;
 -}
 -
 -int
 -ProcChangeAccessControl(ClientPtr client)
 -{
 -    REQUEST(xSetAccessControlReq);
 -
 -    REQUEST_SIZE_MATCH(xSetAccessControlReq);
 -    if ((stuff->mode != EnableAccess) && (stuff->mode != DisableAccess)) {
 -        client->errorValue = stuff->mode;
 -        return BadValue;
 -    }
 -    return ChangeAccessControl(client, stuff->mode == EnableAccess);
 -}
 -
 -/*********************
 - * CloseDownRetainedResources
 - *
 - *    Find all clients that are gone and have terminated in RetainTemporary
 - *    and destroy their resources.
 - *********************/
 -
 -static void
 -CloseDownRetainedResources(void)
 -{
 -    int i;
 -    ClientPtr client;
 -
 -    for (i = 1; i < currentMaxClients; i++) {
 -        client = clients[i];
 -        if (client && (client->closeDownMode == RetainTemporary)
 -            && (client->clientGone))
 -            CloseDownClient(client);
 -    }
 -}
 -
 -int
 -ProcKillClient(ClientPtr client)
 -{
 -    REQUEST(xResourceReq);
 -    ClientPtr killclient;
 -    int rc;
 -
 -    REQUEST_SIZE_MATCH(xResourceReq);
 -    if (stuff->id == AllTemporary) {
 -        CloseDownRetainedResources();
 -        return Success;
 -    }
 -
 -    rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
 -    if (rc == Success) {
 -        CloseDownClient(killclient);
 -        if (client == killclient) {
 -            /* force yield and return Success, so that Dispatch()
 -             * doesn't try to touch client
 -             */
 -            isItTimeToYield = TRUE;
 -        }
 -        return Success;
 -    }
 -    else
 -        return rc;
 -}
 -
 -int
 -ProcSetFontPath(ClientPtr client)
 -{
 -    unsigned char *ptr;
 -    unsigned long nbytes, total;
 -    long nfonts;
 -    int n;
 -
 -    REQUEST(xSetFontPathReq);
 -
 -    REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
 -
 -    nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
 -    total = nbytes;
 -    ptr = (unsigned char *) &stuff[1];
 -    nfonts = stuff->nFonts;
 -    while (--nfonts >= 0) {
 -        if ((total == 0) || (total < (n = (*ptr + 1))))
 -            return BadLength;
 -        total -= n;
 -        ptr += n;
 -    }
 -    if (total >= 4)
 -        return BadLength;
 -    return SetFontPath(client, stuff->nFonts, (unsigned char *) &stuff[1]);
 -}
 -
 -int
 -ProcGetFontPath(ClientPtr client)
 -{
 -    xGetFontPathReply reply;
 -    int rc, stringLens, numpaths;
 -    unsigned char *bufferStart;
 -
 -    /* REQUEST (xReq); */
 -
 -    REQUEST_SIZE_MATCH(xReq);
 -    rc = GetFontPath(client, &numpaths, &stringLens, &bufferStart);
 -    if (rc != Success)
 -        return rc;
 -
 -    reply = (xGetFontPathReply) {
 -        .type = X_Reply,
 -        .sequenceNumber = client->sequence,
 -        .length = bytes_to_int32(stringLens + numpaths),
 -        .nPaths = numpaths
 -    };
 -
 -    WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
 -    if (stringLens || numpaths)
 -        WriteToClient(client, stringLens + numpaths, bufferStart);
 -    return Success;
 -}
 -
 -int
 -ProcChangeCloseDownMode(ClientPtr client)
 -{
 -    int rc;
 -
 -    REQUEST(xSetCloseDownModeReq);
 -    REQUEST_SIZE_MATCH(xSetCloseDownModeReq);
 -
 -    rc = XaceHook(XACE_CLIENT_ACCESS, client, client, DixManageAccess);
 -    if (rc != Success)
 -        return rc;
 -
 -    if ((stuff->mode == AllTemporary) ||
 -        (stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) {
 -        client->closeDownMode = stuff->mode;
 -        return Success;
 -    }
 -    else {
 -        client->errorValue = stuff->mode;
 -        return BadValue;
 -    }
 -}
 -
 -int
 -ProcForceScreenSaver(ClientPtr client)
 -{
 -    int rc;
 -
 -    REQUEST(xForceScreenSaverReq);
 -
 -    REQUEST_SIZE_MATCH(xForceScreenSaverReq);
 -
 -    if ((stuff->mode != ScreenSaverReset) && (stuff->mode != ScreenSaverActive)) {
 -        client->errorValue = stuff->mode;
 -        return BadValue;
 -    }
 -    rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int) stuff->mode);
 -    if (rc != Success)
 -        return rc;
 -    return Success;
 -}
 -
 -int
 -ProcNoOperation(ClientPtr client)
 -{
 -    REQUEST_AT_LEAST_SIZE(xReq);
 -
 -    /* noop -- don't do anything */
 -    return Success;
 -}
 -
 -/**********************
 - * CloseDownClient
 - *
 - *  Client can either mark his resources destroy or retain.  If retained and
 - *  then killed again, the client is really destroyed.
 - *********************/
 -
 -char dispatchExceptionAtReset = DE_RESET;
 -
 -void
 -CloseDownClient(ClientPtr client)
 -{
 -    Bool really_close_down = client->clientGone ||
 -        client->closeDownMode == DestroyAll;
 -
 -    if (!client->clientGone) {
 -        /* ungrab server if grabbing client dies */
 -        if (grabState != GrabNone && grabClient == client) {
 -            UngrabServer(client);
 -        }
 -        BITCLEAR(grabWaiters, client->index);
 -        DeleteClientFromAnySelections(client);
 -        ReleaseActiveGrabs(client);
 -        DeleteClientFontStuff(client);
 -        if (!really_close_down) {
 -            /*  This frees resources that should never be retained
 -             *  no matter what the close down mode is.  Actually we
 -             *  could do this unconditionally, but it's probably
 -             *  better not to traverse all the client's resources
 -             *  twice (once here, once a few lines down in
 -             *  FreeClientResources) in the common case of
 -             *  really_close_down == TRUE.
 -             */
 -            FreeClientNeverRetainResources(client);
 -            client->clientState = ClientStateRetained;
 -            if (ClientStateCallback) {
 -                NewClientInfoRec clientinfo;
 -
 -                clientinfo.client = client;
 -                clientinfo.prefix = (xConnSetupPrefix *) NULL;
 -                clientinfo.setup = (xConnSetup *) NULL;
 -                CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
 -            }
 -        }
 -        client->clientGone = TRUE;      /* so events aren't sent to client */
 -        if (ClientIsAsleep(client))
 -            ClientSignal(client);
 -        ProcessWorkQueueZombies();
 -        CloseDownConnection(client);
 -
 -        /* If the client made it to the Running stage, nClients has
 -         * been incremented on its behalf, so we need to decrement it
 -         * now.  If it hasn't gotten to Running, nClients has *not*
 -         * been incremented, so *don't* decrement it.
 -         */
 -        if (client->clientState != ClientStateInitial) {
 -            --nClients;
 -        }
 -    }
 -
 -    if (really_close_down) {
 -        if (client->clientState == ClientStateRunning && nClients == 0)
 -            dispatchException |= dispatchExceptionAtReset;
 -
 -        client->clientState = ClientStateGone;
 -        if (ClientStateCallback) {
 -            NewClientInfoRec clientinfo;
 -
 -            clientinfo.client = client;
 -            clientinfo.prefix = (xConnSetupPrefix *) NULL;
 -            clientinfo.setup = (xConnSetup *) NULL;
 -            CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
 -        }
 -        TouchListenerGone(client->clientAsMask);
 -        FreeClientResources(client);
 -        /* Disable client ID tracking. This must be done after
 -         * ClientStateCallback. */
 -        ReleaseClientIds(client);
 -#ifdef XSERVER_DTRACE
 -        XSERVER_CLIENT_DISCONNECT(client->index);
 -#endif
 -        if (client->index < nextFreeClientID)
 -            nextFreeClientID = client->index;
 -        clients[client->index] = NullClient;
 -        SmartLastClient = NullClient;
 -        dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
 -
 -        while (!clients[currentMaxClients - 1])
 -            currentMaxClients--;
 -    }
 -}
 -
 -static void
 -KillAllClients(void)
 -{
 -    int i;
 -
 -    for (i = 1; i < currentMaxClients; i++)
 -        if (clients[i]) {
 -            /* Make sure Retained clients are released. */
 -            clients[i]->closeDownMode = DestroyAll;
 -            CloseDownClient(clients[i]);
 -        }
 -}
 -
 -void
 -InitClient(ClientPtr client, int i, void *ospriv)
 -{
 -    client->index = i;
 -    client->clientAsMask = ((Mask) i) << CLIENTOFFSET;
 -    client->closeDownMode = i ? DestroyAll : RetainPermanent;
 -    client->requestVector = InitialVector;
 -    client->osPrivate = ospriv;
 -    QueryMinMaxKeyCodes(&client->minKC, &client->maxKC);
 -    client->smart_start_tick = SmartScheduleTime;
 -    client->smart_stop_tick = SmartScheduleTime;
 -    client->clientIds = NULL;
 -}
 -
 -/************************
 - * int NextAvailableClient(ospriv)
 - *
 - * OS dependent portion can't assign client id's because of CloseDownModes.
 - * Returns NULL if there are no free clients.
 - *************************/
 -
 -ClientPtr
 -NextAvailableClient(void *ospriv)
 -{
 -    int i;
 -    ClientPtr client;
 -    xReq data;
 -
 -    i = nextFreeClientID;
 -    if (i == MAXCLIENTS)
 -        return (ClientPtr) NULL;
 -    clients[i] = client =
 -        dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
 -    if (!client)
 -        return (ClientPtr) NULL;
 -    InitClient(client, i, ospriv);
 -    if (!InitClientResources(client)) {
 -        dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
 -        return (ClientPtr) NULL;
 -    }
 -    data.reqType = 1;
 -    data.length = bytes_to_int32(sz_xReq + sz_xConnClientPrefix);
 -    if (!InsertFakeRequest(client, (char *) &data, sz_xReq)) {
 -        FreeClientResources(client);
 -        dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
 -        return (ClientPtr) NULL;
 -    }
 -    if (i == currentMaxClients)
 -        currentMaxClients++;
 -    while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID])
 -        nextFreeClientID++;
 -
 -    /* Enable client ID tracking. This must be done before
 -     * ClientStateCallback. */
 -    ReserveClientIds(client);
 -
 -    if (ClientStateCallback) {
 -        NewClientInfoRec clientinfo;
 -
 -        clientinfo.client = client;
 -        clientinfo.prefix = (xConnSetupPrefix *) NULL;
 -        clientinfo.setup = (xConnSetup *) NULL;
 -        CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
 -    }
 -    return client;
 -}
 -
 -int
 -ProcInitialConnection(ClientPtr client)
 -{
 -    REQUEST(xReq);
 -    xConnClientPrefix *prefix;
 -    int whichbyte = 1;
 -    char order;
 -
 -    prefix = (xConnClientPrefix *) ((char *)stuff + sz_xReq);
 -    order = prefix->byteOrder;
 -    if (order != 'l' && order != 'B' && order != 'r' && order != 'R')
 -	return client->noClientException = -1;
 -    if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
 -	(!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) {
 -	client->swapped = TRUE;
 -	SwapConnClientPrefix(prefix);
 -    }
 -    stuff->reqType = 2;
 -    stuff->length += bytes_to_int32(prefix->nbytesAuthProto) +
 -        bytes_to_int32(prefix->nbytesAuthString);
 -    if (client->swapped) {
 -        swaps(&stuff->length);
 -    }
 -    if (order == 'r' || order == 'R') {
 -	client->local = FALSE;
 -    }
 -    ResetCurrentRequest(client);
 -    return Success;
 -}
 -
 -static int
 -SendConnSetup(ClientPtr client, const char *reason)
 -{
 -    xWindowRoot *root;
 -    int i;
 -    int numScreens;
 -    char *lConnectionInfo;
 -    xConnSetupPrefix *lconnSetupPrefix;
 -
 -    if (reason) {
 -        xConnSetupPrefix csp;
 -
 -        csp.success = xFalse;
 -        csp.lengthReason = strlen(reason);
 -        csp.length = bytes_to_int32(csp.lengthReason);
 -        csp.majorVersion = X_PROTOCOL;
 -        csp.minorVersion = X_PROTOCOL_REVISION;
 -        if (client->swapped)
 -            WriteSConnSetupPrefix(client, &csp);
 -        else
 -            WriteToClient(client, sz_xConnSetupPrefix, &csp);
 -        WriteToClient(client, (int) csp.lengthReason, reason);
 -        return client->noClientException = -1;
 -    }
 -
 -    numScreens = screenInfo.numScreens;
 -    lConnectionInfo = ConnectionInfo;
 -    lconnSetupPrefix = &connSetupPrefix;
 -
 -    /* We're about to start speaking X protocol back to the client by
 -     * sending the connection setup info.  This means the authorization
 -     * step is complete, and we can count the client as an
 -     * authorized one.
 -     */
 -    nClients++;
 -
 -    client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
 -    client->sequence = 0;
 -    ((xConnSetup *) lConnectionInfo)->ridBase = client->clientAsMask;
 -    ((xConnSetup *) lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
 -#ifdef MATCH_CLIENT_ENDIAN
 -    ((xConnSetup *) lConnectionInfo)->imageByteOrder = ClientOrder(client);
 -    ((xConnSetup *) lConnectionInfo)->bitmapBitOrder = ClientOrder(client);
 -#endif
 -    /* fill in the "currentInputMask" */
 -    root = (xWindowRoot *) (lConnectionInfo + connBlockScreenStart);
 -#ifdef PANORAMIX
 -    if (noPanoramiXExtension)
 -        numScreens = screenInfo.numScreens;
 -    else
 -        numScreens = ((xConnSetup *) ConnectionInfo)->numRoots;
 -#endif
 -
 -    for (i = 0; i < numScreens; i++) {
 -        unsigned int j;
 -        xDepth *pDepth;
 -        WindowPtr pRoot = screenInfo.screens[i]->root;
 -
 -        root->currentInputMask = pRoot->eventMask | wOtherEventMasks(pRoot);
 -        pDepth = (xDepth *) (root + 1);
 -        for (j = 0; j < root->nDepths; j++) {
 -            pDepth = (xDepth *) (((char *) (pDepth + 1)) +
 -                                 pDepth->nVisuals * sizeof(xVisualType));
 -        }
 -        root = (xWindowRoot *) pDepth;
 -    }
 -
 -    if (client->swapped) {
 -        WriteSConnSetupPrefix(client, lconnSetupPrefix);
 -        WriteSConnectionInfo(client,
 -                             (unsigned long) (lconnSetupPrefix->length << 2),
 -                             lConnectionInfo);
 -    }
 -    else {
 -        WriteToClient(client, sizeof(xConnSetupPrefix), lconnSetupPrefix);
 -        WriteToClient(client, (int) (lconnSetupPrefix->length << 2),
 -		      lConnectionInfo);
 -    }
 -    client->clientState = ClientStateRunning;
 -    if (ClientStateCallback) {
 -        NewClientInfoRec clientinfo;
 -
 -        clientinfo.client = client;
 -        clientinfo.prefix = lconnSetupPrefix;
 -        clientinfo.setup = (xConnSetup *) lConnectionInfo;
 -        CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
 -    }
 -    return Success;
 -}
 -
 -int
 -ProcEstablishConnection(ClientPtr client)
 -{
 -    const char *reason;
 -    char *auth_proto, *auth_string;
 -    xConnClientPrefix *prefix;
 -
 -    REQUEST(xReq);
 -
 -    prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
 -    auth_proto = (char *) prefix + sz_xConnClientPrefix;
 -    auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto);
 -    if ((prefix->majorVersion != X_PROTOCOL) ||
 -        (prefix->minorVersion != X_PROTOCOL_REVISION))
 -        reason = "Protocol version mismatch";
 -    else
 -        reason = ClientAuthorized(client,
 -                                  (unsigned short) prefix->nbytesAuthProto,
 -                                  auth_proto,
 -                                  (unsigned short) prefix->nbytesAuthString,
 -                                  auth_string);
 -
 -    return (SendConnSetup(client, reason));
 -}
 -
 -void
 -SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
 -                  XID resId, int errorCode)
 -{
 -    xError rep = {
 -        .type = X_Error,
 -        .errorCode = errorCode,
 -        .resourceID = resId,
 -        .minorCode = minorCode,
 -        .majorCode = majorCode
 -    };
 -
 -    WriteEventsToClient(client, 1, (xEvent *) &rep);
 -}
 -
 -void
 -MarkClientException(ClientPtr client)
 -{
 -    client->noClientException = -1;
 -}
 -
 -/*
 - * This array encodes the answer to the question "what is the log base 2
 - * of the number of pixels that fit in a scanline pad unit?"
 - * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
 - */
 -static int answer[6][4] = {
 -    /* pad   pad   pad     pad */
 -    /*  8     16    32    64 */
 -
 -    {3, 4, 5, 6},               /* 1 bit per pixel */
 -    {1, 2, 3, 4},               /* 4 bits per pixel */
 -    {0, 1, 2, 3},               /* 8 bits per pixel */
 -    {~0, 0, 1, 2},              /* 16 bits per pixel */
 -    {~0, ~0, 0, 1},             /* 24 bits per pixel */
 -    {~0, ~0, 0, 1}              /* 32 bits per pixel */
 -};
 -
 -/*
 - * This array gives the answer to the question "what is the first index for
 - * the answer array above given the number of bits per pixel?"
 - * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
 - */
 -static int indexForBitsPerPixel[33] = {
 -    ~0, 0, ~0, ~0,              /* 1 bit per pixel */
 -    1, ~0, ~0, ~0,              /* 4 bits per pixel */
 -    2, ~0, ~0, ~0,              /* 8 bits per pixel */
 -    ~0, ~0, ~0, ~0,
 -    3, ~0, ~0, ~0,              /* 16 bits per pixel */
 -    ~0, ~0, ~0, ~0,
 -    4, ~0, ~0, ~0,              /* 24 bits per pixel */
 -    ~0, ~0, ~0, ~0,
 -    5                           /* 32 bits per pixel */
 -};
 -
 -/*
 - * This array gives the bytesperPixel value for cases where the number
 - * of bits per pixel is a multiple of 8 but not a power of 2.
 - */
 -static int answerBytesPerPixel[33] = {
 -    ~0, 0, ~0, ~0,              /* 1 bit per pixel */
 -    0, ~0, ~0, ~0,              /* 4 bits per pixel */
 -    0, ~0, ~0, ~0,              /* 8 bits per pixel */
 -    ~0, ~0, ~0, ~0,
 -    0, ~0, ~0, ~0,              /* 16 bits per pixel */
 -    ~0, ~0, ~0, ~0,
 -    3, ~0, ~0, ~0,              /* 24 bits per pixel */
 -    ~0, ~0, ~0, ~0,
 -    0                           /* 32 bits per pixel */
 -};
 -
 -/*
 - * This array gives the answer to the question "what is the second index for
 - * the answer array above given the number of bits per scanline pad unit?"
 - * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
 - */
 -static int indexForScanlinePad[65] = {
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    0, ~0, ~0, ~0,              /* 8 bits per scanline pad unit */
 -    ~0, ~0, ~0, ~0,
 -    1, ~0, ~0, ~0,              /* 16 bits per scanline pad unit */
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    2, ~0, ~0, ~0,              /* 32 bits per scanline pad unit */
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    ~0, ~0, ~0, ~0,
 -    3                           /* 64 bits per scanline pad unit */
 -};
 -
 -/*
 -	grow the array of screenRecs if necessary.
 -	call the device-supplied initialization procedure
 -with its screen number, a pointer to its ScreenRec, argc, and argv.
 -	return the number of successfully installed screens.
 -
 -*/
 -
 -static int init_screen(ScreenPtr pScreen, int i, Bool gpu)
 -{
 -    int scanlinepad, format, depth, bitsPerPixel, j, k;
 -
 -    dixInitScreenSpecificPrivates(pScreen);
 -
 -    if (!dixAllocatePrivates(&pScreen->devPrivates, PRIVATE_SCREEN)) {
 -        return -1;
 -    }
 -    pScreen->myNum = i;
 -    if (gpu) {
 -        pScreen->myNum += GPU_SCREEN_OFFSET;
 -        pScreen->isGPU = TRUE;
 -    }
 -    pScreen->totalPixmapSize = 0;       /* computed in CreateScratchPixmapForScreen */
 -    pScreen->ClipNotify = 0;    /* for R4 ddx compatibility */
 -    pScreen->CreateScreenResources = 0;
 -
 -    xorg_list_init(&pScreen->pixmap_dirty_list);
 -    xorg_list_init(&pScreen->unattached_list);
 -    xorg_list_init(&pScreen->output_slave_list);
 -    xorg_list_init(&pScreen->offload_slave_list);
 -
 -    /*
 -     * This loop gets run once for every Screen that gets added,
 -     * but thats ok.  If the ddx layer initializes the formats
 -     * one at a time calling AddScreen() after each, then each
 -     * iteration will make it a little more accurate.  Worst case
 -     * we do this loop N * numPixmapFormats where N is # of screens.
 -     * Anyway, this must be called after InitOutput and before the
 -     * screen init routine is called.
 -     */
 -    for (format = 0; format < screenInfo.numPixmapFormats; format++) {
 -        depth = screenInfo.formats[format].depth;
 -        bitsPerPixel = screenInfo.formats[format].bitsPerPixel;
 -        scanlinepad = screenInfo.formats[format].scanlinePad;
 -        j = indexForBitsPerPixel[bitsPerPixel];
 -        k = indexForScanlinePad[scanlinepad];
 -        PixmapWidthPaddingInfo[depth].padPixelsLog2 = answer[j][k];
 -        PixmapWidthPaddingInfo[depth].padRoundUp =
 -            (scanlinepad / bitsPerPixel) - 1;
 -        j = indexForBitsPerPixel[8];    /* bits per byte */
 -        PixmapWidthPaddingInfo[depth].padBytesLog2 = answer[j][k];
 -        PixmapWidthPaddingInfo[depth].bitsPerPixel = bitsPerPixel;
 -        if (answerBytesPerPixel[bitsPerPixel]) {
 -            PixmapWidthPaddingInfo[depth].notPower2 = 1;
 -            PixmapWidthPaddingInfo[depth].bytesPerPixel =
 -                answerBytesPerPixel[bitsPerPixel];
 -        }
 -        else {
 -            PixmapWidthPaddingInfo[depth].notPower2 = 0;
 -        }
 -    }
 -    return 0;
 -}
 -
 -int
 -AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
 -                           int /*argc */ ,
 -                           char **      /*argv */
 -          ), int argc, char **argv)
 -{
 -
 -    int i;
 -    ScreenPtr pScreen;
 -    Bool ret;
 -
 -    i = screenInfo.numScreens;
 -    if (i == MAXSCREENS)
 -        return -1;
 -
 -    pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
 -    if (!pScreen)
 -        return -1;
 -
 -    ret = init_screen(pScreen, i, FALSE);
 -    if (ret != 0) {
 -        free(pScreen);
 -        return ret;
 -    }
 -    /* This is where screen specific stuff gets initialized.  Load the
 -       screen structure, call the hardware, whatever.
 -       This is also where the default colormap should be allocated and
 -       also pixel values for blackPixel, whitePixel, and the cursor
 -       Note that InitScreen is NOT allowed to modify argc, argv, or
 -       any of the strings pointed to by argv.  They may be passed to
 -       multiple screens.
 -     */
 -    screenInfo.screens[i] = pScreen;
 -    screenInfo.numScreens++;
 -    if (!(*pfnInit) (pScreen, argc, argv)) {
 -        dixFreeScreenSpecificPrivates(pScreen);
 -        dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
 -        free(pScreen);
 -        screenInfo.numScreens--;
 -        return -1;
 -    }
 -
 -    update_desktop_dimensions();
 -
 -    dixRegisterScreenPrivateKey(&cursorScreenDevPriv, pScreen, PRIVATE_CURSOR,
 -                                0);
 -
 -    return i;
 -}
 -
 -int
 -AddGPUScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
 -                              int /*argc */ ,
 -                              char **      /*argv */
 -                              ),
 -             int argc, char **argv)
 -{
 -    int i;
 -    ScreenPtr pScreen;
 -    Bool ret;
 -
 -    i = screenInfo.numGPUScreens;
 -    if (i == MAXGPUSCREENS)
 -        return -1;
 -
 -    pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
 -    if (!pScreen)
 -        return -1;
 -
 -    ret = init_screen(pScreen, i, TRUE);
 -    if (ret != 0) {
 -        free(pScreen);
 -        return ret;
 -    }
 -
 -    /* This is where screen specific stuff gets initialized.  Load the
 -       screen structure, call the hardware, whatever.
 -       This is also where the default colormap should be allocated and
 -       also pixel values for blackPixel, whitePixel, and the cursor
 -       Note that InitScreen is NOT allowed to modify argc, argv, or
 -       any of the strings pointed to by argv.  They may be passed to
 -       multiple screens.
 -     */
 -    screenInfo.gpuscreens[i] = pScreen;
 -    screenInfo.numGPUScreens++;
 -    if (!(*pfnInit) (pScreen, argc, argv)) {
 -        dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
 -        free(pScreen);
 -        screenInfo.numGPUScreens--;
 -        return -1;
 -    }
 -
 -    update_desktop_dimensions();
 -
 -    return i;
 -}
 -
 -void
 -RemoveGPUScreen(ScreenPtr pScreen)
 -{
 -    int idx, j;
 -    if (!pScreen->isGPU)
 -        return;
 -
 -    idx = pScreen->myNum - GPU_SCREEN_OFFSET;
 -    for (j = idx; j < screenInfo.numGPUScreens - 1; j++) {
 -        screenInfo.gpuscreens[j] = screenInfo.gpuscreens[j + 1];
 -        screenInfo.gpuscreens[j]->myNum = j + GPU_SCREEN_OFFSET;
 -    }
 -    screenInfo.numGPUScreens--;
 -
 -    /* this gets freed later in the resource list, but without
 -     * the screen existing it causes crashes - so remove it here */
 -    if (pScreen->defColormap)
 -        FreeResource(pScreen->defColormap, RT_COLORMAP);
 -    free(pScreen);
 -
 -}
 -
 -void
 -AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr new)
 -{
 -    assert(new->isGPU);
 -    assert(!new->current_master);
 -    xorg_list_add(&new->unattached_head, &pScreen->unattached_list);
 -    new->current_master = pScreen;
 -}
 -
 -void
 -DetachUnboundGPU(ScreenPtr slave)
 -{
 -    assert(slave->isGPU);
 -    xorg_list_del(&slave->unattached_head);
 -    slave->current_master = NULL;
 -}
 -
 -void
 -AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
 -{
 -    assert(new->isGPU);
 -    xorg_list_add(&new->output_head, &pScreen->output_slave_list);
 -    new->current_master = pScreen;
 -}
 -
 -void
 -DetachOutputGPU(ScreenPtr slave)
 -{
 -    assert(slave->isGPU);
 -    xorg_list_del(&slave->output_head);
 -    slave->current_master = NULL;
 -}
 -
 -void
 -AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new)
 -{
 -    assert(new->isGPU);
 -    xorg_list_add(&new->offload_head, &pScreen->offload_slave_list);
 -    new->current_master = pScreen;
 -}
 -
 -void
 -DetachOffloadGPU(ScreenPtr slave)
 -{
 -    assert(slave->isGPU);
 -    xorg_list_del(&slave->offload_head);
 -    slave->current_master = NULL;
 -}
 -
 +/************************************************************
 +
 +Copyright 1987, 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 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
 +
 +                        All Rights Reserved
 +
- Permission to use, copy, modify, and distribute this software and its 
- documentation for any purpose and without fee is hereby granted, 
++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 
++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.  
++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.
 + */
 +
 +#ifdef HAVE_DIX_CONFIG_H
 +#include <dix-config.h>
 +#include <version-config.h>
 +#endif
 +
 +#ifdef CreateWindow
 +#undef CreateWindow
 +#endif
 +
 +#ifdef PANORAMIX_DEBUG
 +#include <stdio.h>
 +int ProcInitialConnection();
 +#endif
 +
 +#include "windowstr.h"
 +#include <X11/fonts/fontstruct.h>
 +#include "dixfontstr.h"
 +#include "gcstruct.h"
 +#include "selection.h"
 +#include "colormapst.h"
 +#include "cursorstr.h"
 +#include "scrnintstr.h"
 +#include "opaque.h"
 +#include "input.h"
 +#include "servermd.h"
 +#include "extnsionst.h"
 +#include "dixfont.h"
 +#include "dispatch.h"
 +#include "swaprep.h"
 +#include "swapreq.h"
 +#include "privates.h"
 +#include "xace.h"
 +#include "inputstr.h"
 +#include "xkbsrv.h"
 +#include "site.h"
 +#include "client.h"
 +
 +#ifdef XSERVER_DTRACE
 +#include "registry.h"
 +#include <sys/types.h>
 +typedef const char *string;
 +
 +#include "Xserver-dtrace.h"
 +#endif
 +
 +#define mskcnt ((MAXCLIENTS + 31) / 32)
 +#define BITMASK(i) (1U << ((i) & 31))
 +#define MASKIDX(i) ((i) >> 5)
 +#define MASKWORD(buf, i) buf[MASKIDX(i)]
 +#define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i)
 +#define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i)
 +#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
 +
 +xConnSetupPrefix connSetupPrefix;
 +
 +PaddingInfo PixmapWidthPaddingInfo[33];
 +
 +static ClientPtr grabClient;
 +
 +#define GrabNone 0
 +#define GrabActive 1
 +#define GrabKickout 2
 +static int grabState = GrabNone;
 +static long grabWaiters[mskcnt];
 +CallbackListPtr ServerGrabCallback = NULL;
 +HWEventQueuePtr checkForInput[2];
 +int connBlockScreenStart;
 +
 +static void KillAllClients(void);
 +
 +static int nextFreeClientID;    /* always MIN free client ID */
 +
 +static int nClients;            /* number of authorized clients */
 +
 +CallbackListPtr ClientStateCallback;
 +
 +/* dispatchException & isItTimeToYield must be declared volatile since they
 + * are modified by signal handlers - otherwise optimizer may assume it doesn't
 + * need to actually check value in memory when used and may miss changes from
 + * signal handlers.
 + */
 +volatile char dispatchException = 0;
 +volatile char isItTimeToYield;
 +
 +#define SAME_SCREENS(a, b) (\
 +    (a.pScreen == b.pScreen))
 +
 +void
 +SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1)
 +{
 +    checkForInput[0] = c0;
 +    checkForInput[1] = c1;
 +}
 +
 +void
 +UpdateCurrentTime(void)
 +{
 +    TimeStamp systime;
 +
 +    /* To avoid time running backwards, we must call GetTimeInMillis before
 +     * calling ProcessInputEvents.
 +     */
 +    systime.months = currentTime.months;
 +    systime.milliseconds = GetTimeInMillis();
 +    if (systime.milliseconds < currentTime.milliseconds)
 +        systime.months++;
 +    if (*checkForInput[0] != *checkForInput[1])
 +        ProcessInputEvents();
 +    if (CompareTimeStamps(systime, currentTime) == LATER)
 +        currentTime = systime;
 +}
 +
 +/* Like UpdateCurrentTime, but can't call ProcessInputEvents */
 +void
 +UpdateCurrentTimeIf(void)
 +{
 +    TimeStamp systime;
 +
 +    systime.months = currentTime.months;
 +    systime.milliseconds = GetTimeInMillis();
 +    if (systime.milliseconds < currentTime.milliseconds)
 +        systime.months++;
 +    if (CompareTimeStamps(systime, currentTime) == LATER)
 +        currentTime = systime;
 +}
 +
 +#undef SMART_DEBUG
 +
 +/* in milliseconds */
 +#define SMART_SCHEDULE_DEFAULT_INTERVAL	5
 +#define SMART_SCHEDULE_MAX_SLICE	15
 +
 +#if defined(WIN32) && !defined(__CYGWIN__) && !defined(_MSC_VER)
 +Bool SmartScheduleDisable = TRUE;
 +#else
 +Bool SmartScheduleDisable = FALSE;
 +#endif
 +long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
 +long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
 +long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
 +long SmartScheduleTime;
 +int SmartScheduleLatencyLimited = 0;
 +static ClientPtr SmartLastClient;
 +static int SmartLastIndex[SMART_MAX_PRIORITY - SMART_MIN_PRIORITY + 1];
 +
 +#ifdef SMART_DEBUG
 +long SmartLastPrint;
 +#endif
 +
 +void Dispatch(void);
 +
 +static int
 +SmartScheduleClient(int *clientReady, int nready)
 +{
 +    ClientPtr pClient;
 +    int i;
 +    int client;
 +    int bestPrio, best = 0;
 +    int bestRobin, robin;
 +    long now = SmartScheduleTime;
 +    long idle;
 +
 +    bestPrio = -0x7fffffff;
 +    bestRobin = 0;
 +    idle = 2 * SmartScheduleSlice;
 +    for (i = 0; i < nready; i++) {
 +        client = clientReady[i];
 +        pClient = clients[client];
 +        /* Praise clients which haven't run in a while */
 +        if ((now - pClient->smart_stop_tick) >= idle) {
 +            if (pClient->smart_priority < 0)
 +                pClient->smart_priority++;
 +        }
 +
 +        /* check priority to select best client */
 +        robin =
 +            (pClient->index -
 +             SmartLastIndex[pClient->smart_priority -
 +                            SMART_MIN_PRIORITY]) & 0xff;
 +        if (pClient->smart_priority > bestPrio ||
 +            (pClient->smart_priority == bestPrio && robin > bestRobin)) {
 +            bestPrio = pClient->smart_priority;
 +            bestRobin = robin;
 +            best = client;
 +        }
 +#ifdef SMART_DEBUG
 +        if ((now - SmartLastPrint) >= 5000)
 +            fprintf(stderr, " %2d: %3d", client, pClient->smart_priority);
 +#endif
 +    }
 +#ifdef SMART_DEBUG
 +    if ((now - SmartLastPrint) >= 5000) {
 +        fprintf(stderr, " use %2d\n", best);
 +        SmartLastPrint = now;
 +    }
 +#endif
 +    pClient = clients[best];
 +    SmartLastIndex[bestPrio - SMART_MIN_PRIORITY] = pClient->index;
 +    /*
 +     * Set current client pointer
 +     */
 +    if (SmartLastClient != pClient) {
 +        pClient->smart_start_tick = now;
 +        SmartLastClient = pClient;
 +    }
 +    /*
 +     * Adjust slice
 +     */
 +    if (nready == 1 && SmartScheduleLatencyLimited == 0) {
 +        /*
 +         * If it's been a long time since another client
 +         * has run, bump the slice up to get maximal
 +         * performance from a single client
 +         */
 +        if ((now - pClient->smart_start_tick) > 1000 &&
 +            SmartScheduleSlice < SmartScheduleMaxSlice) {
 +            SmartScheduleSlice += SmartScheduleInterval;
 +        }
 +    }
 +    else {
 +        SmartScheduleSlice = SmartScheduleInterval;
 +    }
 +    return best;
 +}
 +
 +void
 +EnableLimitedSchedulingLatency(void)
 +{
 +    ++SmartScheduleLatencyLimited;
 +    SmartScheduleSlice = SmartScheduleInterval;
 +}
 +
 +void
 +DisableLimitedSchedulingLatency(void)
 +{
 +    --SmartScheduleLatencyLimited;
 +
 +    /* protect against bugs */
 +    if (SmartScheduleLatencyLimited < 0)
 +        SmartScheduleLatencyLimited = 0;
 +}
 +
 +void
 +Dispatch(void)
 +{
 +    int *clientReady;           /* array of request ready clients */
 +    int result;
 +    ClientPtr client;
 +    int nready;
 +    HWEventQueuePtr *icheck = checkForInput;
 +    long start_tick;
 +
 +    nextFreeClientID = 1;
 +    nClients = 0;
 +
 +    clientReady = malloc(sizeof(int) * MaxClients);
 +    if (!clientReady)
 +        return;
 +
 +    SmartScheduleSlice = SmartScheduleInterval;
 +    while (!dispatchException) {
 +        if (*icheck[0] != *icheck[1]) {
 +            ProcessInputEvents();
 +            FlushIfCriticalOutputPending();
 +        }
 +
 +        nready = WaitForSomething(clientReady);
 +
 +        if (nready && !SmartScheduleDisable) {
 +            clientReady[0] = SmartScheduleClient(clientReady, nready);
 +            nready = 1;
 +        }
-        /***************** 
- 	*  Handle events in round robin fashion, doing input between 
- 	*  each round 
++       /*****************
++	*  Handle events in round robin fashion, doing input between
++	*  each round
 +	*****************/
 +
 +        while (!dispatchException && (--nready >= 0)) {
 +            client = clients[clientReady[nready]];
 +            if (!client) {
 +                /* KillClient can cause this to happen */
 +                continue;
 +            }
 +            /* GrabServer activation can cause this to be true */
 +            if (grabState == GrabKickout) {
 +                grabState = GrabActive;
 +                break;
 +            }
 +            isItTimeToYield = FALSE;
 +
 +            start_tick = SmartScheduleTime;
 +            while (!isItTimeToYield) {
 +#ifdef XSERVER_DTRACE
 +                CARD8 StartMajorOp;
 +#endif
 +                if (*icheck[0] != *icheck[1])
 +                    ProcessInputEvents();
 +
 +                FlushIfCriticalOutputPending();
 +                if (!SmartScheduleDisable &&
 +                    (SmartScheduleTime - start_tick) >= SmartScheduleSlice) {
 +                    /* Penalize clients which consume ticks */
 +                    if (client->smart_priority > SMART_MIN_PRIORITY)
 +                        client->smart_priority--;
 +                    break;
 +                }
 +                /* now, finally, deal with client requests */
 +
 +                /* Update currentTime so request time checks, such as for input
 +                 * device grabs, are calculated correctly */
 +                UpdateCurrentTimeIf();
 +                result = ReadRequestFromClient(client);
 +                if (result <= 0) {
 +                    if (result < 0)
 +                        CloseDownClient(client);
 +                    break;
 +                }
 +
 +                client->sequence++;
 +                client->majorOp = ((xReq *) client->requestBuffer)->reqType;
 +                client->minorOp = 0;
 +                if (client->majorOp >= EXTENSION_BASE) {
 +                    ExtensionEntry *ext = GetExtensionEntry(client->majorOp);
 +
 +                    if (ext)
 +                        client->minorOp = ext->MinorOpcode(client);
 +                }
 +#ifdef XSERVER_DTRACE
 +                if (XSERVER_REQUEST_START_ENABLED())
 +                {
 +                    StartMajorOp=client->majorOp;
 +                    XSERVER_REQUEST_START(LookupMajorName(client->majorOp),
 +                                          client->majorOp,
 +                                          ((xReq *) client->requestBuffer)->length,
 +                                          client->index,
 +                                          client->requestBuffer);
 +                }
 +#endif
 +                if (result > (maxBigRequestSize << 2))
 +                    result = BadLength;
 +                else {
 +                    result = XaceHookDispatch(client, client->majorOp);
 +                    if (result == Success)
 +                        result =
 +                            (*client->requestVector[client->majorOp]) (client);
 +                    XaceHookAuditEnd(client, result);
 +                }
 +#ifdef XSERVER_DTRACE
 +                if (XSERVER_REQUEST_DONE_ENABLED())
 +                {
 +                  if (result!=Success)
 +                  {
 +                    char Message[255];
 +                    sprintf(Message,"ERROR: %s (0x%x)",LookupMajorName(client->majorOp),client->errorValue);
 +                    XSERVER_REQUEST_DONE(Message,
 +                                         client->majorOp, client->sequence,
 +                                         client->index, result);
 +                  }
 +                  else
 +                  {
 +                    if (StartMajorOp!=client->majorOp)
 +                    {
 +                      char Message[255];
 +                      sprintf(Message,"Changed request: %s -> %s",LookupMajorName(StartMajorOp),LookupMajorName(client->majorOp));
 +                      XSERVER_REQUEST_DONE(Message,
 +                                           client->majorOp, client->sequence,
 +                                           client->index, result);
 +                    }
 +                    else
 +                    {
 +                      XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp),
 +                                           client->majorOp, client->sequence,
 +                                           client->index, result);
 +                    }
 +                  }
 +                }
 +#endif
 +
 +                if (client->noClientException != Success) {
 +                    CloseDownClient(client);
 +                    break;
 +                }
 +                else if (result != Success) {
 +                    SendErrorToClient(client, client->majorOp,
 +                                      client->minorOp,
 +                                      client->errorValue, result);
 +                    break;
 +                }
 +            }
 +            FlushAllOutput();
 +            client = clients[clientReady[nready]];
 +            if (client)
 +                client->smart_stop_tick = SmartScheduleTime;
 +        }
 +        dispatchException &= ~DE_PRIORITYCHANGE;
 +    }
 +#if defined(DDXBEFORERESET)
 +    ddxBeforeReset();
 +#endif
 +    KillAllClients();
 +    free(clientReady);
 +    dispatchException &= ~DE_RESET;
 +    SmartScheduleLatencyLimited = 0;
 +    ResetOsBuffers();
 +}
 +
 +static int VendorRelease = VENDOR_RELEASE;
 +static const char *VendorString = VENDOR_NAME;
 +
 +void
 +SetVendorRelease(int release)
 +{
 +    VendorRelease = release;
 +}
 +
 +void
 +SetVendorString(const char *vendor)
 +{
 +    VendorString = vendor;
 +}
 +
 +Bool
 +CreateConnectionBlock(void)
 +{
 +    xConnSetup setup;
 +    xWindowRoot root;
 +    xDepth depth;
 +    xVisualType visual;
 +    xPixmapFormat format;
 +    unsigned long vid;
 +    int i, j, k, lenofblock, sizesofar = 0;
 +    char *pBuf;
 +
 +    memset(&setup, 0, sizeof(xConnSetup));
 +    /* Leave off the ridBase and ridMask, these must be sent with
 +       connection */
 +
 +    setup.release = VendorRelease;
 +    /*
 +     * per-server image and bitmap parameters are defined in Xmd.h
 +     */
 +    setup.imageByteOrder = screenInfo.imageByteOrder;
 +
 +    setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit;
 +    setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad;
 +
 +    setup.bitmapBitOrder = screenInfo.bitmapBitOrder;
 +    setup.motionBufferSize = NumMotionEvents();
 +    setup.numRoots = screenInfo.numScreens;
 +    setup.nbytesVendor = strlen(VendorString);
 +    setup.numFormats = screenInfo.numPixmapFormats;
 +    setup.maxRequestSize = MAX_REQUEST_SIZE;
 +    QueryMinMaxKeyCodes(&setup.minKeyCode, &setup.maxKeyCode);
 +
 +    lenofblock = sizeof(xConnSetup) +
 +        pad_to_int32(setup.nbytesVendor) +
 +        (setup.numFormats * sizeof(xPixmapFormat)) +
 +        (setup.numRoots * sizeof(xWindowRoot));
 +    ConnectionInfo = malloc(lenofblock);
 +    if (!ConnectionInfo)
 +        return FALSE;
 +
 +    memmove(ConnectionInfo, (char *) &setup, sizeof(xConnSetup));
 +    sizesofar = sizeof(xConnSetup);
 +    pBuf = ConnectionInfo + sizeof(xConnSetup);
 +
 +    memmove(pBuf, VendorString, (int) setup.nbytesVendor);
 +    sizesofar += setup.nbytesVendor;
 +    pBuf += setup.nbytesVendor;
 +    i = padding_for_int32(setup.nbytesVendor);
 +    sizesofar += i;
 +    while (--i >= 0)
 +        *pBuf++ = 0;
 +
 +    memset(&format, 0, sizeof(xPixmapFormat));
 +    for (i = 0; i < screenInfo.numPixmapFormats; i++) {
 +        format.depth = screenInfo.formats[i].depth;
 +        format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
 +        format.scanLinePad = screenInfo.formats[i].scanlinePad;
 +        memmove(pBuf, (char *) &format, sizeof(xPixmapFormat));
 +        pBuf += sizeof(xPixmapFormat);
 +        sizesofar += sizeof(xPixmapFormat);
 +    }
 +
 +    connBlockScreenStart = sizesofar;
 +    memset(&depth, 0, sizeof(xDepth));
 +    memset(&visual, 0, sizeof(xVisualType));
 +    for (i = 0; i < screenInfo.numScreens; i++) {
 +        ScreenPtr pScreen;
 +        DepthPtr pDepth;
 +        VisualPtr pVisual;
 +
 +        pScreen = screenInfo.screens[i];
 +        root.windowId = pScreen->root->drawable.id;
 +        root.defaultColormap = pScreen->defColormap;
 +        root.whitePixel = pScreen->whitePixel;
 +        root.blackPixel = pScreen->blackPixel;
 +        root.currentInputMask = 0;      /* filled in when sent */
 +        root.pixWidth = pScreen->width;
 +        root.pixHeight = pScreen->height;
 +        root.mmWidth = pScreen->mmWidth;
 +        root.mmHeight = pScreen->mmHeight;
 +        root.minInstalledMaps = pScreen->minInstalledCmaps;
 +        root.maxInstalledMaps = pScreen->maxInstalledCmaps;
 +        root.rootVisualID = pScreen->rootVisual;
 +        root.backingStore = pScreen->backingStoreSupport;
 +        root.saveUnders = FALSE;
 +        root.rootDepth = pScreen->rootDepth;
 +        root.nDepths = pScreen->numDepths;
 +        memmove(pBuf, (char *) &root, sizeof(xWindowRoot));
 +        sizesofar += sizeof(xWindowRoot);
 +        pBuf += sizeof(xWindowRoot);
 +
 +        pDepth = pScreen->allowedDepths;
 +        for (j = 0; j < pScreen->numDepths; j++, pDepth++) {
 +            lenofblock += sizeof(xDepth) +
 +                (pDepth->numVids * sizeof(xVisualType));
 +            pBuf = (char *) realloc(ConnectionInfo, lenofblock);
 +            if (!pBuf) {
 +                free(ConnectionInfo);
 +                return FALSE;
 +            }
 +            ConnectionInfo = pBuf;
 +            pBuf += sizesofar;
 +            depth.depth = pDepth->depth;
 +            depth.nVisuals = pDepth->numVids;
 +            memmove(pBuf, (char *) &depth, sizeof(xDepth));
 +            pBuf += sizeof(xDepth);
 +            sizesofar += sizeof(xDepth);
 +            for (k = 0; k < pDepth->numVids; k++) {
 +                vid = pDepth->vids[k];
 +                for (pVisual = pScreen->visuals;
 +                     pVisual->vid != vid; pVisual++);
 +                visual.visualID = vid;
 +                visual.class = pVisual->class;
 +                visual.bitsPerRGB = pVisual->bitsPerRGBValue;
 +                visual.colormapEntries = pVisual->ColormapEntries;
 +                visual.redMask = pVisual->redMask;
 +                visual.greenMask = pVisual->greenMask;
 +                visual.blueMask = pVisual->blueMask;
 +                memmove(pBuf, (char *) &visual, sizeof(xVisualType));
 +                pBuf += sizeof(xVisualType);
 +                sizesofar += sizeof(xVisualType);
 +            }
 +        }
 +    }
 +    connSetupPrefix.success = xTrue;
 +    connSetupPrefix.length = lenofblock / 4;
 +    connSetupPrefix.majorVersion = X_PROTOCOL;
 +    connSetupPrefix.minorVersion = X_PROTOCOL_REVISION;
 +    return TRUE;
 +}
 +
 +int
 +ProcBadRequest(ClientPtr client)
 +{
 +    return BadRequest;
 +}
 +
 +int
 +ProcCreateWindow(ClientPtr client)
 +{
 +    WindowPtr pParent, pWin;
 +
 +    REQUEST(xCreateWindowReq);
 +    int len, rc;
 +
 +    REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
 +
 +    LEGAL_NEW_RESOURCE(stuff->wid, client);
 +    rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
 +    if (rc != Success)
 +        return rc;
 +    len = client->req_len - bytes_to_int32(sizeof(xCreateWindowReq));
 +    if (Ones(stuff->mask) != len)
 +        return BadLength;
 +    if (!stuff->width || !stuff->height) {
 +        client->errorValue = 0;
 +        return BadValue;
 +    }
 +    pWin = CreateWindow(stuff->wid, pParent, stuff->x,
 +                        stuff->y, stuff->width, stuff->height,
 +                        stuff->borderWidth, stuff->class,
 +                        stuff->mask, (XID *) &stuff[1],
 +                        (int) stuff->depth, client, stuff->visual, &rc);
 +    if (pWin) {
 +        Mask mask = pWin->eventMask;
 +
 +        pWin->eventMask = 0;    /* subterfuge in case AddResource fails */
 +        if (!AddResource(stuff->wid, RT_WINDOW, (void *) pWin))
 +            return BadAlloc;
 +        pWin->eventMask = mask;
 +    }
 +    return rc;
 +}
 +
 +int
 +ProcChangeWindowAttributes(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xChangeWindowAttributesReq);
 +    int len, rc;
 +    Mask access_mode = 0;
 +
 +    REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
 +    access_mode |= (stuff->valueMask & CWEventMask) ? DixReceiveAccess : 0;
 +    access_mode |= (stuff->valueMask & ~CWEventMask) ? DixSetAttrAccess : 0;
 +    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
 +    if (rc != Success)
 +        return rc;
 +    len = client->req_len - bytes_to_int32(sizeof(xChangeWindowAttributesReq));
 +    if (len != Ones(stuff->valueMask))
 +        return BadLength;
 +    return ChangeWindowAttributes(pWin,
 +                                  stuff->valueMask, (XID *) &stuff[1], client);
 +}
 +
 +int
 +ProcGetWindowAttributes(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xResourceReq);
 +    xGetWindowAttributesReply wa;
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +    memset(&wa, 0, sizeof(xGetWindowAttributesReply));
 +    GetWindowAttributes(pWin, client, &wa);
 +    WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
 +    return Success;
 +}
 +
 +int
 +ProcDestroyWindow(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xResourceReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
 +    if (rc != Success)
 +        return rc;
 +    if (pWin->parent) {
 +        rc = dixLookupWindow(&pWin, pWin->parent->drawable.id, client,
 +                             DixRemoveAccess);
 +        if (rc != Success)
 +            return rc;
 +        FreeResource(stuff->id, RT_NONE);
 +    }
 +    return Success;
 +}
 +
 +int
 +ProcDestroySubwindows(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xResourceReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixRemoveAccess);
 +    if (rc != Success)
 +        return rc;
 +    DestroySubwindows(pWin, client);
 +    return Success;
 +}
 +
 +int
 +ProcChangeSaveSet(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xChangeSaveSetReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xChangeSaveSetReq);
 +    rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
 +    if (rc != Success)
 +        return rc;
 +    if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
 +        return BadMatch;
 +    if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete))
 +        return AlterSaveSetForClient(client, pWin, stuff->mode, FALSE, TRUE);
 +    client->errorValue = stuff->mode;
 +    return BadValue;
 +}
 +
 +int
 +ProcReparentWindow(ClientPtr client)
 +{
 +    WindowPtr pWin, pParent;
 +
 +    REQUEST(xReparentWindowReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xReparentWindowReq);
 +    rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
 +    if (rc != Success)
 +        return rc;
 +    rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
 +    if (rc != Success)
 +        return rc;
 +    if (!SAME_SCREENS(pWin->drawable, pParent->drawable))
 +        return BadMatch;
 +    if ((pWin->backgroundState == ParentRelative) &&
 +        (pParent->drawable.depth != pWin->drawable.depth))
 +        return BadMatch;
 +    if ((pWin->drawable.class != InputOnly) &&
 +        (pParent->drawable.class == InputOnly))
 +        return BadMatch;
 +    return ReparentWindow(pWin, pParent,
 +                          (short) stuff->x, (short) stuff->y, client);
 +}
 +
 +int
 +ProcMapWindow(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xResourceReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixShowAccess);
 +    if (rc != Success)
 +        return rc;
 +    MapWindow(pWin, client);
 +    /* update cache to say it is mapped */
 +    return Success;
 +}
 +
 +int
 +ProcMapSubwindows(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xResourceReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
 +    if (rc != Success)
 +        return rc;
 +    MapSubwindows(pWin, client);
 +    /* update cache to say it is mapped */
 +    return Success;
 +}
 +
 +int
 +ProcUnmapWindow(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xResourceReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixHideAccess);
 +    if (rc != Success)
 +        return rc;
 +    UnmapWindow(pWin, FALSE);
 +    /* update cache to say it is mapped */
 +    return Success;
 +}
 +
 +int
 +ProcUnmapSubwindows(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xResourceReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
 +    if (rc != Success)
 +        return rc;
 +    UnmapSubwindows(pWin);
 +    return Success;
 +}
 +
 +int
 +ProcConfigureWindow(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xConfigureWindowReq);
 +    int len, rc;
 +
 +    REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
 +    rc = dixLookupWindow(&pWin, stuff->window, client,
 +                         DixManageAccess | DixSetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +    len = client->req_len - bytes_to_int32(sizeof(xConfigureWindowReq));
 +    if (Ones((Mask) stuff->mask) != len)
 +        return BadLength;
 +    return ConfigureWindow(pWin, (Mask) stuff->mask, (XID *) &stuff[1], client);
 +}
 +
 +int
 +ProcCirculateWindow(ClientPtr client)
 +{
 +    WindowPtr pWin;
 +
 +    REQUEST(xCirculateWindowReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xCirculateWindowReq);
 +    if ((stuff->direction != RaiseLowest) && (stuff->direction != LowerHighest)) {
 +        client->errorValue = stuff->direction;
 +        return BadValue;
 +    }
 +    rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
 +    if (rc != Success)
 +        return rc;
 +    CirculateWindow(pWin, (int) stuff->direction, client);
 +    return Success;
 +}
 +
 +static int
 +GetGeometry(ClientPtr client, xGetGeometryReply * rep)
 +{
 +    DrawablePtr pDraw;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +
 +    rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    rep->type = X_Reply;
 +    rep->length = 0;
 +    rep->sequenceNumber = client->sequence;
 +    rep->root = pDraw->pScreen->root->drawable.id;
 +    rep->depth = pDraw->depth;
 +    rep->width = pDraw->width;
 +    rep->height = pDraw->height;
 +
 +    if (WindowDrawable(pDraw->type)) {
 +        WindowPtr pWin = (WindowPtr) pDraw;
 +
 +        rep->x = pWin->origin.x - wBorderWidth(pWin);
 +        rep->y = pWin->origin.y - wBorderWidth(pWin);
 +        rep->borderWidth = pWin->borderWidth;
 +    }
 +    else {                      /* DRAWABLE_PIXMAP */
 +
 +        rep->x = rep->y = rep->borderWidth = 0;
 +    }
 +
 +    return Success;
 +}
 +
 +int
 +ProcGetGeometry(ClientPtr client)
 +{
 +    xGetGeometryReply rep;
 +    int status;
 +
 +    memset(&rep, 0, sizeof(xGetGeometryReply));
 +    rep.type = X_Reply ;
 +    if ((status = GetGeometry(client, &rep)) != Success)
 +        return status;
 +
 +    WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
 +    return Success;
 +}
 +
 +#ifdef WIN32
 +/* Do not return the clipboard window in ProcQueryTree, cause this may cause
 +   the clipboard client being closed when connecting through xdmcp.
 +*/
 +extern Window g_iClipboardWindow;
 +
 +#endif
 +int
 +ProcQueryTree(ClientPtr client)
 +{
 +    xQueryTreeReply reply;
 +    int rc, numChildren = 0;
 +    WindowPtr pChild, pWin, pHead;
 +    Window *childIDs = (Window *) NULL;
 +
 +    REQUEST(xResourceReq);
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
 +    if (rc != Success)
 +        return rc;
 +    memset(&reply, 0, sizeof(xQueryTreeReply));
 +    reply.type = X_Reply;
 +    reply.sequenceNumber = client->sequence;
 +    reply.root = pWin->drawable.pScreen->root->drawable.id;
 +    reply.parent =  (pWin->parent) ? pWin->parent->drawable.id : (Window) None;
 +
 +    pHead = RealChildHead(pWin);
 +    for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
 +#ifdef WIN32
 +        if (pChild->drawable.id!=g_iClipboardWindow)
 +#endif
 +            numChildren++;
 +    if (numChildren) {
 +        int curChild = 0;
 +
 +        childIDs = malloc(numChildren * sizeof(Window));
 +        if (!childIDs)
 +            return BadAlloc;
 +        for (pChild = pWin->lastChild; pChild != pHead;
 +             pChild = pChild->prevSib)
 +#ifdef WIN32
 +	         if (pChild->drawable.id!=g_iClipboardWindow)
 +#endif
 +            childIDs[curChild++] = pChild->drawable.id;
 +    }
 +
 +    reply.nChildren = numChildren;
 +    reply.length = bytes_to_int32(numChildren * sizeof(Window));
 +
 +    WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply);
 +    if (numChildren) {
 +        client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 +        WriteSwappedDataToClient(client, numChildren * sizeof(Window),
 +                                 childIDs);
 +        free(childIDs);
 +    }
 +
 +    return Success;
 +}
 +
 +int
 +ProcInternAtom(ClientPtr client)
 +{
 +    Atom atom;
 +    char *tchar;
 +
 +    REQUEST(xInternAtomReq);
 +
 +    REQUEST_FIXED_SIZE(xInternAtomReq, stuff->nbytes);
 +    if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse)) {
 +        client->errorValue = stuff->onlyIfExists;
 +        return BadValue;
 +    }
 +    tchar = (char *) &stuff[1];
 +    atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
 +    if (atom != BAD_RESOURCE) {
 +        xInternAtomReply reply; memset(&reply, 0, sizeof(xInternAtomReply));
 +        reply.type = X_Reply;
 +        reply.sequenceNumber = client->sequence;
 +        reply.length = 0;
 +        reply.atom = atom;
 +
 +        WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
 +        return Success;
 +    }
 +    else
 +        return BadAlloc;
 +}
 +
 +int
 +ProcGetAtomName(ClientPtr client)
 +{
 +    const char *str;
 +
 +    REQUEST(xResourceReq);
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    if ((str = NameForAtom(stuff->id))) {
 +        xGetAtomNameReply reply;
 +        int len = strlen(str);
 +        memset(&reply, 0, sizeof(xGetAtomNameReply));
 +        reply.type = X_Reply;
 +        reply.sequenceNumber = client->sequence;
 +        reply.length = bytes_to_int32(len);
 +        reply.nameLength = len;
 +        WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
 +        WriteToClient(client, len, str);
 +        return Success;
 +    }
 +    else {
 +        client->errorValue = stuff->id;
 +        return BadAtom;
 +    }
 +}
 +
 +int
 +ProcGrabServer(ClientPtr client)
 +{
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xReq);
 +    if (grabState != GrabNone && client != grabClient) {
 +        ResetCurrentRequest(client);
 +        client->sequence--;
 +        BITSET(grabWaiters, client->index);
 +        IgnoreClient(client);
 +        return Success;
 +    }
 +    rc = OnlyListenToOneClient(client);
 +    if (rc != Success)
 +        return rc;
 +    grabState = GrabKickout;
 +    grabClient = client;
 +
 +    if (ServerGrabCallback) {
 +        ServerGrabInfoRec grabinfo;
 +
 +        grabinfo.client = client;
 +        grabinfo.grabstate = SERVER_GRABBED;
 +        CallCallbacks(&ServerGrabCallback, (void *) &grabinfo);
 +    }
 +
 +    return Success;
 +}
 +
 +static void
 +UngrabServer(ClientPtr client)
 +{
 +    int i;
 +
 +    grabState = GrabNone;
 +    ListenToAllClients();
 +    for (i = mskcnt; --i >= 0 && !grabWaiters[i];);
 +    if (i >= 0) {
 +        i <<= 5;
 +        while (!GETBIT(grabWaiters, i))
 +            i++;
 +        BITCLEAR(grabWaiters, i);
 +        AttendClient(clients[i]);
 +    }
 +
 +    if (ServerGrabCallback) {
 +        ServerGrabInfoRec grabinfo;
 +
 +        grabinfo.client = client;
 +        grabinfo.grabstate = SERVER_UNGRABBED;
 +        CallCallbacks(&ServerGrabCallback, (void *) &grabinfo);
 +    }
 +}
 +
 +int
 +ProcUngrabServer(ClientPtr client)
 +{
 +    REQUEST_SIZE_MATCH(xReq);
 +    UngrabServer(client);
 +    return Success;
 +}
 +
 +int
 +ProcTranslateCoords(ClientPtr client)
 +{
 +    REQUEST(xTranslateCoordsReq);
 +
 +    WindowPtr pWin, pDst;
 +    xTranslateCoordsReply rep;
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xTranslateCoordsReq);
 +    rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +    rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +    memset(&rep, 0, sizeof(xTranslateCoordsReply));
 +    rep.type = X_Reply;
 +    rep.sequenceNumber = client->sequence;
 +    rep.length = 0;
 +
 +    if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) {
 +        rep.sameScreen = xFalse;
 +        rep.child = None;
 +        rep.dstX = rep.dstY = 0;
 +    }
 +    else {
 +        INT16 x, y;
 +
 +        rep.sameScreen = xTrue;
 +        rep.child = None;
 +        /* computing absolute coordinates -- adjust to destination later */
 +        x = pWin->drawable.x + stuff->srcX;
 +        y = pWin->drawable.y + stuff->srcY;
 +        pWin = pDst->firstChild;
 +        while (pWin) {
 +            BoxRec box;
 +
 +            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) ||
 +                    RegionContainsPoint(&pWin->borderSize, x, y, &box))
 +
 +                && (!wInputShape(pWin) ||
 +                    RegionContainsPoint(wInputShape(pWin),
 +                                        x - pWin->drawable.x,
 +                                        y - pWin->drawable.y, &box))
 +                ) {
 +                rep.child = pWin->drawable.id;
 +                pWin = (WindowPtr) NULL;
 +            }
 +            else
 +                pWin = pWin->nextSib;
 +        }
 +        /* adjust to destination coordinates */
 +        rep.dstX = x - pDst->drawable.x;
 +        rep.dstY = y - pDst->drawable.y;
 +    }
 +    WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
 +    return Success;
 +}
 +
 +int
 +ProcOpenFont(ClientPtr client)
 +{
 +    int err;
 +
 +    REQUEST(xOpenFontReq);
 +
 +    REQUEST_FIXED_SIZE(xOpenFontReq, stuff->nbytes);
 +    client->errorValue = stuff->fid;
 +    LEGAL_NEW_RESOURCE(stuff->fid, client);
 +    err = OpenFont(client, stuff->fid, (Mask) 0,
 +                   stuff->nbytes, (char *) &stuff[1]);
 +    if (err == Success) {
 +        return Success;
 +    }
 +    else
 +        return err;
 +}
 +
 +int
 +ProcCloseFont(ClientPtr client)
 +{
 +    FontPtr pFont;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupResourceByType((void **) &pFont, stuff->id, RT_FONT,
 +                                 client, DixDestroyAccess);
 +    if (rc == Success) {
 +        FreeResource(stuff->id, RT_NONE);
 +        return Success;
 +    }
 +    else {
 +        client->errorValue = stuff->id;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcQueryFont(ClientPtr client)
 +{
 +    xQueryFontReply *reply;
 +    FontPtr pFont;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +
 +    rc = dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    {
 +        xCharInfo *pmax = FONTINKMAX(pFont);
 +        xCharInfo *pmin = FONTINKMIN(pFont);
 +        int nprotoxcistructs;
 +        int rlength;
 +
 +        nprotoxcistructs = (pmax->rightSideBearing == pmin->rightSideBearing &&
 +                            pmax->leftSideBearing == pmin->leftSideBearing &&
 +                            pmax->descent == pmin->descent &&
 +                            pmax->ascent == pmin->ascent &&
 +                            pmax->characterWidth == pmin->characterWidth) ?
 +            0 : N2dChars(pFont);
 +
 +        rlength = sizeof(xQueryFontReply) +
 +            FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
 +            nprotoxcistructs * sizeof(xCharInfo);
 +        reply = calloc(1, rlength);
 +        if (!reply) {
 +            return BadAlloc;
 +        }
 +
 +        reply->type = X_Reply;
 +        reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
 +        reply->sequenceNumber = client->sequence;
 +        QueryFont(pFont, reply, nprotoxcistructs);
 +
 +        WriteReplyToClient(client, rlength, reply);
 +        free(reply);
 +        return Success;
 +    }
 +}
 +
 +int
 +ProcQueryTextExtents(ClientPtr client)
 +{
 +    xQueryTextExtentsReply reply;
 +    FontPtr pFont;
 +    ExtentInfoRec info;
 +    unsigned long length;
 +    int rc;
 +
 +    REQUEST(xQueryTextExtentsReq);
 +    REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
 +
 +    rc = dixLookupFontable(&pFont, stuff->fid, client, DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    length = client->req_len - bytes_to_int32(sizeof(xQueryTextExtentsReq));
 +    length = length << 1;
 +    if (stuff->oddLength) {
 +        if (length == 0)
 +            return BadLength;
 +        length--;
 +    }
 +    if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
 +        return BadAlloc;
 +
 +    reply.type = X_Reply;
 +    reply.drawDirection = info.drawDirection;
 +    reply.sequenceNumber = client->sequence;
 +    reply.length = 0;
 +    reply.fontAscent = info.fontAscent;
 +    reply.fontDescent = info.fontDescent;
 +    reply.overallAscent = info.overallAscent;
 +    reply.overallDescent = info.overallDescent;
 +    reply.overallWidth = info.overallWidth;
 +    reply.overallLeft = info.overallLeft;
 +    reply.overallRight = info.overallRight;
 +
 +    WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
 +    return Success;
 +}
 +
 +int
 +ProcListFonts(ClientPtr client)
 +{
 +    REQUEST(xListFontsReq);
 +
 +    REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes);
 +
 +    return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes,
 +                     stuff->maxNames);
 +}
 +
 +int
 +ProcListFontsWithInfo(ClientPtr client)
 +{
 +    REQUEST(xListFontsWithInfoReq);
 +
 +    REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes);
 +
 +    return StartListFontsWithInfo(client, stuff->nbytes,
 +                                  (unsigned char *) &stuff[1], stuff->maxNames);
 +}
 +
 +/**
 + *
 + *  \param value must conform to DeleteType
 + */
 +int
 +dixDestroyPixmap(void *value, XID pid)
 +{
 +    PixmapPtr pPixmap = (PixmapPtr) value;
 +
 +    return (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
 +}
 +
 +int
 +ProcCreatePixmap(ClientPtr client)
 +{
 +    PixmapPtr pMap;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xCreatePixmapReq);
 +    DepthPtr pDepth;
 +    int i, rc;
 +
 +    REQUEST_SIZE_MATCH(xCreatePixmapReq);
 +    client->errorValue = stuff->pid;
 +    LEGAL_NEW_RESOURCE(stuff->pid, client);
 +
 +    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
 +                           DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    if (!stuff->width || !stuff->height) {
 +        client->errorValue = 0;
 +        return BadValue;
 +    }
 +    if (stuff->width > 32767 || stuff->height > 32767) {
 +        /* It is allowed to try and allocate a pixmap which is larger than
 +         * 32767 in either dimension. However, all of the framebuffer code
 +         * is buggy and does not reliably draw to such big pixmaps, basically
 +         * because the Region data structure operates with signed shorts
 +         * for the rectangles in it.
 +         *
 +         * Furthermore, several places in the X server computes the
 +         * size in bytes of the pixmap and tries to store it in an
 +         * integer. This integer can overflow and cause the allocated size
 +         * to be much smaller.
 +         *
 +         * So, such big pixmaps are rejected here with a BadAlloc
 +         */
 +        return BadAlloc;
 +    }
 +    if (stuff->depth != 1) {
 +        pDepth = pDraw->pScreen->allowedDepths;
 +        for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
 +            if (pDepth->depth == stuff->depth)
 +                goto CreatePmap;
 +        client->errorValue = stuff->depth;
 +        return BadValue;
 +    }
 + CreatePmap:
 +    pMap = (PixmapPtr) (*pDraw->pScreen->CreatePixmap)
 +        (pDraw->pScreen, stuff->width, stuff->height, stuff->depth, 0);
 +    if (pMap) {
 +        pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
 +        pMap->drawable.id = stuff->pid;
 +        /* security creation/labeling check */
 +        rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
 +                      pMap, RT_NONE, NULL, DixCreateAccess);
 +        if (rc != Success) {
 +            (*pDraw->pScreen->DestroyPixmap) (pMap);
 +            return rc;
 +        }
 +        if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap))
 +            return Success;
 +    }
 +    return BadAlloc;
 +}
 +
 +int
 +ProcFreePixmap(ClientPtr client)
 +{
 +    PixmapPtr pMap;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +
 +    rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP,
 +                                 client, DixDestroyAccess);
 +    if (rc == Success) {
 +        FreeResource(stuff->id, RT_NONE);
 +        return Success;
 +    }
 +    else {
 +        client->errorValue = stuff->id;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcCreateGC(ClientPtr client)
 +{
 +    int error, rc;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +    unsigned len;
 +
 +    REQUEST(xCreateGCReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xCreateGCReq);
 +    client->errorValue = stuff->gc;
 +    LEGAL_NEW_RESOURCE(stuff->gc, client);
 +    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
 +                           DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
 +    if (len != Ones(stuff->mask))
 +        return BadLength;
 +    pGC = (GC *) CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error,
 +                          stuff->gc, client);
 +    if (error != Success)
 +        return error;
 +    if (!AddResource(stuff->gc, RT_GC, (void *) pGC))
 +        return BadAlloc;
 +    return Success;
 +}
 +
 +int
 +ProcChangeGC(ClientPtr client)
 +{
 +    GC *pGC;
 +    int result;
 +    unsigned len;
 +
 +    REQUEST(xChangeGCReq);
 +    REQUEST_AT_LEAST_SIZE(xChangeGCReq);
 +
 +    result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
 +    if (result != Success)
 +        return result;
 +
 +    len = client->req_len - bytes_to_int32(sizeof(xChangeGCReq));
 +    if (len != Ones(stuff->mask))
 +        return BadLength;
 +
 +    return ChangeGCXIDs(client, pGC, stuff->mask, (CARD32 *) &stuff[1]);
 +}
 +
 +int
 +ProcCopyGC(ClientPtr client)
 +{
 +    GC *dstGC;
 +    GC *pGC;
 +    int result;
 +
 +    REQUEST(xCopyGCReq);
 +    REQUEST_SIZE_MATCH(xCopyGCReq);
 +
 +    result = dixLookupGC(&pGC, stuff->srcGC, client, DixGetAttrAccess);
 +    if (result != Success)
 +        return result;
 +    result = dixLookupGC(&dstGC, stuff->dstGC, client, DixSetAttrAccess);
 +    if (result != Success)
 +        return result;
 +    if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
 +        return BadMatch;
 +    if (stuff->mask & ~GCAllBits) {
 +        client->errorValue = stuff->mask;
 +        return BadValue;
 +    }
 +    return CopyGC(pGC, dstGC, stuff->mask);
 +}
 +
 +int
 +ProcSetDashes(ClientPtr client)
 +{
 +    GC *pGC;
 +    int result;
 +
 +    REQUEST(xSetDashesReq);
 +
 +    REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
 +    if (stuff->nDashes == 0) {
 +        client->errorValue = 0;
 +        return BadValue;
 +    }
 +
 +    result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
 +    if (result != Success)
 +        return result;
 +
 +    /* If there's an error, either there's no sensible errorValue,
 +     * or there was a dash segment of 0. */
 +    client->errorValue = 0;
 +    return SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
 +                     (unsigned char *) &stuff[1]);
 +}
 +
 +int
 +ProcSetClipRectangles(ClientPtr client)
 +{
 +    int nr, result;
 +    GC *pGC;
 +
 +    REQUEST(xSetClipRectanglesReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
 +    if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
 +        (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
 +        client->errorValue = stuff->ordering;
 +        return BadValue;
 +    }
 +    result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
 +    if (result != Success)
 +        return result;
 +
 +    nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);
 +    if (nr & 4)
 +        return BadLength;
 +    nr >>= 3;
 +    return SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,
 +                        nr, (xRectangle *) &stuff[1], (int) stuff->ordering);
 +}
 +
 +int
 +ProcFreeGC(ClientPtr client)
 +{
 +    GC *pGC;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +
 +    rc = dixLookupGC(&pGC, stuff->id, client, DixDestroyAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    FreeResource(stuff->id, RT_NONE);
 +    return Success;
 +}
 +
 +int
 +ProcClearToBackground(ClientPtr client)
 +{
 +    REQUEST(xClearAreaReq);
 +    WindowPtr pWin;
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xClearAreaReq);
 +    rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
 +    if (rc != Success)
 +        return rc;
 +    if (pWin->drawable.class == InputOnly) {
 +        client->errorValue = stuff->window;
 +        return BadMatch;
 +    }
 +    if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) {
 +        client->errorValue = stuff->exposures;
 +        return BadValue;
 +    }
 +    (*pWin->drawable.pScreen->ClearToBackground) (pWin, stuff->x, stuff->y,
 +                                                  stuff->width, stuff->height,
 +                                                  (Bool) stuff->exposures);
 +    return Success;
 +}
 +
 +/* send GraphicsExpose events, or a NoExpose event, based on the region */
 +void
 +SendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable,
 +                     int major, int minor)
 +{
 +    if (pRgn && !RegionNil(pRgn)) {
 +        xEvent *pEvent;
 +        xEvent *pe;
 +        BoxPtr pBox;
 +        int i;
 +        int numRects;
 +
 +        numRects = RegionNumRects(pRgn);
 +        pBox = RegionRects(pRgn);
 +        if (!(pEvent = calloc(numRects, sizeof(xEvent))))
 +            return;
 +        pe = pEvent;
 +
 +        for (i = 1; i <= numRects; i++, pe++, pBox++) {
 +            pe->u.u.type = GraphicsExpose;
 +            pe->u.graphicsExposure.drawable = drawable;
 +            pe->u.graphicsExposure.x = pBox->x1;
 +            pe->u.graphicsExposure.y = pBox->y1;
 +            pe->u.graphicsExposure.width = pBox->x2 - pBox->x1;
 +            pe->u.graphicsExposure.height = pBox->y2 - pBox->y1;
 +            pe->u.graphicsExposure.count = numRects - i;
 +            pe->u.graphicsExposure.majorEvent = major;
 +            pe->u.graphicsExposure.minorEvent = minor;
 +        }
 +        /* GraphicsExpose is a "critical event", which TryClientEvents
 +         * handles specially. */
 +        TryClientEvents(client, NULL, pEvent, numRects,
 +                        (Mask) 0, NoEventMask, NullGrab);
 +        free(pEvent);
 +    }
 +    else {
 +        xEvent event = {
 +            .u.noExposure.drawable = drawable,
 +            .u.noExposure.majorEvent = major,
 +            .u.noExposure.minorEvent = minor
 +        };
 +        event.u.u.type = NoExpose;
 +        WriteEventsToClient(client, 1, &event);
 +    }
 +}
 +
 +int
 +ProcCopyArea(ClientPtr client)
 +{
 +    DrawablePtr pDst;
 +    DrawablePtr pSrc;
 +    GC *pGC;
 +
 +    REQUEST(xCopyAreaReq);
 +    RegionPtr pRgn;
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xCopyAreaReq);
 +
 +    VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
 +    if (stuff->dstDrawable != stuff->srcDrawable) {
 +        rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
 +                               DixReadAccess);
 +        if (rc != Success)
 +            return rc;
 +        if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) {
 +            client->errorValue = stuff->dstDrawable;
 +            return BadMatch;
 +        }
 +    }
 +    else
 +        pSrc = pDst;
 +
 +    pRgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, stuff->srcX, stuff->srcY,
 +                                  stuff->width, stuff->height,
 +                                  stuff->dstX, stuff->dstY);
 +    if (pGC->graphicsExposures) {
 +        SendGraphicsExpose(client, pRgn, stuff->dstDrawable, X_CopyArea, 0);
 +        if (pRgn)
 +            RegionDestroy(pRgn);
 +    }
 +
 +    return Success;
 +}
 +
 +int
 +ProcCopyPlane(ClientPtr client)
 +{
 +    DrawablePtr psrcDraw, pdstDraw;
 +    GC *pGC;
 +
 +    REQUEST(xCopyPlaneReq);
 +    RegionPtr pRgn;
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xCopyPlaneReq);
 +
 +    VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
 +    if (stuff->dstDrawable != stuff->srcDrawable) {
 +        rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
 +                               DixReadAccess);
 +        if (rc != Success)
 +            return rc;
 +
 +        if (pdstDraw->pScreen != psrcDraw->pScreen) {
 +            client->errorValue = stuff->dstDrawable;
 +            return BadMatch;
 +        }
 +    }
 +    else
 +        psrcDraw = pdstDraw;
 +
 +    /* Check to see if stuff->bitPlane has exactly ONE good bit set */
 +    if (stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
 +        (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) {
 +        client->errorValue = stuff->bitPlane;
 +        return BadValue;
 +    }
 +
 +    pRgn =
 +        (*pGC->ops->CopyPlane) (psrcDraw, pdstDraw, pGC, stuff->srcX,
 +                                stuff->srcY, stuff->width, stuff->height,
 +                                stuff->dstX, stuff->dstY, stuff->bitPlane);
 +    if (pGC->graphicsExposures) {
 +        SendGraphicsExpose(client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);
 +        if (pRgn)
 +            RegionDestroy(pRgn);
 +    }
 +    return Success;
 +}
 +
 +int
 +ProcPolyPoint(ClientPtr client)
 +{
 +    int npoint;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xPolyPointReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xPolyPointReq);
 +    if ((stuff->coordMode != CoordModeOrigin) &&
 +        (stuff->coordMode != CoordModePrevious)) {
 +        client->errorValue = stuff->coordMode;
 +        return BadValue;
 +    }
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
 +    if (npoint)
 +        (*pGC->ops->PolyPoint) (pDraw, pGC, stuff->coordMode, npoint,
 +                                (xPoint *) &stuff[1]);
 +    return Success;
 +}
 +
 +int
 +ProcPolyLine(ClientPtr client)
 +{
 +    int npoint;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xPolyLineReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xPolyLineReq);
 +    if ((stuff->coordMode != CoordModeOrigin) &&
 +        (stuff->coordMode != CoordModePrevious)) {
 +        client->errorValue = stuff->coordMode;
 +        return BadValue;
 +    }
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
 +    if (npoint > 1)
 +        (*pGC->ops->Polylines) (pDraw, pGC, stuff->coordMode, npoint,
 +                                (DDXPointPtr) &stuff[1]);
 +    return Success;
 +}
 +
 +int
 +ProcPolySegment(ClientPtr client)
 +{
 +    int nsegs;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xPolySegmentReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
 +    if (nsegs & 4)
 +        return BadLength;
 +    nsegs >>= 3;
 +    if (nsegs)
 +        (*pGC->ops->PolySegment) (pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
 +    return Success;
 +}
 +
 +int
 +ProcPolyRectangle(ClientPtr client)
 +{
 +    int nrects;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xPolyRectangleReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
 +    if (nrects & 4)
 +        return BadLength;
 +    nrects >>= 3;
 +    if (nrects)
 +        (*pGC->ops->PolyRectangle) (pDraw, pGC,
 +                                    nrects, (xRectangle *) &stuff[1]);
 +    return Success;
 +}
 +
 +int
 +ProcPolyArc(ClientPtr client)
 +{
 +    int narcs;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xPolyArcReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xPolyArcReq);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
 +    if (narcs % sizeof(xArc))
 +        return BadLength;
 +    narcs /= sizeof(xArc);
 +    if (narcs)
 +        (*pGC->ops->PolyArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
 +    return Success;
 +}
 +
 +int
 +ProcFillPoly(ClientPtr client)
 +{
 +    int things;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xFillPolyReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xFillPolyReq);
 +    if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) &&
 +        (stuff->shape != Convex)) {
 +        client->errorValue = stuff->shape;
 +        return BadValue;
 +    }
 +    if ((stuff->coordMode != CoordModeOrigin) &&
 +        (stuff->coordMode != CoordModePrevious)) {
 +        client->errorValue = stuff->coordMode;
 +        return BadValue;
 +    }
 +
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    things = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
 +    if (things)
 +        (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,
 +                                  stuff->coordMode, things,
 +                                  (DDXPointPtr) &stuff[1]);
 +    return Success;
 +}
 +
 +int
 +ProcPolyFillRectangle(ClientPtr client)
 +{
 +    int things;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xPolyFillRectangleReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
 +    if (things & 4)
 +        return BadLength;
 +    things >>= 3;
 +
 +    if (things)
 +        (*pGC->ops->PolyFillRect) (pDraw, pGC, things,
 +                                   (xRectangle *) &stuff[1]);
 +    return Success;
 +}
 +
 +int
 +ProcPolyFillArc(ClientPtr client)
 +{
 +    int narcs;
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +
 +    REQUEST(xPolyFillArcReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
 +    if (narcs % sizeof(xArc))
 +        return BadLength;
 +    narcs /= sizeof(xArc);
 +    if (narcs)
 +        (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
 +    return Success;
 +}
 +
 +#ifdef MATCH_CLIENT_ENDIAN
 +
 +int
 +ServerOrder(void)
 +{
 +    int whichbyte = 1;
 +
 +    if (*((char *) &whichbyte))
 +        return LSBFirst;
 +    return MSBFirst;
 +}
 +
 +#define ClientOrder(client) ((client)->swapped ? !ServerOrder() : ServerOrder())
 +
 +void
 +ReformatImage(char *base, int nbytes, int bpp, int order)
 +{
 +    switch (bpp) {
 +    case 1:                    /* yuck */
 +        if (BITMAP_BIT_ORDER != order)
 +            BitOrderInvert((unsigned char *) base, nbytes);
 +#if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8
 +        ReformatImage(base, nbytes, BITMAP_SCANLINE_UNIT, order);
 +#endif
 +        break;
 +    case 4:
 +        break;                  /* yuck */
 +    case 8:
 +        break;
 +    case 16:
 +        if (IMAGE_BYTE_ORDER != order)
 +            TwoByteSwap((unsigned char *) base, nbytes);
 +        break;
 +    case 32:
 +        if (IMAGE_BYTE_ORDER != order)
 +            FourByteSwap((unsigned char *) base, nbytes);
 +        break;
 +    }
 +}
 +#else
 +#define ReformatImage(b,n,bpp,o)
 +#endif
 +
 +/* 64-bit server notes: the protocol restricts padding of images to
 + * 8-, 16-, or 32-bits. We would like to have 64-bits for the server
 + * to use internally. Removes need for internal alignment checking.
 + * All of the PutImage functions could be changed individually, but
 + * as currently written, they call other routines which require things
 + * to be 64-bit padded on scanlines, so we changed things here.
 + * If an image would be padded differently for 64- versus 32-, then
 + * copy each scanline to a 64-bit padded scanline.
 + * Also, we need to make sure that the image is aligned on a 64-bit
 + * boundary, even if the scanlines are padded to our satisfaction.
 + */
 +int
 +ProcPutImage(ClientPtr client)
 +{
 +    GC *pGC;
 +    DrawablePtr pDraw;
 +    long length;                /* length of scanline server padded */
 +    long lengthProto;           /* length of scanline protocol padded */
 +    char *tmpImage;
 +
 +    REQUEST(xPutImageReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xPutImageReq);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +    if (stuff->format == XYBitmap) {
 +        if ((stuff->depth != 1) ||
 +            (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad))
 +            return BadMatch;
 +        length = BitmapBytePad(stuff->width + stuff->leftPad);
 +    }
 +    else if (stuff->format == XYPixmap) {
 +        if ((pDraw->depth != stuff->depth) ||
 +            (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad))
 +            return BadMatch;
 +        length = BitmapBytePad(stuff->width + stuff->leftPad);
 +        length *= stuff->depth;
 +    }
 +    else if (stuff->format == ZPixmap) {
 +        if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))
 +            return BadMatch;
 +        length = PixmapBytePad(stuff->width, stuff->depth);
 +    }
 +    else {
 +        client->errorValue = stuff->format;
 +        return BadValue;
 +    }
 +
 +    tmpImage = (char *) &stuff[1];
 +    lengthProto = length;
 +
 +    if ((bytes_to_int32(lengthProto * stuff->height) +
 +         bytes_to_int32(sizeof(xPutImageReq))) != client->req_len)
 +        return BadLength;
 +
 +    ReformatImage(tmpImage, lengthProto * stuff->height,
 +                  stuff->format == ZPixmap ? BitsPerPixel(stuff->depth) : 1,
 +                  ClientOrder(client));
 +
 +    (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,
 +                           stuff->width, stuff->height,
 +                           stuff->leftPad, stuff->format, tmpImage);
 +
 +    return Success;
 +}
 +
 +static int
 +DoGetImage(ClientPtr client, int format, Drawable drawable,
 +           int x, int y, int width, int height,
 +           Mask planemask)
 +{
 +    DrawablePtr pDraw, pBoundingDraw;
 +    int nlines, linesPerBuf, rc;
 +    int linesDone;
 +
 +    /* coordinates relative to the bounding drawable */
 +    int relx, rely;
 +    long widthBytesLine, length;
 +    Mask plane = 0;
 +    char *pBuf;
 +    xGetImageReply xgi;
 +    RegionPtr pVisibleRegion = NULL;
 +
 +    if ((format != XYPixmap) && (format != ZPixmap)) {
 +        client->errorValue = format;
 +        return BadValue;
 +    }
 +    rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    memset(&xgi, 0, sizeof(xGetImageReply));
 +
 +    relx = x;
 +    rely = y;
 +
 +    if (pDraw->type == DRAWABLE_WINDOW) {
 +        WindowPtr pWin = (WindowPtr) pDraw;
 +
 +        /* "If the drawable is a window, the window must be viewable ... or a
 +         * BadMatch error results" */
 +        if (!pWin->viewable)
 +            return BadMatch;
 +
 +        /* If the drawable is a window, the rectangle must be contained within
 +         * its bounds (including the border). */
 +        if (x < -wBorderWidth(pWin) ||
 +            x + width > wBorderWidth(pWin) + (int) pDraw->width ||
 +            y < -wBorderWidth(pWin) ||
 +            y + height > wBorderWidth(pWin) + (int) pDraw->height)
 +            return BadMatch;
 +
 +        relx += pDraw->x;
 +        rely += pDraw->y;
 +
 +        if (pDraw->pScreen->GetWindowPixmap) {
 +            PixmapPtr pPix = (*pDraw->pScreen->GetWindowPixmap) (pWin);
 +
 +            pBoundingDraw = &pPix->drawable;
 +#ifdef COMPOSITE
 +            relx -= pPix->screen_x;
 +            rely -= pPix->screen_y;
 +#endif
 +        }
 +        else {
 +            pBoundingDraw = (DrawablePtr) pDraw->pScreen->root;
 +        }
 +
 +        xgi.visual = wVisual(pWin);
 +    }
 +    else {
 +        pBoundingDraw = pDraw;
 +        xgi.visual = None;
 +    }
 +
 +    /* "If the drawable is a pixmap, the given rectangle must be wholly
 +     *  contained within the pixmap, or a BadMatch error results.  If the
 +     *  drawable is a window [...] it must be the case that if there were no
 +     *  inferiors or overlapping windows, the specified rectangle of the window
 +     *  would be fully visible on the screen and wholly contained within the
 +     *  outside edges of the window, or a BadMatch error results."
 +     *
 +     * We relax the window case slightly to mean that the rectangle must exist
 +     * within the bounds of the window's backing pixmap.  In particular, this
 +     * means that a GetImage request may succeed or fail with BadMatch depending
 +     * on whether any of its ancestor windows are redirected.  */
 +    if (relx < 0 || relx + width > (int) pBoundingDraw->width ||
 +        rely < 0 || rely + height > (int) pBoundingDraw->height)
 +        return BadMatch;
 +
 +    xgi.type = X_Reply;
 +    xgi.sequenceNumber = client->sequence;
 +    xgi.depth = pDraw->depth;
 +    if (format == ZPixmap) {
 +        widthBytesLine = PixmapBytePad(width, pDraw->depth);
 +        length = widthBytesLine * height;
 +
 +    }
 +    else {
 +        widthBytesLine = BitmapBytePad(width);
 +        plane = ((Mask) 1) << (pDraw->depth - 1);
 +        /* only planes asked for */
 +        length = widthBytesLine * height *
 +            Ones(planemask & (plane | (plane - 1)));
 +
 +    }
 +
 +    xgi.length = length;
 +
 +    xgi.length = bytes_to_int32(xgi.length);
 +    if (widthBytesLine == 0 || height == 0)
 +        linesPerBuf = 0;
 +    else if (widthBytesLine >= IMAGE_BUFSIZE)
 +        linesPerBuf = 1;
 +    else {
 +        linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
 +        if (linesPerBuf > height)
 +            linesPerBuf = height;
 +    }
 +    length = linesPerBuf * widthBytesLine;
 +    if (linesPerBuf < height) {
 +        /* we have to make sure intermediate buffers don't need padding */
 +        while ((linesPerBuf > 1) &&
 +               (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
 +            linesPerBuf--;
 +            length -= widthBytesLine;
 +        }
 +        while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
 +            linesPerBuf++;
 +            length += widthBytesLine;
 +        }
 +    }
 +    if (!(pBuf = calloc(1, length)))
 +        return BadAlloc;
 +    WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
 +
 +    if (pDraw->type == DRAWABLE_WINDOW) {
 +        pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
 +        if (pVisibleRegion) {
 +            RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
 +        }
 +    }
 +
 +    if (linesPerBuf == 0) {
 +        /* nothing to do */
 +    }
 +    else if (format == ZPixmap) {
 +        linesDone = 0;
 +        while (height - linesDone > 0) {
 +            nlines = min(linesPerBuf, height - linesDone);
 +            (*pDraw->pScreen->GetImage) (pDraw,
 +                                         x,
 +                                         y + linesDone,
 +                                         width,
 +                                         nlines,
 +                                         format, planemask, (void *) pBuf);
 +            if (pVisibleRegion)
 +                XaceCensorImage(client, pVisibleRegion, widthBytesLine,
 +                                pDraw, x, y + linesDone, width,
 +                                nlines, format, pBuf);
 +
 +            /* Note that this is NOT a call to WriteSwappedDataToClient,
 +               as we do NOT byte swap */
 +            ReformatImage(pBuf, (int) (nlines * widthBytesLine),
 +                          BitsPerPixel(pDraw->depth), ClientOrder(client));
 +
 +            WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
 +            linesDone += nlines;
 +        }
 +    }
 +    else {                      /* XYPixmap */
 +
 +        for (; plane; plane >>= 1) {
 +            if (planemask & plane) {
 +                linesDone = 0;
 +                while (height - linesDone > 0) {
 +                    nlines = min(linesPerBuf, height - linesDone);
 +                    (*pDraw->pScreen->GetImage) (pDraw,
 +                                                 x,
 +                                                 y + linesDone,
 +                                                 width,
 +                                                 nlines,
 +                                                 format, plane, (void *) pBuf);
 +                    if (pVisibleRegion)
 +                        XaceCensorImage(client, pVisibleRegion,
 +                                        widthBytesLine,
 +                                        pDraw, x, y + linesDone, width,
 +                                        nlines, format, pBuf);
 +
 +                    /* Note: NOT a call to WriteSwappedDataToClient,
 +                       as we do NOT byte swap */
 +                    ReformatImage(pBuf, (int) (nlines * widthBytesLine),
 +                                  1, ClientOrder(client));
 +
 +                    WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
 +                    linesDone += nlines;
 +                }
 +            }
 +        }
 +    }
 +    if (pVisibleRegion)
 +        RegionDestroy(pVisibleRegion);
 +    free(pBuf);
 +    return Success;
 +}
 +
 +int
 +ProcGetImage(ClientPtr client)
 +{
 +    REQUEST(xGetImageReq);
 +
 +    REQUEST_SIZE_MATCH(xGetImageReq);
 +
 +    return DoGetImage(client, stuff->format, stuff->drawable,
 +                      stuff->x, stuff->y,
 +                      (int) stuff->width, (int) stuff->height,
 +                      stuff->planeMask);
 +}
 +
 +int
 +ProcPolyText(ClientPtr client)
 +{
 +    int err;
 +
 +    REQUEST(xPolyTextReq);
 +    DrawablePtr pDraw;
 +    GC *pGC;
 +
 +    REQUEST_AT_LEAST_SIZE(xPolyTextReq);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +
 +    err = PolyText(client,
 +                   pDraw,
 +                   pGC,
 +                   (unsigned char *) &stuff[1],
 +                   ((unsigned char *) stuff) + (client->req_len << 2),
 +                   stuff->x, stuff->y, stuff->reqType, stuff->drawable);
 +
 +    if (err == Success) {
 +        return Success;
 +    }
 +    else
 +        return err;
 +}
 +
 +int
 +ProcImageText8(ClientPtr client)
 +{
 +    int err;
 +    DrawablePtr pDraw;
 +    GC *pGC;
 +
 +    REQUEST(xImageTextReq);
 +
 +    REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +
 +    err = ImageText(client,
 +                    pDraw,
 +                    pGC,
 +                    stuff->nChars,
 +                    (unsigned char *) &stuff[1],
 +                    stuff->x, stuff->y, stuff->reqType, stuff->drawable);
 +
 +    if (err == Success) {
 +        return Success;
 +    }
 +    else
 +        return err;
 +}
 +
 +int
 +ProcImageText16(ClientPtr client)
 +{
 +    int err;
 +    DrawablePtr pDraw;
 +    GC *pGC;
 +
 +    REQUEST(xImageTextReq);
 +
 +    REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
 +    VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
 +
 +    err = ImageText(client,
 +                    pDraw,
 +                    pGC,
 +                    stuff->nChars,
 +                    (unsigned char *) &stuff[1],
 +                    stuff->x, stuff->y, stuff->reqType, stuff->drawable);
 +
 +    if (err == Success) {
 +        return Success;
 +    }
 +    else
 +        return err;
 +}
 +
 +int
 +ProcCreateColormap(ClientPtr client)
 +{
 +    VisualPtr pVisual;
 +    ColormapPtr pmap;
 +    Colormap mid;
 +    WindowPtr pWin;
 +    ScreenPtr pScreen;
 +
 +    REQUEST(xCreateColormapReq);
 +    int i, result;
 +
 +    REQUEST_SIZE_MATCH(xCreateColormapReq);
 +
 +    if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll)) {
 +        client->errorValue = stuff->alloc;
 +        return BadValue;
 +    }
 +    mid = stuff->mid;
 +    LEGAL_NEW_RESOURCE(mid, client);
 +    result = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
 +    if (result != Success)
 +        return result;
 +
 +    pScreen = pWin->drawable.pScreen;
 +    for (i = 0, pVisual = pScreen->visuals;
 +         i < pScreen->numVisuals; i++, pVisual++) {
 +        if (pVisual->vid != stuff->visual)
 +            continue;
 +        return CreateColormap(mid, pScreen, pVisual, &pmap,
 +                              (int) stuff->alloc, client->index);
 +    }
 +    client->errorValue = stuff->visual;
 +    return BadMatch;
 +}
 +
 +int
 +ProcFreeColormap(ClientPtr client)
 +{
 +    ColormapPtr pmap;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupResourceByType((void **) &pmap, stuff->id, RT_COLORMAP,
 +                                 client, DixDestroyAccess);
 +    if (rc == Success) {
 +        /* Freeing a default colormap is a no-op */
 +        if (!(pmap->flags & IsDefault))
 +            FreeResource(stuff->id, RT_NONE);
 +        return Success;
 +    }
 +    else {
 +        client->errorValue = stuff->id;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcCopyColormapAndFree(ClientPtr client)
 +{
 +    Colormap mid;
 +    ColormapPtr pSrcMap;
 +
 +    REQUEST(xCopyColormapAndFreeReq);
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
 +    mid = stuff->mid;
 +    LEGAL_NEW_RESOURCE(mid, client);
 +    rc = dixLookupResourceByType((void **) &pSrcMap, stuff->srcCmap,
 +                                 RT_COLORMAP, client,
 +                                 DixReadAccess | DixRemoveAccess);
 +    if (rc == Success)
 +        return CopyColormapAndFree(mid, pSrcMap, client->index);
 +    client->errorValue = stuff->srcCmap;
 +    return rc;
 +}
 +
 +int
 +ProcInstallColormap(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
 +                                 client, DixInstallAccess);
 +    if (rc != Success)
 +        goto out;
 +
 +    rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
 +    if (rc != Success) {
 +        if (rc == BadValue)
 +            rc = BadColor;
 +        goto out;
 +    }
 +
 +    (*(pcmp->pScreen->InstallColormap)) (pcmp);
 +    return Success;
 +
 + out:
 +    client->errorValue = stuff->id;
 +    return rc;
 +}
 +
 +int
 +ProcUninstallColormap(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
 +                                 client, DixUninstallAccess);
 +    if (rc != Success)
 +        goto out;
 +
 +    rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
 +    if (rc != Success) {
 +        if (rc == BadValue)
 +            rc = BadColor;
 +        goto out;
 +    }
 +
 +    if (pcmp->mid != pcmp->pScreen->defColormap)
 +        (*(pcmp->pScreen->UninstallColormap)) (pcmp);
 +    return Success;
 +
 + out:
 +    client->errorValue = stuff->id;
 +    return rc;
 +}
 +
 +int
 +ProcListInstalledColormaps(ClientPtr client)
 +{
 +    xListInstalledColormapsReply *preply;
 +    int nummaps, rc;
 +    WindowPtr pWin;
 +
 +    REQUEST(xResourceReq);
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +
 +    rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
 +                  DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    preply = malloc(sizeof(xListInstalledColormapsReply) +
 +                    pWin->drawable.pScreen->maxInstalledCmaps *
 +                    sizeof(Colormap));
 +    if (!preply)
 +        return BadAlloc;
 +
 +    preply->type = X_Reply;
 +    preply->sequenceNumber = client->sequence;
 +    nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
 +        (pWin->drawable.pScreen, (Colormap *) &preply[1]);
 +    preply->nColormaps = nummaps;
 +    preply->length = nummaps;
 +    WriteReplyToClient(client, sizeof(xListInstalledColormapsReply), preply);
 +    client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 +    WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
 +    free(preply);
 +    return Success;
 +}
 +
 +int
 +ProcAllocColor(ClientPtr client)
 +{
 +    ColormapPtr pmap;
 +    int rc;
 +
 +    REQUEST(xAllocColorReq);
 +
 +    REQUEST_SIZE_MATCH(xAllocColorReq);
 +    rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, RT_COLORMAP,
 +                                 client, DixAddAccess);
 +    if (rc == Success) {
 +        xAllocColorReply acr;
 +        acr.type = X_Reply;
 +        acr.sequenceNumber = client->sequence;
 +        acr.length = 0;
 +        acr.red = stuff->red;
 +        acr.green = stuff->green;
 +        acr.blue = stuff->blue;
 +        acr.pixel = 0;
 +        if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
 +                             &acr.pixel, client->index)))
 +            return rc;
 +#ifdef PANORAMIX
 +        if (noPanoramiXExtension || !pmap->pScreen->myNum)
 +#endif
 +            WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
 +        return Success;
 +
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcAllocNamedColor(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xAllocNamedColorReq);
 +
 +    REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 +                                 client, DixAddAccess);
 +    if (rc == Success) {
 +        xAllocNamedColorReply ancr;
 +        ancr.type = X_Reply;
 +        ancr.sequenceNumber = client->sequence;
 +        ancr.length = 0;
 +
 +        if (OsLookupColor
 +            (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
 +             &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
 +            ancr.screenRed = ancr.exactRed;
 +            ancr.screenGreen = ancr.exactGreen;
 +            ancr.screenBlue = ancr.exactBlue;
 +            ancr.pixel = 0;
 +            if ((rc = AllocColor(pcmp,
 +                                 &ancr.screenRed, &ancr.screenGreen,
 +                                 &ancr.screenBlue, &ancr.pixel, client->index)))
 +                return rc;
 +#ifdef PANORAMIX
 +            if (noPanoramiXExtension || !pcmp->pScreen->myNum)
 +#endif
 +                WriteReplyToClient(client, sizeof(xAllocNamedColorReply),
 +                                   &ancr);
 +            return Success;
 +        }
 +        else
 +            return BadName;
 +
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcAllocColorCells(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xAllocColorCellsReq);
 +
 +    REQUEST_SIZE_MATCH(xAllocColorCellsReq);
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 +                                 client, DixAddAccess);
 +    if (rc == Success) {
 +        int npixels, nmasks;
 +        long length;
 +        Pixel *ppixels, *pmasks;
 +
 +        npixels = stuff->colors;
 +        if (!npixels) {
 +            client->errorValue = npixels;
 +            return BadValue;
 +        }
 +        if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) {
 +            client->errorValue = stuff->contiguous;
 +            return BadValue;
 +        }
 +        nmasks = stuff->planes;
 +        length = ((long) npixels + (long) nmasks) * sizeof(Pixel);
 +        ppixels = malloc(length);
 +        if (!ppixels)
 +            return BadAlloc;
 +        pmasks = ppixels + npixels;
 +
 +        if ((rc = AllocColorCells(client->index, pcmp, npixels, nmasks,
 +                                  (Bool) stuff->contiguous, ppixels, pmasks))) {
 +            free(ppixels);
 +            return rc;
 +        }
 +#ifdef PANORAMIX
 +        if (noPanoramiXExtension || !pcmp->pScreen->myNum)
 +#endif
 +        {
 +            xAllocColorCellsReply accr;
 +            accr.type = X_Reply;
 +            accr.sequenceNumber = client->sequence;
 +            accr.length = bytes_to_int32(length);
 +            accr.nPixels = npixels;
 +            accr.nMasks = nmasks;
 +            WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
 +            client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 +            WriteSwappedDataToClient(client, length, ppixels);
 +        }
 +        free(ppixels);
 +        return Success;
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcAllocColorPlanes(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xAllocColorPlanesReq);
 +
 +    REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 +                                 client, DixAddAccess);
 +    if (rc == Success) {
 +        xAllocColorPlanesReply acpr;
 +        int npixels;
 +        long length;
 +        Pixel *ppixels;
 +
 +        npixels = stuff->colors;
 +        if (!npixels) {
 +            client->errorValue = npixels;
 +            return BadValue;
 +        }
 +        if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) {
 +            client->errorValue = stuff->contiguous;
 +            return BadValue;
 +        }
 +
 +        acpr.type = X_Reply;
 +        acpr.sequenceNumber = client->sequence;
 +        acpr.nPixels = npixels;
 +        
 +        length = (long) npixels *sizeof(Pixel);
 +
 +        ppixels = malloc(length);
 +        if (!ppixels)
 +            return BadAlloc;
 +        if ((rc = AllocColorPlanes(client->index, pcmp, npixels,
 +                                   (int) stuff->red, (int) stuff->green,
 +                                   (int) stuff->blue, (Bool) stuff->contiguous,
 +                                   ppixels, &acpr.redMask, &acpr.greenMask,
 +                                   &acpr.blueMask))) {
 +            free(ppixels);
 +            return rc;
 +        }
 +        acpr.length = bytes_to_int32(length);
 +#ifdef PANORAMIX
 +        if (noPanoramiXExtension || !pcmp->pScreen->myNum)
 +#endif
 +        {
 +            WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
 +            client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 +            WriteSwappedDataToClient(client, length, ppixels);
 +        }
 +        free(ppixels);
 +        return Success;
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcFreeColors(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xFreeColorsReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 +                                 client, DixRemoveAccess);
 +    if (rc == Success) {
 +        int count;
 +
 +        if (pcmp->flags & AllAllocated)
 +            return BadAccess;
 +        count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
 +        return FreeColors(pcmp, client->index, count,
 +                          (Pixel *) &stuff[1], (Pixel) stuff->planeMask);
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcStoreColors(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xStoreColorsReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 +                                 client, DixWriteAccess);
 +    if (rc == Success) {
 +        int count;
 +
 +        count = (client->req_len << 2) - sizeof(xStoreColorsReq);
 +        if (count % sizeof(xColorItem))
 +            return BadLength;
 +        count /= sizeof(xColorItem);
 +        return StoreColors(pcmp, count, (xColorItem *) &stuff[1], client);
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcStoreNamedColor(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xStoreNamedColorReq);
 +
 +    REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 +                                 client, DixWriteAccess);
 +    if (rc == Success) {
 +        xColorItem def;
 +
 +        if (OsLookupColor(pcmp->pScreen->myNum, (char *) &stuff[1],
 +                          stuff->nbytes, &def.red, &def.green, &def.blue)) {
 +            def.flags = stuff->flags;
 +            def.pixel = stuff->pixel;
 +            return StoreColors(pcmp, 1, &def, client);
 +        }
 +        return BadName;
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcQueryColors(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xQueryColorsReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 +                                 client, DixReadAccess);
 +    if (rc == Success) {
 +        int count;
 +        xrgb *prgbs;
 +        xQueryColorsReply qcr;
 +
 +        count =
 +            bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
 +        prgbs = calloc(1, count * sizeof(xrgb));
 +        if (!prgbs && count)
 +            return BadAlloc;
 +        if ((rc =
 +             QueryColors(pcmp, count, (Pixel *) &stuff[1], prgbs, client))) {
 +            free(prgbs);
 +            return rc;
 +        }
 +        memset(&qcr, 0, sizeof(xQueryColorsReply));
 +        qcr.type = X_Reply;
 +        qcr.sequenceNumber = client->sequence;
 +        qcr.length = bytes_to_int32(count * sizeof(xrgb));
 +        qcr.nColors = count;
 +        
 +        WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
 +        if (count) {
 +            client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
 +            WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
 +        }
 +        free(prgbs);
 +        return Success;
 +
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcLookupColor(ClientPtr client)
 +{
 +    ColormapPtr pcmp;
 +    int rc;
 +
 +    REQUEST(xLookupColorReq);
 +
 +    REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
 +    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
 +                                 client, DixReadAccess);
 +    if (rc == Success) {
 +        CARD16 exactRed, exactGreen, exactBlue;
 +
 +        if (OsLookupColor
 +            (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
 +             &exactRed, &exactGreen, &exactBlue)) {
 +            xLookupColorReply lcr;
 +            lcr.type = X_Reply;
 +            lcr.sequenceNumber = client->sequence;
 +            lcr.length = 0;
 +            lcr.exactRed = exactRed;
 +            lcr.exactGreen = exactGreen;
 +            lcr.exactBlue = exactBlue;
 +            lcr.screenRed = exactRed;
 +            lcr.screenGreen = exactGreen;
 +            lcr.screenBlue = exactBlue;
 +            
 +            (*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
 +                                            &lcr.screenGreen,
 +                                            &lcr.screenBlue, pcmp->pVisual);
 +            WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
 +            return Success;
 +        }
 +        return BadName;
 +    }
 +    else {
 +        client->errorValue = stuff->cmap;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcCreateCursor(ClientPtr client)
 +{
 +    CursorPtr pCursor;
 +    PixmapPtr src;
 +    PixmapPtr msk;
 +    unsigned char *srcbits;
 +    unsigned char *mskbits;
 +    unsigned short width, height;
 +    long n;
 +    CursorMetricRec cm;
 +    int rc;
 +
 +    REQUEST(xCreateCursorReq);
 +
 +    REQUEST_SIZE_MATCH(xCreateCursorReq);
 +    LEGAL_NEW_RESOURCE(stuff->cid, client);
 +
 +    rc = dixLookupResourceByType((void **) &src, stuff->source, RT_PIXMAP,
 +                                 client, DixReadAccess);
 +    if (rc != Success) {
 +        client->errorValue = stuff->source;
 +        return rc;
 +    }
 +
 +    if (src->drawable.depth != 1)
 +        return (BadMatch);
 +
 +    /* Find and validate cursor mask pixmap, if one is provided */
 +    if (stuff->mask != None) {
 +        rc = dixLookupResourceByType((void **) &msk, stuff->mask, RT_PIXMAP,
 +                                     client, DixReadAccess);
 +        if (rc != Success) {
 +            client->errorValue = stuff->mask;
 +            return rc;
 +        }
 +
 +        if (src->drawable.width != msk->drawable.width
 +            || src->drawable.height != msk->drawable.height
 +            || src->drawable.depth != 1 || msk->drawable.depth != 1)
 +            return BadMatch;
 +    }
 +    else
 +        msk = NULL;
 +
 +    width = src->drawable.width;
 +    height = src->drawable.height;
 +
 +    if (stuff->x > width || stuff->y > height)
 +        return BadMatch;
 +
 +    n = BitmapBytePad(width) * height;
 +    srcbits = calloc(1, n);
 +    if (!srcbits)
 +        return BadAlloc;
 +    mskbits = malloc(n);
 +    if (!mskbits) {
 +        free(srcbits);
 +        return BadAlloc;
 +    }
 +
 +    (*src->drawable.pScreen->GetImage) ((DrawablePtr) src, 0, 0, width, height,
 +                                        XYPixmap, 1, (void *) srcbits);
 +    if (msk == (PixmapPtr) NULL) {
 +        unsigned char *bits = mskbits;
 +
 +        while (--n >= 0)
 +            *bits++ = ~0;
 +    }
 +    else {
 +        /* zeroing the (pad) bits helps some ddx cursor handling */
 +        memset((char *) mskbits, 0, n);
 +        (*msk->drawable.pScreen->GetImage) ((DrawablePtr) msk, 0, 0, width,
 +                                            height, XYPixmap, 1,
 +                                            (void *) mskbits);
 +    }
 +    cm.width = width;
 +    cm.height = height;
 +    cm.xhot = stuff->x;
 +    cm.yhot = stuff->y;
 +    rc = AllocARGBCursor(srcbits, mskbits, NULL, &cm,
 +                         stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
 +                         stuff->backRed, stuff->backGreen, stuff->backBlue,
 +                         &pCursor, client, stuff->cid);
 +
 +    if (rc != Success)
 +        goto bail;
 +    if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
 +        rc = BadAlloc;
 +        goto bail;
 +    }
 +
 +    return Success;
 + bail:
 +    free(srcbits);
 +    free(mskbits);
 +    return rc;
 +}
 +
 +int
 +ProcCreateGlyphCursor(ClientPtr client)
 +{
 +    CursorPtr pCursor;
 +    int res;
 +
 +    REQUEST(xCreateGlyphCursorReq);
 +
 +    REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
 +    LEGAL_NEW_RESOURCE(stuff->cid, client);
 +
 +    res = AllocGlyphCursor(stuff->source, stuff->sourceChar,
 +                           stuff->mask, stuff->maskChar,
 +                           stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
 +                           stuff->backRed, stuff->backGreen, stuff->backBlue,
 +                           &pCursor, client, stuff->cid);
 +    if (res != Success)
 +        return res;
 +    if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
 +        return Success;
 +    return BadAlloc;
 +}
 +
 +int
 +ProcFreeCursor(ClientPtr client)
 +{
 +    CursorPtr pCursor;
 +    int rc;
 +
 +    REQUEST(xResourceReq);
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR,
 +                                 client, DixDestroyAccess);
 +    if (rc == Success) {
 +        FreeResource(stuff->id, RT_NONE);
 +        return Success;
 +    }
 +    else {
 +        client->errorValue = stuff->id;
 +        return rc;
 +    }
 +}
 +
 +int
 +ProcQueryBestSize(ClientPtr client)
 +{
 +    xQueryBestSizeReply reply;
 +    DrawablePtr pDraw;
 +    ScreenPtr pScreen;
 +    int rc;
 +
 +    REQUEST(xQueryBestSizeReq);
 +    REQUEST_SIZE_MATCH(xQueryBestSizeReq);
 +
 +    if ((stuff->class != CursorShape) &&
 +        (stuff->class != TileShape) && (stuff->class != StippleShape)) {
 +        client->errorValue = stuff->class;
 +        return BadValue;
 +    }
 +
 +    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
 +                           DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +    if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
 +        return BadMatch;
 +    pScreen = pDraw->pScreen;
 +    rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
 +    if (rc != Success)
 +        return rc;
 +    (*pScreen->QueryBestSize) (stuff->class, &stuff->width,
 +                               &stuff->height, pScreen);
 +    memset(&reply, 0, sizeof(xQueryBestSizeReply));
 +    reply.type = X_Reply;
 +    reply.sequenceNumber = client->sequence;
 +    reply.length = 0;
 +    reply.width = stuff->width;
 +    reply.height = stuff->height;
 +    
 +    WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
 +    return Success;
 +}
 +
 +int
 +ProcSetScreenSaver(ClientPtr client)
 +{
 +    int rc, i, blankingOption, exposureOption;
 +
 +    REQUEST(xSetScreenSaverReq);
 +    REQUEST_SIZE_MATCH(xSetScreenSaverReq);
 +
 +    for (i = 0; i < screenInfo.numScreens; i++) {
 +        rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
 +                      DixSetAttrAccess);
 +        if (rc != Success)
 +            return rc;
 +    }
 +
 +    blankingOption = stuff->preferBlank;
 +    if ((blankingOption != DontPreferBlanking) &&
 +        (blankingOption != PreferBlanking) &&
 +        (blankingOption != DefaultBlanking)) {
 +        client->errorValue = blankingOption;
 +        return BadValue;
 +    }
 +    exposureOption = stuff->allowExpose;
 +    if ((exposureOption != DontAllowExposures) &&
 +        (exposureOption != AllowExposures) &&
 +        (exposureOption != DefaultExposures)) {
 +        client->errorValue = exposureOption;
 +        return BadValue;
 +    }
 +    if (stuff->timeout < -1) {
 +        client->errorValue = stuff->timeout;
 +        return BadValue;
 +    }
 +    if (stuff->interval < -1) {
 +        client->errorValue = stuff->interval;
 +        return BadValue;
 +    }
 +
 +    if (blankingOption == DefaultBlanking)
 +        ScreenSaverBlanking = defaultScreenSaverBlanking;
 +    else
 +        ScreenSaverBlanking = blankingOption;
 +    if (exposureOption == DefaultExposures)
 +        ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
 +    else
 +        ScreenSaverAllowExposures = exposureOption;
 +
 +    if (stuff->timeout >= 0)
 +        ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND;
 +    else
 +        ScreenSaverTime = defaultScreenSaverTime;
 +    if (stuff->interval >= 0)
 +        ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND;
 +    else
 +        ScreenSaverInterval = defaultScreenSaverInterval;
 +
 +    SetScreenSaverTimer();
 +    return Success;
 +}
 +
 +int
 +ProcGetScreenSaver(ClientPtr client)
 +{
 +    xGetScreenSaverReply rep;
 +    int rc, i;
 +
 +    REQUEST_SIZE_MATCH(xReq);
 +
 +    for (i = 0; i < screenInfo.numScreens; i++) {
 +        rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
 +                      DixGetAttrAccess);
 +        if (rc != Success)
 +            return rc;
 +    }
 +
 +
 +    rep.type = X_Reply;
 +    rep.sequenceNumber = client->sequence;
 +    rep.length = 0;
 +    rep.timeout = ScreenSaverTime / MILLI_PER_SECOND;
 +    rep.interval = ScreenSaverInterval / MILLI_PER_SECOND;
 +    rep.preferBlanking = ScreenSaverBlanking;
 +    rep.allowExposures = ScreenSaverAllowExposures;
 +    
 +    WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep);
 +    return Success;
 +}
 +
 +int
 +ProcChangeHosts(ClientPtr client)
 +{
 +    REQUEST(xChangeHostsReq);
 +
 +    REQUEST_FIXED_SIZE(xChangeHostsReq, stuff->hostLength);
 +
 +    if (stuff->mode == HostInsert)
 +        return AddHost(client, (int) stuff->hostFamily,
 +                       stuff->hostLength, (void *) &stuff[1]);
 +    if (stuff->mode == HostDelete)
 +        return RemoveHost(client, (int) stuff->hostFamily,
 +                          stuff->hostLength, (void *) &stuff[1]);
 +    client->errorValue = stuff->mode;
 +    return BadValue;
 +}
 +
 +int
 +ProcListHosts(ClientPtr client)
 +{
 +    xListHostsReply reply;
 +    int len, nHosts, result;
 +    BOOL enabled;
 +    void *pdata;
 +
 +    /* REQUEST(xListHostsReq); */
 +
 +    REQUEST_SIZE_MATCH(xListHostsReq);
 +
 +    /* untrusted clients can't list hosts */
 +    result = XaceHook(XACE_SERVER_ACCESS, client, DixReadAccess);
 +    if (result != Success)
 +        return result;
 +
 +    result = GetHosts(&pdata, &nHosts, &len, &enabled);
 +    if (result != Success)
 +        return result;
 +
 +    
 +    reply.type = X_Reply;
 +    reply.enabled = enabled;
 +    reply.sequenceNumber = client->sequence;
 +    reply.length = bytes_to_int32(len);
 +    reply.nHosts = nHosts;
 +    
 +    WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
 +    if (nHosts) {
 +        client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
 +        WriteSwappedDataToClient(client, len, pdata);
 +    }
 +    free(pdata);
 +    return Success;
 +}
 +
 +int
 +ProcChangeAccessControl(ClientPtr client)
 +{
 +    REQUEST(xSetAccessControlReq);
 +
 +    REQUEST_SIZE_MATCH(xSetAccessControlReq);
 +    if ((stuff->mode != EnableAccess) && (stuff->mode != DisableAccess)) {
 +        client->errorValue = stuff->mode;
 +        return BadValue;
 +    }
 +    return ChangeAccessControl(client, stuff->mode == EnableAccess);
 +}
 +
 +/*********************
 + * CloseDownRetainedResources
 + *
-  *    Find all clients that are gone and have terminated in RetainTemporary 
++ *    Find all clients that are gone and have terminated in RetainTemporary
 + *    and destroy their resources.
 + *********************/
 +
 +static void
 +CloseDownRetainedResources(void)
 +{
 +    int i;
 +    ClientPtr client;
 +
 +    for (i = 1; i < currentMaxClients; i++) {
 +        client = clients[i];
 +        if (client && (client->closeDownMode == RetainTemporary)
 +            && (client->clientGone))
 +            CloseDownClient(client);
 +    }
 +}
 +
 +int
 +ProcKillClient(ClientPtr client)
 +{
 +    REQUEST(xResourceReq);
 +    ClientPtr killclient;
 +    int rc;
 +
 +    REQUEST_SIZE_MATCH(xResourceReq);
 +    if (stuff->id == AllTemporary) {
 +        CloseDownRetainedResources();
 +        return Success;
 +    }
 +
 +    rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
 +    if (rc == Success) {
 +        CloseDownClient(killclient);
 +        if (client == killclient) {
 +            /* force yield and return Success, so that Dispatch()
 +             * doesn't try to touch client
 +             */
 +            isItTimeToYield = TRUE;
 +        }
 +        return Success;
 +    }
 +    else
 +        return rc;
 +}
 +
 +int
 +ProcSetFontPath(ClientPtr client)
 +{
 +    unsigned char *ptr;
 +    unsigned long nbytes, total;
 +    long nfonts;
 +    int n;
 +
 +    REQUEST(xSetFontPathReq);
 +
 +    REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
 +
 +    nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
 +    total = nbytes;
 +    ptr = (unsigned char *) &stuff[1];
 +    nfonts = stuff->nFonts;
 +    while (--nfonts >= 0) {
 +        if ((total == 0) || (total < (n = (*ptr + 1))))
 +            return BadLength;
 +        total -= n;
 +        ptr += n;
 +    }
 +    if (total >= 4)
 +        return BadLength;
 +    return SetFontPath(client, stuff->nFonts, (unsigned char *) &stuff[1]);
 +}
 +
 +int
 +ProcGetFontPath(ClientPtr client)
 +{
 +    xGetFontPathReply reply;
 +    int rc, stringLens, numpaths;
 +    unsigned char *bufferStart;
 +
 +    /* REQUEST (xReq); */
 +
 +    REQUEST_SIZE_MATCH(xReq);
 +    rc = GetFontPath(client, &numpaths, &stringLens, &bufferStart);
 +    if (rc != Success)
 +        return rc;
 +
 +
 +    reply.type = X_Reply;
 +    reply.sequenceNumber = client->sequence;
 +    reply.length = bytes_to_int32(stringLens + numpaths);
 +    reply.nPaths = numpaths;
 +
 +    WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
 +    if (stringLens || numpaths)
 +        WriteToClient(client, stringLens + numpaths, bufferStart);
 +    return Success;
 +}
 +
 +int
 +ProcChangeCloseDownMode(ClientPtr client)
 +{
 +    int rc;
 +
 +    REQUEST(xSetCloseDownModeReq);
 +    REQUEST_SIZE_MATCH(xSetCloseDownModeReq);
 +
 +    rc = XaceHook(XACE_CLIENT_ACCESS, client, client, DixManageAccess);
 +    if (rc != Success)
 +        return rc;
 +
 +    if ((stuff->mode == AllTemporary) ||
 +        (stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) {
 +        client->closeDownMode = stuff->mode;
 +        return Success;
 +    }
 +    else {
 +        client->errorValue = stuff->mode;
 +        return BadValue;
 +    }
 +}
 +
 +int
 +ProcForceScreenSaver(ClientPtr client)
 +{
 +    int rc;
 +
 +    REQUEST(xForceScreenSaverReq);
 +
 +    REQUEST_SIZE_MATCH(xForceScreenSaverReq);
 +
 +    if ((stuff->mode != ScreenSaverReset) && (stuff->mode != ScreenSaverActive)) {
 +        client->errorValue = stuff->mode;
 +        return BadValue;
 +    }
 +    rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int) stuff->mode);
 +    if (rc != Success)
 +        return rc;
 +    return Success;
 +}
 +
 +int
 +ProcNoOperation(ClientPtr client)
 +{
 +    REQUEST_AT_LEAST_SIZE(xReq);
 +
 +    /* noop -- don't do anything */
 +    return Success;
 +}
 +
 +/**********************
 + * CloseDownClient
 + *
 + *  Client can either mark his resources destroy or retain.  If retained and
 + *  then killed again, the client is really destroyed.
 + *********************/
 +
 +char dispatchExceptionAtReset = DE_RESET;
 +
 +void
 +CloseDownClient(ClientPtr client)
 +{
 +    Bool really_close_down = client->clientGone ||
 +        client->closeDownMode == DestroyAll;
 +
 +    if (!client->clientGone) {
 +        /* ungrab server if grabbing client dies */
 +        if (grabState != GrabNone && grabClient == client) {
 +            UngrabServer(client);
 +        }
 +        BITCLEAR(grabWaiters, client->index);
 +        DeleteClientFromAnySelections(client);
 +        ReleaseActiveGrabs(client);
 +        DeleteClientFontStuff(client);
 +        if (!really_close_down) {
 +            /*  This frees resources that should never be retained
 +             *  no matter what the close down mode is.  Actually we
 +             *  could do this unconditionally, but it's probably
 +             *  better not to traverse all the client's resources
 +             *  twice (once here, once a few lines down in
 +             *  FreeClientResources) in the common case of
 +             *  really_close_down == TRUE.
 +             */
 +            FreeClientNeverRetainResources(client);
 +            client->clientState = ClientStateRetained;
 +            if (ClientStateCallback) {
 +                NewClientInfoRec clientinfo;
 +
 +                clientinfo.client = client;
 +                clientinfo.prefix = (xConnSetupPrefix *) NULL;
 +                clientinfo.setup = (xConnSetup *) NULL;
 +                CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
 +            }
 +        }
 +        client->clientGone = TRUE;      /* so events aren't sent to client */
 +        if (ClientIsAsleep(client))
 +            ClientSignal(client);
 +        ProcessWorkQueueZombies();
 +        CloseDownConnection(client);
 +
 +        /* If the client made it to the Running stage, nClients has
 +         * been incremented on its behalf, so we need to decrement it
 +         * now.  If it hasn't gotten to Running, nClients has *not*
 +         * been incremented, so *don't* decrement it.
 +         */
 +        if (client->clientState != ClientStateInitial) {
 +            --nClients;
 +        }
 +    }
 +
 +    if (really_close_down) {
 +        if (client->clientState == ClientStateRunning && nClients == 0)
 +            dispatchException |= dispatchExceptionAtReset;
 +
 +        client->clientState = ClientStateGone;
 +        if (ClientStateCallback) {
 +            NewClientInfoRec clientinfo;
 +
 +            clientinfo.client = client;
 +            clientinfo.prefix = (xConnSetupPrefix *) NULL;
 +            clientinfo.setup = (xConnSetup *) NULL;
 +            CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
 +        }
 +        TouchListenerGone(client->clientAsMask);
 +        FreeClientResources(client);
 +        /* Disable client ID tracking. This must be done after
 +         * ClientStateCallback. */
 +        ReleaseClientIds(client);
 +#ifdef XSERVER_DTRACE
 +        XSERVER_CLIENT_DISCONNECT(client->index);
 +#endif
 +        if (client->index < nextFreeClientID)
 +            nextFreeClientID = client->index;
 +        clients[client->index] = NullClient;
 +        SmartLastClient = NullClient;
 +        dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
 +
 +        while (!clients[currentMaxClients - 1])
 +            currentMaxClients--;
 +    }
 +}
 +
 +static void
 +KillAllClients(void)
 +{
 +    int i;
 +
 +    for (i = 1; i < currentMaxClients; i++)
 +        if (clients[i]) {
 +            /* Make sure Retained clients are released. */
 +            clients[i]->closeDownMode = DestroyAll;
 +            CloseDownClient(clients[i]);
 +        }
 +}
 +
 +void
 +InitClient(ClientPtr client, int i, void *ospriv)
 +{
 +    client->index = i;
 +    client->clientAsMask = ((Mask) i) << CLIENTOFFSET;
 +    client->closeDownMode = i ? DestroyAll : RetainPermanent;
 +    client->requestVector = InitialVector;
 +    client->osPrivate = ospriv;
 +    QueryMinMaxKeyCodes(&client->minKC, &client->maxKC);
 +    client->smart_start_tick = SmartScheduleTime;
 +    client->smart_stop_tick = SmartScheduleTime;
 +    client->clientIds = NULL;
 +}
 +
 +/************************
 + * int NextAvailableClient(ospriv)
 + *
 + * OS dependent portion can't assign client id's because of CloseDownModes.
 + * Returns NULL if there are no free clients.
 + *************************/
 +
 +ClientPtr
 +NextAvailableClient(void *ospriv)
 +{
 +    int i;
 +    ClientPtr client;
 +    xReq data;
 +
 +    i = nextFreeClientID;
 +    if (i == MAXCLIENTS)
 +        return (ClientPtr) NULL;
 +    clients[i] = client =
 +        dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
 +    if (!client)
 +        return (ClientPtr) NULL;
 +    InitClient(client, i, ospriv);
 +    if (!InitClientResources(client)) {
 +        dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
 +        return (ClientPtr) NULL;
 +    }
 +    data.reqType = 1;
 +    data.length = bytes_to_int32(sz_xReq + sz_xConnClientPrefix);
 +    if (!InsertFakeRequest(client, (char *) &data, sz_xReq)) {
 +        FreeClientResources(client);
 +        dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
 +        return (ClientPtr) NULL;
 +    }
 +    if (i == currentMaxClients)
 +        currentMaxClients++;
 +    while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID])
 +        nextFreeClientID++;
 +
 +    /* Enable client ID tracking. This must be done before
 +     * ClientStateCallback. */
 +    ReserveClientIds(client);
 +
 +    if (ClientStateCallback) {
 +        NewClientInfoRec clientinfo;
 +
 +        clientinfo.client = client;
 +        clientinfo.prefix = (xConnSetupPrefix *) NULL;
 +        clientinfo.setup = (xConnSetup *) NULL;
 +        CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
 +    }
 +    return client;
 +}
 +
 +int
 +ProcInitialConnection(ClientPtr client)
 +{
 +    REQUEST(xReq);
 +    xConnClientPrefix *prefix;
 +    int whichbyte = 1;
 +    char order;
 +
 +    prefix = (xConnClientPrefix *) ((char *)stuff + sz_xReq);
 +    order = prefix->byteOrder;
 +    if (order != 'l' && order != 'B' && order != 'r' && order != 'R')
 +	return client->noClientException = -1;
 +    if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
 +	(!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) {
 +	client->swapped = TRUE;
 +	SwapConnClientPrefix(prefix);
 +    }
 +    stuff->reqType = 2;
 +    stuff->length += bytes_to_int32(prefix->nbytesAuthProto) +
 +        bytes_to_int32(prefix->nbytesAuthString);
 +    if (client->swapped) {
 +        swaps(&stuff->length);
 +    }
 +    if (order == 'r' || order == 'R') {
 +	client->local = FALSE;
 +    }
 +    ResetCurrentRequest(client);
 +    return Success;
 +}
 +
 +static int
 +SendConnSetup(ClientPtr client, const char *reason)
 +{
 +    xWindowRoot *root;
 +    int i;
 +    int numScreens;
 +    char *lConnectionInfo;
 +    xConnSetupPrefix *lconnSetupPrefix;
 +
 +    if (reason) {
 +        xConnSetupPrefix csp;
 +
 +        csp.success = xFalse;
 +        csp.lengthReason = strlen(reason);
 +        csp.length = bytes_to_int32(csp.lengthReason);
 +        csp.majorVersion = X_PROTOCOL;
 +        csp.minorVersion = X_PROTOCOL_REVISION;
 +        if (client->swapped)
 +            WriteSConnSetupPrefix(client, &csp);
 +        else
 +            WriteToClient(client, sz_xConnSetupPrefix, &csp);
 +        WriteToClient(client, (int) csp.lengthReason, reason);
 +        return client->noClientException = -1;
 +    }
 +
 +    numScreens = screenInfo.numScreens;
 +    lConnectionInfo = ConnectionInfo;
 +    lconnSetupPrefix = &connSetupPrefix;
 +
 +    /* We're about to start speaking X protocol back to the client by
 +     * sending the connection setup info.  This means the authorization
 +     * step is complete, and we can count the client as an
 +     * authorized one.
 +     */
 +    nClients++;
 +
 +    client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
 +    client->sequence = 0;
 +    ((xConnSetup *) lConnectionInfo)->ridBase = client->clientAsMask;
 +    ((xConnSetup *) lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
 +#ifdef MATCH_CLIENT_ENDIAN
 +    ((xConnSetup *) lConnectionInfo)->imageByteOrder = ClientOrder(client);
 +    ((xConnSetup *) lConnectionInfo)->bitmapBitOrder = ClientOrder(client);
 +#endif
 +    /* fill in the "currentInputMask" */
 +    root = (xWindowRoot *) (lConnectionInfo + connBlockScreenStart);
 +#ifdef PANORAMIX
 +    if (noPanoramiXExtension)
 +        numScreens = screenInfo.numScreens;
 +    else
 +        numScreens = ((xConnSetup *) ConnectionInfo)->numRoots;
 +#endif
 +
 +    for (i = 0; i < numScreens; i++) {
 +        unsigned int j;
 +        xDepth *pDepth;
 +        WindowPtr pRoot = screenInfo.screens[i]->root;
 +
 +        root->currentInputMask = pRoot->eventMask | wOtherEventMasks(pRoot);
 +        pDepth = (xDepth *) (root + 1);
 +        for (j = 0; j < root->nDepths; j++) {
 +            pDepth = (xDepth *) (((char *) (pDepth + 1)) +
 +                                 pDepth->nVisuals * sizeof(xVisualType));
 +        }
 +        root = (xWindowRoot *) pDepth;
 +    }
 +
 +    if (client->swapped) {
 +        WriteSConnSetupPrefix(client, lconnSetupPrefix);
 +        WriteSConnectionInfo(client,
 +                             (unsigned long) (lconnSetupPrefix->length << 2),
 +                             lConnectionInfo);
 +    }
 +    else {
 +        WriteToClient(client, sizeof(xConnSetupPrefix), lconnSetupPrefix);
 +        WriteToClient(client, (int) (lconnSetupPrefix->length << 2),
 +		      lConnectionInfo);
 +    }
 +    client->clientState = ClientStateRunning;
 +    if (ClientStateCallback) {
 +        NewClientInfoRec clientinfo;
 +
 +        clientinfo.client = client;
 +        clientinfo.prefix = lconnSetupPrefix;
 +        clientinfo.setup = (xConnSetup *) lConnectionInfo;
 +        CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
 +    }
 +    return Success;
 +}
 +
 +int
 +ProcEstablishConnection(ClientPtr client)
 +{
 +    const char *reason;
 +    char *auth_proto, *auth_string;
 +    xConnClientPrefix *prefix;
 +
 +    REQUEST(xReq);
 +
 +    prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
 +    auth_proto = (char *) prefix + sz_xConnClientPrefix;
 +    auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto);
 +    if ((prefix->majorVersion != X_PROTOCOL) ||
 +        (prefix->minorVersion != X_PROTOCOL_REVISION))
 +        reason = "Protocol version mismatch";
 +    else
 +        reason = ClientAuthorized(client,
 +                                  (unsigned short) prefix->nbytesAuthProto,
 +                                  auth_proto,
 +                                  (unsigned short) prefix->nbytesAuthString,
 +                                  auth_string);
 +
 +    return (SendConnSetup(client, reason));
 +}
 +
 +void
 +SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
 +                  XID resId, int errorCode)
 +{
 +    xError rep; memset(&rep, 0, sizeof(xError));
 +    rep.type = X_Error;
 +    rep.errorCode = errorCode;
 +    rep.resourceID = resId;
 +    rep.minorCode = minorCode;
 +    rep.majorCode = majorCode;
 +
 +    WriteEventsToClient(client, 1, (xEvent *) &rep);
 +}
 +
 +void
 +MarkClientException(ClientPtr client)
 +{
 +    client->noClientException = -1;
 +}
 +
 +/*
 + * This array encodes the answer to the question "what is the log base 2
 + * of the number of pixels that fit in a scanline pad unit?"
 + * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
 + */
 +static int answer[6][4] = {
 +    /* pad   pad   pad     pad */
 +    /*  8     16    32    64 */
 +
 +    {3, 4, 5, 6},               /* 1 bit per pixel */
 +    {1, 2, 3, 4},               /* 4 bits per pixel */
 +    {0, 1, 2, 3},               /* 8 bits per pixel */
 +    {~0, 0, 1, 2},              /* 16 bits per pixel */
 +    {~0, ~0, 0, 1},             /* 24 bits per pixel */
 +    {~0, ~0, 0, 1}              /* 32 bits per pixel */
 +};
 +
 +/*
 + * This array gives the answer to the question "what is the first index for
 + * the answer array above given the number of bits per pixel?"
 + * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
 + */
 +static int indexForBitsPerPixel[33] = {
 +    ~0, 0, ~0, ~0,              /* 1 bit per pixel */
 +    1, ~0, ~0, ~0,              /* 4 bits per pixel */
 +    2, ~0, ~0, ~0,              /* 8 bits per pixel */
 +    ~0, ~0, ~0, ~0,
 +    3, ~0, ~0, ~0,              /* 16 bits per pixel */
 +    ~0, ~0, ~0, ~0,
 +    4, ~0, ~0, ~0,              /* 24 bits per pixel */
 +    ~0, ~0, ~0, ~0,
 +    5                           /* 32 bits per pixel */
 +};
 +
 +/*
 + * This array gives the bytesperPixel value for cases where the number
 + * of bits per pixel is a multiple of 8 but not a power of 2.
 + */
 +static int answerBytesPerPixel[33] = {
 +    ~0, 0, ~0, ~0,              /* 1 bit per pixel */
 +    0, ~0, ~0, ~0,              /* 4 bits per pixel */
 +    0, ~0, ~0, ~0,              /* 8 bits per pixel */
 +    ~0, ~0, ~0, ~0,
 +    0, ~0, ~0, ~0,              /* 16 bits per pixel */
 +    ~0, ~0, ~0, ~0,
 +    3, ~0, ~0, ~0,              /* 24 bits per pixel */
 +    ~0, ~0, ~0, ~0,
 +    0                           /* 32 bits per pixel */
 +};
 +
 +/*
 + * This array gives the answer to the question "what is the second index for
 + * the answer array above given the number of bits per scanline pad unit?"
 + * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
 + */
 +static int indexForScanlinePad[65] = {
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    0, ~0, ~0, ~0,              /* 8 bits per scanline pad unit */
 +    ~0, ~0, ~0, ~0,
 +    1, ~0, ~0, ~0,              /* 16 bits per scanline pad unit */
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    2, ~0, ~0, ~0,              /* 32 bits per scanline pad unit */
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    ~0, ~0, ~0, ~0,
 +    3                           /* 64 bits per scanline pad unit */
 +};
 +
 +/*
 +	grow the array of screenRecs if necessary.
 +	call the device-supplied initialization procedure
 +with its screen number, a pointer to its ScreenRec, argc, and argv.
 +	return the number of successfully installed screens.
 +
 +*/
 +
 +static int init_screen(ScreenPtr pScreen, int i, Bool gpu)
 +{
 +    int scanlinepad, format, depth, bitsPerPixel, j, k;
 +
 +    dixInitScreenSpecificPrivates(pScreen);
 +
 +    if (!dixAllocatePrivates(&pScreen->devPrivates, PRIVATE_SCREEN)) {
 +        return -1;
 +    }
 +    pScreen->myNum = i;
 +    if (gpu) {
 +        pScreen->myNum += GPU_SCREEN_OFFSET;
 +        pScreen->isGPU = TRUE;
 +    }
 +    pScreen->totalPixmapSize = 0;       /* computed in CreateScratchPixmapForScreen */
 +    pScreen->ClipNotify = 0;    /* for R4 ddx compatibility */
 +    pScreen->CreateScreenResources = 0;
 +
 +    xorg_list_init(&pScreen->pixmap_dirty_list);
 +    xorg_list_init(&pScreen->unattached_list);
 +    xorg_list_init(&pScreen->output_slave_list);
 +    xorg_list_init(&pScreen->offload_slave_list);
 +
 +    /*
 +     * This loop gets run once for every Screen that gets added,
 +     * but thats ok.  If the ddx layer initializes the formats
 +     * one at a time calling AddScreen() after each, then each
 +     * iteration will make it a little more accurate.  Worst case
 +     * we do this loop N * numPixmapFormats where N is # of screens.
 +     * Anyway, this must be called after InitOutput and before the
 +     * screen init routine is called.
 +     */
 +    for (format = 0; format < screenInfo.numPixmapFormats; format++) {
 +        depth = screenInfo.formats[format].depth;
 +        bitsPerPixel = screenInfo.formats[format].bitsPerPixel;
 +        scanlinepad = screenInfo.formats[format].scanlinePad;
 +        j = indexForBitsPerPixel[bitsPerPixel];
 +        k = indexForScanlinePad[scanlinepad];
 +        PixmapWidthPaddingInfo[depth].padPixelsLog2 = answer[j][k];
 +        PixmapWidthPaddingInfo[depth].padRoundUp =
 +            (scanlinepad / bitsPerPixel) - 1;
 +        j = indexForBitsPerPixel[8];    /* bits per byte */
 +        PixmapWidthPaddingInfo[depth].padBytesLog2 = answer[j][k];
 +        PixmapWidthPaddingInfo[depth].bitsPerPixel = bitsPerPixel;
 +        if (answerBytesPerPixel[bitsPerPixel]) {
 +            PixmapWidthPaddingInfo[depth].notPower2 = 1;
 +            PixmapWidthPaddingInfo[depth].bytesPerPixel =
 +                answerBytesPerPixel[bitsPerPixel];
 +        }
 +        else {
 +            PixmapWidthPaddingInfo[depth].notPower2 = 0;
 +        }
 +    }
 +    return 0;
 +}
 +
 +int
 +AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
 +                           int /*argc */ ,
 +                           char **      /*argv */
 +          ), int argc, char **argv)
 +{
 +
 +    int i;
 +    ScreenPtr pScreen;
 +    Bool ret;
 +
 +    i = screenInfo.numScreens;
 +    if (i == MAXSCREENS)
 +        return -1;
 +
 +    pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
 +    if (!pScreen)
 +        return -1;
 +
 +    ret = init_screen(pScreen, i, FALSE);
 +    if (ret != 0) {
 +        free(pScreen);
 +        return ret;
 +    }
 +    /* This is where screen specific stuff gets initialized.  Load the
 +       screen structure, call the hardware, whatever.
 +       This is also where the default colormap should be allocated and
 +       also pixel values for blackPixel, whitePixel, and the cursor
 +       Note that InitScreen is NOT allowed to modify argc, argv, or
 +       any of the strings pointed to by argv.  They may be passed to
 +       multiple screens.
 +     */
 +    screenInfo.screens[i] = pScreen;
 +    screenInfo.numScreens++;
 +    if (!(*pfnInit) (pScreen, argc, argv)) {
 +        dixFreeScreenSpecificPrivates(pScreen);
 +        dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
 +        free(pScreen);
 +        screenInfo.numScreens--;
 +        return -1;
 +    }
 +
 +    update_desktop_dimensions();
 +
 +    dixRegisterScreenPrivateKey(&cursorScreenDevPriv, pScreen, PRIVATE_CURSOR,
 +                                0);
 +
 +    return i;
 +}
 +
 +int
 +AddGPUScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
 +                              int /*argc */ ,
 +                              char **      /*argv */
 +                              ),
 +             int argc, char **argv)
 +{
 +    int i;
 +    ScreenPtr pScreen;
 +    Bool ret;
 +
 +    i = screenInfo.numGPUScreens;
 +    if (i == MAXGPUSCREENS)
 +        return -1;
 +
 +    pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
 +    if (!pScreen)
 +        return -1;
 +
 +    ret = init_screen(pScreen, i, TRUE);
 +    if (ret != 0) {
 +        free(pScreen);
 +        return ret;
 +    }
 +
 +    /* This is where screen specific stuff gets initialized.  Load the
 +       screen structure, call the hardware, whatever.
 +       This is also where the default colormap should be allocated and
 +       also pixel values for blackPixel, whitePixel, and the cursor
 +       Note that InitScreen is NOT allowed to modify argc, argv, or
 +       any of the strings pointed to by argv.  They may be passed to
 +       multiple screens.
 +     */
 +    screenInfo.gpuscreens[i] = pScreen;
 +    screenInfo.numGPUScreens++;
 +    if (!(*pfnInit) (pScreen, argc, argv)) {
 +        dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
 +        free(pScreen);
 +        screenInfo.numGPUScreens--;
 +        return -1;
 +    }
 +
 +    update_desktop_dimensions();
 +
 +    return i;
 +}
 +
 +void
 +RemoveGPUScreen(ScreenPtr pScreen)
 +{
 +    int idx, j;
 +    if (!pScreen->isGPU)
 +        return;
 +
 +    idx = pScreen->myNum - GPU_SCREEN_OFFSET;
 +    for (j = idx; j < screenInfo.numGPUScreens - 1; j++) {
 +        screenInfo.gpuscreens[j] = screenInfo.gpuscreens[j + 1];
 +        screenInfo.gpuscreens[j]->myNum = j + GPU_SCREEN_OFFSET;
 +    }
 +    screenInfo.numGPUScreens--;
 +
 +    /* this gets freed later in the resource list, but without
 +     * the screen existing it causes crashes - so remove it here */
 +    if (pScreen->defColormap)
 +        FreeResource(pScreen->defColormap, RT_COLORMAP);
 +    free(pScreen);
 +
 +}
 +
 +void
 +AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr new)
 +{
 +    assert(new->isGPU);
 +    assert(!new->current_master);
 +    xorg_list_add(&new->unattached_head, &pScreen->unattached_list);
 +    new->current_master = pScreen;
 +}
 +
 +void
 +DetachUnboundGPU(ScreenPtr slave)
 +{
 +    assert(slave->isGPU);
 +    xorg_list_del(&slave->unattached_head);
 +    slave->current_master = NULL;
 +}
 +
 +void
 +AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
 +{
 +    assert(new->isGPU);
 +    xorg_list_add(&new->output_head, &pScreen->output_slave_list);
 +    new->current_master = pScreen;
 +}
 +
 +void
 +DetachOutputGPU(ScreenPtr slave)
 +{
 +    assert(slave->isGPU);
 +    xorg_list_del(&slave->output_head);
 +    slave->current_master = NULL;
 +}
 +
 +void
 +AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new)
 +{
 +    assert(new->isGPU);
 +    xorg_list_add(&new->offload_head, &pScreen->offload_slave_list);
 +    new->current_master = pScreen;
 +}
 +
 +void
 +DetachOffloadGPU(ScreenPtr slave)
 +{
 +    assert(slave->isGPU);
 +    xorg_list_del(&slave->offload_head);
 +    slave->current_master = NULL;
 +}
 +
diff --cc xorg-server/hw/kdrive/ephyr/ephyrinit.c
index 8311a5f,897aa19..65b1a47
mode 100755,100644..100755
--- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
diff --cc xorg-server/hw/kdrive/ephyr/hostx.c
index ae92545,8d6d5e8..7a3338f
mode 100755,100644..100755
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
diff --cc xorg-server/hw/xfree86/common/compiler.h
index 4cb1277,1653574..2ee5e22
mode 100755,100644..100755
--- a/xorg-server/hw/xfree86/common/compiler.h
+++ b/xorg-server/hw/xfree86/common/compiler.h
diff --cc xorg-server/hw/xwin/InitOutput.c
index 9e9491d,fef46a9..4e099d2
mode 100755,100644..100755
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
diff --cc xorg-server/hw/xwin/windialogs.c
index 3d95f36,6fe3fc4..b0e7a18
mode 100644,100644..100755
--- a/xorg-server/hw/xwin/windialogs.c
+++ b/xorg-server/hw/xwin/windialogs.c
@@@ -440,10 -436,13 +440,10 @@@ winChangeDepthDlgProc(HWND hwndDialog, 
          s_pScreenPriv = (winPrivScreenPtr) lParam;
          s_pScreenInfo = s_pScreenPriv->pScreenInfo;
  
-         winDebug("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, "
-                  "s_pScreenInfo: %08x\n",
 -#if CYGDEBUG
+         winDebug("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %p, "
+                  "s_pScreenInfo: %p\n",
                   s_pScreenPriv, s_pScreenInfo);
 -#endif
  
 -#if CYGDEBUG
          winDebug("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
                   "current bpp: %d\n",
                   s_pScreenInfo->dwBPP,
diff --cc xorg-server/hw/xwin/winmultiwindowshape.c
index 0a00e79,73afaea..15c5ebe
mode 100644,100644..100755
--- a/xorg-server/hw/xwin/winmultiwindowshape.c
+++ b/xorg-server/hw/xwin/winmultiwindowshape.c
@@@ -46,7 -46,9 +46,7 @@@ winSetShapeMultiWindow(WindowPtr pWin, 
  
      winScreenPriv(pScreen);
  
-   winDebug ("winSetShapeMultiWindow - pWin: %08x kind: %i\n", pWin, kind);
 -#if CYGMULTIWINDOW_DEBUG
 -    ErrorF("winSetShapeMultiWindow - pWin: %p kind: %i\n", pWin, kind);
 -#endif
++  winDebug ("winSetShapeMultiWindow - pWin: %p kind: %i\n", pWin, kind);
  
      WIN_UNWRAP(SetShape);
      (*pScreen->SetShape) (pWin, kind);
diff --cc xorg-server/hw/xwin/winmultiwindowwindow.c
index 2439ddb,c22d690..850edc1
mode 100644,100644..100755
--- a/xorg-server/hw/xwin/winmultiwindowwindow.c
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
@@@ -288,7 -285,9 +288,7 @@@ winChangeWindowAttributesMultiWindow(Wi
  
      winScreenPriv(pScreen);
  
-     winDebug ("winChangeWindowAttributesMultiWindow - pWin: %08x\n", pWin);
 -#if CYGMULTIWINDOW_DEBUG
 -    ErrorF("winChangeWindowAttributesMultiWindow - pWin: %p\n", pWin);
 -#endif
++    winDebug ("winChangeWindowAttributesMultiWindow - pWin: %p\n", pWin);
  
      WIN_UNWRAP(ChangeWindowAttributes);
      fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
@@@ -316,7 -315,7 +316,7 @@@ winUnmapWindowMultiWindow(WindowPtr pWi
      winScreenPriv(pScreen);
  
  #if CYGMULTIWINDOW_DEBUG
-     winDebug ("winUnmapWindowMultiWindow - pWin: %08x\n", pWin);
 -    ErrorF("winUnmapWindowMultiWindow - pWin: %p\n", pWin);
++    winDebug ("winUnmapWindowMultiWindow - pWin: %p\n", pWin);
  #endif
  
      WIN_UNWRAP(UnrealizeWindow);
@@@ -347,7 -346,7 +347,7 @@@ winMapWindowMultiWindow(WindowPtr pWin
      winScreenPriv(pScreen);
  
  #if CYGMULTIWINDOW_DEBUG
-     winDebug ("winMapWindowMultiWindow - pWin: %08x\n", pWin);
 -    ErrorF("winMapWindowMultiWindow - pWin: %p\n", pWin);
++    winDebug ("winMapWindowMultiWindow - pWin: %p\n", pWin);
  #endif
  
      WIN_UNWRAP(RealizeWindow);
@@@ -403,7 -408,9 +403,7 @@@ winRestackWindowMultiWindow(WindowPtr p
  
      winScreenPriv(pScreen);
  
-     winDebug ("winRestackMultiWindow - %08x\n", pWin);
 -#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
 -    winTrace("winRestackMultiWindow - %p\n", pWin);
 -#endif
++    winDebug ("winRestackMultiWindow - %p\n", pWin);
  
      WIN_UNWRAP(RestackWindow);
      if (pScreen->RestackWindow)
diff --cc xorg-server/hw/xwin/winprefslex.l
index 5a6c969,9e6f0d6..0caeb67
mode 100644,100644..100755
--- a/xorg-server/hw/xwin/winprefslex.l
+++ b/xorg-server/hw/xwin/winprefslex.l
@@@ -37,8 -37,8 +37,6 @@@
  #include <string.h>
  #include "winprefsyacc.h"
  
- extern int yyparse(void);
- 
 -extern void ErrorF (const char* /*f*/, ...);
 -
  /* Copy the parsed string, must be free()d in yacc parser */
  static char *makestr(char *str)
  {
diff --cc xorg-server/hw/xwin/winprefsyacc.y
index 8dae912,9bb28ae..6cbb9cc
--- a/xorg-server/hw/xwin/winprefsyacc.y
+++ b/xorg-server/hw/xwin/winprefsyacc.y
@@@ -86,14 -79,12 +86,15 @@@ static void OpenSysMenu(void)
  static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
  static void CloseSysMenu(void);
  
- static int yyerror (char *s);
+ static int yyerror (const char *s);
  
  extern char *yytext;
+ extern int yylineno;
  extern int yylex(void);
  
 +#define YYMALLOC malloc
 +#define YYFREE   free
 +
  %}
  
  %union {
diff --cc xorg-server/hw/xwin/winscrinit.c
index 952e7eb,ce0aada..9f106f7
mode 100755,100644..100755
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
diff --cc xorg-server/hw/xwin/winshadddnl.c
index b7187b1,48599b2..4170953
mode 100644,100644..100755
--- a/xorg-server/hw/xwin/winshadddnl.c
+++ b/xorg-server/hw/xwin/winshadddnl.c
@@@ -293,34 -208,19 +293,34 @@@ winAllocateFBShadowDDNL(ScreenPtr pScre
      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);
 +    if ( pScreenInfo->pfb)
 +    {
 +        ErrorF("winAllocateFBShadowDDNL calling for the second time, reallocating\n");
 +        lpSurface=pScreenInfo->pfb;
  
 +        if (pScreenPriv->pddsShadow4)
 +        {
 +            IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4);
 +            pScreenPriv->pddsShadow4 = NULL;
 +        }
 +        ClosePrimarySurfaceShadowDDNL(pScreenPriv);
 +        ReleaseDDNL(pScreenPriv);
 +    }
 +    else
 +    {
 +        /* 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 
++         * 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);
diff --cc xorg-server/hw/xwin/winshadgdi.c
index f04d256,3d222ad..cda4759
mode 100644,100644..100755
--- a/xorg-server/hw/xwin/winshadgdi.c
+++ b/xorg-server/hw/xwin/winshadgdi.c
@@@ -366,11 -372,16 +366,11 @@@ winAllocateFBShadowGDI(ScreenPtr pScree
                       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
 +        winW32Error ("winAllocateFBShadowGDI - Shadow blit failure\n");
-         /* ago: ignore this error. The blit fails with wine, but does not 
+         /* ago: ignore this error. The blit fails with wine, but does not
           * cause any problems later. */
  
          fReturn = TRUE;
diff --cc xorg-server/hw/xwin/winwndproc.c
index 37d5ef6,0c434c9..9a150d5
mode 100644,100644..100755
--- a/xorg-server/hw/xwin/winwndproc.c
+++ b/xorg-server/hw/xwin/winwndproc.c
@@@ -624,8 -620,10 +624,8 @@@ winWindowProc(HWND hwnd, UINT message, 
          int iCaptionHeight;
          int iBorderHeight, iBorderWidth;
  
-         winDebug("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n",
 -#if CYGDEBUG
+         winDebug("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %p\n",
                   s_pScreenInfo);
 -#endif
  
          /* Can't do anything without screen info */
          if (s_pScreenInfo == NULL
diff --cc xorg-server/include/colormap.h
index b89bbe1,5f6b97f..5f6b97f
mode 100755,100644..100755
--- a/xorg-server/include/colormap.h
+++ b/xorg-server/include/colormap.h
diff --cc xorg-server/include/cursor.h
index 1e483ac,281d88b..281d88b
mode 100755,100644..100755
--- a/xorg-server/include/cursor.h
+++ b/xorg-server/include/cursor.h
diff --cc xorg-server/include/dix.h
index 116da2e,991a3ce..991a3ce
mode 100755,100644..100755
--- a/xorg-server/include/dix.h
+++ b/xorg-server/include/dix.h
diff --cc xorg-server/include/gc.h
index cb2909e,53f9c29..70695f1
mode 100755,100644..100755
--- a/xorg-server/include/gc.h
+++ b/xorg-server/include/gc.h
diff --cc xorg-server/include/gcstruct.h
index 6358b8c,e48d610..e48d610
mode 100755,100644..100755
--- a/xorg-server/include/gcstruct.h
+++ b/xorg-server/include/gcstruct.h
diff --cc xorg-server/include/input.h
index d30333a,bf22dc7..605e383
mode 100755,100644..100755
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
diff --cc xorg-server/include/os.h
index 2e2dca0,3e68c49..cee8f3c
mode 100755,100644..100755
--- a/xorg-server/include/os.h
+++ b/xorg-server/include/os.h
diff --cc xorg-server/include/pixmap.h
index 4b8fc24,9656c3a..9656c3a
mode 100755,100644..100755
--- a/xorg-server/include/pixmap.h
+++ b/xorg-server/include/pixmap.h
diff --cc xorg-server/include/property.h
index cae4471,e350513..e350513
mode 100755,100644..100755
--- a/xorg-server/include/property.h
+++ b/xorg-server/include/property.h
diff --cc xorg-server/include/resource.h
index 8ebced3,772f363..a2d6b6c
mode 100755,100644..100755
--- a/xorg-server/include/resource.h
+++ b/xorg-server/include/resource.h
diff --cc xorg-server/include/scrnintstr.h
index 444340c,faf0563..96bfd93
mode 100755,100644..100755
--- a/xorg-server/include/scrnintstr.h
+++ b/xorg-server/include/scrnintstr.h
diff --cc xorg-server/include/servermd.h
index 3e6bcf4,a3b5c3a..6aeed82
mode 100755,100644..100755
--- a/xorg-server/include/servermd.h
+++ b/xorg-server/include/servermd.h
diff --cc xorg-server/include/window.h
index c123728,6daec85..6daec85
mode 100755,100644..100755
--- a/xorg-server/include/window.h
+++ b/xorg-server/include/window.h
diff --cc xorg-server/include/xkbsrv.h
index a4878fc,cc6307a..cc6307a
mode 100755,100644..100755
--- a/xorg-server/include/xkbsrv.h
+++ b/xorg-server/include/xkbsrv.h
diff --cc xorg-server/mi/mi.h
index b7e791d,db62c91..d41a5d5
mode 100755,100644..100755
--- a/xorg-server/mi/mi.h
+++ b/xorg-server/mi/mi.h
diff --cc xorg-server/mi/miarc.c
index e0f09d2,e8bc87e..fa7befa
mode 100644,100644..100755
--- a/xorg-server/mi/miarc.c
+++ b/xorg-server/mi/miarc.c
@@@ -63,11 -63,22 +63,27 @@@ SOFTWARE
  #include "mifillarc.h"
  #include <X11/Xfuncproto.h>
  
 +#ifdef _MSC_VER
 +#define hypot _hypot
 +#define HAVE_CBRT
 +#endif
 +
+ #define EPSILON	0.000001
+ #define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON)
+ #define UNEQUAL(a,b) (fabs((a) - (b)) > EPSILON)
+ #define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y))
+ #define SQSECANT 108.856472512142   /* 1/sin^2(11/2) - for 11o miter cutoff */
+ 
+ /* Point with sub-pixel positioning. */
+ typedef struct _SppPoint {
+     double x, y;
+ } SppPointRec, *SppPointPtr;
+ 
+ typedef struct _SppArc {
+     double x, y, width, height;
+     double angle1, angle2;
+ } SppArcRec, *SppArcPtr;
+ 
  static double miDsin(double a);
  static double miDcos(double a);
  static double miDasin(double v);
diff --cc xorg-server/mi/miexpose.c
index de8ee6c,fc4dbc0..fc4dbc0
mode 100755,100644..100755
--- a/xorg-server/mi/miexpose.c
+++ b/xorg-server/mi/miexpose.c
diff --cc xorg-server/os/access.c
index 0dda35b,5c510de..1644e95
--- a/xorg-server/os/access.c
+++ b/xorg-server/os/access.c
@@@ -389,9 -307,9 +389,9 @@@ ifioctl(int fd, int cmd, char *arg
  #endif
  
  /*
 - * DefineSelf (fd):
 + * DefineSelf (fd, protocol):
   *
-  * Define this host for access control.  Find all the hosts the OS knows about 
+  * Define this host for access control.  Find all the hosts the OS knows about
   * for this fd and add them to the selfhosts list.
   */
  
@@@ -1824,9 -1647,8 +1824,9 @@@ siHostnameAddrMatch(int family, void *a
          char hostname[SI_HOSTNAME_MAXLEN];
          struct addrinfo *addresses;
          struct addrinfo *a;
 +        struct addrinfo hints;
          int f, hostaddrlen;
-         void *hostaddr;
+         void *hostaddr = NULL;
  
          if (siAddrLen >= sizeof(hostname))
              return FALSE;
diff --cc xorg-server/os/connection.c
index 616c201,da3397d..2d9d74b
mode 100644,100644..100755
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@@ -453,8 -421,8 +453,8 @@@ CreateWellKnownSockets(void
      }
      else { /* -displayfd and no explicit display number */
          Bool found = 0;
-         for (i = 0; i < 65535 - X_TCP_PORT; i++) {
+         for (i = 0; i < 65536 - X_TCP_PORT; i++) {
 -            if (TryCreateSocket(i, &partial) && !partial) {
 +            if (TryCreateSocket(i, &partial) && ListenTransCount >= 1 && (PartialNetwork || !partial)) {
                  found = 1;
                  break;
              }

--
Alioth's /srv/git/code.x2go.org/vcxsrv.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/vcxsrv.git


More information about the x2go-commits mailing list