Commit 9bc6ff26 authored by Mike Gabriel's avatar Mike Gabriel

Drop X11 extensions not shipped with recent X.Org server versions anymore:

include/extensions: Xag.h, Xagsrv.h, Xagstr.h Xserver/Xext: appgroup.c, appgroup.h lib/Xext: XAppgroup.c include/extensions: Xcup.h, Xcupstr.h, Xserver/Xext: cup.c lib/Xext: cup.c include/extensions: Xdbe.h Xserver/Xext: Xdbe.c Xserver/Xext: dgaproc.h, xf86dga.c, xf86dga2.c, xf86dgaext.h include/extensions: Xevie.h, Xeviestr.h include/extensions: XEVI.h, XEVIstr.h Xserver/Xext: EVI.c, EVIstruct.h, sampleEVI.c lib/Xext: XEVI.c include/extensions: fontcache.h, fontcacheP.h, fontcachstr.h Xserver/Xext: fontcache.c include/extensions: lbxbuf.h, lbxbufstr.h, lbxdeltastr.h, lbximage.h, lbxopts.h, lbxstr.h, lbxzlib.h lib/Xext: XLbx.c include/extensions: multibuf.h, multibufst.h lib/Xext: XMultibuf.c Xserver/Xext: mbuf.c, mbufbf.c, mbufpx.c include/extensions: xf86vmode.h, xf86vmstr.h Xserver/Xext: vidmodeproc.h, xf86vmode.c lib/Xext: MITMisc.c Xserver/Xext: mitmisc.c Xserver/Xext: xf86misc.c, xf86miscproc.h Xserver/XTrap: xf86XTrapModule.c, xtrapddmi.c, xtrapdi.c, xtrapdiswp.c, xtrapditbl.c include/extensions: xtrapbits.h xtrapddmi.h xtrapdi.h xtrapemacros.h xtraplib.h xtraplibp.h xtrapproto.h Fixes: ArcticaProject/nx-libs#116 X.org: https://cgit.freedesktop.org/xorg/xserver/commit/?id=cbc20d92de92aad5ca240310a9156ccf97c24a01 Plus: Drop various Imake'ish defines where not needed anymore.
parent c646808b
usr/lib/*/libNX_Xext.so
usr/include/*/nx-X11/extensions/MITMisc.h
usr/include/*/nx-X11/extensions/XEVI.h
usr/include/*/nx-X11/extensions/XEVIstr.h
usr/include/*/nx-X11/extensions/Xevie.h
usr/include/*/nx-X11/extensions/Xeviestr.h
usr/include/*/nx-X11/extensions/XLbx.h
usr/include/*/nx-X11/extensions/XShm.h
usr/include/*/nx-X11/extensions/Xag.h
usr/include/*/nx-X11/extensions/Xagsrv.h
usr/include/*/nx-X11/extensions/Xagstr.h
usr/include/*/nx-X11/extensions/Xcup.h
usr/include/*/nx-X11/extensions/Xcupstr.h
usr/include/*/nx-X11/extensions/Xdbe.h
usr/include/*/nx-X11/extensions/Xdbeproto.h
usr/include/*/nx-X11/extensions/Xext.h
usr/include/*/nx-X11/extensions/dpms.h
usr/include/*/nx-X11/extensions/dpmsstr.h
usr/include/*/nx-X11/extensions/extutil.h
usr/include/*/nx-X11/extensions/lbxstr.h
usr/include/*/nx-X11/extensions/lbxbuf.h
usr/include/*/nx-X11/extensions/lbxdeltastr.h
usr/include/*/nx-X11/extensions/lbximage.h
usr/include/*/nx-X11/extensions/lbxbufstr.h
usr/include/*/nx-X11/extensions/lbxopts.h
usr/include/*/nx-X11/extensions/lbxzlib.h
usr/include/*/nx-X11/extensions/mitmiscstr.h
usr/include/*/nx-X11/extensions/multibuf.h
usr/include/*/nx-X11/extensions/multibufst.h
usr/include/*/nx-X11/extensions/security.h
usr/include/*/nx-X11/extensions/securstr.h
usr/include/*/nx-X11/extensions/shape.h
......
......@@ -8,12 +8,12 @@ libNX_Xext.so.6 libnx-xext6 #MINVER#
DPMSInfo@Base 3.5.0.29
DPMSQueryExtension@Base 3.5.0.29
DPMSSetTimeouts@Base 3.5.0.29
XLbxGetEventBase@Base 3.5.0.29
XLbxQueryExtension@Base 3.5.0.29
XLbxQueryVersion@Base 3.5.0.29
XMITMiscGetBugMode@Base 3.5.0.29
XMITMiscQueryExtension@Base 3.5.0.29
XMITMiscSetBugMode@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XLbxGetEventBase@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XLbxQueryExtension@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XLbxQueryVersion@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XMITMiscGetBugMode@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XMITMiscQueryExtension@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XMITMiscSetBugMode@Base 3.5.0.29
XMissingExtension@Base 3.5.0.29
XSecurityAllocXauth@Base 3.5.0.29
XSecurityFreeXauth@Base 3.5.0.29
......@@ -85,44 +85,44 @@ libNX_Xext.so.6 libnx-xext6 #MINVER#
XTestQueryInputSize@Base 3.5.0.29
XTestReset@Base 3.5.0.29
XTestStopInput@Base 3.5.0.29
XagCreateAssociation@Base 3.5.0.29
XagCreateEmbeddedApplicationGroup@Base 3.5.0.29
XagCreateNonembeddedApplicationGroup@Base 3.5.0.29
XagDestroyApplicationGroup@Base 3.5.0.29
XagDestroyAssociation@Base 3.5.0.29
XagGetApplicationGroupAttributes@Base 3.5.0.29
XagQueryApplicationGroup@Base 3.5.0.29
XagQueryVersion@Base 3.5.0.29
XcupGetReservedColormapEntries@Base 3.5.0.29
XcupQueryVersion@Base 3.5.0.29
XcupStoreColors@Base 3.5.0.29
XdbeAllocateBackBufferName@Base 3.5.0.29
XdbeBeginIdiom@Base 3.5.0.29
XdbeDeallocateBackBufferName@Base 3.5.0.29
XdbeEndIdiom@Base 3.5.0.29
XdbeFreeVisualInfo@Base 3.5.0.29
XdbeGetBackBufferAttributes@Base 3.5.0.29
XdbeGetVisualInfo@Base 3.5.0.29
XdbeQueryExtension@Base 3.5.0.29
XdbeSwapBuffers@Base 3.5.0.29
XeviGetVisualInfo@Base 3.5.0.29
XeviQueryExtension@Base 3.5.0.29
XeviQueryVersion@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XagCreateAssociation@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XagCreateEmbeddedApplicationGroup@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XagCreateNonembeddedApplicationGroup@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XagDestroyApplicationGroup@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XagDestroyAssociation@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XagGetApplicationGroupAttributes@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XagQueryApplicationGroup@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XagQueryVersion@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XcupGetReservedColormapEntries@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XcupQueryVersion@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XcupStoreColors@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeAllocateBackBufferName@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeBeginIdiom@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeDeallocateBackBufferName@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeEndIdiom@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeFreeVisualInfo@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeGetBackBufferAttributes@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeGetVisualInfo@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeQueryExtension@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XdbeSwapBuffers@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XeviGetVisualInfo@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XeviQueryExtension@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XeviQueryVersion@Base 3.5.0.29
XextAddDisplay@Base 3.5.0.29
XextCreateExtension@Base 3.5.0.29
XextDestroyExtension@Base 3.5.0.29
XextFindDisplay@Base 3.5.0.29
XextRemoveDisplay@Base 3.5.0.29
XmbufChangeBufferAttributes@Base 3.5.0.29
XmbufChangeWindowAttributes@Base 3.5.0.29
XmbufClearBufferArea@Base 3.5.0.29
XmbufCreateBuffers@Base 3.5.0.29
XmbufCreateStereoWindow@Base 3.5.0.29
XmbufDestroyBuffers@Base 3.5.0.29
XmbufDisplayBuffers@Base 3.5.0.29
XmbufGetBufferAttributes@Base 3.5.0.29
XmbufGetScreenInfo@Base 3.5.0.29
XmbufGetVersion@Base 3.5.0.29
XmbufGetWindowAttributes@Base 3.5.0.29
XmbufQueryExtension@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufChangeBufferAttributes@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufChangeWindowAttributes@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufClearBufferArea@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufCreateBuffers@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufCreateStereoWindow@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufDestroyBuffers@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufDisplayBuffers@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufGetBufferAttributes@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufGetScreenInfo@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufGetVersion@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufGetWindowAttributes@Base 3.5.0.29
#MISSING: 2:3.5.99.0-0# XmbufQueryExtension@Base 3.5.0.29
_XExtensionErrorFunction@Base 3.5.0.29
......@@ -3,3 +3,4 @@ usr/include/*/nx-X11/extensions/xtestconst.h
usr/include/*/nx-X11/extensions/shapestr.h
usr/include/*/nx-X11/extensions/shmstr.h
usr/include/*/nx-X11/extensions/syncstr.h
usr/include/*/nx-X11/extensions/Xdbeproto.h
......@@ -6,7 +6,7 @@ Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Last-Update: 2012-12-31
--- a/nx-X11/config/cf/Imake.tmpl
+++ b/nx-X11/config/cf/Imake.tmpl
@@ -829,7 +829,7 @@
@@ -776,7 +776,7 @@
#define AlternateUsrLibDir YES
#endif
#else
......
......@@ -45,17 +45,8 @@ override_dh_install:
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XInput.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XK*.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/*Xv*.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xtrap*.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XRes*.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/record*.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86vmode.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86vmstr.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86misc.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86dga1.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86dgastr.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86dga.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86dga1str.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86mscstr.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/bigreqstr.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xcmiscstr.h
rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XIproto.h
......
......@@ -172,15 +172,10 @@ X11.tmpl provides defaults for the following variables:
BDFTOSNFFILT command to run bdftosnf
BaseExtensionDefines universal extensions to use
BinDir directory in which to install programs
BuildAppgroup build AppGroup extension in server
BuildCup build Colormap Utilization extension in server
BuildDBE build DOUBLE-BUFFER extension
BuildDmx build Distributed Multihead X server and extension
BuildDPMS build Display Power Management Signaling extension
BuildIncRoot relative path to location of headers in build
BuildIncTop path from build includes directory to top
BuildEVI build EVI server extension
BuildMultibuffer build Multibuffer extension (obsolete)
BuildPlugin build xrx plug-in for web browsers
BuildRECORD Build RECORD extension
BuildServer build X server
......
......@@ -157,9 +157,6 @@ XORGRELSTRING = XorgManVersionString
#define BuildXauLib (BuildLibraries || BuildLibrariesForXServers)
#endif
#define UseInstalledXauLib (defined(UseInstalled) || !BuildXauLib)
#ifndef BuildMITMiscExt
#define BuildMITMiscExt YES
#endif
#ifndef BuildTestExt
#define BuildTestExt YES
#endif
......@@ -178,21 +175,12 @@ XORGRELSTRING = XorgManVersionString
#ifndef BuildXInputExt
#define BuildXInputExt NO
#endif
#ifndef BuildEVI
#define BuildEVI YES
#endif
#ifndef BuildDBE
#define BuildDBE YES
#endif
#ifndef BuildDIS
#define BuildDIS NO
#endif
#ifndef BuildDPMS
#define BuildDPMS YES
#endif
#ifndef BuildFontCache
#define BuildFontCache NO
#endif
#ifndef BuildXKB
#define BuildXKB YES
#endif
......@@ -202,9 +190,6 @@ XORGRELSTRING = XorgManVersionString
#ifndef BuildXKBfilelib
#define BuildXKBfilelib (BuildXKB && !BuildServersOnly)
#endif
#ifndef BuildXTrap
#define BuildXTrap YES
#endif
/*
* WARNING: Setting UseXKBInClients to YES cause incompatibilities
......@@ -214,9 +199,6 @@ XORGRELSTRING = XorgManVersionString
#ifndef UseXKBInClients
#define UseXKBInClients NO /* use XKB in "normal" clients? */
#endif
#ifndef BuildMultibuffer
#define BuildMultibuffer NO
#endif
#ifndef BuildRECORD
#define BuildRECORD YES
#endif
......@@ -229,15 +211,6 @@ XORGRELSTRING = XorgManVersionString
#ifndef BuildXCSecurity
#define BuildXCSecurity YES
#endif
#ifndef BuildAppgroup
#define BuildAppgroup YES
#endif
#if BuildAppgroup && !BuildXCSecurity
#define BuildXCSecurity YES
#endif
#ifndef BuildCup
#define BuildCup YES
#endif
#ifndef HasPlugin
/* Browser plugins are shared libraries - only build them if the OS
* supports shared libs.
......@@ -251,18 +224,9 @@ XORGRELSTRING = XorgManVersionString
#ifndef BuildScreenSaverExt
#define BuildScreenSaverExt NO
#endif
#ifndef BuildXF86VidModeExt
#define BuildXF86VidModeExt NO
#endif
#ifndef BuildXF86MiscExt
#define BuildXF86MiscExt NO
#endif
#ifndef BuildXF86BigfontExt
#define BuildXF86BigfontExt NO
#endif
#ifndef BuildXF86DGA
#define BuildXF86DGA NO
#endif
#ifndef BuildXResExt
#define BuildXResExt NO
#endif
......@@ -301,10 +265,6 @@ XORGRELSTRING = XorgManVersionString
#define BuildCompositeLibrary !BuildServersOnly && BuildXfixesLibrary
#endif
#ifndef BuildXevie
#define BuildXevie YES
#endif
#ifndef BuildRootless
#define BuildRootless NO
#endif
......@@ -459,13 +419,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#endif
#ifndef ExtensionDefines
#ifndef MITMiscDefines
#if BuildMITMiscExt
#define MITMiscDefines -DMITMISC
#else
#define MITMiscDefines /**/
#endif
#endif
#ifndef XTestDefines
#if BuildTestExt
#define XTestDefines -DXTEST
......@@ -473,13 +426,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#define XTestDefines /**/
#endif
#endif
#ifndef XTrapDefines
#if BuildXTrap
#define XTrapDefines -DXTRAP
#else
#define XTrapDefines /**/
#endif
#endif
#ifndef XSyncDefines
#if BuildSyncExt
#define XSyncDefines -DXSYNC
......@@ -573,14 +519,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#endif
#endif
#ifndef EVIDefines
#if BuildEVI
#define EVIDefines -DEVI
#else
#define EVIDefines /**/
#endif
#endif
#ifndef DBEDefines
#if BuildDBE
#define DBEDefines -DDBE
......@@ -593,14 +531,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#define PervasiveDBEDefines /* -DNEED_DBE_BUF_BITS -DNEED_DBE_BUF_VALIDATE */
#endif
#ifndef MultibufferDefines
#if BuildMultibuffer
#define MultibufferDefines -DMULTIBUFFER
#else
#define MultibufferDefines /**/
#endif
#endif
#ifndef ScreenSaverExtensionDefines
#if BuildScreenSaverExt
#define ScreenSaverExtensionDefines -DSCREENSAVER
......@@ -608,20 +538,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#define ScreenSaverExtensionDefines /**/
#endif
#endif
#ifndef VidModeExtensionDefines
#if BuildXF86VidModeExt
#define VidModeExtensionDefines -DXF86VIDMODE
#else
#define VidModeExtensionDefines /**/
#endif
#endif
#ifndef XF86MiscExtensionDefines
#if BuildXF86MiscExt
#define XF86MiscExtensionDefines -DXF86MISC
#else
#define XF86MiscExtensionDefines /**/
#endif
#endif
#ifndef XF86BigfontExtensionDefines
#if BuildXF86BigfontExt
......@@ -663,14 +579,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#endif
#endif
#ifndef AppgroupDefines
#if BuildAppgroup
#define AppgroupDefines -DXAPPGROUP
#else
#define AppgroupDefines /**/
#endif
#endif
#ifndef XCSecurityDefines
#if BuildXCSecurity
#define XCSecurityDefines -DXCSECURITY
......@@ -679,14 +587,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#endif
#endif
#ifndef CupDefines
#if BuildCup
#define CupDefines -DTOGCUP
#else
#define CupDefines /**/
#endif
#endif
#ifndef DPMSDefines
#if BuildDPMS
#define DPMSDefines -DDPMSExtension
......@@ -711,14 +611,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#endif
#endif
#ifndef FontCacheExtentionDefines
#if BuildFontCache
#define FontCacheExtensionDefines -DFONTCACHE
#else
#define FontCacheExtensionDefines /**/
#endif
#endif
#ifndef XfixesDefines
#if BuildXfixes
#define XfixesDefines -DXFIXES
......@@ -743,14 +635,6 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#endif
#endif
#ifndef XevieDefines
#if BuildXevie
#define XevieDefines -DXEVIE
#else
#define XevieDefines /**/
#endif
#endif
#ifndef RootlessDefines
#if BuildRootless
#define RootlessDefines -DROOTLESS
......@@ -764,12 +648,20 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#endif
#ifndef PervasiveExtensionDefines
#define PervasiveExtensionDefines \
ShapeDefines XInputDefines XkbDefines AppgroupDefines \
XCSecurityDefines CupDefines PervasiveDBEDefines \
XF86BigfontExtensionDefines DPMSDefines \
PervasiveDBEDefines \
ShapeDefines \
XInputDefines \
XkbDefines \
XCSecurityDefines \
XF86BigfontExtensionDefines \
DPMSDefines \
SitePervasiveExtensionDefines \
RenderDefines \
RandRDefines \
XineramaDefines \
SitePervasiveExtensionDefines RenderDefines RandRDefines \
XfixesDefines XDamageDefines CompositeDefines XevieDefines \
XfixesDefines \
XDamageDefines \
CompositeDefines \
RootlessDefines
#endif
#ifndef SiteExtensionDefines
......@@ -777,12 +669,18 @@ FCHOWN_DEFINES = -DHAS_FCHOWN
#endif
#ifndef BaseExtensionDefines
#define BaseExtensionDefines \
MultibufferDefines MITMiscDefines XTestDefines XTrapDefines \
XSyncDefines XCMiscDefines RECORDDefines \
ShmDefines BigReqDefines VidModeExtensionDefines \
XF86MiscExtensionDefines DBEDefines DPMSDefines EVIDefines \
ScreenSaverExtensionDefines XvExtensionDefines XvMCExtensionDefines \
GlxDefines FontCacheExtensionDefines SiteExtensionDefines \
DBEDefines \
XTestDefines \
XSyncDefines \
RECORDDefines \
ShmDefines \
BigReqDefines \
DPMSDefines \
ScreenSaverExtensionDefines \
XvExtensionDefines \
XvMCExtensionDefines \
GlxDefines \
SiteExtensionDefines \
XResExtensionDefines
#endif
#define ExtensionDefines BaseExtensionDefines ExtensionOSDefines
......
......@@ -944,10 +944,6 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion)
# endif
#endif
#ifndef BuildDmx
#define BuildDmx YES
#endif
#include <lnxLib.rules>
# include <xorg.cf>
......
......@@ -472,21 +472,6 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
#endif
/*
* Build the XFree86-VidMode extension
*/
#ifndef BuildXF86VidModeExt
# define BuildXF86VidModeExt YES
#endif
/* Don't build this now because the interface hasn't been done yet */
/*
* Build the XFree86-Misc extension
*/
#ifndef BuildXF86MiscExt
# define BuildXF86MiscExt YES
#endif
/*
* Build the XFree86-Bigfont extension
*/
#ifndef BuildXF86BigfontExt
......@@ -494,13 +479,6 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
#endif
/*
* Build the XFree86 DGA support
*/
#ifndef BuildXF86DGA
# define BuildXF86DGA YES
#endif
/*
* Build the DPMS extension support
*/
#ifndef BuildDPMSExt
......@@ -576,12 +554,6 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
#define InstallJapaneseDocs NO
#endif
#if BuildXF86DGA
# define XFree86DGADefines -DXFreeXDGA
#else
# define XFree86DGADefines /**/
#endif
#if BuildXvExt
# define XFree86XvDefines -DXvExtension
#else
......@@ -643,9 +615,8 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
/* Server defines required for all OSs */
#ifndef XFree86ServerDefines
# define XFree86ServerDefines -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH \
XFree86DGADefines XFree86XvDefines \
XFree86XvDefines \
XFree86LoaderDefines -DXFree86Server \
VidModeExtensionDefines \
XFree86XvMCDefines \
SmartScheduleDefines \
DebugDefines XFree86XResDefines \
......
......@@ -12,29 +12,13 @@ NULL =
SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h
#endif
#if BuildXF86MiscExt
XF86MISCHEADERS = xf86misc.h xf86mscstr.h
#endif
#if BuildXF86BigfontExt
XF86BIGFONTHEADERS = xf86bigfont.h xf86bigfstr.h
#endif
#if BuildXF86VidModeExt
XF86VIDMODEHEADERS = xf86vmode.h xf86vmstr.h
#endif
#if BuildXF86DGA
XF86DGAHEADERS = xf86dga.h xf86dgastr.h xf86dga1.h xf86dga1str.h
#endif
#if BuildXextLib
LBXHEADERS = XLbx.h lbxbuf.h lbxbufstr.h lbxdeltastr.h lbximage.h lbxopts.h \
lbxstr.h lbxzlib.h
#endif
#if BuildXvExt
XVHEADERS = Xv.h Xvlib.h Xvproto.h
XVMCHEADERS = XvMC.h XvMClib.h XvMCproto.h vldXvMC.h
#endif
#if BuildFontCache
FONTCACHEHEADERS = fontcache.h fontcacheP.h fontcachstr.h
#endif
#if BuildXinerama
XINERAMAHEADERS = panoramiXext.h panoramiXproto.h
#endif
......@@ -53,58 +37,39 @@ COMPOSITEHEADERS = composite.h compositeproto.h
#if BuildDamage
DAMAGEHEADERS = damagewire.h damageproto.h
#endif
#if BuildXTrap
XTRAPHEADERS = xtrapbits.h xtrapddmi.h xtrapdi.h xtrapemacros.h xtraplib.h \
xtraplibp.h xtrapproto.h
#endif
#if BuildXResExt
XRESHEADERS = XResproto.h
#endif
#if BuildXevie
XEVIEHEADERS = Xevie.h Xeviestr.h
#endif
EXTRAHEADERS = \
$(SCREENSAVERHEADERS) \
$(XF86MISCHEADERS) \
$(XF86BIGFONTHEADERS) \
$(XF86VIDMODEHEADERS) \
$(XF86DGAHEADERS) \
$(XINERAMAHEADERS) \
$(LBXHEADERS) \
$(XF86BIGFONTHEADERS) \
$(XVHEADERS) \
$(XVMCHEADERS) \
$(FONTCACHEHEADERS) \
$(RANDRHEADERS) \
$(RENDERHEADERS) \
$(XFIXESHEADERS) \
$(COMPOSITEHEADERS) \
$(DAMAGEHEADERS) \
$(XEVIEHEADERS) \
$(XTRAPHEADERS) \
$(XRESHEADERS) \
$(NULL)
HEADERS = Xext.h \
xcmiscstr.h \
MITMisc.h mitmiscstr.h \
bigreqstr.h \
extutil.h \
XI.h XInput.h XIproto.h \
xtestconst.h xtestext1.h xteststr.h \
XKB.h XKBgeom.h XKBproto.h XKBstr.h XKBsrv.h \
Xdbe.h Xdbeproto.h \
Xag.h Xagstr.h Xagsrv.h \
Xdbeproto.h \
XShm.h shmstr.h \
$(EXTRAHEADERS) \
multibuf.h multibufst.h \
record.h recordstr.h \
security.h securstr.h \
shape.h shapestr.h \
sync.h syncstr.h \
Xcup.h Xcupstr.h \
dpms.h dpmsstr.h \
XEVI.h XEVIstr.h \
$(NULL)
all::
......@@ -120,9 +85,6 @@ InstallDriverSDKNonExecFile(XIproto.h,$(DRIVERSDKINCLUDEDIR)/extensions)
InstallDriverSDKNonExecFile(Xv.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xvproto.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(dpms.h,$(DRIVERSDKINCLUDEDIR)/extensions)
InstallDriverSDKNonExecFile(xf86dga1str.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(xf86dgastr.h,$(DRIVERSDKINCLUDEDIR)/extensions)
InstallDriverSDKNonExecFile(xf86misc.h,$(DRIVERSDKINCLUDEDIR)/extensions)
InstallDriverSDKNonExecFile(renderproto.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(Xv.h,$(DRIVERSDKINCLUDEDIR)/extensions)
InstallDriverSDKNonExecFile(XvMC.h,$(DRIVERSDKINCLUDEDIR))
......
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
/* $Xorg: MITMisc.h,v 1.4 2001/02/09 02:03:23 xorgcvs Exp $ */
#ifndef _XMITMISC_H_
#define _XMITMISC_H_
#include <nx-X11/Xfuncproto.h>
#define X_MITSetBugMode 0
#define X_MITGetBugMode 1
#define MITMiscNumberEvents 0
#define MITMiscNumberErrors 0
#ifndef _MITMISC_SERVER_
_XFUNCPROTOBEGIN
Bool XMITMiscQueryExtension(
Display* /* dpy */,
int* /* event_basep */,
int* /* error_basep */
);
Status XMITMiscSetBugMode(
Display* /* dpy */,
Bool /* onOff */
);
Bool XMITMiscGetBugMode(
Display* /* dpy */
);
_XFUNCPROTOEND
#endif
#endif
/* $Xorg: XEVI.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/* $XFree86$ */
#ifndef _XEVI_H_
#define _XEVI_H_
#include <nx-X11/Xfuncproto.h>
#define X_EVIQueryVersion 0
#define X_EVIGetVisualInfo 1
#define XEVI_TRANSPARENCY_NONE 0
#define XEVI_TRANSPARENCY_PIXEL 1
#define XEVI_TRANSPARENCY_MASK 2
#ifndef _XEVI_SERVER_
typedef struct {
VisualID core_visual_id;
int screen;
int level;
unsigned int transparency_type;
unsigned int transparency_value;
unsigned int min_hw_colormaps;
unsigned int max_hw_colormaps;
unsigned int num_colormap_conflicts;
VisualID* colormap_conflicts;
} ExtendedVisualInfo;
_XFUNCPROTOBEGIN
Bool XeviQueryExtension(
Display* /* dpy */
);
Status XeviQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
Status XeviGetVisualInfo(
Display* /* dpy */,
VisualID* /* visual_query */,
int /* nVisual_query */,
ExtendedVisualInfo** /* extendedVisualInfo_return */,
int* /* nInfo_return */
);
_XFUNCPROTOEND
#endif
#endif
/* $Xorg: XEVIstr.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/* $XFree86$ */
#ifndef _EVISTR_H_
#define _EVISTR_H_
#include <nx-X11/extensions/XEVI.h>
#define VisualID CARD32
#define EVINAME "Extended-Visual-Information"
#define XEVI_MAJOR_VERSION 1 /* current version numbers */
#define XEVI_MINOR_VERSION 0
typedef CARD32 VisualID32;
#define sz_VisualID32 4
typedef struct _xExtendedVisualInfo {
VisualID core_visual_id B32;
INT8 screen;
INT8 level;
CARD8 transparency_type;
CARD8 pad0;
CARD32 transparency_value B32;
CARD8 min_hw_colormaps;
CARD8 max_hw_colormaps;
CARD16 num_colormap_conflicts B16;
} xExtendedVisualInfo;
#define sz_xExtendedVisualInfo 16
typedef struct _XEVIQueryVersion {
CARD8 reqType; /* always XEVIReqCode */
CARD8 xeviReqType; /* always X_EVIQueryVersion */
CARD16 length B16;
} xEVIQueryVersionReq;
#define sz_xEVIQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of EVI protocol */
CARD16 minorVersion B16; /* minor version of EVI protocol */
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xEVIQueryVersionReply;
#define sz_xEVIQueryVersionReply 32
typedef struct _XEVIGetVisualInfoReq {
CARD8 reqType; /* always XEVIReqCode */
CARD8 xeviReqType; /* always X_EVIGetVisualInfo */
CARD16 length B16;
CARD32 n_visual B32;
} xEVIGetVisualInfoReq;
#define sz_xEVIGetVisualInfoReq 8
typedef struct _XEVIGetVisualInfoReply {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 n_info B32;
CARD32 n_conflicts B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
} xEVIGetVisualInfoReply;
#define sz_xEVIGetVisualInfoReply 32
#undef VisualID
#endif /* _EVISTR_H_ */
/* $Xorg: XLbx.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
/*
* Copyright 1992 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/include/extensions/XLbx.h,v 1.3 2002/10/16 01:59:55 dawes Exp $ */
#ifndef _XLBX_H_
#define _XLBX_H_
#include <nx-X11/Xfuncproto.h>
/*
* NOTE: any changes or additions to the opcodes needs to be reflected
* in the lbxCacheable array in Xserver/lbx/lbxmain.c
*/
#define X_LbxQueryVersion 0
#define X_LbxStartProxy 1
#define X_LbxStopProxy 2
#define X_LbxSwitch 3
#define X_LbxNewClient 4
#define X_LbxCloseClient 5
#define X_LbxModifySequence 6
#define X_LbxAllowMotion 7
#define X_LbxIncrementPixel 8
#define X_LbxDelta 9
#define X_LbxGetModifierMapping 10
#define X_LbxInvalidateTag 12
#define X_LbxPolyPoint 13
#define X_LbxPolyLine 14
#define X_LbxPolySegment 15
#define X_LbxPolyRectangle 16
#define X_LbxPolyArc 17
#define X_LbxFillPoly 18
#define X_LbxPolyFillRectangle 19
#define X_LbxPolyFillArc 20
#define X_LbxGetKeyboardMapping 21
#define X_LbxQueryFont 22
#define X_LbxChangeProperty 23
#define X_LbxGetProperty 24
#define X_LbxTagData 25
#define X_LbxCopyArea 26
#define X_LbxCopyPlane 27
#define X_LbxPolyText8 28
#define X_LbxPolyText16 29
#define X_LbxImageText8 30
#define X_LbxImageText16 31
#define X_LbxQueryExtension 32
#define X_LbxPutImage 33
#define X_LbxGetImage 34
#define X_LbxBeginLargeRequest 35
#define X_LbxLargeRequestData 36
#define X_LbxEndLargeRequest 37
#define X_LbxInternAtoms 38
#define X_LbxGetWinAttrAndGeom 39
#define X_LbxGrabCmap 40
#define X_LbxReleaseCmap 41
#define X_LbxAllocColor 42
#define X_LbxSync 43
#define LbxNumberReqs 44
#define LbxEvent 0
#define LbxQuickMotionDeltaEvent 1
#define LbxNumberEvents 2
/* This is always the master client */
#define LbxMasterClientIndex 0
/* LbxEvent lbxType sub-fields */
#define LbxSwitchEvent 0
#define LbxCloseEvent 1
#define LbxDeltaEvent 2
#define LbxInvalidateTagEvent 3
#define LbxSendTagDataEvent 4
#define LbxListenToOne 5
#define LbxListenToAll 6
#define LbxMotionDeltaEvent 7
#define LbxReleaseCmapEvent 8
#define LbxFreeCellsEvent 9
/*
* Lbx image compression methods
*
* No compression is always assigned the value of 0.
*
* The rest of the compression method opcodes are assigned dynamically
* at option negotiation time.
*/
#define LbxImageCompressNone 0
#define BadLbxClient 0
#define LbxNumberErrors (BadLbxClient + 1)
/* tagged data types */
#define LbxTagTypeModmap 1
#define LbxTagTypeKeymap 2
#define LbxTagTypeProperty 3
#define LbxTagTypeFont 4
#define LbxTagTypeConnInfo 5
#ifndef _XLBX_SERVER_
#include <nx-X11/Xdefs.h>
#include <nx-X11/Xlib.h>
_XFUNCPROTOBEGIN
Bool XLbxQueryExtension(
Display* /* dpy */,
int* /* requestp */,
int* /* event_basep */,
int* /* error_basep */
);
Bool XLbxQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
int XLbxGetEventBase(Display *dpy);
_XFUNCPROTOEND
#endif
#endif
/* $XFree86: xc/include/extensions/Xag.h,v 1.5 2001/12/17 20:52:24 dawes Exp $ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/* $Xorg: Xag.h,v 1.5 2001/02/09 02:03:24 xorgcvs Exp $ */
#ifndef _XAG_H_
#define _XAG_H_
#include <nx-X11/Xfuncproto.h>
#define X_XagQueryVersion 0
#define X_XagCreate 1
#define X_XagDestroy 2
#define X_XagGetAttr 3
#define X_XagQuery 4
#define X_XagCreateAssoc 5
#define X_XagDestroyAssoc 6
#define XagBadAppGroup 0
#define XagNumberErrors (XagBadAppGroup + 1)
#define XagNsingleScreen 7
#define XagNdefaultRoot 1
#define XagNrootVisual 2
#define XagNdefaultColormap 3
#define XagNblackPixel 4
#define XagNwhitePixel 5
#define XagNappGroupLeader 6
#ifndef _XAG_SERVER_
#include <stdarg.h>
_XFUNCPROTOBEGIN
typedef XID XAppGroup;
Bool XagQueryVersion(
Display* /* dpy */,
int* /* major_version */,
int* /* minor_version */
);
Status XagCreateEmbeddedApplicationGroup(
Display* /* dpy */,
VisualID /* root_visual */,
Colormap /* default_colormap */,
unsigned long /* black_pixel */,
unsigned long /* white_pixel */,
XAppGroup* /* app_group_return */
);
Status XagCreateNonembeddedApplicationGroup(
Display* /* dpy */,
XAppGroup* /* app_group_return */
);
Status XagDestroyApplicationGroup(
Display* /* dpy */,
XAppGroup /* app_group */
);
Status XagGetApplicationGroupAttributes(
Display* /* dpy */,
XAppGroup /* app_group */,
...
);
Status XagQueryApplicationGroup(
Display* /* dpy */,
XID /* resource_base */,
XAppGroup* /* app_group_ret */
);
Status XagCreateAssociation(
Display* /* dpy */,
Window* /* window_ret */,
void* /* system_window */
);
Status XagDestroyAssociation(
Display* /* dpy */,
Window /* window */
);
_XFUNCPROTOEND
#endif /* _XAG_SERVER_ */
#endif /* _XAG_H_ */
/* $XFree86: xc/include/extensions/Xagsrv.h,v 1.5 2003/07/16 01:38:24 dawes Exp $ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/* $Xorg: Xagsrv.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ */
#ifndef _XAGSRV_H_
#define _XAGSRV_H_
#include <nx-X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
extern void XagConnectionInfo(
ClientPtr /* client */,
xConnSetupPrefix** /* conn_prefix */,
char** /* conn_info */,
int* /* num_screens */
);
extern VisualID XagRootVisual(
ClientPtr /* client */
);
extern Colormap XagDefaultColormap(
ClientPtr /* client */
);
extern ClientPtr XagLeader(
ClientPtr /* client */
);
extern void XagCallClientStateChange(
ClientPtr /* client */
);
extern Bool XagIsControlledRoot (
ClientPtr /* client */,
WindowPtr /* pParent */
);
extern XID XagId (
ClientPtr /* client */
);
extern void XagGetDeltaInfo (
ClientPtr /* client */,
CARD32* /* buf */
);
_XFUNCPROTOEND
#endif /* _XAGSRV_H_ */
/* $XFree86: xc/include/extensions/Xagstr.h,v 1.4 2001/12/14 19:53:28 dawes Exp $ */
/*
Copyright 1996, 1998, 2001 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.
*/
/* $Xorg: Xagstr.h,v 1.6 2001/02/09 02:03:24 xorgcvs Exp $ */
#ifndef _XAGSTR_H_ /* { */
#define _XAGSTR_H_
#include <nx-X11/extensions/Xag.h>
#define XAppGroup CARD32
#define XAGNAME "XC-APPGROUP"
#define XAG_MAJOR_VERSION 1 /* current version numbers */
#define XAG_MINOR_VERSION 0
#define XagWindowTypeX11 0
#define XagWindowTypeMacintosh 1
#define XagWindowTypeWin32 2
#define XagWindowTypeWin16 3
/*
* Redefine some basic types used by structures defined herein. This allows
* both the library and server to view communicated data as 32-bit entities,
* thus preventing problems on 64-bit architectures where libXext sees this
* data as 64 bits and the server sees it as 32 bits.
*/
#define Colormap CARD32
#define VisualID CARD32
#define Window CARD32
typedef struct _XagQueryVersion {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagQueryVersion */
CARD16 length B16;
CARD16 client_major_version B16;
CARD16 client_minor_version B16;
} xXagQueryVersionReq;
#define sz_xXagQueryVersionReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD16 server_major_version B16;
CARD16 server_minor_version B16;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXagQueryVersionReply;
#define sz_xXagQueryVersionReply 32
/* Set AppGroup Attributes masks */
#define XagSingleScreenMask 1 << 0
#define XagDefaultRootMask 1 << XagNdefaultRoot
#define XagRootVisualMask 1 << XagNrootVisual
#define XagDefaultColormapMask 1 << XagNdefaultColormap
#define XagBlackPixelMask 1 << XagNblackPixel
#define XagWhitePixelMask 1 << XagNwhitePixel
#define XagAppGroupLeaderMask 1 << XagNappGroupLeader
typedef struct _XagCreate {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagCreate */
CARD16 length B16;
XAppGroup app_group B32;
CARD32 attrib_mask B32; /* LISTofVALUE follows */
} xXagCreateReq;
#define sz_xXagCreateReq 12
typedef struct _XagDestroy {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagDestroy */
CARD16 length B16;
XAppGroup app_group B32;
} xXagDestroyReq;
#define sz_xXagDestroyReq 8
typedef struct _XagGetAttr {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagGetAttr */
CARD16 length B16;
XAppGroup app_group B32;
} xXagGetAttrReq;
#define sz_xXagGetAttrReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
Window default_root B32;
VisualID root_visual B32;
Colormap default_colormap B32;
CARD32 black_pixel B32;
CARD32 white_pixel B32;
BOOL single_screen;
BOOL app_group_leader;
CARD16 pad2 B16;
} xXagGetAttrReply;
#define sz_xXagGetAttrReply 32
typedef struct _XagQuery {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagQuery */
CARD16 length B16;
CARD32 resource B32;
} xXagQueryReq;
#define sz_xXagQueryReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
XAppGroup app_group B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXagQueryReply;
#define sz_xXagQueryReply 32
typedef struct _XagCreateAssoc {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagCreateAssoc */
CARD16 length B16;
Window window B32;
CARD16 window_type B16;
CARD16 system_window_len B16; /* LISTofCARD8 follows */
} xXagCreateAssocReq;
#define sz_xXagCreateAssocReq 12
typedef struct _XagDestroyAssoc {
CARD8 reqType; /* always XagReqCode */
CARD8 xagReqType; /* always X_XagDestroyAssoc */
CARD16 length B16;
Window window B32;
} xXagDestroyAssocReq;
#define sz_xXagDestroyAssocReq 8
#undef XAppGroup
/*
* Cancel the previous redefinition of the basic types, thus restoring their
* X.h definitions.
*/
#undef Window
#undef Colormap
#undef VisualID
#endif /* } _XAGSTR_H_ */
/* $Xorg: Xcup.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ */
/*
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86$ */
#ifndef _XCUP_H_
#define _XCUP_H_
#include <nx-X11/Xfuncproto.h>
#define X_XcupQueryVersion 0
#define X_XcupGetReservedColormapEntries 1
#define X_XcupStoreColors 2
#define XcupNumberErrors 0
#ifndef _XCUP_SERVER_
_XFUNCPROTOBEGIN
Bool XcupQueryVersion(
Display* /* dpy */,
int* /* major_version */,
int* /* minor_version */
);
Status XcupGetReservedColormapEntries(
Display* /* dpy */,
int /* screen */,
XColor** /* colors_out */,
int* /* ncolors */
);
Status XcupStoreColors(
Display* /* dpy */,
Colormap /* colormap */,
XColor* /* colors */,
int /* ncolors */
);
_XFUNCPROTOEND
#endif /* _XCUP_SERVER_ */
#endif /* _XCUP_H_ */
/* $Xorg: Xcupstr.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ */
/*
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/include/extensions/Xcupstr.h,v 3.5 2001/08/01 00:44:35 tsi Exp $ */
#ifndef _XCUPSTR_H_ /* { */
#define _XCUPSTR_H_
#include <nx-X11/extensions/Xcup.h>
#define XCUPNAME "TOG-CUP"
#define XCUP_MAJOR_VERSION 1 /* current version numbers */
#define XCUP_MINOR_VERSION 0
typedef struct _XcupQueryVersion {
CARD8 reqType; /* always XcupReqCode */
CARD8 xcupReqType; /* always X_XcupQueryVersion */
CARD16 length B16;
CARD16 client_major_version B16;
CARD16 client_minor_version B16;
} xXcupQueryVersionReq;
#define sz_xXcupQueryVersionReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD16 server_major_version B16;
CARD16 server_minor_version B16;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXcupQueryVersionReply;
#define sz_xXcupQueryVersionReply 32
typedef struct _XcupGetReservedColormapEntries {
CARD8 reqType; /* always XcupReqCode */
CARD8 xcupReqType; /* always X_XcupGetReservedColormapEntries */
CARD16 length B16;
CARD32 screen B32;
} xXcupGetReservedColormapEntriesReq;
#define sz_xXcupGetReservedColormapEntriesReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXcupGetReservedColormapEntriesReply;
#define sz_xXcupGetReservedColormapEntriesReply 32
typedef struct _XcupStoreColors {
CARD8 reqType; /* always XcupReqCode */
CARD8 xcupReqType; /* always X_XcupStoreColors */
CARD16 length B16;
CARD32 cmap B32;
} xXcupStoreColorsReq;
#define sz_xXcupStoreColorsReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXcupStoreColorsReply;
#define sz_xXcupStoreColorsReply 32
#endif /* } _XCUPSTR_H_ */
/* $Xorg: Xdbe.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
/******************************************************************************
*
* Copyright (c) 1994, 1995 Hewlett-Packard Company
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Hewlett-Packard
* Company shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the Hewlett-Packard Company.
*
* Header file for Xlib-related DBE
*
*****************************************************************************/
/* $XFree86: xc/include/extensions/Xdbe.h,v 3.2 2001/08/01 00:44:35 tsi Exp $ */
#ifndef XDBE_H
#define XDBE_H
/* INCLUDES */
#include <nx-X11/Xfuncproto.h>
#include <nx-X11/extensions/Xdbeproto.h>
/* DEFINES */
/* Errors */
#define XdbeBadBuffer 0
/* TYPEDEFS */
typedef Drawable XdbeBackBuffer;
typedef unsigned char XdbeSwapAction;
typedef struct
{
Window swap_window; /* window for which to swap buffers */
XdbeSwapAction swap_action; /* swap action to use for swap_window */
}
XdbeSwapInfo;
typedef struct
{
Window window; /* window that buffer belongs to */
}
XdbeBackBufferAttributes;
typedef struct
{
int type;
Display *display; /* display the event was read from */
XdbeBackBuffer buffer; /* resource id */
unsigned long serial; /* serial number of failed request */
unsigned char error_code; /* error base + XdbeBadBuffer */
unsigned char request_code; /* major opcode of failed request */
unsigned char minor_code; /* minor opcode of failed request */
}
XdbeBufferError;
/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops
* (for non-C++ builds) in X11/Xfuncproto.h.
*/
_XFUNCPROTOBEGIN
extern Status XdbeQueryExtension(
Display* /* dpy */,
int* /* major_version_return */,
int* /* minor_version_return */
);
extern XdbeBackBuffer XdbeAllocateBackBufferName(
Display* /* dpy */,
Window /* window */,
XdbeSwapAction /* swap_action */
);
extern Status XdbeDeallocateBackBufferName(
Display* /* dpy */,
XdbeBackBuffer /* buffer */
);
extern Status XdbeSwapBuffers(
Display* /* dpy */,
XdbeSwapInfo* /* swap_info */,
int /* num_windows */
);
extern Status XdbeBeginIdiom(
Display* /* dpy */
);
extern Status XdbeEndIdiom(
Display* /* dpy */
);
extern XdbeScreenVisualInfo *XdbeGetVisualInfo(
Display* /* dpy */,
Drawable* /* screen_specifiers */,
int* /* num_screens */
);
extern void XdbeFreeVisualInfo(
XdbeScreenVisualInfo* /* visual_info */
);
extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
Display* /* dpy */,
XdbeBackBuffer /* buffer */
);
_XFUNCPROTOEND
#endif /* XDBE_H */
/* $XdotOrg: xc/include/extensions/Xevie.h,v 1.3 2005/05/22 01:20:14 alanc Exp $ */
/************************************************************
Copyright 2003 Sun Microsystems, Inc.
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of
the Software and that both the above copyright notice(s) and this
permission notice appear in supporting documentation.
THE SOFTWARE IS PROVIDED "AS 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
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of the copyright holder.
************************************************************/
#ifndef _XEVIE_H_
#define _XEVIE_H_
#include <nx-X11/Xfuncproto.h>
#define XEVIE_UNMODIFIED 0
#define XEVIE_MODIFIED 1
#ifndef _XEVIE_SERVER_
_XFUNCPROTOBEGIN
Bool XevieQueryVersion(
Display* /* dpy */,
int* /* major_version */,
int* /* minor_version */
);
extern Status XevieStart(
Display* /* dpy */
);
Status XevieEnd(
Display* /* dpy */
);
Status XevieSendEvent(
Display* /* dpy */,
XEvent* /* event */,
int /* data type */
);
Status XevieSelectInput(
Display* /* dpy */,
long
);
_XFUNCPROTOEND
#endif /* _XEVIE_SERVER_ */
#endif /* _XEVIE_H_ */
/* $XdotOrg: xc/include/extensions/Xeviestr.h,v 1.3 2005/05/22 01:20:14 alanc Exp $ */
/************************************************************
Copyright 2003 Sun Microsystems, Inc.
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of
the Software and that both the above copyright notice(s) and this
permission notice appear in supporting documentation.
THE SOFTWARE IS PROVIDED "AS 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
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of the copyright holder.
************************************************************/
#ifndef _XEVIESTR_H_
#define _XEVIESTR_H_
#define XEVIENAME "XEVIE"
#define XEVIE_MAJOR_VERSION 1
#define XEVIE_MINOR_VERSION 0
#define X_XevieQueryVersion 0
#define X_XevieStart 1
#define X_XevieEnd 2
#define X_XevieSend 3
#define X_XevieSelectInput 4
#define XevieNumberErrors 0
typedef struct _XevieQueryVersion {
CARD8 reqType;
CARD8 xevieReqType;
CARD16 length B16;
CARD16 client_major_version B16;
CARD16 client_minor_version B16;
} xXevieQueryVersionReq;
#define sz_xXevieQueryVersionReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD16 server_major_version B16;
CARD16 server_minor_version B16;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXevieQueryVersionReply;
#define sz_xXevieQueryVersionReply 32
typedef struct _XevieStart {
CARD8 reqType;
CARD8 xevieReqType;
CARD16 length B16;
CARD32 screen B32;
} xXevieStartReq;
#define sz_xXevieStartReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXevieStartReply;
#define sz_xXevieStartReply 32
typedef struct _XevieEnd {
CARD8 reqType;
CARD8 xevieReqType;
CARD16 length B16;
CARD32 cmap B32;
} xXevieEndReq;
#define sz_xXevieEndReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXevieEndReply;
#define sz_xXevieEndReply 32
typedef struct _XevieSend {
CARD8 reqType;
CARD8 xevieReqType;
CARD16 length B16;
xEvent event;
CARD32 dataType B32;
} xXevieSendReq;
#define sz_xXevieSendReq 104
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXevieSendReply;
#define sz_xXevieSendReply 32
typedef struct _XevieSelectInput {
CARD8 reqType;
CARD8 xevieReqType;
CARD16 length B16;
CARD32 event_mask B32;
} xXevieSelectInputReq;
#define sz_xXevieSelectInputReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequence_number B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXevieSelectInputReply;
#define sz_xXevieSelectInputReply 32
#endif /* } _XEVIESTR_H_ */
/* $XdotOrg: xc/include/extensions/Xinerama.h,v 1.3 2004/12/01 19:03:46 daniels Exp $ */
/*
Copyright 2003 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.
*/
/* $XFree86: xc/include/extensions/Xinerama.h,v 3.3 2002/09/16 18:05:19 eich Exp $ */
#ifndef _Xinerama_h
#define _Xinerama_h
#include <nx-X11/Xlib.h>
typedef struct {
int screen_number;
short x_org;
short y_org;
short width;
short height;
} XineramaScreenInfo;
_XFUNCPROTOBEGIN
Bool XineramaQueryExtension (
Display *dpy,
int *event_base,
int *error_base
);
Status XineramaQueryVersion(
Display *dpy,
int *major_versionp,
int *minor_versionp
);
Bool XineramaIsActive(Display *dpy);
/*
Returns the number of heads and a pointer to an array of
structures describing the position and size of the individual
heads. Returns NULL and number = 0 if Xinerama is not active.
Returned array should be freed with XFree().
*/
XineramaScreenInfo *
XineramaQueryScreens(
Display *dpy,
int *number
);
_XFUNCPROTOEND
#endif /* _Xinerama_h */
/*-
* Copyright (c) 1998-1999 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
* All rights reserved.
* Copyright (c) 1998-1999 X-TrueType Server Project, All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: fontcache.h,v 1.6 1999/01/31 12:41:32 akiyama Exp $
*/
/* $XFree86: xc/include/extensions/fontcache.h,v 1.3 2001/08/01 00:44:35 tsi Exp $ */
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _EXT_FONTCACHE_H_
#define _EXT_FONTCACHE_H_
#define X_FontCacheQueryVersion 0
#define X_FontCacheGetCacheSettings 1
#define X_FontCacheChangeCacheSettings 2
#define X_FontCacheGetCacheStatistics 3
#define FontCacheNumberEvents 0
#define FontCacheBadProtocol 0
#define FontCacheCannotAllocMemory 1
#define FontCacheNumberErrors (FontCacheCannotAllocMemory + 1)
typedef struct {
long himark;
long lowmark;
long balance;
} FontCacheSettings, *FontCacheSettingsPtr;
struct cacheinfo {
long hits;
long misshits;
long purged;
long usage;
};
typedef struct {
long purge_runs;
long purge_stat;
long balance;
struct cacheinfo f;
struct cacheinfo v;
} FontCacheStatistics, *FontCacheStatisticsPtr;
#ifndef _FONTCACHE_SERVER_
#include <nx-X11/Xlib.h>
_XFUNCPROTOBEGIN
Bool FontCacheQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
Bool FontCacheQueryExtension(
Display* /* dpy */,
int* /* event_base */,
int* /* error_base */
);
Status FontCacheGetCacheSettings(
Display* /* dpy */,
FontCacheSettings* /* cache info */
);
Status FontCacheChangeCacheSettings(
Display* /* dpy */,
FontCacheSettings* /* cache info */
);
Status FontCacheGetCacheStatistics(
Display* /* dpy */,
FontCacheStatistics* /* cache statistics info */
);
_XFUNCPROTOEND
#endif /* !_FONTCACHE_SERVER_ */
#endif /* _EXT_FONTCACHE_H_ */
/*-
* Copyright (c) 1998-1999 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
* All rights reserved.
* Copyright (c) 1998-1999 X-TrueType Server Project, All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: fontcacheP.h,v 1.6 1999/01/31 12:43:53 akiyama Exp $
*/
/* $XFree86: xc/include/extensions/fontcacheP.h,v 1.4 2000/03/01 01:04:21 dawes Exp $ */
#ifndef _FONTCACHEP_H_
#define _FONTCACHEP_H_
#include <nx-X11/extensions/fontcache.h>
int FontCacheChangeSettings(FontCacheSettingsPtr /* cinfo */);
void FontCacheGetSettings(FontCacheSettingsPtr /* cinfo */);
void FontCacheGetStatistics(FontCacheStatisticsPtr /* cstats */);
#endif /* _FONTCACHEP_H_ */
/*-
* Copyright (c) 1998-1999 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
* All rights reserved.
* Copyright (c) 1998-1999 X-TrueType Server Project, All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: fontcachstr.h,v 1.7 1999/01/31 14:58:40 akiyama Exp $
*/
/* $XFree86$ */
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _FONTCACHESTR_H_
#define _FONTCACHESTR_H_
#include <nx-X11/extensions/fontcache.h>
#define FONTCACHENAME "FontCache"
#define FONTCACHE_MAJOR_VERSION 0 /* current version numbers */
#define FONTCACHE_MINOR_VERSION 1
typedef struct _FontCacheQueryVersion {
CARD8 reqType; /* always FontCacheReqCode */
CARD8 fontcacheReqType; /* always X_FontCacheQueryVersion */
CARD16 length B16;
} xFontCacheQueryVersionReq;
#define sz_xFontCacheQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of Font-Cache */
CARD16 minorVersion B16; /* minor version of Font-Cache */
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xFontCacheQueryVersionReply;
#define sz_xFontCacheQueryVersionReply 32
typedef struct _FontCacheGetCacheSettings {
CARD8 reqType; /* always FontCacheReqCode */
CARD8 fontcacheReqType; /* always X_FontCacheGetCacheSettings */
CARD16 length B16;
} xFontCacheGetCacheSettingsReq;
#define sz_xFontCacheGetCacheSettingsReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 himark B32;
CARD32 lowmark B32;
CARD32 balance B32;
CARD32 reserve0 B32;
CARD32 reserve1 B32;
CARD32 reserve2 B32;
} xFontCacheGetCacheSettingsReply;
#define sz_xFontCacheGetCacheSettingsReply 32
typedef struct _FontCacheChangeCacheSettings {
CARD8 reqType; /* always FontCacheReqCode */
CARD8 fontcacheReqType; /* always X_FontCacheChangeCacheSettings */
CARD16 length B16;
CARD32 himark B32;
CARD32 lowmark B32;
CARD32 balance B32;
CARD32 reserve0 B32;
CARD32 reserve1 B32;
CARD32 reserve2 B32;
CARD32 reserve3 B32;
} xFontCacheChangeCacheSettingsReq;
#define sz_xFontCacheChangeCacheSettingsReq 32
typedef struct _FontCacheGetCacheStatistics {
CARD8 reqType; /* always FontCacheReqCode */
CARD8 fontcacheReqType; /* always X_FontCacheGetCacheStatistics */
CARD16 length B16;
} xFontCacheGetCacheStatisticsReq;
#define sz_xFontCacheGetCacheStatisticsReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 purge_runs B32;
CARD32 purge_stat B32;
CARD32 balance B32;
CARD32 reserve0 B32;
CARD32 f_hits B32;
CARD32 f_misshits B32;
CARD32 f_purged B32;
CARD32 f_usage B32;
CARD32 f_reserve0 B32;
CARD32 v_hits B32;
CARD32 v_misshits B32;
CARD32 v_purged B32;
CARD32 v_usage B32;
CARD32 v_reserve0 B32;
} xFontCacheGetCacheStatisticsReply;
#define sz_xFontCacheGetCacheStatisticsReply 64
#endif /* _FONTCACHESTR_H_ */
/* $Xorg: lbxbuf.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
/*
* Copyright 1988, 1989, 1990, 1994 Network Computing Devices, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE,
* DATA, OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND
* REGARDLESS OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
#ifndef _BUFFER_H_
#define _BUFFER_H_
#define INBUFFER_SIZE (1 << 13) /* 8K */
#define OUTBUFFER_SIZE (1 << 12) /* 4K */
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
typedef struct _zlibbuffer *ZlibBufferPtr;
#include <nx-X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
extern int InitZlibBuffer(ZlibBufferPtr b, int size);
extern void FreeZlibBuffer(ZlibBufferPtr b);
extern char *ReserveOutBuf(ZlibBufferPtr outbuf, int outlen);
_XFUNCPROTOEND
#endif /* _BUFFER_H_ */
/* $Xorg: lbxbufstr.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
/*
* Copyright 1988, 1989, 1990, 1994 Network Computing Devices, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE,
* DATA, OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND
* REGARDLESS OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
/* $XFree86$ */
#ifndef _BUFFERSTR_H_
#define _BUFFERSTR_H_
#include <nx-X11/extensions/lbxbuf.h>
/*
* ZLIB Input/Output buffer
*/
typedef struct _zlibbuffer {
char *bufbase;
char *bufend;
char *bufptr;
int bufcnt;
} ZlibBuffer;
#define BYTES_AVAIL(inbuf, len) \
(((inbuf)->bufcnt >= (len)) ? (inbuf)->bufptr : NULL)
#endif /* _BUFFERSTR_H_ */
/* $Xorg: lbxdeltastr.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
/*
* Copyright 1993 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifndef LBX_DELTA_STRUCT_H
#define LBX_DELTA_STRUCT_H
#define MIN_CACHEABLE_LEN 8
#define DELTA_CACHEABLE(pcache, len) \
((len) > MIN_CACHEABLE_LEN && (len) <= (pcache)->maxDeltasize)
/*
* An entry in the delta compactor cache
*/
typedef struct _LBXDeltaElem {
int length;
unsigned char *buf;
} LBXDeltaElemRec, *LBXDeltaElemPtr;
/*
* Delta compactor cache
*/
typedef struct _LBXDeltas {
unsigned short nDeltas;
unsigned short maxDeltasize;
LBXDeltaElemPtr deltas;
unsigned short nextDelta;
unsigned short activeDeltas; /* only needed for outgoing */
} LBXDeltasRec, *LBXDeltasPtr;
/*
* Motion delta cache
*/
typedef struct {
BYTE swapped;
BYTE detail;
CARD16 sequenceNumber B16;
Time time B32;
Window root B32, event B32, child B32;
INT16 rootX B16, rootY B16, eventX B16, eventY B16;
KeyButMask state B16;
BOOL sameScreen;
} lbxMotionCache;
/*
* Motion delta events
*/
typedef struct {
BYTE type; /* always eventBase + LbxQuickMotionDeltaEvent */
CARD8 deltaTime;
INT8 deltaX;
INT8 deltaY;
} lbxQuickMotionDeltaEvent;
#define sz_lbxQuickMotionDeltaEvent 4
typedef struct {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxMotionDeltaEvent */
INT8 deltaX;
INT8 deltaY;
CARD16 deltaTime B16;
CARD16 deltaSequence B16;
} lbxMotionDeltaEvent;
#define sz_lbxMotionDeltaEvent 8
extern int LBXInitDeltaCache ( LBXDeltasPtr pcache, int nDeltas,
int maxDeltasize );
extern void LBXFreeDeltaCache ( LBXDeltasPtr pcache );
extern int LBXDeltaMinDiffs ( LBXDeltasPtr pcache, unsigned char *inmsg,
int inmsglen, int maxdiff, int *pindex );
extern void LBXEncodeDelta ( LBXDeltasPtr pcache, unsigned char *inmsg,
int ndiff, int index, unsigned char *buf );
extern int LBXDecodeDelta ( LBXDeltasPtr pcache, xLbxDiffItem *deltas,
int ndiff, int index, unsigned char **buf );
extern void LBXAddDeltaOut ( LBXDeltasPtr pcache, unsigned char *inmsg,
int inmsglen );
extern void LBXAddDeltaIn ( LBXDeltasPtr pcache, unsigned char *inmsg,
int inmsglen );
#endif /* LBX_DELTA_STRUCT_H */
/* $Xorg: lbximage.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ */
/******************************************************************************
Copyright 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
/* $XFree86: xc/include/extensions/lbximage.h,v 1.4 2001/12/20 19:28:54 tsi Exp $ */
#ifndef _LBX_IMAGE_H_
#define _LBX_IMAGE_H_
#include <nx-X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
typedef struct _LbxBitmapCompMethod {
char *methodName;
int inited;
int methodOpCode; /* to be filled on reply from server */
int (*compInit)(
void
);
int (*compFunc)(
unsigned char * /* inbuf */,
unsigned char * /* outbuf */,
int /* outbufSize */,
int /* image_bytes */,
int /* pixels_per_line */,
int /* padded_bytes_per_scanline */,
int /* reverse_bits */,
int * /* bytesCompressed */
);
int (*decompFunc)(
unsigned char * /* inbuf */,
unsigned char * /* outbuf */,
int /* image_bytes */,
int /* pixels_per_line */,
int /* padded_bytes_per_scanline */,
int /* reverse_bits */
);
} LbxBitmapCompMethod;
#define LBX_MAX_DEPTHS 5
typedef struct _LbxPixmapCompMethod {
char *methodName;
unsigned formatMask;
int depthCount;
int depths[LBX_MAX_DEPTHS];
int inited;
int methodOpCode; /* to be filled on reply from server */
int (*compInit)(
void
);
int (*compFunc)(
char * /* inbuf */,
char * /* outbuf */,
int /* outbufSize */,
int /* format */,
int /* depth */,
int /* num_scan_lines */,
int /* scan_line_size */,
int * /* bytesCompressed */
);
int (*decompFunc)(
char * /* inbuf */,
char * /* outbuf */,
int /* num_scan_lines */,
int /* scan_line_size */
);
} LbxPixmapCompMethod;
extern int LbxImageEncodePackBits (
char * /* inbuf */,
char * /* outbuf */,
int /* outbufSize */,
int /* format */,
int /* depth */,
int /* num_scan_lines */,
int /* scan_line_size */,
int * /* bytesCompressed */
);
extern int LbxImageEncodeFaxG42D (
unsigned char * /* inbuf */,
unsigned char * /* outbuf */,
int /* outbufSize */,
int /* image_bytes */,
int /* pixels_per_line */,
int /* padded_bytes_per_scanline */,
int /* reverse_bits */,
int * /* bytesCompressed */
);
extern int LbxImageDecodePackBits (
char * /* inbuf */,
char * /* outbuf */,
int /* num_scan_lines */,
int /* scan_line_size */
);
extern int LbxImageDecodeFaxG42D (
unsigned char * /* inbuf */,
unsigned char * /* outbuf */,
int /* image_bytes */,
int /* pixels_per_line */,
int /* padded_bytes_per_scanline */,
int /* reverse_bits */
);
_XFUNCPROTOEND
#define LBX_IMAGE_COMPRESS_SUCCESS 0
#define LBX_IMAGE_COMPRESS_NO_SUPPORT 1
#define LBX_IMAGE_COMPRESS_BAD_MALLOC 2
#define LBX_IMAGE_COMPRESS_NOT_WORTH_IT 3
#endif /* _LBX_IMAGE_H_ */
/* $Xorg: lbxopts.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
/*
* Copyright 1994 Network Computing Devices, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/include/extensions/lbxopts.h,v 1.5 2001/01/17 17:53:21 dawes Exp $ */
#ifndef _LBX_OPTS_H_
#define _LBX_OPTS_H_
/*
* Negotiable configuration options
*/
#define LBX_OPT_DELTA_PROXY 0
#define LBX_OPT_DELTA_SERVER 1
#define LBX_OPT_STREAM_COMP 2
#define LBX_OPT_BITMAP_COMP 3
#define LBX_OPT_PIXMAP_COMP 4
#define LBX_OPT_MSG_COMP 5 /* aka "squishing" */
#define LBX_OPT_USE_TAGS 6
#define LBX_OPT_CMAP_ALL 7
#define LBX_OPT_EXTENSION 255
/*
* Length fields are encoded in 1 or 3 bytes
*/
#define LBX_OPT_SMALLLEN_SIZE 1
#define LBX_OPT_BIGLEN_SIZE 3
#define LBX_OPT_BIGLEN_MIN 256
#define LBX_OPT_DECODE_LEN(p, len, size) \
if ((p)[0]) { \
(len) = (p)[0]; \
(size) = LBX_OPT_SMALLLEN_SIZE; \
} \
else { \
(len) = ((LBX_OPT_BIGLEN_MIN + (p)[1]) << 8) | (p)[2]; \
(size) = LBX_OPT_BIGLEN_SIZE; \
}
/*
* Option header lengths
*/
#define LBX_OPT_SMALLHDR_LEN (1 + LBX_OPT_SMALLLEN_SIZE)
#define LBX_OPT_BIGHDR_LEN (1 + LBX_OPT_BIGLEN_SIZE)
/*
* Delta compression parameters
*/
#define LBX_OPT_DELTA_REQLEN 6
#define LBX_OPT_DELTA_REPLYLEN 2
#define LBX_OPT_DELTA_NCACHE_DFLT 16
#define LBX_OPT_DELTA_MSGLEN_MIN 32
#define LBX_OPT_DELTA_MSGLEN_DFLT 64
/*
* Stream compression opts
*/
#include <sys/types.h>
#if defined(WIN32) || (defined(USG) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__))
struct iovec {
caddr_t iov_base;
int iov_len;
};
#else
#ifndef Lynx
#include <sys/uio.h>
#else
#include <uio.h>
#endif
#endif
typedef void *LbxStreamCompHandle;
typedef struct _LbxStreamOpts {
LbxStreamCompHandle (*streamCompInit)(int fd, void * arg);
void * streamCompArg;
int (*streamCompStuffInput)(
int fd,
unsigned char *buf,
int buflen
);
int (*streamCompInputAvail)(
int fd
);
int (*streamCompFlush)(
int fd
);
int (*streamCompRead)(
int fd,
unsigned char *buf,
int buflen
);
int (*streamCompWriteV)(
int fd,
struct iovec *iov,
int iovcnt
);
void (*streamCompOn)(
int fd
);
void (*streamCompOff)(
int fd
);
void (*streamCompFreeHandle)(
LbxStreamCompHandle handle
);
} LbxStreamOpts;
#endif /* _LBX_OPTS_H_ */
/* $Xorg: lbxstr.h,v 1.4 2001/02/13 20:14:04 pookie Exp $ */
/*
* Copyright 1992 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XFree86: xc/include/extensions/lbxstr.h,v 1.2 2001/08/01 00:44:35 tsi Exp $ */
#ifndef _LBXSTR_H_
#define _LBXSTR_H_
#include <nx-X11/extensions/XLbx.h>
#define LBXNAME "LBX"
#define LBX_MAJOR_VERSION 1
#define LBX_MINOR_VERSION 0
/*
* Redefine some basic types used by structures defined herein. This removes
* any possibility on 64-bit architectures of one entity viewing communicated
* data as 32-bit quantities and another entity viewing the same data as 64-bit
* quantities.
*/
#define XID CARD32
#define Atom CARD32
#define Colormap CARD32
#define Drawable CARD32
#define VisualID CARD32
#define Window CARD32
typedef struct {
BOOL success; /* TRUE */
BOOL changeType;
CARD16 majorVersion B16,
minorVersion B16;
CARD16 length B16; /* 1/4 additional bytes in setup info */
CARD32 tag B32;
} xLbxConnSetupPrefix;
typedef struct _LbxQueryVersion {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxQueryVersion */
CARD16 length B16;
} xLbxQueryVersionReq;
#define sz_xLbxQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of LBX protocol */
CARD16 minorVersion B16; /* minor version of LBX protocol */
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xLbxQueryVersionReply;
#define sz_xLbxQueryVersionReply 32
typedef struct _LbxStartProxy {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxStartProxy */
CARD16 length B16;
} xLbxStartProxyReq;
#define sz_xLbxStartProxyReq 4
typedef struct _LbxStopProxy {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxStopProxy */
CARD16 length B16;
} xLbxStopProxyReq;
#define sz_xLbxStopProxyReq 4
typedef struct _LbxSwitch {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxSwitch */
CARD16 length B16;
CARD32 client B32; /* new client */
} xLbxSwitchReq;
#define sz_xLbxSwitchReq 8
typedef struct _LbxNewClient {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxNewClient */
CARD16 length B16;
CARD32 client B32; /* new client */
} xLbxNewClientReq;
#define sz_xLbxNewClientReq 8
typedef struct _LbxCloseClient {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxCloseClient */
CARD16 length B16;
CARD32 client B32; /* new client */
} xLbxCloseClientReq;
#define sz_xLbxCloseClientReq 8
typedef struct _LbxModifySequence {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxModifySequence */
CARD16 length B16;
CARD32 adjust B32;
} xLbxModifySequenceReq;
#define sz_xLbxModifySequenceReq 8
typedef struct _LbxAllowMotion {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxAllowMotion */
CARD16 length B16;
CARD32 num B32;
} xLbxAllowMotionReq;
#define sz_xLbxAllowMotionReq 8
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGrabCmap */
CARD16 length B16;
Colormap cmap B32;
} xLbxGrabCmapReq;
#define sz_xLbxGrabCmapReq 8
#define LBX_SMART_GRAB 0x80
#define LBX_AUTO_RELEASE 0x40
#define LBX_3CHANNELS 0x20
#define LBX_2BYTE_PIXELS 0x10
#define LBX_RGB_BITS_MASK 0x0f
#define LBX_LIST_END 0
#define LBX_PIXEL_PRIVATE 1
#define LBX_PIXEL_SHARED 2
#define LBX_PIXEL_RANGE_PRIVATE 3
#define LBX_PIXEL_RANGE_SHARED 4
#define LBX_NEXT_CHANNEL 5
typedef struct {
BYTE type; /* X_Reply */
CARD8 flags;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 pad0 B16;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B16;
} xLbxGrabCmapReply;
#define sz_xLbxGrabCmapReply 32
#define sz_xLbxGrabCmapReplyHdr 8
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxReleaseCmap */
CARD16 length B16;
Colormap cmap B32;
} xLbxReleaseCmapReq;
#define sz_xLbxReleaseCmapReq 8
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxAllocColor */
CARD16 length B16;
Colormap cmap B32;
CARD32 pixel B32;
CARD16 red B16, green B16, blue B16;
CARD16 pad B16;
} xLbxAllocColorReq;
#define sz_xLbxAllocColorReq 20
typedef struct _LbxIncrementPixel {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxIncrementPixel */
CARD16 length B16;
CARD32 cmap B32;
CARD32 pixel B32;
} xLbxIncrementPixelReq;
#define sz_xLbxIncrementPixelReq 12
typedef struct _LbxDelta {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxDelta */
CARD16 length B16;
CARD8 diffs; /* number of diffs */
CARD8 cindex; /* cache index */
/* list of diffs follows */
} xLbxDeltaReq;
#define sz_xLbxDeltaReq 6
typedef struct _LbxGetModifierMapping {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetModifierMapping */
CARD16 length B16;
} xLbxGetModifierMappingReq;
#define sz_xLbxGetModifierMappingReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 keyspermod;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 tag B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xLbxGetModifierMappingReply;
#define sz_xLbxGetModifierMappingReply 32
typedef struct _LbxGetKeyboardMapping {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetKeyboardMapping */
CARD16 length B16;
KeyCode firstKeyCode;
CARD8 count;
CARD16 pad1 B16;
} xLbxGetKeyboardMappingReq;
#define sz_xLbxGetKeyboardMappingReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 keysperkeycode;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 tag B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xLbxGetKeyboardMappingReply;
#define sz_xLbxGetKeyboardMappingReply 32
typedef struct _LbxQueryFont {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxQueryFont */
CARD16 length B16;
CARD32 fid B32;
} xLbxQueryFontReq;
#define sz_xLbxQueryFontReq 8
typedef struct _LbxInternAtoms {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxInternAtoms */
CARD16 length B16;
CARD16 num B16;
} xLbxInternAtomsReq;
#define sz_xLbxInternAtomsReq 6
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 atomsStart B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xLbxInternAtomsReply;
#define sz_xLbxInternAtomsReply 32
#define sz_xLbxInternAtomsReplyHdr 8
typedef struct _LbxGetWinAttrAndGeom {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetWinAttrAndGeom */
CARD16 length B16;
CARD32 id B32; /* window id */
} xLbxGetWinAttrAndGeomReq;
#define sz_xLbxGetWinAttrAndGeomReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 backingStore;
CARD16 sequenceNumber B16;
CARD32 length B32; /* NOT 0; this is an extra-large reply */
VisualID visualID B32;
#if defined(__cplusplus) || defined(c_plusplus)
CARD16 c_class B16;
#else
CARD16 class B16;
#endif
CARD8 bitGravity;
CARD8 winGravity;
CARD32 backingBitPlanes B32;
CARD32 backingPixel B32;
BOOL saveUnder;
BOOL mapInstalled;
CARD8 mapState;
BOOL override;
Colormap colormap B32;
CARD32 allEventMasks B32;
CARD32 yourEventMask B32;
CARD16 doNotPropagateMask B16;
CARD16 pad1 B16;
Window root B32;
INT16 x B16, y B16;
CARD16 width B16, height B16;
CARD16 borderWidth B16;
CARD8 depth;
CARD8 pad2;
} xLbxGetWinAttrAndGeomReply;
#define sz_xLbxGetWinAttrAndGeomReply 60
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxSync */
CARD16 length B16;
} xLbxSyncReq;
#define sz_xLbxSyncReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad0;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xLbxSyncReply;
#define sz_xLbxSyncReply 32
/* an LBX squished charinfo packs the data in a CARD32 as follows */
#define LBX_WIDTH_SHIFT 26
#define LBX_LEFT_SHIFT 20
#define LBX_RIGHT_SHIFT 13
#define LBX_ASCENT_SHIFT 7
#define LBX_DESCENT_SHIFT 0
#define LBX_WIDTH_BITS 6
#define LBX_LEFT_BITS 6
#define LBX_RIGHT_BITS 7
#define LBX_ASCENT_BITS 6
#define LBX_DESCENT_BITS 7
#define LBX_WIDTH_MASK 0xfc000000
#define LBX_LEFT_MASK 0x03f00000
#define LBX_RIGHT_MASK 0x000fe000
#define LBX_ASCENT_MASK 0x00001f80
#define LBX_DESCENT_MASK 0x0000007f
#define LBX_MASK_BITS(val, n) ((unsigned int) ((val) & ((1 << (n)) - 1)))
typedef struct {
CARD32 metrics B32;
} xLbxCharInfo;
/* note that this is identical to xQueryFontReply except for missing
* first 2 words
*/
typedef struct {
xCharInfo minBounds;
/* XXX do we need to leave this gunk? */
CARD32 walign1 B32;
xCharInfo maxBounds;
CARD32 walign2 B32;
CARD16 minCharOrByte2 B16, maxCharOrByte2 B16;
CARD16 defaultChar B16;
CARD16 nFontProps B16; /* followed by this many xFontProp structures */
CARD8 drawDirection;
CARD8 minByte1, maxByte1;
BOOL allCharsExist;
INT16 fontAscent B16, fontDescent B16;
CARD32 nCharInfos B32; /* followed by this many xLbxCharInfo structures */
} xLbxFontInfo;
typedef struct {
BYTE type; /* X_Reply */
CARD8 compression;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 tag B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
/* X_QueryFont sticks much of the data in the base reply packet,
* but we hope that it won't be needed, (and it won't fit in 32 bytes
* with the tag anyways)
*
* if any additional data is needed, its sent in a xLbxFontInfo
*/
} xLbxQueryFontReply;
#define sz_xLbxQueryFontReply 32
typedef struct _LbxChangeProperty {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxChangeProperty */
CARD16 length B16;
Window window B32;
Atom property B32;
Atom type B32;
CARD8 format;
CARD8 mode;
BYTE pad[2];
CARD32 nUnits B32;
} xLbxChangePropertyReq;
#define sz_xLbxChangePropertyReq 24
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 tag B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xLbxChangePropertyReply;
#define sz_xLbxChangePropertyReply 32
typedef struct _LbxGetProperty {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetProperty */
CARD16 length B16;
Window window B32;
Atom property B32;
Atom type B32;
CARD8 delete;
BYTE pad[3];
CARD32 longOffset B32;
CARD32 longLength B32;
} xLbxGetPropertyReq;
#define sz_xLbxGetPropertyReq 28
typedef struct {
BYTE type; /* X_Reply */
CARD8 format;
CARD16 sequenceNumber B16;
CARD32 length B32;
Atom propertyType B32;
CARD32 bytesAfter B32;
CARD32 nItems B32;
CARD32 tag B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
} xLbxGetPropertyReply;
#define sz_xLbxGetPropertyReply 32
typedef struct _LbxTagData {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxTagData */
CARD16 length B16;
XID tag B32;
CARD32 real_length B32;
/* data */
} xLbxTagDataReq;
#define sz_xLbxTagDataReq 12
typedef struct _LbxInvalidateTag {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxInvalidateTag */
CARD16 length B16;
CARD32 tag B32;
} xLbxInvalidateTagReq;
#define sz_xLbxInvalidateTagReq 8
typedef struct _LbxPutImage {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxPutImage */
CARD16 length B16;
CARD8 compressionMethod;
CARD8 cacheEnts;
CARD8 bitPacked;
/* rest is variable */
} xLbxPutImageReq;
#define sz_xLbxPutImageReq 7
typedef struct {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxGetImage */
CARD16 length B16;
Drawable drawable B32;
INT16 x B16, y B16;
CARD16 width B16, height B16;
CARD32 planeMask B32;
CARD8 format;
CARD8 pad1;
CARD16 pad2 B16;
} xLbxGetImageReq;
#define sz_xLbxGetImageReq 24
typedef struct {
BYTE type; /* X_Reply */
CARD8 depth;
CARD16 sequenceNumber B16;
CARD32 lbxLength B32;
CARD32 xLength B32;
VisualID visual B32;
CARD8 compressionMethod;
CARD8 pad1;
CARD16 pad2 B16;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xLbxGetImageReply;
#define sz_xLbxGetImageReply 32
/* Following used for LbxPolyPoint, LbxPolyLine, LbxPolySegment,
LbxPolyRectangle, LbxPolyArc, LbxPolyFillRectangle and LbxPolyFillArc */
#define GFX_CACHE_SIZE 15
#define GFXdCacheEnt(e) ((e) & 0xf)
#define GFXgCacheEnt(e) (((e) >> 4) & 0xf)
#define GFXCacheEnts(d,g) (((d) & 0xf) | (((g) & 0xf) << 4))
#define GFXCacheNone 0xf
typedef struct _LbxPolyPoint {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length B16;
CARD8 cacheEnts;
CARD8 padBytes;
} xLbxPolyPointReq;
#define sz_xLbxPolyPointReq 6
typedef xLbxPolyPointReq xLbxPolyLineReq;
typedef xLbxPolyPointReq xLbxPolySegmentReq;
typedef xLbxPolyPointReq xLbxPolyRectangleReq;
typedef xLbxPolyPointReq xLbxPolyArcReq;
typedef xLbxPolyPointReq xLbxPolyFillRectangleReq;
typedef xLbxPolyPointReq xLbxPolyFillArcReq;
#define sz_xLbxPolyLineReq sz_xLbxPolyPointReq
#define sz_xLbxPolySegmentReq sz_xLbxPolyPointReq
#define sz_xLbxPolyRectangleReq sz_xLbxPolyPointReq
#define sz_xLbxPolyArcReq sz_xLbxPolyPointReq
#define sz_xLbxPolyFillRectangleReq sz_xLbxPolyPointReq
#define sz_xLbxPolyFillArc sz_xLbxPolyPointReq
typedef struct _LbxFillPoly {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length B16;
CARD8 cacheEnts;
BYTE shape;
CARD8 padBytes;
} xLbxFillPolyReq;
#define sz_xLbxFillPolyReq 7
typedef struct _LbxCopyArea {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length B16;
CARD8 srcCache; /* source drawable */
CARD8 cacheEnts; /* dest drawable and gc */
/* followed by encoded src x, src y, dst x, dst y, width, height */
} xLbxCopyAreaReq;
#define sz_xLbxCopyAreaReq 6
typedef struct _LbxCopyPlane {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length B16;
CARD32 bitPlane B32;
CARD8 srcCache; /* source drawable */
CARD8 cacheEnts; /* dest drawable and gc */
/* followed by encoded src x, src y, dst x, dst y, width, height */
} xLbxCopyPlaneReq;
#define sz_xLbxCopyPlaneReq 10
typedef struct _LbxPolyText {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length B16;
CARD8 cacheEnts;
/* followed by encoded src x, src y coordinates and text elts */
} xLbxPolyTextReq;
#define sz_xLbxPolyTextReq 5
typedef xLbxPolyTextReq xLbxPolyText8Req;
typedef xLbxPolyTextReq xLbxPolyText16Req;
#define sz_xLbxPolyTextReq 5
#define sz_xLbxPolyText8Req 5
#define sz_xLbxPolyText16Req 5
typedef struct _LbxImageText {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType;
CARD16 length B16;
CARD8 cacheEnts;
CARD8 nChars;
/* followed by encoded src x, src y coordinates and string */
} xLbxImageTextReq;
typedef xLbxImageTextReq xLbxImageText8Req;
typedef xLbxImageTextReq xLbxImageText16Req;
#define sz_xLbxImageTextReq 6
#define sz_xLbxImageText8Req 6
#define sz_xLbxImageText16Req 6
typedef struct {
CARD8 offset;
CARD8 diff;
} xLbxDiffItem;
#define sz_xLbxDiffItem 2
typedef struct {
BYTE type; /* X_Reply */
CARD8 nOpts;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 optDataStart B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xLbxStartReply;
#define sz_xLbxStartReply 32
#define sz_xLbxStartReplyHdr 8
typedef struct _LbxQueryExtension {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxQueryExtension */
CARD16 length B16;
CARD32 nbytes B32;
} xLbxQueryExtensionReq;
#define sz_xLbxQueryExtensionReq 8
typedef struct _LbxQueryExtensionReply {
BYTE type; /* X_Reply */
CARD8 numReqs;
CARD16 sequenceNumber B16;
CARD32 length B32;
BOOL present;
CARD8 major_opcode;
CARD8 first_event;
CARD8 first_error;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
/* reply & event generating requests */
} xLbxQueryExtensionReply;
#define sz_xLbxQueryExtensionReply 32
typedef struct _LbxBeginLargeRequest {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxBeginLargeRequest */
CARD16 length B16;
CARD32 largeReqLength B32;
} xLbxBeginLargeRequestReq;
#define sz_BeginLargeRequestReq 8
typedef struct _LbxLargeRequestData {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxLargeRequestData */
CARD16 length B16;
/* followed by LISTofCARD8 data */
} xLbxLargeRequestDataReq;
#define sz_LargeRequestDataReq 4
typedef struct _LbxEndLargeRequest {
CARD8 reqType; /* always LbxReqCode */
CARD8 lbxReqType; /* always X_LbxEndLargeRequest */
CARD16 length B16;
} xLbxEndLargeRequestReq;
#define sz_EndLargeRequestReq 4
typedef struct _LbxSwitchEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxSwitchEvent */
CARD16 pad B16;
CARD32 client B32;
} xLbxSwitchEvent;
#define sz_xLbxSwitchEvent 8
typedef struct _LbxCloseEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxCloseEvent */
CARD16 sequenceNumber B16;
CARD32 client B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xLbxCloseEvent;
#define sz_xLbxCloseEvent 32
typedef struct _LbxInvalidateTagEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxInvalidateTagEvent */
CARD16 sequenceNumber B16;
CARD32 tag B32;
CARD32 tagType B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xLbxInvalidateTagEvent;
#define sz_xLbxInvalidateTagEvent 32
typedef struct _LbxSendTagDataEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxSendTagDataEvent */
CARD16 sequenceNumber B16;
CARD32 tag B32;
CARD32 tagType B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xLbxSendTagDataEvent;
#define sz_xLbxSendTagDataEvent 32
typedef struct _LbxListenToOneEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxListenToOneEvent */
CARD16 sequenceNumber B16;
CARD32 client B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xLbxListenToOneEvent;
#define sz_xLbxListenToOneEvent 32
typedef struct _LbxListenToAllEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxListenToAllEvent */
CARD16 sequenceNumber B16;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xLbxListenToAllEvent;
#define sz_xLbxListenToOneEvent 32
typedef struct _LbxReleaseCmapEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxReleaseCmapEvent */
CARD16 sequenceNumber B16;
Colormap colormap B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xLbxReleaseCmapEvent;
#define sz_xLbxReleaseCmapEvent 32
typedef struct _LbxFreeCellsEvent {
BYTE type; /* always eventBase + LbxEvent */
BYTE lbxType; /* LbxFreeCellsEvent */
CARD16 sequenceNumber B16;
Colormap colormap B32;
CARD32 pixelStart B32;
CARD32 pixelEnd B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xLbxFreeCellsEvent;
#define sz_xLbxFreeCellsEvent 32
/*
* squished X event sizes. If these change, be sure to update lbxquish.c
* and unsquish.c appropriately
*
* lbxsz_* is the padded squished length
* lbxupsz_* is the unpadded squished length
*/
#define lbxsz_KeyButtonEvent 32
#define lbxupsz_KeyButtonEvent 31
#define lbxsz_EnterLeaveEvent 32
#define lbxupsz_EnterLeaveEvent 32
#define lbxsz_FocusEvent 12
#define lbxupsz_FocusEvent 9
#define lbxsz_KeymapEvent 32
#define lbxupsz_KeymapEvent 32
#define lbxsz_ExposeEvent 20
#define lbxupsz_ExposeEvent 18
#define lbxsz_GfxExposeEvent 24
#define lbxupsz_GfxExposeEvent 21
#define lbxsz_NoExposeEvent 12
#define lbxupsz_NoExposeEvent 11
#define lbxsz_VisibilityEvent 12
#define lbxupsz_VisibilityEvent 9
#define lbxsz_CreateNotifyEvent 24
#define lbxupsz_CreateNotifyEvent 23
#define lbxsz_DestroyNotifyEvent 12
#define lbxupsz_DestroyNotifyEvent 12
#define lbxsz_UnmapNotifyEvent 16
#define lbxupsz_UnmapNotifyEvent 13
#define lbxsz_MapNotifyEvent 16
#define lbxupsz_MapNotifyEvent 13
#define lbxsz_MapRequestEvent 12
#define lbxupsz_MapRequestEvent 12
#define lbxsz_ReparentEvent 24
#define lbxupsz_ReparentEvent 21
#define lbxsz_ConfigureNotifyEvent 28
#define lbxupsz_ConfigureNotifyEvent 27
#define lbxsz_ConfigureRequestEvent 28
#define lbxupsz_ConfigureRequestEvent 28
#define lbxsz_GravityEvent 16
#define lbxupsz_GravityEvent 16
#define lbxsz_ResizeRequestEvent 12
#define lbxupsz_ResizeRequestEvent 12
#define lbxsz_CirculateEvent 20
#define lbxupsz_CirculateEvent 17
#define lbxsz_PropertyEvent 20
#define lbxupsz_PropertyEvent 17
#define lbxsz_SelectionClearEvent 16
#define lbxupsz_SelectionClearEvent 16
#define lbxsz_SelectionRequestEvent 28
#define lbxupsz_SelectionRequestEvent 28
#define lbxsz_SelectionNotifyEvent 24
#define lbxupsz_SelectionNotifyEvent 24
#define lbxsz_ColormapEvent 16
#define lbxupsz_ColormapEvent 14
#define lbxsz_MappingNotifyEvent 8
#define lbxupsz_MappingNotifyEvent 7
#define lbxsz_ClientMessageEvent 32
#define lbxupsz_ClientMessageEvent 32
#define lbxsz_UnknownEvent 32
#ifdef DEBUG
#define DBG_SWITCH 0x00000001
#define DBG_CLOSE 0x00000002
#define DBG_IO 0x00000004
#define DBG_READ_REQ 0x00000008
#define DBG_LEN 0x00000010
#define DBG_BLOCK 0x00000020
#define DBG_CLIENT 0x00000040
#define DBG_DELTA 0x00000080
extern int lbxDebug;
#define DBG(n,m) if (lbxDebug & (n)) { fprintf m; } else
#else
#define DBG(n,m)
#endif
/*
* Cancel the previous redefinition of the basic types, thus restoring their
* X.h definitions.
*/
#undef XID
#undef Atom
#undef Colormap
#undef Drawable
#undef VisualID
#undef Window
#endif /* _LBXSTR_H_ */
/* $Xorg: lbxzlib.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
/*
* Copyright 1993 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Dale Tonogai, Network Computing Devices
*/
#ifndef _ZLIB_H_
#define _ZLIB_H_
#define ZLIB_STRCOMP_OPT "XC-ZLIB"
#define ZLIB_STRCOMP_OPT_LEN 7
#define ZLIB_PACKET_HDRLEN 2
#define ZLIB_MAX_DATALEN 0xfff
#define ZLIB_MAX_PLAIN 270
#define ZLIB_MAX_OUTLEN (ZLIB_MAX_PLAIN << 1)
#define ZLIB_COMPRESS_FLAG 0x80
#define ZLIB_DATALEN_MASK 0x0f
#define ZLIB_PUT_PKTHDR(p, len, compflag) \
{ \
(p)[0] = ((unsigned)(len)) >> 8 | ((compflag) ? ZLIB_COMPRESS_FLAG : 0);\
(p)[1] = (len) & 0xff; \
}
#define ZLIB_GET_DATALEN(p) \
((((unsigned)((p)[0] & ZLIB_DATALEN_MASK)) << 8) | (unsigned)(p)[1])
#define ZLIB_COMPRESSED(p) ((p)[0] & ZLIB_COMPRESS_FLAG)
struct ZlibInfo;
extern void * ZlibInit ( int fd, int level );
extern void ZlibFree ( struct ZlibInfo *comp );
extern int ZlibFlush ( int fd );
extern int ZlibStuffInput ( int fd, unsigned char *buffer, int buflen );
extern void ZlibCompressOn ( int fd );
extern void ZlibCompressOff ( int fd );
extern int ZlibWrite ( int fd, unsigned char *buffer, int buflen );
extern int ZlibWriteV ( int fd, struct iovec *iov, int iovcnt );
extern int ZlibRead ( int fd, unsigned char *buffer, int buflen );
extern int ZlibInputAvail ( int fd );
#endif /* _ZLIB_H_ */
/* $XFree86$ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
/* $Xorg: mitmiscstr.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ */
#ifndef _MITMISCSTR_H_
#define _MITMISCSTR_H_
#include "MITMisc.h"
#define MITMISCNAME "MIT-SUNDRY-NONSTANDARD"
typedef struct _SetBugMode {
CARD8 reqType; /* always MITReqCode */
CARD8 mitReqType; /* always X_MITSetBugMode */
CARD16 length B16;
BOOL onOff;
BYTE pad0;
CARD16 pad1;
} xMITSetBugModeReq;
#define sz_xMITSetBugModeReq 8
typedef struct _GetBugMode {
CARD8 reqType; /* always MITReqCode */
CARD8 mitReqType; /* always X_MITGetBugMode */
CARD16 length B16;
} xMITGetBugModeReq;
#define sz_xMITGetBugModeReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL onOff;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xMITGetBugModeReply;
#define sz_xMITGetBugModeReply 32
#endif /* _MITMISCSTR_H_ */
/*
* $Xorg: multibuf.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/include/extensions/multibuf.h,v 3.4 2001/12/14 19:53:28 dawes Exp $ */
#ifndef _MULTIBUF_H_
#define _MULTIBUF_H_
#include <nx-X11/Xfuncproto.h>
#define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering"
#define MULTIBUFFER_MAJOR_VERSION 1 /* current version numbers */
#define MULTIBUFFER_MINOR_VERSION 1 /* has ClearImageBufferArea */
#define X_MbufGetBufferVersion 0
#define X_MbufCreateImageBuffers 1
#define X_MbufDestroyImageBuffers 2
#define X_MbufDisplayImageBuffers 3
#define X_MbufSetMBufferAttributes 4
#define X_MbufGetMBufferAttributes 5
#define X_MbufSetBufferAttributes 6
#define X_MbufGetBufferAttributes 7
#define X_MbufGetBufferInfo 8
#define X_MbufCreateStereoWindow 9
#define X_MbufClearImageBufferArea 10
/*
* update_action field
*/
#define MultibufferUpdateActionUndefined 0
#define MultibufferUpdateActionBackground 1
#define MultibufferUpdateActionUntouched 2
#define MultibufferUpdateActionCopied 3
/*
* update_hint field
*/
#define MultibufferUpdateHintFrequent 0
#define MultibufferUpdateHintIntermittent 1
#define MultibufferUpdateHintStatic 2
/*
* valuemask fields
*/
#define MultibufferWindowUpdateHint (1L << 0)
#define MultibufferBufferEventMask (1L << 0)
/*
* mono vs. stereo and left vs. right
*/
#define MultibufferModeMono 0
#define MultibufferModeStereo 1
#define MultibufferSideMono 0
#define MultibufferSideLeft 1
#define MultibufferSideRight 2
/*
* clobber state
*/
#define MultibufferUnclobbered 0
#define MultibufferPartiallyClobbered 1
#define MultibufferFullyClobbered 2
/*
* event stuff
*/
#define MultibufferClobberNotifyMask 0x02000000
#define MultibufferUpdateNotifyMask 0x04000000
#define MultibufferClobberNotify 0
#define MultibufferUpdateNotify 1
#define MultibufferNumberEvents (MultibufferUpdateNotify + 1)
#define MultibufferBadBuffer 0
#define MultibufferNumberErrors (MultibufferBadBuffer + 1)
#ifndef _MULTIBUF_SERVER_
/*
* Extra definitions that will only be needed in the client
*/
typedef XID Multibuffer;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
int send_event; /* true if this came frome a SendEvent request */
Display *display; /* Display the event was read from */
Multibuffer buffer; /* buffer of event */
int state; /* see Clobbered constants above */
} XmbufClobberNotifyEvent;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
int send_event; /* true if this came frome a SendEvent request */
Display *display; /* Display the event was read from */
Multibuffer buffer; /* buffer of event */
} XmbufUpdateNotifyEvent;
/*
* per-window attributes that can be got
*/
typedef struct {
int displayed_index; /* which buffer is being displayed */
int update_action; /* Undefined, Background, Untouched, Copied */
int update_hint; /* Frequent, Intermittent, Static */
int window_mode; /* Mono, Stereo */
int nbuffers; /* Number of buffers */
Multibuffer *buffers; /* Buffers */
} XmbufWindowAttributes;
/*
* per-window attributes that can be set
*/
typedef struct {
int update_hint; /* Frequent, Intermittent, Static */
} XmbufSetWindowAttributes;
/*
* per-buffer attributes that can be got
*/
typedef struct {
Window window; /* which window this belongs to */
unsigned long event_mask; /* events that have been selected */
int buffer_index; /* which buffer is this */
int side; /* Mono, Left, Right */
} XmbufBufferAttributes;
/*
* per-buffer attributes that can be set
*/
typedef struct {
unsigned long event_mask; /* events that have been selected */
} XmbufSetBufferAttributes;
/*
* per-screen buffer info (there will be lists of them)
*/
typedef struct {
VisualID visualid; /* visual usuable at this depth */
int max_buffers; /* most buffers for this visual */
int depth; /* depth of buffers to be created */
} XmbufBufferInfo;
_XFUNCPROTOBEGIN
extern Bool XmbufQueryExtension(
Display* /* dpy */,
int* /* event_base_return */,
int* /* error_base_return */
);
extern Status XmbufGetVersion(
Display* /* dpy */,
int* /* major_version_return */,
int* /* minor_version_return */
);
extern int XmbufCreateBuffers(
Display* /* dpy */,
Window /* w */,
int /* count */,
int /* update_action */,
int /* update_hint */,
Multibuffer* /* buffers */
);
extern void XmbufDestroyBuffers(
Display* /* dpy */,
Window /* window */
);
extern void XmbufDisplayBuffers(
Display* /* dpy */,
int /* count */,
Multibuffer* /* buffers */,
int /* min_delay */,
int /* max_delay */
);
extern Status XmbufGetWindowAttributes(
Display* /* dpy */,
Window /* w */,
XmbufWindowAttributes* /* attr */
);
extern void XmbufChangeWindowAttributes(
Display* /* dpy */,
Window /* w */,
unsigned long /* valuemask */,
XmbufSetWindowAttributes* /* attr */
);
extern Status XmbufGetBufferAttributes(
Display* /* dpy */,
Multibuffer /* b */,
XmbufBufferAttributes* /* attr */
);
extern void XmbufChangeBufferAttributes(
Display* /* dpy */,
Multibuffer /* b */,
unsigned long /* valuemask */,
XmbufSetBufferAttributes* /* attr */
);
extern Status XmbufGetScreenInfo(
Display* /* dpy */,
Drawable /* d */,
int* /* nmono_return */,
XmbufBufferInfo** /* mono_info_return */,
int* /* nstereo_return */,
XmbufBufferInfo** /* stereo_info_return */
);
extern Window XmbufCreateStereoWindow(
Display* /* dpy */,
Window /* parent */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
unsigned int /* border_width */,
int /* depth */,
unsigned int /* class */,
Visual* /* visual */,
unsigned long /* valuemask */,
XSetWindowAttributes* /* attr */,
Multibuffer* /* leftp */,
Multibuffer* /* rightp */
);
extern void XmbufClearBufferArea(
Display* /* dpy */,
Multibuffer /* buffer */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */,
Bool /* exposures */
);
_XFUNCPROTOEND
#else
#include "scrnintstr.h"
typedef Bool (* mbInitFunc)();
struct _mbufScreen; /* declared in multibufst.h */
extern void RegisterMultibufferInit(
ScreenPtr /* pScreen */,
Bool (* /* bufMultibufferInit */)(
ScreenPtr /* pScreen */,
struct _mbufScreen * /* pMBScreen */
)
);
struct xMbufBufferInfo; /* declared in multibufst.h */
extern void RegisterDoubleBufferHardware(
ScreenPtr /* pScreen */,
int /* nInfo */,
struct xMbufBufferInfo * /* pInfo */,
DevUnion * /* frameBuffer */,
DevUnion /* selectPlane */,
void (* /* CopyBufferBitsFunc */ )(),
void (* /* DrawSelectPlaneFunc */ )()
);
extern int CreateImageBuffers (
WindowPtr /* pWin */,
int /* nbuf */,
XID * /* ids */,
int /* action */,
int /* hint */
);
extern void DestroyImageBuffers (
WindowPtr /* pWin */
);
extern int DisplayImageBuffers (
XID * /* ids */,
int /* nbuf */
);
#endif /* _MULTIBUF_SERVER_ */
#endif /* _MULTIBUF_H_ */
/*
* $Xorg: multibufst.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/include/extensions/multibufst.h,v 3.8 2001/12/19 21:37:29 dawes Exp $ */
#ifndef _MULTIBUFST_H_
#define _MULTIBUFST_H_
/*
* Protocol requests constants and alignment values
*/
#include "multibuf.h"
#ifdef _MULTIBUF_SERVER_
#include "inputstr.h"
#endif
#if !defined(UNIXCPP) || defined(ANSICPP)
#define MbufGetReq(name,req,info) GetReq (name, req); \
req->reqType = info->codes->major_opcode; \
req->mbufReqType = X_##name;
#else
#define MbufGetReq(name,req,info) GetReq (name, req); \
req->reqType = info->codes->major_opcode; \
req->mbufReqType = X_/**/name;
#endif
#define Window CARD32
#define Drawable CARD32
#define VisualID CARD32
#define Multibuffer CARD32
typedef struct xMbufBufferInfo {
CARD32 visualID B32; /* associated visual */
CARD16 maxBuffers B16; /* maximum supported buffers */
CARD8 depth; /* depth of visual (redundant) */
CARD8 unused;
} xMbufBufferInfo;
#define sz_xMbufBufferInfo 8
typedef struct {
BYTE type;
BYTE unused;
CARD16 sequenceNumber B16;
CARD32 buffer B32; /* affected buffer */
BYTE state; /* current status */
CARD8 unused1;
CARD16 unused2 B16;
CARD32 unused3 B32;
CARD32 unused4 B32;
CARD32 unused5 B32;
CARD32 unused6 B32;
CARD32 unused7 B32;
} xMbufClobberNotifyEvent;
typedef struct {
BYTE type;
BYTE unused;
CARD16 sequenceNumber B16;
CARD32 buffer B32; /* affected buffer */
CARD32 timeStamp B32; /* update time */
CARD32 unused1 B32;
CARD32 unused2 B32;
CARD32 unused3 B32;
CARD32 unused4 B32;
CARD32 unused5 B32;
CARD32 unused6 B32;
} xMbufUpdateNotifyEvent;
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufGetBufferVersion */
CARD16 length B16;
} xMbufGetBufferVersionReq;
#define sz_xMbufGetBufferVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD8 majorVersion; /* major version of Multi-Buffering protocol */
CARD8 minorVersion; /* minor version of Multi-Buffering protocol */
CARD16 pad1 B16;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xMbufGetBufferVersionReply;
#define sz_xMbufGetBufferVersionReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufCreateImageBuffers */
CARD16 length B16;
CARD32 window B32; /* associated window */
CARD8 updateAction; /* action at update */
CARD8 updateHint; /* hint as to frequency of updates */
CARD16 unused;
} xMbufCreateImageBuffersReq; /* followed by buffer ids */
#define sz_xMbufCreateImageBuffersReq 12
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 numberBuffer B16; /* number successfully allocated */
CARD16 unused1 B16;
CARD32 unused2 B32;
CARD32 unused3 B32;
CARD32 unused4 B32;
CARD32 unused5 B32;
CARD32 unused6 B32;
} xMbufCreateImageBuffersReply;
#define sz_xMbufCreateImageBuffersReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufDestroyImageBuffers */
CARD16 length B16;
CARD32 window B32; /* associated window */
} xMbufDestroyImageBuffersReq;
#define sz_xMbufDestroyImageBuffersReq 8
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufDisplayImageBuffers */
CARD16 length B16;
CARD16 minDelay B16; /* minimum time between last update and now */
CARD16 maxDelay B16; /* maximum time between last update and now */
} xMbufDisplayImageBuffersReq; /* followed by list of buffers */
#define sz_xMbufDisplayImageBuffersReq 8
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufSetMBufferAttributes */
CARD16 length B16;
CARD32 window B32; /* associated window */
CARD32 valueMask B32; /* modified entries */
} xMbufSetMBufferAttributesReq; /* followed by values */
#define sz_xMbufSetMBufferAttributesReq 12
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufGetMBufferAttributes */
CARD16 length B16;
CARD32 window B32; /* associated window */
} xMbufGetMBufferAttributesReq;
#define sz_xMbufGetMBufferAttributesReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 displayedBuffer B16; /* currently visible buffer */
CARD8 updateAction;
CARD8 updateHint;
CARD8 windowMode;
CARD8 unused0;
CARD16 unused1 B16;
CARD32 unused2 B32;
CARD32 unused3 B32;
CARD32 unused4 B32;
CARD32 unused5 B32;
} xMbufGetMBufferAttributesReply;
#define sz_xMbufGetMBufferAttributesReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufSetBufferAttributes */
CARD16 length B16;
CARD32 buffer B32;
CARD32 valueMask B32;
} xMbufSetBufferAttributesReq; /* followed by values */
#define sz_xMbufSetBufferAttributesReq 12
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufGetBufferAttributes */
CARD16 length B16;
CARD32 buffer B32;
} xMbufGetBufferAttributesReq;
#define sz_xMbufGetBufferAttributesReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 window B32;
CARD32 eventMask B32;
CARD16 bufferIndex B16;
CARD8 side;
CARD8 unused0;
CARD32 unused1 B32;
CARD32 unused2 B32;
CARD32 unused3 B32;
} xMbufGetBufferAttributesReply;
#define sz_xMbufGetBufferAttributesReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufGetBufferInfo */
CARD16 length B16;
Drawable drawable B32;
} xMbufGetBufferInfoReq;
#define sz_xMbufGetBufferInfoReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 unused; /* not used */
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 normalInfo B16;
CARD16 stereoInfo B16;
CARD32 unused1 B32;
CARD32 unused2 B32;
CARD32 unused3 B32;
CARD32 unused4 B32;
CARD32 unused5 B32;
} xMbufGetBufferInfoReply; /* followed by buffer infos */
#define sz_xMbufGetBufferInfoReply 32
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufCreateStereoWindow */
CARD16 length B16;
CARD8 unused0;
CARD8 unused1;
CARD8 unused2;
CARD8 depth;
Window wid B32;
Window parent B32;
Multibuffer left B32; /* associated buffers */
Multibuffer right B32;
INT16 x B16;
INT16 y B16;
CARD16 width B16;
CARD16 height B16;
CARD16 borderWidth B16;
#if defined(__cplusplus) || defined(c_plusplus)
CARD16 c_class B16;
#else
CARD16 class B16;
#endif
VisualID visual B32;
CARD32 mask B32;
} xMbufCreateStereoWindowReq; /* followed by value list */
#define sz_xMbufCreateStereoWindowReq 44
typedef struct {
CARD8 reqType; /* always codes->major_opcode */
CARD8 mbufReqType; /* always X_MbufClearImageBufferArea */
CARD16 length B16;
Multibuffer buffer B32;
INT16 x B16;
INT16 y B16;
CARD16 width B16;
CARD16 height B16;
CARD8 unused0;
CARD8 unused1;
CARD8 unused2;
BOOL exposures;
} xMbufClearImageBufferAreaReq;
#define sz_xMbufClearImageBufferAreaReq 20
#undef Window
#undef Drawable
#undef VisualID
#undef Multibuffer
#ifdef _MULTIBUF_SERVER_
/* Macros for wrapping and unwrapping functions */
#define SWAP_FUNC_VECTOR(pSTRUCT1,pSTRUCT2,DATA_TYPE,FUNC_NAME) \
{ \
DATA_TYPE (* tmpFn)(); \
\
tmpFn = pSTRUCT1->FUNC_NAME; \
pSTRUCT1->FUNC_NAME = pSTRUCT2->FUNC_NAME; \
pSTRUCT2->FUNC_NAME = tmpFn; \
}
#if !defined(UNIXCPP) || defined(ANSICPP)
#define WRAP_SCREEN_FUNC(pSCREEN,pPRIV,FUNC_NAME, PRIV_FUNC_NAME) \
{ \
if ((pPRIV->funcsWrapped & FUNC_NAME##Mask) == 0) \
{ \
pPRIV->FUNC_NAME = pSCREEN->FUNC_NAME; \
pSCREEN->FUNC_NAME = PRIV_FUNC_NAME; \
pPRIV->funcsWrapped |= FUNC_NAME##Mask; \
} \
}
#define UNWRAP_SCREEN_FUNC(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME) \
{ \
SWAP_FUNC_VECTOR(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME); \
pPRIV->funcsWrapped &= ~(FUNC_NAME##Mask); \
}
#define REWRAP_SCREEN_FUNC(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME) \
{ \
if (MB_SCREEN_PRIV(pSCREEN)->mbufWindowCount) \
{ \
SWAP_FUNC_VECTOR(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME); \
pPRIV->funcsWrapped |= FUNC_NAME##Mask; \
} \
}
#else
#define WRAP_SCREEN_FUNC(pSCREEN,pPRIV,FUNC_NAME, PRIV_FUNC_NAME) \
{ \
if ((pPRIV->funcsWrapped & FUNC_NAME/**/Mask) == 0) \
{ \
pPRIV->FUNC_NAME = pSCREEN->FUNC_NAME; \
pSCREEN->FUNC_NAME = PRIV_FUNC_NAME; \
pPRIV->funcsWrapped |= FUNC_NAME/**/Mask; \
} \
}
#define UNWRAP_SCREEN_FUNC(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME) \
{ \
SWAP_FUNC_VECTOR(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME); \
pPRIV->funcsWrapped &= ~(FUNC_NAME/**/Mask); \
}
#define REWRAP_SCREEN_FUNC(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME) \
{ \
if (MB_SCREEN_PRIV(pSCREEN)->mbufWindowCount) \
{ \
SWAP_FUNC_VECTOR(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME); \
pPRIV->funcsWrapped |= FUNC_NAME/**/Mask; \
} \
}
#endif
/* The _Multibuffer and _Multibuffers structures below refer to each other,
* so we need this forward declaration
*/
typedef struct _Multibuffers *MultibuffersPtr;
/*
* per-Multibuffer data
*/
typedef struct _Multibuffer {
MultibuffersPtr pMultibuffers; /* associated window data */
Mask eventMask; /* MultibufferClobberNotifyMask|ExposureMask|MultibufferUpdateNotifyMask */
Mask otherEventMask; /* mask of all other clients event masks */
OtherClients *otherClients; /* other clients that want events */
int number; /* index of this buffer into array */
int side; /* always Mono */
int clobber; /* Unclobbered, PartiallyClobbered, FullClobbered */
PixmapPtr pPixmap; /* associated pixmap */
} MultibufferRec, *MultibufferPtr;
/*
* per-window data
*/
typedef struct _Multibuffers {
WindowPtr pWindow; /* associated window */
int numMultibuffer; /* count of buffers */
int refcnt; /* ref count for delete */
int displayedMultibuffer; /* currently active buffer */
int updateAction; /* Undefined, Background, Untouched, Copied */
int updateHint; /* Frequent, Intermittent, Static */
int windowMode; /* always Mono */
TimeStamp lastUpdate; /* time of last update */
unsigned short width, height; /* last known window size */
short x, y; /* for static gravity */
MultibufferPtr buffers; /* array of numMultibuffer buffers */
} MultibuffersRec;
/*
* per-screen data
*/
typedef struct _MultibufferScreen {
PositionWindowProcPtr PositionWindow; /* pWin, x,y */
} MultibufferScreenRec, *MultibufferScreenPtr;
/*
* per display-image-buffers request data.
*/
typedef struct _DisplayRequest {
struct _DisplayRequest *next;
TimeStamp activateTime;
ClientPtr pClient;
XID id;
} DisplayRequestRec, *DisplayRequestPtr;
#define DestroyWindowMask (1L<<0)
#define PositionWindowMask (1L<<1)
#define PostValidateTreeMask (1L<<2)
#define ClipNotifyMask (1L<<3)
#define WindowExposuresMask (1L<<4)
#define CopyWindowMask (1L<<5)
#define ClearToBackgroundMask (1L<<6)
#define ChangeWindowAttributesMask (1L<<7)
extern int MultibufferScreenIndex;
extern int MultibufferWindowIndex;
extern RESTYPE MultibufferDrawableResType;
extern void MultibufferUpdate( /* pMbuffer, time */
MultibufferPtr /* pMultibuffer */,
CARD32 /* time */
);
extern void MultibufferExpose( /* pMbuffer, pRegion */
MultibufferPtr /* pMultibuffer */,
RegionPtr /* pRegion */
);
extern void MultibufferClobber( /* pMbuffer */
MultibufferPtr /* pMultibuffer */
);
typedef struct _mbufWindow *mbufWindowPtr;
/*
* per-buffer data
*/
#define MB_DISPLAYED_BUFFER(pMBWindow) \
((pMBWindow)->buffers + (pMBWindow)->displayedMultibuffer)
typedef struct _mbufBuffer {
mbufWindowPtr pMBWindow; /* associated window data */
Mask eventMask; /* client event mask */
Mask otherEventMask; /* union of other clients' event masks */
OtherClientsPtr otherClients; /* other clients that want events */
int number; /* index of this buffer into array */
int side; /* stero side: always Mono */
int clobber; /* clober state */
DrawablePtr pDrawable; /* associated drawable */
} mbufBufferRec, *mbufBufferPtr;
/*
* per-window data
*/
#define MB_WINDOW_PRIV(pWin) \
((mbufWindowPtr)((pWin)->devPrivates[MultibufferWindowIndex].ptr))
typedef struct _mbufWindow {
WindowPtr pWindow; /* associated window */
int numMultibuffer; /* count of buffers */
mbufBufferPtr buffers; /* array of (numMultibuffer) buffers */
int displayedMultibuffer; /* currently active buffer */
int updateAction; /* Undefined, Background,
Untouched, Copied */
int updateHint; /* Frequent, Intermittent, Static */
int windowMode; /* always Mono */
TimeStamp lastUpdate; /* time of last update */
short x, y; /* for static gravity */
unsigned short width, height; /* last known window size */
DevUnion devPrivate;
} mbufWindowRec;
/*
* per-screen data
*/
#define MB_SCREEN_PRIV(pScreen) \
((mbufScreenPtr)((pScreen)->devPrivates[MultibufferScreenIndex].ptr))
typedef struct _mbufScreen {
long mbufWindowCount; /* count of multibuffered windows */
/* Wrap pScreen->DestroyWindow */
DestroyWindowProcPtr DestroyWindow;
long funcsWrapped; /* flags which functions are wrapped */
/* Initialized by device-dependent section */
int nInfo; /* number of buffer info rec's */
xMbufBufferInfo *pInfo; /* buffer info (for Normal buffers) */
int (* CreateImageBuffers)(
WindowPtr /* pWin */,
int /* nbuf */,
XID * /* ids */,
int /* action */,
int /* hint */
);
void (* DestroyImageBuffers)(
WindowPtr /* pWin */
);
void (* DisplayImageBuffers)(
ScreenPtr /* pScreen */,
mbufBufferPtr * /* ppMBBuffer */,
mbufWindowPtr * /* ppMBWindow */,
int /* nbuf */
);
void (* ClearImageBufferArea)(
mbufBufferPtr /* pMBBuffer */,
short /* x */,
short /* y */,
unsigned short /* width */,
unsigned short /* height */,
Bool /* exposures */
);
Bool (* ChangeMBufferAttributes)( /* pMBWindow, vmask */
/* FIXME */
);
Bool (* ChangeBufferAttributes)( /* pMBBuffer, vmask */
/* FIXME */
);
void (* DeleteBufferDrawable)(
DrawablePtr /* pDrawable */
);
void (* WrapScreenFuncs)(
ScreenPtr /* pScreen */
);
void (* ResetProc)(
ScreenPtr /* pScreen */
);
DevUnion devPrivate;
} mbufScreenRec, *mbufScreenPtr;
/* Privates to mbufScreenRec */
#ifdef _MULTIBUF_PIXMAP_
#define MB_SCREEN_PRIV_PIXMAP(pScreen) \
((mbufPixmapPrivPtr) MB_SCREEN_PRIV((pScreen))->devPrivate.ptr)
typedef struct _mbufPixmapPriv
{
/* Pointers to wrapped functions */
PositionWindowProcPtr PositionWindow; /* pWin, x,y */
long funcsWrapped; /* flags which functions are wrapped */
} mbufPixmapPrivRec, *mbufPixmapPrivPtr;
#endif /* _MULTIBUF_PIXMAP_ */
#ifdef _MULTIBUF_BUFFER_
extern int frameWindowPrivateIndex;
#define MB_SCREEN_PRIV_BUFFER(pScreen) \
((mbufBufferPrivPtr) MB_SCREEN_PRIV((pScreen))->devPrivate.ptr)
typedef struct _mbufBufferPriv
{
DevUnion *frameBuffer; /* Array of screen framebuffers */
DevUnion selectPlane; /* Plane(s) that select displayed buffer */
/*
* Note: subtractRgn and unionRgn may overlap. subtractRgn is a union
* of all the old clipLists of the windows that are displaying
* the backbuffer. unionRgn is the union of all the new clipLists
* of the same windows.
*/
RegionRec backBuffer; /* Area of screen displaying back buffer */
RegionRec subtractRgn; /* Regions lost to backBuffer */
RegionRec unionRgn; /* Regions gained by backBuffer */
Bool rgnChanged; /* TRUE if "backBuffer" needs to be updated */
void (* CopyBufferBits)(); /* pMBWindow, srcBufferNum, dstBufferNum */
void (* DrawSelectPlane)(); /* pScreen, selectPlane, pRegion, bufferNum */
/* Pointers to wrapped functions */
PostValidateTreeProcPtr PostValidateTree; /* pParent, pChild, kind */
ClipNotifyProcPtr ClipNotify; /* pWin, dx, dy */
WindowExposuresProcPtr WindowExposures; /* pWin, pRegion */
CopyWindowProcPtr CopyWindow; /* pWin, oldPt, pOldRegion */
ClearToBackgroundProcPtr ClearToBackground; /* pWin, x,y,w,h, sendExpose */
ChangeWindowAttributesProcPtr ChangeWindowAttributes; /* pWin, vmask */
long funcsWrapped; /* flags which functions are wrapped */
unsigned inClearToBackground:1; /* used by WindowExposure */
} mbufBufferPrivRec, *mbufBufferPrivPtr;
#endif /* _MULTIBUF_BUFFER_ */
#endif /* _MULTIBUF_SERVER_ */
#endif /* _MULTIBUFST_H_ */
/*
Copyright (c) 1999 XFree86 Inc
*/
/* $XFree86: xc/include/extensions/xf86dga.h,v 3.20 1999/10/13 04:20:48 dawes Exp $ */
#ifndef _XF86DGA_H_
#define _XF86DGA_H_
#include <nx-X11/Xfuncproto.h>
#include <nx-X11/extensions/xf86dga1.h>
#define X_XDGAQueryVersion 0
/* 1 through 9 are in xf86dga1.h */
/* 10 and 11 are reserved to avoid conflicts with rogue DGA extensions */
#define X_XDGAQueryModes 12
#define X_XDGASetMode 13
#define X_XDGASetViewport 14
#define X_XDGAInstallColormap 15
#define X_XDGASelectInput 16
#define X_XDGAFillRectangle 17
#define X_XDGACopyArea 18
#define X_XDGACopyTransparentArea 19
#define X_XDGAGetViewportStatus 20
#define X_XDGASync 21
#define X_XDGAOpenFramebuffer 22
#define X_XDGACloseFramebuffer 23
#define X_XDGASetClientVersion 24
#define X_XDGAChangePixmapMode 25
#define X_XDGACreateColormap 26
#define XDGAConcurrentAccess 0x00000001
#define XDGASolidFillRect 0x00000002
#define XDGABlitRect 0x00000004
#define XDGABlitTransRect 0x00000008
#define XDGAPixmap 0x00000010
#define XDGAInterlaced 0x00010000
#define XDGADoublescan 0x00020000
#define XDGAFlipImmediate 0x00000001
#define XDGAFlipRetrace 0x00000002
#define XDGANeedRoot 0x00000001
#define XF86DGANumberEvents 7
#define XDGAPixmapModeLarge 0
#define XDGAPixmapModeSmall 1
#define XF86DGAClientNotLocal 0
#define XF86DGANoDirectVideoMode 1
#define XF86DGAScreenNotActive 2
#define XF86DGADirectNotActivated 3
#define XF86DGAOperationNotSupported 4
#define XF86DGANumberErrors (XF86DGAOperationNotSupported + 1)
typedef struct {
int num; /* A unique identifier for the mode (num > 0) */
char *name; /* name of mode given in the XF86Config */
float verticalRefresh;
int flags; /* DGA_CONCURRENT_ACCESS, etc... */
int imageWidth; /* linear accessible portion (pixels) */
int imageHeight;
int pixmapWidth; /* Xlib accessible portion (pixels) */
int pixmapHeight; /* both fields ignored if no concurrent access */
int bytesPerScanline;
int byteOrder; /* MSBFirst, LSBFirst */
int depth;
int bitsPerPixel;
unsigned long redMask;
unsigned long greenMask;
unsigned long blueMask;
short visualClass;
int viewportWidth;
int viewportHeight;
int xViewportStep; /* viewport position granularity */
int yViewportStep;
int maxViewportX; /* max viewport origin */
int maxViewportY;
int viewportFlags; /* types of page flipping possible */
int reserved1;
int reserved2;
} XDGAMode;
typedef struct {
XDGAMode mode;
unsigned char *data;
Pixmap pixmap;
} XDGADevice;
#ifndef _XF86DGA_SERVER_
_XFUNCPROTOBEGIN
typedef struct {
int type;
unsigned long serial;
Display *display;
int screen;
Time time;
unsigned int state;
unsigned int button;
} XDGAButtonEvent;
typedef struct {
int type;
unsigned long serial;
Display *display;
int screen;
Time time;
unsigned int state;
unsigned int keycode;
} XDGAKeyEvent;
typedef struct {
int type;
unsigned long serial;
Display *display;
int screen;
Time time;
unsigned int state;
int dx;
int dy;
} XDGAMotionEvent;
typedef union {
int type;
XDGAButtonEvent xbutton;
XDGAKeyEvent xkey;
XDGAMotionEvent xmotion;
long pad[24];
} XDGAEvent;
Bool XDGAQueryExtension(
Display *dpy,
int *eventBase,
int *erroBase
);
Bool XDGAQueryVersion(
Display *dpy,
int *majorVersion,
int *minorVersion
);
XDGAMode* XDGAQueryModes(
Display *dpy,
int screen,
int *num
);
XDGADevice* XDGASetMode(
Display *dpy,
int screen,
int mode
);
Bool XDGAOpenFramebuffer(
Display *dpy,
int screen
);
void XDGACloseFramebuffer(
Display *dpy,
int screen
);
void XDGASetViewport(
Display *dpy,
int screen,
int x,
int y,
int flags
);
void XDGAInstallColormap(
Display *dpy,
int screen,
Colormap cmap
);
Colormap XDGACreateColormap(
Display *dpy,
int screen,
XDGADevice *device,
int alloc
);
void XDGASelectInput(
Display *dpy,
int screen,
long event_mask
);
void XDGAFillRectangle(
Display *dpy,
int screen,
int x,
int y,
unsigned int width,
unsigned int height,
unsigned long color
);
void XDGACopyArea(
Display *dpy,
int screen,
int srcx,
int srcy,
unsigned int width,
unsigned int height,
int dstx,
int dsty
);
void XDGACopyTransparentArea(
Display *dpy,
int screen,
int srcx,
int srcy,
unsigned int width,
unsigned int height,
int dstx,
int dsty,
unsigned long key
);
int XDGAGetViewportStatus(
Display *dpy,
int screen
);
void XDGASync(
Display *dpy,
int screen
);
Bool XDGASetClientVersion(
Display *dpy
);
void XDGAChangePixmapMode(
Display *dpy,
int screen,
int *x,
int *y,
int mode
);
void XDGAKeyEventToXKeyEvent(XDGAKeyEvent* dk, XKeyEvent* xk);
_XFUNCPROTOEND
#endif /* _XF86DGA_SERVER_ */
#endif /* _XF86DGA_H_ */
/* $XFree86: xc/include/extensions/xf86dga1.h,v 1.2 1999/04/17 07:05:41 dawes Exp $ */
/*
Copyright (c) 1995 Jon Tombs
Copyright (c) 1995 XFree86 Inc
*/
/************************************************************************
THIS IS THE OLD DGA API AND IS OBSOLETE. PLEASE DO NOT USE IT ANYMORE
************************************************************************/
#ifndef _XF86DGA1_H_
#define _XF86DGA1_H_
#include <nx-X11/Xfuncproto.h>
#define X_XF86DGAQueryVersion 0
#define X_XF86DGAGetVideoLL 1
#define X_XF86DGADirectVideo 2
#define X_XF86DGAGetViewPortSize 3
#define X_XF86DGASetViewPort 4
#define X_XF86DGAGetVidPage 5
#define X_XF86DGASetVidPage 6
#define X_XF86DGAInstallColormap 7
#define X_XF86DGAQueryDirectVideo 8
#define X_XF86DGAViewPortChanged 9
#define XF86DGADirectPresent 0x0001
#define XF86DGADirectGraphics 0x0002
#define XF86DGADirectMouse 0x0004
#define XF86DGADirectKeyb 0x0008
#define XF86DGAHasColormap 0x0100
#define XF86DGADirectColormap 0x0200
#ifndef _XF86DGA_SERVER_
_XFUNCPROTOBEGIN
Bool XF86DGAQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
Bool XF86DGAQueryExtension(
Display* /* dpy */,
int* /* event_base */,
int* /* error_base */
);
Status XF86DGAGetVideoLL(
Display* /* dpy */,
int /* screen */,
int * /* base addr */,
int * /* width */,
int * /* bank_size */,
int * /* ram_size */
);
Status XF86DGAGetVideo(
Display* /* dpy */,
int /* screen */,
char ** /* base addr */,
int * /* width */,
int * /* bank_size */,
int * /* ram_size */
);
Status XF86DGADirectVideo(
Display* /* dpy */,
int /* screen */,
int /* enable */
);
Status XF86DGADirectVideoLL(
Display* /* dpy */,
int /* screen */,
int /* enable */
);
Status XF86DGAGetViewPortSize(
Display* /* dpy */,
int /* screen */,
int * /* width */,
int * /* height */
);
Status XF86DGASetViewPort(
Display* /* dpy */,
int /* screen */,
int x /* X */,
int y /* Y */
);
Status XF86DGAGetVidPage(
Display* /* dpy */,
int /* screen */,
int * /* vid page */
);
Status XF86DGASetVidPage(
Display* /* dpy */,
int /* screen */,
int /* vid page */
);
Status XF86DGAInstallColormap(
Display* /* dpy */,
int /* screen */,
Colormap /*Colormap */
);
int XF86DGAForkApp(
int screen
);
Status XF86DGAQueryDirectVideo(
Display * /* dpy */,
int /* screen */,
int * /* flags */
);
Bool XF86DGAViewPortChanged(
Display * /* dpy */,
int /* screen */,
int /* n */
);
_XFUNCPROTOEND
#endif /* _XF86DGA_SERVER_ */
#endif /* _XF86DGA1_H_ */
/* $XFree86: xc/include/extensions/xf86dga1str.h,v 1.1 1999/03/28 15:31:33 dawes Exp $ */
/*
Copyright (c) 1995 Jon Tombs
Copyright (c) 1995 XFree86 Inc.
*/
#ifndef _XF86DGASTR1_H_
#define _XF86DGASTR1_H_
typedef struct _XF86DGAQueryVersion {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_DGAQueryVersion */
CARD16 length B16;
} xXF86DGAQueryVersionReq;
#define sz_xXF86DGAQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of DGA protocol */
CARD16 minorVersion B16; /* minor version of DGA protocol */
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86DGAQueryVersionReply;
#define sz_xXF86DGAQueryVersionReply 32
typedef struct _XF86DGAGetVideoLL {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGAGetVideoLL */
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
} xXF86DGAGetVideoLLReq;
#define sz_xXF86DGAGetVideoLLReq 8
typedef struct _XF86DGAInstallColormap{
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD16 screen B16;
CARD16 pad2;
CARD32 id B32; /* colormap. */
} xXF86DGAInstallColormapReq;
#define sz_xXF86DGAInstallColormapReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 offset B32;
CARD32 width B32;
CARD32 bank_size B32;
CARD32 ram_size B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86DGAGetVideoLLReply;
#define sz_xXF86DGAGetVideoLLReply 32
typedef struct _XF86DGADirectVideo {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGADirectVideo */
CARD16 length B16;
CARD16 screen B16;
CARD16 enable B16;
} xXF86DGADirectVideoReq;
#define sz_xXF86DGADirectVideoReq 8
typedef struct _XF86DGAGetViewPortSize {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGAGetViewPort */
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
} xXF86DGAGetViewPortSizeReq;
#define sz_xXF86DGAGetViewPortSizeReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 width B32;
CARD32 height B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86DGAGetViewPortSizeReply;
#define sz_xXF86DGAGetViewPortSizeReply 32
typedef struct _XF86DGASetViewPort {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGASetViewPort */
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
CARD32 x B32;
CARD32 y B32;
} xXF86DGASetViewPortReq;
#define sz_xXF86DGASetViewPortReq 16
typedef struct _XF86DGAGetVidPage {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGAGetVidPage */
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
} xXF86DGAGetVidPageReq;
#define sz_xXF86DGAGetVidPageReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 vpage B32;
CARD32 pad B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86DGAGetVidPageReply;
#define sz_xXF86DGAGetVidPageReply 32
typedef struct _XF86DGASetVidPage {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_XF86DGASetVidPage */
CARD16 length B16;
CARD16 screen B16;
CARD16 vpage B16;
} xXF86DGASetVidPageReq;
#define sz_xXF86DGASetVidPageReq 8
typedef struct _XF86DGAQueryDirectVideo {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_DGAQueryVersion */
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
} xXF86DGAQueryDirectVideoReq;
#define sz_xXF86DGAQueryDirectVideoReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 flags B32;
CARD32 pad B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86DGAQueryDirectVideoReply;
#define sz_xXF86DGAQueryDirectVideoReply 32
typedef struct _XF86DGAViewPortChanged {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_DGAQueryVersion */
CARD16 length B16;
CARD16 screen B16;
CARD16 n B16;
} xXF86DGAViewPortChangedReq;
#define sz_xXF86DGAViewPortChangedReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 result B32;
CARD32 pad B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86DGAViewPortChangedReply;
#define sz_xXF86DGAViewPortChangedReply 32
#endif /* _XF86DGASTR1_H_ */
/* $XFree86: xc/include/extensions/xf86dgastr.h,v 3.13 2000/12/20 00:19:41 mvojkovi Exp $ */
/*
Copyright (c) 1995 Jon Tombs
Copyright (c) 1995 XFree86 Inc.
*/
#ifndef _XF86DGASTR_H_
#define _XF86DGASTR_H_
#include <nx-X11/extensions/xf86dga1str.h>
#define XF86DGANAME "XFree86-DGA"
#define XDGA_MAJOR_VERSION 2 /* current version numbers */
#define XDGA_MINOR_VERSION 0
typedef struct _XDGAQueryVersion {
CARD8 reqType; /* always DGAReqCode */
CARD8 dgaReqType; /* always X_DGAQueryVersion */
CARD16 length B16;
} xXDGAQueryVersionReq;
#define sz_xXDGAQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of DGA protocol */
CARD16 minorVersion B16; /* minor version of DGA protocol */
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXDGAQueryVersionReply;
#define sz_xXDGAQueryVersionReply 32
typedef struct _XDGAQueryModes {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
} xXDGAQueryModesReq;
#define sz_xXDGAQueryModesReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 number B32; /* number of modes available */
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXDGAQueryModesReply;
#define sz_xXDGAQueryModesReply 32
typedef struct _XDGASetMode {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD32 mode B32; /* mode number to init */
CARD32 pid B32; /* Pixmap descriptor */
} xXDGASetModeReq;
#define sz_xXDGASetModeReq 16
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 offset B32; /* offset into framebuffer map */
CARD32 flags B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXDGASetModeReply;
#define sz_xXDGASetModeReply 32
typedef struct {
CARD8 byte_order;
CARD8 depth;
CARD16 num B16;
CARD16 bpp B16;
CARD16 name_size B16;
CARD32 vsync_num B32;
CARD32 vsync_den B32;
CARD32 flags B32;
CARD16 image_width B16;
CARD16 image_height B16;
CARD16 pixmap_width B16;
CARD16 pixmap_height B16;
CARD32 bytes_per_scanline B32;
CARD32 red_mask B32;
CARD32 green_mask B32;
CARD32 blue_mask B32;
CARD16 visual_class B16;
CARD16 pad1 B16;
CARD16 viewport_width B16;
CARD16 viewport_height B16;
CARD16 viewport_xstep B16;
CARD16 viewport_ystep B16;
CARD16 viewport_xmax B16;
CARD16 viewport_ymax B16;
CARD32 viewport_flags B32;
CARD32 reserved1 B32;
CARD32 reserved2 B32;
} xXDGAModeInfo;
#define sz_xXDGAModeInfo 72
typedef struct _XDGAOpenFramebuffer {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
} xXDGAOpenFramebufferReq;
#define sz_xXDGAOpenFramebufferReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32; /* device name size if there is one */
CARD32 mem1 B32; /* physical memory */
CARD32 mem2 B32; /* spillover for _alpha_ */
CARD32 size B32; /* size of map in bytes */
CARD32 offset B32; /* optional offset into device */
CARD32 extra B32; /* extra info associated with the map */
CARD32 pad2 B32;
} xXDGAOpenFramebufferReply;
#define sz_xXDGAOpenFramebufferReply 32
typedef struct _XDGACloseFramebuffer {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
} xXDGACloseFramebufferReq;
#define sz_xXDGACloseFramebufferReq 8
typedef struct _XDGASetViewport {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD16 x B16;
CARD16 y B16;
CARD32 flags B32;
} xXDGASetViewportReq;
#define sz_xXDGASetViewportReq 16
typedef struct _XDGAInstallColormap {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD32 cmap B32;
} xXDGAInstallColormapReq;
#define sz_xXDGAInstallColormapReq 12
typedef struct _XDGASelectInput {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD32 mask B32;
} xXDGASelectInputReq;
#define sz_xXDGASelectInputReq 12
typedef struct _XDGAFillRectangle {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD16 x B16;
CARD16 y B16;
CARD16 width B16;
CARD16 height B16;
CARD32 color B32;
} xXDGAFillRectangleReq;
#define sz_xXDGAFillRectangleReq 20
typedef struct _XDGACopyArea {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD16 srcx B16;
CARD16 srcy B16;
CARD16 width B16;
CARD16 height B16;
CARD16 dstx B16;
CARD16 dsty B16;
} xXDGACopyAreaReq;
#define sz_xXDGACopyAreaReq 20
typedef struct _XDGACopyTransparentArea {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD16 srcx B16;
CARD16 srcy B16;
CARD16 width B16;
CARD16 height B16;
CARD16 dstx B16;
CARD16 dsty B16;
CARD32 key B32;
} xXDGACopyTransparentAreaReq;
#define sz_xXDGACopyTransparentAreaReq 24
typedef struct _XDGAGetViewportStatus {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
} xXDGAGetViewportStatusReq;
#define sz_xXDGAGetViewportStatusReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 status B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXDGAGetViewportStatusReply;
#define sz_xXDGAGetViewportStatusReply 32
typedef struct _XDGASync {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
} xXDGASyncReq;
#define sz_xXDGASyncReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXDGASyncReply;
#define sz_xXDGASyncReply 32
typedef struct _XDGASetClientVersion {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD16 major B16;
CARD16 minor B16;
} xXDGASetClientVersionReq;
#define sz_xXDGASetClientVersionReq 8
typedef struct {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD16 x B16;
CARD16 y B16;
CARD32 flags B32;
} xXDGAChangePixmapModeReq;
#define sz_xXDGAChangePixmapModeReq 16
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 x B16;
CARD16 y B16;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xXDGAChangePixmapModeReply;
#define sz_xXDGAChangePixmapModeReply 32
typedef struct _XDGACreateColormap {
CARD8 reqType;
CARD8 dgaReqType;
CARD16 length B16;
CARD32 screen B32;
CARD32 id B32;
CARD32 mode B32;
CARD8 alloc;
CARD8 pad1;
CARD16 pad2;
} xXDGACreateColormapReq;
#define sz_xXDGACreateColormapReq 20
typedef struct {
union {
struct {
BYTE type;
BYTE detail;
CARD16 sequenceNumber B16;
} u;
struct {
CARD32 pad0 B32;
CARD32 time B32;
INT16 dx B16;
INT16 dy B16;
INT16 screen B16;
CARD16 state B16;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} event;
} u;
} dgaEvent;
#endif /* _XF86DGASTR_H_ */
/* $XFree86: xc/include/extensions/xf86misc.h,v 3.16 2002/11/20 04:04:56 dawes Exp $ */
/*
* Copyright (c) 1995, 1996 The XFree86 Project, Inc
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _XF86MISC_H_
#define _XF86MISC_H_
#include <nx-X11/Xfuncproto.h>
#define X_XF86MiscQueryVersion 0
#ifdef _XF86MISC_SAVER_COMPAT_
#define X_XF86MiscGetSaver 1
#define X_XF86MiscSetSaver 2
#endif
#define X_XF86MiscGetMouseSettings 3
#define X_XF86MiscGetKbdSettings 4
#define X_XF86MiscSetMouseSettings 5
#define X_XF86MiscSetKbdSettings 6
#define X_XF86MiscSetGrabKeysState 7
#define X_XF86MiscSetClientVersion 8
#define X_XF86MiscGetFilePaths 9
#define X_XF86MiscPassMessage 10
#define XF86MiscNumberEvents 0
#define XF86MiscBadMouseProtocol 0
#define XF86MiscBadMouseBaudRate 1
#define XF86MiscBadMouseFlags 2
#define XF86MiscBadMouseCombo 3
#define XF86MiscBadKbdType 4
#define XF86MiscModInDevDisabled 5
#define XF86MiscModInDevClientNotLocal 6
#define XF86MiscNoModule 7
#define XF86MiscNumberErrors (XF86MiscNoModule + 1)
/* Never renumber these */
#define MTYPE_MICROSOFT 0
#define MTYPE_MOUSESYS 1
#define MTYPE_MMSERIES 2
#define MTYPE_LOGITECH 3
#define MTYPE_BUSMOUSE 4
#define MTYPE_LOGIMAN 5
#define MTYPE_PS_2 6
#define MTYPE_MMHIT 7
#define MTYPE_GLIDEPOINT 8
#define MTYPE_IMSERIAL 9
#define MTYPE_THINKING 10
#define MTYPE_IMPS2 11
#define MTYPE_THINKINGPS2 12
#define MTYPE_MMANPLUSPS2 13
#define MTYPE_GLIDEPOINTPS2 14
#define MTYPE_NETPS2 15
#define MTYPE_NETSCROLLPS2 16
#define MTYPE_SYSMOUSE 17
#define MTYPE_AUTOMOUSE 18
#define MTYPE_ACECAD 19
#define MTYPE_EXPPS2 20
#define MTYPE_XQUEUE 127
#define MTYPE_OSMOUSE 126
#define MTYPE_UNKNOWN 125
#define KTYPE_UNKNOWN 0
#define KTYPE_84KEY 1
#define KTYPE_101KEY 2
#define KTYPE_OTHER 3
#define KTYPE_XQUEUE 4
#define MF_CLEAR_DTR 1
#define MF_CLEAR_RTS 2
#define MF_REOPEN 128
#ifndef _XF86MISC_SERVER_
/* return values for XF86MiscSetGrabKeysState */
#define MiscExtGrabStateSuccess 0 /* No errors */
#define MiscExtGrabStateLocked 1 /* A client already requested that
* grabs cannot be removed/killed */
#define MiscExtGrabStateAlready 2 /* Request for enabling/disabling
* grab removeal/kill already done */
_XFUNCPROTOBEGIN
typedef struct {
char* device;
int type;
int baudrate;
int samplerate;
int resolution;
int buttons;
Bool emulate3buttons;
int emulate3timeout;
Bool chordmiddle;
int flags;
} XF86MiscMouseSettings;
typedef struct {
int type;
int rate;
int delay;
Bool servnumlock;
} XF86MiscKbdSettings;
typedef struct {
char* configfile;
char* modulepath;
char* logfile;
} XF86MiscFilePaths;
Bool XF86MiscQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
Bool XF86MiscQueryExtension(
Display* /* dpy */,
int* /* event_base */,
int* /* error_base */
);
Bool XF86MiscSetClientVersion(
Display *dpy /* dpy */
);
Status XF86MiscGetMouseSettings(
Display* /* dpy */,
XF86MiscMouseSettings* /* mouse info */
);
Status XF86MiscGetKbdSettings(
Display* /* dpy */,
XF86MiscKbdSettings* /* keyboard info */
);
Status XF86MiscSetMouseSettings(
Display* /* dpy */,
XF86MiscMouseSettings* /* mouse info */
);
Status XF86MiscSetKbdSettings(
Display* /* dpy */,
XF86MiscKbdSettings* /* keyboard info */
);
int XF86MiscSetGrabKeysState(
Display* /* dpy */,
Bool /* enabled */
);
Status XF86MiscGetFilePaths(
Display* /* dpy */,
XF86MiscFilePaths* /* file paths/locations */
);
Status XF86MiscPassMessage(
Display* /* dpy */,
int /* screen */,
const char* /* message name/type */,
const char* /* message contents/value */,
char ** /* returned message */
);
_XFUNCPROTOEND
#endif
#endif
/* $XFree86: xc/include/extensions/xf86mscstr.h,v 3.12 2002/11/20 04:04:56 dawes Exp $ */
/*
* Copyright (c) 1995, 1996 The XFree86 Project, Inc
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _XF86MISCSTR_H_
#define _XF86MISCSTR_H_
#include <nx-X11/extensions/xf86misc.h>
#define XF86MISCNAME "XFree86-Misc"
#define XF86MISC_MAJOR_VERSION 0 /* current version numbers */
#define XF86MISC_MINOR_VERSION 9
typedef struct _XF86MiscQueryVersion {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscQueryVersion */
CARD16 length B16;
} xXF86MiscQueryVersionReq;
#define sz_xXF86MiscQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of XFree86-Misc */
CARD16 minorVersion B16; /* minor version of XFree86-Misc */
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86MiscQueryVersionReply;
#define sz_xXF86MiscQueryVersionReply 32
#ifdef _XF86MISC_SAVER_COMPAT_
typedef struct _XF86MiscGetSaver {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscGetSaver */
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
} xXF86MiscGetSaverReq;
#define sz_xXF86MiscGetSaverReq 8
typedef struct _XF86MiscSetSaver {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscSetSaver */
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
CARD32 suspendTime B32;
CARD32 offTime B32;
} xXF86MiscSetSaverReq;
#define sz_xXF86MiscSetSaverReq 16
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 suspendTime B32;
CARD32 offTime B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86MiscGetSaverReply;
#define sz_xXF86MiscGetSaverReply 32
#endif
typedef struct _XF86MiscGetMouseSettings {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscGetMouseSettings */
CARD16 length B16;
} xXF86MiscGetMouseSettingsReq;
#define sz_xXF86MiscGetMouseSettingsReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 mousetype B32;
CARD32 baudrate B32;
CARD32 samplerate B32;
CARD32 resolution B32;
CARD32 buttons B32;
BOOL emulate3buttons;
BOOL chordmiddle;
CARD16 pad2 B16;
CARD32 emulate3timeout B32;
CARD32 flags B32;
CARD32 devnamelen B32; /* strlen(device)+1 */
} xXF86MiscGetMouseSettingsReply;
#define sz_xXF86MiscGetMouseSettingsReply 44
typedef struct _XF86MiscGetKbdSettings {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscGetKbdSettings */
CARD16 length B16;
} xXF86MiscGetKbdSettingsReq;
#define sz_xXF86MiscGetKbdSettingsReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 kbdtype B32;
CARD32 rate B32;
CARD32 delay B32;
BOOL servnumlock;
BOOL pad2;
CARD16 pad3 B16;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86MiscGetKbdSettingsReply;
#define sz_xXF86MiscGetKbdSettingsReply 32
typedef struct _XF86MiscSetMouseSettings {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscSetMouseSettings */
CARD16 length B16;
CARD32 mousetype B32;
CARD32 baudrate B32;
CARD32 samplerate B32;
CARD32 resolution B32;
CARD32 buttons B32;
BOOL emulate3buttons;
BOOL chordmiddle;
CARD16 devnamelen B16;
CARD32 emulate3timeout B32;
CARD32 flags B32;
} xXF86MiscSetMouseSettingsReq;
#define sz_xXF86MiscSetMouseSettingsReq 36
typedef struct _XF86MiscSetKbdSettings {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscSetKbdSettings */
CARD16 length B16;
CARD32 kbdtype B32;
CARD32 rate B32;
CARD32 delay B32;
BOOL servnumlock;
BOOL pad1;
CARD16 pad2 B16;
} xXF86MiscSetKbdSettingsReq;
#define sz_xXF86MiscSetKbdSettingsReq 20
typedef struct _XF86MiscSetGrabKeysState {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscSetKbdSettings */
CARD16 length B16;
BOOL enable;
BOOL pad1;
CARD16 pad2 B16;
} xXF86MiscSetGrabKeysStateReq;
#define sz_xXF86MiscSetGrabKeysStateReq 8
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 status B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86MiscSetGrabKeysStateReply;
#define sz_xXF86MiscSetGrabKeysStateReply 32
typedef struct _XF86MiscSetClientVersion {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType;
CARD16 length B16;
CARD16 major B16;
CARD16 minor B16;
} xXF86MiscSetClientVersionReq;
#define sz_xXF86MiscSetClientVersionReq 8
typedef struct _XF86MiscGetFilePaths {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscGetFilePaths */
CARD16 length B16;
} xXF86MiscGetFilePathsReq;
#define sz_xXF86MiscGetFilePathsReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 configlen B16;
CARD16 modulelen B16;
CARD16 loglen B16;
CARD16 pad2 B16;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86MiscGetFilePathsReply;
#define sz_xXF86MiscGetFilePathsReply 32
typedef struct _XF86MiscPassMessage {
CARD8 reqType; /* always XF86MiscReqCode */
CARD8 xf86miscReqType; /* always X_XF86MiscPassMessage */
CARD16 length B16;
CARD16 typelen B16;
CARD16 vallen B16;
CARD16 screen B16;
CARD16 pad B16;
} xXF86MiscPassMessageReq;
#define sz_xXF86MiscPassMessageReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 mesglen B16;
CARD16 pad2 B16;
CARD32 status B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86MiscPassMessageReply;
#define sz_xXF86MiscPassMessageReply 32
#endif /* _XF86MISCSTR_H_ */
/* $XFree86: xc/include/extensions/xf86vmode.h,v 3.30 2001/05/07 20:09:50 mvojkovi Exp $ */
/*
Copyright 1995 Kaleb S. KEITHLEY
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL Kaleb S. KEITHLEY 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 Kaleb S. KEITHLEY
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
from Kaleb S. KEITHLEY
*/
/* $Xorg: xf86vmode.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ */
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifndef _XF86VIDMODE_H_
#define _XF86VIDMODE_H_
#include <nx-X11/Xfuncproto.h>
#include <nx-X11/Xmd.h>
#define X_XF86VidModeQueryVersion 0
#define X_XF86VidModeGetModeLine 1
#define X_XF86VidModeModModeLine 2
#define X_XF86VidModeSwitchMode 3
#define X_XF86VidModeGetMonitor 4
#define X_XF86VidModeLockModeSwitch 5
#define X_XF86VidModeGetAllModeLines 6
#define X_XF86VidModeAddModeLine 7
#define X_XF86VidModeDeleteModeLine 8
#define X_XF86VidModeValidateModeLine 9
#define X_XF86VidModeSwitchToMode 10
#define X_XF86VidModeGetViewPort 11
#define X_XF86VidModeSetViewPort 12
/* new for version 2.x of this extension */
#define X_XF86VidModeGetDotClocks 13
#define X_XF86VidModeSetClientVersion 14
#define X_XF86VidModeSetGamma 15
#define X_XF86VidModeGetGamma 16
#define X_XF86VidModeGetGammaRamp 17
#define X_XF86VidModeSetGammaRamp 18
#define X_XF86VidModeGetGammaRampSize 19
#define X_XF86VidModeGetPermissions 20
#define CLKFLAG_PROGRAMABLE 1
#ifdef XF86VIDMODE_EVENTS
#define XF86VidModeNotify 0
#define XF86VidModeNumberEvents (XF86VidModeNotify + 1)
#define XF86VidModeNotifyMask 0x00000001
#define XF86VidModeNonEvent 0
#define XF86VidModeModeChange 1
#else
#define XF86VidModeNumberEvents 0
#endif
#define XF86VidModeBadClock 0
#define XF86VidModeBadHTimings 1
#define XF86VidModeBadVTimings 2
#define XF86VidModeModeUnsuitable 3
#define XF86VidModeExtensionDisabled 4
#define XF86VidModeClientNotLocal 5
#define XF86VidModeZoomLocked 6
#define XF86VidModeNumberErrors (XF86VidModeZoomLocked + 1)
#define XF86VM_READ_PERMISSION 1
#define XF86VM_WRITE_PERMISSION 2
#ifndef _XF86VIDMODE_SERVER_
typedef struct {
unsigned short hdisplay;
unsigned short hsyncstart;
unsigned short hsyncend;
unsigned short htotal;
unsigned short hskew;
unsigned short vdisplay;
unsigned short vsyncstart;
unsigned short vsyncend;
unsigned short vtotal;
unsigned int flags;
int privsize;
#if defined(__cplusplus) || defined(c_plusplus)
/* private is a C++ reserved word */
INT32 *c_private;
#else
INT32 *private;
#endif
} XF86VidModeModeLine;
typedef struct {
unsigned int dotclock;
unsigned short hdisplay;
unsigned short hsyncstart;
unsigned short hsyncend;
unsigned short htotal;
unsigned short hskew;
unsigned short vdisplay;
unsigned short vsyncstart;
unsigned short vsyncend;
unsigned short vtotal;
unsigned int flags;
int privsize;
#if defined(__cplusplus) || defined(c_plusplus)
/* private is a C++ reserved word */
INT32 *c_private;
#else
INT32 *private;
#endif
} XF86VidModeModeInfo;
typedef struct {
float hi;
float lo;
} XF86VidModeSyncRange;
typedef struct {
char* vendor;
char* model;
float EMPTY;
unsigned char nhsync;
XF86VidModeSyncRange* hsync;
unsigned char nvsync;
XF86VidModeSyncRange* vsync;
} XF86VidModeMonitor;
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent req */
Display *display; /* Display the event was read from */
Window root; /* root window of event screen */
int state; /* What happened */
int kind; /* What happened */
Bool forced; /* extents of new region */
Time time; /* event timestamp */
} XF86VidModeNotifyEvent;
typedef struct {
float red; /* Red Gamma value */
float green; /* Green Gamma value */
float blue; /* Blue Gamma value */
} XF86VidModeGamma;
#define XF86VidModeSelectNextMode(disp, scr) \
XF86VidModeSwitchMode(disp, scr, 1)
#define XF86VidModeSelectPrevMode(disp, scr) \
XF86VidModeSwitchMode(disp, scr, -1)
_XFUNCPROTOBEGIN
Bool XF86VidModeQueryVersion(
Display* /* dpy */,
int* /* majorVersion */,
int* /* minorVersion */
);
Bool XF86VidModeQueryExtension(
Display* /* dpy */,
int* /* event_base */,
int* /* error_base */
);
Bool XF86VidModeSetClientVersion(
Display* /* dpy */
);
Bool XF86VidModeGetModeLine(
Display* /* dpy */,
int /* screen */,
int* /* dotclock */,
XF86VidModeModeLine* /* modeline */
);
Bool XF86VidModeGetAllModeLines(
Display* /* dpy */,
int /* screen */,
int* /* modecount */,
XF86VidModeModeInfo*** /* modelinesPtr */
);
Bool XF86VidModeAddModeLine(
Display* /* dpy */,
int /* screen */,
XF86VidModeModeInfo* /* new modeline */,
XF86VidModeModeInfo* /* after modeline */
);
Bool XF86VidModeDeleteModeLine(
Display* /* dpy */,
int /* screen */,
XF86VidModeModeInfo* /* modeline */
);
Bool XF86VidModeModModeLine(
Display* /* dpy */,
int /* screen */,
XF86VidModeModeLine* /* modeline */
);
Status XF86VidModeValidateModeLine(
Display* /* dpy */,
int /* screen */,
XF86VidModeModeInfo* /* modeline */
);
Bool XF86VidModeSwitchMode(
Display* /* dpy */,
int /* screen */,
int /* zoom */
);
Bool XF86VidModeSwitchToMode(
Display* /* dpy */,
int /* screen */,
XF86VidModeModeInfo* /* modeline */
);
Bool XF86VidModeLockModeSwitch(
Display* /* dpy */,
int /* screen */,
int /* lock */
);
Bool XF86VidModeGetMonitor(
Display* /* dpy */,
int /* screen */,
XF86VidModeMonitor* /* monitor */
);
Bool XF86VidModeGetViewPort(
Display* /* dpy */,
int /* screen */,
int* /* x return */,
int* /* y return */
);
Bool XF86VidModeSetViewPort(
Display* /* dpy */,
int /* screen */,
int /* x */,
int /* y */
);
Bool XF86VidModeGetDotClocks(
Display* /* dpy */,
int /* screen */,
int* /* flags return */,
int* /* number of clocks return */,
int* /* max dot clock return */,
int** /* clocks return */
);
Bool XF86VidModeGetGamma(
Display* /* dpy */,
int /* screen */,
XF86VidModeGamma* /* Gamma */
);
Bool XF86VidModeSetGamma(
Display* /* dpy */,
int /* screen */,
XF86VidModeGamma* /* Gamma */
);
Bool XF86VidModeSetGammaRamp(
Display* /* dpy */,
int /* screen */,
int /* size */,
unsigned short* /* red array */,
unsigned short* /* green array */,
unsigned short* /* blue array */
);
Bool XF86VidModeGetGammaRamp(
Display* /* dpy */,
int /* screen */,
int /* size */,
unsigned short* /* red array */,
unsigned short* /* green array */,
unsigned short* /* blue array */
);
Bool XF86VidModeGetGammaRampSize(
Display* /* dpy */,
int /* screen */,
int* /* size */
);
Bool XF86VidModeGetPermissions(
Display* /* dpy */,
int /* screen */,
int* /* permissions */
);
_XFUNCPROTOEND
#endif
#endif
/* $XFree86: xc/include/extensions/xf86vmstr.h,v 3.27 2001/08/01 00:44:36 tsi Exp $ */
/*
Copyright 1995 Kaleb S. KEITHLEY
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL Kaleb S. KEITHLEY 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 Kaleb S. KEITHLEY
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
from Kaleb S. KEITHLEY
*/
/* $Xorg: xf86vmstr.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ */
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifndef _XF86VIDMODESTR_H_
#define _XF86VIDMODESTR_H_
#include <nx-X11/extensions/xf86vmode.h>
#define XF86VIDMODENAME "XFree86-VidModeExtension"
#define XF86VIDMODE_MAJOR_VERSION 2 /* current version numbers */
#define XF86VIDMODE_MINOR_VERSION 2
/*
* major version 0 == uses parameter-to-wire functions in XFree86 libXxf86vm.
* major version 1 == uses parameter-to-wire functions hard-coded in xvidtune
* client.
* major version 2 == uses new protocol version in XFree86 4.0.
*/
typedef struct _XF86VidModeQueryVersion {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeQueryVersion */
CARD16 length B16;
} xXF86VidModeQueryVersionReq;
#define sz_xXF86VidModeQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of XF86VidMode */
CARD16 minorVersion B16; /* minor version of XF86VidMode */
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86VidModeQueryVersionReply;
#define sz_xXF86VidModeQueryVersionReply 32
typedef struct _XF86VidModeGetModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
} xXF86VidModeGetModeLineReq,
xXF86VidModeGetAllModeLinesReq,
xXF86VidModeGetMonitorReq,
xXF86VidModeGetViewPortReq,
xXF86VidModeGetDotClocksReq,
xXF86VidModeGetPermissionsReq;
#define sz_xXF86VidModeGetModeLineReq 8
#define sz_xXF86VidModeGetAllModeLinesReq 8
#define sz_xXF86VidModeGetMonitorReq 8
#define sz_xXF86VidModeGetViewPortReq 8
#define sz_xXF86VidModeGetDotClocksReq 8
#define sz_xXF86VidModeGetPermissionsReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 dotclock B32;
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 hskew B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD16 pad2 B16;
CARD32 flags B32;
CARD32 reserved1 B32;
CARD32 reserved2 B32;
CARD32 reserved3 B32;
CARD32 privsize B32;
} xXF86VidModeGetModeLineReply;
#define sz_xXF86VidModeGetModeLineReply 52
/* 0.x version */
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 dotclock B32;
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD32 flags B32;
CARD32 privsize B32;
} xXF86OldVidModeGetModeLineReply;
#define sz_xXF86OldVidModeGetModeLineReply 36
typedef struct {
CARD32 dotclock B32;
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD32 hskew B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD16 pad1 B16;
CARD32 flags B32;
CARD32 reserved1 B32;
CARD32 reserved2 B32;
CARD32 reserved3 B32;
CARD32 privsize B32;
} xXF86VidModeModeInfo;
/* 0.x version */
typedef struct {
CARD32 dotclock B32;
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD32 flags B32;
CARD32 privsize B32;
} xXF86OldVidModeModeInfo;
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 modecount B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86VidModeGetAllModeLinesReply;
#define sz_xXF86VidModeGetAllModeLinesReply 32
typedef struct _XF86VidModeAddModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */
CARD16 length B16;
CARD32 screen B32; /* could be CARD16 but need the pad */
CARD32 dotclock B32;
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 hskew B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD16 pad1 B16;
CARD32 flags B32;
CARD32 reserved1 B32;
CARD32 reserved2 B32;
CARD32 reserved3 B32;
CARD32 privsize B32;
CARD32 after_dotclock B32;
CARD16 after_hdisplay B16;
CARD16 after_hsyncstart B16;
CARD16 after_hsyncend B16;
CARD16 after_htotal B16;
CARD16 after_hskew B16;
CARD16 after_vdisplay B16;
CARD16 after_vsyncstart B16;
CARD16 after_vsyncend B16;
CARD16 after_vtotal B16;
CARD16 pad2 B16;
CARD32 after_flags B32;
CARD32 reserved4 B32;
CARD32 reserved5 B32;
CARD32 reserved6 B32;
} xXF86VidModeAddModeLineReq;
#define sz_xXF86VidModeAddModeLineReq 92
/* 0.x version */
typedef struct _XF86OldVidModeAddModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */
CARD16 length B16;
CARD32 screen B32; /* could be CARD16 but need the pad */
CARD32 dotclock B32;
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD32 flags B32;
CARD32 privsize B32;
CARD32 after_dotclock B32;
CARD16 after_hdisplay B16;
CARD16 after_hsyncstart B16;
CARD16 after_hsyncend B16;
CARD16 after_htotal B16;
CARD16 after_vdisplay B16;
CARD16 after_vsyncstart B16;
CARD16 after_vsyncend B16;
CARD16 after_vtotal B16;
CARD32 after_flags B32;
} xXF86OldVidModeAddModeLineReq;
#define sz_xXF86OldVidModeAddModeLineReq 60
typedef struct _XF86VidModeModModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeModModeLine */
CARD16 length B16;
CARD32 screen B32; /* could be CARD16 but need the pad */
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 hskew B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD16 pad1 B16;
CARD32 flags B32;
CARD32 reserved1 B32;
CARD32 reserved2 B32;
CARD32 reserved3 B32;
CARD32 privsize B32;
} xXF86VidModeModModeLineReq;
#define sz_xXF86VidModeModModeLineReq 48
/* 0.x version */
typedef struct _XF86OldVidModeModModeLine {
CARD8 reqType; /* always XF86OldVidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86OldVidModeModModeLine */
CARD16 length B16;
CARD32 screen B32; /* could be CARD16 but need the pad */
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD32 flags B32;
CARD32 privsize B32;
} xXF86OldVidModeModModeLineReq;
#define sz_xXF86OldVidModeModModeLineReq 32
typedef struct _XF86VidModeValidateModeLine {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD32 screen B32; /* could be CARD16 but need the pad */
CARD32 dotclock B32;
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 hskew B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD16 pad1 B16;
CARD32 flags B32;
CARD32 reserved1 B32;
CARD32 reserved2 B32;
CARD32 reserved3 B32;
CARD32 privsize B32;
} xXF86VidModeDeleteModeLineReq,
xXF86VidModeValidateModeLineReq,
xXF86VidModeSwitchToModeReq;
#define sz_xXF86VidModeDeleteModeLineReq 52
#define sz_xXF86VidModeValidateModeLineReq 52
#define sz_xXF86VidModeSwitchToModeReq 52
/* 0.x version */
typedef struct _XF86OldVidModeValidateModeLine {
CARD8 reqType; /* always XF86OldVidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD32 screen B32; /* could be CARD16 but need the pad */
CARD32 dotclock B32;
CARD16 hdisplay B16;
CARD16 hsyncstart B16;
CARD16 hsyncend B16;
CARD16 htotal B16;
CARD16 vdisplay B16;
CARD16 vsyncstart B16;
CARD16 vsyncend B16;
CARD16 vtotal B16;
CARD32 flags B32;
CARD32 privsize B32;
} xXF86OldVidModeDeleteModeLineReq,
xXF86OldVidModeValidateModeLineReq,
xXF86OldVidModeSwitchToModeReq;
#define sz_xXF86OldVidModeDeleteModeLineReq 36
#define sz_xXF86OldVidModeValidateModeLineReq 36
#define sz_xXF86OldVidModeSwitchToModeReq 36
typedef struct _XF86VidModeSwitchMode {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSwitchMode */
CARD16 length B16;
CARD16 screen B16;
CARD16 zoom B16;
} xXF86VidModeSwitchModeReq;
#define sz_xXF86VidModeSwitchModeReq 8
typedef struct _XF86VidModeLockModeSwitch {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeLockModeSwitch */
CARD16 length B16;
CARD16 screen B16;
CARD16 lock B16;
} xXF86VidModeLockModeSwitchReq;
#define sz_xXF86VidModeLockModeSwitchReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 status B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86VidModeValidateModeLineReply;
#define sz_xXF86VidModeValidateModeLineReply 32
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD8 vendorLength;
CARD8 modelLength;
CARD8 nhsync;
CARD8 nvsync;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86VidModeGetMonitorReply;
#define sz_xXF86VidModeGetMonitorReply 32
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 x B32;
CARD32 y B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86VidModeGetViewPortReply;
#define sz_xXF86VidModeGetViewPortReply 32
typedef struct _XF86VidModeSetViewPort {
CARD8 reqType; /* always VidModeReqCode */
CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSetViewPort */
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
CARD32 x B32;
CARD32 y B32;
} xXF86VidModeSetViewPortReq;
#define sz_xXF86VidModeSetViewPortReq 16
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 flags B32;
CARD32 clocks B32;
CARD32 maxclocks B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xXF86VidModeGetDotClocksReply;
#define sz_xXF86VidModeGetDotClocksReply 32
typedef struct _XF86VidModeSetClientVersion {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD16 major B16;
CARD16 minor B16;
} xXF86VidModeSetClientVersionReq;
#define sz_xXF86VidModeSetClientVersionReq 8
typedef struct _XF86VidModeGetGamma {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXF86VidModeGetGammaReq;
#define sz_xXF86VidModeGetGammaReq 32
typedef struct {
BYTE type;
BOOL pad;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 red B32;
CARD32 green B32;
CARD32 blue B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
} xXF86VidModeGetGammaReply;
#define sz_xXF86VidModeGetGammaReply 32
typedef struct _XF86VidModeSetGamma {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
CARD32 red B32;
CARD32 green B32;
CARD32 blue B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
} xXF86VidModeSetGammaReq;
#define sz_xXF86VidModeSetGammaReq 32
typedef struct _XF86VidModeSetGammaRamp {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD16 screen B16;
CARD16 size B16;
} xXF86VidModeSetGammaRampReq;
#define sz_xXF86VidModeSetGammaRampReq 8
typedef struct _XF86VidModeGetGammaRamp {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD16 screen B16;
CARD16 size B16;
} xXF86VidModeGetGammaRampReq;
#define sz_xXF86VidModeGetGammaRampReq 8
typedef struct {
BYTE type;
BOOL pad;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 size B16;
CARD16 pad0 B16;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86VidModeGetGammaRampReply;
#define sz_xXF86VidModeGetGammaRampReply 32
typedef struct _XF86VidModeGetGammaRampSize {
CARD8 reqType; /* always XF86VidModeReqCode */
CARD8 xf86vidmodeReqType;
CARD16 length B16;
CARD16 screen B16;
CARD16 pad B16;
} xXF86VidModeGetGammaRampSizeReq;
#define sz_xXF86VidModeGetGammaRampSizeReq 8
typedef struct {
BYTE type;
BOOL pad;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 size B16;
CARD16 pad0 B16;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86VidModeGetGammaRampSizeReply;
#define sz_xXF86VidModeGetGammaRampSizeReply 32
typedef struct {
BYTE type;
BOOL pad;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 permissions B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xXF86VidModeGetPermissionsReply;
#define sz_xXF86VidModeGetPermissionsReply 32
#endif /* _XF86VIDMODESTR_H_ */
/* $XFree86$ */
/*
* This include file is designed to be a portable way for systems to define
* bit field manipulation of arrays of bits.
*/
#ifndef __XTRAPBITS__
#define __XTRAPBITS__ "@(#)xtrapbits.h 1.6 - 90/09/18 "
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1994 by Digital Equipment Corporation,
Maynard, MA
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.
*****************************************************************************/
/*
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Dan Coutu
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
*/
typedef unsigned char *UByteP; /* Pointer to an unsigned byte array */
#define BitsInByte 8L /* The number of bits in a byte */
#define BitInByte(bit) /* Returns the bit mask of a byte */ \
(1L << (((bit) % BitsInByte)))
#define BitInWord(bit) /* Returns the bit mask of a word */ \
(1L << (((bit) % (BitsInByte * 2L))))
#define BitInLong(bit) /* Returns the bit mask of a long */ \
(1L << (((bit) % (BitsInByte * 4L))))
#define ByteInArray(array,bit) /* Returns the byte offset to get to a bit */ \
(((UByteP)(array))[(bit) / BitsInByte])
#define BitIsTrue(array,bit) /* Test to see if a specific bit is True */ \
(ByteInArray(array,bit) & BitInByte(bit))
#define BitIsFalse(array,bit) /* Test to see if a specific bit is False */ \
(!(BitIsTrue(array,bit)))
#define BitTrue(array,bit) /* Set a specific bit to be True */ \
(ByteInArray(array,bit) |= BitInByte(bit))
#define BitFalse(array,bit) /* Set a specific bit to be False */ \
(ByteInArray(array,bit) &= ~BitInByte(bit))
#define BitToggle(array,bit) /* Toggle a specific bit */ \
(ByteInArray(array,bit) ^= BitInByte(bit))
#define BitCopy(dest,src,bit) /* Copy a specific bit */ \
BitIsTrue((src),(bit)) ? BitTrue((dest),(bit)) : BitFalse((dest),(bit))
#define BitValue(array,bit) /* Return True or False depending on bit */ \
(BitIsTrue((array),(bit)) ? True : False)
#define BitSet(array,bit,value) /* Set bit to given value in array */ \
(value) ? BitTrue((array),(bit)) : BitFalse((array),(bit))
#endif /* __XTRAPBITS__ */
/* $XFree86$ */
#ifndef __XTRAPDDMI__
#define __XTRAPDDMI__
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
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.
*****************************************************************************/
/*
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Dan Coutu
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
* DESCRIPTION:
* This header file is used by the XTrap server extension only
* (not used by clients or the XTrap Toolkit). Information
* contained herein should *not* be visible to clients (xtrapdi.h
* is used for this). The name is historical.
*/
#include <nx-X11/X.h>
#include <nx-X11/extensions/xtrapbits.h>
#include "dix.h"
#ifndef MIN
# define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX
# define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
#define XETrapNumEvents 1L /* constants used for AddExtension */
/* Other constants used within the extension code */
#define XETrapMinRepSize 32L /* Minimum number of longs */
/* This structure will be globally declared to provide storage to hold
* the various extension wide configuration information. Allocated on
* a per-client basis.
*/
typedef struct
{
ClientPtr client; /* Multi-client support and error handling */
xXTrapGetCurReply cur; /* Struct of Miscellaneous state info */
xXTrapGetStatsReply *stats; /* Pointer to stat's, malloc'd if requested */
CARD32 last_input_time B32; /* last timestamp from input event */
CARD16 protocol B16; /* current communication protocol */
} XETrapEnv;
#define XETrapSetHeaderEvent(phdr) ((phdr)->type = 0x1L)
#define XETrapSetHeaderRequest(phdr) ((phdr)->type = 0x2L)
#define XETrapSetHeaderSpecial(phdr) ((phdr)->type = 0x3L)
#define XETrapSetHeaderCursor(phdr) ((phdr)->type = 0x4L)
#define XETrapSetHeaderReply(phdr) ((phdr)->type = 0x5L)
#ifndef vaxc
#define globaldef
#define globalref extern
#endif
/* Extension platform identifier (conditionally defined) */
#if ( defined (__osf__) && defined(__alpha) )
# define XETrapPlatform PF_DECOSF1
#endif
#ifdef ultrix
# define XETrapPlatform PF_DECUltrix
#endif
#ifdef vms
#ifdef VAXELN
# define XETrapPlatform PF_DECELN
#else
# define XETrapPlatform PF_DECVMS
#endif
#endif
#ifdef VT1000
# define XETrapPlatform PF_DECVT1000
#endif
#ifdef VXT
# define XETrapPlatform PF_DECXTerm
#endif
#ifdef PC
# define XETrapPlatform PF_IBMAT
#endif
#ifdef sun
# define XETrapPlatform PF_SunSparc
#endif
#ifndef XETrapPlatform
# define XETrapPlatform PF_Other
#endif /* XETrapPlatform */
#endif /* __XTRAPDDMI__ */
/* $XFree86$ */
#ifndef __XTRAPDI__
#define __XTRAPDI__
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1994 by Digital Equipment Corp.,
Maynard, MA
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.
*****************************************************************************/
/*
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Dan Coutu
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
* DESCRIPTION:
* This header file defines the common structures/constants
* between the XTrap extension and clients. All protocol
* definitions between XTrap extension/clients can be found
* here.
*/
#define NEED_REPLIES
#define NEED_EVENTS
#ifndef IN_MODULE
#include <stdio.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xmd.h>
#ifdef SMT
#define NEED_EVENTS
#define NEED_REPLIES
#endif
#include <nx-X11/Xproto.h>
#include <nx-X11/extensions/xtrapbits.h>
#define XTrapExtName "DEC-XTRAP"
/* Current Release, Version, and Revision of the XTrap Extension */
#define XETrapRelease 3L
#define XETrapVersion 4L
#ifndef XETrapRevision /* Changed from the Makefile by users */
# define XETrapRevision 0L
#endif /* XETrapRevision */
#define XETrapProtocol 32L
#ifndef SIZEOF
# ifdef __STDC__
# define SIZEOF(x) sz_##x
# else
# define SIZEOF(x) sz_/**/x
# endif /* if ANSI C compiler else not */
#endif
#ifndef sz_CARD32
#define sz_CARD32 4L
#endif
#ifndef sz_CARD8
#define sz_CARD8 1L
#endif
#ifndef True
# define True 1L
# define False 0L
#endif
typedef int (*int_function)();
typedef void (*void_function)();
/* This is used as flags to indicate desired request traps
* Note: This has been padded to a CARD32 to keep structure aligned
*/
#define XETrapMaxRequest (((SIZEOF(CARD32)+((256L-1L) / \
(BitsInByte*SIZEOF(CARD8))))/SIZEOF(CARD32))*SIZEOF(CARD32))
typedef CARD8 ReqFlags[XETrapMaxRequest];
/* This is used as flags to indicate desired event traps
* Until events become *fully vectored*, we'll have to fake it
* by defining an array of 5 events (KeyPress, KeyRelease,
* ButtonPress, ButtonRelease, and MotionNotify. The extra 2
* are required as the event types start with "2" (errors and
* replies are 0 & 1). The event type is the index into the
* bits.
* Note: This has been padded to a longword to keep structure aligned
*/
#ifndef VECTORED_EVENTS
#define XETrapCoreEvents (2L+5L)
#else
#define XETrapCoreEvents 128L
#endif
#define XETrapMaxEvent (((SIZEOF(CARD32)+((XETrapCoreEvents-1L) / \
(BitsInByte*SIZEOF(CARD8))))/SIZEOF(CARD32))*SIZEOF(CARD32))
typedef CARD8 EventFlags[XETrapMaxEvent];
/* This structure is used in a request to specify the types of
* configuration information that should be changed or updated.
*/
typedef struct
{
CARD8 valid[4L]; /* Bits TRUE indicates data field is used */
CARD8 data[4L]; /* Bits looked at if corresponding valid bit set */
ReqFlags req; /* Bits coorespond to core requests */
EventFlags event; /* Bits correspond to core events */
} XETrapFlags;
/* Bit definitions for the above XETrapFlags structure. */
#define XETrapTimestamp 0L /* hdr timestamps desired */
#define XETrapCmd 1L /* command key specified */
#define XETrapCmdKeyMod 2L /* cmd key is a modifier */
#define XETrapRequest 3L /* output requests array */
#define XETrapEvent 4L /* future output events array */
#define XETrapMaxPacket 5L /* Maximum packet length set */
#define XETrapTransOut 6L /* obsolete */
#define XETrapStatistics 7L /* collect counts on requests */
#define XETrapWinXY 8L /* Fill in Window (X,Y) in hdr */
#define XETrapTransIn 9L /* obsolete */
#define XETrapCursor 10L /* Trap cursor state changes */
#define XETrapXInput 11L /* Use XInput extension */
#define XETrapVectorEvents 12L /* Use Vectored Events (128) */
#define XETrapColorReplies 13L /* Return replies with Color Req's */
#define XETrapGrabServer 14L /* Disables client GrabServers */
typedef struct /* used by XEConfigRequest */
{
XETrapFlags flags; /* Flags to specify what should be chg'd */
CARD16 max_pkt_size B16; /* Maximum number of bytes in a packet */
CARD8 cmd_key; /* Keyboard command_key (KeyCode) */
/*
* cmd_key is intentionally *not* defined KeyCode since it's definition is
* ambiguous (int in Intrinsic.h and unsigned char in X.h.
*/
CARD8 pad[1L]; /* pad out to a quadword */
} XETrapCfg;
/* These structures are used within the Xtrap request structure for
* the various types of xtrap request
*/
#ifndef _XINPUT
/* (see the definition of XEvent as a reference) */
typedef struct /* used by XESimulateXEventRequest for synthesizing core evts */
{
CARD8 type; /* (must be first) as in XEvent */
CARD8 detail; /* Detail keycode/button as in XEvent */
CARD8 screen; /* screen number (0 to n) */
CARD8 pad; /* pad to longword */
INT16 x B16; /* X & Y coord as in XEvent */
INT16 y B16;
} XETrapInputReq;
#endif
/* These are constants that refer to the extension request vector table.
* A request will use these values as minor opcodes.
*/
#define XETrap_Reset 0L /* set to steady state */
#define XETrap_GetAvailable 1L /* get available funct from ext */
#define XETrap_Config 2L /* configure extension */
#define XETrap_StartTrap 3L /* use Trapping */
#define XETrap_StopTrap 4L /* stop using Trapping */
#define XETrap_GetCurrent 5L /* get current info from ext */
#define XETrap_GetStatistics 6L /* get count statistics from ext */
#ifndef _XINPUT
#define XETrap_SimulateXEvent 7L /* async input simulation */
#endif
#define XETrap_GetVersion 8L /* Get (Just) Version */
#define XETrap_GetLastInpTime 9L /* Get Timestamp of last client input */
/* The following are formats of a request to the XTRAP
* extension. The data-less XTrap requests all use xXTrapReq
*/
typedef struct
{
CARD8 reqType;
CARD8 minor_opcode;
CARD16 length B16;
CARD32 pad B32; /* Maintain quadword alignment */
} xXTrapReq;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_xXTrapReq (sizeof(xXTrapReq))
/* For retrieving version/available info (passes lib-side protocol number) */
typedef struct
{
CARD8 reqType;
CARD8 minor_opcode;
CARD16 length B16;
CARD16 protocol B16; /* The xtrap extension protocol number */
CARD16 pad B16; /* Maintain quadword alignment */
} xXTrapGetReq;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_xXTrapGetReq (sizeof(xXTrapGetReq))
typedef struct
{
CARD8 reqType;
CARD8 minor_opcode;
CARD16 length B16;
/*
* The follwing is done so that structure padding wont be
* a problem. The request structure contains a shadow for
* the XETrapCfg structure. Since the XETrapCfg also has a
* substructure (XETrapFlags) this structure is also shadowed.
*
* The following are a shadow of the XETrapFlags
* structure.
*/
CARD8 config_flags_valid[4L];
CARD8 config_flags_data[4L];
ReqFlags config_flags_req;
EventFlags config_flags_event;
/* End Shadow (XETrapFlags)*/
CARD16 config_max_pkt_size B16; /* Max number of bytes in a packet */
CARD8 config_cmd_key; /* Keyboard command_key (KeyCode) */
/*
* cmd_key is intentionally *not* defined KeyCode since it's definition is
* ambiguous (int in Intrinsic.h and unsigned char in X.h.
*/
CARD8 config_pad[1L]; /* pad out to a quadword */
/* End Shadow (XETrapCfg) */
CARD32 pad B32; /* Maintain quadword alignment */
} xXTrapConfigReq;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_xXTrapConfigReq (sizeof(xXTrapConfigReq))
#ifndef _XINPUT
typedef struct
{
CARD8 reqType;
CARD8 minor_opcode;
CARD16 length B16;
CARD32 pad B32; /* Maintain quadword alignment */
XETrapInputReq input;
} xXTrapInputReq;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_xXTrapInputReq (sizeof(xXTrapInputReq))
#endif
/* The following structures are used by the server extension to send
* information and replies to the client.
*/
/* header for all X replies */
typedef struct
{
CARD8 type;
CARD8 detail;
CARD16 sequenceNumber B16;
CARD32 length B32;
} XETrapRepHdr;
/* Structure of Get Available Functionality reply */
typedef struct
{
CARD32 pf_ident B32; /* Contains constant identifying the platform */
CARD16 xtrap_release B16; /* The xtrap extension release number */
CARD16 xtrap_version B16; /* The xtrap extension version number */
CARD16 xtrap_revision B16; /* The xtrap extension revision number */
CARD16 max_pkt_size B16; /* Maximum number of bytes in a packet */
CARD8 valid[4]; /* What specific configuration flags are valid */
CARD32 major_opcode B32; /* The major opcode identifying xtrap */
CARD32 event_base B32; /* The event value we start at */
CARD32 pad0 B32; /* obsolete field */
CARD16 pad1 B16, pad2 B16, pad3 B16; /* obsolete field */
CARD16 xtrap_protocol B16; /* The xtrap extension protocol number */
INT16 cur_x B16; /* Current X & Y coord for relative motion */
INT16 cur_y B16;
} XETrapGetAvailRep;
typedef struct
{
CARD16 xtrap_release B16; /* The xtrap extension release number */
CARD16 xtrap_version B16; /* The xtrap extension version number */
CARD16 xtrap_revision B16; /* The xtrap extension revision number */
CARD16 xtrap_protocol B16; /* The xtrap extension protocol number */
} XETrapGetVersRep;
typedef struct
{
CARD32 last_time B32; /* Timestamp of last input time */
} XETrapGetLastInpTimeRep;
/* Structure of Get Current Configuration Information reply */
typedef struct
{
CARD8 state_flags[2]; /* Miscelaneous flags, see below #define's */
CARD16 pad0 B16; /* Assure quadword alignment */
XETrapCfg config; /* Current Config information */
CARD32 pad1 B32;
} XETrapGetCurRep;
/* Mask definitions for the above flags. */
#define XETrapTrapActive 0L /* If sending/receiving between client/ext */
/* Structure of Get Statistics Information reply */
typedef struct
{
CARD32 requests[256L]; /* Array containing request counts if trapped */
CARD32 events[XETrapCoreEvents]; /* Array containing event stats */
#ifndef VECTORED_EVENTS
CARD32 pad B32; /* Pad out to a quadword */
#endif
} XETrapGetStatsRep;
#define PF_Other 0L /* server not one of the below */
#define PF_Apollo 10L /* server on Apollo system */
#define PF_ATT 20L /* server on AT&T system */
#define PF_Cray1 30L /* server on Cray 1 system */
#define PF_Cray2 31L /* server on Cray 2 system */
#define PF_DECUltrix 40L /* server on DEC ULTRIX system */
#define PF_DECVMS 41L /* server on DEC VMS system */
#define PF_DECVT1000 42L /* server on DEC-VT1000-terminal */
#define PF_DECXTerm 43L /* server on DEC-X-terminal */
#define PF_DECELN 44L /* server on DEC VAXELN X terminal */
#define PF_DECOSF1 45L /* server on DEC's OSF/1 system */
#define PF_HP9000s800 50L /* server on HP 9000/800 system */
#define PF_HP9000s300 51L /* server on HP 9000/300 system */
#define PF_IBMAT 60L /* server on IBM/AT system */
#define PF_IBMRT 61L /* server on IBM/RT system */
#define PF_IBMPS2 62L /* server on IBM/PS2 system */
#define PF_IBMRS 63L /* server on IBM/RS system */
#define PF_MacII 70L /* server on Mac II system */
#define PF_Pegasus 80L /* server on Tektronix Pegasus system */
#define PF_SGI 90L /* server on Silicon Graphcis system */
#define PF_Sony 100L /* server on Sony system */
#define PF_Sun3 110L /* server on Sun 3 system */
#define PF_Sun386i 111L /* server on Sun 386i system */
#define PF_SunSparc 112L /* server on Sun Sparc system */
/* reply sent back by XETrapGetAvailable request */
typedef struct
{
XETrapRepHdr hdr;
XETrapGetAvailRep data;
} xXTrapGetAvailReply;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_xXTrapGetAvailReply sizeof(xXTrapGetAvailReply)
/* reply sent back by XETrapGetVersion request */
typedef struct
{
XETrapRepHdr hdr;
XETrapGetVersRep data;
CARD32 pad0 B32; /* pad out to 32 bytes */
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
} xXTrapGetVersReply;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_xXTrapGetVersReply sizeof(xXTrapGetVersReply)
/* reply sent back by XETrapGetLastInpTime request */
typedef struct
{
XETrapRepHdr hdr;
/*
* The following is a shadow of the XETrapGetLastInpTimeRep
* structure. This is done to avoid structure padding.
*/
CARD32 data_last_time B32; /* Timestamp of last input time */
CARD32 pad0 B32; /* pad out to 32 bytes */
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xXTrapGetLITimReply;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_xXTrapGetLITimReply sizeof(xXTrapGetLITimReply)
/* reply sent back by XETrapGetCurrent request */
typedef struct
{
XETrapRepHdr hdr;
/*
* The following is a shadow of the XETrapGetCurRep
* structure. This is done to avoid structure padding.
* Since the XETrapGetCurRep structure contains a sub-structure
* (XETrapCfg) there is a shadow for that as well.*/
CARD8 data_state_flags[2]; /* Misc flags, see below #define's */
CARD16 data_pad0 B16; /* Assure quadword alignment */
/* XETrapCfg Shadow Starts */
CARD8 data_config_flags_valid[4L];
CARD8 data_config_flags_data[4L];
ReqFlags data_config_flags_req;
EventFlags data_config_flags_event;
CARD16 data_config_max_pkt_size B16; /* Max num of bytes in a pkt */
CARD8 data_config_cmd_key; /* Keyboard cmd_key (KeyCode) */
/*
* cmd_key is intentionally *not* defined KeyCode since it's definition is
* ambiguous (int in Intrinsic.h and unsigned char in X.h.
*/
CARD8 data_config_pad[1L]; /* pad out to a quadword */
/* End Shadow (XETrapCfg) */
CARD32 pad1 B32;
} xXTrapGetCurReply;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_xXTrapGetCurReply sizeof(xXTrapGetCurReply)
/* reply sent back by XETrapGetStatistics request */
/* Note:
* The following does *not* use the standard XETrapRepHdr, but instead
* one which is padded out to 32-bytes. This is because Cray's have a problem
* reading arrays of CARD32s without using the _Read32 macro (see XERqsts.c).
* This requires that none of the data be in the _Reply area.
*/
typedef struct
{
CARD8 type;
CARD8 detail;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 pad0 B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
XETrapGetStatsRep data;
} xXTrapGetStatsReply;
#define sz_xXTrapGetStatsReply 1088
typedef struct /* the XTrap Output header (for output from ext to client) */
{ /* this must be quadword aligned for portability */
CARD32 count B32; /* Length including this header */
CARD32 timestamp B32; /* timestamp if desired */
CARD8 type; /* event id, request id, special id */
CARD8 screen; /* screen number (0 to n) */
INT16 win_x B16; /* X coord of drawable, if any */
INT16 win_y B16; /* X coord of drawable, if any */
CARD16 client B16; /* to distinguish requests */
} XETrapHeader;
/* the following works because all fields are defined as bit (Bnn) fields */
#define sz_XETrapHeader sizeof(XETrapHeader)
#define XETrapHeaderIsEvent(phdr) (XETrapGetHeaderType(phdr) == 0x1L)
#define XETrapHeaderIsRequest(phdr) (XETrapGetHeaderType(phdr) == 0x2L)
#define XETrapHeaderIsSpecial(phdr) (XETrapGetHeaderType(phdr) == 0x3L)
#define XETrapHeaderIsCursor(phdr) (XETrapGetHeaderType(phdr) == 0x4L)
#define XETrapHeaderIsReply(phdr) (XETrapGetHeaderType(phdr) == 0x5L)
/* Define a structure used for reading/writing datum of type XTrap */
typedef struct
{
XETrapHeader hdr;
union
{
xEvent event;
xResourceReq req;
xGenericReply reply;
/* special? */
} u;
} XETrapDatum;
/* this doesn't get picked up for VMS server builds (different Xproto.h) */
#ifndef sz_xEvent
#define sz_xEvent 32
#endif
/* Minimum size of a packet from the server extension */
#define XETrapMinPktSize (SIZEOF(XETrapHeader) + SIZEOF(xEvent))
/* Constants used with the XLIB transport */
#define XETrapDataStart 0L /* Used in the detail field */
#define XETrapDataContinued 1L /* Used in the detail field */
#define XETrapDataLast 2L /* Used in the detail field */
#define XETrapData 0L /* Used in the type field */
#define XETrapNumberEvents 1L
/* This is the representation on the wire(see also XLib.h) */
#define sz_EventData 24L /* 32 bytes - type, detail, seq, index */
typedef struct {
CARD8 type;
CARD8 detail;
CARD16 sequenceNumber B16;
CARD32 idx B32;
CARD8 data[sz_EventData];
} xETrapDataEvent;
/* Error message indexes added to X for extension */
#define BadIO 2L /* Can't read/write */
#define BadStatistics 4L /* Stat's not avail. */
#define BadDevices 5L /* Devices not vectored */
#define BadScreen 7L /* Can't send event to given screen */
#define BadSwapReq 8L /* Can't send swapped extension requests */
#define XETrapNumErrors (BadSwapReq + 1)
#define XEKeyIsClear 0
#define XEKeyIsEcho 1
#define XEKeyIsOther 2
#endif /* __XTRAPDI__ */
/* $XFree86: xc/include/extensions/xtrapemacros.h,v 1.1 2001/11/02 23:29:26 dawes Exp $ */
#ifndef __XTRAPEMACROS__
#define __XTRAPEMACROS__ "@(#)xtrapemacros.h 1.9 - 90/09/18 "
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp.,
Maynard, MA
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.
*****************************************************************************/
/*
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Dan Coutu
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
* DESCRIPTION:
* This include file is designed to provide the *visible*
* interface to XTrap data structures. Fields can be set
* using these macros by client programs unless otherwise
* specified; however, use of Trap Context convenience
* routines is strongly encouraged (XETrapContext.c)
*/
#include <nx-X11/extensions/xtrapbits.h>
#include <signal.h>
/* msleep macro to replace msleep() for portability reasons */
#define msleep(m) usleep((m)*1000)
/* Copying TC's assumes that the new TC must be created */
#define XECopyTC(src,mask,dest) \
(dest = XECreateTC(((src)->dpy), (mask), (&((src)->values))))
/* Expands to SET each element of the TCValues structure
* Returns the TCValues Mask so that the Set can be entered
* as an argument to the XEChangeTC() routine call
*/
/* Note: req_cb & evt_cb would only be used if you wanted to
* *share* callbacks between Trap Contexts. Normally,
* XEAddRequestCB() and XEAddEventCB() would be used.
*/
#define XETrapSetCfgReqCB(tcv,x) ((tcv)->req_cb = (x))
#define XETrapSetCfgEvtCB(tcv,x) ((tcv)->evt_cb = (x))
#define XETrapSetCfgMaxPktSize(tcv,x) ((tcv)->v.max_pkt_size = (x))
#define XETrapSetCfgCmdKey(tcv,x) ((tcv)->v.cmd_key = (x))
/* Note: e is only pertinent for "valid" or "data" */
#define XETrapSetCfgFlags(tcv,e,a) \
memcpy((tcv)->v.flags.e, (a), sizeof((tcv)->v.flags.e))
#define XETrapSetCfgFlagTimestamp(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapTimestamp, (x))
#define XETrapSetCfgFlagCmd(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapCmd, (x))
#define XETrapSetCfgFlagCmdKeyMod(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapCmdKeyMod, (x))
#define XETrapSetCfgFlagRequest(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapRequest, (x))
#define XETrapSetCfgFlagEvent(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapEvent, (x))
#define XETrapSetCfgFlagMaxPacket(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapMaxPacket, (x))
#define XETrapSetCfgFlagStatistics(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapStatistics, (x))
#define XETrapSetCfgFlagWinXY(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapWinXY, (x))
#define XETrapSetCfgFlagCursor(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapCursor, (x))
#define XETrapSetCfgFlagReq(tcv,request,x) \
BitSet((tcv)->v.flags.req, (request), (x))
#define XETrapSetCfgFlagXInput(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapXInput, (x))
#define XETrapSetCfgFlagColorReplies(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapColorReplies, (x))
#define XETrapSetCfgFlagGrabServer(tcv,e,x) \
BitSet((tcv)->v.flags.e, XETrapGrabServer, (x))
#define XETrapSetCfgFlagEvt(tcv,evt,x) \
BitSet((tcv)->v.flags.event, (evt), (x))
#define XETrapSetValFlagDeltaTimes(tcv,x) \
BitSet((tcv)->tc_flags, XETCDeltaTimes, (x))
/* Fields returned in the "GetAvailable" request */
#define XETrapGetAvailPFIdent(avail) ((avail)->pf_ident)
#define XETrapGetAvailRelease(avail) ((avail)->xtrap_release)
#define XETrapGetAvailVersion(avail) ((avail)->xtrap_version)
#define XETrapGetAvailRevision(avail) ((avail)->xtrap_revision)
#define XETrapGetAvailMaxPktSize(avail) ((avail)->max_pkt_size)
#define XETrapGetAvailFlags(avail,a) \
memcpy((a), (avail)->valid, sizeof((avail)->valid))
#define XETrapGetAvailFlagTimestamp(avail) \
(BitValue((avail)->valid, XETrapTimestamp))
#define XETrapGetAvailFlagCmd(avail) \
(BitValue((avail)->valid, XETrapCmd))
#define XETrapGetAvailFlagCmdKeyMod(avail) \
(BitValue((avail)->valid, XETrapCmdKeyMod))
#define XETrapGetAvailFlagRequest(avail) \
(BitValue((avail)->valid, XETrapRequest))
#define XETrapGetAvailFlagEvent(avail) \
(BitValue((avail)->valid, XETrapEvent))
#define XETrapGetAvailFlagMaxPacket(avail) \
(BitValue((avail)->valid, XETrapMaxPacket))
#define XETrapGetAvailFlagStatistics(avail) \
(BitValue((avail)->valid, XETrapStatistics))
#define XETrapGetAvailFlagWinXY(avail) \
(BitValue((avail)->valid, XETrapWinXY))
#define XETrapGetAvailFlagCursor(avail) \
(BitValue((avail)->valid, XETrapCursor))
#define XETrapGetAvailFlagXInput(avail) \
(BitValue((avail)->valid, XETrapXInput))
#define XETrapGetAvailFlagVecEvt(avail) \
(BitValue((avail)->valid, XETrapVectorEvents))
#define XETrapGetAvailFlagColorReplies(avail) \
(BitValue((avail)->valid, XETrapColorReplies))
#define XETrapGetAvailFlagGrabServer(avail) \
(BitValue((avail)->valid, XETrapGrabServer))
#define XETrapGetAvailOpCode(avail) ((avail)->major_opcode)
/* Macro's for creating current request and trap context macros */
#define XETrapGetCfgMaxPktSize(cfg) ((cfg)->max_pkt_size)
#define XETrapGetCfgCmdKey(cfg) ((cfg)->cmd_key)
#define XETrapGetCfgFlags(cfg,e,a) \
memcpy((a), (cfg)->flags.e, sizeof((cfg)->flags.e))
#define XETrapGetCfgFlagTimestamp(cfg,e) \
(BitValue((cfg)->flags.e, XETrapTimestamp))
#define XETrapGetCfgFlagCmd(cfg,e) \
(BitValue((cfg)->flags.e, XETrapCmd))
#define XETrapGetCfgFlagCmdKeyMod(cfg,e) \
(BitValue((cfg)->flags.e, XETrapCmdKeyMod))
#define XETrapGetCfgFlagRequest(cfg,e) \
(BitValue((cfg)->flags.e, XETrapRequest))
#define XETrapGetCfgFlagEvent(cfg,e) \
(BitValue((cfg)->flags.e, XETrapEvent))
#define XETrapGetCfgFlagMaxPacket(cfg,e) \
(BitValue((cfg)->flags.e, XETrapMaxPacket))
#define XETrapGetCfgFlagStatistics(cfg,e) \
(BitValue((cfg)->flags.e, XETrapStatistics))
#define XETrapGetCfgFlagWinXY(cfg,e) \
(BitValue((cfg)->flags.e, XETrapWinXY))
#define XETrapGetCfgFlagCursor(cfg,e) \
(BitValue((cfg)->flags.e, XETrapCursor))
#define XETrapGetCfgFlagXInput(cfg,e) \
(BitValue((cfg)->flags.e, XETrapXInput))
#define XETrapGetCfgFlagColorReplies(cfg,e) \
(BitValue((cfg)->flags.e, XETrapColorReplies))
#define XETrapGetCfgFlagGrabServer(cfg,e) \
(BitValue((cfg)->flags.e, XETrapGrabServer))
/* Request values are in "Xproto.h" of the flavor X_RequestType */
#define XETrapGetCfgFlagReq(cfg,request) \
(BitValue((cfg)->flags.req, (request)))
/* Event types are in "X.h" of the flavor EventType (e.g. KeyPress) */
#define XETrapGetCfgFlagEvt(cfg,evt) \
(BitValue((cfg)->flags.event, (evt)))
/* Fields returned int the "GetCurrent" Request */
#define XETrapGetCurX(avail) ((avail)->cur_x)
#define XETrapGetCurY(avail) ((avail)->cur_y)
#define XETrapGetCurSFlags(cur,a) \
memcpy((a), (cur)->state_flags, sizeof((cur)->state_flags))
#define XETrapGetCurMaxPktSize(cur) (XETrapGetCfgMaxPktSize(&((cur)->config)))
#define XETrapGetCurCmdKey(cur) (XETrapGetCfgCmdKey(&((cur)->config)))
/* Note: e is only pertinent for "valid" or "data" */
#define XETrapGetCurCFlags(cur,e,a) (XETrapGetCfgFlags(&((cur)->config),e,a))
#define XETrapGetCurFlagTimestamp(cur,e) \
(XETrapGetCfgFlagTimestamp(&((cur)->config),e))
#define XETrapGetCurFlagCmd(cur,e) (XETrapGetCfgFlagCmd(&((cur)->config),e))
#define XETrapGetCurFlagCmdKeyMod(cur,e) \
(XETrapGetCfgFlagCmdKeyMod(&((cur)->config),e))
#define XETrapGetCurFlagRequest(cur,r) \
(XETrapGetCfgFlagRequest(&((cur)->config),r))
#define XETrapGetCurFlagEvent(cur,e) \
(XETrapGetCfgFlagEvent(&((cur)->config),e))
#define XETrapGetCurFlagMaxPacket(cur,e) \
(XETrapGetCfgFlagMaxPacket(&((cur)->config),e))
#define XETrapGetCurFlagStatistics(cur,e) \
(XETrapGetCfgFlagStatistics(&((cur)->config),e))
#define XETrapGetCurFlagWinXY(cur,e) \
(XETrapGetCfgFlagWinXY(&((cur)->config),e))
#define XETrapGetCurFlagCursor(cur,e) \
(XETrapGetCfgFlagCursor(&((cur)->config),e))
#define XETrapGetCurFlagXInput(cur,e) \
(XETrapGetCfgFlagXInput(&((cur)->config),e))
#define XETrapGetCurFlagColorReplies(cur,e) \
(XETrapGetCfgFlagColorReplies(&((cur)->config),e))
#define XETrapGetCurFlagGrabServer(cur,e) \
(XETrapGetCfgFlagGrabServer(&((cur)->config),e))
/* Request values are in "Xproto.h" of the flavor X_RequestType */
#define XETrapGetCurFlagReq(cur,r) (XETrapGetCfgFlagReq(&((cur)->config),r))
/* Event types are in "X.h" of the flavor EventType (e.g. KeyPress) */
#define XETrapGetCurFlagEvt(cur,e) (XETrapGetCfgFlagEvt(&((cur)->config),e))
/* Fields returned int the "GetStatistics" Request */
#define XETrapGetStatsReq(stat,e) ((stat)->requests[(e)])
#define XETrapGetStatsEvt(stat,e) ((stat)->events[(e)])
/* Fields returned in the "GetVersion" request */
#define XETrapGetVersRelease(vers) ((vers)->xtrap_release)
#define XETrapGetVersVersion(vers) ((vers)->xtrap_version)
#define XETrapGetVersRevision(vers) ((vers)->xtrap_revision)
/* Fields returned in the "GetLastInpTime" request */
#define XETrapGetLastInpTime(time_rep) ((time_rep)->last_time)
/* Expands to GET each element of the TCValues structure */
#define XETrapGetTCReqCB(tc) ((tc)->values.req_cb)
#define XETrapGetTCEvtCB(tc) ((tc)->values.evt_cb)
#define XETrapGetTCTime(tc) ((tc)->values.last_time)
/* TC specific flags */
#define XETrapGetTCLFlags(tc,a) \
memcpy((a), (tc)->values.tc_flags, sizeof((tc)->values.tc_flags))
#define XETrapGetTCFlagDeltaTimes(tc) \
(BitValue((tc)->values.tc_flags, XETCDeltaTimes))
#define XETrapGetTCFlagTrapActive(tc) \
(BitValue((tc)->values.tc_flags, XETCTrapActive))
#define XETrapGetTCMaxPktSize(tc) (XETrapGetCfgMaxPktSize(&((tc)->values.v)))
#define XETrapGetTCCmdKey(tc) (XETrapGetCfgCmdKey(&((tc)->values.v)))
/* Note: e is only pertinent for "valid" or "data" */
#define XETrapGetTCFlags(tc,e,a) (XETrapGetCfgFlags(&((tc)->values.v),e,a))
#define XETrapGetTCFlagTimestamp(tc,e) \
(XETrapGetCfgFlagTimestamp(&((tc)->values.v),e))
#define XETrapGetTCFlagCmd(tc,e) \
(XETrapGetCfgFlagCmd(&((tc)->values.v),e))
#define XETrapGetTCFlagCmdKeyMod(tc,e) \
(XETrapGetCfgFlagCmdKeyMod(&((tc)->values.v),e))
#define XETrapGetTCFlagRequest(tc,r) \
(XETrapGetCfgFlagRequest(&((tc)->values.v),r))
#define XETrapGetTCFlagEvent(tc,e) \
(XETrapGetCfgFlagEvent(&((tc)->values.v),e))
#define XETrapGetTCFlagMaxPacket(tc,e) \
(XETrapGetCfgFlagMaxPacket(&((tc)->values.v),e))
#define XETrapGetTCFlagStatistics(tc,e) \
(XETrapGetCfgFlagStatistics(&((tc)->values.v),e))
#define XETrapGetTCFlagWinXY(tc,e) \
(XETrapGetCfgFlagWinXY(&((tc)->values.v),e))
#define XETrapGetTCFlagCursor(tc,e) \
(XETrapGetCfgFlagCursor(&((tc)->values.v),e))
#define XETrapGetTCFlagXInput(tc,e) \
(XETrapGetCfgFlagXInput(&((tc)->values.v),e))
#define XETrapGetTCFlagColorReplies(tc,e) \
(XETrapGetCfgFlagColorReplies(&((tc)->values.v),e))
#define XETrapGetTCFlagGrabServer(tc,e) \
(XETrapGetCfgFlagGrabServer(&((tc)->values.v),e))
/* Request values are in "Xproto.h" of the flavor X_RequestType */
#define XETrapGetTCFlagReq(tc,r) \
(XETrapGetCfgFlagReq(&((tc)->values.v),r))
/* Event types are in "X.h" of the flavor EventType (e.g. KeyPress) */
#define XETrapGetTCFlagEvt(tc,e) \
(XETrapGetCfgFlagEvt(&((tc)->values.v),e))
/* The following can/should *not* be set directly! */
#define XETrapGetNext(tc) ((tc)->next)
#define XETrapGetDpy(tc) ((tc)->dpy)
#define XETrapGetEventBase(tc) ((tc)->eventBase)
#define XETrapGetErrorBase(tc) ((tc)->errorBase)
#define XETrapGetExtOpcode(tc) ((tc)->extOpcode)
#define XETrapGetXBuff(tc) ((tc)->xbuff)
#define XETrapGetXMaxSize(tc) ((tc)->xmax_size)
#define XETrapGetExt(tc) ((tc)->ext_data)
#define XETrapGetDirty(tc) ((tc)->dirty)
#define XETrapGetValues(tc) memcpy((x),(tc)->values,sizeof((tc)->values))
#define XETrapGetEventFunc(tc) ((tc)->eventFunc)
#define XETrapGetHeaderCount(phdr) ((phdr)->count)
#define XETrapGetHeaderTimestamp(phdr) ((phdr)->timestamp)
#define XETrapGetHeaderType(phdr) ((phdr)->type)
#define XETrapGetHeaderScreen(phdr) ((phdr)->screen)
#define XETrapGetHeaderWindowX(phdr) ((phdr)->win_x)
#define XETrapGetHeaderWindowY(phdr) ((phdr)->win_y)
#define XETrapGetHeaderClient(phdr) ((phdr)->client)
#define XEGetRelease(tc) ((tc)->release)
#define XEGetVersion(tc) ((tc)->version)
#define XEGetRevision(tc) ((tc)->revision)
/* Condition handling macros */
#if !defined(vms) && \
(!defined(_InitExceptionHandling) || !defined(_ClearExceptionHandling))
# ifndef _SetSIGBUSHandling
# ifdef SIGBUS
# define _SetSIGBUSHandling(rtn) (void)signal(SIGBUS, rtn)
# else
# define _SetSIGBUSHandling(rtn) /* */
# endif
# endif
# ifndef _SetSIGSEGVHandling
# ifdef SIGSEGV
# define _SetSIGSEGVHandling(rtn) (void)signal(SIGSEGV, rtn)
# else
# define _SetSIGSEGVHandling(rtn) /* */
# endif
# endif
# ifndef _SetSIGFPEHandling
# ifdef SIGFPE
# define _SetSIGFPEHandling(rtn) (void)signal(SIGFPE, rtn)
# else
# define _SetSIGFPEHandling(rtn) /* */
# endif
# endif
# ifndef _SetSIGILLHandling
# ifdef SIGILL
# define _SetSIGILLHandling(rtn) (void)signal(SIGILL, rtn)
# else
# define _SetSIGILLHandling(rtn) /* */
# endif
# endif
# ifndef _SetSIGSYSHandling
# ifdef SIGSYS
# define _SetSIGSYSHandling(rtn) (void)signal(SIGSYS, rtn)
# else
# define _SetSIGSYSHandling(rtn) /* */
# endif
# endif
# ifndef _SetSIGHUPHandling
# ifdef SIGHUP
# define _SetSIGHUPHandling(rtn) (void)signal(SIGHUP, rtn)
# else
# define _SetSIGHUPHandling(rtn) /* */
# endif
# endif
# ifndef _SetSIGPIPEHandling
# ifdef SIGPIPE
# define _SetSIGPIPEHandling(rtn) (void)signal(SIGPIPE, rtn)
# else
# define _SetSIGPIPEHandling(rtn) /* */
# endif
# endif
# ifndef _SetSIGTERMHandling
# ifdef SIGTERM
# define _SetSIGTERMHandling(rtn) (void)signal(SIGTERM, rtn)
# else
# define _SetSIGTERMHandling(rtn) /* */
# endif
# endif
#endif
#ifndef _InitExceptionHandling
#ifdef vms
#define _InitExceptionHandling(rtn) \
VAXC$ESTABLISH(rtn) /* VMS exception handler */
#else /* vms */
#define _InitExceptionHandling(rtn) \
_SetSIGBUSHandling(rtn); /* Bus error */ \
_SetSIGSEGVHandling(rtn); /* Accvio/Segment error */ \
_SetSIGFPEHandling(rtn); /* Floating point exception */ \
_SetSIGILLHandling(rtn); /* Illegal instruction */ \
_SetSIGSYSHandling(rtn); /* Param error in sys call */ \
_SetSIGHUPHandling(rtn); \
_SetSIGPIPEHandling(rtn); \
_SetSIGTERMHandling(rtn)
#endif /* vms */
#endif /* _InitExceptionHandling */
#ifndef _ClearExceptionHandling
#ifdef vms
#define _ClearExceptionHandling() \
LIB$REVERT()
#else
#define _ClearExceptionHandling() \
_SetSIGBUSHandling(SIG_DFL); /* Bus error */ \
_SetSIGSEGVHandling(SIG_DFL); /* Accvio/Segment error */ \
_SetSIGFPEHandling(SIG_DFL); /* Floating point exception */ \
_SetSIGILLHandling(SIG_DFL); /* Illegal instruction */ \
_SetSIGSYSHandling(SIG_DFL); /* Param error in sys call */ \
_SetSIGHUPHandling(SIG_DFL); \
_SetSIGPIPEHandling(SIG_DFL); \
_SetSIGTERMHandling(SIG_DFL)
#endif /* vms */
#endif /* _ClearExceptionHandling */
#endif /* __XTRAPEMACROS__ */
/* $XFree86$ */
#ifndef __XTRAPLIB__
#define __XTRAPLIB__
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp.,
Maynard, MA
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.
*****************************************************************************/
/*
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Dan Coutu
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
* DESCRIPTION:
* This header file describes all the structures/constants required
* for interfacing with the client toolkit *except* the common
* client/extension definitions in xtrapdi.h. Namely, *no* extension-
* only information or client/extension information can be found here.
*/
#ifdef SMT
#define NEED_EVENTS
#define NEED_REPLIES
#endif
#include <nx-X11/Xlib.h>
#include <nx-X11/Intrinsic.h>
#include <nx-X11/extensions/xtrapdi.h>
#include <nx-X11/extensions/xtrapemacros.h>
typedef struct /* Callback structure */
{
void_function func;
BYTE *data;
} XETrapCB;
/* Data structure for setting trap context */
typedef struct
{
CARD8 tc_flags[2L]; /* Toolkit-side specific flags */
XETrapCfg v; /* XTrap configuration values */
XETrapCB *req_cb; /* Pointer to Request Callbacks */
XETrapCB *evt_cb; /* Pointer to Event Callbacks (starting at 2) */
CARD32 last_time B32; /* Last (delta) timestamp */
} XETCValues;
/* bits 0 thru 6 are formerly "families" (now obsolete) */
#define XETCDeltaTimes 7
#define XETCTrapActive 8
/* bits 9 thru 15 are reserved for future expansion */
/* Values bit masks (used when determining what's dirty */
#define TCStatistics (1L<<0L)
#define TCRequests (1L<<1L)
#define TCEvents (1L<<2L)
#define TCMaxPacket (1L<<3L)
#define TCCmdKey (1L<<4L)
#define TCTimeStamps (1L<<5L)
#define TCWinXY (1L<<6L)
#define TCXInput (1L<<7L)
#define TCReqCBs (1L<<8L)
#define TCEvtCBs (1L<<9L)
#define TCCursor (1L<<10L)
#define TCColorReplies (1L<<11L)
#define TCGrabServer (1L<<12L)
/* This is the representation we use in the library code for XLib transport */
typedef struct {
int type;
unsigned long serial;
Bool synthetic;
Display *display;
int detail;
unsigned long idx;
unsigned char data[sz_EventData];
} XETrapDataEvent;
/* Trap Context structure for maintaining XTrap State for client */
typedef struct _XETC
{
struct _XETC *next; /* Ptr to next linked-listed TC */
Display *dpy; /* Display ptr of current TC */
INT32 eventBase /*B32*/; /* First event value */
INT32 errorBase /*B32*/; /* First error value */
INT32 extOpcode /*B32*/; /* Major opcode of the extension */
BYTE *xbuff; /* Pointer to buffer for XLib Communications */
CARD16 xmax_size /*B16*/; /* Max Size of a request */
XExtData *ext_data; /* hook for extension to hang data */
/*
* The following are initialized with the client-side version number
* However, when either a GetAvailable or GetVersion reply is received,
* these values are updated with the *oldest* version numbers.
*/
CARD16 release /*B16*/; /* The extension release number */
CARD16 version /*B16*/; /* The xtrap extension version number */
CARD16 revision /*B16*/; /* The xtrap extension revision number */
CARD16 protocol /*B16*/; /* The xtrap extension protocol number */
unsigned dirty /*B32*/; /* cache dirty bits */
XETCValues values; /* shadow structure of values */
Boolean (*eventFunc[XETrapNumberEvents])(XETrapDataEvent *event, struct _XETC *tc);
} XETC;
#endif /* __XTRAPLIB__ */
/* $XFree86$ */
#ifndef __XTRAPLIBP__
#define __XTRAPLIBP__
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp.,
Maynard, MA
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.
*****************************************************************************/
/*
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Dan Coutu
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
* DESCRIPTION:
* This header file contains the function prototypes for client/toolkit
* routines sorted by module (globally defined routines *only*).
*/
/* XEConTxt.c */
XETC *XECreateTC (Display *dpy , CARD32 valuemask , XETCValues *value );
int XEChangeTC (XETC *tc , CARD32 mask , XETCValues *values );
void XEFreeTC (XETC *tc );
int XETrapSetMaxPacket (XETC *tc , Bool set_flag , CARD16 size );
int XETrapSetCommandKey (XETC *tc , Bool set_flag , KeySym cmd_key ,
Bool mod_flag );
int XETrapSetTimestamps (XETC *tc , Bool set_flag , Bool delta_flag );
int XETrapSetWinXY (XETC *tc , Bool set_flag );
int XETrapSetCursor (XETC *tc , Bool set_flag );
int XETrapSetXInput (XETC *tc , Bool set_flag );
int XETrapSetColorReplies (XETC *tc , Bool set_flag );
int XETrapSetGrabServer (XETC *tc , Bool set_flag );
int XETrapSetStatistics (XETC *tc , Bool set_flag );
int XETrapSetRequests (XETC *tc , Bool set_flag , ReqFlags requests );
int XETrapSetEvents (XETC *tc , Bool set_flag , EventFlags events );
Bool XESetCmdGateState (XETC *tc , CARD8 type, Bool *gate_closed ,
CARD8 *next_key , Bool *key_ignore );
/* XERqsts.c */
int XEFlushConfig (XETC *tc );
int XEResetRequest (XETC *tc );
int XEGetVersionRequest (XETC *tc , XETrapGetVersRep *ret );
int XEGetLastInpTimeRequest (XETC *tc , XETrapGetLastInpTimeRep *ret );
int XEGetAvailableRequest (XETC *tc , XETrapGetAvailRep *ret );
int XEStartTrapRequest (XETC *tc );
int XEStopTrapRequest (XETC *tc );
int XESimulateXEventRequest (XETC *tc , CARD8 type , CARD8 detail ,
CARD16 x , CARD16 y , CARD8 screen );
int XEGetCurrentRequest (XETC *tc , XETrapGetCurRep *ret );
int XEGetStatisticsRequest (XETC *tc , XETrapGetStatsRep *ret );
/* XECallBcks.c */
int XEAddRequestCB (XETC *tc , CARD8 req , void_function func , BYTE *data );
int XEAddRequestCBs (XETC *tc , ReqFlags req_flags , void_function func ,
BYTE *data );
int XEAddEventCB (XETC *tc , CARD8 evt , void_function func , BYTE *data );
int XEAddEventCBs (XETC *tc , EventFlags evt_flags , void_function func ,
BYTE *data );
/* The following seem to never be used. Perhaps they should be removed */
void XERemoveRequestCB (XETC *tc, CARD8 req);
void XERemoveRequestCBs (XETC *tc, ReqFlags req_flags);
void XERemoveAllRequestCBs (XETC *tc);
void XERemoveEventCB (XETC *tc, CARD8 evt);
void XERemoveEventCBs (XETC *tc, EventFlags evt_flags);
void XERemoveAllEventCBs (XETC *tc);
/* XEDsptch.c */
Boolean XETrapDispatchXLib (XETrapDataEvent *event , XETC *tc);
/* XEWrappers.c */
Boolean XETrapDispatchEvent (XEvent *pevent , XETC *tc );
XtInputMask XETrapAppPending (XtAppContext app);
void XETrapAppMainLoop (XtAppContext app , XETC *tc );
int XETrapAppWhileLoop (XtAppContext app , XETC *tc , Bool *done );
int XETrapWaitForSomething (XtAppContext app );
Boolean (*XETrapSetEventHandler(XETC *tc, CARD32 id, Boolean (*pfunc)(XETrapDataEvent *event, XETC *tc))) (XETrapDataEvent *event, XETC *tc);
/* XEPrInfo.c */
void XEPrintRelease (FILE *ofp , XETrapGetAvailRep *pavail );
void XEPrintTkRelease ( FILE *ofp, XETC *tc);
void XEPrintPlatform (FILE *ofp , XETrapGetAvailRep *pavail );
void XEPrintAvailFlags (FILE *ofp , XETrapGetAvailRep *pavail );
void XEPrintAvailPktSz (FILE *ofp , XETrapGetAvailRep *pavail );
void XEPrintStateFlags (FILE *ofp , XETrapGetCurRep *pcur );
void XEPrintMajOpcode (FILE *ofp , XETrapGetAvailRep *pavail );
void XEPrintCurXY (FILE *ofp , XETrapGetAvailRep *pavail );
void XEPrintTkFlags (FILE *ofp , XETC *tc );
void XEPrintLastTime (FILE *ofp , XETC *tc );
void XEPrintCfgFlags (FILE *ofp , XETrapGetCurRep *pcur );
void XEPrintRequests (FILE *ofp , XETrapGetCurRep *pcur );
void XEPrintEvents (FILE *ofp , XETrapGetCurRep *pcur );
void XEPrintCurPktSz (FILE *ofp , XETrapGetCurRep *pcur );
void XEPrintCmdKey (FILE *ofp , XETrapGetCurRep *pcur );
void XEPrintEvtStats (FILE *ofp , XETrapGetStatsRep *pstats , XETC *tc);
void XEPrintReqStats (FILE *ofp , XETrapGetStatsRep *pstats , XETC *tc);
void XEPrintAvail (FILE *ofp , XETrapGetAvailRep *pavail );
void XEPrintTkState (FILE *ofp , XETC *tc );
void XEPrintCurrent (FILE *ofp , XETrapGetCurRep *pcur );
void XEPrintStatistics (FILE *ofp , XETrapGetStatsRep *pstats, XETC *tc );
/* XEStrMap.c */
INT16 XEEventStringToID (char *string );
INT16 XERequestStringToID (char *string );
CARD32 XEPlatformStringToID (char *string );
char *XEEventIDToString (CARD8 id , XETC *tc);
char *XERequestIDToExtString (register CARD8 id , XETC *tc);
char *XERequestIDToString (CARD8 id , XETC *tc);
char *XEPlatformIDToString (CARD32 id );
/* XETrapInit.c */
Bool XETrapQueryExtension (Display *dpy,INT32 *event_base_return,
INT32 *error_base_return, INT32 *opcode_return);
#endif /* __XTRAPLIBP__ */
/* $XFree86: xc/include/extensions/xtrapproto.h,v 1.1 2001/11/02 23:29:26 dawes Exp $ */
#ifndef __XTRAPPROTO__
#define __XTRAPPROTO__
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
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.
*****************************************************************************/
/*
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Dan Coutu
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
* DESCRIPTION:
* This header file contains the function prototypes for extension
* routines sorted by module (globally defined routines *only*).
*/
#ifndef Bool
# define Bool int
#endif
/* xtrapdi.c */
int XETrapDestroyEnv (void * value , XID id );
void XETrapCloseDown ( ExtensionEntry *extEntry );
Bool XETrapRedirectDevices (void );
void DEC_XTRAPInit (void );
int XETrapCreateEnv (ClientPtr client );
int XETrapDispatch (ClientPtr client );
int sXETrapDispatch (ClientPtr client );
int XETrapReset (xXTrapReq *request , ClientPtr client );
int XETrapGetAvailable (xXTrapGetReq *request , ClientPtr client );
int XETrapGetCurrent (xXTrapReq *request , ClientPtr client );
int XETrapGetStatistics (xXTrapReq *request , ClientPtr client );
int XETrapConfig (xXTrapConfigReq *request , ClientPtr client );
int XETrapStartTrap (xXTrapReq *request , ClientPtr client );
int XETrapStopTrap (xXTrapReq *request , ClientPtr client );
int XETrapGetVersion (xXTrapGetReq *request , ClientPtr client );
int XETrapGetLastInpTime (xXTrapReq *request , ClientPtr client );
int XETrapRequestVector (ClientPtr client );
int XETrapKeyboard (xEvent *x_event , DevicePtr keybd , int count );
#ifndef VECTORED_EVENTS
int XETrapPointer (xEvent *x_event , DevicePtr ptrdev , int count );
#else
int XETrapEventVector (ClientPtr client , xEvent *x_event );
#endif
void XETrapStampAndMail (xEvent *x_event );
void sReplyXTrapDispatch (ClientPtr client , int size , char *reply );
int XETrapWriteXLib (XETrapEnv *penv , BYTE *data , CARD32 nbytes );
/* xtrapddmi.c */
void XETrapPlatformSetup (void );
int XETrapSimulateXEvent (xXTrapInputReq *request , ClientPtr client );
/* xtrapdiswap.c */
int sXETrapReset (xXTrapReq *request , ClientPtr client );
int sXETrapGetAvailable (xXTrapGetReq *request , ClientPtr client );
int sXETrapConfig (xXTrapConfigReq *request , ClientPtr client );
int sXETrapStartTrap (xXTrapReq *request , ClientPtr client );
int sXETrapStopTrap (xXTrapReq *request , ClientPtr client );
int sXETrapGetCurrent (xXTrapReq *request , ClientPtr client );
int sXETrapGetStatistics (xXTrapReq *request , ClientPtr client );
int sXETrapSimulateXEvent (xXTrapInputReq *request , ClientPtr client );
int sXETrapGetVersion (xXTrapGetReq *request , ClientPtr client );
int sXETrapGetLastInpTime (xXTrapReq *request , ClientPtr client );
void sReplyXETrapGetAvail (ClientPtr client , int size , char *reply );
void sReplyXETrapGetVers (ClientPtr client , int size , char *reply );
void sReplyXETrapGetLITim (ClientPtr client , int size , char *reply );
void sReplyXETrapGetCur (ClientPtr client , int size , char *reply );
void sReplyXETrapGetStats (ClientPtr client , int size , char *reply );
void sXETrapHeader (XETrapHeader *hdr );
void XETSwSimpleReq (xReq *data );
void XETSwResourceReq (xResourceReq *data );
void XETSwCreateWindow (xCreateWindowReq *data , ClientPtr client );
void XETSwChangeWindowAttributes (xChangeWindowAttributesReq *data , ClientPtr client );
void XETSwReparentWindow (xReparentWindowReq *data );
void XETSwConfigureWindow (xConfigureWindowReq *data , ClientPtr client );
void XETSwInternAtom (xInternAtomReq *data );
void XETSwChangeProperty (xChangePropertyReq *data );
void XETSwDeleteProperty (xDeletePropertyReq *data );
void XETSwGetProperty (xGetPropertyReq *data );
void XETSwSetSelectionOwner (xSetSelectionOwnerReq *data );
void XETSwConvertSelection (xConvertSelectionReq *data );
void XETSwSendEvent (xSendEventReq *data );
void XETSwGrabPointer (xGrabPointerReq *data );
void XETSwGrabButton (xGrabButtonReq *data );
void XETSwUngrabButton (xUngrabButtonReq *data );
void XETSwChangeActivePointerGrab (xChangeActivePointerGrabReq *data );
void XETSwGrabKeyboard (xGrabKeyboardReq *data );
void XETSwGrabKey (xGrabKeyReq *data );
void XETSwUngrabKey (xUngrabKeyReq *data );
void XETSwGetMotionEvents (xGetMotionEventsReq *data );
void XETSwTranslateCoords (xTranslateCoordsReq *data );
void XETSwWarpPointer (xWarpPointerReq *data );
void XETSwSetInputFocus (xSetInputFocusReq *data );
void XETSwOpenFont (xOpenFontReq *data );
void XETSwListFonts (xListFontsReq *data );
void XETSwListFontsWithInfo (xListFontsWithInfoReq *data );
void XETSwSetFontPath (xSetFontPathReq *data );
void XETSwCreatePixmap (xCreatePixmapReq *data );
void XETSwCreateGC (xCreateGCReq *data , ClientPtr client );
void XETSwChangeGC (xChangeGCReq *data , ClientPtr client );
void XETSwCopyGC (xCopyGCReq *data );
void XETSwSetDashes (xSetDashesReq *data );
void XETSwSetClipRectangles (xSetClipRectanglesReq *data , ClientPtr client );
void XETSwClearToBackground (xClearAreaReq *data );
void XETSwCopyArea (xCopyAreaReq *data );
void XETSwCopyPlane (xCopyPlaneReq *data );
void XETSwPoly (xPolyPointReq *data , ClientPtr client );
void XETSwFillPoly (xFillPolyReq *data , ClientPtr client );
void XETSwPutImage (xPutImageReq *data );
void XETSwGetImage (xGetImageReq *data );
void XETSwPolyText (xPolyTextReq *data );
void XETSwImageText (xImageTextReq *data );
void XETSwCreateColormap (xCreateColormapReq *data );
void XETSwCopyColormapAndFree (xCopyColormapAndFreeReq *data );
void XETSwAllocColor (xAllocColorReq *data );
void XETSwAllocNamedColor (xAllocNamedColorReq *data );
void XETSwAllocColorCells (xAllocColorCellsReq *data );
void XETSwAllocColorPlanes (xAllocColorPlanesReq *data );
void XETSwFreeColors (xFreeColorsReq *data , ClientPtr client );
void XETSwStoreColors (xStoreColorsReq *data , ClientPtr client );
void XETSwStoreNamedColor (xStoreNamedColorReq *data );
void XETSwQueryColors (xQueryColorsReq *data , ClientPtr client );
void XETSwLookupColor (xLookupColorReq *data );
void XETSwCreateCursor (xCreateCursorReq *data );
void XETSwCreateGlyphCursor (xCreateGlyphCursorReq *data );
void XETSwRecolorCursor (xRecolorCursorReq *data );
void XETSwQueryBestSize (xQueryBestSizeReq *data );
void XETSwQueryExtension (xQueryExtensionReq *data );
void XETSwChangeKeyboardMapping (xChangeKeyboardMappingReq *data );
void XETSwChangeKeyboardControl (xChangeKeyboardControlReq *data , ClientPtr client );
void XETSwChangePointerControl (xChangePointerControlReq *data );
void XETSwSetScreenSaver (xSetScreenSaverReq *data );
void XETSwChangeHosts (xChangeHostsReq *data );
void XETSwRotateProperties (xRotatePropertiesReq *data , ClientPtr client );
void XETSwNoOperation (xReq *data );
#ifdef vms
void SwapLongs (long *list , unsigned long count );
void SwapShorts (short *list , unsigned long count );
int SwapColorItem (xColorItem *pItem );
#endif /* vms */
#endif /* __XTRAPPROTO__ */
......@@ -31,12 +31,12 @@ ALLOC_DEFINES = Malloc0ReturnsNullDefines
DEFINES = $(ALLOC_DEFINES)
INCLUDES = -I$(XLIBSRC)
SRCS = globals.c extutil.c XMultibuf.c XShape.c $(SHMSRCS) \
MITMisc.c XTestExt1.c XSync.c Xdbe.c XLbx.c \
XSecurity.c XAppgroup.c Xcup.c DPMS.c XEVI.c
OBJS = globals.o extutil.o XMultibuf.o XShape.o $(SHMOBJS) \
MITMisc.o XTestExt1.o XSync.o Xdbe.o XLbx.o \
XSecurity.o XAppgroup.o Xcup.o DPMS.o XEVI.o
SRCS = globals.c extutil.c XShape.c $(SHMSRCS) \
XTestExt1.c XSync.c \
XSecurity.c DPMS.c
OBJS = globals.o extutil.o XShape.o $(SHMOBJS) \
XTestExt1.o XSync.o \
XSecurity.o DPMS.o
LINTLIBS = $(LINTXLIB)
#include <Library.tmpl>
......
/*
* $Xorg: MITMisc.c,v 1.4 2001/02/09 02:03:49 xorgcvs Exp $
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
*/
/* $XFree86: xc/lib/Xext/MITMisc.c,v 1.3 2002/10/16 00:37:27 dawes Exp $ */
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */
#define NEED_REPLIES
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <nx-X11/Xlibint.h>
#include <nx-X11/extensions/MITMisc.h>
#include <nx-X11/extensions/mitmiscstr.h>
#include <nx-X11/extensions/Xext.h>
#include <nx-X11/extensions/extutil.h>
static XExtensionInfo _mit_info_data;
static XExtensionInfo *mit_info = &_mit_info_data;
static /* const */ char *mit_extension_name = MITMISCNAME;
#define MITCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, mit_extension_name, val)
/*****************************************************************************
* *
* private utility routines *
* *
*****************************************************************************/
static int close_display(Display *dpy, XExtCodes *codes);
static /* const */ XExtensionHooks mit_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL /* error_string */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, mit_info, mit_extension_name,
&mit_extension_hooks, MITMiscNumberEvents,
NULL)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, mit_info)
/*****************************************************************************
* *
* public routines *
* *
*****************************************************************************/
Bool XMITMiscQueryExtension (Display *dpy, int *event_basep, int *error_basep)
{
XExtDisplayInfo *info = find_display (dpy);
if (XextHasExtension(info)) {
*event_basep = info->codes->first_event;
*error_basep = info->codes->first_error;
return True;
} else {
return False;
}
}
Status XMITMiscSetBugMode(Display *dpy, Bool onOff)
{
XExtDisplayInfo *info = find_display (dpy);
register xMITSetBugModeReq *req;
MITCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(MITSetBugMode, req);
req->reqType = info->codes->major_opcode;
req->mitReqType = X_MITSetBugMode;
req->onOff = onOff;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
Bool XMITMiscGetBugMode(Display *dpy)
{
XExtDisplayInfo *info = find_display (dpy);
register xMITGetBugModeReq *req;
xMITGetBugModeReply rep;
MITCheckExtension (dpy, info, 0);
LockDisplay(dpy);
GetReq(MITGetBugMode, req);
req->reqType = info->codes->major_opcode;
req->mitReqType = X_MITGetBugMode;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
UnlockDisplay(dpy);
SyncHandle();
return rep.onOff;
}
/* $XFree86: xc/lib/Xext/XAppgroup.c,v 1.11 2002/10/16 02:19:22 dawes Exp $ */
/*
Copyright 1996, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $Xorg: XAppgroup.c,v 1.5 2001/02/09 02:03:49 xorgcvs Exp $ */
#ifdef WIN32
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <nx-X11/Xwindows.h>
#endif
#define NEED_EVENTS
#define NEED_REPLIES
#include <nx-X11/Xlibint.h>
#include <nx-X11/extensions/Xagstr.h>
#include <nx-X11/extensions/Xext.h>
#include <nx-X11/extensions/extutil.h>
#include <stdarg.h>
struct xagstuff {
int attrib_mask;
Bool app_group_leader;
Bool single_screen;
Window default_root;
VisualID root_visual;
Colormap default_colormap;
unsigned long black_pixel;
unsigned long white_pixel;
};
static XExtensionInfo _xag_info_data;
static XExtensionInfo *xag_info = &_xag_info_data;
static char *xag_extension_name = XAGNAME;
#define XagCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, xag_extension_name, val)
/*****************************************************************************
* *
* private utility routines *
* *
*****************************************************************************/
static int close_display(Display *dpy, XExtCodes *codes);
static /* const */ XExtensionHooks xag_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, xag_info,
xag_extension_name,
&xag_extension_hooks,
0, NULL)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xag_info)
/*****************************************************************************
* *
* public Xag Extension routines *
* *
*****************************************************************************/
Bool
XagQueryVersion(
Display *dpy,
int *major_version_return,
int *minor_version_return)
{
XExtDisplayInfo *info = find_display (dpy);
xXagQueryVersionReply rep;
xXagQueryVersionReq *req;
XagCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(XagQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->xagReqType = X_XagQueryVersion;
req->client_major_version = XAG_MAJOR_VERSION;
req->client_minor_version = XAG_MINOR_VERSION;
if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
*major_version_return = rep.server_major_version;
*minor_version_return = rep.server_minor_version;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
static void
StuffToWire (Display *dpy, struct xagstuff *stuff, xXagCreateReq *req)
{
unsigned long values[8];
unsigned long* value = values;
unsigned int nvalues;
/* the order these are in is important */
if (stuff->attrib_mask & XagSingleScreenMask)
*value++ = stuff->single_screen;
if (stuff->attrib_mask & XagDefaultRootMask)
*value++ = stuff->default_root;
if (stuff->attrib_mask & XagRootVisualMask)
*value++ = stuff->root_visual;
if (stuff->attrib_mask & XagDefaultColormapMask)
*value++ = stuff->default_colormap;
if (stuff->attrib_mask & XagBlackPixelMask)
*value++ = stuff->black_pixel;
if (stuff->attrib_mask & XagWhitePixelMask)
*value++ = stuff->white_pixel;
if (stuff->attrib_mask & XagAppGroupLeaderMask)
*value++ = stuff->app_group_leader;
req->length += (nvalues = value - values);
nvalues <<= 2;
Data32 (dpy, (long*) values, (long) nvalues);
}
Bool
XagCreateEmbeddedApplicationGroup(
Display* dpy,
VisualID root_visual,
Colormap default_colormap,
unsigned long black_pixel,
unsigned long white_pixel,
XAppGroup* app_group_return)
{
XExtDisplayInfo *info = find_display (dpy);
xXagCreateReq *req;
struct xagstuff stuff;
XagCheckExtension (dpy, info, False);
LockDisplay(dpy);
stuff.app_group_leader = True;
stuff.single_screen = True;
stuff.default_root = RootWindow (dpy, DefaultScreen(dpy));
stuff.root_visual = root_visual;
stuff.default_colormap = default_colormap;
stuff.attrib_mask =
XagAppGroupLeaderMask | XagSingleScreenMask | XagDefaultRootMask |
XagRootVisualMask | XagDefaultColormapMask;
if (default_colormap != None) {
stuff.black_pixel = black_pixel;
stuff.white_pixel = white_pixel;
stuff.attrib_mask |= XagBlackPixelMask | XagWhitePixelMask;
}
/* might do some validation here */
GetReq(XagCreate, req);
req->reqType = info->codes->major_opcode;
req->xagReqType = X_XagCreate;
*app_group_return = req->app_group = XAllocID(dpy);
req->attrib_mask = stuff.attrib_mask;
StuffToWire (dpy, &stuff, req);
UnlockDisplay(dpy);
SyncHandle();
return True;
}
Bool
XagCreateNonembeddedApplicationGroup(
Display* dpy,
XAppGroup* app_group_return)
{
XExtDisplayInfo *info = find_display (dpy);
xXagCreateReq *req;
struct xagstuff stuff;
XagCheckExtension (dpy, info, False);
LockDisplay(dpy);
stuff.app_group_leader = False;
stuff.single_screen = False;
stuff.attrib_mask = XagAppGroupLeaderMask | XagSingleScreenMask;
/* might do some validation here */
GetReq(XagCreate, req);
req->reqType = info->codes->major_opcode;
req->xagReqType = X_XagCreate;
*app_group_return = req->app_group = XAllocID(dpy);
req->attrib_mask = stuff.attrib_mask;
StuffToWire (dpy, &stuff, req);
UnlockDisplay(dpy);
SyncHandle();
return True;
}
Bool XagDestroyApplicationGroup(Display* dpy, XAppGroup app_group)
{
XExtDisplayInfo *info = find_display (dpy);
xXagDestroyReq *req;
XagCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(XagDestroy, req);
req->reqType = info->codes->major_opcode;
req->xagReqType = X_XagDestroy;
req->app_group = app_group;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
Bool
XagGetApplicationGroupAttributes(Display* dpy, XAppGroup app_group, ...)
{
va_list var;
XExtDisplayInfo *info = find_display (dpy);
xXagGetAttrReq *req;
xXagGetAttrReply rep;
int attr;
XagCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(XagGetAttr, req);
req->reqType = info->codes->major_opcode;
req->xagReqType = X_XagGetAttr;
req->app_group = app_group;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
va_start (var, app_group);
for (attr = va_arg(var, int); attr != 0; attr = va_arg(var, int)) {
void* ptr;
switch (attr) {
case XagNappGroupLeader:
ptr = va_arg(var, void*);
*(Bool*)ptr = rep.app_group_leader;
break;
case XagNsingleScreen:
ptr = va_arg(var, void*);
*(Bool*)ptr = rep.single_screen;
break;
case XagNdefaultRoot:
ptr = va_arg(var, void*);
*(Window*)ptr = rep.default_root;
break;
case XagNrootVisual:
ptr = va_arg(var, void*);
*(VisualID*)ptr = rep.root_visual;
break;
case XagNdefaultColormap:
ptr = va_arg(var, void*);
*(Colormap*)ptr = rep.default_colormap;
break;
case XagNblackPixel:
ptr = va_arg(var, void*);
*(unsigned long*)ptr = rep.black_pixel;
break;
case XagNwhitePixel:
ptr = va_arg(var, void*);
*(unsigned long*)ptr = rep.white_pixel;
break;
}
}
va_end (var);
UnlockDisplay(dpy);
SyncHandle();
return True;
}
Bool
XagQueryApplicationGroup(
Display* dpy,
XID resource,
XAppGroup* app_group_return)
{
XExtDisplayInfo *info = find_display (dpy);
xXagQueryReq *req;
xXagQueryReply rep;
XagCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(XagQuery, req);
req->reqType = info->codes->major_opcode;
req->xagReqType = X_XagQuery;
req->resource = resource;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
*app_group_return = rep.app_group;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
Bool
XagCreateAssociation(Display* dpy, Window* window_return, void* system_window)
{
#ifdef WIN32
long tmp = *(HWND*) system_window;
XExtDisplayInfo *info = find_display (dpy);
xXagCreateAssocReq *req;
XagCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(XagCreateAssoc, req);
req->reqType = info->codes->major_opcode;
req->xagReqType = X_XagCreateAssoc;
*window_return = req->window = XAllocID(dpy);
req->window_type = XagWindowTypeWin32;
req->system_window_len = sizeof(HWND);
Data32 (dpy, (long*) tmp, 1L);
req->length++;
UnlockDisplay(dpy);
SyncHandle();
#else
/* other platforms go here */
/* this whole thing could be arranged better, but since X need
* only short-circuit the protocol and WIN32 is the only other
* platform the XC supports, it will suffice for now.
*/
*window_return = *(Window*)system_window;
#endif
return True;
}
Bool
XagDestroyAssociation(Display* dpy, Window window)
{
#ifdef WIN32
XExtDisplayInfo *info = find_display (dpy);
xXagDestroyAssocReq *req;
XagCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(XagDestroyAssoc, req);
req->reqType = info->codes->major_opcode;
req->xagReqType = X_XagDestroyAssoc;
req->window = window;
UnlockDisplay(dpy);
SyncHandle();
#endif
return True;
}
/* $Xorg: XEVI.c,v 1.3 2000/08/17 19:45:51 cpqbld Exp $ */
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/* $XFree86$ */
#define NEED_EVENTS
#define NEED_REPLIES
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <nx-X11/Xlibint.h>
#include <nx-X11/extensions/XEVI.h>
#include <nx-X11/extensions/XEVIstr.h>
#include <nx-X11/extensions/Xext.h>
#include <nx-X11/extensions/extutil.h>
#include <nx-X11/Xutil.h>
static XExtensionInfo *xevi_info;/* needs to move to globals.c */
static /* const */ char *xevi_extension_name = EVINAME;
#define XeviCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, xevi_extension_name, val)
/*****************************************************************************
* *
* private utility routines *
* *
*****************************************************************************/
static /* const */ XExtensionHooks xevi_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
NULL, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, xevi_info,
xevi_extension_name,
&xevi_extension_hooks, 0, NULL)
Bool XeviQueryExtension (Display *dpy)
{
XExtDisplayInfo *info = find_display (dpy);
if (XextHasExtension(info)) {
return True;
} else {
return False;
}
}
Bool XeviQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
{
XExtDisplayInfo *info = find_display (dpy);
xEVIQueryVersionReply rep;
register xEVIQueryVersionReq *req;
XeviCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(EVIQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->xeviReqType = X_EVIQueryVersion;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
*majorVersion = rep.majorVersion;
*minorVersion = rep.minorVersion;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
static Bool notInList(VisualID32 *visual, int sz_visual, VisualID newVisualid)
{
while (sz_visual-- > 0) {
if (*visual == newVisualid)
return False;
visual++;
}
return True;
}
Status XeviGetVisualInfo(
register Display *dpy,
VisualID *visual,
int n_visual,
ExtendedVisualInfo **evi_return,
int *n_info_return)
{
XExtDisplayInfo *info = find_display (dpy);
register xEVIGetVisualInfoReq *req;
xEVIGetVisualInfoReply rep;
int sz_info, sz_xInfo, sz_conflict, sz_xConflict;
VisualID32 *temp_conflict, *temp_visual, *xConflictPtr;
VisualID *conflict;
xExtendedVisualInfo *temp_xInfo;
XVisualInfo *vinfo;
register ExtendedVisualInfo *infoPtr;
register xExtendedVisualInfo *xInfoPtr;
register int n_data, visualIndex, vinfoIndex;
Bool isValid;
XeviCheckExtension (dpy, info, 0);
*n_info_return = 0;
*evi_return = NULL;
vinfo = XGetVisualInfo(dpy, 0, NULL, &sz_info);
if (!vinfo) {
return BadValue;
}
if (!n_visual || !visual) { /* copy the all visual */
temp_visual = (VisualID32 *)Xmalloc(sz_VisualID32 * sz_info);
n_visual = 0;
for (vinfoIndex = 0; vinfoIndex < sz_info; vinfoIndex++)
if (notInList(temp_visual, n_visual, vinfo[vinfoIndex].visualid))
temp_visual[n_visual++] = vinfo[vinfoIndex].visualid;
}
else { /* check if the visual is valid */
for (visualIndex = 0; visualIndex < n_visual; visualIndex++) {
isValid = False;
for (vinfoIndex = 0; vinfoIndex < sz_info; vinfoIndex++) {
if (visual[visualIndex] == vinfo[vinfoIndex].visualid) {
isValid = True;
break;
}
}
if (!isValid) {
XFree(vinfo);
return BadValue;
}
}
temp_visual = (VisualID32 *)Xmalloc(sz_VisualID32 * n_visual);
for (visualIndex = 0; visualIndex < n_visual; visualIndex++)
temp_visual[visualIndex] = visual[visualIndex];
}
XFree(vinfo);
LockDisplay(dpy);
GetReq(EVIGetVisualInfo, req);
req->reqType = info->codes->major_opcode;
req->xeviReqType = X_EVIGetVisualInfo;
req->n_visual = n_visual;
SetReqLen(req, n_visual, 1);
Data(dpy, (char *)temp_visual, n_visual * sz_VisualID32);
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
Xfree(temp_visual);
return BadAccess;
}
Xfree(temp_visual);
sz_info = rep.n_info * sizeof(ExtendedVisualInfo);
sz_xInfo = rep.n_info * sz_xExtendedVisualInfo;
sz_conflict = rep.n_conflicts * sizeof(VisualID);
sz_xConflict = rep.n_conflicts * sz_VisualID32;
infoPtr = *evi_return = (ExtendedVisualInfo *)Xmalloc(sz_info + sz_conflict);
xInfoPtr = temp_xInfo = (xExtendedVisualInfo *)Xmalloc(sz_xInfo);
xConflictPtr = temp_conflict = (VisualID32 *)Xmalloc(sz_xConflict);
if (!*evi_return || !temp_xInfo || !temp_conflict) {
_XEatData(dpy, (sz_xInfo + sz_xConflict + 3) & ~3);
UnlockDisplay(dpy);
SyncHandle();
if (evi_return)
Xfree(evi_return);
if (temp_xInfo)
Xfree(temp_xInfo);
if (temp_conflict)
Xfree(temp_conflict);
return BadAlloc;
}
_XRead(dpy, (char *)temp_xInfo, sz_xInfo);
_XRead(dpy, (char *)temp_conflict, sz_xConflict);
UnlockDisplay(dpy);
SyncHandle();
n_data = rep.n_info;
conflict = (VisualID *)(infoPtr + n_data);
while (n_data-- > 0) {
infoPtr->core_visual_id = xInfoPtr->core_visual_id;
infoPtr->screen = xInfoPtr->screen;
infoPtr->level = xInfoPtr->level;
infoPtr->transparency_type = xInfoPtr->transparency_type;
infoPtr->transparency_value = xInfoPtr->transparency_value;
infoPtr->min_hw_colormaps = xInfoPtr->min_hw_colormaps;
infoPtr->max_hw_colormaps = xInfoPtr->max_hw_colormaps;
infoPtr->num_colormap_conflicts = xInfoPtr->num_colormap_conflicts;
infoPtr->colormap_conflicts = conflict;
conflict += infoPtr->num_colormap_conflicts;
infoPtr++;
xInfoPtr++;
}
n_data = rep.n_conflicts;
conflict = (VisualID *)(infoPtr);
while (n_data-- > 0)
*conflict++ = *xConflictPtr++;
Xfree(temp_xInfo);
Xfree(temp_conflict);
*n_info_return = rep.n_info;
return Success;
}
/*
* $Xorg: XLbx.c,v 1.3 2000/08/17 19:45:51 cpqbld Exp $
*
* Copyright 1992 Network Computing Devices
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of NCD. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. NCD. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, Network Computing Devices
*/
/* $XFree86: xc/lib/Xext/XLbx.c,v 1.4 2002/10/16 00:37:27 dawes Exp $ */
#define NEED_EVENTS
#define NEED_REPLIES
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <nx-X11/Xlibint.h>
#include <nx-X11/extensions/XLbx.h>
#include <nx-X11/extensions/lbxstr.h>
#include <nx-X11/extensions/Xext.h>
#include <nx-X11/extensions/extutil.h>
static XExtensionInfo _lbx_info_data;
static XExtensionInfo *lbx_info = &_lbx_info_data;
static /* const */ char *lbx_extension_name = LBXNAME;
#define LbxCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, lbx_extension_name, val)
static int close_display(Display *dpy, XExtCodes *codes);
static char *error_string(Display *dpy, int code, XExtCodes *codes,
char *buf, int n);
static /* const */ XExtensionHooks lbx_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
error_string, /* error_string */
};
static /* const */ char *lbx_error_list[] = {
"BadLbxClient", /* BadLbxClient */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, lbx_info, lbx_extension_name,
&lbx_extension_hooks, LbxNumberEvents, NULL)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, lbx_info)
static XEXT_GENERATE_ERROR_STRING (error_string, lbx_extension_name,
LbxNumberErrors, lbx_error_list)
Bool XLbxQueryExtension (
Display *dpy,
int *requestp, int *event_basep, int *error_basep)
{
XExtDisplayInfo *info = find_display (dpy);
if (XextHasExtension(info)) {
*requestp = info->codes->major_opcode;
*event_basep = info->codes->first_event;
*error_basep = info->codes->first_error;
return True;
} else {
return False;
}
}
int XLbxGetEventBase(Display *dpy)
{
XExtDisplayInfo *info = find_display (dpy);
if (XextHasExtension(info)) {
return info->codes->first_event;
} else {
return -1;
}
}
Bool XLbxQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
{
XExtDisplayInfo *info = find_display (dpy);
xLbxQueryVersionReply rep;
register xLbxQueryVersionReq *req;
LbxCheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(LbxQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->lbxReqType = X_LbxQueryVersion;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
*majorVersion = rep.majorVersion;
*minorVersion = rep.minorVersion;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
/* all other requests will run after Xlib has lost the wire ... */
/*
* $Xorg: XMultibuf.c,v 1.6 2001/02/09 02:03:49 xorgcvs Exp $
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
* Authors: Jim Fulton, MIT X Consortium
*/
/* $XFree86: xc/lib/Xext/XMultibuf.c,v 1.5 2001/12/14 19:55:00 dawes Exp $ */
#define NEED_EVENTS
#define NEED_REPLIES
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <nx-X11/Xlibint.h>
#include <stdio.h>
#include <nx-X11/extensions/Xext.h>
#include <nx-X11/extensions/extutil.h>
#include <nx-X11/extensions/multibufst.h>
static XExtensionInfo _multibuf_info_data;
static XExtensionInfo *multibuf_info = &_multibuf_info_data;
static /* const */ char *multibuf_extension_name = MULTIBUFFER_PROTOCOL_NAME;
#define MbufCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, multibuf_extension_name, val)
#define MbufSimpleCheckExtension(dpy,i) \
XextSimpleCheckExtension (dpy, i, multibuf_extension_name)
/*****************************************************************************
* *
* private utility routines *
* *
*****************************************************************************/
/*
* find_display - locate the display info block
*/
static int close_display(Display *dpy, XExtCodes *codes);
static char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n);
static Bool wire_to_event(Display *dpy, XEvent *libevent, xEvent *netevent);
static Status event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent);
static /* const */ XExtensionHooks multibuf_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
wire_to_event, /* wire_to_event */
event_to_wire, /* event_to_wire */
NULL, /* error */
error_string, /* error_string */
};
static /* const */ char *multibuf_error_list[] = {
"BadBuffer", /* MultibufferBadBuffer */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, multibuf_info,
multibuf_extension_name,
&multibuf_extension_hooks,
MultibufferNumberEvents, NULL)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, multibuf_info)
static XEXT_GENERATE_ERROR_STRING (error_string, multibuf_extension_name,
MultibufferNumberErrors,
multibuf_error_list)
/*
* wire_to_event - convert a wire event in network format to a C
* event structure
*/
static Bool wire_to_event (Display *dpy, XEvent *libevent, xEvent *netevent)
{
XExtDisplayInfo *info = find_display (dpy);
MbufCheckExtension (dpy, info, False);
switch ((netevent->u.u.type & 0x7f) - info->codes->first_event) {
case MultibufferClobberNotify:
{
XmbufClobberNotifyEvent *ev;
xMbufClobberNotifyEvent *event;
ev = (XmbufClobberNotifyEvent *) libevent;
event = (xMbufClobberNotifyEvent *) netevent;
ev->type = event->type & 0x7f;
ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent);
ev->send_event = ((event->type & 0x80) != 0);
ev->display = dpy;
ev->buffer = event->buffer;
ev->state = event->state;
return True;
}
case MultibufferUpdateNotify:
{
XmbufUpdateNotifyEvent *ev;
xMbufUpdateNotifyEvent *event;
ev = (XmbufUpdateNotifyEvent *) libevent;
event = (xMbufUpdateNotifyEvent *) netevent;
ev->type = event->type & 0x7f;
ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent);
ev->send_event = ((event->type & 0x80) != 0);
ev->display = dpy;
ev->buffer = event->buffer;
return True;
}
}
return False;
}
/*
* event_to_wire - convert a C event structure to a wire event in
* network format
*/
static Status event_to_wire (Display *dpy, XEvent *libevent, xEvent *netevent)
{
XExtDisplayInfo *info = find_display (dpy);
MbufCheckExtension (dpy, info, 0);
switch ((libevent->type & 0x7f) - info->codes->first_event) {
case MultibufferClobberNotify:
{
XmbufClobberNotifyEvent *ev;
xMbufClobberNotifyEvent *event;
ev = (XmbufClobberNotifyEvent *) libevent;
event = (xMbufClobberNotifyEvent *) netevent;
event->type = ev->type;
event->sequenceNumber = (ev->serial & 0xffff);
event->buffer = ev->buffer;
event->state = ev->state;
return 1;
}
case MultibufferUpdateNotify:
{
XmbufUpdateNotifyEvent *ev;
xMbufUpdateNotifyEvent *event;
ev = (XmbufUpdateNotifyEvent *) libevent;
event = (xMbufUpdateNotifyEvent *) netevent;
event->type = ev->type;
event->sequenceNumber = (ev->serial & 0xffff);
event->buffer = ev->buffer;
return 1;
}
}
return 0;
}
/*
* read_buffer_info - read Buffer Info descriptors from the net; if unable
* to allocate memory, read junk to make sure that stream is clear.
*/
#define TALLOC(type,count) ((type *) Xmalloc ((unsigned) count * sizeof(type)))
static XmbufBufferInfo *read_buffer_info (Display *dpy, int nbufs)
{
xMbufBufferInfo *netbuf = TALLOC (xMbufBufferInfo, nbufs);
XmbufBufferInfo *bufinfo = NULL;
long netbytes = nbufs * SIZEOF(xMbufBufferInfo);
if (netbuf) {
_XRead (dpy, (char *) netbuf, netbytes);
bufinfo = TALLOC (XmbufBufferInfo, nbufs);
if (bufinfo) {
register XmbufBufferInfo *c;
register xMbufBufferInfo *net;
register int i;
for (i = 0, c = bufinfo, net = netbuf; i < nbufs;
i++, c++, net++) {
c->visualid = net->visualID;
c->max_buffers = net->maxBuffers;
c->depth = net->depth;
}
}
Xfree ((char *) netbuf);
} else { /* eat the data */
while (netbytes > 0) {
char dummy[256]; /* stack size vs loops tradeoff */
long nbytes = sizeof dummy;
if (nbytes > netbytes) nbytes = netbytes;
_XRead (dpy, dummy, nbytes);
netbytes -= nbytes;
}
}
return bufinfo;
}
#undef TALLOC
/*****************************************************************************
* *
* Multibuffering/stereo public interfaces *
* *
*****************************************************************************/
/*
* XmbufQueryExtension -
* Returns True if the multibuffering/stereo extension is available
* on the given display. If the extension exists, the value of the
* first event code (which should be added to the event type constants
* MultibufferClobberNotify and MultibufferUpdateNotify to get the
* actual values) is stored into event_base and the value of the first
* error code (which should be added to the error type constant
* MultibufferBadBuffer to get the actual value) is stored into
* error_base.
*/
Bool XmbufQueryExtension (
Display *dpy,
int *event_base_return, int *error_base_return)
{
XExtDisplayInfo *info = find_display (dpy);
if (XextHasExtension (info)) {
*event_base_return = info->codes->first_event;
*error_base_return = info->codes->first_error;
return True;
} else {
return False;
}
}
/*
* XmbufGetVersion -
* Gets the major and minor version numbers of the extension. The return
* value is zero if an error occurs or non-zero if no error happens.
*/
Status XmbufGetVersion (
Display *dpy,
int *major_version_return, int *minor_version_return)
{
XExtDisplayInfo *info = find_display (dpy);
xMbufGetBufferVersionReply rep;
register xMbufGetBufferVersionReq *req;
MbufCheckExtension (dpy, info, 0);
LockDisplay (dpy);
MbufGetReq (MbufGetBufferVersion, req, info);
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
*major_version_return = rep.majorVersion;
*minor_version_return = rep.minorVersion;
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
/*
* XmbufCreateBuffers -
* Requests that "count" buffers be created with the given update_action
* and update_hint and be associated with the indicated window. The
* number of buffers created is returned (zero if an error occurred)
* and buffers_return is filled in with that many Multibuffer identifiers.
*/
int XmbufCreateBuffers (
Display *dpy,
Window w,
int count,
int update_action, int update_hint,
Multibuffer *buffers)
{
XExtDisplayInfo *info = find_display (dpy);
xMbufCreateImageBuffersReply rep;
register xMbufCreateImageBuffersReq *req;
int result;
MbufCheckExtension (dpy, info, 0);
LockDisplay (dpy);
XAllocIDs(dpy, buffers, count);
MbufGetReq (MbufCreateImageBuffers, req, info);
req->window = w;
req->updateAction = update_action;
req->updateHint = update_hint;
req->length += count;
count <<= 2;
PackData32 (dpy, buffers, count);
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
result = rep.numberBuffer;
UnlockDisplay (dpy);
SyncHandle ();
return result;
}
/*
* XmbufDestroyBuffers -
* Destroys the buffers associated with the given window.
*/
void XmbufDestroyBuffers (Display *dpy, Window window)
{
XExtDisplayInfo *info = find_display (dpy);
register xMbufDestroyImageBuffersReq *req;
MbufSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
MbufGetReq (MbufDestroyImageBuffers, req, info);
req->window = window;
UnlockDisplay (dpy);
SyncHandle ();
}
/*
* XmbufDisplayBuffers -
* Displays the indicated buffers their appropriate windows within
* max_delay milliseconds after min_delay milliseconds have passed.
* No two buffers may be associated with the same window or else a Matc
* error is generated.
*/
void XmbufDisplayBuffers (
Display *dpy,
int count,
Multibuffer *buffers,
int min_delay, int max_delay)
{
XExtDisplayInfo *info = find_display (dpy);
register xMbufDisplayImageBuffersReq *req;
MbufSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
MbufGetReq (MbufDisplayImageBuffers, req, info);
req->minDelay = min_delay;
req->maxDelay = max_delay;
req->length += count;
count <<= 2;
PackData32 (dpy, buffers, count);
UnlockDisplay (dpy);
SyncHandle();
}
/*
* XmbufGetWindowAttributes -
* Gets the multibuffering attributes that apply to all buffers associated
* with the given window. Returns non-zero on success and zero if an
* error occurs.
*/
Status XmbufGetWindowAttributes (
Display *dpy,
Window w,
XmbufWindowAttributes *attr)
{
XExtDisplayInfo *info = find_display (dpy);
register xMbufGetMBufferAttributesReq *req;
xMbufGetMBufferAttributesReply rep;
MbufCheckExtension (dpy, info, 0);
LockDisplay (dpy);
MbufGetReq (MbufGetMBufferAttributes, req, info);
req->window = w;
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
attr->buffers = (Multibuffer *) NULL;
if ((attr->nbuffers = rep.length)) {
int nbytes = rep.length * sizeof(Multibuffer);
attr->buffers = (Multibuffer *) Xmalloc((unsigned) nbytes);
nbytes = rep.length << 2;
if (! attr->buffers) {
_XEatData(dpy, (unsigned long) nbytes);
UnlockDisplay(dpy);
SyncHandle();
return (0);
}
_XRead32 (dpy, (long *) attr->buffers, nbytes);
}
attr->displayed_index = rep.displayedBuffer;
attr->update_action = rep.updateAction;
attr->update_hint = rep.updateHint;
attr->window_mode = rep.windowMode;
UnlockDisplay (dpy);
SyncHandle();
return 1;
}
/*
* XmbufChangeWindowAttributes -
* Sets the multibuffering attributes that apply to all buffers associated
* with the given window. This is currently limited to the update_hint.
*/
void XmbufChangeWindowAttributes (
Display *dpy,
Window w,
unsigned long valuemask,
XmbufSetWindowAttributes *attr)
{
XExtDisplayInfo *info = find_display (dpy);
register xMbufSetMBufferAttributesReq *req;
MbufSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
MbufGetReq (MbufSetMBufferAttributes, req, info);
req->window = w;
if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */
unsigned long values[1]; /* one per element in if stmts below */
unsigned long *v = values;
unsigned int nvalues;
if (valuemask & MultibufferWindowUpdateHint)
*v++ = attr->update_hint;
req->length += (nvalues = v - values);
nvalues <<= 2; /* watch out for macros... */
Data32 (dpy, (long *) values, (long)nvalues);
}
UnlockDisplay (dpy);
SyncHandle();
}
/*
* XmbufGetBufferAttributes -
* Gets the attributes for the indicated buffer. Returns non-zero on
* success and zero if an error occurs.
*/
Status XmbufGetBufferAttributes (
Display *dpy,
Multibuffer b,
XmbufBufferAttributes *attr)
{
XExtDisplayInfo *info = find_display (dpy);
register xMbufGetBufferAttributesReq *req;
xMbufGetBufferAttributesReply rep;
MbufCheckExtension (dpy, info, 0);
LockDisplay (dpy);
MbufGetReq (MbufGetBufferAttributes, req, info);
req->buffer = b;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
attr->window = rep.window;
attr->event_mask = rep.eventMask;
attr->buffer_index = rep.bufferIndex;
attr->side = rep.side;
UnlockDisplay (dpy);
SyncHandle();
return 1;
}
/*
* XmbufChangeBufferAttributes -
* Sets the attributes for the indicated buffer. This is currently
* limited to the event_mask.
*/
void XmbufChangeBufferAttributes (
Display *dpy,
Multibuffer b,
unsigned long valuemask,
XmbufSetBufferAttributes *attr)
{
XExtDisplayInfo *info = find_display (dpy);
register xMbufSetBufferAttributesReq *req;
MbufSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
MbufGetReq (MbufSetBufferAttributes, req, info);
req->buffer = b;
if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */
unsigned long values[1]; /* one per element in if stmts below */
unsigned long *v = values;
unsigned int nvalues;
if (valuemask & MultibufferBufferEventMask)
*v++ = attr->event_mask;
req->length += (nvalues = v - values);
nvalues <<= 2; /* watch out for macros... */
Data32 (dpy, (long *) values, (long)nvalues);
}
UnlockDisplay (dpy);
SyncHandle();
}
/*
* XmbufGetScreenInfo -
* Gets the parameters controlling how mono and stereo windows may be
* created on the indicated screen. The numbers of sets of visual and
* depths are returned in nmono_return and nstereo_return. If
* nmono_return is greater than zero, then mono_info_return is set to
* the address of an array of XmbufBufferInfo structures describing the
* various visuals and depths that may be used. Otherwise,
* mono_info_return is set to NULL. Similarly, stereo_info_return is
* set according to nstereo_return. The storage returned in
* mono_info_return and stereo_info_return may be released by XFree.
* If no errors are encounted, non-zero will be returned.
*/
Status XmbufGetScreenInfo (
Display *dpy,
Drawable d,
int *nmono_return,
XmbufBufferInfo **mono_info_return,
int *nstereo_return,
XmbufBufferInfo **stereo_info_return)
{
XExtDisplayInfo *info = find_display (dpy);
register xMbufGetBufferInfoReq *req;
xMbufGetBufferInfoReply rep;
int nmono, nstereo;
XmbufBufferInfo *minfo, *sinfo;
MbufCheckExtension (dpy, info, 0);
LockDisplay (dpy);
MbufGetReq (MbufGetBufferInfo, req, info);
req->drawable = d;
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
nmono = rep.normalInfo;
nstereo = rep.stereoInfo;
minfo = ((nmono > 0) ? read_buffer_info (dpy, nmono) : NULL);
sinfo = ((nstereo > 0) ? read_buffer_info (dpy, nstereo) : NULL);
/* check for bad reads indicating we need to return an error */
if ((nmono > 0 && !minfo) || (nstereo > 0 && !sinfo)) {
if (minfo) Xfree ((char *) minfo);
if (sinfo) Xfree ((char *) sinfo);
UnlockDisplay (dpy);
SyncHandle();
return 0;
}
*nmono_return = nmono;
*mono_info_return = minfo;
*nstereo_return = nstereo;
*stereo_info_return = sinfo;
UnlockDisplay (dpy);
SyncHandle();
return 1;
}
/*
* XmbufCreateStereoWindow -
* Creates a stereo window in the same way that XCreateWindow creates
* a mono window (in fact, use the same code, except for the request)
* and returns the left and right buffers that may be
*/
Window XmbufCreateStereoWindow (
Display *dpy,
Window parent,
int x, int y,
unsigned int width, unsigned int height, unsigned int border_width,
int depth,
unsigned int class,
Visual *visual,
unsigned long valuemask,
XSetWindowAttributes *attr,
Multibuffer *leftp, Multibuffer *rightp)
{
XExtDisplayInfo *info = find_display (dpy);
Window wid;
register xMbufCreateStereoWindowReq *req;
MbufCheckExtension (dpy, info, None);
LockDisplay(dpy);
MbufGetReq(MbufCreateStereoWindow, req, info);
wid = req->wid = XAllocID(dpy);
req->parent = parent;
req->left = *leftp = XAllocID (dpy);
req->right = *rightp = XAllocID (dpy);
req->x = x;
req->y = y;
req->width = width;
req->height = height;
req->borderWidth = border_width;
req->depth = depth;
req->class = class;
if (visual == CopyFromParent)
req->visual = CopyFromParent;
else
req->visual = visual->visualid;
valuemask &= (CWBackPixmap|CWBackPixel|CWBorderPixmap|
CWBorderPixel|CWBitGravity|CWWinGravity|
CWBackingStore|CWBackingPlanes|CWBackingPixel|
CWOverrideRedirect|CWSaveUnder|CWEventMask|
CWDontPropagate|CWColormap|CWCursor);
if ((req->mask = valuemask)) {
unsigned long values[32];
register unsigned long *value = values;
unsigned int nvalues;
if (valuemask & CWBackPixmap)
*value++ = attr->background_pixmap;
if (valuemask & CWBackPixel)
*value++ = attr->background_pixel;
if (valuemask & CWBorderPixmap)
*value++ = attr->border_pixmap;
if (valuemask & CWBorderPixel)
*value++ = attr->border_pixel;
if (valuemask & CWBitGravity)
*value++ = attr->bit_gravity;
if (valuemask & CWWinGravity)
*value++ = attr->win_gravity;
if (valuemask & CWBackingStore)
*value++ = attr->backing_store;
if (valuemask & CWBackingPlanes)
*value++ = attr->backing_planes;
if (valuemask & CWBackingPixel)
*value++ = attr->backing_pixel;
if (valuemask & CWOverrideRedirect)
*value++ = attr->override_redirect;
if (valuemask & CWSaveUnder)
*value++ = attr->save_under;
if (valuemask & CWEventMask)
*value++ = attr->event_mask;
if (valuemask & CWDontPropagate)
*value++ = attr->do_not_propagate_mask;
if (valuemask & CWColormap)
*value++ = attr->colormap;
if (valuemask & CWCursor)
*value++ = attr->cursor;
req->length += (nvalues = value - values);
nvalues <<= 2; /* watch out for macros... */
Data32 (dpy, (long *) values, (long)nvalues);
}
UnlockDisplay(dpy);
SyncHandle();
return wid;
}
void XmbufClearBufferArea (
Display *dpy,
Multibuffer buffer,
int x, int y,
unsigned int width, unsigned int height,
Bool exposures)
{
XExtDisplayInfo *info = find_display (dpy);
register xMbufClearImageBufferAreaReq *req;
MbufSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
MbufGetReq (MbufClearImageBufferArea, req, info);
req->buffer = buffer;
req->x = x;
req->y = y;
req->width = width;
req->height = height;
req->exposures = exposures;
UnlockDisplay (dpy);
SyncHandle();
}
/* $XFree86: xc/lib/Xext/Xcup.c,v 1.8 2002/10/16 02:19:22 dawes Exp $ */
/*
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $Xorg: Xcup.c,v 1.5 2001/02/09 02:03:49 xorgcvs Exp $ */
#ifdef WIN32
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <nx-X11/Xwindows.h>
#endif
#define NEED_EVENTS
#define NEED_REPLIES
#include <nx-X11/Xlibint.h>
#include <nx-X11/extensions/Xcupstr.h>
#include <nx-X11/extensions/Xext.h>
#include <nx-X11/extensions/extutil.h>
static XExtensionInfo _xcup_info_data;
static XExtensionInfo *xcup_info = &_xcup_info_data;
static char *xcup_extension_name = XCUPNAME;
/*****************************************************************************
* *
* private utility routines *
* *
*****************************************************************************/
static int close_display(Display *dpy, XExtCodes *codes);
static /* const */ XExtensionHooks xcup_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, xcup_info,
xcup_extension_name,
&xcup_extension_hooks,
0, NULL)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xcup_info)
/*****************************************************************************
* *
* public Xcup Extension routines *
* *
*****************************************************************************/
Status
XcupQueryVersion(
Display* dpy,
int* major_version_return,
int* minor_version_return)
{
XExtDisplayInfo *info = find_display (dpy);
xXcupQueryVersionReply rep;
xXcupQueryVersionReq *req;
XextCheckExtension (dpy, info, xcup_extension_name, False);
LockDisplay(dpy);
GetReq(XcupQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->xcupReqType = X_XcupQueryVersion;
req->client_major_version = XCUP_MAJOR_VERSION;
req->client_minor_version = XCUP_MINOR_VERSION;
if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
*major_version_return = rep.server_major_version;
*minor_version_return = rep.server_minor_version;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
/* Win32 reserves 20 colormap entries for its desktop */
#ifndef TYP_RESERVED_ENTRIES
#define TYP_RESERVED_ENTRIES 20
#endif
Status
XcupGetReservedColormapEntries(
Display* dpy,
int screen,
XColor** colors_out,
int* ncolors)
{
XExtDisplayInfo *info = find_display (dpy);
xXcupGetReservedColormapEntriesReply rep;
xXcupGetReservedColormapEntriesReq *req;
xColorItem rbuf[TYP_RESERVED_ENTRIES];
*ncolors = 0;
XextCheckExtension (dpy, info, xcup_extension_name, False);
LockDisplay(dpy);
GetReq(XcupGetReservedColormapEntries, req);
req->reqType = info->codes->major_opcode;
req->xcupReqType = X_XcupGetReservedColormapEntries;
req->screen = screen;
if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
long nbytes;
xColorItem* rbufp;
int nentries = rep.length / 3;
nbytes = nentries * SIZEOF (xColorItem);
if (nentries > TYP_RESERVED_ENTRIES)
rbufp = (xColorItem*) Xmalloc (nbytes);
else
rbufp = rbuf;
if (rbufp == NULL) {
_XEatData (dpy, (unsigned long) nbytes);
UnlockDisplay (dpy);
SyncHandle ();
return False;
}
_XRead (dpy, (char*) rbufp, nbytes);
*colors_out = (XColor*) Xmalloc (nentries * sizeof (XColor));
if (*colors_out) {
xColorItem* cs = (xColorItem *) rbufp;
XColor* cd = *colors_out;
int i;
*ncolors = nentries;
for (i = 0; i < *ncolors; i++, cd++) {
cd->pixel = cs->pixel;
cd->red = cs->red;
cd->green = cs->green;
cd->blue = cs->blue;
cs = (xColorItem*) (((char*) cs) + SIZEOF(xColorItem));
}
if (rbufp != rbuf) XFree ((char*) rbufp);
UnlockDisplay(dpy);
SyncHandle();
return True;
}
if (rbufp != rbuf) XFree ((char*) rbufp);
}
UnlockDisplay(dpy);
SyncHandle();
return False;
}
Status
XcupStoreColors(
Display* dpy,
Colormap colormap,
XColor* colors_in_out,
int ncolors)
{
XExtDisplayInfo *info = find_display (dpy);
xXcupStoreColorsReply rep;
xXcupStoreColorsReq *req;
xColorItem rbuf[256];
xColorItem citem;
int i;
XColor* xcp;
XextCheckExtension (dpy, info, xcup_extension_name, False);
LockDisplay(dpy);
GetReq(XcupStoreColors, req);
req->reqType = info->codes->major_opcode;
req->xcupReqType = X_XcupStoreColors;
req->cmap = colormap;
req->length += (ncolors * SIZEOF(xColorItem)) >> 2;
for (i = 0, xcp = colors_in_out; i < ncolors; i++, xcp++) {
citem.pixel = xcp->pixel;
citem.red = xcp->red;
citem.green = xcp->green;
citem.blue = xcp->blue;
/* note that xColorItem doesn't contain all 16-bit quantities, so
we can't use Data16 */
Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem));
}
if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
long nbytes;
xColorItem* rbufp;
xColorItem* cs;
int nentries = rep.length / 3;
nbytes = nentries * SIZEOF (xColorItem);
if (nentries != ncolors) {
_XEatData (dpy, (unsigned long) nbytes);
UnlockDisplay (dpy);
SyncHandle ();
return False;
}
if (ncolors > 256)
rbufp = (xColorItem*) Xmalloc (nbytes);
else
rbufp = rbuf;
if (rbufp == NULL) {
_XEatData (dpy, (unsigned long) nbytes);
UnlockDisplay (dpy);
SyncHandle ();
return False;
}
_XRead (dpy, (char*) rbufp, nbytes);
for (i = 0, xcp = colors_in_out, cs = rbufp; i < ncolors; i++, xcp++, cs++) {
xcp->pixel = cs->pixel;
xcp->red = cs->red;
xcp->green = cs->green;
xcp->blue = cs->blue;
xcp->flags = cs->flags;
}
if (rbufp != rbuf) XFree ((char*)rbufp);
UnlockDisplay(dpy);
SyncHandle();
return True;
}
UnlockDisplay(dpy);
SyncHandle();
return False;
}
/* $Xorg: Xdbe.c,v 1.4 2000/08/17 19:45:53 cpqbld Exp $ */
/******************************************************************************
*
* Copyright (c) 1994, 1995 Hewlett-Packard Company
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Hewlett-Packard
* Company shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the Hewlett-Packard Company.
*
* Xlib DBE code
*
*****************************************************************************/
/* $XFree86: xc/lib/Xext/Xdbe.c,v 3.7 2002/10/16 02:19:22 dawes Exp $ */
#define NEED_EVENTS
#define NEED_REPLIES
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <nx-X11/Xlibint.h>
#include <nx-X11/extensions/Xext.h>
#include <nx-X11/extensions/extutil.h>
#define NEED_DBE_PROTOCOL
#include <nx-X11/extensions/Xdbe.h>
static XExtensionInfo _dbe_info_data;
static XExtensionInfo *dbe_info = &_dbe_info_data;
static char *dbe_extension_name = DBE_PROTOCOL_NAME;
#define DbeCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, dbe_extension_name, val)
#define DbeSimpleCheckExtension(dpy,i) \
XextSimpleCheckExtension (dpy, i, dbe_extension_name)
#if !defined(UNIXCPP)
#define DbeGetReq(name,req,info) GetReq (name, req); \
req->reqType = info->codes->major_opcode; \
req->dbeReqType = X_##name;
#else
#define DbeGetReq(name,req,info) GetReq (name, req); \
req->reqType = info->codes->major_opcode; \
req->dbeReqType = X_/**/name;
#endif
/*****************************************************************************
* *
* private utility routines *
* *
*****************************************************************************/
/*
* find_display - locate the display info block
*/
static int close_display(Display *dpy, XExtCodes *codes);
static char *error_string(Display *dpy, int code, XExtCodes *codes,
char *buf, int n);
static XExtensionHooks dbe_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
error_string, /* error_string */
};
static char *dbe_error_list[] = {
"BadBuffer", /* DbeBadBuffer */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, dbe_info,
dbe_extension_name,
&dbe_extension_hooks,
DbeNumberEvents, NULL)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dbe_info)
static XEXT_GENERATE_ERROR_STRING (error_string, dbe_extension_name,
DbeNumberErrors,
dbe_error_list)
/*****************************************************************************
* *
* Double-Buffering public interfaces *
* *
*****************************************************************************/
/*
* XdbeQueryExtension -
* Sets major_version_return and minor_verion_return to the major and
* minor DBE protocol version supported by the server. If the DBE
* library is compatible with the version returned by the server, this
* function returns non-zero. If dpy does not support the DBE
* extension, or if there was an error during communication with the
* server, or if the server and library protocol versions are
* incompatible, this functions returns zero. No other Xdbe functions
* may be called before this function. If a client violates this rule,
* the effects of all subsequent Xdbe calls are undefined.
*/
Status XdbeQueryExtension (
Display *dpy,
int *major_version_return,
int *minor_version_return)
{
XExtDisplayInfo *info = find_display (dpy);
xDbeGetVersionReply rep;
register xDbeGetVersionReq *req;
if (!XextHasExtension (info))
return (Status)0; /* failure */
LockDisplay (dpy);
DbeGetReq (DbeGetVersion, req, info);
req->majorVersion = DBE_MAJOR_VERSION;
req->minorVersion = DBE_MINOR_VERSION;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return (Status)0; /* failure */
}
*major_version_return = rep.majorVersion;
*minor_version_return = rep.minorVersion;
UnlockDisplay (dpy);
SyncHandle ();
if (*major_version_return != DBE_MAJOR_VERSION)
return (Status)0; /* failure */
else
return (Status)1; /* success */
}
/*
* XdbeAllocateBackBuffer -
* This function returns a drawable ID used to refer to the back buffer
* of the specified window. The swap_action is a hint to indicate the
* swap action that will likely be used in subsequent calls to
* XdbeSwapBuffers. The actual swap action used in calls to
* XdbeSwapBuffers does not have to be the same as the swap_action
* passed to this function, though clients are encouraged to provide
* accurate information whenever possible.
*/
XdbeBackBuffer XdbeAllocateBackBufferName(
Display *dpy,
Window window,
XdbeSwapAction swap_action)
{
XExtDisplayInfo *info = find_display (dpy);
register xDbeAllocateBackBufferNameReq *req;
XdbeBackBuffer buffer;
/* make sure extension is available; if not, return the
* third parameter (0).
*/
DbeCheckExtension (dpy, info, (XdbeBackBuffer)0);
/* allocate the id */
buffer = XAllocID (dpy);
LockDisplay(dpy);
DbeGetReq(DbeAllocateBackBufferName, req, info);
req->window = window;
req->swapAction = (unsigned char)swap_action;
req->buffer = buffer;
UnlockDisplay (dpy);
SyncHandle ();
return buffer;
} /* XdbeAllocateBackBufferName() */
/*
* XdbeDeallocateBackBufferName -
* This function frees a drawable ID, buffer, that was obtained via
* XdbeAllocateBackBufferName. The buffer must refer to the back buffer
* of the specified window, or a protocol error results.
*/
Status XdbeDeallocateBackBufferName (
Display *dpy,
XdbeBackBuffer buffer)
{
XExtDisplayInfo *info = find_display (dpy);
register xDbeDeallocateBackBufferNameReq *req;
DbeCheckExtension (dpy, info, (Status)0 /* failure */);
LockDisplay (dpy);
DbeGetReq (DbeDeallocateBackBufferName, req, info);
req->buffer = buffer;
UnlockDisplay (dpy);
SyncHandle ();
return (Status)1; /* success */
}
/*
* XdbeSwapBuffers -
* This function swaps the front and back buffers for a list of windows.
* The argument num_windows specifies how many windows are to have their
* buffers swapped; it is the number of elements in the swap_info array.
* The argument swap_info specifies the information needed per window
* to do the swap.
*/
Status XdbeSwapBuffers (
Display *dpy,
XdbeSwapInfo *swap_info,
int num_windows)
{
XExtDisplayInfo *info = find_display (dpy);
register xDbeSwapBuffersReq *req;
int i;
DbeCheckExtension (dpy, info, (Status)0 /* failure */);
LockDisplay (dpy);
DbeGetReq (DbeSwapBuffers, req, info);
req->length += 2*num_windows;
req->n = num_windows;
/* We need to handle 64-bit machines, where we can not use PackData32
* directly because info would be lost in translating from 32- to 64-bit.
* Instead we send data via a loop that accounts for the translation.
*/
for (i = 0; i < num_windows; i++)
{
char tmp[4];
Data32 (dpy, (long *)&swap_info[i].swap_window, 4);
tmp[0] = swap_info[i].swap_action;
Data (dpy, (char *)tmp, 4);
}
UnlockDisplay (dpy);
SyncHandle ();
return (Status)1; /* success */
} /* XdbeSwapBuffers() */
/*
* XdbeBeginIdiom -
* This function marks the beginning of an idiom sequence.
*/
Status XdbeBeginIdiom (Display *dpy)
{
XExtDisplayInfo *info = find_display(dpy);
register xDbeBeginIdiomReq *req;
DbeCheckExtension (dpy, info, (Status)0 /* failure */);
LockDisplay (dpy);
DbeGetReq (DbeBeginIdiom, req, info);
UnlockDisplay (dpy);
SyncHandle ();
return (Status)1; /* success */
}
/*
* XdbeEndIdiom -
* This function marks the end of an idiom sequence.
*/
Status XdbeEndIdiom (Display *dpy)
{
XExtDisplayInfo *info = find_display(dpy);
register xDbeEndIdiomReq *req;
DbeCheckExtension (dpy, info, (Status)0 /* failure */);
LockDisplay (dpy);
DbeGetReq (DbeEndIdiom, req, info);
UnlockDisplay (dpy);
SyncHandle ();
return (Status)1; /* success */
}
/*
* XdbeGetVisualInfo -
* This function returns information about which visuals support
* double buffering. The argument num_screens specifies how many
* elements there are in the screen_specifiers list. Each drawable
* in screen_specifiers designates a screen for which the supported
* visuals are being requested. If num_screens is zero, information
* for all screens is requested. In this case, upon return from this
* function, num_screens will be set to the number of screens that were
* found. If an error occurs, this function returns NULL, else it returns
* a pointer to a list of XdbeScreenVisualInfo structures of length
* num_screens. The nth element in the returned list corresponds to the
* nth drawable in the screen_specifiers list, unless num_screens was
* passed in with the value zero, in which case the nth element in the
* returned list corresponds to the nth screen of the server, starting
* with screen zero.
*/
XdbeScreenVisualInfo *XdbeGetVisualInfo (
Display *dpy,
Drawable *screen_specifiers,
int *num_screens) /* SEND and RETURN */
{
XExtDisplayInfo *info = find_display(dpy);
register xDbeGetVisualInfoReq *req;
xDbeGetVisualInfoReply rep;
XdbeScreenVisualInfo *scrVisInfo;
int i;
DbeCheckExtension (dpy, info, (XdbeScreenVisualInfo *)NULL);
LockDisplay (dpy);
DbeGetReq(DbeGetVisualInfo, req, info);
req->length = 2 + *num_screens;
req->n = *num_screens;
Data32 (dpy, screen_specifiers, (*num_screens * sizeof (CARD32)));
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
/* return the number of screens actually found if we
* requested information about all screens (*num_screens == 0)
*/
if (*num_screens == 0)
*num_screens = rep.m;
/* allocate list of visual information to be returned */
if (!(scrVisInfo =
(XdbeScreenVisualInfo *)Xmalloc(
(unsigned)(*num_screens * sizeof(XdbeScreenVisualInfo))))) {
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
for (i = 0; i < *num_screens; i++)
{
int nbytes;
int j;
long c;
_XRead32 (dpy, &c, sizeof(CARD32));
scrVisInfo[i].count = c;
nbytes = scrVisInfo[i].count * sizeof(XdbeVisualInfo);
/* if we can not allocate the list of visual/depth info
* then free the lists that we already allocate as well
* as the visual info list itself
*/
if (!(scrVisInfo[i].visinfo = (XdbeVisualInfo *)Xmalloc(
(unsigned)nbytes))) {
for (j = 0; j < i; j++) {
Xfree ((char *)scrVisInfo[j].visinfo);
}
Xfree ((char *)scrVisInfo);
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
/* Read the visual info item into the wire structure. Then copy each
* element into the library structure. The element sizes and/or
* padding may be different in the two structures.
*/
for (j = 0; j < scrVisInfo[i].count; j++) {
xDbeVisInfo xvi;
_XRead (dpy, (char *)&xvi, sizeof(xDbeVisInfo));
scrVisInfo[i].visinfo[j].visual = xvi.visualID;
scrVisInfo[i].visinfo[j].depth = xvi.depth;
scrVisInfo[i].visinfo[j].perflevel = xvi.perfLevel;
}
}
UnlockDisplay (dpy);
SyncHandle ();
return scrVisInfo;
} /* XdbeGetVisualInfo() */
/*
* XdbeFreeVisualInfo -
* This function frees the list of XdbeScreenVisualInfo returned by the
* function XdbeGetVisualInfo.
*/
void XdbeFreeVisualInfo(XdbeScreenVisualInfo *visual_info)
{
if (visual_info == NULL) {
return;
}
if (visual_info->visinfo) {
XFree(visual_info->visinfo);
}
XFree(visual_info);
}
/*
* XdbeGetBackBufferAttributes -
* This function returns the attributes associated with the specified
* buffer.
*/
XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
Display *dpy,
XdbeBackBuffer buffer)
{
XExtDisplayInfo *info = find_display(dpy);
register xDbeGetBackBufferAttributesReq *req;
xDbeGetBackBufferAttributesReply rep;
XdbeBackBufferAttributes *attr;
DbeCheckExtension(dpy, info, (XdbeBackBufferAttributes *)NULL);
if (!(attr =
(XdbeBackBufferAttributes *)Xmalloc(sizeof(XdbeBackBufferAttributes)))) {
return NULL;
}
LockDisplay(dpy);
DbeGetReq(DbeGetBackBufferAttributes, req, info);
req->buffer = buffer;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
attr->window = rep.attributes;
UnlockDisplay (dpy);
SyncHandle ();
return attr;
}
LIBRARY XEXT
VERSION LIBRARY_VERSION
EXPORTS
XMITMiscGetBugMode
XMITMiscQueryExtension
XMITMiscSetBugMode
XMissingExtension
XSetExtensionErrorHandler
XShapeCombineMask
......@@ -76,46 +73,11 @@ EXPORTS
XextDestroyExtension
XextFindDisplay
XextRemoveDisplay
XmbufChangeBufferAttributes
XmbufChangeWindowAttributes
XmbufClearBufferArea
XmbufCreateBuffers
XmbufCreateStereoWindow
XmbufDestroyBuffers
XmbufDisplayBuffers
XmbufGetBufferAttributes
XmbufGetScreenInfo
XmbufGetVersion
XmbufGetWindowAttributes
XmbufQueryExtension
XdbeQueryExtension
XdbeAllocateBackBufferName
XdbeDeallocateBackBufferName
XdbeSwapBuffers
XdbeBeginIdiom
XdbeEndIdiom
XdbeGetVisualInfo
XdbeFreeVisualInfo
XdbeGetBackBufferAttributes
XSecurityQueryExtension
XSecurityAllocXauth
XSecurityFreeXauth
XSecurityGenerateAuthorization
XSecurityRevokeAuthorization
XagQueryVersion
XagCreateAssociation
XagCreateEmbeddedApplicationGroup
XagCreateNonembeddedApplicationGroup
XagDestroyApplicationGroup
XagDestroyAssociation
XagGetApplicationGroupAttributes
XagQueryApplicationGroup
XLbxQueryExtension
XLbxGetEventBase
XLbxQueryVersion
XcupGetReservedColormapEntries
XcupQueryVersion
XcupStoreColors
#if !defined(__CYGWIN__) && !defined(__UNIXOS2__)
XPanoramiXQueryVersion
XPanoramiXAllocInfo
......@@ -133,8 +95,5 @@ EXPORTS
DPMSDisable
DPMSForceLevel
DPMSInfo
XeviQueryExtension
XeviQueryVersion
XeviGetVisualInfo
/* $Xorg: Xext-def.cpp,v 1.3 2000/08/17 19:45:53 cpqbld Exp $ */
/* $XFree86: xc/lib/Xext/Xext-def.cpp,v 1.8 2001/05/06 10:35:51 alanh Exp $ */
......@@ -105,10 +105,6 @@ INSTPGMFLAGS =
#if BuildRECORD || BuildRECORDlib
RECORDDIR = record
#endif
#if BuildXTrap
XTRAPEXT = XTrap/LibraryTargetName(xtrap)
XTRAPDIR = XTrap
#endif
#ifdef SiteExtensionLibs
SITEEXTS = SiteExtensionLibs
#endif
......@@ -153,7 +149,7 @@ INSTPGMFLAGS =
#if DoLoadableServer
EXTENSIONS = $(COMPOSITELIB) $(DAMAGELIB) $(DAMAGE) $(FIXESLIB) $(CW) \
$(OTHEREXTS) $(RANDRLIB) $(RENDERLIB)
LOADABLEEXTS = $(MISCEXT) $(DBEEXT) $(RECORDEXT) $(GLXEXT) $(XTRAPEXT)
LOADABLEEXTS = $(MISCEXT) $(DBEEXT) $(RECORDEXT) $(GLXEXT)
MISCEXT = Xext/LibraryTargetName(ext)
OTHEREXTS = Xext/LibraryTargetName(exts) $(XKBEXT) $(XINPUTEXT) \
$(SITEEXTS)
......@@ -161,11 +157,11 @@ INSTPGMFLAGS =
EXTENSIONS = $(COMPOSITELIB) $(DAMAGELIB) $(DAMAGE) $(FIXESLIB) $(CW) \
$(OTHEREXTS) $(GLXEXT) $(RANDRLIB) $(RENDERLIB)
OTHEREXTS = Xext/LibraryTargetName(ext) $(XKBEXT) $(XINPUTEXT) \
$(DBEEXT) $(RECORDEXT) $(SITEEXTS) $(XTRAPEXT)
$(DBEEXT) $(RECORDEXT) $(SITEEXTS)
#endif
EXTDIRS = Xext $(XKBDIR) $(XIDIR) $(GLXDIR) \
$(DBEDIR) $(RECORDDIR) $(SITEEXTDIRS) \
$(RANDRDIR) $(RENDERDIR) $(XTRAPDIR) $(XPCONFIGDIR) \
$(RANDRDIR) $(RENDERDIR) $(XPCONFIGDIR) \
$(FIXESDIR) $(DAMAGEDIR) $(CWDIR) $(COMPOSITEDIR)
OS = os/LibraryTargetName(os) $(DEPXAUTHLIB)
BSDEMUL = $(DEPXBSDLIB)
......
XCOMM $XFree86: xc/programs/Xserver/XTrap/Imakefile,v 1.1 2001/11/02 23:29:29 dawes Exp $
#if DoLoadableServer
#define IHaveSubdirs
#endif
#include <Server.tmpl>
#if DoLoadableServer
SUBDIRS = module
#endif
SRCS = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c
OBJS = xtrapddmi.o xtrapdi.o xtrapdiswp.o xtrapditbl.o
INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext `pkg-config --cflags-only-I pixman-1`
NormalLibraryTarget(xtrap,$(OBJS))
LintLibraryTarget(xtrap,$(SRCS))
NormalLintTarget($(SRCS))
NormalLibraryObjectRule()
#if DoLoadableServer
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
#endif
DependTarget()
XCOMM $XFree86: xc/programs/Xserver/XTrap/module/Imakefile,v 1.2 2002/01/23 03:31:40 dawes Exp $
#define IHaveModules
#include <Server.tmpl>
SRCS = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c xf86XTrapModule.c
OBJS = xtrapddmi.o xtrapdi.o xtrapdiswp.o xtrapditbl.o xf86XTrapModule.o
INCLUDES = -I.. -I../../include -I$(EXTINCSRC) -I$(XINCLUDESRC) \
-I$(SERVERSRC)/Xext
DEFINES = -DEXTMODULE
LinkSourceFile(xf86XTrapModule.c,..)
LinkSourceFile(xtrapddmi.c,..)
LinkSourceFile(xtrapdi.c,..)
LinkSourceFile(xtrapdiswp.c,..)
LinkSourceFile(xtrapditbl.c,..)
ModuleObjectRule()
LibraryModuleTarget(xtrap,$(OBJS))
InstallLibraryModule(xtrap,$(MODULEDIR),extensions)
DependTarget()
InstallDriverSDKLibraryModule(xtrap,$(DRIVERSDKMODULEDIR),extensions)
/* $XFree86$ */
/* This is the xf86 module code for the DEC_XTRAP extension.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "xf86Module.h"
#include <nx-X11/extensions/xtrapdi.h>
extern void DEC_XTRAPInit(INITARGS);
#ifdef XFree86LOADER
static MODULESETUPPROTO(xtrapSetup);
ExtensionModule xtrapExt =
{
DEC_XTRAPInit,
XTrapExtName,
NULL,
NULL,
NULL
};
static XF86ModuleVersionInfo xtrapVersRec =
{
"xtrap",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_EXTENSION, /* needs the server extension ABI */
ABI_EXTENSION_VERSION,
MOD_CLASS_EXTENSION,
{0,0,0,0}
};
XF86ModuleData xtrapModuleData = { &xtrapVersRec, xtrapSetup, NULL };
static void *
xtrapSetup(void * module, void * opts, int *errmaj, int *errmin) {
LoadExtension(&xtrapExt, FALSE);
/* Need a non-NULL return value to indicate success */
return (void *)1;
}
#endif /* XFree86LOADER */
/* $XFree86: xc/programs/Xserver/XTrap/xtrapddmi.c,v 1.1 2001/11/02 23:29:29 dawes Exp $ */
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
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.
*****************************************************************************/
/*
* ABSTRACT:
*
* This module is the platform-specific but conditionally independent
* code for the XTrap extension (usually I/O or platform setup).
* This is shared code and is subject to change only by team approval.
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef EXTMODULE
#include <errno.h>
#include <nx-X11/Xos.h>
#ifdef PC
# include "fcntl.h"
# include "io.h"
# define O_NDELAY 0L
#endif
#else
#include "xf86_ansic.h"
#endif
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/X.h> /* From library include environment */
#include "input.h" /* From server include env. (must be before Xlib.h!) */
#ifdef PC
# include "scrintst.h" /* Screen struct */
# include "extnsist.h"
#else
# include "extnsionst.h" /* Server ExtensionEntry definitions */
# include "scrnintstr.h" /* Screen struct */
#endif
#include <nx-X11/extensions/xtrapdi.h>
#include <nx-X11/extensions/xtrapddmi.h>
#include <nx-X11/extensions/xtrapproto.h>
extern int XETrapErrorBase;
extern xXTrapGetAvailReply XETrap_avail;
extern DevicePtr XETrapKbdDev;
extern DevicePtr XETrapPtrDev;
/*
* DESCRIPTION:
*
* This function performs the platform specific setup for server
* extension implementations.
*/
void XETrapPlatformSetup()
{
}
#if !defined _XINPUT
/*
* DESCRIPTION:
*
* This routine processes the simulation of some input event.
*
*/
int XETrapSimulateXEvent(register xXTrapInputReq *request,
register ClientPtr client)
{
ScreenPtr pScr = NULL;
int status = Success;
xEvent xev;
register int x = request->input.x;
register int y = request->input.y;
DevicePtr keydev = LookupKeyboardDevice();
DevicePtr ptrdev = LookupPointerDevice();
if (request->input.screen < screenInfo.numScreens)
{
pScr = screenInfo.screens[request->input.screen];
}
else
{ /* Trying to play bogus events to this WS! */
#ifdef VERBOSE
ErrorF("%s: Trying to send events to screen %d!\n", XTrapExtName,
request->input.screen);
#endif
status = XETrapErrorBase + BadScreen;
}
/* Fill in the event structure with the information
* Note: root, event, child, eventX, eventY, state, and sameScreen
* are all updated by FixUpEventFromWindow() when the events
* are delivered via DeliverDeviceEvents() or whatever. XTrap
* needs to only concern itself with type, detail, time, rootX,
* and rootY.
*/
if (status == Success)
{
xev.u.u.type = request->input.type;
xev.u.u.detail = request->input.detail;
xev.u.keyButtonPointer.time = GetTimeInMillis();
xev.u.keyButtonPointer.rootX = x;
xev.u.keyButtonPointer.rootY = y;
if (request->input.type == MotionNotify)
{ /* Set new cursor position on screen */
XETrap_avail.data.cur_x = x;
XETrap_avail.data.cur_y = y;
NewCurrentScreen (pScr, x, y); /* fix from amnonc@mercury.co.il */
if (!(*pScr->SetCursorPosition)(pScr, x, y, xFalse))
{
status = BadImplementation;
}
}
}
if (status == Success)
{
switch(request->input.type)
{ /* Now process the event appropriately */
case KeyPress:
case KeyRelease:
(*XETrapKbdDev->realInputProc)(&xev,(DeviceIntPtr)keydev, 1L);
break;
case MotionNotify:
case ButtonPress:
case ButtonRelease:
(*XETrapPtrDev->realInputProc)(&xev,(DeviceIntPtr)ptrdev, 1L);
break;
default:
status = BadValue;
break;
}
}
return(status);
}
#endif /* _XINPUT */
#if defined vms && !defined LINKED_IN
/* Used by swapping code not visible from VMS (from main.c) */
#ifndef BLADE
void
NotImplemented()
{
FatalError("Not implemented");
}
#endif
int
#ifdef __STDC__
ProcBadRequest( ClientPtr client)
#else
ProcBadRequest(client)
ClientPtr client;
#endif
{
return (BadRequest);
}
#endif /* vms && ! LINKED_IN */
/* $XdotOrg: xc/programs/Xserver/XTrap/xtrapdi.c,v 1.5 2005/07/03 08:53:36 daniels Exp $ */
/* $XFree86: xc/programs/Xserver/XTrap/xtrapdi.c,v 1.6tsi Exp $ */
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH.
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 AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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.
*****************************************************************************/
/*
* ABSTRACT:
*
* This module is the main module for extension initialization and setup.
* It is called by the server and by clients using the extension.
* This is shared code and is subject to change only by team approval.
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
* CHANGES:
*
* Robert Chesler - grab-impreviousness patch to improve grab behavior
* Robert Chesler - add client arg to swapping routines for X11R6 port
*
*/
/*-----------------*
* Include Files *
*-----------------*/
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef EXTMODULE
#include <stdio.h>
#include <errno.h>
#include <nx-X11/Xos.h>
#else
#include "xf86_ansic.h"
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "input.h" /* Server DevicePtr definitions */
#include "misc.h" /* Server swapping macros */
#include "dixstruct.h" /* Server ClientRec definitions */
#include "resource.h" /* Used with the MakeAtom call */
#ifdef PC
# include "scrintst.h" /* Screen struct */
# include "extnsist.h"
#else
# include "extnsionst.h" /* Server ExtensionEntry definitions */
# include "scrnintstr.h" /* Screen struct */
#endif
#include "pixmapstr.h" /* DrawableRec */
#include "windowstr.h" /* Drawable Lookup structures */
#include <nx-X11/extensions/xtrapdi.h>
#include <nx-X11/extensions/xtrapddmi.h>
#include <nx-X11/extensions/xtrapproto.h>
#include "colormapst.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#include "cursor.h"
#endif
/*----------------------------*
* Global Data Declarations *
*----------------------------*/
DevicePtr XETrapKbdDev = NULL;
DevicePtr XETrapPtrDev = NULL;
int XETrapErrorBase = 0L;
xXTrapGetAvailReply XETrap_avail; /* What's available to clients */
globalref int_function XETrapDispatchVector[10L]; /* Vector of XTrap Rtns */
globalref int_function XETSwDispatchVector[10L]; /* Swapped XTrap Rtns */
globalref int_function XETrapProcVector[256L]; /* The "shadowed" ProcVector */
/* The "real" EventVector (XTrap creates it till events
* truly become vectored
*/
#ifndef VECTORED_EVENTS
globalref int_function EventProcVector[XETrapCoreEvents];
#else
extern WindowPtr GetCurrentRootWindow();
globalref int_function EventProcVector[128L];
#endif
static int_function keybd_process_inp = NULL; /* Used for VECTORED_EVENTS */
/* The "shadowed" Event Vector */
globalref int_function XETrapEventProcVector[XETrapCoreEvents];
globalref void_function XETSwProcVector[256L];/* Vector of Req swapping rtns */
/* This macro returns a true/false indicator based on whether it changes the
* environment state bits local to the server extension. This is based on the
* idea that if a valid flag is set and the corresponding data bit is not in
* the same state as desired, then true is returned, otherwise false is
* returned.
*/
#define _CheckChangeBit(valid,data,local,bit) \
(BitIsFalse(valid,bit) ? 0L : \
(((BitIsTrue(data,bit) && BitIsTrue(local,bit)) || \
(BitIsFalse(data,bit) && BitIsFalse(local,bit))) ? 0L : \
(BitToggle(local,bit), 1L)))
/* This macro is designed to return the number of elements in an
* automatically allocated array.
*/
#ifndef ASIZE
#define ASIZE(array) (sizeof(array)/sizeof(array[0L]))
#endif
/* This macro is designed to return the number of long words beyond
* XETrapMinRepSize contained in a data structure.
*/
#ifndef XEXTRA
#define XEXTRA(s) \
((sizeof(s)+(sizeof(CARD32)-1L)-XETrapMinRepSize)/sizeof(CARD32))
#endif
/* Static Declarations known to XTrap Only
* All XTrap clients refer to these single copies!
*/
/* This carries all of the information XTrap uses for internal information */
static XETrapEnv *XETenv[MAXCLIENTS] = {NULL};
#ifndef RESTYPE
#define RESTYPE unsigned long
#endif
static RESTYPE XETrapClass = 0L; /* Resource class for this extension */
static RESTYPE XETrapType = 0L; /* Resource type for this extension */
static Bool gate_closed = False; /* The global "gatekeeper" */
static Bool key_ignore = False; /* The global "keymaster" */
static Bool ignore_grabs = False;
static CARD8 next_key = XEKeyIsClear; /* Echo, Clear, or Other */
#ifdef VECTORED_EVENTS
static INT16 current_screen = -1L; /* Current screen for events */
#endif
static INT16 vectored_requests[256L] = {0L}; /* cnt of vectoring clients */
static INT16 vectored_events[KeyPress+MotionNotify] = {0L};
typedef struct _client_list
{
struct _client_list *next;
ClientPtr client;
} ClientList;
static ClientList io_clients; /* Linked-list of clients currently doing I/O */
static ClientList stats_clients; /* Linked-list of clients collecting stats */
static ClientList cmd_clients; /* Linked-list of clients using command key */
/*----------------------------*
* Forward Declarations
*----------------------------*/
static void _SwapProc (int (**f1 )(), int (**f2 )());
static void sXETrapEvent (xETrapDataEvent *from , xETrapDataEvent *to );
static int add_accelerator_node (ClientPtr client , ClientList *accel );
static void remove_accelerator_node (ClientPtr client , ClientList *accel );
static void update_protocol (xXTrapGetReq *reqptr , ClientPtr client );
#ifdef COLOR_REPLIES
static void GetSendColorRep (ClientPtr client , xResourceReq *req );
static void GetSendNamedColorRep (ClientPtr client , xResourceReq *req );
static void GetSendColorCellsRep (ClientPtr client , xResourceReq *req );
static void GetSendColorPlanesRep (ClientPtr client , xResourceReq *req );
#endif
/*
* DESCRIPTION:
*
* This routine is called by the server when a given client
* goes away (as identified by the first argument). All
* memory allocations, misc. values specific to a given
* client would be reset here.
*
*/
int XETrapDestroyEnv(void * value, XID id)
{
xXTrapReq request;
XETrapEnv *penv = XETenv[(long)value];
XETrapReset(&request,penv->client);
/* Free any memory malloc'd for a particular client here */
/* In case stop I/O wasn't received for this client */
if (penv->stats)
{ /* Remove from client accelerator list */
remove_accelerator_node(penv->client, &stats_clients);
Xfree(penv->stats); /* Free the stats buckets */
}
if (cmd_clients.next == NULL)
{ /* No more command key clients! Let's reset the gate */
gate_closed = False;
key_ignore = False;
next_key = XEKeyIsClear;
}
#ifdef VECTORED_EVENTS
current_screen = -1L; /* Invalidate current screen */
#endif
#ifdef VERBOSE
ErrorF("%s: Client '%d' Disconnected\n", XTrapExtName,
penv->client->index);
#endif
Xfree(penv);
XETenv[(long)value] = NULL;
return 0;
}
/*
* DESCRIPTION:
*
* This routine is called by the server when the last client
* (the session manager in most cases) goes away. This is server
* reset. When the server comes back up, this extension will not
* be loaded unless this routine makes the proper arrangements.
*
* The real concern here is to unload the extension
* and possibly make arragements to be called upon
* server restart.
*
*/
void XETrapCloseDown(ExtensionEntry *extEntry)
{
long i;
for (i=0L; i<MAXCLIENTS; i++)
{
if (XETenv[i] != NULL)
{
XETrapDestroyEnv((void *)i,0L);
}
}
ignore_grabs = False;
return;
}
/*
*
* DESCRIPTION:
*
* This routine has been created because of the initialization
* order that X uses, such that extensions are initialized before
* devices. This means that this extension must perform a second
* level of initialization to obtain the device references at some
* point after they have been initialized. It is assumed that when
* a client establishes communication with the extension that the
* devices havae been initialized, and therefore this function can
* obtain the information it needs.
*
* In obtaining the information, this function also places its own
* functions in place of the *standard* functions. The original
* functions are retained for vectoring purposes.
*/
Bool XETrapRedirectDevices()
{
Bool retval = True;
/* Do we need to redirect the keyboard device? */
if (XETrapKbdDev == NULL)
{
if ((XETrapKbdDev = LookupKeyboardDevice()) == NULL)
{
retval = False;
}
else
{
EventProcVector[KeyPress] =
(int_function)XETrapKbdDev->realInputProc;
EventProcVector[KeyRelease] =
(int_function)XETrapKbdDev->realInputProc;
}
#ifdef VECTORED_EVENTS
keybd_process_inp = EventProcVector[KeyPress];
EventProcVector[KeyPress] = EventProcVector[KeyRelease] = NULL;
XETrapEventProcVector[KeyPress] = XETrapEventVector;
XETrapEventProcVector[KeyRelease] = XETrapEventVector;
#else /* !VECTORED_EVENTS */
XETrapEventProcVector[KeyPress] = XETrapKeyboard;
XETrapEventProcVector[KeyRelease] = XETrapKeyboard;
#endif /* !VECTORED_EVENTS */
}
/* Do we need to redirect the pointer device? */
#ifndef VECTORED_EVENTS
if (XETrapPtrDev == NULL)
{
if ((XETrapPtrDev = LookupPointerDevice()) == 0L)
{
retval = False;
}
else
{
EventProcVector[ButtonPress] =
(int_function)XETrapPtrDev->realInputProc;
EventProcVector[ButtonRelease] =
(int_function)XETrapPtrDev->realInputProc;
EventProcVector[MotionNotify] =
(int_function)XETrapPtrDev->realInputProc;
}
XETrapEventProcVector[ButtonPress] = XETrapPointer;
XETrapEventProcVector[ButtonRelease] = XETrapPointer;
XETrapEventProcVector[MotionNotify] = XETrapPointer;
}
#endif /* !VECTORED_EVENTS */
return(retval);
}
/*
*
* DESCRIPTION:
*
* This routine is the main entry point for the Xtrap extension. It is
* called by the server to inititalize the Xtrap extension. Once the
* extension is initialized, life is controlled by the XtrapDispatch
* routine by the requests it will handle.
*
* Initializes all the XTrap data structures with the proper
* addresses of defined routines that will help control the extension.
* It is vital that the extension state be kept accurate so that only
* one call to this routine be made.
*
*/
void DEC_XTRAPInit()
{
register ExtensionEntry *extEntry;
unsigned int i;
Atom a;
/* Make the extension known to the server. Must be done every time
* DEC_XTRAPInit is called, else server will think it failed.
*/
if ((extEntry = AddExtension(XTrapExtName,XETrapNumEvents,
XETrapNumErrors,XETrapDispatch,sXETrapDispatch,XETrapCloseDown
,StandardMinorOpcode)) == NULL)
{
ErrorF("%s: AddExtension Failed!\n", XTrapExtName);
return;
}
#ifdef VERBOSE
ErrorF("%s: AddExtension assigned Major Opcode '%d'\n",
XTrapExtName, extEntry->base);
#endif
XETrap_avail.data.major_opcode = extEntry->base;
XETrapErrorBase = extEntry->errorBase;
XETrap_avail.data.event_base = extEntry->eventBase;
/* Set up our swapped reply vector */
ReplySwapVector[XETrap_avail.data.major_opcode] =
(void_function) sReplyXTrapDispatch;
/* Set up our swapped event vector */
EventSwapVector[extEntry->eventBase + XETrapData] =
(EventSwapPtr) sXETrapEvent;
/* make an atom saying that the extension is present. The
* adding of the resource occurs during XETrapCreateEnv().
*/
if ((a = MakeAtom(XTrapExtName,strlen(XTrapExtName),1L)) == None ||
(XETrapType = CreateNewResourceType(XETrapDestroyEnv)) == 0L)
{
ErrorF("%s: Setup can't create new resource type (%d,%d,%d)\n",
XTrapExtName, (int)a,(int)XETrapClass,(int)XETrapType);
return;
}
/* initialize the GetAvailable info reply here */
XETrap_avail.hdr.type = X_Reply;
XETrap_avail.hdr.length = XEXTRA(xXTrapGetAvailReply);
XETrap_avail.data.xtrap_release = XETrapRelease;
XETrap_avail.data.xtrap_version = XETrapVersion;
XETrap_avail.data.xtrap_revision = XETrapRevision;
XETrap_avail.data.pf_ident = XETrapPlatform;
XETrap_avail.data.max_pkt_size = 0xFFFF; /* very large number */
for (i=0L; i<ASIZE(XETrap_avail.data.valid); i++)
{
XETrap_avail.data.valid[i] = 0L; /* Clear bits initially */
}
BitTrue(XETrap_avail.data.valid,XETrapTimestamp);
BitTrue(XETrap_avail.data.valid,XETrapCmd);
BitTrue(XETrap_avail.data.valid,XETrapCmdKeyMod);
BitTrue(XETrap_avail.data.valid,XETrapRequest);
BitTrue(XETrap_avail.data.valid,XETrapEvent);
BitTrue(XETrap_avail.data.valid,XETrapMaxPacket);
BitTrue(XETrap_avail.data.valid,XETrapStatistics);
BitTrue(XETrap_avail.data.valid,XETrapWinXY);
/* Not yet implemented */
BitFalse(XETrap_avail.data.valid,XETrapCursor);
#ifndef _XINPUT
BitFalse(XETrap_avail.data.valid,XETrapXInput);
#else
BitTrue(XETrap_avail.data.valid,XETrapXInput);
#endif
#ifndef VECTORED_EVENTS
BitFalse(XETrap_avail.data.valid,XETrapVectorEvents);
#else
BitTrue(XETrap_avail.data.valid,XETrapVectorEvents);
#endif /* VECTORED_EVENTS */
#ifndef COLOR_REPLIES
BitFalse(XETrap_avail.data.valid,XETrapColorReplies);
#else
BitTrue(XETrap_avail.data.valid,XETrapColorReplies);
#endif /* COLOR_REPLIES */
BitTrue(XETrap_avail.data.valid,XETrapGrabServer);
/* initialize multi-client accelerator lists */
io_clients.next = NULL;
stats_clients.next = NULL;
cmd_clients.next = NULL;
for (i=0L; i<256L; i++)
{
vectored_requests[i] = 0L;
}
for (i=KeyPress; i<=MotionNotify; i++)
{
vectored_events[i] = 0L;
}
gate_closed = False;
key_ignore = False;
next_key = XEKeyIsClear;
XETrapPlatformSetup();
/* Initialize any local memory we use */
for (i=0L; i<ASIZE(EventProcVector); i++)
{
EventProcVector[i] = NULL;
#ifndef VECTORED_EVENTS
XETrapEventProcVector[i] = NULL;
#else
XETrapEventProcVector[i] = XETrapEventVector;
#endif
}
XETrapKbdDev = NULL;
XETrapPtrDev = NULL;
for (i=0L; i<ASIZE(XETrapProcVector); i++)
{
XETrapProcVector[i] = XETrapRequestVector;
}
for (i=128L; i<=255L; i++)
{ /* Extension "swapped" requests are not implemented */
XETSwProcVector[i] = NotImplemented;
}
#ifdef VERBOSE
ErrorF("%s: Vers. %d.%d-%d successfully loaded\n", XTrapExtName,
XETrap_avail.data.xtrap_release,
XETrap_avail.data.xtrap_version,
XETrap_avail.data.xtrap_revision);
#endif
return;
}
/*
* DESCRIPTION:
*
* This procedure is called upon dispatch to allocate an
* environment structure for a new XTrap client. The XETenv[]
* entry is allocated and initialized with default values.
* XETrapDestroyEnv() is responsible for deallocating this memory
* upon client termination.
*
* Note: the status of this routine is returned to the caller of
* the Dispatch routine which will in turn SendErrorToClient if
* necessary.
*
*/
int XETrapCreateEnv(ClientPtr client)
{
XETrapEnv *penv = NULL;
int status = Success;
if (client->index > MAXCLIENTS)
{
status = BadImplementation;
}
else if ((XETenv[client->index] = (XETrapEnv *)Xcalloc(sizeof(XETrapEnv)))
== NULL)
{
status = BadAlloc;
}
if (status == Success)
{
penv = XETenv[client->index];
penv->client = client;
penv->protocol = 31; /* default to backwards compatibility */
/* prep for client's departure (for memory dealloc, cleanup) */
AddResource(FakeClientID(client->index),XETrapType,
(void *)(long)(client->index));
if (XETrapRedirectDevices() == False)
{
status = XETrapErrorBase + BadDevices;
}
/* Initialize the current state */
if (status == Success)
{
status = XETrapReset(NULL, penv->client);
}
}
#ifdef VECTORED_EVENTS
current_screen = -1L; /* Invalidate current screen */
#endif
#ifdef VERBOSE
if (status == Success)
{
ErrorF("%s: Client '%d' Connection Accepted\n", XTrapExtName,
penv->client->index);
}
#endif
return(status);
}
/*
* DESCRIPTION:
*
* This procedure is defined for the call to AddExtension()
* in which it is expected to be a parameter of the call.
*
* This routine will be called by the server dispatcher
* when a client makes a request that is handled
* by the extension and the byte ordering of the client is the
* SAME as that of the extension.
*
* Note: the status of the requests is returned to the caller of
* the Dispatch routine which will in turn SendErrorToClient if
* necessary.
*/
int XETrapDispatch(ClientPtr client)
{
REQUEST(xXTrapReq);
register int status = Success;
REQUEST_AT_LEAST_SIZE(xXTrapReq);
/* Have we seen this client before? */
if (XETenv[client->index] == NULL)
{
status = XETrapCreateEnv(client);
}
/* Do we have a valid request? */
if (status == Success)
{
if (stuff->minor_opcode < ASIZE(XETrapDispatchVector))
{
/* Then vector to the pointed to function */
status =
(*(XETrapDispatchVector[stuff->minor_opcode]))(stuff,client);
}
else
{
status = BadRequest;
}
}
return(status);
}
/*
* DESCRIPTION:
*
* This procedure is defined for the call to AddExtension()
* in which it is expected to be a parameter of the call.
*
* This routine would ordinarily be called by the server
* dispatcher when a client makes a request that is handled
* by the extension and the byte ordering of the client is
* DIFFERENT than that of the extension.
*/
int sXETrapDispatch(ClientPtr client)
{
REQUEST(xXTrapReq);
register int status = Success;
REQUEST_AT_LEAST_SIZE(xXTrapReq);
/* Have we seen this client before? */
if (XETenv[client->index] == NULL)
{
status = XETrapCreateEnv(client);
}
/* Do we have a valid request? */
if (status == Success)
{
if (stuff->minor_opcode < ASIZE(XETSwDispatchVector))
{
/* Then vector to the pointed to function */
status =
(*(XETSwDispatchVector[stuff->minor_opcode]))(stuff,client);
}
else
{
status = BadRequest;
}
}
return(status);
}
/*
* DESCRIPTION:
*
* This routine will place the extension in a steady and known
* state. Any current state will be reset. This is called either
* by a client request (dispatched) or when a new client environment
* is created.
*
*/
int XETrapReset(xXTrapReq *request, ClientPtr client)
{
static xXTrapConfigReq DummyReq;
register int i;
register int status = Success;
XETrapEnv *penv = XETenv[client->index];
/* in case any i/o's pending */
(void)XETrapStopTrap((xXTrapReq *)NULL, client);
penv->cur.hdr.type = X_Reply;
penv->cur.hdr.length = XEXTRA(xXTrapGetCurReply);
/* Fill in a dummy config request to clear all elements */
for (i=0L; i<ASIZE(DummyReq.config_flags_valid); i++)
{
DummyReq.config_flags_valid[i] = 0xFFL; /* set all the valid flags */
DummyReq.config_flags_data[i] = 0L; /* clear all data flags */
}
/* Don't reset grab server arbitrarily, it must be explicitly
* de-configured.
*/
BitSet(DummyReq.config_flags_data, XETrapGrabServer, ignore_grabs);
for (i=0L; i< ASIZE(DummyReq.config_flags_req); i++)
{
DummyReq.config_flags_req[i] = 0xFF; /* Clear all protocol requests */
}
for (i=0L; i< ASIZE(DummyReq.config_flags_event); i++)
{
DummyReq.config_flags_event[i] = 0xFF; /* Clear all protocol events */
}
/* Call config routine to clear all configurable fields */
status = XETrapConfig(&DummyReq, client);
/* reset the environment */
for (i=0L; i<ASIZE(penv->cur.data_state_flags); i++)
{
penv->cur.data_state_flags[i] = 0L; /* Clear all env flags */
}
penv->cur.data_config_max_pkt_size = XETrap_avail.data.max_pkt_size;
return(status);
}
/*
* DESCRIPTION:
*
* This function sends a reply back to the requesting client indicating
* the available states of the extension can be configured for.
*/
int XETrapGetAvailable(xXTrapGetReq *request, ClientPtr client)
{
XETrapEnv *penv = XETenv[client->index];
update_protocol(request, client);
/* Initialize the reply as needed */
XETrap_avail.data.xtrap_protocol = penv->protocol;
XETrap_avail.hdr.detail = XETrap_GetAvailable;
XETrap_avail.hdr.sequenceNumber = client->sequence;
WriteReplyToClient(client, sizeof(xXTrapGetAvailReply), &XETrap_avail);
return(Success);
}
/*
* DESCRIPTION:
*
* This function sends a reply back to the requesting client indicating
* the current state of the extension.
*/
int XETrapGetCurrent(xXTrapReq *request, ClientPtr client)
{
XETrapEnv *penv = XETenv[client->index];
int rep_size = (penv->protocol == 31 ? 284 : sz_xXTrapGetCurReply);
penv->cur.hdr.length = (rep_size - 32L) / SIZEOF(CARD32);
/* Initialize the reply as needed */
penv->cur.hdr.detail = XETrap_GetCurrent;
penv->cur.hdr.sequenceNumber = client->sequence;
WriteReplyToClient(client, rep_size, &(penv->cur));
return(Success);
}
/*
* DESCRIPTION:
*
* This function sends a reply back to the requesting client dumping
* statistics (counts) of requests and events. If stat's isn't
* configured, return failure.
*/
int XETrapGetStatistics(xXTrapReq *request, ClientPtr client)
{
int status = Success;
XETrapEnv *penv = XETenv[client->index];
if ((BitIsTrue(penv->cur.data_config_flags_data, XETrapStatistics)) &&
(penv->stats))
{
/* Initialize the reply as needed */
int rep_size = sizeof(xXTrapGetStatsReply);
penv->stats->detail = XETrap_GetStatistics;
penv->stats->sequenceNumber = client->sequence;
if (penv->protocol == 31)
{
xXTrapGetStatsReply rep_stats;
rep_stats = *penv->stats;
#ifndef VECTORED_EVENTS
rep_size = 1060;
#else
rep_size = 1544;
#endif
rep_stats.length = (rep_size - 32L) / SIZEOF(CARD32);
/*
* Now we need to shift the data *into* the header area
* for bug compatibility.
*/
memcpy(&(rep_stats.pad0),&(penv->stats->data),
sizeof(XETrapGetStatsRep));
WriteReplyToClient(client, rep_size, &rep_stats);
}
else
{
WriteReplyToClient(client, rep_size, penv->stats);
}
}
else
{
status = XETrapErrorBase + BadStatistics;
}
return(status);
}
/*
* DESCRIPTION:
*
* This function is dispatched when a client requests the extension to
* be configured in some manner.
*/
int XETrapConfig(xXTrapConfigReq *request, ClientPtr client)
{
UByteP vflags = request->config_flags_valid;
UByteP dflags = request->config_flags_data;
UByteP req_flags = request->config_flags_req;
UByteP event_flags = request->config_flags_event;
XETrapEnv *penv = XETenv[client->index];
UByteP bit_flags = penv->cur.data_config_flags_data;
int status = Success;
CARD32 i = 0L;
/* Check events and swap if desired */
if (BitIsTrue(vflags,XETrapEvent))
{ /* Loop through all of the events */
for (i=0L; i<ASIZE(EventProcVector); i++)
{
if (BitIsTrue(event_flags,i) && /* Do we care about this one? */
(BitValue(dflags,XETrapEvent) ^ /* Exclusive Or */
(BitValue(penv->cur.data_config_flags_event,i))))
{ /* At this point we *know* there's a change. The
* only question remaining is are there any more
* clients interested in this specific event. If
* so, *don't* swap this process!
*/
if (BitIsTrue(dflags,XETrapEvent))
{ /* Client wants the XTrap rtn */
if (++(vectored_events[i]) <= 1L)
{ /* first client, so do it */
_SwapProc(&(XETrapEventProcVector[i]),
&(EventProcVector[i]));
}
}
else
{ /* Client wants the *real* rtn */
if (--(vectored_events[i]) <= 0L)
{ /* No more clients using, so do it */
_SwapProc(&(XETrapEventProcVector[i]),
&(EventProcVector[i]));
}
}
switch(i)
{
case KeyPress: /* needed for command key processing */
case KeyRelease:
XETrapKbdDev->processInputProc =
(void_function)(EventProcVector[i] ?
(void_function)EventProcVector[i] :
(void_function)keybd_process_inp);
XETrapKbdDev->realInputProc =
(void_function)(EventProcVector[i] ?
(void_function)EventProcVector[i] :
(void_function)keybd_process_inp);
break;
#ifndef VECTORED_EVENTS
case ButtonPress: /* hack until events become vectored */
case ButtonRelease:
case MotionNotify:
XETrapPtrDev->processInputProc =
(void_function)EventProcVector[i];
XETrapPtrDev->realInputProc =
(void_function)EventProcVector[i];
break;
default:
status = BadImplementation;
break;
#endif /* !VECTORED_EVENTS */
}
BitToggle(penv->cur.data_config_flags_event,i);
}
}
}
if ((status == Success) &&
(_CheckChangeBit(vflags,dflags,bit_flags,XETrapCmd)))
{
if (BitIsTrue(dflags, XETrapCmd))
{ /* Add accelerator entry to cmd_clients list iff necessary */
penv->cur.data_config_cmd_key = request->config_cmd_key;
status = add_accelerator_node(penv->client, &cmd_clients);
}
else
{
penv->cur.data_config_cmd_key = 0L; /* default no KeyCode */
remove_accelerator_node(penv->client, &cmd_clients);
}
}
if ((status == Success) &&
(_CheckChangeBit(vflags,dflags,bit_flags,XETrapMaxPacket)))
{
if (BitIsTrue(dflags,XETrapMaxPacket))
{ /* Set size to what's passed in */
if (request->config_max_pkt_size < XETrapMinPktSize)
{ /* Tell them the value is too small */
status = BadValue;
}
else
{
penv->cur.data_config_max_pkt_size =
request->config_max_pkt_size;
}
}
else
{ /* Set it to the default (a *very* big number) */
penv->cur.data_config_max_pkt_size = 0xFFFF;
}
}
/* If the valid flag is set for requests, then each of the
* requests is swapped if it's different from current state.
*/
if (BitIsTrue(vflags,XETrapRequest) && status == Success)
{ /* Loop through all of the core requests */
for (i=0L; i<ASIZE(XETrapProcVector); i++)
{
if (BitIsTrue(req_flags,i) && /* Do we care about this one? */
(BitValue(dflags,XETrapRequest) ^ /* Exclusive Or */
(BitValue(penv->cur.data_config_flags_req,i))))
{ /* At this point we *know* there's a change. The
* only question remaining is are there any more
* clients interested in this specific request. If
* so, *don't* swap this process!
*/
if (BitIsTrue(dflags,XETrapRequest))
{ /* Client wants the XTrap rtn */
if (++(vectored_requests[i]) <= 1L)
{ /* first client, so do it */
_SwapProc(&(XETrapProcVector[i]), &(ProcVector[i]));
}
}
else
{ /* Client wants the *real* rtn */
if (--(vectored_requests[i]) <= 0L)
{ /* No more clients using, so do it */
_SwapProc(&(XETrapProcVector[i]), &(ProcVector[i]));
}
}
if (status == Success)
{
BitToggle(penv->cur.data_config_flags_req,i);
}
}
}
}
/* Check & Set the boolean flags */
if (status == Success)
{
_CheckChangeBit(vflags,dflags,bit_flags,XETrapCmdKeyMod);
_CheckChangeBit(vflags,dflags,bit_flags,XETrapTimestamp);
_CheckChangeBit(vflags,dflags,bit_flags,XETrapWinXY);
/* _CheckChangeBit(vflags,dflags,bit_flags,XETrapCursor); */
#ifdef COLOR_REPLIES
_CheckChangeBit(vflags,dflags,bit_flags,XETrapColorReplies);
#endif /* COLOR_REPLIES */
if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapGrabServer))
{ /* Let any client uncoditionally set/clear Grabs */
ignore_grabs = BitValue(dflags, XETrapGrabServer);
}
}
/* The statistics vflag/dflag mechanism is a little different
* from most. The dflag is initially set to 0 to indicate no
* statistics. When a config request comes in to request
* statistics, memory's allocated and the dflag is set.
* Thereafter, whenever a client wants to clear the counters, he
* simply sets the vflag and clears the dflag. Multiple requests
* for statistics configuration are ignored, and the stats memory is
* free'd only when the client disconnects.
*/
if (status == Success)
{
if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapStatistics))
{
if (BitIsTrue(dflags,XETrapStatistics))
{ /* Do we need to allocate memory? */
if (penv->stats == NULL && (penv->stats =
(xXTrapGetStatsReply *)Xcalloc(sizeof(xXTrapGetStatsReply)))
!= NULL)
{ /* Set up the reply header */
penv->stats->type = X_Reply;
penv->stats->length = XEXTRA(xXTrapGetStatsReply);
/* add accelerator node for stats clients list */
status = add_accelerator_node(penv->client, &stats_clients);
}
else if (penv->stats == NULL)
{ /* No Memory! */
status = BadAlloc;
}
}
else
{ /* Zero out counters */
(void)memset(penv->stats->data.requests, 0L,
sizeof(penv->stats->data.requests));
(void)memset(penv->stats->data.events, 0L,
sizeof(penv->stats->data.events));
/* Re-cock the Stat's flag so that it'll
* sense a change for next zero'ing out
* of the counters.
*/
BitTrue(penv->cur.data_config_flags_data, XETrapStatistics);
}
}
}
return(status);
}
/*
* DESCRIPTION:
*
* This function sets the XETrapTrapActive bit to indicate that Trapping
* of requests and/or core events to the client may take place.
*
*/
int XETrapStartTrap(xXTrapReq *request, ClientPtr client)
{
XETrapEnv *penv = XETenv[client->index];
int status = add_accelerator_node(penv->client, &io_clients);
if (status == Success)
{
BitTrue(penv->cur.data_state_flags, XETrapTrapActive);
}
return(status);
}
/*
* DESCRIPTION:
*
* This function clears the XETrapTrapActive bit to indicate that Trapping
* of requests and/or core events to the client may *not* take place.
*
*/
int XETrapStopTrap(xXTrapReq *request, ClientPtr client)
{
XETrapEnv *penv = XETenv[client->index];
remove_accelerator_node(penv->client, &io_clients);
BitFalse(penv->cur.data_state_flags, XETrapTrapActive);
return(Success);
}
/*
* DESCRIPTION:
*
* This function sends a reply back to the requesting client indicating
* the specific XTrap version of this extension.
*/
int XETrapGetVersion(xXTrapGetReq *request, ClientPtr client)
{
xXTrapGetVersReply ver_rep;
XETrapEnv *penv = XETenv[client->index];
update_protocol(request,client); /* to agree on protocol version */
/* Initialize the reply as needed */
ver_rep.hdr.type = X_Reply;
ver_rep.hdr.detail = XETrap_GetVersion;
ver_rep.hdr.sequenceNumber = client->sequence;
ver_rep.hdr.length = XEXTRA(xXTrapGetVersReply);
ver_rep.data.xtrap_release = XETrap_avail.data.xtrap_release;
ver_rep.data.xtrap_version = XETrap_avail.data.xtrap_version;
ver_rep.data.xtrap_revision = XETrap_avail.data.xtrap_revision;
ver_rep.data.xtrap_protocol = penv->protocol; /* return agreed protocol */
WriteReplyToClient(client, sizeof(xXTrapGetVersReply), &ver_rep);
return(Success);
}
/*
* DESCRIPTION:
*
* This function sends a reply back to the requesting client indicating
* the specific XTrap version of this extension.
*/
int XETrapGetLastInpTime(xXTrapReq *request, ClientPtr client)
{
xXTrapGetLITimReply tim_rep;
XETrapEnv *penv = XETenv[client->index];
/* Initialize the reply as needed */
tim_rep.hdr.type = X_Reply;
tim_rep.hdr.detail = XETrap_GetLastInpTime;
tim_rep.hdr.sequenceNumber = client->sequence;
tim_rep.hdr.length = XEXTRA(xXTrapGetLITimReply);
tim_rep.data_last_time = penv->last_input_time;
WriteReplyToClient(client, sizeof(xXTrapGetLITimReply), &tim_rep);
return(Success);
}
/*
* DESCRIPTION:
*
* This routine is swapped in for the server's output request vectors.
* After writing the request to one (or more) XTrap client(s), this
* routine ALWAYS returns by calling the REAL output request vector rtn.
*
* Note: Swapped Requests are handled automatically since the unswapped
* vectored routine is called after the request has been swapped.
* IOW, all requests are directed through ProcVector eventually and are
* "unswapped" at that point. It is necessary to swap the data
* back if writing to a swapped client, however, and this is done
* by calling the appropriate XETSwProcVector[] routine.
*/
int XETrapRequestVector(ClientPtr client)
{
int status = True;
XETrapDatum *pdata, *spdata = NULL;
REQUEST(xResourceReq);
WindowPtr window_ptr;
XETrapEnv *penv;
BYTE *tptr;
ClientList *ioc = &io_clients;
ClientList *stc = &stats_clients;
INT32 asize = sizeof(pdata->hdr) + stuff->length * sizeof(CARD32);
INT32 size = MAX(asize,XETrapMinPktSize); /* Must be at least */
INT32 csize; /* size of request to send to the XTrap client */
/* Get memory for the data to be sent */
if ((pdata = (XETrapDatum *)Xcalloc(size)) == NULL)
{ /* Can't do anything accept set a flag since we don't
* know who to send the error to yet.
*/
status = False;
}
while (ioc->next != NULL)
{
ioc = ioc->next;
penv = XETenv[ioc->client->index];
if (status == False)
{ /* We didn't get the memory! Complain */
SendErrorToClient(penv->client,XETrap_avail.data.major_opcode,
stuff->reqType, 0L, BadAlloc);
break;
}
if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType))
{ /* This particular client is interested in *this* request */
pdata->hdr.client = client->index; /* stuff client index in hdr */
if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY))
{
window_ptr = (WindowPtr) LookupDrawable(stuff->id, client);
if (window_ptr == 0L)
{ /* Failed...invalidate the X and Y coordinate data. */
pdata->hdr.win_x = -1L;
pdata->hdr.win_y = -1L;
}
else
{
pdata->hdr.screen = window_ptr->drawable.pScreen->myNum;
pdata->hdr.win_x = window_ptr->drawable.x;
pdata->hdr.win_y = window_ptr->drawable.y;
}
}
if (BitIsTrue(penv->cur.data_config_flags_data,XETrapTimestamp))
{
pdata->hdr.timestamp = GetTimeInMillis();
}
/* Copy the information to a location we can write it from */
(void) memcpy(&(pdata->u.req),stuff,stuff->length*sizeof(CARD32));
pdata->hdr.count = MIN(penv->cur.data_config_max_pkt_size,asize);
XETrapSetHeaderRequest(&(pdata->hdr));
/* Perform any needed byte/word swapping. NOTE: This is not
* the "normal" technique that should be used to perform the
* swapping. The reason that we do it here is to be sure to
* do it only once in a controlled manner, which we can not
* guarentee in the case of the Xlib transport. Notice that
* we don't swap the XTRAP EVENT information. This is done
* in the XETrapWriteXLib() routine.
*/
if (penv->client->swapped)
{ /* need to deal with swapped clients */
if (spdata == NULL)
{ /* Get memory for the swapped data to be sent */
if ((spdata = (XETrapDatum *)Xcalloc(size)) == NULL)
{
SendErrorToClient(penv->client,
XETrap_avail.data.major_opcode,
stuff->reqType, 0L, BadAlloc);
break;
}
memcpy(spdata,pdata,size); /* fill in the info */
/* Now call the request-specific rtn to swap the request */
if (stuff->reqType < 128)
{ /* a core request, good */
(*XETSwProcVector[stuff->reqType])(&(spdata->u.req),
penv->client); /* RTC X11R6 */
}
else if (penv->cur.data_config_max_pkt_size ==
XETrapMinPktSize)
{ /* Minimum size, so swap it as an ResourceReq */
XETSwResourceReq(&(spdata->u.req));
}
else
{ /* trying to swap an extension request! */
SendErrorToClient(penv->client,
XETrap_avail.data.major_opcode,
stuff->reqType, 0L, XETrapErrorBase + BadSwapReq);
}
}
/* need to stow in the latest header (count) */
memcpy(spdata,pdata,SIZEOF(XETrapHeader));
sXETrapHeader(&(spdata->hdr)); /* swap the XTrap Header */
}
/* Write as many bytes of information as the client wants */
tptr = (BYTE *)(penv->client->swapped ? spdata : pdata);
csize = MAX(pdata->hdr.count, XETrapMinPktSize);
if (XETrapWriteXLib(penv, tptr, csize) != csize)
{
SendErrorToClient(penv->client,XETrap_avail.data.major_opcode,
stuff->reqType, 0L, XETrapErrorBase + BadIO);
}
#ifdef COLOR_REPLIES
/* Process Color Replies, if desired, and applicable */
if (BitIsTrue(penv->cur.data_config_flags_data,XETrapColorReplies))
{ /* wants color replies */
switch(stuff->reqType)
{
case X_AllocColor:
GetSendColorRep(client, stuff);
break;
case X_AllocNamedColor:
GetSendNamedColorRep(client, stuff);
break;
case X_AllocColorCells:
GetSendColorCellsRep(client, stuff);
break;
case X_AllocColorPlanes:
GetSendColorPlanesRep(client, stuff);
break;
default:
break;
}
}
#endif /* COLOR_REPLIES */
}
}
while (stc->next != NULL)
{ /* increment appropriate stats bucket for each interested client */
stc = stc->next;
penv = XETenv[stc->client->index];
if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType))
{ /* This particular client would like this particular stat */
penv->stats->data.requests[stuff->reqType]++;
}
}
if (pdata)
{
Xfree(pdata);
}
if (spdata)
{
Xfree(spdata);
}
if (ignore_grabs == True &&
(stuff->reqType == X_GrabServer || stuff->reqType == X_UngrabServer))
{ /* doesn't want Grab's! Note: this is a "last configured" setting */
#ifndef NO_NEW_XTRAP
int status;
if (stuff->reqType == X_GrabServer)
{
ClientList *pclient;
/* first call grab server procedure */
status = (*XETrapProcVector[stuff->reqType])(client);
/* then add XTrap controlling clients */
for (pclient = &io_clients; pclient; pclient = pclient->next)
if (pclient->client)
MakeClientGrabImpervious(pclient->client);
}
else
{
ClientList *pclient;
/* first drop XTrap controlling clients */
for (pclient = &io_clients; pclient; pclient = pclient->next)
if (pclient->client)
MakeClientGrabPervious(pclient->client);
/* then call ungrab server procedure */
status = (*XETrapProcVector[stuff->reqType])(client);
}
return status;
#else /* NO_NEW_XTRAP */
return(Success);
#endif /* NO_NEW_XTRAP */
}
else
{
return((*XETrapProcVector[stuff->reqType])(client));
}
}
/*
*
* DESCRIPTION:
*
* This routine intercepts input xEvents from the keyboard.
* if XETrapTrapActive, will write record to client(s)
* and then pass the event to the server iff not command
* key and gate is open. If it's a command key, then twiddle
* the gate state as required (optional, see below).
*
* This routine implements an optional user specified command key
* that can be used to close the input pipe into the server
* while a client command is generated. The keypress of the
* command key places this routine in command mode, the keyrelease
* exits command mode.
*
* A keypress of the command key followed by the
* optionally specified lock key will place this routine in continuous
* command mode until the command key and lock key are pressed again
* to exit command mode. In the locked state, the client interprets
* keystrokes as it wishes, as commands or as input to a prior command.
*
* Both mechanisms can be used alternately.
*
* IMPLICIT INPUTS :
*
* penv->cur.data_config_cmd_key :
* This is the keycode of the key that is used to stop
* and restart the transmission of intercepted input
* events to the server. If specified, the gate_state
* flag will be set or cleared depending on the state of
* the command_key.
*
* penv->cur.data_config_flags_data.XETrapCmdKeyMod:
* This is the value of the mode in which the command_key
* will operate. It currently has two values: MODIFIER and
* COMMAND_LOCK. MODIFIER mode clears gate_state on
* keypress, and sets gate_state on keyrelease.
* COMMAND_LOCK mode toggles gate_state on
* or off.
*
* gate_closed:
* A flag that is set/cleared in the xtrap_keyboard
* routine that indicates whether intercepted input
* should be passed to the server at any particular
* instance.
*
*
* next_key:
* This variable tracks the state of the next key to be
* pressed or released. It allows the checking of double
* presses of the command key to be sent to the server and
* keeps good state order when the command key is used.
*
* key_ignore:
* This variable indicates whether or not the specific
* key should be ignored for subsequent server processing.
*
*/
int XETrapKeyboard(xEvent *x_event, DevicePtr keybd, int count)
{
register BYTE type = x_event->u.u.type;
register BYTE detail = x_event->u.u.detail;
XETrapEnv *penv;
ClientList *stc = &stats_clients;
ClientList *cmc = &cmd_clients;
int_function cur_func = XETrapKeyboard;
#ifdef VERBOSE
if (count != 1L)
{ /* We haven't coded for this situation yet! */
ErrorF("Warning! Event count != 1 (%d)\n", count);
}
#endif
while (stc->next != NULL)
{ /* increment appropriate stats bucket for each interested client */
stc = stc->next;
penv = XETenv[stc->client->index];
if (BitIsTrue(penv->cur.data_config_flags_event,type))
{ /* This particular client would like this particular stat */
penv->stats->data.events[type]++;
}
}
#ifndef VECTORED_EVENTS
/* We *only* StampAndMail command keys with vectored events since
* we get much more data by waiting till we get called in XETrapEventVector
*/
XETrapStampAndMail(x_event); /* send to XTrap client if necessry */
#endif
while (cmc->next != NULL)
{
cmc = cmc->next;
penv = XETenv[cmc->client->index];
key_ignore = False;
if (detail == penv->cur.data_config_cmd_key)
{
if (BitIsTrue(penv->cur.data_config_flags_data, XETrapCmdKeyMod))
{
switch (type)
{
case KeyPress:
if (next_key == XEKeyIsEcho)
{
break;
}
gate_closed = True;
next_key = XEKeyIsClear;
break;
case KeyRelease:
if (next_key == XEKeyIsEcho)
{
next_key = XEKeyIsClear;
break;
}
if (next_key == XEKeyIsClear)
{
next_key = XEKeyIsEcho;
}
else
{ /* it's Other, so Clear it */
next_key = XEKeyIsClear;
}
gate_closed = False;
key_ignore = True;
break;
default: break;
}
}
else
{
switch (type)
{
case KeyPress:
if (next_key == XEKeyIsEcho)
{
gate_closed = False;
break;
}
/* Open gate on cmd key release */
if ((next_key == XEKeyIsOther) &&
gate_closed == True)
{
break;
}
gate_closed = True;
next_key = XEKeyIsClear;
break;
case KeyRelease:
if (next_key == XEKeyIsClear)
{
next_key = XEKeyIsEcho;
break;
}
if (next_key == XEKeyIsEcho)
{
next_key = XEKeyIsClear;
break;
}
gate_closed = False;
key_ignore = True;
next_key = XEKeyIsClear;
break;
default:
break;
}
}
}
else
{
next_key = XEKeyIsOther;
}
}
/*
* If the gate to the server is open,
* and we are not ignoring a keyrelease,
* pass the event to the server for normal processing.
*/
#ifndef VECTORED_EVENTS
if ((gate_closed == False) && (key_ignore == False))
{
if (XETrapEventProcVector[type] != cur_func)
{ /* to protect us from infinite loops */
(void)(*XETrapEventProcVector[type])(x_event,keybd,count);
}
else
{
(void)(*EventProcVector[type])(x_event,keybd,count);
}
}
#else /* VECTORED_EVENTS */
if ((gate_closed == False) && (key_ignore == False))
{ /* send event on to server to be trapped again in XETrapEventVector */
(void)(*keybd_process_inp)(x_event,keybd,count);
}
else
{
XETrapStampAndMail(x_event); /* send to XTrap client if necessry */
}
#endif
key_ignore = False; /* reset for next time around */
return 0;
}
/*
* DESCRIPTION:
*
* This routine intercepts input xEvents from the pointer device
* and passes the input event back to the server for normal processing.
*
* This routine is sensitive to whether input is being passed
* up to the server or not. This state is set by the keyboard
* input routine.
*
*
*/
#ifndef VECTORED_EVENTS
int XETrapPointer(xEvent *x_event, DevicePtr ptrdev, int count)
{
XETrapEnv *penv;
ClientList *stc = &stats_clients;
int_function cur_func = XETrapPointer;
#ifdef VERBOSE
if (count != 1L)
{ /* We haven't coded for this situation yet! */
ErrorF("Warning! Event count != 1 (%d)\n", count);
}
#endif
while (stc->next != NULL)
{ /* increment appropriate stats bucket for each interested client */
stc = stc->next;
penv = XETenv[stc->client->index];
if (BitIsTrue(penv->cur.data_config_flags_event,x_event->u.u.type))
{ /* This particular client would like this particular stat */
penv->stats->data.events[x_event->u.u.type]++;
}
}
XETrapStampAndMail(x_event); /* send to XTrap client if necessry */
/*
* If the gate to the server is open,
* pass the event up like nothing has happened.
*/
if (gate_closed == False)
{
if (XETrapEventProcVector[x_event->u.u.type] != cur_func)
{ /* to protect us from infinite loops */
(void)(*XETrapEventProcVector[x_event->u.u.type])(x_event,ptrdev,
count);
}
else
{
(void)(*EventProcVector[x_event->u.u.type])(x_event,ptrdev,count);
}
}
return 0;
}
#endif /* !VECTORED_EVENTS */
/*
* DESCRIPTION:
*
* This routine determines whether it needs to send event data
* to the XTrap Client(s). If so, it timestamps it appropriately
* and writes out both the header and detail information.
*
*/
void XETrapStampAndMail(xEvent *x_event)
{
XETrapDatum data;
register CARD32 size;
XETrapEnv *penv;
ClientList *ioc = &io_clients;
/* Currently, we're intercepting core events *before* most
* of the event information's filled in. Specifically, the
* only fields that are valid at this level are: type, detail,
* time, rootX, rootY, and state.
*/
/* Loop through all clients wishing I/O */
while (ioc->next != NULL)
{
ioc = ioc->next;
penv = XETenv[ioc->client->index];
/* Do we have a valid fd? Do we care about this event? */
if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type))
{
XETrapSetHeaderEvent(&(data.hdr));
data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */
data.hdr.screen = 0L; /* not till Events are vectored! */
data.hdr.client = 0L; /* not till Events are vectored! */
if (BitIsTrue(penv->cur.data_config_flags_data,
XETrapTimestamp))
{
data.hdr.timestamp = GetTimeInMillis();
}
size = data.hdr.count = XETrapMinPktSize; /* Always for evts */
penv->last_input_time = x_event->u.keyButtonPointer.time;
/* Copy the event information into our local memory */
(void)memcpy(&(data.u.event),x_event,sizeof(xEvent));
#ifdef PANORAMIX
if (!noPanoramiXExtension &&
(data.u.event.u.u.type == MotionNotify ||
data.u.event.u.u.type == ButtonPress ||
data.u.event.u.u.type == ButtonRelease ||
data.u.event.u.u.type == KeyPress ||
data.u.event.u.u.type == KeyRelease)) {
int scr = XineramaGetCursorScreen();
data.u.event.u.keyButtonPointer.rootX +=
panoramiXdataPtr[scr].x - panoramiXdataPtr[0].x;
data.u.event.u.keyButtonPointer.rootY +=
panoramiXdataPtr[scr].y - panoramiXdataPtr[0].y;
}
#endif
if (penv->client->swapped)
{ /*
* Notice that we don't swap the XTRAP EVENT information.
* This is done in the XETrapWriteXLib() routine.
*/
xEvent ToEvent;
(*EventSwapVector[data.u.event.u.u.type & 0177])
(&data.u.event,&ToEvent);
(void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent));
sXETrapHeader(&(data.hdr)); /* swap the XTrap Header */
}
/* From this point on, the contents of data is swapped and
* therefore we should not refer to it for information.
*/
if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size)
{
SendErrorToClient(penv->client,
XETrap_avail.data.major_opcode,
x_event->u.u.type, 0L, XETrapErrorBase + BadIO);
}
}
}
return;
}
#ifdef VECTORED_EVENTS
int XETrapEventVector(ClientPtr client, xEvent *x_event)
{
XETrapDatum data;
register CARD32 size;
XETrapEnv *penv;
ClientList *ioc = &io_clients;
/* Loop through all clients wishing I/O */
while (ioc->next != NULL)
{
ioc = ioc->next;
penv = XETenv[ioc->client->index];
/* Do we care about this event? */
if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type))
{
XETrapSetHeaderEvent(&(data.hdr));
data.hdr.client = client->index;
data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */
if ((current_screen < 0L) || ((x_event->u.u.type >= KeyPress) &&
(x_event->u.u.type <= MotionNotify) &&
(!x_event->u.keyButtonPointer.sameScreen)))
{ /* we've moved/warped to another screen */
WindowPtr root_win = GetCurrentRootWindow();
current_screen = root_win->drawable.pScreen->myNum;
}
data.hdr.screen = current_screen;
if (BitIsTrue(penv->cur.data_config_flags_data,
XETrapTimestamp))
{
data.hdr.timestamp = GetTimeInMillis();
}
size = data.hdr.count = XETrapMinPktSize; /* Always for evts */
penv->last_input_time = x_event->u.keyButtonPointer.time;
/* Copy the event information into our local memory */
(void)memcpy(&(data.u.event),x_event,sizeof(xEvent));
if (penv->client->swapped)
{
xEvent ToEvent;
(*EventSwapVector[data.u.event.u.u.type & 0177])
(&data.u.event,&ToEvent);
(void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent));
sXETrapHeader(&(data.hdr)); /* swap the XTrap Header */
}
/* From this point on, the contents of pdata is swapped and
* therefore we should not refer to it for information.
*/
if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size)
{
SendErrorToClient(penv->client,
XETrap_avail.data.major_opcode,
x_event->u.u.type, 0L, XETrapErrorBase + BadIO);
}
}
}
return;
}
#endif /* VECTORED_EVENTS */
void sReplyXTrapDispatch(ClientPtr client, int size, char *reply)
{
register XETrapRepHdr *rep = (XETrapRepHdr *)reply;
switch(rep->detail)
{
case XETrap_GetAvailable:
{
xXTrapGetAvailReply lrep;
(void)memcpy((char *)&lrep,reply,sizeof(lrep));
sReplyXETrapGetAvail(client,size,(char *)&lrep);
}
break;
case XETrap_GetCurrent:
{
xXTrapGetCurReply lrep;
(void)memcpy((char *)&lrep,reply,sizeof(lrep));
sReplyXETrapGetCur(client,size,(char *)&lrep);
}
break;
case XETrap_GetStatistics:
{
xXTrapGetStatsReply lrep;
(void)memcpy((char *)&lrep,reply,sizeof(lrep));
sReplyXETrapGetStats(client,size,(char *)&lrep);
}
break;
case XETrap_GetVersion:
{
xXTrapGetVersReply lrep;
(void)memcpy((char *)&lrep,reply,sizeof(lrep));
sReplyXETrapGetVers(client,size,(char *)&lrep);
}
break;
case XETrap_GetLastInpTime:
{
xXTrapGetLITimReply lrep;
(void)memcpy((char *)&lrep,reply,sizeof(lrep));
sReplyXETrapGetLITim(client,size,(char *)&lrep);
}
break;
default:
SendErrorToClient(client,XETrap_avail.data.major_opcode,
rep->detail, 0L, BadImplementation);
break;
}
return;
}
/*
* XLib communications routines
*/
/*
* DESCRIPTION:
*
* This function performs the transport specific functions required
* for writing data back to an XTrap client over XLib. The trick is
* packaging the data into <=32 byte packets to conform to the sizeof
* an X Event. nbytes must be at least equal to XETrapMinPktSize
*
*/
int XETrapWriteXLib(XETrapEnv *penv, BYTE *data, CARD32 nbytes)
{
CARD32 size, total = 0L;
xETrapDataEvent event;
/* Initialize the detail field to show the beginning of a datum */
event.detail = XETrapDataStart;
event.idx = 0L;
/* This loop could be optimized by not calling Write until after all
* of the events are packaged. However, this would require memory
* games, and may not therefore be a win.
*/
while (nbytes > 0L)
{ /* How many bytes can we send in this packet */
size = (nbytes > sz_EventData) ? sz_EventData : nbytes;
/* Initialize the event */
event.type = XETrapData + XETrap_avail.data.event_base;
event.sequenceNumber = penv->client->sequence;
/* Copy the data we are sending */
(void)memcpy(event.data,data,size);
if (size < sz_EventData)
(void)memset(event.data+size,0L,sz_EventData-size);
data += size;
nbytes -= size;
total += size;
/* Set the detail field to show the continuation of datum */
if (total != size)
{ /* this is not the first one */
event.detail = (nbytes > 0) ? XETrapDataContinued : XETrapDataLast;
}
/* Send this part to the client */
WriteEventsToClient(penv->client, 1L, (xEvent *) &event);
event.idx++; /* Bump the index for the next event */
}
return(total);
}
/*----------------------------*
* Static Functions
*----------------------------*/
static void update_protocol(xXTrapGetReq *reqptr, ClientPtr client)
{
XETrapEnv *penv = XETenv[client->index];
/* update protocol number */
switch (reqptr->protocol)
{
/* known acceptable protocols */
case 31:
case XETrapProtocol:
penv->protocol = reqptr->protocol;
break;
/* all else */
default: /* stay backwards compatible */
penv->protocol = 31;
break;
}
}
/* Swap 2 functions. This is a function instead of a macro to help to keep
* lint from complaining about mixed types. It seems to work, but I would
* probably classify this as a hack.
*/
static void _SwapProc( register int (**f1)(), register int (**f2)())
{
register int (*t1)() = *f1;
*f1 = *f2;
*f2 = t1;
return;
}
/*
* DESCRIPTION:
*
* This function swaps the byte order of fields within
* the XTrap Event Header. It assumes the data will be
* swapped by code in XETrapRequestVector().
*
*/
static void sXETrapEvent(xETrapDataEvent *from, xETrapDataEvent *to)
{
to->type = from->type;
to->detail = from->detail;
cpswaps(from->sequenceNumber,to->sequenceNumber);
cpswapl(from->idx,to->idx);
/* Assumes that the data's already been swapped by XETrapRequestVector */
memcpy(to->data, from->data, SIZEOF(EventData));
}
/*
* DESCRIPTION:
*
* This function adds a node from an accelerator linked-list
* (either io_clients, stats_clients, or cmd_clients).
*
*/
static int add_accelerator_node(ClientPtr client, ClientList *accel)
{
Bool found = False;
int status = Success;
while (accel->next != NULL)
{
if (accel->client == client)
{
found = True; /* Client's already known */
break;
}
else
{
accel = accel->next;
}
}
if (found == False)
{
if ((accel->next = (ClientList *)Xcalloc(sizeof(ClientList))) == NULL)
{
status = BadAlloc;
}
else
{ /* fill in the node */
accel = accel->next;
accel->next = NULL;
accel->client = client;
}
}
return(status);
}
/*
* DESCRIPTION:
*
* This function removes a node from an accelerator linked-list
* (either io_clients, stats_clients, or cmd_clients).
*
*/
static void remove_accelerator_node(ClientPtr client, ClientList *accel)
{
while (accel->next != NULL)
{
if (accel->next->client == client)
{
ClientList *tmp = accel->next->next;
Xfree(accel->next);
accel->next = tmp;
break;
}
else
{
accel = accel->next;
}
}
return;
}
#ifdef COLOR_REPLIES
static void GetSendColorRep(ClientPtr client, xResourceReq *req)
{ /* adapted from ProcAllocColor() in dispatch.c */
XETrapDatum data;
int retval;
XETrapEnv *penv = XETenv[client->index];
xAllocColorReply *crep = (xAllocColorReply *)&(data.u.reply);
xAllocColorReq *creq = (xAllocColorReq *)req;
ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
/* Fill in the header fields */
data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */
XETrapSetHeaderReply(&(data.hdr));
/* Hack alert:
* We need to pass the "reply" type in the header since replies don't
* contain the id's themselves. However, we're not changing the
* protocol to support this until we decide exactly how we want to
* do *all* replies (e.g. not just ColorReplies). So until then, stow
* the reply id in the screen field which wouldn't normally be used in
* this context.
*/
data.hdr.screen = req->reqType;
if (!pmap)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadColor);
return;
}
crep->red = creq->red;
crep->green = creq->green;
crep->blue = creq->blue;
crep->pixel = 0;
if ((retval = AllocColor(pmap, &(crep->red), &(crep->green),
&(crep->blue), &(crep->pixel), client->index)) != Success)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, retval);
return;
}
/* Swap data if necessary */
if (client->swapped)
{
INT32 n;
swaps(&(crep->red), n);
swaps(&(crep->green), n);
swaps(&(crep->blue), n);
swapl(&(crep->pixel), n);
}
/* Send data to client */
if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize)
!= XETrapMinPktSize)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, XETrapErrorBase + BadIO);
}
}
static void GetSendNamedColorRep(ClientPtr client, xResourceReq *req)
{ /* adapted from ProcAllocNamedColor() in dispatch.c */
XETrapDatum data;
XETrapEnv *penv = XETenv[client->index];
int retval;
xAllocNamedColorReply *nrep = (xAllocNamedColorReply *)&(data.u.reply);
xAllocNamedColorReq *nreq = (xAllocNamedColorReq *)req;
ColormapPtr pcmp = (ColormapPtr )LookupIDByType(nreq->cmap, RT_COLORMAP);
data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */
XETrapSetHeaderReply(&(data.hdr));
/* Hack alert:
* We need to pass the "reply" type in the header since replies don't
* contain the id's themselves. However, we're not changing the
* protocol to support this until we decide exactly how we want to
* do *all* replies (e.g. not just ColorReplies). So until then, stow
* the reply id in the screen field which wouldn't normally be used in
* this context.
*/
data.hdr.screen = req->reqType;
if (!pcmp)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadColor);
return;
}
if (!OsLookupColor(pcmp->pScreen->myNum, (char *)&nreq[1],
nreq->nbytes, &(nrep->exactRed), &(nrep->exactGreen),
&(nrep->exactBlue)))
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadName);
return;
}
nrep->screenRed = nrep->exactRed;
nrep->screenGreen = nrep->exactGreen;
nrep->screenBlue = nrep->exactBlue;
nrep->pixel = 0;
if ((retval = AllocColor(pcmp, &(nrep->screenRed),
&(nrep->screenGreen), &(nrep->screenBlue), &(nrep->pixel),
client->index)) != Success)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, retval);
return;
}
/* Swap data if necessary */
if (client->swapped)
{
INT32 n;
swapl(&(nrep->pixel), n);
swaps(&(nrep->exactRed), n);
swaps(&(nrep->exactGreen), n);
swaps(&(nrep->exactBlue), n);
swaps(&(nrep->screenRed), n);
swaps(&(nrep->screenGreen), n);
swaps(&(nrep->screenBlue), n);
}
/* Send data to client */
if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize)
!= XETrapMinPktSize)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, XETrapErrorBase + BadIO);
}
}
static void GetSendColorCellsRep(ClientPtr client, xResourceReq *req)
{ /* adapted from ProcAllocColorCells() in dispatch.c */
int retval;
int npixels, nmasks;
unsigned long *ppixels, *pmasks;
long length;
XETrapDatum *data;
XETrapEnv *penv = XETenv[client->index];
xAllocColorCellsReply *crep;
xAllocColorCellsReq *creq = (xAllocColorCellsReq *)req;
ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
if (!pmap)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadColor);
return;
}
npixels = creq->colors;
if (!npixels)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadValue);
return;
}
nmasks = creq->planes;
length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
data = (XETrapDatum *)ALLOCATE_LOCAL(sizeof(XETrapDatum)+length);
if (!data)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadAlloc);
return;
}
data->hdr.count = MIN(penv->cur.data_config_max_pkt_size,
sizeof(XETrapDatum)+length);
XETrapSetHeaderReply(&(data->hdr));
data->hdr.screen = req->reqType; /* hack! but necessary */
ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum));
pmasks = ppixels + npixels;
if ((retval = AllocColorCells(client->index, pmap, npixels,
nmasks, (Bool)creq->contiguous, ppixels, pmasks)) != Success)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, retval);
DEALLOCATE_LOCAL(data);
return;
}
crep = (xAllocColorCellsReply *)&(data->u.reply);
crep->nPixels = npixels;
crep->nMasks = nmasks;
/* Swap data if necessary */
if (client->swapped)
{
INT32 n, i, *ptr;
ptr=(INT32 *)ppixels;
swaps(&(crep->nPixels), n);
swaps(&(crep->nMasks), n);
for (i=0; i<length; i++)
{
swapl(&(ptr[i]), n);
}
}
/* Send data to client */
if (XETrapWriteXLib(penv, (BYTE *)&data, data->hdr.count)
!= data->hdr.count)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, XETrapErrorBase + BadIO);
}
DEALLOCATE_LOCAL(data);
}
static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req)
{ /* adapted from ProcAllocColorPlanes() in dispatch.c */
int retval;
int npixels, nmasks;
unsigned long *ppixels, *pmasks;
long length;
XETrapDatum *data;
XETrapEnv *penv = XETenv[client->index];
xAllocColorPlanesReply *crep;
xAllocColorPlanesReq *creq = (xAllocColorPlanesReq *)req;
ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
if (!pmap)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadColor);
return;
}
npixels = creq->colors;
if (!npixels)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadValue);
return;
}
length = (long)npixels * sizeof(Pixel);
data = (XETrapDatum *)ALLOCATE_LOCAL(sizeof(XETrapDatum)+length);
if (!data)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, BadAlloc);
return;
}
data->hdr.count = MIN(penv->cur.data_config_max_pkt_size,
sizeof(XETrapDatum)+length);
XETrapSetHeaderReply(&(data->hdr));
data->hdr.screen = req->reqType; /* hack! but necessary */
ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum));
crep = (xAllocColorPlanesReply *)&(data->u.reply);
if ((retval = AllocColorPlanes(client->index, pmap, npixels,
(int)creq->red, (int)creq->green, (int)creq->blue,
(int)creq->contiguous, ppixels, &(crep->redMask), &(crep->greenMask),
&(crep->blueMask))) != Success)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, retval);
DEALLOCATE_LOCAL(data);
return;
}
crep->nPixels = npixels;
/* Swap data if necessary */
if (client->swapped)
{
INT32 n, i, *ptr;
ptr=(INT32 *)ppixels;
swaps(&(crep->nPixels), n);
swapl(&(crep->redMask), n);
swapl(&(crep->greenMask), n);
swapl(&(crep->blueMask), n);
for (i=0; i<length; i++)
{
swapl(&(ptr[i]), n);
}
}
/* Send data to client */
if (XETrapWriteXLib(penv, (BYTE *)&data, data->hdr.count)
!= data->hdr.count)
{
SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
req->reqType, 0L, XETrapErrorBase + BadIO);
}
DEALLOCATE_LOCAL(data);
}
#endif /* COLOR_REPLIES */
/* $XFree86$ */
/****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991, 1992 by
Digital Equipment Corp., Maynard, MA
X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH.
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 AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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.
*****************************************************************************/
/*
* ABSTRACT:
*
* This module is the device independent module responsible for all
* routines required for proper communication in a heterogeneous
* networking environment (i.e. client & server on different endian
* machines). The bulk of this module is patterned after X11/R4's
* server/dix/swapreq.c ; however, they infact swap fields
* in the exact opposite order since XTrap requires "unswapped" data
* to become "swapped" before sending it to a "swapped" client.
*
* CONTRIBUTORS:
*
* Ken Miller
* Marc Evans
*
* CHANGES:
*
* Robert Chesler - added client arg for X11R6 port in many spots
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/Xproto.h>
#include <nx-X11/Xprotostr.h>
#include <nx-X11/extensions/xtrapdi.h>
#include "input.h" /* Server DevicePtr definitions */
#include "misc.h"
#include "dixstruct.h"
#ifdef PC
# include "extnsist.h"
#else
# include "extnsionst.h" /* Server ExtensionEntry definitions */
#endif
# include "swapreq.h" /* Server SwapColorItem definition */
#include <nx-X11/extensions/xtrapddmi.h>
#include <nx-X11/extensions/xtrapproto.h>
/* In-coming XTrap requests needing to be swapped to native format */
int sXETrapReset(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapReset(request,client));
}
int sXETrapGetAvailable(xXTrapGetReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
swaps(&(request->protocol),n);
return(XETrapGetAvailable(request,client));
}
int sXETrapConfig(xXTrapConfigReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
swaps(&(request->config_max_pkt_size),n);
return(XETrapConfig(request,client));
}
int sXETrapStartTrap(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapStartTrap(request,client));
}
int sXETrapStopTrap(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapStopTrap(request,client));
}
int sXETrapGetCurrent(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapGetCurrent(request,client));
}
int sXETrapGetStatistics(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapGetStatistics(request,client));
}
#ifndef _XINPUT
int sXETrapSimulateXEvent(xXTrapInputReq *request, ClientPtr client)
{
register char n;
swaps(&(request->input.x),n);
swaps(&(request->input.y),n);
return(XETrapSimulateXEvent(request,client));
}
#endif
int sXETrapGetVersion(xXTrapGetReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
swaps(&(request->protocol),n);
return(XETrapGetVersion(request,client));
}
int sXETrapGetLastInpTime(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapGetLastInpTime(request,client));
}
/* Out-going XTrap replies needing to be swapped *from* native format */
void sReplyXETrapGetAvail(ClientPtr client, int size, char *reply)
{
xXTrapGetAvailReply *rep = (xXTrapGetAvailReply *)reply;
register char n;
swaps(&(rep->hdr.sequenceNumber),n);
swapl(&(rep->hdr.length),n);
swapl(&(rep->data.pf_ident),n);
swaps(&(rep->data.xtrap_release),n);
swaps(&(rep->data.xtrap_version),n);
swaps(&(rep->data.xtrap_revision),n);
swaps(&(rep->data.max_pkt_size),n);
swapl(&(rep->data.major_opcode),n);
swapl(&(rep->data.event_base),n);
swaps(&(rep->data.cur_x),n);
swaps(&(rep->data.cur_y),n);
(void)WriteToClient(client,size,reply);
return;
}
void sReplyXETrapGetVers(ClientPtr client, int size, char *reply)
{
xXTrapGetVersReply *rep = (xXTrapGetVersReply *)reply;
register char n;
swaps(&(rep->hdr.sequenceNumber),n);
swapl(&(rep->hdr.length),n);
swaps(&(rep->data.xtrap_release),n);
swaps(&(rep->data.xtrap_version),n);
swaps(&(rep->data.xtrap_revision),n);
(void)WriteToClient(client,size,reply);
return;
}
void sReplyXETrapGetLITim(ClientPtr client, int size, char *reply)
{
xXTrapGetLITimReply *rep = (xXTrapGetLITimReply *)reply;
register char n;
swaps(&(rep->hdr.sequenceNumber),n);
swapl(&(rep->hdr.length),n);
swapl(&(rep->data_last_time),n);
(void)WriteToClient(client,size,reply);
return;
}
void sReplyXETrapGetCur(ClientPtr client, int size, char *reply)
{
xXTrapGetCurReply *rep = (xXTrapGetCurReply *)reply;
register char n;
swaps(&(rep->hdr.sequenceNumber),n);
swapl(&(rep->hdr.length),n);
swaps(&(rep->data_config_max_pkt_size),n);
(void)WriteToClient(client,size,reply);
return;
}
void sReplyXETrapGetStats(ClientPtr client, int size, char *reply)
{
xXTrapGetStatsReply *rep = (xXTrapGetStatsReply *)reply;
register char n;
register int i;
long *p;
swaps(&(rep->sequenceNumber),n);
swapl(&(rep->length),n);
for (i=0L, p = (long *)rep->data.requests; i<256L; i++, p++)
{
swapl(p,n);
}
for (i=0L, p = (long *)rep->data.events; i<XETrapCoreEvents; i++, p++)
{
swapl(p,n);
}
(void)WriteToClient(client,size,reply);
return;
}
/* Out-going XTrap I/O header needing to be swapped *from* native format */
void sXETrapHeader(XETrapHeader *hdr)
{
register char n;
swapl(&(hdr->count), n);
swapl(&(hdr->timestamp), n);
swaps(&(hdr->win_x), n);
swaps(&(hdr->win_y), n);
swaps(&(hdr->client), n);
}
/* Out-going requests needing to be swapped *from* native format
* aka swapreq.c "equivalents"
*/
/* The following is used for all requests that have
no fields to be swapped (except "length") */
void XETSwSimpleReq(register xReq *data)
{
register char n;
swaps(&(data->length), n);
}
/* The following is used for all requests that have
only a single 32-bit field to be swapped, coming
right after the "length" field */
void XETSwResourceReq(register xResourceReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->id), n);
}
void XETSwCreateWindow(register xCreateWindowReq *data,ClientPtr client)
{
register char n;
swapl(&(data->wid), n);
swapl(&(data->parent), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
swaps(&(data->borderWidth), n);
swaps(&(data->class), n);
swapl(&(data->visual), n);
swapl(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwChangeWindowAttributes(register xChangeWindowAttributesReq *data,
ClientPtr client)
{
register char n;
swapl(&(data->window), n);
swapl(&(data->valueMask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwReparentWindow(register xReparentWindowReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->parent), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
}
void XETSwConfigureWindow(xConfigureWindowReq *data, ClientPtr client)
{
register char n;
swapl(&(data->window), n);
swaps(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwInternAtom(register xInternAtomReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->nbytes), n);
}
void XETSwChangeProperty(register xChangePropertyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->property), n);
swapl(&(data->type), n);
switch ( data->format ) {
case 8L : break;
case 16L:
SwapShorts((short *)(data + 1), data->nUnits);
break;
case 32L:
SwapLongs((CARD32 *)(data + 1), data->nUnits);
break;
}
swapl(&(data->nUnits), n);
}
void XETSwDeleteProperty(register xDeletePropertyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->property), n);
}
void XETSwGetProperty(register xGetPropertyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->property), n);
swapl(&(data->type), n);
swapl(&(data->longOffset), n);
swapl(&(data->longLength), n);
}
void XETSwSetSelectionOwner(register xSetSelectionOwnerReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->selection), n);
swapl(&(data->time), n);
}
void XETSwConvertSelection(register xConvertSelectionReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->requestor), n);
swapl(&(data->selection), n);
swapl(&(data->target), n);
swapl(&(data->property), n);
swapl(&(data->time), n);
}
void XETSwSendEvent(register xSendEventReq *data)
{
register char n;
xEvent eventT;
void (*proc)();
swapl(&(data->destination), n);
swapl(&(data->eventMask), n);
/* Swap event */
proc = EventSwapVector[data->event.u.u.type & 0177];
if (!proc || (int (*)()) proc == (int (*)()) NotImplemented)
(*proc)(&(data->event), &eventT);
data->event = eventT;
swaps(&(data->length), n);
}
void XETSwGrabPointer(register xGrabPointerReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->eventMask), n);
swapl(&(data->confineTo), n);
swapl(&(data->cursor), n);
swapl(&(data->time), n);
}
void XETSwGrabButton(register xGrabButtonReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->eventMask), n);
swapl(&(data->confineTo), n);
swapl(&(data->cursor), n);
swaps(&(data->modifiers), n);
}
void XETSwUngrabButton(register xUngrabButtonReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->modifiers), n);
}
void XETSwChangeActivePointerGrab(register xChangeActivePointerGrabReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cursor), n);
swapl(&(data->time), n);
swaps(&(data->eventMask), n);
}
void XETSwGrabKeyboard(register xGrabKeyboardReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swapl(&(data->time), n);
}
void XETSwGrabKey(register xGrabKeyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->modifiers), n);
}
void XETSwUngrabKey(register xUngrabKeyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->modifiers), n);
}
void XETSwGetMotionEvents(register xGetMotionEventsReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->start), n);
swapl(&(data->stop), n);
}
void XETSwTranslateCoords(register xTranslateCoordsReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcWid), n);
swapl(&(data->dstWid), n);
swaps(&(data->srcX), n);
swaps(&(data->srcY), n);
}
void XETSwWarpPointer(register xWarpPointerReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcWid), n);
swapl(&(data->dstWid), n);
swaps(&(data->srcX), n);
swaps(&(data->srcY), n);
swaps(&(data->srcWidth), n);
swaps(&(data->srcHeight), n);
swaps(&(data->dstX), n);
swaps(&(data->dstY), n);
}
void XETSwSetInputFocus(register xSetInputFocusReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->focus), n);
swapl(&(data->time), n);
}
void XETSwOpenFont(register xOpenFontReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->fid), n);
swaps(&(data->nbytes), n);
}
void XETSwListFonts(register xListFontsReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->maxNames), n);
swaps(&(data->nbytes), n);
}
void XETSwListFontsWithInfo(register xListFontsWithInfoReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->maxNames), n);
swaps(&(data->nbytes), n);
}
void XETSwSetFontPath(register xSetFontPathReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->nFonts), n);
}
void XETSwCreatePixmap(register xCreatePixmapReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->pid), n);
swapl(&(data->drawable), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
}
void XETSwCreateGC(register xCreateGCReq *data, ClientPtr client)
{
register char n;
swapl(&(data->gc), n);
swapl(&(data->drawable), n);
swapl(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwChangeGC(register xChangeGCReq *data, ClientPtr client)
{
register char n;
swapl(&(data->gc), n);
swapl(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwCopyGC(register xCopyGCReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcGC), n);
swapl(&(data->dstGC), n);
swapl(&(data->mask), n);
}
void XETSwSetDashes(register xSetDashesReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->gc), n);
swaps(&(data->dashOffset), n);
swaps(&(data->nDashes), n);
}
void XETSwSetClipRectangles(register xSetClipRectanglesReq *data, ClientPtr
client)
{
register char n;
swapl(&(data->gc), n);
swaps(&(data->xOrigin), n);
swaps(&(data->yOrigin), n);
SwapRestS(data);
swaps(&(data->length), n);
}
void XETSwClearToBackground(register xClearAreaReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
}
void XETSwCopyArea(register xCopyAreaReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcDrawable), n);
swapl(&(data->dstDrawable), n);
swapl(&(data->gc), n);
swaps(&(data->srcX), n);
swaps(&(data->srcY), n);
swaps(&(data->dstX), n);
swaps(&(data->dstY), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
}
void XETSwCopyPlane(register xCopyPlaneReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcDrawable), n);
swapl(&(data->dstDrawable), n);
swapl(&(data->gc), n);
swaps(&(data->srcX), n);
swaps(&(data->srcY), n);
swaps(&(data->dstX), n);
swaps(&(data->dstY), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
swapl(&(data->bitPlane), n);
}
/* The following routine is used for all Poly drawing requests
(except FillPoly, which uses a different request format) */
void XETSwPoly(register xPolyPointReq *data, ClientPtr client)
{
register char n;
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
SwapRestS(data);
swaps(&(data->length), n);
}
/* cannot use XETSwPoly for this one, because xFillPolyReq
* is longer than xPolyPointReq, and we don't want to swap
* the difference as shorts!
*/
void XETSwFillPoly(register xFillPolyReq *data, ClientPtr client)
{
register char n;
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
SwapRestS(data);
swaps(&(data->length), n);
}
void XETSwPutImage(register xPutImageReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
swaps(&(data->dstX), n);
swaps(&(data->dstY), n);
/* Image should already be swapped */
}
void XETSwGetImage(register xGetImageReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
swapl(&(data->planeMask), n);
}
/* ProcPolyText used for both PolyText8 and PolyText16 */
void XETSwPolyText(register xPolyTextReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
}
/* ProcImageText used for both ImageText8 and ImageText16 */
void XETSwImageText(register xImageTextReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
}
void XETSwCreateColormap(register xCreateColormapReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->mid), n);
swapl(&(data->window), n);
swapl(&(data->visual), n);
}
void XETSwCopyColormapAndFree(register xCopyColormapAndFreeReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->mid), n);
swapl(&(data->srcCmap), n);
}
void XETSwAllocColor (register xAllocColorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->red), n);
swaps(&(data->green), n);
swaps(&(data->blue), n);
}
void XETSwAllocNamedColor (register xAllocNamedColorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->nbytes), n);
}
void XETSwAllocColorCells (register xAllocColorCellsReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->colors), n);
swaps(&(data->planes), n);
}
void XETSwAllocColorPlanes(register xAllocColorPlanesReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->colors), n);
swaps(&(data->red), n);
swaps(&(data->green), n);
swaps(&(data->blue), n);
}
void XETSwFreeColors (register xFreeColorsReq *data, ClientPtr
client)
{
register char n;
swapl(&(data->cmap), n);
swapl(&(data->planeMask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwStoreColors (register xStoreColorsReq *data,ClientPtr
client)
{
register char n;
unsigned long count;
xColorItem *pItem;
swapl(&(data->cmap), n);
pItem = (xColorItem *) &(data[1]);
for(count = LengthRestB(data)/sizeof(xColorItem); count != 0; count--)
SwapColorItem(pItem++);
swaps(&(data->length), n);
}
void XETSwStoreNamedColor (register xStoreNamedColorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swapl(&(data->pixel), n);
swaps(&(data->nbytes), n);
}
void XETSwQueryColors(register xQueryColorsReq *data, ClientPtr client)
{
register char n;
swapl(&(data->cmap), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwLookupColor(register xLookupColorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->nbytes), n);
}
void XETSwCreateCursor(register xCreateCursorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cid), n);
swapl(&(data->source), n);
swapl(&(data->mask), n);
swaps(&(data->foreRed), n);
swaps(&(data->foreGreen), n);
swaps(&(data->foreBlue), n);
swaps(&(data->backRed), n);
swaps(&(data->backGreen), n);
swaps(&(data->backBlue), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
}
void XETSwCreateGlyphCursor(register xCreateGlyphCursorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cid), n);
swapl(&(data->source), n);
swapl(&(data->mask), n);
swaps(&(data->sourceChar), n);
swaps(&(data->maskChar), n);
swaps(&(data->foreRed), n);
swaps(&(data->foreGreen), n);
swaps(&(data->foreBlue), n);
swaps(&(data->backRed), n);
swaps(&(data->backGreen), n);
swaps(&(data->backBlue), n);
}
void XETSwRecolorCursor(register xRecolorCursorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cursor), n);
swaps(&(data->foreRed), n);
swaps(&(data->foreGreen), n);
swaps(&(data->foreBlue), n);
swaps(&(data->backRed), n);
swaps(&(data->backGreen), n);
swaps(&(data->backBlue), n);
}
void XETSwQueryBestSize (register xQueryBestSizeReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
}
void XETSwQueryExtension (register xQueryExtensionReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->nbytes), n);
}
void XETSwChangeKeyboardMapping (register xChangeKeyboardMappingReq *data)
{
register char n;
register long *p;
register int i, count;
swaps(&(data->length), n);
p = (long *)&(data[1]);
count = data->keyCodes * data->keySymsPerKeyCode;
for(i = 0; i < count; i++)
{
swapl(p, n);
p++;
}
}
void XETSwChangeKeyboardControl (register xChangeKeyboardControlReq *data,
ClientPtr client)
{
register char n;
swapl(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwChangePointerControl (register xChangePointerControlReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->accelNum), n);
swaps(&(data->accelDenum), n);
swaps(&(data->threshold), n);
}
void XETSwSetScreenSaver (register xSetScreenSaverReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->timeout), n);
swaps(&(data->interval), n);
}
void XETSwChangeHosts(register xChangeHostsReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->hostLength), n);
}
void XETSwRotateProperties(register xRotatePropertiesReq *data, ClientPtr client)
{
register char n;
swapl(&(data->window), n);
swaps(&(data->nAtoms), n);
swaps(&(data->nPositions), n);
SwapRestL(data);
swaps(&(data->length), n);
}
/*ARGSUSED*/
void XETSwNoOperation(xReq *data)
{
/* noop -- don't do anything */
}
/* Byte swap a list of longs */
#if defined vms && !defined MITR5
#ifndef LINKED_IN
void SwapLongs ( register long *list, register unsigned long count)
{
register char n;
while (count >= 8) {
swapl(list+0, n);
swapl(list+1, n);
swapl(list+2, n);
swapl(list+3, n);
swapl(list+4, n);
swapl(list+5, n);
swapl(list+6, n);
swapl(list+7, n);
list += 8;
count -= 8;
}
if (count != 0) {
do {
swapl(list, n);
list++;
} while (--count != 0);
}
}
/* Byte swap a list of shorts */
void SwapShorts (register short *list, register unsigned long count)
{
register char n;
while (count >= 16) {
swaps(list+0, n);
swaps(list+1, n);
swaps(list+2, n);
swaps(list+3, n);
swaps(list+4, n);
swaps(list+5, n);
swaps(list+6, n);
swaps(list+7, n);
swaps(list+8, n);
swaps(list+9, n);
swaps(list+10, n);
swaps(list+11, n);
swaps(list+12, n);
swaps(list+13, n);
swaps(list+14, n);
swaps(list+15, n);
list += 16;
count -= 16;
}
if (count != 0) {
do {
swaps(list, n);
list++;
} while (--count != 0);
}
}
SwapColorItem(xColorItem *pItem)
{
register char n;
swapl(&pItem->pixel, n);
swaps(&pItem->red, n);
swaps(&pItem->green, n);
swaps(&pItem->blue, n);
}
#endif /* LINKED_IN */
#endif /* vms */
/* $XFree86$ */
/****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
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.
*****************************************************************************/
/*
* ABSTRACT:
*
* This module is contains Vector tables used for swapping and general
* dispatch by the XTrap server extension.
*
* CONTRIBUTORS:
*
* Ken Miller
* Marc Evans
*
*/
/*-----------------*
* Include Files *
*-----------------*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/Xproto.h>
#include <nx-X11/Xprotostr.h>
#include <nx-X11/extensions/xtrapdi.h>
#include "input.h" /* Server DevicePtr definitions */
#include "misc.h"
#include "dixstruct.h"
#ifdef PC
# include "extnsist.h"
#else
# include "extnsionst.h" /* Server ExtensionEntry definitions */
#endif
#include <nx-X11/extensions/xtrapddmi.h>
#include <nx-X11/extensions/xtrapproto.h>
globaldef void_function XETSwProcVector[256L] =
{
(void_function)ProcBadRequest,
XETSwCreateWindow,
XETSwChangeWindowAttributes,
XETSwResourceReq, /* GetWindowAttributes */
XETSwResourceReq, /* DestroyWindow */
XETSwResourceReq, /* 5 DestroySubwindows */
XETSwResourceReq, /* XETSwChangeSaveSet, */
XETSwReparentWindow,
XETSwResourceReq, /* MapWindow */
XETSwResourceReq, /* MapSubwindows */
XETSwResourceReq, /* 10 UnmapWindow */
XETSwResourceReq, /* UnmapSubwindows */
XETSwConfigureWindow,
XETSwResourceReq, /* XETSwCirculateWindow, */
XETSwResourceReq, /* GetGeometry */
XETSwResourceReq, /* 15 QueryTree */
XETSwInternAtom,
XETSwResourceReq, /* XETSwGetAtomName, */
XETSwChangeProperty,
XETSwDeleteProperty,
XETSwGetProperty, /* 20 */
XETSwResourceReq, /* XETSwListProperties, */
XETSwSetSelectionOwner,
XETSwResourceReq, /* XETSwGetSelectionOwner, */
XETSwConvertSelection,
XETSwSendEvent, /* 25 */
XETSwGrabPointer,
XETSwResourceReq, /* XETSwUngrabPointer, */
XETSwGrabButton,
XETSwUngrabButton,
XETSwChangeActivePointerGrab, /* 30 */
XETSwGrabKeyboard,
XETSwResourceReq, /* XETSwUngrabKeyboard, */
XETSwGrabKey,
XETSwUngrabKey,
XETSwResourceReq, /* 35 XETSwAllowEvents, */
XETSwSimpleReq, /* XETSwGrabServer, */
XETSwSimpleReq, /* XETSwUngrabServer, */
XETSwResourceReq, /* XETSwQueryPointer, */
XETSwGetMotionEvents,
XETSwTranslateCoords, /*40 */
XETSwWarpPointer,
XETSwSetInputFocus,
XETSwSimpleReq, /* XETSwGetInputFocus, */
XETSwSimpleReq, /* QueryKeymap, */
XETSwOpenFont, /* 45 */
XETSwResourceReq, /* XETSwCloseFont, */
XETSwResourceReq, /* XETSwQueryFont, */
XETSwResourceReq, /* XETSwQueryTextExtents, */
XETSwListFonts,
XETSwListFontsWithInfo, /* 50 */
XETSwSetFontPath,
XETSwSimpleReq, /* GetFontPath, */
XETSwCreatePixmap,
XETSwResourceReq, /* XETSwFreePixmap, */
XETSwCreateGC, /* 55 */
XETSwChangeGC,
XETSwCopyGC,
XETSwSetDashes,
XETSwSetClipRectangles,
XETSwResourceReq, /* 60 XETSwFreeGC, */
XETSwClearToBackground,
XETSwCopyArea,
XETSwCopyPlane,
XETSwPoly, /* PolyPoint, */
XETSwPoly, /* 65 PolyLine */
XETSwPoly, /* PolySegment, */
XETSwPoly, /* PolyRectangle, */
XETSwPoly, /* PolyArc, */
XETSwFillPoly,
XETSwPoly, /* 70 PolyFillRectangle */
XETSwPoly, /* PolyFillArc, */
XETSwPutImage,
XETSwGetImage,
XETSwPolyText,
XETSwPolyText, /* 75 */
XETSwImageText,
XETSwImageText,
XETSwCreateColormap,
XETSwResourceReq, /* XETSwFreeColormap, */
XETSwCopyColormapAndFree, /* 80 */
XETSwResourceReq, /* XETSwInstallColormap, */
XETSwResourceReq, /* XETSwUninstallColormap, */
XETSwResourceReq, /* XETSwListInstalledColormaps, */
XETSwAllocColor,
XETSwAllocNamedColor, /* 85 */
XETSwAllocColorCells,
XETSwAllocColorPlanes,
XETSwFreeColors,
XETSwStoreColors,
XETSwStoreNamedColor, /* 90 */
XETSwQueryColors,
XETSwLookupColor,
XETSwCreateCursor,
XETSwCreateGlyphCursor,
XETSwResourceReq, /* 95 XETSwFreeCursor, */
XETSwRecolorCursor,
XETSwQueryBestSize,
XETSwQueryExtension,
XETSwSimpleReq, /* ListExtensions, */
XETSwChangeKeyboardMapping, /* 100 */
XETSwSimpleReq, /* GetKeyboardMapping, */
XETSwChangeKeyboardControl,
XETSwSimpleReq, /* GetKeyboardControl, */
XETSwSimpleReq, /* Bell, */
XETSwChangePointerControl, /* 105 */
XETSwSimpleReq, /* GetPointerControl, */
XETSwSetScreenSaver,
XETSwSimpleReq, /* GetScreenSaver, */
XETSwChangeHosts,
XETSwSimpleReq, /* 110 ListHosts, */
XETSwSimpleReq, /* XETSwChangeAccessControl, */
XETSwSimpleReq, /* XETSwChangeCloseDownMode, */
XETSwResourceReq, /* XETSwKillClient, */
XETSwRotateProperties,
XETSwSimpleReq, /* 115 ForceScreenSaver */
XETSwSimpleReq, /* SetPointerMapping, */
XETSwSimpleReq, /* GetPointerMapping, */
XETSwSimpleReq, /* SetModifierMapping, */
XETSwSimpleReq, /* GetModifierMapping, */
NotImplemented, /* 120 */
NotImplemented,
NotImplemented,
NotImplemented,
NotImplemented,
NotImplemented, /* 125 */
NotImplemented,
XETSwNoOperation
};
/* NOTE: This array must align with the values of the constants used
* as minor_opcode values in the request structure. Failure to do this
* could result in random code paths.
*/
globaldef int_function XETrapDispatchVector[10L] =
{
XETrapReset, /* 0 XETrap_Reset */
XETrapGetAvailable, /* 1 XETrap_GetAvailable */
XETrapConfig, /* 2 XETrap_Config */
XETrapStartTrap, /* 3 XETrap_StartTrap */
XETrapStopTrap, /* 4 XETrap_StopTrap */
XETrapGetCurrent, /* 5 XETrap_GetCurrent */
XETrapGetStatistics, /* 6 XETrap_GetStatistics */
#ifndef _XINPUT
XETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */
#endif
XETrapGetVersion, /* 8 XETrap_GetVersion */
XETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */
};
/* NOTE: This array must align with the values of the constants used
* as minor_opcode values in the request structure. Failure to do this
* could result in random code paths.
*/
globaldef int_function XETSwDispatchVector[10L] =
{
sXETrapReset, /* 0 XETrap_Reset */
sXETrapGetAvailable, /* 1 XETrap_GetAvailable */
sXETrapConfig, /* 2 XETrap_Config */
sXETrapStartTrap, /* 3 XETrap_StartTrap */
sXETrapStopTrap, /* 4 XETrap_StopTrap */
sXETrapGetCurrent, /* 5 XETrap_GetCurrent */
sXETrapGetStatistics, /* 6 XETrap_GetStatistics */
#ifndef _XINPUT
sXETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */
#endif
sXETrapGetVersion, /* 8 XETrap_GetVersion */
sXETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */
};
/* ProcVector shadow vector */
globaldef int_function XETrapProcVector[256L] = {XETrapRequestVector};
/*
* Events are faked as if they're vectored since that's
* the way it'll eventually be (X11 R5?).
*/
#ifndef VECTORED_EVENTS
globaldef int_function EventProcVector[XETrapCoreEvents] = {NULL};
#endif
globaldef int_function XETrapEventProcVector[XETrapCoreEvents] = {NULL};
/* $Xorg: EVI.c,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ */
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/* $XFree86: xc/programs/Xserver/Xext/EVI.c,v 3.10tsi Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "dixstruct.h"
#include "extnsionst.h"
#include "dix.h"
#define _XEVI_SERVER_
#include <nx-X11/extensions/XEVIstr.h>
#include "EVIstruct.h"
#include "modinit.h"
#include "scrnintstr.h"
#if 0
static unsigned char XEVIReqCode = 0;
#endif
static EviPrivPtr eviPriv;
static int
ProcEVIQueryVersion(ClientPtr client)
{
/* REQUEST(xEVIQueryVersionReq); */
xEVIQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XEVI_MAJOR_VERSION;
rep.minorVersion = XEVI_MAJOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
#define swapEviInfo(eviInfo, l) \
{ \
int l1 = l; \
xExtendedVisualInfo *eviInfo1 = eviInfo; \
while (l1-- > 0) { \
swapl(&eviInfo1->core_visual_id, n); \
swapl(&eviInfo1->transparency_value, n); \
swaps(&eviInfo1->num_colormap_conflicts, n); \
eviInfo1++; \
} \
}
#define swapVisual(visual, l) \
{ \
int l1 = l; \
VisualID32 *visual1 = visual; \
while (l1-- > 0) { \
swapl(visual1, n); \
visual1++; \
} \
}
static int
ProcEVIGetVisualInfo(ClientPtr client)
{
REQUEST(xEVIGetVisualInfoReq);
xEVIGetVisualInfoReply rep;
int i, n, n_conflict, n_info, sz_info, sz_conflict;
VisualID32 *conflict;
unsigned int total_visuals = 0;
xExtendedVisualInfo *eviInfo;
int status;
/*
* do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume
* here that you don't have more than 2^32 visuals over all your screens;
* this seems like a safe assumption.
*/
for (i = 0; i < screenInfo.numScreens; i++)
total_visuals += screenInfo.screens[i]->numVisuals;
if (stuff->n_visual > total_visuals)
return BadValue;
REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
&eviInfo, &n_info, &conflict, &n_conflict);
if (status != Success)
return status;
sz_info = n_info * sz_xExtendedVisualInfo;
sz_conflict = n_conflict * sz_VisualID32;
rep.type = X_Reply;
rep.n_info = n_info;
rep.n_conflicts = n_conflict;
rep.sequenceNumber = client->sequence;
rep.length = (sz_info + sz_conflict) >> 2;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.n_info, n);
swapl(&rep.n_conflicts, n);
swapEviInfo(eviInfo, n_info);
swapVisual(conflict, n_conflict);
}
WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
WriteToClient(client, sz_info, (char *)eviInfo);
WriteToClient(client, sz_conflict, (char *)conflict);
eviPriv->freeVisualInfo(eviInfo, conflict);
return (client->noClientException);
}
static int
ProcEVIDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_EVIQueryVersion:
return ProcEVIQueryVersion (client);
case X_EVIGetVisualInfo:
return ProcEVIGetVisualInfo (client);
default:
return BadRequest;
}
}
static int
SProcEVIQueryVersion(ClientPtr client)
{
REQUEST(xEVIQueryVersionReq);
int n;
swaps(&stuff->length, n);
return ProcEVIQueryVersion(client);
}
static int
SProcEVIGetVisualInfo(ClientPtr client)
{
register int n;
REQUEST(xEVIGetVisualInfoReq);
swaps(&stuff->length, n);
return ProcEVIGetVisualInfo(client);
}
static int
SProcEVIDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_EVIQueryVersion:
return SProcEVIQueryVersion (client);
case X_EVIGetVisualInfo:
return SProcEVIGetVisualInfo (client);
default:
return BadRequest;
}
}
/*ARGSUSED*/
static void
EVIResetProc(ExtensionEntry *extEntry)
{
eviDDXReset();
}
/****************
* XEVIExtensionInit
*
* Called from InitExtensions in main() or from QueryExtension() if the
* extension is dynamically loaded.
*
****************/
void
EVIExtensionInit(INITARGS)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(EVINAME, 0, 0,
ProcEVIDispatch,
SProcEVIDispatch,
EVIResetProc, StandardMinorOpcode))) {
XEVIReqCode = (unsigned char)extEntry->base;
#else
if (AddExtension(EVINAME, 0, 0,
ProcEVIDispatch, SProcEVIDispatch,
EVIResetProc, StandardMinorOpcode)) {
#endif
eviPriv = eviDDXInit();
}
}
/* $Xorg: EVIstruct.h,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ */
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/* $XFree86: xc/programs/Xserver/Xext/EVIstruct.h,v 3.5 2003/07/16 01:38:28 dawes Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef EVI_STRUCT_H
#define EVI_STRUCT_H
/*
******************************************************************************
** Per-ddx data
******************************************************************************
*/
typedef int (*GetVisualInfoProc)(
VisualID32*,
int,
xExtendedVisualInfo**,
int*,
VisualID32**,
int*
);
typedef void (*FreeVisualInfoProc)(
xExtendedVisualInfo*,
VisualID32*
);
typedef struct _EviPrivRec {
GetVisualInfoProc getVisualInfo;
FreeVisualInfoProc freeVisualInfo;
} EviPrivRec, *EviPrivPtr;
extern EviPrivPtr eviDDXInit(void);
extern void eviDDXReset(void);
#endif /* EVI_STRUCT_H */
......@@ -30,42 +30,16 @@ XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.43 2003/04/21 18:56:48 sv
SUBDIRS = extmod
#endif
#if BuildEVI
#ifdef SGIArchitectureNotTog
EVISRCS = EVI.c sgiEVI.c
EVIOBJS = EVI.o sgiEVI.o
#else
EVISRCS = EVI.c sampleEVI.c
EVIOBJS = EVI.o sampleEVI.o
#endif
#endif
#if HasShm
SHMSRCS = shm.c
SHMOBJS = shm.o
#endif
#if BuildMultibuffer
MULTIBUFSRC = mbuf.c
MULTIBUFOBJ = mbuf.o
#endif
#if BuildScreenSaverExt
SCRNSAVSRC = saver.c
SCRNSAVOBJ = saver.o
#endif
#if BuildXF86VidModeExt && \
(defined(XorgServer) && XorgServer)
VIDMODESRCS = xf86vmode.c
VIDMODEOBJS = xf86vmode.o
#endif
#if BuildXF86MiscExt && \
(defined(XorgServer) && XorgServer)
XF86MISCSRCS = xf86misc.c
XF86MISCOBJS = xf86misc.o
#endif
#if BuildXF86BigfontExt
XF86BIGFSRCS = xf86bigfont.c
XF86BIGFOBJS = xf86bigfont.o
......@@ -74,14 +48,6 @@ XF86BIGFOBJS = xf86bigfont.o
#endif
#endif
#if BuildXF86DGA
XF86DGASRCS = xf86dga.c xf86dga2.c
XF86DGAOBJS = xf86dga.o xf86dga2.o
#if HasShm
XVMCSHM_DEFINES = -DHAS_XVMCSHM
#endif
#endif
#if BuildXvExt
XVSRCS = xvmain.c xvdisp.c xvmc.c
XVOBJS = xvmain.o xvdisp.o xvmc.o
......@@ -92,20 +58,12 @@ XF86BIGFOBJS = xf86bigfont.o
XRESOBJS = xres.o
#endif
#if BuildAppgroup
APPGROUPSRCS = appgroup.c
APPGROUPOBJS = appgroup.o
#endif
#if BuildXCSecurity
SECURITYSRCS = security.c
SECURITYOBJS = security.o
SERVERCONFIGDIR = ServerConfigDir
POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGDIR)/SecurityPolicy\"
#endif
#if BuildCup
CUPSRCS = cup.c
CUPOBJS = cup.o
#endif
#if BuildXinerama
PNRXSRCS = panoramiX.c panoramiXSwap.c panoramiXprocs.c
PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o
......@@ -116,38 +74,22 @@ XF86BIGFOBJS = xf86bigfont.o
DPMSOBJS = dpms.o
#endif
#if BuildFontCache
FONTCACHESRCS = fontcache.c
FONTCACHEOBJS = fontcache.o
#if 0
FONTCACHEINCLUDES = -I$(XF86SRC)/os-support
#endif
#endif
SRCS = shape.c $(SHMSRCS) xcmisc.c\
xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
bigreq.c sync.c $(SCRNSAVSRC) \
$(XF86BIGFSRCS) $(SECURITYSRCS) \
$(PNRXSRCS) $(DPMSSRCS) \
$(XVSRCS) $(XRESSRCS) $(DMXSRCS)
#if BuildXevie
XEVIESRCS = xevie.c
XEVIEOBJS = xevie.o
#endif
SRCS = shape.c $(SHMSRCS) $(MULTIBUFSRC) \
mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
$(XF86MISCSRCS) $(XF86BIGFSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \
$(APPGROUPSRCS) $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \
$(XEVIESRCS) \
$(EVISRCS) $(XVSRCS) $(FONTCACHESRCS) $(XRESSRCS) $(DMXSRCS)
OBJS = shape.o $(SHMOBJS) $(MULTIBUFOBJ) \
mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \
$(XF86MISCOBJS) $(XF86BIGFOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \
$(APPGROUPOBJS) $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \
$(XEVIEOBJS) \
$(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) $(XRESOBJS) $(DMXOBJS)
OBJS = shape.o $(SHMOBJS) xcmisc.o \
xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
bigreq.o sync.o $(SCRNSAVOBJ) \
$(XF86BIGFOBJS) $(SECURITYOBJS) \
$(PNRXOBJS) $(DPMSOBJS) \
$(XVOBJS) $(XRESOBJS) $(DMXOBJS)
SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) \
SOBJS = $(SHMOBJS) $(SECURITYOBJS) \
shape.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \
$(XEVIEOBJS) \
$(XF86BIGFOBJS)
#if defined(NXAgentServer) && NXAgentServer
......@@ -160,8 +102,9 @@ NX_DEFINES = -DNXAGENT_SERVER
XF86INCLUDES = -I$(XF86COMSRC)
#endif
INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
$(PNRXINCLUDES) $(XF86INCLUDES) \
$(FONTCACHEINCLUDES) $(DMXINCLUDES) \
$(PNRXINCLUDES) \
$(XF86INCLUDES) \
$(DMXINCLUDES) \
`pkg-config --cflags-only-I pixman-1`
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
......@@ -173,13 +116,6 @@ XF86INCLUDES = -I$(XF86COMSRC)
NormalLibraryObjectRule()
/*
* A hack to work around an optimization problem with gcc 2.95.2
*/
#if BuildXF86VidModeExt && defined(GccOptBug295)
SpecialCObjectRule(xf86vmode,NullParameter,-O0)
#endif
NormalLibraryTarget(ext,$(OBJS))
LintLibraryTarget(ext,$(SRCS))
NormalLintTarget($(SRCS))
......@@ -210,6 +146,5 @@ MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
#endif
InstallDriverSDKNonExecFile(dgaproc.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(xvdix.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(xvmcext.h,$(DRIVERSDKINCLUDEDIR))
/* $XFree86: xc/programs/Xserver/Xext/appgroup.c,v 1.10tsi Exp $ */
/*
Copyright 1996, 1998, 2001 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.
*/
/* $Xorg: appgroup.c,v 1.6 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "colormapst.h"
#include "servermd.h"
#define _XAG_SERVER_
#include <nx-X11/extensions/Xagstr.h>
#include <nx-X11/extensions/Xagsrv.h>
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
#include <nx-X11/Xfuncproto.h>
#define XSERV_t
#include <nx-X11/Xtrans/Xtrans.h>
#include "../os/osdep.h"
#include <stdio.h>
#include "modinit.h"
#include "appgroup.h"
typedef struct _AppGroupRec {
struct _AppGroupRec* next;
XID appgroupId;
ClientPtr* clients;
int nclients;
ClientPtr leader;
Bool single_screen;
Window default_root;
VisualID root_visual;
Colormap default_colormap;
Pixel black_pixel;
Pixel white_pixel;
xConnSetupPrefix connSetupPrefix;
char* ConnectionInfo;
} AppGroupRec, *AppGroupPtr;
static int ProcXagDispatch(ClientPtr client);
static int SProcXagDispatch(ClientPtr client);
static void XagResetProc(ExtensionEntry* extEntry);
#if 0
static unsigned char XagReqCode = 0;
static int XagErrorBase;
#endif
static int XagCallbackRefCount = 0;
static RESTYPE RT_APPGROUP;
static AppGroupPtr appGrpList = NULL;
extern xConnSetupPrefix connSetupPrefix;
extern char* ConnectionInfo;
extern int connBlockScreenStart;
static
int XagAppGroupFree(
void * what,
XID id) /* unused */
{
int i;
AppGroupPtr pAppGrp = (AppGroupPtr) what;
if (pAppGrp->leader)
for (i = 0; i < pAppGrp->nclients; i++) {
pAppGrp->clients[i]->appgroup = NULL;
CloseDownClient (pAppGrp->clients[i]);
}
if (pAppGrp == appGrpList)
appGrpList = appGrpList->next;
else {
AppGroupPtr tpAppGrp;
for (tpAppGrp = appGrpList;
tpAppGrp->next != NULL;
tpAppGrp = tpAppGrp->next) {
if (tpAppGrp->next == pAppGrp) {
tpAppGrp->next = tpAppGrp->next->next;
break;
}
}
}
(void) xfree (pAppGrp->clients);
(void) xfree (pAppGrp->ConnectionInfo);
(void) xfree (what);
return Success;
}
/* static */
void XagClientStateChange(
CallbackListPtr* pcbl,
void * nulldata,
void * calldata)
{
SecurityAuthorizationPtr pAuth;
NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
ClientPtr pClient = pci->client;
AppGroupPtr pAppGrp;
XID authId = 0;
if (!pClient->appgroup) {
switch (pClient->clientState) {
case ClientStateAuthenticating:
case ClientStateRunning:
case ClientStateCheckingSecurity:
return;
case ClientStateInitial:
case ClientStateCheckedSecurity:
/*
* If the client is connecting via a firewall proxy (which
* uses XC-QUERY-SECURITY-1, then the authId is available
* during ClientStateCheckedSecurity, otherwise it's
* available during ClientStateInitial.
*
* Don't get it from pClient because can't guarantee the order
* of the callbacks and the security extension might not have
* plugged it in yet.
*/
authId = AuthorizationIDOfClient(pClient);
break;
case ClientStateGone:
case ClientStateRetained:
/*
* Don't get if from AuthorizationIDOfClient because can't
* guarantee the order of the callbacks and the security
* extension may have torn down the client's private data
*/
authId = pClient->authId;
break;
}
if (authId == None)
return;
pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(pClient,
authId, SecurityAuthorizationResType, SecurityReadAccess);
if (pAuth == NULL)
return;
for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
if (pAppGrp->appgroupId == pAuth->group) break;
} else {
pAppGrp = pClient->appgroup;
}
if (!pAppGrp)
return;
switch (pClient->clientState) {
case ClientStateAuthenticating:
case ClientStateRunning:
case ClientStateCheckingSecurity:
break;
case ClientStateInitial:
case ClientStateCheckedSecurity:
/* see the comment above about Initial vs. CheckedSecurity */
{
/* if this client already in AppGroup, don't add it again */
int i;
for (i = 0; i < pAppGrp->nclients; i++)
if (pClient == pAppGrp->clients[i]) return;
}
pAppGrp->clients = (ClientPtr*) xrealloc (pAppGrp->clients,
++pAppGrp->nclients * sizeof (ClientPtr));
pAppGrp->clients[pAppGrp->nclients - 1] = pClient;
pClient->appgroup = pAppGrp;
break;
case ClientStateGone:
case ClientStateRetained: /* client disconnected, dump it */
{
int i;
for (i = 0; i < pAppGrp->nclients; i++)
if (pAppGrp->clients[i] == pClient) {
pAppGrp->clients[i] = NULL;
break;
}
for (i = 0; i < pAppGrp->nclients; i++)
if (pAppGrp->clients[i] == NULL && i + 1 < pAppGrp->nclients)
pAppGrp->clients[i] = pAppGrp->clients[i + 1];
pAppGrp->nclients--;
}
pClient->appgroup = NULL; /* redundant, pClient will be freed */
break;
}
}
void
XagExtensionInit(INITARGS)
{
#if 0
ExtensionEntry* extEntry;
if ((extEntry = AddExtension (XAGNAME,
0,
XagNumberErrors,
ProcXagDispatch,
SProcXagDispatch,
XagResetProc,
StandardMinorOpcode))) {
XagReqCode = (unsigned char)extEntry->base;
XagErrorBase = extEntry->errorBase;
#else
if (AddExtension (XAGNAME,
0,
XagNumberErrors,
ProcXagDispatch,
SProcXagDispatch,
XagResetProc,
StandardMinorOpcode)) {
#endif
RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
}
}
/*ARGSUSED*/
static
void XagResetProc(
ExtensionEntry* extEntry)
{
DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
XagCallbackRefCount = 0;
while (appGrpList) XagAppGroupFree ((void *) appGrpList, 0);
}
static
int ProcXagQueryVersion(
register ClientPtr client)
{
/* REQUEST (xXagQueryVersionReq); */
xXagQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xXagQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.server_major_version = XAG_MAJOR_VERSION;
rep.server_minor_version = XAG_MINOR_VERSION;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
swaps (&rep.server_major_version, n);
swaps (&rep.server_minor_version, n);
}
WriteToClient (client, sizeof (xXagQueryVersionReply), (char *)&rep);
return client->noClientException;
}
static
void ProcessAttr(
AppGroupPtr pAppGrp,
ClientPtr client,
unsigned int attrib_mask,
CARD32* attribs)
{
int i;
for (i = 0; i <= XagNappGroupLeader; i++) {
switch (attrib_mask & (1 << i)) {
case XagSingleScreenMask:
pAppGrp->single_screen = *attribs;
break;
case XagDefaultRootMask:
pAppGrp->default_root = *attribs;
break;
case XagRootVisualMask:
pAppGrp->root_visual = *attribs;
break;
case XagDefaultColormapMask:
pAppGrp->default_colormap = *attribs;
break;
case XagBlackPixelMask:
pAppGrp->black_pixel = *attribs;
break;
case XagWhitePixelMask:
pAppGrp->white_pixel = *attribs;
break;
case XagAppGroupLeaderMask:
pAppGrp->leader = client;
break;
default: continue;
}
attribs++;
}
}
static
void CreateConnectionInfo(
AppGroupPtr pAppGrp)
{
xWindowRoot* rootp;
xWindowRoot* roots[MAXSCREENS];
unsigned int rootlens[MAXSCREENS];
xDepth* depth;
int olen;
int snum, i;
rootp = (xWindowRoot*) (ConnectionInfo + connBlockScreenStart);
for (snum = 0; snum < screenInfo.numScreens; snum++) {
rootlens[snum] = sizeof (xWindowRoot);
roots[snum] = rootp;
depth = (xDepth*) (rootp + 1);
for (i = 0; i < rootp->nDepths; i++) {
rootlens[snum] += sizeof (xDepth) +
depth->nVisuals * sizeof (xVisualType);
depth = (xDepth *)(((char*)(depth + 1)) +
depth->nVisuals * sizeof (xVisualType));
}
rootp = (xWindowRoot*) depth;
}
snum = 0;
if (pAppGrp->default_root) {
for (; snum < screenInfo.numVideoScreens; snum++) {
if (roots[snum]->windowId == pAppGrp->default_root)
break;
}
}
olen = connBlockScreenStart + rootlens[snum];
for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++)
olen += rootlens[i];
pAppGrp->ConnectionInfo = (char*) xalloc (olen);
if (!pAppGrp->ConnectionInfo)
return;
memmove (pAppGrp->ConnectionInfo, ConnectionInfo, connBlockScreenStart);
((xConnSetup*) (pAppGrp->ConnectionInfo))->numRoots =
1 + screenInfo.numScreens - screenInfo.numVideoScreens;
memmove (pAppGrp->ConnectionInfo + connBlockScreenStart,
(void*) roots[snum], rootlens[snum]);
rootp = (xWindowRoot*) (pAppGrp->ConnectionInfo + connBlockScreenStart);
if (pAppGrp->default_colormap) {
rootp->defaultColormap = pAppGrp->default_colormap;
rootp->whitePixel = pAppGrp->white_pixel;
rootp->blackPixel = pAppGrp->black_pixel;
}
if (pAppGrp->root_visual)
rootp->rootVisualID = pAppGrp->root_visual;
rootp = (xWindowRoot*) (((char*)rootp) + rootlens[snum]);
for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++) {
memmove ((void*) rootp, (void*) roots[i], rootlens[i]);
rootp = (xWindowRoot*) (((char*) rootp) + rootlens[i]);
}
pAppGrp->connSetupPrefix = connSetupPrefix;
pAppGrp->connSetupPrefix.length = olen >> 2;
}
static
AppGroupPtr CreateAppGroup(
ClientPtr client,
XID appgroupId,
unsigned int attrib_mask,
CARD32* attribs)
{
AppGroupPtr pAppGrp;
pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
if (pAppGrp) {
pAppGrp->next = appGrpList;
appGrpList = pAppGrp;
pAppGrp->appgroupId = appgroupId;
pAppGrp->clients = (ClientPtr*) xalloc (0);
pAppGrp->nclients = 0;
pAppGrp->leader = NULL;
pAppGrp->default_root = 0;
pAppGrp->root_visual = 0;
pAppGrp->default_colormap = 0;
pAppGrp->black_pixel = -1;
pAppGrp->white_pixel = -1;
pAppGrp->ConnectionInfo = NULL;
ProcessAttr (pAppGrp, client, attrib_mask, attribs);
}
return pAppGrp;
}
static
int AttrValidate(
ClientPtr client,
int attrib_mask,
AppGroupPtr pAppGrp)
{
WindowPtr pWin;
int idepth, ivids, found;
ScreenPtr pScreen;
DepthPtr pDepth;
ColormapPtr pColormap;
pWin = LookupWindow (pAppGrp->default_root, client);
/* XXX check that pWin is not NULL */
pScreen = pWin->drawable.pScreen;
if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)
return BadWindow;
pDepth = pScreen->allowedDepths;
if (pAppGrp->root_visual) {
found = FALSE;
for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) {
for (ivids = 0; ivids < pDepth->numVids; ivids++) {
if (pAppGrp->root_visual == pDepth->vids[ivids]) {
found = TRUE;
break;
}
}
}
if (!found)
return BadMatch;
}
if (pAppGrp->default_colormap) {
pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP);
/* XXX check that pColormap is not NULL */
if (pColormap->pScreen != pScreen)
return BadColor;
if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual))
return BadMatch;
}
return client->noClientException;
}
/* static */
int ProcXagCreate (
register ClientPtr client)
{
REQUEST (xXagCreateReq);
AppGroupPtr pAppGrp;
int ret;
REQUEST_AT_LEAST_SIZE (xXagCreateReq);
LEGAL_NEW_RESOURCE (stuff->app_group, client);
pAppGrp = CreateAppGroup (client, stuff->app_group,
stuff->attrib_mask, (CARD32*) &stuff[1]);
if (!pAppGrp)
return BadAlloc;
ret = AttrValidate (client, stuff->attrib_mask, pAppGrp);
if (ret != Success) {
XagAppGroupFree ((void *)pAppGrp, (XID)0);
return ret;
}
if (pAppGrp->single_screen) {
CreateConnectionInfo (pAppGrp);
if (!pAppGrp->ConnectionInfo)
return BadAlloc;
}
if (!AddResource (stuff->app_group, RT_APPGROUP, (void *)pAppGrp))
return BadAlloc;
if (XagCallbackRefCount++ == 0)
(void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL);
return client->noClientException;
}
/* static */
int ProcXagDestroy(
register ClientPtr client)
{
AppGroupPtr pAppGrp;
REQUEST (xXagDestroyReq);
REQUEST_SIZE_MATCH (xXagDestroyReq);
pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
(XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
if (!pAppGrp) return XagBadAppGroup;
FreeResource ((XID)stuff->app_group, RT_NONE);
if (--XagCallbackRefCount == 0)
(void) DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
return client->noClientException;
}
static
int ProcXagGetAttr(
register ClientPtr client)
{
AppGroupPtr pAppGrp;
REQUEST (xXagGetAttrReq);
xXagGetAttrReply rep;
int n;
REQUEST_SIZE_MATCH (xXagGetAttrReq);
pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
(XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
if (!pAppGrp) return XagBadAppGroup;
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.default_root = pAppGrp->default_root;
rep.root_visual = pAppGrp->root_visual;
rep.default_colormap = pAppGrp->default_colormap;
rep.black_pixel = pAppGrp->black_pixel;
rep.white_pixel = pAppGrp->white_pixel;
rep.single_screen = pAppGrp->single_screen;
rep.app_group_leader = (pAppGrp->leader) ? 1 : 0;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
swapl (&rep.default_root, n);
swapl (&rep.root_visual, n);
swapl (&rep.default_colormap, n);
swapl (&rep.black_pixel, n);
swapl (&rep.white_pixel, n);
}
WriteToClient (client, sizeof (xXagGetAttrReply), (char *)&rep);
return client->noClientException;
}
static
int ProcXagQuery(
register ClientPtr client)
{
ClientPtr pClient;
AppGroupPtr pAppGrp;
REQUEST (xXagQueryReq);
int n;
REQUEST_SIZE_MATCH (xXagQueryReq);
pClient = LookupClient (stuff->resource, client);
for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
for (n = 0; n < pAppGrp->nclients; n++)
if (pAppGrp->clients[n] == pClient) {
xXagQueryReply rep;
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.app_group = pAppGrp->appgroupId;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
swapl (&rep.app_group, n);
}
WriteToClient (client, sizeof (xXagQueryReply), (char *)&rep);
return client->noClientException;
}
return BadMatch;
}
static
int ProcXagCreateAssoc(
register ClientPtr client)
{
REQUEST (xXagCreateAssocReq);
REQUEST_SIZE_MATCH (xXagCreateAssocReq);
#ifdef WIN32
if (stuff->window_type != XagWindowTypeWin32)
#else
if (stuff->window_type != XagWindowTypeX11)
#endif
return BadMatch;
#if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */
if (!LocalClient (client))
return BadAccess;
#endif
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
return client->noClientException;
}
static
int ProcXagDestroyAssoc(
register ClientPtr client)
{
/* REQUEST (xXagDestroyAssocReq); */
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
return client->noClientException;
}
static
int ProcXagDispatch (
register ClientPtr client)
{
REQUEST (xReq);
switch (stuff->data)
{
case X_XagQueryVersion:
return ProcXagQueryVersion (client);
case X_XagCreate:
return ProcXagCreate (client);
case X_XagDestroy:
return ProcXagDestroy (client);
case X_XagGetAttr:
return ProcXagGetAttr (client);
case X_XagQuery:
return ProcXagQuery (client);
case X_XagCreateAssoc:
return ProcXagCreateAssoc (client);
case X_XagDestroyAssoc:
return ProcXagDestroyAssoc (client);
default:
return BadRequest;
}
}
static
int SProcXagQueryVersion(
register ClientPtr client)
{
register int n;
REQUEST(xXagQueryVersionReq);
swaps(&stuff->length, n);
return ProcXagQueryVersion(client);
}
static
int SProcXagCreate(
ClientPtr client)
{
register int n;
REQUEST (xXagCreateReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXagCreateReq);
swapl (&stuff->app_group, n);
swapl (&stuff->attrib_mask, n);
SwapRestL (stuff);
return ProcXagCreate (client);
}
static
int SProcXagDestroy(
ClientPtr client)
{
register int n;
REQUEST (xXagDestroyReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagDestroyReq);
swapl (&stuff->app_group, n);
return ProcXagDestroy (client);
}
static
int SProcXagGetAttr(
ClientPtr client)
{
register int n;
REQUEST (xXagGetAttrReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagGetAttrReq);
swapl (&stuff->app_group, n);
return ProcXagGetAttr (client);
}
static
int SProcXagQuery(
ClientPtr client)
{
register int n;
REQUEST (xXagQueryReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagQueryReq);
swapl (&stuff->resource, n);
return ProcXagQuery (client);
}
static
int SProcXagCreateAssoc(
ClientPtr client)
{
register int n;
REQUEST (xXagCreateAssocReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagCreateAssocReq);
swapl (&stuff->window, n);
swapl (&stuff->window_type, n);
swaps (&stuff->system_window_len, n);
return ProcXagCreateAssoc (client);
}
static
int SProcXagDestroyAssoc(
ClientPtr client)
{
register int n;
REQUEST (xXagDestroyAssocReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
swapl (&stuff->window, n);
return ProcXagDestroyAssoc (client);
}
static
int SProcXagDispatch(
register ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XagQueryVersion:
return SProcXagQueryVersion (client);
case X_XagCreate:
return SProcXagCreate (client);
case X_XagDestroy:
return SProcXagDestroy (client);
case X_XagGetAttr:
return SProcXagGetAttr (client);
case X_XagQuery:
return SProcXagQuery (client);
case X_XagCreateAssoc:
return SProcXagCreateAssoc (client);
case X_XagDestroyAssoc:
return SProcXagDestroyAssoc (client);
default:
return BadRequest;
}
}
Colormap XagDefaultColormap(
ClientPtr client)
{
return (client->appgroup ? client->appgroup->default_colormap : None);
}
VisualID XagRootVisual(
ClientPtr client)
{
return (client->appgroup ? client->appgroup->root_visual : 0);
}
ClientPtr XagLeader(
ClientPtr client)
{
return (client->appgroup ? client->appgroup->leader : NULL);
}
/*
* Return whether the Map request event should be sent to the appgroup leader.
* We don't want to send it to the leader when the window is on a different
* screen, e.g. a print screen.
*/
Bool XagIsControlledRoot(
ClientPtr client,
WindowPtr pParent)
{
if (client->appgroup) {
if (client->appgroup->single_screen &&
pParent->drawable.id == client->appgroup->default_root)
return TRUE;
else if (!pParent->parent)
return TRUE;
else
return FALSE;
}
return FALSE;
}
void XagConnectionInfo(
ClientPtr client,
xConnSetupPrefix** conn_prefix,
char** conn_info,
int* num_screen)
{
if (client->appgroup && client->appgroup->ConnectionInfo) {
*conn_prefix = &client->appgroup->connSetupPrefix;
*conn_info = client->appgroup->ConnectionInfo;
*num_screen = ((xConnSetup*)(client->appgroup->ConnectionInfo))->numRoots;
}
}
XID XagId(
ClientPtr client)
{
return (client->appgroup ? client->appgroup->appgroupId : 0);
}
void XagGetDeltaInfo(
ClientPtr client,
CARD32* buf)
{
*buf++ = (CARD32) client->appgroup->default_root;
*buf++ = (CARD32) client->appgroup->root_visual;
*buf++ = (CARD32) client->appgroup->default_colormap;
*buf++ = (CARD32) client->appgroup->black_pixel;
*buf = (CARD32) client->appgroup->white_pixel;
}
void XagCallClientStateChange(
ClientPtr client)
{
if (appGrpList) {
NewClientInfoRec clientinfo;
clientinfo.client = client;
XagClientStateChange (NULL, NULL, (void *)&clientinfo);
}
}
/* $XFree86$ */
void XagClientStateChange(
CallbackListPtr* pcbl,
void * nulldata,
void * calldata);
int ProcXagCreate (
register ClientPtr client);
int ProcXagDestroy(
register ClientPtr client);
/* $Xorg: cup.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
/*
Copyright 1997, 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.
*/
/* $XFree86: xc/programs/Xserver/Xext/cup.c,v 1.11tsi Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "colormapst.h"
#include "scrnintstr.h"
#include "servermd.h"
#include "swapreq.h"
#define _XCUP_SERVER_
#include <nx-X11/extensions/Xcupstr.h>
#include <nx-X11/Xfuncproto.h>
#ifndef EXTMODULE
#include "../os/osdep.h"
#else
#include "xf86_ansic.h"
#endif
#include "modinit.h"
static int ProcDispatch(ClientPtr client);
static int SProcDispatch(ClientPtr client);
static void ResetProc(ExtensionEntry* extEntry);
#if 0
static unsigned char ReqCode = 0;
static int ErrorBase;
#endif
#if defined(WIN32) || defined(TESTWIN32)
#define HAVE_SPECIAL_DESKTOP_COLORS
#endif
static xColorItem citems[] = {
#ifndef HAVE_SPECIAL_DESKTOP_COLORS
#define CUP_BLACK_PIXEL 0
#define CUP_WHITE_PIXEL 1
/* pix red green blue */
{ 0, 0, 0, 0, 0, 0 },
{ 1, 0xffff, 0xffff, 0xffff, 0, 0 }
#else
#ifndef WIN32
/*
This approximates the MS-Windows desktop colormap for testing
purposes but has black and white pixels in the typical Unix
locations, which should be switched if necessary if your system
has blackPixel and whitePixel swapped. No entries are provided
for colormap entries 254 and 255 because AllocColor/FindColor
will reuse entries zero and one.
*/
{ 0, 0, 0, 0, 0, 0 },
{ 1, 0xffff, 0xffff, 0xffff, 0, 0 },
{ 2, 0x8000, 0, 0, 0, 0 },
{ 3, 0, 0x8000, 0, 0, 0 },
{ 4, 0x8000, 0x8000, 0, 0, 0 },
{ 5, 0, 0, 0x8000, 0, 0 },
{ 6, 0x8000, 0, 0x8000, 0, 0 },
{ 7, 0, 0x8000, 0x8000, 0, 0 },
{ 8, 0xc000, 0xc000, 0xc000, 0, 0 },
{ 9, 0xc000, 0xdc00, 0xc000, 0, 0 },
{ 246, 0xa000, 0xa000, 0xa000, 0, 0 },
{ 247, 0x8000, 0x8000, 0x8000, 0, 0 },
{ 248, 0xffff, 0, 0, 0, 0 },
{ 249, 0, 0xffff, 0, 0, 0 },
{ 250, 0xffff, 0xffff, 0, 0, 0 },
{ 251, 0, 0, 0xffff, 0, 0 },
{ 252, 0xffff, 0, 0xffff, 0, 0 },
{ 253, 0, 0xffff, 0xffff, 0, 0 }
#else
/*
this is the MS-Windows desktop, adjusted for X's 16-bit color
specifications.
*/
{ 0, 0, 0, 0, 0, 0 },
{ 1, 0x8000, 0, 0, 0, 0 },
{ 2, 0, 0x8000, 0, 0, 0 },
{ 3, 0x8000, 0x8000, 0, 0, 0 },
{ 4, 0, 0, 0x8000, 0, 0 },
{ 5, 0x8000, 0, 0x8000, 0, 0 },
{ 6, 0, 0x8000, 0x8000, 0, 0 },
{ 7, 0xc000, 0xc000, 0xc000, 0, 0 },
{ 8, 0xc000, 0xdc00, 0xc000, 0, 0 },
{ 9, 0xa600, 0xca00, 0xf000, 0, 0 },
{ 246, 0xff00, 0xfb00, 0xf000, 0, 0 },
{ 247, 0xa000, 0xa000, 0xa400, 0, 0 },
{ 248, 0x8000, 0x8000, 0x8000, 0, 0 },
{ 249, 0xff00, 0, 0, 0, 0 },
{ 250, 0, 0xff00, 0, 0, 0 },
{ 251, 0xff00, 0xff00, 0, 0, 0 },
{ 252, 0, 0, 0xff00, 0, 0 },
{ 253, 0xff00, 0, 0xff00, 0, 0 },
{ 254, 0, 0xff00, 0xff00, 0, 0 },
{ 255, 0xff00, 0xff00, 0xff00, 0, 0 }
#endif
#endif
};
#define NUM_DESKTOP_COLORS (sizeof citems / sizeof citems[0])
void
XcupExtensionInit (INITARGS)
{
#if 0
ExtensionEntry* extEntry;
if ((extEntry = AddExtension (XCUPNAME,
0,
XcupNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
StandardMinorOpcode))) {
ReqCode = (unsigned char)extEntry->base;
ErrorBase = extEntry->errorBase;
}
#else
(void) AddExtension (XCUPNAME,
0,
XcupNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
StandardMinorOpcode);
#endif
/* PC servers initialize the desktop colors (citems) here! */
}
/*ARGSUSED*/
static
void ResetProc(
ExtensionEntry* extEntry)
{
}
static
int ProcQueryVersion(
register ClientPtr client)
{
/* REQUEST (xXcupQueryVersionReq); */
xXcupQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xXcupQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.server_major_version = XCUP_MAJOR_VERSION;
rep.server_minor_version = XCUP_MINOR_VERSION;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
swaps (&rep.server_major_version, n);
swaps (&rep.server_minor_version, n);
}
WriteToClient (client, sizeof (xXcupQueryVersionReply), (char *)&rep);
return client->noClientException;
}
static
int ProcGetReservedColormapEntries(
register ClientPtr client)
{
REQUEST (xXcupGetReservedColormapEntriesReq);
xXcupGetReservedColormapEntriesReply rep;
xColorItem* cptr;
register int n;
REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
#ifndef HAVE_SPECIAL_DESKTOP_COLORS
citems[CUP_BLACK_PIXEL].pixel =
screenInfo.screens[stuff->screen]->blackPixel;
citems[CUP_WHITE_PIXEL].pixel =
screenInfo.screens[stuff->screen]->whitePixel;
#endif
rep.type = X_Reply;
rep.sequence_number = client->sequence;
rep.length = NUM_DESKTOP_COLORS * 3;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
}
WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
for (n = 0, cptr = citems; n < NUM_DESKTOP_COLORS; n++, cptr++) {
if (client->swapped) SwapColorItem (cptr);
WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
}
return client->noClientException;
}
static
int ProcStoreColors(
register ClientPtr client)
{
REQUEST (xXcupStoreColorsReq);
ColormapPtr pcmp;
REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
pcmp = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap,
RT_COLORMAP, SecurityWriteAccess);
if (pcmp) {
int ncolors, n;
xXcupStoreColorsReply rep;
xColorItem* cptr;
if (!(pcmp->class & DynamicClass))
return BadMatch;
ncolors = (client->req_len << 2) - SIZEOF (xXcupStoreColorsReq);
if (ncolors % SIZEOF(xColorItem))
return BadLength;
ncolors /= SIZEOF (xColorItem);
for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
Pixel pixel = cptr->pixel;
if (AllocColor (pcmp,
&cptr->red, &cptr->green, &cptr->blue,
&pixel, client->index) == Success) {
cptr->pixel = pixel;
cptr->flags = 0x08;
} else
cptr->flags = 0;
cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
}
rep.type = X_Reply;
rep.sequence_number = client->sequence;
rep.length = ncolors * 3;
if (client->swapped) {
swaps (&rep.sequence_number, n);
swapl (&rep.length, n);
}
WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
if (client->swapped) SwapColorItem (cptr);
WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
}
return client->noClientException;
} else {
client->errorValue = stuff->cmap;
return BadColor;
}
}
static
int ProcDispatch(
register ClientPtr client)
{
REQUEST (xReq);
switch (stuff->data)
{
case X_XcupQueryVersion:
return ProcQueryVersion (client);
case X_XcupGetReservedColormapEntries:
return ProcGetReservedColormapEntries (client);
case X_XcupStoreColors:
return ProcStoreColors (client);
default:
return BadRequest;
}
}
static
int SProcQueryVersion(
register ClientPtr client)
{
register int n;
REQUEST(xXcupQueryVersionReq);
swaps(&stuff->length, n);
return ProcQueryVersion(client);
}
static
int SProcGetReservedColormapEntries(
ClientPtr client)
{
register int n;
REQUEST (xXcupGetReservedColormapEntriesReq);
swaps (&stuff->length, n);
swapl (&stuff->screen, n);
REQUEST_AT_LEAST_SIZE (xXcupGetReservedColormapEntriesReq);
return ProcGetReservedColormapEntries (client);
}
static
int SProcXcupStoreColors(
ClientPtr client)
{
register int n;
int count;
xColorItem* pItem;
REQUEST (xXcupStoreColorsReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
swapl(&stuff->cmap, n);
pItem = (xColorItem*) &stuff[1];
for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
SwapColorItem(pItem++);
return ProcStoreColors (client);
}
static
int SProcDispatch(
register ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XcupQueryVersion:
return SProcQueryVersion (client);
case X_XcupGetReservedColormapEntries:
return SProcGetReservedColormapEntries (client);
case X_XcupStoreColors:
return SProcXcupStoreColors (client);
default:
return BadRequest;
}
}
/* $XFree86: xc/programs/Xserver/Xext/dgaproc.h,v 1.21 2000/06/30 19:06:54 keithp Exp $ */
#ifndef __DGAPROC_H
#define __DGAPROC_H
#include <nx-X11/Xproto.h>
#include "pixmap.h"
#define DGA_CONCURRENT_ACCESS 0x00000001
#define DGA_FILL_RECT 0x00000002
#define DGA_BLIT_RECT 0x00000004
#define DGA_BLIT_RECT_TRANS 0x00000008
#define DGA_PIXMAP_AVAILABLE 0x00000010
#define DGA_INTERLACED 0x00010000
#define DGA_DOUBLESCAN 0x00020000
#define DGA_FLIP_IMMEDIATE 0x00000001
#define DGA_FLIP_RETRACE 0x00000002
#define DGA_COMPLETED 0x00000000
#define DGA_PENDING 0x00000001
#define DGA_NEED_ROOT 0x00000001
typedef struct {
int num; /* A unique identifier for the mode (num > 0) */
char *name; /* name of mode given in the XF86Config */
int VSync_num;
int VSync_den;
int flags; /* DGA_CONCURRENT_ACCESS, etc... */
int imageWidth; /* linear accessible portion (pixels) */
int imageHeight;
int pixmapWidth; /* Xlib accessible portion (pixels) */
int pixmapHeight; /* both fields ignored if no concurrent access */
int bytesPerScanline;
int byteOrder; /* MSBFirst, LSBFirst */
int depth;
int bitsPerPixel;
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
short visualClass;
int viewportWidth;
int viewportHeight;
int xViewportStep; /* viewport position granularity */
int yViewportStep;
int maxViewportX; /* max viewport origin */
int maxViewportY;
int viewportFlags; /* types of page flipping possible */
int offset;
int reserved1;
int reserved2;
} XDGAModeRec, *XDGAModePtr;
/* DDX interface */
int
DGASetMode(
int Index,
int num,
XDGAModePtr mode,
PixmapPtr *pPix
);
void
DGASetInputMode(
int Index,
Bool keyboard,
Bool mouse
);
void
DGASelectInput(
int Index,
ClientPtr client,
long mask
);
Bool DGAAvailable(int Index);
Bool DGAActive(int Index);
void DGAShutdown(void);
void DGAInstallCmap(ColormapPtr cmap);
int DGAGetViewportStatus(int Index);
int DGASync(int Index);
int
DGAFillRect(
int Index,
int x, int y, int w, int h,
unsigned long color
);
int
DGABlitRect(
int Index,
int srcx, int srcy,
int w, int h,
int dstx, int dsty
);
int
DGABlitTransRect(
int Index,
int srcx, int srcy,
int w, int h,
int dstx, int dsty,
unsigned long color
);
int
DGASetViewport(
int Index,
int x, int y,
int mode
);
int DGAGetModes(int Index);
int DGAGetOldDGAMode(int Index);
int DGAGetModeInfo(int Index, XDGAModePtr mode, int num);
Bool DGAVTSwitch(void);
Bool DGAStealMouseEvent(int Index, xEvent *e, int dx, int dy);
Bool DGAStealKeyEvent(int Index, xEvent *e);
Bool DGAIsDgaEvent (xEvent *e);
Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e);
Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem,
int *size, int *offset, int *flags);
void DGACloseFramebuffer(int Index);
Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode);
int DGACreateColormap(int Index, ClientPtr client, int id, int mode,
int alloc);
extern unsigned char DGAReqCode;
extern int DGAErrorBase;
extern int DGAEventBase;
extern int *XDGAEventBase;
#endif /* __DGAPROC_H */
......@@ -4,52 +4,18 @@ XCOMM This directory is only entered if DoLoadableServer is set
#define IHaveModules
#include <Server.tmpl>
#if BuildMultibuffer
MULTIBUFSRC = mbuf.c
MULTIBUFOBJ = mbuf.o
LinkSourceFile(mbuf.c,..)
#endif
#if BuildScreenSaverExt
SCRNSAVSRC = saver.c
SCRNSAVOBJ = saver.o
LinkSourceFile(saver.c,..)
#endif
#if BuildXF86VidModeExt
VIDMODESRCS = xf86vmode.c
VIDMODEOBJS = xf86vmode.o
LinkSourceFile(xf86vmode.c,..)
#endif
#if BuildXF86MiscExt
XF86MISCSRCS = xf86misc.c
XF86MISCOBJS = xf86misc.o
LinkSourceFile(xf86misc.c,..)
#endif
#if BuildXF86DGA
XF86DGASRCS = xf86dga.c xf86dga2.c
XF86DGAOBJS = xf86dga.o xf86dga2.o
LinkSourceFile(xf86dga.c,..)
LinkSourceFile(xf86dga2.c,..)
#endif
#if BuildDPMS
DPMSSRCS = dpms.c
DPMSOBJS = dpms.o
LinkSourceFile(dpms.c,..)
#endif
#if BuildFontCache
FONTCACHESRCS = fontcache.c
FONTCACHEOBJS = fontcache.o
#if 0
FONTCACHEINCLUDES = -I$(XF86SRC)/os-support
#endif
LinkSourceFile(fontcache.c,..)
#endif
#if BuildXvExt
XVSRCS = xvmain.c xvdisp.c xvmod.c xvmc.c
XVOBJS = xvmain.o xvdisp.o xvmod.o xvmc.o
......@@ -65,57 +31,33 @@ LinkSourceFile(xvmc.c,..)
LinkSourceFile(xres.c,..)
#endif
#if BuildEVI
EVISRCS = EVI.c sampleEVI.c
EVIOBJS = EVI.o sampleEVI.o
LinkSourceFile(EVI.c,..)
LinkSourceFile(sampleEVI.c,..)
#endif
#if BuildCup
CUPSRCS = cup.c
CUPOBJS = cup.o
LinkSourceFile(cup.c,..)
#endif
MODINITSRCS = modinit.c
MODINITOBJS = modinit.o
SRCS = shape.c $(MULTIBUFSRC) \
mitmisc.c \
bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
$(XF86MISCSRCS) $(XF86DGASRCS) \
$(CUPSRCS) $(DPMSSRCS) $(FONTCACHESRCS) \
$(EVISRCS) $(XVSRCS) $(MODINITSRCS) $(XRESSRCS)
SRCS = shape.c \
bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c \
$(DPMSSRCS) \
$(XVSRCS) $(MODINITSRCS) $(XRESSRCS)
MOBJS = $(MODINITOBJS) shape.o $(MULTIBUFOBJ) mitmisc.o \
MOBJS = $(MODINITOBJS) shape.o \
bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o \
$(VIDMODEOBJS) $(XF86MISCOBJS) $(XF86DGAOBJS) \
$(CUPOBJS) $(DPMSOBJS) $(FONTCACHEOBJS) \
$(EVIOBJS) $(XVOBJS) $(XRESOBJS)
$(DPMSOBJS) \
$(XVOBJS) $(XRESOBJS)
DEFINES = -DEXTMODULE $(EXT_DEFINES)
XF86INCLUDES = -I$(XF86COMSRC)
INCLUDES = -I.. -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
$(XF86INCLUDES) $(FONTCACHEINCLUDES)
$(XF86INCLUDES)
LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln
LinkSourceFile(shape.c,..)
LinkSourceFile(mitmisc.c,..)
LinkSourceFile(bigreq.c,..)
LinkSourceFile(sync.c,..)
LinkSourceFile(xcmisc.c,..)
ModuleObjectRule()
/*
* A hack to work around an optimization problem with gcc 2.95.2
*/
#if BuildXF86VidModeExt && defined(GccOptBug295)
SpecialCObjectRule(xf86vmode,NullParameter,-O0)
#endif
SpecialCObjectRule(modinit,$(ICONFIGFILES),$(EXT_DEFINES))
LibraryModuleTarget(extmod,$(MOBJS))
NormalLintTarget($(SRCS))
......
......@@ -53,24 +53,6 @@ ExtensionModule extensionModules[] = {
NULL
},
#endif
#ifdef MULTIBUFFER
{
MultibufferExtensionInit,
MULTIBUFFER_PROTOCOL_NAME,
&noMultibufferExtension,
NULL,
NULL
},
#endif
#ifdef MITMISC
{
MITMiscExtensionInit,
MITMISCNAME,
&noMITMiscExtension,
NULL,
NULL
},
#endif
#ifdef notyet
{
XTestExtensionInit,
......@@ -107,42 +89,6 @@ ExtensionModule extensionModules[] = {
NULL
},
#endif
#ifdef XCMISC
{
XCMiscExtensionInit,
XCMiscExtensionName,
&noXCMiscExtension,
NULL,
NULL
},
#endif
#ifdef XF86VIDMODE
{
XFree86VidModeExtensionInit,
XF86VIDMODENAME,
&noXFree86VidModeExtension,
NULL,
NULL
},
#endif
#ifdef XF86MISC
{
XFree86MiscExtensionInit,
XF86MISCNAME,
&noXFree86MiscExtension,
NULL,
NULL
},
#endif
#ifdef XFreeXDGA
{
XFree86DGAExtensionInit,
XF86DGANAME,
&noXFree86DGAExtension,
XFree86DGARegister,
NULL
},
#endif
#ifdef DPMSExtension
{
DPMSExtensionInit,
......@@ -152,33 +98,6 @@ ExtensionModule extensionModules[] = {
NULL
},
#endif
#ifdef FONTCACHE
{
FontCacheExtensionInit,
FONTCACHENAME,
&noFontCacheExtension,
NULL,
NULL
},
#endif
#ifdef TOGCUP
{
XcupExtensionInit,
XCUPNAME,
&noXcupExtension,
NULL,
NULL
},
#endif
#ifdef EVI
{
EVIExtensionInit,
EVINAME,
&noEVIExtension,
NULL,
NULL
},
#endif
#ifdef XV
{
XvExtensionInit,
......
......@@ -92,18 +92,6 @@ extern void FontCacheExtensionInit(INITARGS);
#include "fontcachstr.h"
#endif
#ifdef TOGCUP
extern void XcupExtensionInit(INITARGS);
#define _XCUP_SERVER_
#include <nx-X11/extensions/Xcupstr.h>
#endif
#ifdef EVI
extern void EVIExtensionInit(INITARGS);
#define _XEVI_SERVER_
#include <nx-X11/extensions/XEVIstr.h>
#endif
#ifdef XV
extern void XvExtensionInit(INITARGS);
extern void XvMCExtensionInit(INITARGS);
......
/*-
* Copyright (c) 1998-1999 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
* All rights reserved.
* Copyright (c) 1998-1999 X-TrueType Server Project, All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: fontcache.c,v 1.12 1999/01/31 13:47:45 akiyama Exp $
*/
/* $XFree86: xc/programs/Xserver/Xext/fontcache.c,v 1.7 2003/10/28 23:08:43 tsi Exp $ */
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "scrnintstr.h"
#include "inputstr.h"
#include "servermd.h"
#define _FONTCACHE_SERVER_
#include "fontcacheP.h"
#include "fontcachstr.h"
#include <nx-X11/Xfuncproto.h>
#include "swaprep.h"
#include "modinit.h"
static int miscErrorBase;
static void FontCacheResetProc(
ExtensionEntry* /* extEntry */
);
static DISPATCH_PROC(ProcFontCacheDispatch);
static DISPATCH_PROC(ProcFontCacheGetCacheSettings);
static DISPATCH_PROC(ProcFontCacheGetCacheStatistics);
static DISPATCH_PROC(ProcFontCacheQueryVersion);
static DISPATCH_PROC(ProcFontCacheChangeCacheSettings);
static DISPATCH_PROC(SProcFontCacheDispatch);
static DISPATCH_PROC(SProcFontCacheGetCacheSettings);
static DISPATCH_PROC(SProcFontCacheGetCacheStatistics);
static DISPATCH_PROC(SProcFontCacheQueryVersion);
static DISPATCH_PROC(SProcFontCacheChangeCacheSettings);
#if 0
static unsigned char FontCacheReqCode = 0;
#endif
void
FontCacheExtensionInit(INITARGS)
{
ExtensionEntry* extEntry;
if (
(extEntry = AddExtension(FONTCACHENAME,
FontCacheNumberEvents,
FontCacheNumberErrors,
ProcFontCacheDispatch,
SProcFontCacheDispatch,
FontCacheResetProc,
StandardMinorOpcode))) {
#if 0
FontCacheReqCode = (unsigned char)extEntry->base;
#endif
miscErrorBase = extEntry->errorBase;
}
}
/*ARGSUSED*/
static void
FontCacheResetProc (extEntry)
ExtensionEntry* extEntry;
{
}
static int
ProcFontCacheQueryVersion(client)
register ClientPtr client;
{
xFontCacheQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH(xFontCacheQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = FONTCACHE_MAJOR_VERSION;
rep.minorVersion = FONTCACHE_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, SIZEOF(xFontCacheQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcFontCacheGetCacheSettings(client)
register ClientPtr client;
{
xFontCacheGetCacheSettingsReply rep;
FontCacheSettings cinfo;
register int n;
REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
/* XXX */
FontCacheGetSettings(&cinfo);
rep.himark = cinfo.himark;
rep.lowmark = cinfo.lowmark;
rep.balance = cinfo.balance;
rep.reserve0 = 0;
rep.reserve1 = 0;
rep.reserve2 = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.himark, n);
swapl(&rep.lowmark, n);
swapl(&rep.balance, n);
swapl(&rep.reserve0, n);
swapl(&rep.reserve1, n);
swapl(&rep.reserve2, n);
}
/* XXX */
WriteToClient(client, SIZEOF(xFontCacheGetCacheSettingsReply),
(char *)&rep);
return (client->noClientException);
}
static int
ProcFontCacheGetCacheStatistics(client)
register ClientPtr client;
{
xFontCacheGetCacheStatisticsReply rep;
FontCacheStatistics cstats;
register int n;
REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = (sz_xFontCacheGetCacheStatisticsReply - 32) >> 2;
/* XXX */
FontCacheGetStatistics(&cstats);
rep.purge_runs = cstats.purge_runs;
rep.purge_stat = cstats.purge_stat;
rep.balance = cstats.balance;
rep.reserve0 = 0;
rep.f_hits = cstats.f.hits;
rep.f_misshits = cstats.f.misshits;
rep.f_purged = cstats.f.purged;
rep.f_usage = cstats.f.usage;
rep.f_reserve0 = 0;
rep.v_hits = cstats.v.hits;
rep.v_misshits = cstats.v.misshits;
rep.v_purged = cstats.v.purged;
rep.v_usage = cstats.v.usage;
rep.v_reserve0 = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.purge_runs, n);
swapl(&rep.purge_stat, n);
swapl(&rep.balance, n);
swapl(&rep.reserve0, n);
swapl(&rep.f_hits, n);
swapl(&rep.f_misshits, n);
swapl(&rep.f_purged, n);
swapl(&rep.f_usage, n);
swapl(&rep.f_reserve0, n);
swapl(&rep.v_hits, n);
swapl(&rep.v_misshits, n);
swapl(&rep.v_purged, n);
swapl(&rep.v_usage, n);
swapl(&rep.v_reserve0, n);
}
/* XXX */
WriteToClient(client, SIZEOF(xFontCacheGetCacheStatisticsReply),
(char *)&rep);
return (client->noClientException);
}
static int
ProcFontCacheChangeCacheSettings(client)
register ClientPtr client;
{
FontCacheSettings cs;
REQUEST(xFontCacheChangeCacheSettingsReq);
REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq);
/* XXX */
cs.himark = stuff->himark;
cs.lowmark = stuff->lowmark;
cs.balance = stuff->balance;
if (cs.himark < 0 || cs.lowmark < 0)
return BadValue;
if (cs.himark <= cs.lowmark)
return BadValue;
if (!(10 <= cs.balance && cs.balance <= 90))
return BadValue;
if (FontCacheChangeSettings(&cs) == 0)
return miscErrorBase + FontCacheCannotAllocMemory;
/* XXX */
return (client->noClientException);
}
static int
ProcFontCacheDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_FontCacheQueryVersion:
return ProcFontCacheQueryVersion(client);
case X_FontCacheGetCacheSettings:
return ProcFontCacheGetCacheSettings(client);
case X_FontCacheGetCacheStatistics:
return ProcFontCacheGetCacheStatistics(client);
case X_FontCacheChangeCacheSettings:
return ProcFontCacheChangeCacheSettings(client);
default:
return miscErrorBase + FontCacheBadProtocol;
}
}
static int
SProcFontCacheQueryVersion(client)
register ClientPtr client;
{
register int n;
REQUEST(xFontCacheQueryVersionReq);
swaps(&stuff->length, n);
return ProcFontCacheQueryVersion(client);
}
static int
SProcFontCacheGetCacheSettings(client)
ClientPtr client;
{
register int n;
REQUEST(xFontCacheGetCacheSettingsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq);
return ProcFontCacheGetCacheSettings(client);
}
static int
SProcFontCacheGetCacheStatistics(client)
ClientPtr client;
{
register int n;
REQUEST(xFontCacheGetCacheStatisticsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq);
return ProcFontCacheGetCacheStatistics(client);
}
static int
SProcFontCacheChangeCacheSettings(client)
ClientPtr client;
{
register int n;
REQUEST(xFontCacheChangeCacheSettingsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq);
/* XXX */
swapl(&stuff->himark, n);
swapl(&stuff->lowmark, n);
swapl(&stuff->balance, n);
/* XXX */
return ProcFontCacheChangeCacheSettings(client);
}
static int
SProcFontCacheDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_FontCacheQueryVersion:
return SProcFontCacheQueryVersion(client);
case X_FontCacheGetCacheSettings:
return SProcFontCacheGetCacheSettings(client);
case X_FontCacheGetCacheStatistics:
return SProcFontCacheGetCacheStatistics(client);
case X_FontCacheChangeCacheSettings:
return SProcFontCacheChangeCacheSettings(client);
default:
return miscErrorBase + FontCacheBadProtocol;
}
}
/* $XFree86: xc/programs/Xserver/Xext/mbuf.c,v 3.15 2003/10/28 23:08:43 tsi Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* $Xorg: mbuf.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "window.h"
#include "os.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "gcstruct.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "sleepuntil.h"
#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
#include <nx-X11/extensions/multibufst.h>
#ifdef EXTMODULE
#include "xf86_ansic.h"
#else
#include <stdio.h>
#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h>
#endif
#endif
/* given an OtherClientPtr obj, get the ClientPtr */
#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
/* given a MultibufferPtr b, get the ClientPtr */
#define bClient(b) (clients[CLIENT_ID(b->pPixmap->drawable.id)])
#define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask)
#if 0
static unsigned char MultibufferReqCode;
#endif
static int MultibufferEventBase;
static int MultibufferErrorBase;
int MultibufferScreenIndex = -1;
int MultibufferWindowIndex = -1;
static void PerformDisplayRequest (
MultibuffersPtr * /* ppMultibuffers */,
MultibufferPtr * /* pMultibuffer */,
int /* nbuf */
);
static Bool QueueDisplayRequest (
ClientPtr /* client */,
TimeStamp /* activateTime */
);
static void BumpTimeStamp (
TimeStamp * /* ts */,
CARD32 /* inc */
);
static void AliasMultibuffer (
MultibuffersPtr /* pMultibuffers */,
int /* i */
);
static void RecalculateMultibufferOtherEvents (
MultibufferPtr /* pMultibuffer */
);
static int EventSelectForMultibuffer(
MultibufferPtr /* pMultibuffer */,
ClientPtr /* client */,
Mask /* mask */
);
/*
* The Pixmap associated with a buffer can be found as a resource
* with this type
*/
RESTYPE MultibufferDrawableResType;
static int MultibufferDrawableDelete (
void * /* value */,
XID /* id */
);
/*
* The per-buffer data can be found as a resource with this type.
* the resource id of the per-buffer data is the same as the resource
* id of the pixmap
*/
static RESTYPE MultibufferResType;
static int MultibufferDelete (
void * /* value */,
XID /* id */
);
/*
* The per-window data can be found as a resource with this type,
* using the window resource id
*/
static RESTYPE MultibuffersResType;
static int MultibuffersDelete (
void * /* value */,
XID /* id */
);
/*
* Clients other than the buffer creator attach event masks in
* OtherClient structures; each has a resource of this type.
*/
static RESTYPE OtherClientResType;
static int OtherClientDelete (
void * /* value */,
XID /* id */
);
/****************
* MultibufferExtensionInit
*
* Called from InitExtensions in main()
*
****************/
extern DISPATCH_PROC(ProcGetBufferAttributes);
static DISPATCH_PROC(ProcClearImageBufferArea);
static DISPATCH_PROC(ProcCreateImageBuffers);
static DISPATCH_PROC(ProcDestroyImageBuffers);
static DISPATCH_PROC(ProcDisplayImageBuffers);
static DISPATCH_PROC(ProcGetBufferInfo);
static DISPATCH_PROC(ProcGetBufferVersion);
static DISPATCH_PROC(ProcGetMBufferAttributes);
static DISPATCH_PROC(ProcMultibufferDispatch);
static DISPATCH_PROC(ProcSetBufferAttributes);
static DISPATCH_PROC(ProcSetMBufferAttributes);
static DISPATCH_PROC(SProcClearImageBufferArea);
static DISPATCH_PROC(SProcCreateImageBuffers);
static DISPATCH_PROC(SProcDestroyImageBuffers);
static DISPATCH_PROC(SProcDisplayImageBuffers);
static DISPATCH_PROC(SProcGetBufferAttributes);
static DISPATCH_PROC(SProcGetBufferInfo);
static DISPATCH_PROC(SProcGetBufferVersion);
static DISPATCH_PROC(SProcGetMBufferAttributes);
static DISPATCH_PROC(SProcMultibufferDispatch);
static DISPATCH_PROC(SProcSetBufferAttributes);
static DISPATCH_PROC(SProcSetMBufferAttributes);
static void MultibufferResetProc(
ExtensionEntry * /* extEntry */
);
static void SClobberNotifyEvent(
xMbufClobberNotifyEvent * /* from */,
xMbufClobberNotifyEvent * /* to */
);
static void SUpdateNotifyEvent(
xMbufUpdateNotifyEvent * /* from */,
xMbufUpdateNotifyEvent * /* to */
);
static Bool MultibufferPositionWindow(
WindowPtr /* pWin */,
int /* x */,
int /* y */
);
static void SetupBackgroundPainter (
WindowPtr /* pWin */,
GCPtr /* pGC */
);
static int DeliverEventsToMultibuffer (
MultibufferPtr /* pMultibuffer */,
xEvent * /* pEvents */,
int /* count */,
Mask /* filter */
);
void
MultibufferExtensionInit()
{
ExtensionEntry *extEntry;
int i, j;
ScreenPtr pScreen;
MultibufferScreenPtr pMultibufferScreen;
/*
* allocate private pointers in windows and screens. Allocating
* window privates may seem like an unnecessary expense, but every
* PositionWindow call must check to see if the window is
* multi-buffered; a resource lookup is too expensive.
*/
MultibufferScreenIndex = AllocateScreenPrivateIndex ();
if (MultibufferScreenIndex < 0)
return;
MultibufferWindowIndex = AllocateWindowPrivateIndex ();
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
if (!AllocateWindowPrivate (pScreen, MultibufferWindowIndex, 0) ||
!(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec))))
{
for (j = 0; j < i; j++)
xfree (screenInfo.screens[j]->devPrivates[MultibufferScreenIndex].ptr);
return;
}
pScreen->devPrivates[MultibufferScreenIndex].ptr = (void *) pMultibufferScreen;
/*
* wrap PositionWindow to resize the pixmap when the window
* changes size
*/
pMultibufferScreen->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = MultibufferPositionWindow;
}
/*
* create the resource types
*/
MultibufferDrawableResType =
CreateNewResourceType(MultibufferDrawableDelete)|RC_CACHED|RC_DRAWABLE;
MultibufferResType = CreateNewResourceType(MultibufferDelete);
MultibuffersResType = CreateNewResourceType(MultibuffersDelete);
OtherClientResType = CreateNewResourceType(OtherClientDelete);
if (MultibufferDrawableResType && MultibufferResType &&
MultibuffersResType && OtherClientResType &&
(extEntry = AddExtension(MULTIBUFFER_PROTOCOL_NAME,
MultibufferNumberEvents,
MultibufferNumberErrors,
ProcMultibufferDispatch, SProcMultibufferDispatch,
MultibufferResetProc, StandardMinorOpcode)))
{
#if 0
MultibufferReqCode = (unsigned char)extEntry->base;
#endif
MultibufferEventBase = extEntry->eventBase;
MultibufferErrorBase = extEntry->errorBase;
EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
}
}
/*ARGSUSED*/
static void
MultibufferResetProc (extEntry)
ExtensionEntry *extEntry;
{
int i;
ScreenPtr pScreen;
MultibufferScreenPtr pMultibufferScreen;
if (MultibufferScreenIndex < 0)
return;
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
if (pScreen->devPrivates[MultibufferScreenIndex].ptr)
{
pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr;
pScreen->PositionWindow = pMultibufferScreen->PositionWindow;
xfree (pMultibufferScreen);
}
}
}
static int
ProcGetBufferVersion (client)
register ClientPtr client;
{
xMbufGetBufferVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xMbufGetBufferVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = MULTIBUFFER_MAJOR_VERSION;
rep.minorVersion = MULTIBUFFER_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
}
WriteToClient(client, sizeof (xMbufGetBufferVersionReply), (char *)&rep);
return (client->noClientException);
}
static void
SetupBackgroundPainter (pWin, pGC)
WindowPtr pWin;
GCPtr pGC;
{
void *gcvalues[4];
int ts_x_origin, ts_y_origin;
PixUnion background;
int backgroundState;
Mask gcmask;
/*
* First take care of any ParentRelative stuff by altering the
* tile/stipple origin to match the coordinates of the upper-left
* corner of the first ancestor without a ParentRelative background.
* This coordinate is, of course, negative.
*/
ts_x_origin = ts_y_origin = 0;
while (pWin->backgroundState == ParentRelative) {
ts_x_origin -= pWin->origin.x;
ts_y_origin -= pWin->origin.y;
pWin = pWin->parent;
}
backgroundState = pWin->backgroundState;
background = pWin->background;
switch (backgroundState)
{
case BackgroundPixel:
gcvalues[0] = (void *) background.pixel;
gcvalues[1] = (void *) FillSolid;
gcmask = GCForeground|GCFillStyle;
break;
case BackgroundPixmap:
gcvalues[0] = (void *) FillTiled;
gcvalues[1] = (void *) background.pixmap;
gcvalues[2] = (void *)(long) ts_x_origin;
gcvalues[3] = (void *)(long) ts_y_origin;
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
break;
default:
gcvalues[0] = (void *) GXnoop;
gcmask = GCFunction;
}
DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE);
}
int
CreateImageBuffers (pWin, nbuf, ids, action, hint)
WindowPtr pWin;
int nbuf;
XID *ids;
int action;
int hint;
{
MultibuffersPtr pMultibuffers;
MultibufferPtr pMultibuffer;
ScreenPtr pScreen;
int width, height, depth;
int i;
GCPtr pClearGC = NULL;
xRectangle clearRect;
DestroyImageBuffers(pWin);
pMultibuffers = (MultibuffersPtr) xalloc (sizeof (MultibuffersRec) +
nbuf * sizeof (MultibufferRec));
if (!pMultibuffers)
return BadAlloc;
pMultibuffers->pWindow = pWin;
pMultibuffers->buffers = (MultibufferPtr) (pMultibuffers + 1);
pMultibuffers->refcnt = pMultibuffers->numMultibuffer = 0;
if (!AddResource (pWin->drawable.id, MultibuffersResType, (void *) pMultibuffers))
return BadAlloc;
width = pWin->drawable.width;
height = pWin->drawable.height;
depth = pWin->drawable.depth;
pScreen = pWin->drawable.pScreen;
if (pWin->backgroundState != None)
{
pClearGC = GetScratchGC (pWin->drawable.depth, pScreen);
SetupBackgroundPainter (pWin, pClearGC);
clearRect.x = clearRect.y = 0;
clearRect.width = width;
clearRect.height = height;
}
for (i = 0; i < nbuf; i++)
{
pMultibuffer = &pMultibuffers->buffers[i];
pMultibuffer->eventMask = 0L;
pMultibuffer->otherEventMask = 0L;
pMultibuffer->otherClients = (OtherClientsPtr) NULL;
pMultibuffer->number = i;
pMultibuffer->side = MultibufferSideMono;
pMultibuffer->clobber = MultibufferUnclobbered;
pMultibuffer->pMultibuffers = pMultibuffers;
if (!AddResource (ids[i], MultibufferResType, (void *) pMultibuffer))
break;
pMultibuffer->pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth);
if (!pMultibuffer->pPixmap)
break;
if (!AddResource (ids[i], MultibufferDrawableResType, (void *) pMultibuffer->pPixmap))
{
FreeResource (ids[i], MultibufferResType);
(*pScreen->DestroyPixmap) (pMultibuffer->pPixmap);
break;
}
pMultibuffer->pPixmap->drawable.id = ids[i];
if (i > 0 && pClearGC)
{
ValidateGC((DrawablePtr)pMultibuffer->pPixmap, pClearGC);
(*pClearGC->ops->PolyFillRect)((DrawablePtr)pMultibuffer->pPixmap,
pClearGC, 1, &clearRect);
}
}
pMultibuffers->numMultibuffer = i;
pMultibuffers->refcnt = i;
pMultibuffers->displayedMultibuffer = -1;
if (i > 0)
AliasMultibuffer (pMultibuffers, 0);
pMultibuffers->updateAction = action;
pMultibuffers->updateHint = hint;
pMultibuffers->windowMode = MultibufferModeMono;
pMultibuffers->lastUpdate.months = 0;
pMultibuffers->lastUpdate.milliseconds = 0;
pMultibuffers->width = width;
pMultibuffers->height = height;
pWin->devPrivates[MultibufferWindowIndex].ptr = (void *) pMultibuffers;
if (pClearGC) FreeScratchGC(pClearGC);
return Success;
}
static int
ProcCreateImageBuffers (client)
register ClientPtr client;
{
REQUEST(xMbufCreateImageBuffersReq);
xMbufCreateImageBuffersReply rep;
register int n;
WindowPtr pWin;
XID *ids;
int len, nbuf;
int i;
int err;
REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
if (len == 0)
return BadLength;
if (!(pWin = LookupWindow (stuff->window, client)))
return BadWindow;
if (pWin->drawable.class == InputOnly)
return BadMatch;
switch (stuff->updateAction)
{
case MultibufferUpdateActionUndefined:
case MultibufferUpdateActionBackground:
case MultibufferUpdateActionUntouched:
case MultibufferUpdateActionCopied:
break;
default:
client->errorValue = stuff->updateAction;
return BadValue;
}
switch (stuff->updateHint)
{
case MultibufferUpdateHintFrequent:
case MultibufferUpdateHintIntermittent:
case MultibufferUpdateHintStatic:
break;
default:
client->errorValue = stuff->updateHint;
return BadValue;
}
nbuf = len;
ids = (XID *) &stuff[1];
for (i = 0; i < nbuf; i++)
{
LEGAL_NEW_RESOURCE(ids[i], client);
}
err = CreateImageBuffers (pWin, nbuf, ids,
stuff->updateAction, stuff->updateHint);
if (err != Success)
return err;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.numberBuffer = ((MultibuffersPtr) (pWin->devPrivates[MultibufferWindowIndex].ptr))->numMultibuffer;
if (client->swapped)
{
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.numberBuffer, n);
}
WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
return (client->noClientException);
}
static int
ProcDisplayImageBuffers (client)
register ClientPtr client;
{
REQUEST(xMbufDisplayImageBuffersReq);
MultibufferPtr *pMultibuffer;
MultibuffersPtr *ppMultibuffers;
int nbuf;
XID *ids;
int i, j;
CARD32 minDelay;
TimeStamp activateTime, bufferTime;
REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2);
if (!nbuf)
return Success;
minDelay = stuff->minDelay;
ids = (XID *) &stuff[1];
ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr));
pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr));
if (!ppMultibuffers || !pMultibuffer)
{
if (ppMultibuffers) DEALLOCATE_LOCAL(ppMultibuffers);
if (pMultibuffer) DEALLOCATE_LOCAL(pMultibuffer);
client->errorValue = 0;
return BadAlloc;
}
activateTime.months = 0;
activateTime.milliseconds = 0;
for (i = 0; i < nbuf; i++)
{
pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i],
MultibufferResType);
if (!pMultibuffer[i])
{
DEALLOCATE_LOCAL(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer);
client->errorValue = ids[i];
return MultibufferErrorBase + MultibufferBadBuffer;
}
ppMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
for (j = 0; j < i; j++)
{
if (ppMultibuffers[i] == ppMultibuffers[j])
{
DEALLOCATE_LOCAL(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer);
client->errorValue = ids[i];
return BadMatch;
}
}
bufferTime = ppMultibuffers[i]->lastUpdate;
BumpTimeStamp (&bufferTime, minDelay);
if (CompareTimeStamps (bufferTime, activateTime) == LATER)
activateTime = bufferTime;
}
UpdateCurrentTime ();
if (CompareTimeStamps (activateTime, currentTime) == LATER &&
QueueDisplayRequest (client, activateTime))
{
;
}
else
PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
DEALLOCATE_LOCAL(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer);
return Success;
}
static int
ProcDestroyImageBuffers (client)
register ClientPtr client;
{
REQUEST (xMbufDestroyImageBuffersReq);
WindowPtr pWin;
REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
if (!(pWin = LookupWindow (stuff->window, client)))
return BadWindow;
DestroyImageBuffers (pWin);
return Success;
}
static int
ProcSetMBufferAttributes (client)
register ClientPtr client;
{
REQUEST (xMbufSetMBufferAttributesReq);
WindowPtr pWin;
MultibuffersPtr pMultibuffers;
int len;
Mask vmask;
Mask index2;
CARD32 updateHint;
XID *vlist;
REQUEST_AT_LEAST_SIZE (xMbufSetMBufferAttributesReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers)
return BadMatch;
len = stuff->length - (sizeof (xMbufSetMBufferAttributesReq) >> 2);
vmask = stuff->valueMask;
if (len != Ones (vmask))
return BadLength;
vlist = (XID *) &stuff[1];
while (vmask)
{
index2 = (Mask) lowbit (vmask);
vmask &= ~index2;
switch (index2)
{
case MultibufferWindowUpdateHint:
updateHint = (CARD32) *vlist;
switch (updateHint)
{
case MultibufferUpdateHintFrequent:
case MultibufferUpdateHintIntermittent:
case MultibufferUpdateHintStatic:
pMultibuffers->updateHint = updateHint;
break;
default:
client->errorValue = updateHint;
return BadValue;
}
vlist++;
break;
default:
client->errorValue = stuff->valueMask;
return BadValue;
}
}
return Success;
}
static int
ProcGetMBufferAttributes (client)
ClientPtr client;
{
REQUEST (xMbufGetMBufferAttributesReq);
WindowPtr pWin;
MultibuffersPtr pMultibuffers;
XID *ids;
xMbufGetMBufferAttributesReply rep;
int i, n;
REQUEST_SIZE_MATCH (xMbufGetMBufferAttributesReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers)
return BadAccess;
ids = (XID *) ALLOCATE_LOCAL (pMultibuffers->numMultibuffer * sizeof (XID));
if (!ids)
return BadAlloc;
for (i = 0; i < pMultibuffers->numMultibuffer; i++)
ids[i] = pMultibuffers->buffers[i].pPixmap->drawable.id;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = pMultibuffers->numMultibuffer;
rep.displayedBuffer = pMultibuffers->displayedMultibuffer;
rep.updateAction = pMultibuffers->updateAction;
rep.updateHint = pMultibuffers->updateHint;
rep.windowMode = pMultibuffers->windowMode;
if (client->swapped)
{
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.displayedBuffer, n);
SwapLongs (ids, pMultibuffers->numMultibuffer);
}
WriteToClient (client, sizeof(xMbufGetMBufferAttributesReply),
(char *)&rep);
WriteToClient (client, (int)(pMultibuffers->numMultibuffer * sizeof (XID)),
(char *)ids);
DEALLOCATE_LOCAL((void *) ids);
return client->noClientException;
}
static int
ProcSetBufferAttributes (client)
register ClientPtr client;
{
REQUEST(xMbufSetBufferAttributesReq);
MultibufferPtr pMultibuffer;
int len;
Mask vmask, index2;
XID *vlist;
Mask eventMask;
int result;
REQUEST_AT_LEAST_SIZE (xMbufSetBufferAttributesReq);
pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
if (!pMultibuffer)
return MultibufferErrorBase + MultibufferBadBuffer;
len = stuff->length - (sizeof (xMbufSetBufferAttributesReq) >> 2);
vmask = stuff->valueMask;
if (len != Ones (vmask))
return BadLength;
vlist = (XID *) &stuff[1];
while (vmask)
{
index2 = (Mask) lowbit (vmask);
vmask &= ~index2;
switch (index2)
{
case MultibufferBufferEventMask:
eventMask = (Mask) *vlist;
vlist++;
result = EventSelectForMultibuffer (pMultibuffer, client, eventMask);
if (result != Success)
return result;
break;
default:
client->errorValue = stuff->valueMask;
return BadValue;
}
}
return Success;
}
int
ProcGetBufferAttributes (client)
register ClientPtr client;
{
REQUEST(xMbufGetBufferAttributesReq);
MultibufferPtr pMultibuffer;
xMbufGetBufferAttributesReply rep;
OtherClientsPtr other;
int n;
REQUEST_SIZE_MATCH (xMbufGetBufferAttributesReq);
pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
if (!pMultibuffer)
return MultibufferErrorBase + MultibufferBadBuffer;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.window = pMultibuffer->pMultibuffers->pWindow->drawable.id;
if (bClient (pMultibuffer) == client)
rep.eventMask = pMultibuffer->eventMask;
else
{
rep.eventMask = (Mask) 0L;
for (other = pMultibuffer->otherClients; other; other = other->next)
if (SameClient (other, client))
{
rep.eventMask = other->mask;
break;
}
}
rep.bufferIndex = pMultibuffer->number;
rep.side = pMultibuffer->side;
if (client->swapped)
{
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.window, n);
swapl(&rep.eventMask, n);
swaps(&rep.bufferIndex, n);
}
WriteToClient(client, sizeof (xMbufGetBufferAttributesReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcGetBufferInfo (client)
register ClientPtr client;
{
REQUEST (xMbufGetBufferInfoReq);
DrawablePtr pDrawable;
xMbufGetBufferInfoReply rep;
ScreenPtr pScreen;
int i, j, k;
int n;
xMbufBufferInfo *pInfo;
int nInfo;
DepthPtr pDepth;
pDrawable = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDrawable)
return BadDrawable;
pScreen = pDrawable->pScreen;
nInfo = 0;
for (i = 0; i < pScreen->numDepths; i++)
{
pDepth = &pScreen->allowedDepths[i];
nInfo += pDepth->numVids;
}
pInfo = (xMbufBufferInfo *)
ALLOCATE_LOCAL (nInfo * sizeof (xMbufBufferInfo));
if (!pInfo)
return BadAlloc;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = nInfo * (sizeof (xMbufBufferInfo) >> 2);
rep.normalInfo = nInfo;
rep.stereoInfo = 0;
if (client->swapped)
{
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.normalInfo, n);
swaps(&rep.stereoInfo, n);
}
k = 0;
for (i = 0; i < pScreen->numDepths; i++)
{
pDepth = &pScreen->allowedDepths[i];
for (j = 0; j < pDepth->numVids; j++)
{
pInfo[k].visualID = pDepth->vids[j];
pInfo[k].maxBuffers = 0;
pInfo[k].depth = pDepth->depth;
if (client->swapped)
{
swapl (&pInfo[k].visualID, n);
swaps (&pInfo[k].maxBuffers, n);
}
k++;
}
}
WriteToClient (client, sizeof (xMbufGetBufferInfoReply), (void *) &rep);
WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (void *) pInfo);
DEALLOCATE_LOCAL ((void *) pInfo);
return client->noClientException;
}
static int
ProcClearImageBufferArea (client)
register ClientPtr client;
{
REQUEST (xMbufClearImageBufferAreaReq);
MultibufferPtr pMultibuffer;
WindowPtr pWin;
xRectangle clearRect;
int width, height;
DrawablePtr pDrawable;
ScreenPtr pScreen;
REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq);
pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
if (!pMultibuffer)
return MultibufferErrorBase + MultibufferBadBuffer;
if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse))
{
client->errorValue = stuff->exposures;
return(BadValue);
}
pWin = pMultibuffer->pMultibuffers->pWindow;
width = pWin->drawable.width;
height = pWin->drawable.height;
pScreen = pWin->drawable.pScreen;
clearRect.x = stuff->x;
clearRect.y = stuff->y;
clearRect.width = stuff->width ? stuff->width : width;
clearRect.height = stuff->height ? stuff->height : height;
if (pWin->backgroundState != None)
{
GCPtr pClearGC;
pClearGC = GetScratchGC (pWin->drawable.depth, pScreen);
SetupBackgroundPainter (pWin, pClearGC);
if (pMultibuffer->number == pMultibuffer->pMultibuffers->displayedMultibuffer)
pDrawable = (DrawablePtr)pWin;
else
pDrawable = (DrawablePtr)pMultibuffer->pPixmap;
ValidateGC(pDrawable, pClearGC);
(*pClearGC->ops->PolyFillRect) (pDrawable, pClearGC, 1, &clearRect);
FreeScratchGC(pClearGC);
}
if (stuff->exposures)
{
RegionRec region;
BoxRec box;
box.x1 = clearRect.x;
box.y1 = clearRect.y;
box.x2 = clearRect.x + clearRect.width;
box.y2 = clearRect.y + clearRect.height;
RegionInit(&region, &box, 1);
MultibufferExpose(pMultibuffer, &region);
RegionUninit(&region);
}
return Success;
}
static int
ProcMultibufferDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data) {
case X_MbufGetBufferVersion:
return ProcGetBufferVersion (client);
case X_MbufCreateImageBuffers:
return ProcCreateImageBuffers (client);
case X_MbufDisplayImageBuffers:
return ProcDisplayImageBuffers (client);
case X_MbufDestroyImageBuffers:
return ProcDestroyImageBuffers (client);
case X_MbufSetMBufferAttributes:
return ProcSetMBufferAttributes (client);
case X_MbufGetMBufferAttributes:
return ProcGetMBufferAttributes (client);
case X_MbufSetBufferAttributes:
return ProcSetBufferAttributes (client);
case X_MbufGetBufferAttributes:
return ProcGetBufferAttributes (client);
case X_MbufGetBufferInfo:
return ProcGetBufferInfo (client);
case X_MbufClearImageBufferArea:
return ProcClearImageBufferArea (client);
default:
return BadRequest;
}
}
static int
SProcGetBufferVersion (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufGetBufferVersionReq);
swaps (&stuff->length, n);
return ProcGetBufferVersion (client);
}
static int
SProcCreateImageBuffers (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufCreateImageBuffersReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
swapl (&stuff->window, n);
SwapRestL(stuff);
return ProcCreateImageBuffers (client);
}
static int
SProcDisplayImageBuffers (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufDisplayImageBuffersReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
swaps (&stuff->minDelay, n);
swaps (&stuff->maxDelay, n);
SwapRestL(stuff);
return ProcDisplayImageBuffers (client);
}
static int
SProcDestroyImageBuffers (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufDestroyImageBuffersReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
swapl (&stuff->window, n);
return ProcDestroyImageBuffers (client);
}
static int
SProcSetMBufferAttributes (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufSetMBufferAttributesReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xMbufSetMBufferAttributesReq);
swapl (&stuff->window, n);
swapl (&stuff->valueMask, n);
SwapRestL(stuff);
return ProcSetMBufferAttributes (client);
}
static int
SProcGetMBufferAttributes (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufGetMBufferAttributesReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xMbufGetMBufferAttributesReq);
swapl (&stuff->window, n);
return ProcGetMBufferAttributes (client);
}
static int
SProcSetBufferAttributes (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufSetBufferAttributesReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xMbufSetBufferAttributesReq);
swapl (&stuff->buffer, n);
swapl (&stuff->valueMask, n);
SwapRestL(stuff);
return ProcSetBufferAttributes (client);
}
static int
SProcGetBufferAttributes (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufGetBufferAttributesReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xMbufGetBufferAttributesReq);
swapl (&stuff->buffer, n);
return ProcGetBufferAttributes (client);
}
static int
SProcGetBufferInfo (client)
register ClientPtr client;
{
register int n;
REQUEST (xMbufGetBufferInfoReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xMbufGetBufferInfoReq);
swapl (&stuff->drawable, n);
return ProcGetBufferInfo (client);
}
static int
SProcClearImageBufferArea(client)
register ClientPtr client;
{
register char n;
REQUEST(xMbufClearImageBufferAreaReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq);
swapl(&stuff->buffer, n);
swaps(&stuff->x, n);
swaps(&stuff->y, n);
swaps(&stuff->width, n);
swaps(&stuff->height, n);
return ProcClearImageBufferArea(client);
}
static int
SProcMultibufferDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data) {
case X_MbufGetBufferVersion:
return SProcGetBufferVersion (client);
case X_MbufCreateImageBuffers:
return SProcCreateImageBuffers (client);
case X_MbufDisplayImageBuffers:
return SProcDisplayImageBuffers (client);
case X_MbufDestroyImageBuffers:
return SProcDestroyImageBuffers (client);
case X_MbufSetMBufferAttributes:
return SProcSetMBufferAttributes (client);
case X_MbufGetMBufferAttributes:
return SProcGetMBufferAttributes (client);
case X_MbufSetBufferAttributes:
return SProcSetBufferAttributes (client);
case X_MbufGetBufferAttributes:
return SProcGetBufferAttributes (client);
case X_MbufGetBufferInfo:
return SProcGetBufferInfo (client);
case X_MbufClearImageBufferArea:
return SProcClearImageBufferArea (client);
default:
return BadRequest;
}
}
static void
SUpdateNotifyEvent (from, to)
xMbufUpdateNotifyEvent *from, *to;
{
to->type = from->type;
cpswaps (from->sequenceNumber, to->sequenceNumber);
cpswapl (from->buffer, to->buffer);
cpswapl (from->timeStamp, to->timeStamp);
}
static void
SClobberNotifyEvent (from, to)
xMbufClobberNotifyEvent *from, *to;
{
to->type = from->type;
cpswaps (from->sequenceNumber, to->sequenceNumber);
cpswapl (from->buffer, to->buffer);
to->state = from->state;
}
static void
PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
MultibufferPtr *pMultibuffer;
MultibuffersPtr *ppMultibuffers;
int nbuf;
{
GCPtr pGC;
PixmapPtr pPrevPixmap, pNewPixmap;
xRectangle clearRect;
WindowPtr pWin;
RegionPtr pExposed;
int i;
MultibufferPtr pPrevMultibuffer;
XID graphicsExpose;
UpdateCurrentTime ();
for (i = 0; i < nbuf; i++)
{
pWin = ppMultibuffers[i]->pWindow;
pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
pPrevMultibuffer =
&ppMultibuffers[i]->buffers[ppMultibuffers[i]->displayedMultibuffer];
pPrevPixmap = pPrevMultibuffer->pPixmap;
pNewPixmap = pMultibuffer[i]->pPixmap;
switch (ppMultibuffers[i]->updateAction)
{
case MultibufferUpdateActionUndefined:
break;
case MultibufferUpdateActionBackground:
SetupBackgroundPainter (pWin, pGC);
ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
clearRect.x = 0;
clearRect.y = 0;
clearRect.width = pPrevPixmap->drawable.width;
clearRect.height = pPrevPixmap->drawable.height;
(*pGC->ops->PolyFillRect) ((DrawablePtr)pPrevPixmap, pGC,
1, &clearRect);
break;
case MultibufferUpdateActionUntouched:
/* copy the window to the pixmap that represents the
* currently displayed buffer
*/
if (pPrevMultibuffer->eventMask & ExposureMask)
{
graphicsExpose = TRUE;
DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
}
ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
pExposed = (*pGC->ops->CopyArea)
((DrawablePtr) pWin,
(DrawablePtr) pPrevPixmap,
pGC,
0, 0,
pWin->drawable.width, pWin->drawable.height,
0, 0);
/* if we couldn't copy the whole window to the buffer,
* send expose events (if any client wants them)
*/
if (pPrevMultibuffer->eventMask & ExposureMask)
{ /* some client wants expose events */
if (pExposed)
{
RegionPtr pWinSize;
pWinSize = CreateUnclippedWinSize (pWin);
/* pExposed is window-relative, but at this point
* pWinSize is screen-relative. Make pWinSize be
* window-relative so that region ops involving
* pExposed and pWinSize behave sensibly.
*/
RegionTranslate(pWinSize,
-pWin->drawable.x, -pWin->drawable.y);
RegionIntersect(pExposed,
pExposed, pWinSize);
RegionDestroy(pWinSize);
MultibufferExpose (pPrevMultibuffer, pExposed);
RegionDestroy(pExposed);
}
graphicsExpose = FALSE;
DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
}
break; /* end case MultibufferUpdateActionUntouched */
case MultibufferUpdateActionCopied:
ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
(DrawablePtr)pPrevPixmap, pGC,
0, 0,
pWin->drawable.width, pWin->drawable.height,
0, 0);
break;
} /* end switch on update action */
/* display the new buffer */
ValidateGC ((DrawablePtr)pWin, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin, pGC,
0, 0,
pWin->drawable.width, pWin->drawable.height,
0, 0);
ppMultibuffers[i]->lastUpdate = currentTime;
MultibufferUpdate (pMultibuffer[i],
ppMultibuffers[i]->lastUpdate.milliseconds);
AliasMultibuffer (ppMultibuffers[i],
pMultibuffer[i] - ppMultibuffers[i]->buffers);
FreeScratchGC (pGC);
}
}
DrawablePtr
GetBufferPointer (pWin, i)
WindowPtr pWin;
int i;
{
MultibuffersPtr pMultibuffers;
if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr))
return NULL;
return (DrawablePtr) pMultibuffers->buffers[i].pPixmap;
}
int
DisplayImageBuffers (ids, nbuf)
XID *ids;
int nbuf;
{
MultibufferPtr *pMultibuffer;
MultibuffersPtr *pMultibuffers;
int i, j;
pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL (nbuf * sizeof *pMultibuffer +
nbuf * sizeof *pMultibuffers);
if (!pMultibuffer)
return BadAlloc;
pMultibuffers = (MultibuffersPtr *) (pMultibuffer + nbuf);
for (i = 0; i < nbuf; i++)
{
pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType);
if (!pMultibuffer[i])
{
DEALLOCATE_LOCAL (pMultibuffer);
return MultibufferErrorBase + MultibufferBadBuffer;
}
pMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
for (j = 0; j < i; j++)
if (pMultibuffers[i] == pMultibuffers[j])
{
DEALLOCATE_LOCAL (pMultibuffer);
return BadMatch;
}
}
PerformDisplayRequest (pMultibuffers, pMultibuffer, nbuf);
DEALLOCATE_LOCAL (pMultibuffer);
return Success;
}
static Bool
QueueDisplayRequest (client, activateTime)
ClientPtr client;
TimeStamp activateTime;
{
/* see xtest.c:ProcXTestFakeInput for code similar to this */
if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
{
return FALSE;
}
/* swap the request back so we can simply re-execute it */
if (client->swapped)
{
register int n;
REQUEST (xMbufDisplayImageBuffersReq);
SwapRestL(stuff);
swaps (&stuff->length, n);
swaps (&stuff->minDelay, n);
swaps (&stuff->maxDelay, n);
}
ResetCurrentRequest (client);
client->sequence--;
return TRUE;
}
/*
* Deliver events to a buffer
*/
static int
DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
MultibufferPtr pMultibuffer;
xEvent *pEvents;
int count;
Mask filter;
{
int deliveries = 0, nondeliveries = 0;
int attempt;
OtherClients *other;
/* if nobody wants the event, we're done */
if (!((pMultibuffer->otherEventMask|pMultibuffer->eventMask) & filter))
return 0;
/* maybe send event to owner */
if ((attempt = TryClientEvents(
bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0)
{
if (attempt > 0)
deliveries++;
else
nondeliveries--;
}
/* maybe send event to other clients */
for (other = pMultibuffer->otherClients; other; other=other->next)
{
if ((attempt = TryClientEvents(
rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0)
{
if (attempt > 0)
deliveries++;
else
nondeliveries--;
}
}
if (deliveries)
return deliveries;
return nondeliveries;
}
/*
* Send Expose events to interested clients
*/
void
MultibufferExpose (pMultibuffer, pRegion)
MultibufferPtr pMultibuffer;
RegionPtr pRegion;
{
if (pRegion && !RegionNil(pRegion))
{
xEvent *pEvent;
PixmapPtr pPixmap;
register xEvent *pe;
register BoxPtr pBox;
register int i;
int numRects;
pPixmap = pMultibuffer->pPixmap;
RegionTranslate(pRegion,
-pPixmap->drawable.x, -pPixmap->drawable.y);
/* XXX MultibufferExpose "knows" the region representation */
numRects = RegionNumRects(pRegion);
pBox = RegionRects(pRegion);
pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent));
if (pEvent) {
pe = pEvent;
for (i=1; i<=numRects; i++, pe++, pBox++)
{
pe->u.u.type = Expose;
pe->u.expose.window = pPixmap->drawable.id;
pe->u.expose.x = pBox->x1;
pe->u.expose.y = pBox->y1;
pe->u.expose.width = pBox->x2 - pBox->x1;
pe->u.expose.height = pBox->y2 - pBox->y1;
pe->u.expose.count = (numRects - i);
}
(void) DeliverEventsToMultibuffer (pMultibuffer, pEvent, numRects,
ExposureMask);
DEALLOCATE_LOCAL(pEvent);
}
}
}
/* send UpdateNotify event */
void
MultibufferUpdate (pMultibuffer, time2)
MultibufferPtr pMultibuffer;
CARD32 time2;
{
xMbufUpdateNotifyEvent event;
event.type = MultibufferEventBase + MultibufferUpdateNotify;
event.buffer = pMultibuffer->pPixmap->drawable.id;
event.timeStamp = time2;
(void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
1, (Mask)MultibufferUpdateNotifyMask);
}
/*
* The sample implementation will never generate MultibufferClobberNotify
* events
*/
void
MultibufferClobber (pMultibuffer)
MultibufferPtr pMultibuffer;
{
xMbufClobberNotifyEvent event;
event.type = MultibufferEventBase + MultibufferClobberNotify;
event.buffer = pMultibuffer->pPixmap->drawable.id;
event.state = pMultibuffer->clobber;
(void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
1, (Mask)MultibufferClobberNotifyMask);
}
/*
* make the resource id for buffer i refer to the window
* drawable instead of the pixmap;
*/
static void
AliasMultibuffer (pMultibuffers, i)
MultibuffersPtr pMultibuffers;
int i;
{
MultibufferPtr pMultibuffer;
if (i == pMultibuffers->displayedMultibuffer)
return;
/*
* remove the old association
*/
if (pMultibuffers->displayedMultibuffer >= 0)
{
pMultibuffer = &pMultibuffers->buffers[pMultibuffers->displayedMultibuffer];
ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
MultibufferDrawableResType,
(void *) pMultibuffer->pPixmap);
}
/*
* make the new association
*/
pMultibuffer = &pMultibuffers->buffers[i];
ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
MultibufferDrawableResType,
(void *) pMultibuffers->pWindow);
pMultibuffers->displayedMultibuffer = i;
}
/*
* free everything associated with multibuffering for this
* window
*/
void
DestroyImageBuffers (pWin)
WindowPtr pWin;
{
FreeResourceByType (pWin->drawable.id, MultibuffersResType, FALSE);
/* Zero out the window's pointer to the buffers so they won't be reused */
pWin->devPrivates[MultibufferWindowIndex].ptr = NULL;
}
/*
* resize the buffers when the window is resized
*/
static Bool
MultibufferPositionWindow (pWin, x, y)
WindowPtr pWin;
int x, y;
{
ScreenPtr pScreen;
MultibufferScreenPtr pMultibufferScreen;
MultibuffersPtr pMultibuffers;
MultibufferPtr pMultibuffer;
int width, height;
int i;
int dx, dy, dw, dh;
int sourcex, sourcey;
int destx, desty;
PixmapPtr pPixmap;
GCPtr pGC;
int savewidth, saveheight;
xRectangle clearRect;
Bool clear;
pScreen = pWin->drawable.pScreen;
pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr;
(*pMultibufferScreen->PositionWindow) (pWin, x, y);
/* if this window is not multibuffered, we're done */
if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr))
return TRUE;
/* if new size is same as old, we're done */
if (pMultibuffers->width == pWin->drawable.width &&
pMultibuffers->height == pWin->drawable.height)
return TRUE;
width = pWin->drawable.width;
height = pWin->drawable.height;
dx = pWin->drawable.x - pMultibuffers->x;
dy = pWin->drawable.x - pMultibuffers->y;
dw = width - pMultibuffers->width;
dh = height - pMultibuffers->height;
GravityTranslate (0, 0, -dx, -dy, dw, dh,
pWin->bitGravity, &destx, &desty);
/* if the window grew, remember to paint the window background,
* and maybe send expose events, for the new areas of the buffers
*/
clear = pMultibuffers->width < width || pMultibuffers->height < height ||
pWin->bitGravity == ForgetGravity;
sourcex = 0;
sourcey = 0;
savewidth = pMultibuffers->width;
saveheight = pMultibuffers->height;
/* clip rectangle to source and destination */
if (destx < 0)
{
savewidth += destx;
sourcex -= destx;
destx = 0;
}
if (destx + savewidth > width)
savewidth = width - destx;
if (desty < 0)
{
saveheight += desty;
sourcey -= desty;
desty = 0;
}
if (desty + saveheight > height)
saveheight = height - desty;
pMultibuffers->width = width;
pMultibuffers->height = height;
pMultibuffers->x = pWin->drawable.x;
pMultibuffers->y = pWin->drawable.y;
pGC = GetScratchGC (pWin->drawable.depth, pScreen);
if (clear)
{
SetupBackgroundPainter (pWin, pGC);
clearRect.x = 0;
clearRect.y = 0;
clearRect.width = width;
clearRect.height = height;
}
for (i = 0; i < pMultibuffers->numMultibuffer; i++)
{
pMultibuffer = &pMultibuffers->buffers[i];
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
pWin->drawable.depth);
if (!pPixmap)
{
DestroyImageBuffers (pWin);
break;
}
ValidateGC ((DrawablePtr)pPixmap, pGC);
/*
* I suppose this could avoid quite a bit of work if
* it computed the minimal area required.
*/
if (clear)
(*pGC->ops->PolyFillRect) ((DrawablePtr)pPixmap, pGC, 1, &clearRect);
if (pWin->bitGravity != ForgetGravity)
{
(*pGC->ops->CopyArea) ((DrawablePtr)pMultibuffer->pPixmap,
(DrawablePtr)pPixmap, pGC,
sourcex, sourcey, savewidth, saveheight,
destx, desty);
}
pPixmap->drawable.id = pMultibuffer->pPixmap->drawable.id;
(*pScreen->DestroyPixmap) (pMultibuffer->pPixmap);
pMultibuffer->pPixmap = pPixmap;
if (i != pMultibuffers->displayedMultibuffer)
{
ChangeResourceValue (pPixmap->drawable.id,
MultibufferDrawableResType,
(void *) pPixmap);
}
}
FreeScratchGC (pGC);
return TRUE;
}
/* Resource delete func for MultibufferDrawableResType */
/*ARGSUSED*/
static int
MultibufferDrawableDelete (value, id)
void *value;
XID id;
{
DrawablePtr pDrawable = (DrawablePtr)value;
WindowPtr pWin;
MultibuffersPtr pMultibuffers;
PixmapPtr pPixmap;
if (pDrawable->type == DRAWABLE_WINDOW)
{
pWin = (WindowPtr) pDrawable;
pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr;
pPixmap = pMultibuffers->buffers[pMultibuffers->displayedMultibuffer].pPixmap;
}
else
{
pPixmap = (PixmapPtr) pDrawable;
}
(*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
return Success;
}
/* Resource delete func for MultibufferResType */
/*ARGSUSED*/
static int
MultibufferDelete (value, id)
void *value;
XID id;
{
MultibufferPtr pMultibuffer = (MultibufferPtr)value;
MultibuffersPtr pMultibuffers;
pMultibuffers = pMultibuffer->pMultibuffers;
if (--pMultibuffers->refcnt == 0)
{
FreeResourceByType (pMultibuffers->pWindow->drawable.id,
MultibuffersResType, TRUE);
xfree (pMultibuffers);
}
return Success;
}
/* Resource delete func for MultibuffersResType */
/*ARGSUSED*/
static int
MultibuffersDelete (value, id)
void *value;
XID id;
{
MultibuffersPtr pMultibuffers = (MultibuffersPtr)value;
int i;
if (pMultibuffers->refcnt == pMultibuffers->numMultibuffer)
{
for (i = pMultibuffers->numMultibuffer; --i >= 0; )
FreeResource (pMultibuffers->buffers[i].pPixmap->drawable.id, 0);
}
return Success;
}
/* Resource delete func for OtherClientResType */
static int
OtherClientDelete (value, id)
void *value;
XID id;
{
MultibufferPtr pMultibuffer = (MultibufferPtr)value;
register OtherClientsPtr other, prev;
prev = 0;
for (other = pMultibuffer->otherClients; other; other = other->next)
{
if (other->resource == id)
{
if (prev)
prev->next = other->next;
else
pMultibuffer->otherClients = other->next;
xfree (other);
RecalculateMultibufferOtherEvents (pMultibuffer);
break;
}
prev = other;
}
return Success;
}
static int
EventSelectForMultibuffer (pMultibuffer, client, mask)
MultibufferPtr pMultibuffer;
ClientPtr client;
Mask mask;
{
OtherClientsPtr other;
if (mask & ~ValidEventMasks)
{
client->errorValue = mask;
return BadValue;
}
if (bClient (pMultibuffer) == client)
{
pMultibuffer->eventMask = mask;
}
else /* some other client besides the creator wants events */
{
for (other = pMultibuffer->otherClients; other; other = other->next)
{
if (SameClient (other, client))
{
if (mask == 0)
{
FreeResource (other->resource, RT_NONE);
break;
}
other->mask = mask;
break;
}
}
if (!other)
{ /* new client that never selected events on this buffer before */
other = (OtherClients *) xalloc (sizeof (OtherClients));
if (!other)
return BadAlloc;
other->mask = mask;
other->resource = FakeClientID (client->index);
if (!AddResource (other->resource, OtherClientResType, (void *) pMultibuffer))
{
xfree (other);
return BadAlloc;
}
other->next = pMultibuffer->otherClients;
pMultibuffer->otherClients = other;
}
RecalculateMultibufferOtherEvents (pMultibuffer);
}
return (client->noClientException);
}
/* or together all the otherClients event masks */
static void
RecalculateMultibufferOtherEvents (pMultibuffer)
MultibufferPtr pMultibuffer;
{
Mask otherEventMask;
OtherClients *other;
otherEventMask = 0L;
for (other = pMultibuffer->otherClients; other; other = other->next)
otherEventMask |= other->mask;
pMultibuffer->otherEventMask = otherEventMask;
}
/* add milliseconds to a timestamp, handling overflow */
static void
BumpTimeStamp (ts, inc)
TimeStamp *ts;
CARD32 inc;
{
CARD32 newms;
newms = ts->milliseconds + inc;
if (newms < ts->milliseconds)
ts->months++;
ts->milliseconds = newms;
}
/* $XFree86: xc/programs/Xserver/Xext/mbufbf.c,v 3.5tsi Exp $ */
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $Xorg: mbufbf.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "regionstr.h"
#include "gcstruct.h"
#include "inputstr.h"
#include "validate.h"
#include <sys/time.h>
#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
#define _MULTIBUF_BUFFER_
#include <nx-X11/extensions/multibufst.h>
/*
Support for doublebuffer hardare
This code is designed to support doublebuffer hardware where the
displayed buffer is selected on a per-pixel basis by an additional bit
plane, called the select plane. It could probably be easily modified
to work with systems that use window-id planes.
This is done by creating a new drawable type, DRAWABLE_BUFFER. The
type has the same exact layout as a window drawable. Your code should
treat a DRAWABLE_BUFFER the same as it would tread a DRAWABLE_WINDOW
when handling the gc drawing functions. In addition, PaintWindowBackground,
CopyWindow, and all of the gc drawing functions to be able to draw into both
framebuffers. Which framebuffer to draw into is selected by the contents of
pWin->devPrivates[frameWindowPrivateIndex].
The content of the devPrivate is either from frameBuffer[0] or
frameBuffer[1], depending on which buffer is being drawn into. When
pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[0],
the functions should draw into the front framebuffer. When
pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[1],
the functions should draw into the back framebuffer.
In addition, you need to provide a function that allows you to copy
bits between the buffers (optional since CopyArea can be used) and a
function that draws into the select plane. Then, you need to register
your functions and other information, by calling:
void
RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane,
CopyBufferBitsFunc, DrawSelectPlaneFunc)
int nInfo;
xMbufBufferInfo *pInfo;
DevUnion *frameBuffer;
DevUnion selectPlane;
"pInfo" is an array indicating which visuals and depths that double
buffering is supported on. "nInfo" is the length of the array.
"frameBuffer" is array of length 2. The contents of the array element
is ddx-specific. The content of frameBuffer[0] should, when placed in
the window private, indicate that framebuffer 0 should be drawn into.
The contents of frameBuffer[1], when placed into the window private,
should indicate that framebuffer 1 should be drawn into.
"selectPlane" is ddx-specific. It should contain information
neccessary for your displayProc to access the select plane.
It is passed to DrawSelectPlaneFunc.
"CopyBufferBitsFunc" is a ddx-specific function that copies from one
buffer of a multibuffered window to another buffer. If the CopyBufferBitsFunc
is NULL, a default function will be used that calls pScreen->CopyArea.
void CopyBufferBitsFunc(pMBWindow, srcBufferNum, dstBufferNum)
mbufWindowPtr pMBWindow;
int srcBufferNum, dstBufferNum;
"DrawSelectPlaneFunc" is a ddx-specific function that fills the
regions "prgn" of select plane with the value "bufferNum". If
selectPlane is a DrawablePtr (such as a PixmapPtr), you can pass
NULL for DrawSelectPlaneFunc, a default function will be used that
calls FillRectangle on the selectPlane.
void DrawSelectPlaneFunc(pScreen, selectPlane, prgn, bufferNum)
ScreenPtr pScreen;
DevUnion selectPlane;
RegionPtr prgn;
long bufferNum;
...
...
...
*/
#define MAX_BUFFERS 2 /* Only supports 2 buffers */
#define FRONT_BUFFER 0
#define BACK_BUFFER 1
/* Buffer drawables have the same structure as window drawables */
typedef WindowRec BufferRec;
typedef WindowPtr BufferPtr;
/*
* Call RegisterHdwrBuffer for every screen that has doublebuffer hardware.
*/
static int bufNumInfo[MAXSCREENS];
static xMbufBufferInfo *bufInfo[MAXSCREENS];
static DevUnion *bufFrameBuffer[MAXSCREENS];
static DevUnion bufselectPlane[MAXSCREENS];
static void (* bufCopyBufferBitsFunc[MAXSCREENS])();
static void (* bufDrawSelectPlaneFunc[MAXSCREENS])();
static Bool bufMultibufferInit();
void
RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane,
CopyBufferBitsFunc, DrawSelectPlaneFunc)
ScreenPtr pScreen;
int nInfo;
xMbufBufferInfo *pInfo;
DevUnion *frameBuffer;
DevUnion selectPlane;
void (* CopyBufferBitsFunc)();
void (* DrawSelectPlaneFunc)();
{
bufNumInfo[pScreen->myNum] = nInfo;
bufInfo[pScreen->myNum] = pInfo;
bufFrameBuffer[pScreen->myNum] = frameBuffer;
bufselectPlane[pScreen->myNum] = selectPlane;
bufCopyBufferBitsFunc[pScreen->myNum] = CopyBufferBitsFunc;
bufDrawSelectPlaneFunc[pScreen->myNum] = DrawSelectPlaneFunc;
/* Register ourselves with device-independent multibuffers code */
RegisterMultibufferInit(pScreen, bufMultibufferInit);
}
/*
* Called by Multibuffer extension initialization.
* Initializes mbufScreenRec and its devPrivate.
*/
static Bool NoopDDA_True() { return TRUE; }
static Bool bufPositionWindow();
static int bufCreateImageBuffers();
static void bufDestroyImageBuffers();
static void bufDisplayImageBuffers();
static void bufClearImageBufferArea();
static void bufDestroyBuffer();
static void bufCopyBufferBits();
static void bufDrawSelectPlane();
static void bufWrapScreenFuncs();
static void bufResetProc();
static void bufPostValidateTree();
static void bufClipNotify();
static void bufWindowExposures();
static Bool bufChangeWindowAttributes();
static void bufClearToBackground();
static void bufCopyWindow();
extern WindowPtr *WindowTable;
static Bool
bufMultibufferInit(pScreen, pMBScreen)
ScreenPtr pScreen;
mbufScreenPtr pMBScreen;
{
mbufBufferPrivPtr pMBPriv;
BoxRec box;
/* Multibuffer info */
pMBScreen->nInfo = bufNumInfo[pScreen->myNum];
pMBScreen->pInfo = bufInfo[pScreen->myNum];
/* Hooks */
pMBScreen->CreateImageBuffers = bufCreateImageBuffers;
pMBScreen->DestroyImageBuffers = bufDestroyImageBuffers;
pMBScreen->DisplayImageBuffers = bufDisplayImageBuffers;
pMBScreen->ClearImageBufferArea = bufClearImageBufferArea;
pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
pMBScreen->ChangeBufferAttributes = NoopDDA_True;
pMBScreen->DeleteBufferDrawable = bufDestroyBuffer;
pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs;
pMBScreen->ResetProc = bufResetProc;
/* Create devPrivate part */
pMBPriv = (mbufBufferPrivPtr) xalloc(sizeof *pMBPriv);
if (!pMBPriv)
return (FALSE);
pMBScreen->devPrivate.ptr = (void *) pMBPriv;
pMBPriv->frameBuffer = bufFrameBuffer[pScreen->myNum];
pMBPriv->selectPlane = bufselectPlane[pScreen->myNum];
/*
* Initializing the subtractRgn to the screen area will ensure that
* the selectPlane will get cleared on the first PostValidateTree.
*/
box.x1 = 0;
box.y1 = 0;
box.x2 = pScreen->width;
box.y2 = pScreen->height;
pMBPriv->rgnChanged = TRUE;
RegionInit(&pMBPriv->backBuffer, &box, 1);
RegionInit(&pMBPriv->subtractRgn, &box, 1);
RegionNull(&pMBPriv->unionRgn);
/* Misc functions */
pMBPriv->CopyBufferBits = bufCopyBufferBitsFunc[pScreen->myNum];
pMBPriv->DrawSelectPlane = bufDrawSelectPlaneFunc[pScreen->myNum];
if (!pMBPriv->CopyBufferBits)
pMBPriv->CopyBufferBits = bufCopyBufferBits;
if (!pMBPriv->DrawSelectPlane)
pMBPriv->DrawSelectPlane = bufDrawSelectPlane;
/* screen functions */
pMBPriv->funcsWrapped = 0;
pMBPriv->inClearToBackground = FALSE;
pMBPriv->WindowExposures = NULL;
pMBPriv->CopyWindow = NULL;
pMBPriv->ClearToBackground = NULL;
pMBPriv->ClipNotify = NULL;
pMBPriv->ChangeWindowAttributes = NULL;
/* Start out wrapped to clear select plane */
WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree);
return TRUE;
}
static void
UpdateBufferFromWindow(pBuffer, pWin)
BufferPtr pBuffer;
WindowPtr pWin;
{
pBuffer->drawable.x = pWin->drawable.x;
pBuffer->drawable.y = pWin->drawable.y;
pBuffer->drawable.width = pWin->drawable.width;
pBuffer->drawable.height = pWin->drawable.height;
pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER;
/* Update for PaintWindowBackground */
pBuffer->parent = pWin->parent;
/*
* Make the borderClip the same as the clipList so
* NotClippedByChildren comes out with just clipList.
*/
pBuffer->clipList = pWin->clipList;
pBuffer->borderClip = pWin->clipList;
pBuffer->winSize = pWin->winSize;
pBuffer->borderSize = pWin->borderSize;
pBuffer->origin = pWin->origin;
}
static BufferPtr
bufCreateBuffer(pScreen, pWin, bufferNum)
ScreenPtr pScreen;
WindowPtr pWin;
int bufferNum;
{
mbufBufferPrivPtr pMBPriv;
DevUnion *devPrivates;
BufferPtr pBuffer;
int i;
pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
pBuffer = AllocateWindow(pWin->drawable.pScreen);
if (!pBuffer)
return (NULL);
/* XXX- Until we know what is needed, copy everything. */
devPrivates = pBuffer->devPrivates;
*pBuffer = *pWin;
pBuffer->devPrivates = devPrivates;
pBuffer->drawable.type = DRAWABLE_BUFFER;
pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pBuffer->nextSib = NULL;
pBuffer->prevSib = NULL;
pBuffer->firstChild = NULL;
pBuffer->lastChild = NULL;
/* XXX - Worry about backingstore later */
pBuffer->backStorage = NULL;
pBuffer->backingStore = NotUseful;
/* XXX - Need to call pScreen->CreateWindow for tile/stipples
* or should I just copy the devPrivates?
*/
for (i=0; i < pScreen->WindowPrivateLen; i++)
pBuffer->devPrivates[i] = pWin->devPrivates[i];
pBuffer->devPrivates[frameWindowPrivateIndex] =
pMBPriv->frameBuffer[bufferNum];
return pBuffer;
}
static void
bufDestroyBuffer(pDrawable)
DrawablePtr pDrawable;
{
xfree(pDrawable);
}
/*ARGSUSED*/
static int
bufCreateImageBuffers (pWin, nbuf, ids, action, hint)
WindowPtr pWin;
int nbuf;
XID *ids;
int action;
int hint;
{
ScreenPtr pScreen;
mbufScreenPtr pMBScreen;
mbufWindowPtr pMBWindow;
mbufBufferPtr pMBBuffer;
int i;
pScreen = pWin->drawable.pScreen;
pMBScreen = MB_SCREEN_PRIV(pScreen);
pMBWindow = MB_WINDOW_PRIV(pWin);
pMBWindow->devPrivate.ptr = (void *) RegionCreate(0,0);
if (!pMBWindow->devPrivate.ptr)
return(0);
RegionCopy((RegionPtr) pMBWindow->devPrivate.ptr,
&pWin->clipList);
for (i = 0; i < nbuf; i++)
{
pMBBuffer = pMBWindow->buffers + i;
pMBBuffer->pDrawable = (DrawablePtr) bufCreateBuffer(pScreen,pWin,i);
if (!pMBBuffer->pDrawable)
break;
if (!AddResource (ids[i], MultibufferDrawableResType,
(void *) pMBBuffer->pDrawable))
{
bufDestroyBuffer((BufferPtr) pMBBuffer->pDrawable);
break;
}
pMBBuffer->pDrawable->id = ids[i];
/*
* If window is already mapped, generate exposures and
* clear the area of the newly buffers.
*/
if ((pWin->realized) && (i != pMBWindow->displayedMultibuffer))
(* pMBScreen->ClearImageBufferArea)(pMBBuffer, 0,0, 0,0, TRUE);
}
return i;
}
static void
bufDestroyImageBuffers(pWin)
WindowPtr pWin;
{
ScreenPtr pScreen;
mbufWindowPtr pMBWindow;
pScreen = pWin->drawable.pScreen;
if (pMBWindow = MB_WINDOW_PRIV(pWin))
{
mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
/*
* if the backbuffer is currently being displayed, move the bits
* to the frontbuffer and display it instead.
*/
if (pWin->realized && (pMBWindow->displayedMultibuffer == BACK_BUFFER))
{
(* pMBPriv->CopyBufferBits)(pMBWindow, BACK_BUFFER, FRONT_BUFFER);
RegionSubtract(&pMBPriv->backBuffer,
&pMBPriv->backBuffer, &pWin->clipList);
(* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
&pWin->clipList, FRONT_BUFFER);
}
/* Switch window rendering to front buffer */
pWin->devPrivates[frameWindowPrivateIndex] =
pMBPriv->frameBuffer[FRONT_BUFFER];
RegionDestroy((RegionPtr) pMBWindow->devPrivate.ptr);
pMBWindow->devPrivate.ptr = NULL;
}
}
/*
* Can be replaced by pScreen->ClearToBackground if pBuffer->eventMask
* and wOtherEventsMasks(pBuffer) were setup.
*/
static void
bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures)
mbufBufferPtr pMBBuffer;
short x,y;
unsigned short w,h;
Bool generateExposures;
{
BoxRec box;
RegionRec reg;
RegionPtr pBSReg = NullRegion;
ScreenPtr pScreen;
BoxPtr extents;
int x1, y1, x2, y2;
BufferPtr pBuffer;
pBuffer = (BufferPtr) pMBBuffer->pDrawable;
/* compute everything using ints to avoid overflow */
x1 = pBuffer->drawable.x + x;
y1 = pBuffer->drawable.y + y;
if (w)
x2 = x1 + (int) w;
else
x2 = x1 + (int) pBuffer->drawable.width - (int) x;
if (h)
y2 = y1 + h;
else
y2 = y1 + (int) pBuffer->drawable.height - (int) y;
extents = &pBuffer->clipList.extents;
/* clip the resulting rectangle to the window clipList extents. This
* makes sure that the result will fit in a box, given that the
* screen is < 32768 on a side.
*/
if (x1 < extents->x1)
x1 = extents->x1;
if (x2 > extents->x2)
x2 = extents->x2;
if (y1 < extents->y1)
y1 = extents->y1;
if (y2 > extents->y2)
y2 = extents->y2;
if (x2 <= x1 || y2 <= y1)
{
x2 = x1 = 0;
y2 = y1 = 0;
}
box.x1 = x1;
box.x2 = x2;
box.y1 = y1;
box.y2 = y2;
pScreen = pBuffer->drawable.pScreen;
RegionInit(&reg, &box, 1);
if (pBuffer->backStorage)
{
/*
* If the window has backing-store on, call through the
* ClearToBackground vector to handle the special semantics
* (i.e. things backing store is to be cleared out and
* an Expose event is to be generated for those areas in backing
* store if generateExposures is TRUE).
*/
pBSReg = (* pScreen->ClearBackingStore)(pBuffer, x, y, w, h,
generateExposures);
}
RegionIntersect(&reg, &reg, &pBuffer->clipList);
if (pBuffer->backgroundState != None)
(*pScreen->PaintWindowBackground)(pBuffer, &reg, PW_BACKGROUND);
if (generateExposures)
MultibufferExpose(pMBBuffer, &reg);
#ifdef _notdef
/* XXBS - This is the original miClearToBackground code.
* WindowExposures needs to be called (or the functionality emulated)
* in order for backingStore to work, but first, pBuffer->eventMask
* and wOtherEventsMasks(pBuffer) need to be setup correctly.
*/
if (generateExposures)
(*pScreen->WindowExposures)(pBuffer, &reg, pBSReg);
else if (pBuffer->backgroundState != None)
(*pScreen->PaintWindowBackground)(pBuffer, &reg, PW_BACKGROUND);
#endif
RegionUninit(&reg);
if (pBSReg)
RegionDestroy(pBSReg);
}
static void
bufWrapScreenFuncs(pScreen)
ScreenPtr pScreen;
{
mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree);
WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClipNotify, bufClipNotify);
WRAP_SCREEN_FUNC(pScreen,pMBPriv,WindowExposures,bufWindowExposures);
WRAP_SCREEN_FUNC(pScreen,pMBPriv,ChangeWindowAttributes, bufChangeWindowAttributes);
WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClearToBackground,bufClearToBackground);
WRAP_SCREEN_FUNC(pScreen,pMBPriv,CopyWindow,bufCopyWindow);
}
static void
bufResetProc(pScreen)
ScreenPtr pScreen;
{
mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
/*
* frameBuffer, selectPlane, and pInfo should be freed by
* whoever called RegisterDoubleBufferHardware
*/
RegionUninit(&pMBPriv->backBuffer);
RegionUninit(&pMBPriv->subtractRgn);
RegionUninit(&pMBPriv->unionRgn);
xfree(pMBPriv);
}
/*---------------------------------------------------------------------------*/
/*
* Used if CopyBufferBitsFunc is not provided when registering.
* This should work for everybody since CopyArea needs to support
* copying between buffers anyway.
*/
static void
bufCopyBufferBits(pMBWindow, srcBufferNum, dstBufferNum)
mbufWindowPtr pMBWindow;
int srcBufferNum, dstBufferNum;
{
DrawablePtr pSrcBuffer, pDstBuffer;
GCPtr pGC;
pSrcBuffer = pMBWindow->buffers[srcBufferNum].pDrawable;
pDstBuffer = pMBWindow->buffers[dstBufferNum].pDrawable;
pGC = GetScratchGC (pDstBuffer->depth, pDstBuffer->pScreen);
if (!pGC)
return;
ValidateGC (pDstBuffer, pGC);
(* pGC->ops->CopyArea) (pSrcBuffer, pDstBuffer, pGC,
0,0, pDstBuffer->width, pDstBuffer->height, 0,0);
FreeScratchGC (pGC);
}
/*
* Used if DrawSelectPlanFunc is not provided for when registering.
* However, it only works if selectPlane.ptr is a drawable. Also
* assumes that painting with color 0 selects the front buffer,
* while color 1 selects the back buffer.
*/
static void
bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
ScreenPtr pScreen;
DevUnion selectPlane;
RegionPtr prgn;
long bufferNum;
{
DrawablePtr pDrawable;
GCPtr pGC;
register int i;
register BoxPtr pbox;
register xRectangle *prect;
int numRects;
XID value;
if (RegionNumRects(prgn) == 0)
return;
pDrawable = (DrawablePtr) selectPlane.ptr;
pGC = GetScratchGC (pDrawable->depth, pScreen);
if (!pGC)
return;
prect = (xRectangle *)ALLOCATE_LOCAL(RegionNumRects(prgn) *
sizeof(xRectangle));
if (!prect)
{
FreeScratchGC(pGC);
return;
}
value = (XID) bufferNum;
DoChangeGC(pGC, GCForeground, &value, 0);
ValidateGC(pDrawable, pGC);
numRects = RegionNumRects(prgn);
pbox = RegionRects(prgn);
for (i= numRects; --i >= 0; pbox++, prect++)
{
prect->x = pbox->x1;
prect->y = pbox->y1;
prect->width = pbox->x2 - pbox->x1;
prect->height = pbox->y2 - pbox->y1;
}
prect -= numRects;
(* pGC->ops->PolyFillRect)(pDrawable, pGC, numRects, prect);
DEALLOCATE_LOCAL(prect);
FreeScratchGC (pGC);
}
static void
bufDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
ScreenPtr pScreen;
mbufBufferPtr *ppMBBuffer;
mbufWindowPtr *ppMBWindow;
int nbuf;
{
WindowPtr pWin;
BufferPtr pPrevBuffer, pNewBuffer;
int i, number;
mbufBufferPrivPtr pMBPriv;
mbufBufferPtr pPrevMBBuffer;
pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
for (i = 0; i < nbuf; i++)
{
number = ppMBBuffer[i]->number; /* 0=frontbuffer, 1=backbuffer */
pWin = ppMBWindow[i]->pWindow;
pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
pPrevBuffer = (BufferPtr) pPrevMBBuffer->pDrawable;
pNewBuffer = (BufferPtr) ppMBBuffer[i]->pDrawable;
if (pPrevBuffer != pNewBuffer)
{
RegionPtr backBuffer = &pMBPriv->backBuffer;
/*
* Update the select plane and the backBuffer region.
*/
(* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
&pWin->clipList, number);
if (number == BACK_BUFFER)
RegionUnion(backBuffer, backBuffer,
&pWin->clipList);
else
RegionSubtract(backBuffer, backBuffer,
&pWin->clipList);
/* Switch which framebuffer the window draws into */
pWin->devPrivates[frameWindowPrivateIndex] =
pMBPriv->frameBuffer[number];
}
switch (ppMBWindow[i]->updateAction)
{
case MultibufferUpdateActionUndefined:
break;
case MultibufferUpdateActionBackground:
(* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
(pPrevMBBuffer, 0,0, 0,0, FALSE);
break;
case MultibufferUpdateActionUntouched:
break;
case MultibufferUpdateActionCopied:
if (pPrevBuffer != pNewBuffer)
{
(* pMBPriv->CopyBufferBits) (ppMBWindow[i],
ppMBBuffer[i]->number, pPrevMBBuffer->number);
}
break;
}
}
}
/* Updates the backBuffer region and paints the selectPlane. */
static void
bufPostValidateTree(pParent, pChild, kind)
WindowPtr pParent, pChild;
VTKind kind;
{
ScreenPtr pScreen;
mbufBufferPrivPtr pMBPriv;
if (pParent)
pScreen = pParent->drawable.pScreen;
else if (pChild)
pScreen = pChild->drawable.pScreen;
else
return; /* Hopeless */
pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);
if (pScreen->PostValidateTree)
(* pScreen->PostValidateTree)(pParent, pChild, kind);
REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);
/* Does backBuffer need to change? */
if (pMBPriv->rgnChanged)
{
RegionRec exposed;
RegionPtr pSubtractRgn, pUnionRgn;
Bool overlap;
pMBPriv->rgnChanged = FALSE;
pSubtractRgn = &pMBPriv->subtractRgn;
pUnionRgn = &pMBPriv->unionRgn;
RegionValidate(pSubtractRgn, &overlap);
#ifdef DEBUG
if (overlap)
FatalError("bufPostValidateTree: subtractRgn overlaps");
#endif
RegionValidate(pUnionRgn, &overlap);
#ifdef DEBUG
if (overlap)
FatalError("bufPostValidateTree: unionRgn overlaps");
#endif
/* Update backBuffer: subtract must come before union */
RegionSubtract(&pMBPriv->backBuffer, &pMBPriv->backBuffer,
pSubtractRgn);
RegionUnion(&pMBPriv->backBuffer, &pMBPriv->backBuffer,
pUnionRgn);
/* Paint gained and lost backbuffer areas in select plane */
RegionNull(&exposed);
RegionSubtract(&exposed, pSubtractRgn, pUnionRgn);
(* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
&exposed, FRONT_BUFFER);
RegionSubtract(&exposed, pUnionRgn, pSubtractRgn);
(* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
&exposed, BACK_BUFFER);
RegionUninit(&exposed);
RegionEmpty(pSubtractRgn);
RegionEmpty(pUnionRgn);
}
}
/*
* If the window is multibuffered and displaying the backbuffer,
* add the old clipList to the subtractRgn and add the new clipList
* to the unionRgn. PostValidateTree will use subtractRgn and unionRgn
* to update the backBuffer region and the selectPlane.
*
* Copy changes to the window structure into the buffers.
* Send ClobberNotify events.
*/
static void
bufClipNotify(pWin, dx,dy)
WindowPtr pWin;
int dx,dy;
{
ScreenPtr pScreen = pWin->drawable.pScreen;
mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
mbufWindowPtr pMBWindow;
int i;
UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);
if (pScreen->ClipNotify)
(* pScreen->ClipNotify)(pWin, dx,dy);
REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);
if (pMBWindow = MB_WINDOW_PRIV(pWin))
{
RegionPtr pOldClipList = (RegionPtr) pMBWindow->devPrivate.ptr;
if (! RegionEqual(pOldClipList, &pWin->clipList))
{
if (pMBWindow->displayedMultibuffer == BACK_BUFFER)
{
pMBPriv->rgnChanged = TRUE;
RegionAppend(&pMBPriv->subtractRgn, pOldClipList);
RegionAppend(&pMBPriv->unionRgn, &pWin->clipList);
}
RegionCopy(pOldClipList,&pWin->clipList);
}
/* Update buffer x,y,w,h, and clipList */
for (i=0; i<pMBWindow->numMultibuffer; i++)
{
mbufBufferPtr pMBBuffer = pMBWindow->buffers + i;
if (pMBBuffer->clobber != pWin->visibility)
{
pMBBuffer->clobber = pWin->visibility;
MultibufferClobber(pMBBuffer);
}
UpdateBufferFromWindow(pMBBuffer->pDrawable, pWin);
}
}
}
/*
* Updates buffer's background fields when the window's changes.
* This is necessary because pScreen->PaintWindowBackground
* is used to paint the buffer.
*
* XXBS - Backingstore state will have be tracked too if it is supported.
*/
static Bool
bufChangeWindowAttributes(pWin, mask)
WindowPtr pWin;
unsigned long mask;
{
ScreenPtr pScreen = pWin->drawable.pScreen;
mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
mbufWindowPtr pMBWindow;
Bool ret;
UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);
ret = (* pScreen->ChangeWindowAttributes)(pWin, mask);
REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);
if (pMBWindow = MB_WINDOW_PRIV(pWin))
{
if (mask & (CWBackPixmap | CWBackPixel))
{
BufferPtr pBuffer;
int i;
for (i=0; i<pMBWindow->displayedMultibuffer; i++)
{
pBuffer = (BufferPtr) pMBWindow->buffers[i].pDrawable;
pBuffer->backgroundState = pWin->backgroundState;
pBuffer->background = pWin->background;
}
}
}
return ret;
}
/*
* Send exposures and clear the background for a buffer whenever
* its corresponding window is exposed, except when called by
* ClearToBackground.
*/
static void
bufWindowExposures(pWin, prgn, other_exposed)
WindowPtr pWin;
register RegionPtr prgn, other_exposed;
{
ScreenPtr pScreen = pWin->drawable.pScreen;
mbufWindowPtr pMBWindow = MB_WINDOW_PRIV(pWin);
mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
RegionRec tmp_rgn;
int i;
Bool handleBuffers;
handleBuffers = (!pMBPriv->inClearToBackground) &&
(pWin->drawable.type == DRAWABLE_WINDOW) &&
pMBWindow && (prgn && !RegionNil(prgn));
/* miWindowExposures munges prgn and other_exposed. */
if (handleBuffers)
{
RegionNull(&tmp_rgn);
RegionCopy(&tmp_rgn, prgn);
}
UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);
(* pScreen->WindowExposures) (pWin, prgn, other_exposed);
REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);
if (!handleBuffers)
return;
/*
* Send expose events to all clients. Paint the exposed region for all
* buffers except the displayed buffer since it is handled when the
* window is painted.
*
* XXBS - Will have to be re-written to handle BackingStore on buffers.
*/
for (i=0; i<pMBWindow->numMultibuffer; i++)
{
mbufBufferPtr pMBBuffer;
BufferPtr pBuffer;
pMBBuffer = pMBWindow->buffers + i;
pBuffer = (BufferPtr) pMBBuffer->pDrawable;
if (i != pMBWindow->displayedMultibuffer)
(* pScreen->PaintWindowBackground)(pBuffer,&tmp_rgn,PW_BACKGROUND);
if ((pMBBuffer->otherEventMask | pMBBuffer->eventMask) & ExposureMask)
MultibufferExpose(pMBBuffer, &tmp_rgn);
}
RegionUninit(&tmp_rgn);
}
/*
* Set ``inClearToBackground'' so that WindowExposures does not attempt
* to send expose events or clear the background on the buffers.
*/
static void
bufClearToBackground(pWin, x,y,w,h, sendExpose)
WindowPtr pWin;
int x,y, w,h;
Bool sendExpose;
{
ScreenPtr pScreen = pWin->drawable.pScreen;
mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
pMBPriv->inClearToBackground = TRUE;
UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);
(* pScreen->ClearToBackground)(pWin, x,y,w,h, sendExpose);
REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);
pMBPriv->inClearToBackground = FALSE;
}
/*
* Move bits in both buffers. It does this by calling pScreen->CopyWindow
* twice, once with the root window's devPrivate[frameWindowPrivateIndex]
* pointing to the frontbuffer pixmap and once with it pointed to the
* backbuffer pixmap. It does this if there are *any* existing multibuffered
* window... a possible optimization is to copy the backbuffer only if this
* window or its inferiors are multibuffered. May be faster, maybe not.
*
* XXX - Only works if your CopyWindow checks the root window's devPrivate
* to see which buffer to draw into. Works for cfbPaintWindow.
*/
/*ARGSUSED*/
static void
bufCopyWindow(pWin, ptOldOrg, prgnSrc)
WindowPtr pWin;
DDXPointRec ptOldOrg;
RegionPtr prgnSrc;
{
ScreenPtr pScreen = pWin->drawable.pScreen;
mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
WindowPtr pwinroot;
DevUnion save;
UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);
pwinroot = WindowTable[pScreen->myNum];
save = pwinroot->devPrivates[frameWindowPrivateIndex];
/*
* Copy front buffer
*/
pwinroot->devPrivates[frameWindowPrivateIndex] =
pMBPriv->frameBuffer[FRONT_BUFFER];
(* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
/*
* Copy back buffer
*/
/* CopyWindow translates prgnSrc... translate it back for 2nd call. */
RegionTranslate(prgnSrc,
ptOldOrg.x - pWin->drawable.x,
ptOldOrg.y - pWin->drawable.y);
pwinroot->devPrivates[frameWindowPrivateIndex] =
pMBPriv->frameBuffer[BACK_BUFFER];
(* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
pwinroot->devPrivates[frameWindowPrivateIndex] = save;
REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);
}
/* $XFree86: xc/programs/Xserver/Xext/mbufpx.c,v 3.3 2001/07/23 13:15:44 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* $Xorg: mbufpx.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "regionstr.h"
#include "gcstruct.h"
#include "inputstr.h"
#include <sys/time.h>
#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
#define _MULTIBUF_PIXMAP_
#include <nx-X11/extensions/multibufst.h>
static Bool NoopDDA_True() { return TRUE; }
static Bool pixPositionWindow();
static int pixCreateImageBuffers();
static void pixDisplayImageBuffers();
static void pixClearImageBufferArea();
static void pixDeleteBufferDrawable();
static void pixWrapScreenFuncs();
static void pixResetProc();
Bool
pixMultibufferInit(pScreen, pMBScreen)
ScreenPtr pScreen;
mbufScreenPtr pMBScreen;
{
int i, j, k;
xMbufBufferInfo *pInfo;
int nInfo;
DepthPtr pDepth;
mbufPixmapPrivPtr pMBPriv;
pMBScreen->CreateImageBuffers = pixCreateImageBuffers;
pMBScreen->DestroyImageBuffers = (void (*)())NoopDDA;
pMBScreen->DisplayImageBuffers = pixDisplayImageBuffers;
pMBScreen->ClearImageBufferArea = pixClearImageBufferArea;
pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
pMBScreen->ChangeBufferAttributes = NoopDDA_True;
pMBScreen->DeleteBufferDrawable = pixDeleteBufferDrawable;
pMBScreen->WrapScreenFuncs = pixWrapScreenFuncs;
pMBScreen->ResetProc = pixResetProc;
/* Support every depth and visual combination that the screen does */
nInfo = 0;
for (i = 0; i < pScreen->numDepths; i++)
{
pDepth = &pScreen->allowedDepths[i];
nInfo += pDepth->numVids;
}
pInfo = (xMbufBufferInfo *) xalloc (nInfo * sizeof (xMbufBufferInfo));
if (!pInfo)
return FALSE;
k = 0;
for (i = 0; i < pScreen->numDepths; i++)
{
pDepth = &pScreen->allowedDepths[i];
for (j = 0; j < pDepth->numVids; j++)
{
pInfo[k].visualID = pDepth->vids[j];
pInfo[k].maxBuffers = 0;
pInfo[k].depth = pDepth->depth;
k++;
}
}
pMBScreen->nInfo = nInfo;
pMBScreen->pInfo = pInfo;
/*
* Setup the devPrivate to mbufScreenRec
*/
pMBPriv = (mbufPixmapPrivPtr) xalloc(sizeof(* pMBPriv));
if (!pMBPriv)
{
xfree(pInfo);
return (FALSE);
}
pMBScreen->devPrivate.ptr = (void *) pMBPriv;
pMBPriv->PositionWindow = NULL;
pMBPriv->funcsWrapped = 0;
return TRUE;
}
/*ARGSUSED*/
static int
pixCreateImageBuffers (pWin, nbuf, ids, action, hint)
WindowPtr pWin;
int nbuf;
XID *ids;
int action;
int hint;
{
mbufWindowPtr pMBWindow;
mbufBufferPtr pMBBuffer;
ScreenPtr pScreen;
int width, height, depth;
int i;
pMBWindow = MB_WINDOW_PRIV(pWin);
width = pWin->drawable.width;
height = pWin->drawable.height;
depth = pWin->drawable.depth;
pScreen = pWin->drawable.pScreen;
for (i = 0; i < nbuf; i++)
{
pMBBuffer = &pMBWindow->buffers[i];
pMBBuffer->pDrawable = (DrawablePtr)
(*pScreen->CreatePixmap) (pScreen, width, height, depth);
if (!pMBBuffer->pDrawable)
break;
if (!AddResource (ids[i], MultibufferDrawableResType,
(void *) pMBBuffer->pDrawable))
{
(*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
break;
}
pMBBuffer->pDrawable->id = ids[i];
/*
* In the description of the CreateImageBuffers request:
* "If the window is mapped, or if these image buffers have
* backing store, their contents will be tiled with the window
* background, and zero or more expose events will be generated
* for each of these buffers."
*/
(* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
(pMBBuffer, 0,0, 0,0, TRUE);
}
return i;
}
/*
* set up the gc to clear the pixmaps;
*/
static Bool
SetupBackgroundPainter (pWin, pGC)
WindowPtr pWin;
GCPtr pGC;
{
XID gcvalues[4];
int ts_x_origin, ts_y_origin;
PixUnion background;
int backgroundState;
Mask gcmask;
/*
* First take care of any ParentRelative stuff by altering the
* tile/stipple origin to match the coordinates of the upper-left
* corner of the first ancestor without a ParentRelative background.
* This coordinate is, of course, negative.
*/
ts_x_origin = ts_y_origin = 0;
while (pWin->backgroundState == ParentRelative) {
ts_x_origin -= pWin->origin.x;
ts_y_origin -= pWin->origin.y;
pWin = pWin->parent;
}
backgroundState = pWin->backgroundState;
background = pWin->background;
switch (backgroundState)
{
case BackgroundPixel:
gcvalues[0] = (XID) background.pixel;
gcvalues[1] = FillSolid;
gcmask = GCForeground|GCFillStyle;
break;
case BackgroundPixmap:
gcvalues[0] = FillTiled;
gcvalues[1] = (XID) background.pixmap;
gcvalues[2] = ts_x_origin;
gcvalues[3] = ts_y_origin;
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
break;
default:
return FALSE;
}
DoChangeGC(pGC, gcmask, gcvalues, TRUE);
return TRUE;
}
static void
MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects)
WindowPtr pWin;
DrawablePtr pDrawable;
int nrects;
xRectangle *pRects;
{
GCPtr pGC;
pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
if (SetupBackgroundPainter(pWin, pGC))
{
ValidateGC(pDrawable, pGC);
(*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, pRects);
}
FreeScratchGC(pGC);
}
static void
MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
WindowPtr pWin;
DrawablePtr pDrawable;
RegionPtr pRegion;
{
xRectangle *pRects;
int nrects = RegionNumRects(pRegion);
BoxPtr pbox = RegionRects(pRegion);
pRects = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
if (pRects)
{
int i;
for (i = 0; i < nrects; i++)
{
pRects[i].x = pbox->x1;
pRects[i].y = pbox->y1;
pRects[i].width = pbox->x2 - pbox->x1;
pRects[i].height = pbox->y2 - pbox->y1;
}
MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects);
DEALLOCATE_LOCAL(pRects);
}
}
static void
pixDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
mbufBufferPtr *ppMBBuffer;
mbufWindowPtr *ppMBWindow;
int nbuf;
{
GCPtr pGC = NULL;
PixmapPtr pPrevPixmap, pNewPixmap;
WindowPtr pWin;
RegionPtr pExposed;
int i;
mbufBufferPtr pPrevMBBuffer;
XID bool;
xRectangle r;
UpdateCurrentTime ();
for (i = 0; i < nbuf; i++)
{
pWin = ppMBWindow[i]->pWindow;
/* Time to get a different scratch GC? */
if (!pGC
|| pGC->depth != pWin->drawable.depth
|| pGC->pScreen != pWin->drawable.pScreen)
{
if (pGC) FreeScratchGC(pGC);
pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
}
pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
pPrevPixmap = (PixmapPtr) pPrevMBBuffer->pDrawable;
pNewPixmap = (PixmapPtr) ppMBBuffer[i]->pDrawable;
if (pPrevPixmap == pNewPixmap)
{
/* "If a specified buffer is already displayed, any delays and
* update action will still be performed for that buffer."
*
* We special-case this because applications do occasionally
* request a redundant DisplayImageBuffers, and we can save
* strokes by recognizing that the only update action that will
* change the buffer contents in this case is Background.
*/
if (ppMBWindow[i]->updateAction == MultibufferUpdateActionBackground)
{
r.x = r.y = 0;
r.width = pWin->drawable.width;
r.height = pWin->drawable.height;
MultibufferPaintBackgroundRectangles(pWin, (DrawablePtr)pWin,
1, &r);
}
}
else /* different buffer is being displayed */
{
/* perform update action */
switch (ppMBWindow[i]->updateAction)
{
case MultibufferUpdateActionUndefined:
break;
case MultibufferUpdateActionBackground:
r.x = r.y = 0;
r.width = pPrevPixmap->drawable.width;
r.height = pPrevPixmap->drawable.height;
MultibufferPaintBackgroundRectangles(pWin,
(DrawablePtr)pPrevPixmap,
1, &r);
break;
case MultibufferUpdateActionUntouched:
/* copy the window to the pixmap that represents the
* currently displayed buffer
*/
if (pPrevMBBuffer->eventMask & ExposureMask)
{
bool = TRUE;
DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
}
ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
pExposed = (*pGC->ops->CopyArea)((DrawablePtr) pWin,
(DrawablePtr) pPrevPixmap,
pGC,
0, 0,
pWin->drawable.width,
pWin->drawable.height,
0, 0);
/* if we couldn't copy the whole window to the buffer,
* send expose events (if any client wants them)
*/
if (pPrevMBBuffer->eventMask & ExposureMask)
{ /* some client wants expose events */
if (pExposed)
{
RegionPtr pWinSize;
extern RegionPtr CreateUnclippedWinSize();
ScreenPtr pScreen = pWin->drawable.pScreen;
pWinSize = CreateUnclippedWinSize (pWin);
/*
* pExposed is window-relative, but at this point
* pWinSize is screen-relative. Make pWinSize be
* window-relative so that region ops involving
* pExposed and pWinSize behave sensibly.
*/
RegionTranslate(pWinSize,
-pWin->drawable.x,
-pWin->drawable.y);
RegionIntersect(pExposed, pExposed, pWinSize);
RegionDestroy(pWinSize);
MultibufferExpose (pPrevMBBuffer, pExposed);
RegionDestroy(pExposed);
}
bool = FALSE;
DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
} /* end some client wants expose events */
break; /* end case MultibufferUpdateActionUntouched */
case MultibufferUpdateActionCopied:
ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
(DrawablePtr)pPrevPixmap, pGC,
0, 0, pWin->drawable.width,
pWin->drawable.height, 0, 0);
break;
} /* end switch on update action */
/* display the new buffer */
ValidateGC ((DrawablePtr)pWin, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin,
pGC, 0, 0,
pWin->drawable.width, pWin->drawable.height,
0, 0);
}
ppMBWindow[i]->lastUpdate = currentTime;
}
if (pGC) FreeScratchGC (pGC);
return;
}
/*
* resize the buffers when the window is resized
*/
static Bool
pixPositionWindow (pWin, x, y)
WindowPtr pWin;
int x, y;
{
ScreenPtr pScreen;
mbufPixmapPrivPtr pMBPriv;
mbufWindowPtr pMBWindow;
mbufBufferPtr pMBBuffer;
int width, height;
int i;
int dx, dy, dw, dh;
int sourcex, sourcey;
int destx, desty;
PixmapPtr pPixmap;
GCPtr pGC;
int savewidth, saveheight;
Bool clear;
RegionRec exposedRegion;
Bool ret;
pScreen = pWin->drawable.pScreen;
pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
ret = (* pScreen->PositionWindow) (pWin, x, y);
REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
if (!(pMBWindow = MB_WINDOW_PRIV(pWin)))
return ret;
/* if new size is same as old, we're done */
if (pMBWindow->width == pWin->drawable.width &&
pMBWindow->height == pWin->drawable.height)
return ret;
width = pWin->drawable.width;
height = pWin->drawable.height;
dx = pWin->drawable.x - pMBWindow->x;
dy = pWin->drawable.x - pMBWindow->y;
dw = width - pMBWindow->width;
dh = height - pMBWindow->height;
GravityTranslate (0, 0, -dx, -dy, dw, dh,
pWin->bitGravity, &destx, &desty);
/* if the window grew, remember to paint the window background,
* and maybe send expose events, for the new areas of the buffers
*/
clear = pMBWindow->width < width || pMBWindow->height < height ||
pWin->bitGravity == ForgetGravity;
sourcex = 0;
sourcey = 0;
savewidth = pMBWindow->width;
saveheight = pMBWindow->height;
/* clip rectangle to source and destination */
if (destx < 0)
{
savewidth += destx;
sourcex -= destx;
destx = 0;
}
if (destx + savewidth > width)
savewidth = width - destx;
if (desty < 0)
{
saveheight += desty;
sourcey -= desty;
desty = 0;
}
if (desty + saveheight > height)
saveheight = height - desty;
pMBWindow->width = width;
pMBWindow->height = height;
pMBWindow->x = pWin->drawable.x;
pMBWindow->y = pWin->drawable.y;
if (clear)
{
BoxRec box;
box.x1 = box.y1 = 0;
box.x2 = width;
box.y2 = height;
RegionInit(&exposedRegion, &box, 1);
if (pWin->bitGravity != ForgetGravity)
{
RegionRec preservedRegion;
box.x1 = destx;
box.y1 = desty;
box.x2 = destx + savewidth;
box.y2 = desty + saveheight;
RegionInit(&preservedRegion, &box, 1);
RegionSubtract(&exposedRegion, &exposedRegion, &preservedRegion);
RegionUninit(&preservedRegion);
}
} /* end if (clear) */
pGC = GetScratchGC (pWin->drawable.depth, pScreen);
/* create buffers with new window size */
for (i = 0; i < pMBWindow->numMultibuffer; i++)
{
pMBBuffer = &pMBWindow->buffers[i];
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth);
if (!pPixmap)
{
(* MB_SCREEN_PRIV(pScreen)->DestroyImageBuffers)(pWin);
break;
}
if (clear)
{
MultibufferPaintBackgroundRegion(pWin, (DrawablePtr)pPixmap, &exposedRegion);
MultibufferExpose(pMBBuffer, &exposedRegion);
}
if (pWin->bitGravity != ForgetGravity)
{
ValidateGC ((DrawablePtr)pPixmap, pGC);
(*pGC->ops->CopyArea) (pMBBuffer->pDrawable, (DrawablePtr)pPixmap,
pGC,
sourcex, sourcey, savewidth, saveheight,
destx, desty);
}
pPixmap->drawable.id = pMBBuffer->pDrawable->id;
(*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
pMBBuffer->pDrawable = (DrawablePtr) pPixmap;
if (i != pMBWindow->displayedMultibuffer)
{
ChangeResourceValue (pPixmap->drawable.id,
MultibufferDrawableResType,
(void *) pPixmap);
}
}
FreeScratchGC (pGC);
if (clear)
RegionUninit(&exposedRegion);
return TRUE;
}
static void
pixWrapScreenFuncs(pScreen)
ScreenPtr pScreen;
{
mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
WRAP_SCREEN_FUNC(pScreen, pMBPriv, PositionWindow, pixPositionWindow);
}
static void
pixResetProc(pScreen)
ScreenPtr pScreen;
{
mbufScreenPtr pMBScreen = MB_SCREEN_PRIV(pScreen);
mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
xfree(pMBScreen->pInfo);
xfree(pMBPriv);
}
static void
pixClearImageBufferArea(pMBBuffer, x,y, width,height, exposures)
mbufBufferPtr pMBBuffer;
short x, y;
unsigned short width, height;
Bool exposures;
{
WindowPtr pWin;
ScreenPtr pScreen;
BoxRec box;
RegionRec region;
int w_width, w_height;
DrawablePtr pDrawable;
pWin = pMBBuffer->pMBWindow->pWindow;
pScreen = pWin->drawable.pScreen;
w_width = pWin->drawable.width;
w_height = pWin->drawable.height;
box.x1 = x;
box.y1 = y;
box.x2 = width ? (box.x1 + width) : w_width;
box.y2 = height ? (box.y1 + height) : w_height;
if (box.x1 < 0) box.x1 = 0;
if (box.y1 < 0) box.y1 = 0;
if (box.x2 > w_width) box.x2 = w_width;
if (box.y2 > w_height) box.y2 = w_height;
RegionInit(&region, &box, 1);
if (pMBBuffer->number == pMBBuffer->pMBWindow->displayedMultibuffer)
pDrawable = (DrawablePtr) pWin;
else
pDrawable = pMBBuffer->pDrawable;
MultibufferPaintBackgroundRegion(pWin, pDrawable, &region);
if (exposures)
MultibufferExpose(pMBBuffer, &region);
RegionUninit(&region);
}
static void
pixDeleteBufferDrawable(pDrawable)
DrawablePtr pDrawable;
{
(* pDrawable->pScreen->DestroyPixmap)((PixmapPtr) pDrawable);
}
/* $XFree86: xc/programs/Xserver/Xext/mitmisc.c,v 3.6 2003/10/28 23:08:43 tsi Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
********************************************************/
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
/* $Xorg: mitmisc.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#define _MITMISC_SERVER_
#include <nx-X11/extensions/mitmiscstr.h>
#include "modinit.h"
extern Bool permitOldBugs;
#if 0
static unsigned char MITReqCode;
#endif
static void MITResetProc(
ExtensionEntry * /* extEntry */
);
static DISPATCH_PROC(ProcMITDispatch);
static DISPATCH_PROC(ProcMITGetBugMode);
static DISPATCH_PROC(ProcMITSetBugMode);
static DISPATCH_PROC(SProcMITDispatch);
static DISPATCH_PROC(SProcMITGetBugMode);
static DISPATCH_PROC(SProcMITSetBugMode);
void
MITMiscExtensionInit(INITARGS)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
MITResetProc, StandardMinorOpcode)) != 0)
MITReqCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
MITResetProc, StandardMinorOpcode);
#endif
}
/*ARGSUSED*/
static void
MITResetProc (extEntry)
ExtensionEntry *extEntry;
{
}
static int
ProcMITSetBugMode(client)
register ClientPtr client;
{
REQUEST(xMITSetBugModeReq);
REQUEST_SIZE_MATCH(xMITSetBugModeReq);
if ((stuff->onOff != xTrue) && (stuff->onOff != xFalse))
{
client->errorValue = stuff->onOff;
return BadValue;
}
permitOldBugs = stuff->onOff;
return(client->noClientException);
}
static int
ProcMITGetBugMode(client)
register ClientPtr client;
{
xMITGetBugModeReply rep;
register int n;
REQUEST_SIZE_MATCH(xMITGetBugModeReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.onOff = permitOldBugs;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
}
WriteToClient(client, sizeof(xMITGetBugModeReply), (char *)&rep);
return(client->noClientException);
}
static int
ProcMITDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_MITSetBugMode:
return ProcMITSetBugMode(client);
case X_MITGetBugMode:
return ProcMITGetBugMode(client);
default:
return BadRequest;
}
}
static int
SProcMITSetBugMode(client)
register ClientPtr client;
{
register int n;
REQUEST(xMITSetBugModeReq);
swaps(&stuff->length, n);
return ProcMITSetBugMode(client);
}
static int
SProcMITGetBugMode(client)
register ClientPtr client;
{
register int n;
REQUEST(xMITGetBugModeReq);
swaps(&stuff->length, n);
return ProcMITGetBugMode(client);
}
static int
SProcMITDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_MITSetBugMode:
return SProcMITSetBugMode(client);
case X_MITGetBugMode:
return SProcMITGetBugMode(client);
default:
return BadRequest;
}
}
......@@ -30,8 +30,8 @@ Equipment Corporation.
#endif
#include <stdio.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
......
......@@ -33,10 +33,10 @@ Equipment Corporation.
#endif
#include <stdio.h>
#include <nx-X11/X.h>
#include <X11/X.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/Xproto.h>
#include <X11/Xproto.h>
#include "windowstr.h"
#include "dixfontstr.h"
#include "gcstruct.h"
......@@ -1113,7 +1113,7 @@ int PanoramiXCopyArea(ClientPtr client)
FOR_NSCREENS_BACKWARD(j) {
if(pRgn[j]) {
if(srcIsRoot) {
RegionTranslate(pRgn[j],
RegionTranslate(pRgn[j],
panoramiXdataPtr[j].x, panoramiXdataPtr[j].y);
}
RegionAppend(&totalReg, pRgn[j]);
......
/* $Xorg: sampleEVI.c,v 1.3 2000/08/17 19:47:58 cpqbld Exp $ */
/************************************************************
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/* $XFree86$ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "dixstruct.h"
#include "extnsionst.h"
#include "dix.h"
#define _XEVI_SERVER_
#include <nx-X11/extensions/XEVIstr.h>
#include "EVIstruct.h"
#include "scrnintstr.h"
#include <stdint.h>
static int sampleGetVisualInfo(
VisualID32 *visual,
int n_visual,
xExtendedVisualInfo **evi_rn,
int *n_info_rn,
VisualID32 **conflict_rn,
int *n_conflict_rn)
{
unsigned int max_sz_evi;
VisualID32 *temp_conflict;
xExtendedVisualInfo *evi;
unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens))
return BadAlloc;
max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
if (screenInfo.screens[scrI]->numVisuals > max_visuals)
max_visuals = screenInfo.screens[scrI]->numVisuals;
}
if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens
* max_visuals))
return BadAlloc;
max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
*evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
if (!*evi_rn)
return BadAlloc;
temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
if (!temp_conflict) {
xfree(*evi_rn);
return BadAlloc;
}
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
for (visualI = 0; visualI < n_visual; visualI++) {
evi[sz_evi].core_visual_id = visual[visualI];
evi[sz_evi].screen = scrI;
evi[sz_evi].level = 0;
evi[sz_evi].transparency_type = XEVI_TRANSPARENCY_NONE;
evi[sz_evi].transparency_value = 0;
evi[sz_evi].min_hw_colormaps = 1;
evi[sz_evi].max_hw_colormaps = 1;
evi[sz_evi].num_colormap_conflicts = n_conflict = 0;
for (conflictI = 0; conflictI < n_conflict; conflictI++)
temp_conflict[sz_conflict++] = visual[visualI];
sz_evi++;
}
}
*conflict_rn = temp_conflict;
*n_conflict_rn = sz_conflict;
*n_info_rn = sz_evi;
return Success;
}
static void sampleFreeVisualInfo(
xExtendedVisualInfo *evi,
VisualID32 *conflict)
{
if (evi)
xfree(evi);
if (conflict)
xfree(conflict);
}
EviPrivPtr eviDDXInit(void)
{
static EviPrivRec eviPriv;
eviPriv.getVisualInfo = sampleGetVisualInfo;
eviPriv.freeVisualInfo = sampleFreeVisualInfo;
return &eviPriv;
}
void eviDDXReset(void)
{
}
/* $XFree86: xc/programs/Xserver/Xext/vidmodeproc.h,v 1.4 1999/12/13 01:39:40 robin Exp $ */
/* Prototypes for DGA functions that the DDX must provide */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _VIDMODEPROC_H_
#define _VIDMODEPROC_H_
typedef enum {
VIDMODE_H_DISPLAY,
VIDMODE_H_SYNCSTART,
VIDMODE_H_SYNCEND,
VIDMODE_H_TOTAL,
VIDMODE_H_SKEW,
VIDMODE_V_DISPLAY,
VIDMODE_V_SYNCSTART,
VIDMODE_V_SYNCEND,
VIDMODE_V_TOTAL,
VIDMODE_FLAGS,
VIDMODE_CLOCK
} VidModeSelectMode;
typedef enum {
VIDMODE_MON_VENDOR,
VIDMODE_MON_MODEL,
VIDMODE_MON_NHSYNC,
VIDMODE_MON_NVREFRESH,
VIDMODE_MON_HSYNC_LO,
VIDMODE_MON_HSYNC_HI,
VIDMODE_MON_VREFRESH_LO,
VIDMODE_MON_VREFRESH_HI
} VidModeSelectMonitor;
typedef union {
void * ptr;
int i;
float f;
} vidMonitorValue;
void XFree86VidModeExtensionInit(void);
Bool VidModeAvailable(int scrnIndex);
Bool VidModeGetCurrentModeline(int scrnIndex, void **mode, int *dotClock);
Bool VidModeGetFirstModeline(int scrnIndex, void **mode, int *dotClock);
Bool VidModeGetNextModeline(int scrnIndex, void **mode, int *dotClock);
Bool VidModeDeleteModeline(int scrnIndex, void * mode);
Bool VidModeZoomViewport(int scrnIndex, int zoom);
Bool VidModeGetViewPort(int scrnIndex, int *x, int *y);
Bool VidModeSetViewPort(int scrnIndex, int x, int y);
Bool VidModeSwitchMode(int scrnIndex, void * mode);
Bool VidModeLockZoom(int scrnIndex, Bool lock);
Bool VidModeGetMonitor(int scrnIndex, void **monitor);
int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
Bool VidModeGetClocks(int scrnIndex, int *Clocks);
ModeStatus VidModeCheckModeForMonitor(int scrnIndex, void * mode);
ModeStatus VidModeCheckModeForDriver(int scrnIndex, void * mode);
void VidModeSetCrtcForMode(int scrnIndex, void * mode);
Bool VidModeAddModeline(int scrnIndex, void * mode);
int VidModeGetDotClock(int scrnIndex, int Clock);
int VidModeGetNumOfModes(int scrnIndex);
Bool VidModeSetGamma(int scrnIndex, float red, float green, float blue);
Bool VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue);
void * VidModeCreateMode(void);
void VidModeCopyMode(void * modefrom, void * modeto);
int VidModeGetModeValue(void * mode, int valtyp);
void VidModeSetModeValue(void * mode, int valtyp, int val);
vidMonitorValue VidModeGetMonitorValue(void * monitor, int valtyp, int indx);
Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
Bool VidModeGetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
int VidModeGetGammaRampSize(int scrnIndex);
#endif
......@@ -34,8 +34,8 @@ from The Open Group.
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
......@@ -44,7 +44,11 @@ from The Open Group.
#include <nx-X11/extensions/xcmiscstr.h>
#include "modinit.h"
#if HAVE_STDINT_H
#include <stdint.h>
#elif !defined(UINT32_MAX)
#define UINT32_MAX 0xffffffffU
#endif
#if 0
static unsigned char XCMiscCode;
......
/************************************************************
Copyright 2003-2005 Sun Microsystems, Inc.
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of
the Software and that both the above copyright notice(s) and this
permission notice appear in supporting documentation.
THE SOFTWARE IS PROVIDED "AS 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
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of the copyright holder.
************************************************************/
/* $XdotOrg: xc/programs/Xserver/Xext/xevie.c,v 1.11 2005/10/06 17:55:54 alanc Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "colormapst.h"
#include "scrnintstr.h"
#include "servermd.h"
#define _XEVIE_SERVER_
#include <nx-X11/extensions/Xeviestr.h>
#include <nx-X11/Xfuncproto.h>
#include "input.h"
#include "inputstr.h"
#include "windowstr.h"
#include "cursorstr.h"
#include <nx-X11/extensions/XKBsrv.h>
#include "../os/osdep.h"
#define NoSuchEvent 0x80000000
extern Bool noXkbExtension;
extern int xeviegrabState;
static int ProcDispatch (), SProcDispatch ();
static void ResetProc ();
static unsigned char ReqCode = 0;
static int ErrorBase;
int xevieFlag = 0;
int xevieClientIndex = 0;
DeviceIntPtr xeviekb = NULL;
DeviceIntPtr xeviemouse = NULL;
Mask xevieMask = 0;
int xevieEventSent = 0;
int xevieKBEventSent = 0;
static unsigned int xevieServerGeneration;
static int xevieDevicePrivateIndex;
static Bool xevieModifiersOn = FALSE;
#define XEVIEINFO(dev) ((xevieDeviceInfoPtr)dev->devPrivates[xevieDevicePrivateIndex].ptr)
Mask xevieFilters[128] =
{
NoSuchEvent, /* 0 */
NoSuchEvent, /* 1 */
KeyPressMask, /* KeyPress */
KeyReleaseMask, /* KeyRelease */
ButtonPressMask, /* ButtonPress */
ButtonReleaseMask, /* ButtonRelease */
PointerMotionMask /* MotionNotify (initial state) */
};
typedef struct {
ProcessInputProc processInputProc;
ProcessInputProc realInputProc;
DeviceUnwrapProc unwrapProc;
} xevieDeviceInfoRec, *xevieDeviceInfoPtr;
typedef struct {
CARD32 time;
KeyClassPtr keyc;
} xevieKeycQueueRec, *xevieKeycQueuePtr;
#define KEYC_QUEUE_SIZE 100
xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {0, NULL};
static int keycqHead = 0, keycqTail = 0;
static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr);
static void ResetProc (ExtensionEntry*);
static int ErrorBase;
static Bool XevieStart(void);
static void XevieEnd(int clientIndex);
static void XevieClientStateCallback(CallbackListPtr *pcbl, void * nulldata,
void * calldata);
static void XevieServerGrabStateCallback(CallbackListPtr *pcbl,
void * nulldata,
void * calldata);
static Bool XevieAdd(DeviceIntPtr device, void * data);
static void XevieWrap(DeviceIntPtr device, ProcessInputProc proc);
static Bool XevieRemove(DeviceIntPtr device, void * data);
static void doSendEvent(xEvent *xE, DeviceIntPtr device);
static void XeviePointerProcessInputProc(xEvent *xE, DeviceIntPtr dev,
int count);
static void XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count);
void
XevieExtensionInit ()
{
ExtensionEntry* extEntry;
if (serverGeneration != xevieServerGeneration) {
if ((xevieDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1)
return;
xevieServerGeneration = serverGeneration;
}
if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL))
return;
if ((extEntry = AddExtension (XEVIENAME,
0,
XevieNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
StandardMinorOpcode))) {
ReqCode = (unsigned char)extEntry->base;
ErrorBase = extEntry->errorBase;
}
/* PC servers initialize the desktop colors (citems) here! */
}
/*ARGSUSED*/
static
void ResetProc (extEntry)
ExtensionEntry* extEntry;
{
}
static
int ProcQueryVersion (client)
register ClientPtr client;
{
REQUEST (xXevieQueryVersionReq);
xXevieQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xXevieQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequence_number = client->sequence;
rep.server_major_version = XEVIE_MAJOR_VERSION;
rep.server_minor_version = XEVIE_MINOR_VERSION;
WriteToClient (client, sizeof (xXevieQueryVersionReply), (char *)&rep);
return client->noClientException;
}
static
int ProcStart (client)
register ClientPtr client;
{
REQUEST (xXevieStartReq);
xXevieStartReply rep;
register int n;
REQUEST_SIZE_MATCH (xXevieStartReq);
rep.pad1 = 0;
if(!xevieFlag){
if (AddCallback(&ClientStateCallback,XevieClientStateCallback,NULL)) {
xevieFlag = 1;
rep.pad1 = 1;
xevieClientIndex = client->index;
if(!keycq[0].time ) {
int i;
for(i=0; i<KEYC_QUEUE_SIZE; i++) {
keycq[i].keyc = xalloc(sizeof(KeyClassRec));
keycq[i].keyc->xkbInfo = xalloc(sizeof(XkbSrvInfoRec));
}
}
} else
return BadAlloc;
} else
return BadAccess;
if (!noXkbExtension) {
if (!XevieStart()) {
DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
return BadAlloc;
}
}
xevieModifiersOn = FALSE;
rep.type = X_Reply;
rep.sequence_number = client->sequence;
WriteToClient (client, sizeof (xXevieStartReply), (char *)&rep);
return client->noClientException;
}
static
int ProcEnd (client)
register ClientPtr client;
{
xXevieEndReply rep;
if (xevieFlag) {
if (client->index != xevieClientIndex)
return BadAccess;
DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
XevieEnd(xevieClientIndex);
}
rep.type = X_Reply;
rep.sequence_number = client->sequence;
WriteToClient (client, sizeof (xXevieEndReply), (char *)&rep);
return client->noClientException;
}
static
int ProcSend (client)
register ClientPtr client;
{
REQUEST (xXevieSendReq);
xXevieSendReply rep;
xEvent *xE;
OsCommPtr oc;
static unsigned char lastDetail = 0, lastType = 0;
if (client->index != xevieClientIndex)
return BadAccess;
xE = (xEvent *)&stuff->event;
rep.type = X_Reply;
rep.sequence_number = client->sequence;
WriteToClient (client, sizeof (xXevieSendReply), (char *)&rep);
switch(xE->u.u.type) {
case KeyPress:
case KeyRelease:
xevieKBEventSent = 1;
if(noXkbExtension)
CoreProcessKeyboardEvent (xE, xeviekb, 1);
else
doSendEvent(xE, inputInfo.keyboard);
break;
case ButtonPress:
case ButtonRelease:
case MotionNotify:
xevieEventSent = 1;
if(noXkbExtension)
CoreProcessPointerEvent(xE, xeviemouse, 1);
else
doSendEvent(xE, inputInfo.pointer);
break;
default:
break;
}
lastType = xE->u.u.type;
lastDetail = xE->u.u.detail;
return client->noClientException;
}
static
int ProcSelectInput (client)
register ClientPtr client;
{
REQUEST (xXevieSelectInputReq);
xXevieSelectInputReply rep;
if (client->index != xevieClientIndex)
return BadAccess;
xevieMask = (long)stuff->event_mask;
rep.type = X_Reply;
rep.sequence_number = client->sequence;
WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep);
return client->noClientException;
}
static
int ProcDispatch (client)
register ClientPtr client;
{
REQUEST (xReq);
switch (stuff->data)
{
case X_XevieQueryVersion:
return ProcQueryVersion (client);
case X_XevieStart:
return ProcStart (client);
case X_XevieEnd:
return ProcEnd (client);
case X_XevieSend:
return ProcSend (client);
case X_XevieSelectInput:
return ProcSelectInput(client);
default:
return BadRequest;
}
}
static
int SProcQueryVersion (client)
register ClientPtr client;
{
register int n;
REQUEST(xXevieQueryVersionReq);
swaps(&stuff->length, n);
return ProcQueryVersion(client);
}
static
int SProcStart (client)
ClientPtr client;
{
register int n;
REQUEST (xXevieStartReq);
swaps (&stuff->length, n);
swapl (&stuff->screen, n);
REQUEST_AT_LEAST_SIZE (xXevieStartReq);
return ProcStart (client);
}
static
int SProcEnd (client)
ClientPtr client;
{
register int n;
int count;
xColorItem* pItem;
REQUEST (xXevieEndReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXevieEndReq);
swapl(&stuff->cmap, n);
return ProcEnd (client);
}
static
int SProcSend (client)
ClientPtr client;
{
register int n;
int count;
REQUEST (xXevieSendReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXevieSendReq);
swapl(&stuff->event, n);
return ProcSend (client);
}
static
int SProcSelectInput (client)
ClientPtr client;
{
register int n;
int count;
REQUEST (xXevieSelectInputReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXevieSendReq);
swapl(&stuff->event_mask, n);
return ProcSelectInput (client);
}
static
int SProcDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XevieQueryVersion:
return SProcQueryVersion (client);
case X_XevieStart:
return SProcStart (client);
case X_XevieEnd:
return SProcEnd (client);
case X_XevieSend:
return SProcSend (client);
case X_XevieSelectInput:
return SProcSelectInput(client);
default:
return BadRequest;
}
}
/*======================================================*/
#define WRAP_INPUTPROC(dev,store,inputProc) \
store->processInputProc = dev->public.processInputProc; \
dev->public.processInputProc = inputProc; \
store->realInputProc = dev->public.realInputProc; \
dev->public.realInputProc = inputProc;
#define COND_WRAP_INPUTPROC(dev,store,inputProc) \
if (dev->public.processInputProc == dev->public.realInputProc) \
dev->public.processInputProc = inputProc; \
store->processInputProc = \
store->realInputProc = dev->public.realInputProc; \
dev->public.realInputProc = inputProc;
#define UNWRAP_INPUTPROC(dev,restore) \
dev->public.processInputProc = restore->processInputProc; \
dev->public.realInputProc = restore->realInputProc;
#define UNWRAP_INPUTPROC(dev,restore) \
dev->public.processInputProc = restore->processInputProc; \
dev->public.realInputProc = restore->realInputProc;
#define XEVIE_EVENT(xE) \
(xevieFlag \
&& !xeviegrabState \
&& clients[xevieClientIndex] \
&& (xevieMask & xevieFilters[xE->u.u.type]))
static void
sendEvent(ClientPtr pClient, xEvent *xE)
{
if(pClient->swapped) {
xEvent eventTo;
/* Remember to strip off the leading bit of type in case
this event was sent with "SendEvent." */
(*EventSwapVector[xE->u.u.type & 0177]) (xE, &eventTo);
(void)WriteToClient(pClient, sizeof(xEvent), (char *)&eventTo);
} else {
(void)WriteToClient(pClient, sizeof(xEvent), (char *) xE);
}
}
static void
XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count)
{
int key, bit;
BYTE *kptr;
ProcessInputProc tmp;
KeyClassPtr keyc = dev->key;
xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
if(XEVIE_EVENT(xE)) {
key = xE->u.u.detail;
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
if (dev->key->modifierMap[xE->u.u.detail])
xevieModifiersOn = TRUE;
xE->u.keyButtonPointer.event = xeviewin->drawable.id;
xE->u.keyButtonPointer.root = GetCurrentRootWindow()->drawable.id;
xE->u.keyButtonPointer.child = (xeviewin->firstChild)
? xeviewin->firstChild->drawable.id:0;
xE->u.keyButtonPointer.rootX = xeviehot.x;
xE->u.keyButtonPointer.rootY = xeviehot.y;
xE->u.keyButtonPointer.state = keyc->state | inputInfo.pointer->button->state;
/* fix bug: sequence lost in Xlib */
xE->u.u.sequenceNumber = clients[xevieClientIndex]->sequence;
/* fix for bug5092586 */
if(!noXkbExtension) {
switch(xE->u.u.type) {
case KeyPress: *kptr |= bit; break;
case KeyRelease: *kptr &= ~bit; break;
}
}
keycq[keycqHead].time = xE->u.keyButtonPointer.time;
memcpy(keycq[keycqHead].keyc, keyc, sizeof(KeyClassRec) - sizeof(KeyClassPtr));
memcpy(keycq[keycqHead].keyc->xkbInfo, keyc->xkbInfo, sizeof(XkbSrvInfoRec));
if(++keycqHead >=KEYC_QUEUE_SIZE)
keycqHead = 0;
sendEvent(clients[xevieClientIndex], xE);
return;
}
tmp = dev->public.realInputProc;
UNWRAP_INPUTPROC(dev,xeviep);
dev->public.processInputProc(xE,dev,count);
COND_WRAP_INPUTPROC(dev,xeviep,tmp);
}
static void
XeviePointerProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count)
{
xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
ProcessInputProc tmp;
if (XEVIE_EVENT(xE)) {
/* fix bug: sequence lost in Xlib */
xE->u.u.sequenceNumber = clients[xevieClientIndex]->sequence;
sendEvent(clients[xevieClientIndex], xE);
return;
}
tmp = dev->public.realInputProc;
UNWRAP_INPUTPROC(dev,xeviep);
dev->public.processInputProc(xE,dev,count);
COND_WRAP_INPUTPROC(dev,xeviep,tmp);
}
static Bool
XevieStart(void)
{
ProcessInputProc prp;
prp = XevieKbdProcessInputProc;
if (!XevieAdd(inputInfo.keyboard,&prp))
return FALSE;
prp = XeviePointerProcessInputProc;
if (!XevieAdd(inputInfo.pointer,&prp))
return FALSE;
return TRUE;
}
static void
XevieEnd(int clientIndex)
{
if (!clientIndex || clientIndex == xevieClientIndex) {
if(!noXkbExtension) {
XevieRemove(inputInfo.keyboard,NULL);
inputInfo.keyboard->public.processInputProc = CoreProcessKeyboardEvent;
inputInfo.keyboard->public.realInputProc = CoreProcessKeyboardEvent;
XkbSetExtension(inputInfo.keyboard,ProcessKeyboardEvent);
XevieRemove(inputInfo.pointer,NULL);
inputInfo.pointer->public.processInputProc = CoreProcessPointerEvent;
inputInfo.pointer->public.realInputProc = CoreProcessPointerEvent;
XkbSetExtension(inputInfo.pointer,ProcessPointerEvent);
}
xevieFlag = 0;
xevieClientIndex = 0;
DeleteCallback (&ClientStateCallback, XevieClientStateCallback, NULL);
}
}
static void
XevieClientStateCallback(CallbackListPtr *pcbl, void * nulldata,
void * calldata)
{
NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
ClientPtr client = pci->client;
if (client->clientState == ClientStateGone
|| client->clientState == ClientStateRetained)
XevieEnd(client->index);
}
static void
XevieServerGrabStateCallback(CallbackListPtr *pcbl, void * nulldata,
void * calldata)
{
ServerGrabInfoRec *grbinfo = (ServerGrabInfoRec *)calldata;
if (grbinfo->grabstate == SERVER_GRABBED)
xeviegrabState = TRUE;
else
xeviegrabState = FALSE;
}
#define UNWRAP_UNWRAPPROC(device,proc_store) \
device->unwrapProc = proc_store;
#define WRAP_UNWRAPPROC(device,proc_store,proc) \
proc_store = device->unwrapProc; \
device->unwrapProc = proc;
static void
xevieUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, void * data)
{
xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
ProcessInputProc tmp = device->public.processInputProc;
UNWRAP_INPUTPROC(device,xeviep);
UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc);
proc(device,data);
WRAP_INPUTPROC(device,xeviep,tmp);
WRAP_UNWRAPPROC(device,xeviep->unwrapProc,xevieUnwrapProc);
}
static Bool
XevieUnwrapAdd(DeviceIntPtr device, void* data)
{
if (device->unwrapProc)
device->unwrapProc(device,XevieUnwrapAdd,data);
else {
ProcessInputProc *ptr = data;
XevieWrap(device,*ptr);
}
return TRUE;
}
static Bool
XevieAdd(DeviceIntPtr device, void* data)
{
xevieDeviceInfoPtr xeviep;
if (!AllocateDevicePrivate(device, xevieDevicePrivateIndex))
return FALSE;
xeviep = xalloc (sizeof (xevieDeviceInfoRec));
if (!xeviep)
return FALSE;
device->devPrivates[xevieDevicePrivateIndex].ptr = xeviep;
XevieUnwrapAdd(device, data);
return TRUE;
}
static Bool
XevieRemove(DeviceIntPtr device,void * data)
{
xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
if (!xeviep) return TRUE;
UNWRAP_INPUTPROC(device,xeviep);
UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc);
xfree(xeviep);
device->devPrivates[xevieDevicePrivateIndex].ptr = NULL;
return TRUE;
}
static void
XevieWrap(DeviceIntPtr device, ProcessInputProc proc)
{
xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
WRAP_INPUTPROC(device,xeviep,proc);
WRAP_UNWRAPPROC(device,xeviep->unwrapProc,xevieUnwrapProc);
}
static void
doSendEvent(xEvent *xE, DeviceIntPtr dev)
{
xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
ProcessInputProc tmp = dev->public.realInputProc;
if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))
&& !xevieModifiersOn) {
KeyClassPtr keyc = dev->key;
CARD8 realModes = dev->key->modifierMap[xE->u.u.detail];
int notFound = 0;
/* if some events are consumed by client, move the queue tail pointer to the current
event which just comes back from Xevie client .
*/
if(keycq[keycqTail].time != xE->u.keyButtonPointer.time) {
while(keycq[keycqTail].time != xE->u.keyButtonPointer.time) {
if(++keycqTail >= KEYC_QUEUE_SIZE)
keycqTail = 0;
if(keycqTail == keycqHead) {
notFound = 1;
break;
}
}
}
if(!notFound) {
dev->key = keycq[keycqTail].keyc;
if(++keycqTail >= KEYC_QUEUE_SIZE)
keycqTail = 0;
}
dev->key->modifierMap[xE->u.u.detail] = 0;
if(dev->key->xkbInfo->repeatKey != 0 && xE->u.u.type != KeyPress)
XkbLastRepeatEvent= (void *)xE;
UNWRAP_INPUTPROC(dev,xeviep);
dev->public.processInputProc(xE,dev,1);
COND_WRAP_INPUTPROC(dev,xeviep,tmp);
XkbLastRepeatEvent= NULL;
dev->key->modifierMap[xE->u.u.detail] = realModes;
dev->key = keyc;
if(notFound) {
DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
XevieEnd(xevieClientIndex);
ErrorF("Error: Xevie keyc queue size is not enough, disable Xevie\n");
}
} else {
UNWRAP_INPUTPROC(dev,xeviep);
dev->public.processInputProc(xE,dev,1);
COND_WRAP_INPUTPROC(dev,xeviep,tmp);
}
}
/* $XFree86: xc/programs/Xserver/Xext/xf86dga.c,v 3.21 2000/06/30 19:06:54 keithp Exp $ */
/*
Copyright (c) 1995 Jon Tombs
Copyright (c) 1995, 1996, 1999 XFree86 Inc
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
#include "servermd.h"
#define _XF86DGA_SERVER_
#include <nx-X11/extensions/xf86dga.h>
#include <nx-X11/extensions/xf86dgastr.h>
#include "swaprep.h"
#include "dgaproc.h"
#include "xf86dgaext.h"
static DISPATCH_PROC(ProcXF86DGADirectVideo);
static DISPATCH_PROC(ProcXF86DGAGetVidPage);
static DISPATCH_PROC(ProcXF86DGAGetVideoLL);
static DISPATCH_PROC(ProcXF86DGAGetViewPortSize);
static DISPATCH_PROC(ProcXF86DGASetVidPage);
static DISPATCH_PROC(ProcXF86DGASetViewPort);
static DISPATCH_PROC(ProcXF86DGAInstallColormap);
static DISPATCH_PROC(ProcXF86DGAQueryDirectVideo);
static DISPATCH_PROC(ProcXF86DGAViewPortChanged);
static int
ProcXF86DGAGetVideoLL(ClientPtr client)
{
REQUEST(xXF86DGAGetVideoLLReq);
xXF86DGAGetVideoLLReply rep;
XDGAModeRec mode;
int num, offset, flags;
char *name;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if(!DGAAvailable(stuff->screen))
return (DGAErrorBase + XF86DGANoDirectVideoMode);
if(!(num = DGAGetOldDGAMode(stuff->screen)))
return (DGAErrorBase + XF86DGANoDirectVideoMode);
/* get the parameters for the mode that best matches */
DGAGetModeInfo(stuff->screen, &mode, num);
if(!DGAOpenFramebuffer(stuff->screen, &name,
(unsigned char**)(&rep.offset),
(int*)(&rep.bank_size), &offset, &flags))
return BadAlloc;
rep.offset += mode.offset;
rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3);
rep.ram_size = rep.bank_size >> 10;
WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86DGADirectVideo(ClientPtr client)
{
int num;
PixmapPtr pix;
XDGAModeRec mode;
REQUEST(xXF86DGADirectVideoReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode;
if (stuff->enable & XF86DGADirectGraphics) {
if(!(num = DGAGetOldDGAMode(stuff->screen)))
return (DGAErrorBase + XF86DGANoDirectVideoMode);
} else
num = 0;
if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
return (DGAErrorBase + XF86DGAScreenNotActive);
DGASetInputMode (stuff->screen,
(stuff->enable & XF86DGADirectKeyb) != 0,
(stuff->enable & XF86DGADirectMouse) != 0);
return (client->noClientException);
}
static int
ProcXF86DGAGetViewPortSize(ClientPtr client)
{
int num;
XDGAModeRec mode;
REQUEST(xXF86DGAGetViewPortSizeReq);
xXF86DGAGetViewPortSizeReply rep;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen))
return (DGAErrorBase + XF86DGANoDirectVideoMode);
if(!(num = DGAGetOldDGAMode(stuff->screen)))
return (DGAErrorBase + XF86DGANoDirectVideoMode);
DGAGetModeInfo(stuff->screen, &mode, num);
rep.width = mode.viewportWidth;
rep.height = mode.viewportHeight;
WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86DGASetViewPort(ClientPtr client)
{
REQUEST(xXF86DGASetViewPortReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
if (!DGAActive(stuff->screen))
{
int num;
PixmapPtr pix;
XDGAModeRec mode;
if(!(num = DGAGetOldDGAMode(stuff->screen)))
return (DGAErrorBase + XF86DGANoDirectVideoMode);
if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
return (DGAErrorBase + XF86DGAScreenNotActive);
}
if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
!= Success)
return DGAErrorBase + XF86DGADirectNotActivated;
return (client->noClientException);
}
static int
ProcXF86DGAGetVidPage(ClientPtr client)
{
REQUEST(xXF86DGAGetVidPageReq);
xXF86DGAGetVidPageReply rep;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.vpage = 0; /* silently fail */
WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86DGASetVidPage(ClientPtr client)
{
REQUEST(xXF86DGASetVidPageReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
/* silently fail */
return (client->noClientException);
}
static int
ProcXF86DGAInstallColormap(ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xXF86DGAInstallColormapReq);
REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
if (!DGAActive(stuff->screen))
return (DGAErrorBase + XF86DGADirectNotActivated);
pcmp = (ColormapPtr )LookupIDByType(stuff->id, RT_COLORMAP);
if (pcmp) {
DGAInstallCmap(pcmp);
return (client->noClientException);
} else {
client->errorValue = stuff->id;
return (BadColor);
}
}
static int
ProcXF86DGAQueryDirectVideo(ClientPtr client)
{
REQUEST(xXF86DGAQueryDirectVideoReq);
xXF86DGAQueryDirectVideoReply rep;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.flags = 0;
if (DGAAvailable(stuff->screen))
rep.flags = XF86DGADirectPresent;
WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86DGAViewPortChanged(ClientPtr client)
{
REQUEST(xXF86DGAViewPortChangedReq);
xXF86DGAViewPortChangedReply rep;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
if (!DGAActive(stuff->screen))
return (DGAErrorBase + XF86DGADirectNotActivated);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.result = 1;
WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *)&rep);
return (client->noClientException);
}
int
ProcXF86DGADispatch(register ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XF86DGAGetVideoLL:
return ProcXF86DGAGetVideoLL(client);
case X_XF86DGADirectVideo:
return ProcXF86DGADirectVideo(client);
case X_XF86DGAGetViewPortSize:
return ProcXF86DGAGetViewPortSize(client);
case X_XF86DGASetViewPort:
return ProcXF86DGASetViewPort(client);
case X_XF86DGAGetVidPage:
return ProcXF86DGAGetVidPage(client);
case X_XF86DGASetVidPage:
return ProcXF86DGASetVidPage(client);
case X_XF86DGAInstallColormap:
return ProcXF86DGAInstallColormap(client);
case X_XF86DGAQueryDirectVideo:
return ProcXF86DGAQueryDirectVideo(client);
case X_XF86DGAViewPortChanged:
return ProcXF86DGAViewPortChanged(client);
default:
return BadRequest;
}
}
/*
Copyright (c) 1999 - The XFree86 Project Inc.
Written by Mark Vojkovich
*/
/* $XFree86: xc/programs/Xserver/Xext/xf86dga2.c,v 1.17 2001/10/28 03:32:51 tsi Exp $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "dixevents.h"
#include "pixmapstr.h"
#include "extnsionst.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
#include "servermd.h"
#define _XF86DGA_SERVER_
#include <nx-X11/extensions/xf86dga.h>
#include <nx-X11/extensions/xf86dgastr.h>
#include "swaprep.h"
#include "dgaproc.h"
#include "xf86dgaext.h"
#ifdef EXTMODULE
#include "xf86_ansic.h"
#else
#include <string.h>
#endif
#include "modinit.h"
static DISPATCH_PROC(ProcXDGADispatch);
static DISPATCH_PROC(SProcXDGADispatch);
static DISPATCH_PROC(ProcXDGAQueryVersion);
static DISPATCH_PROC(ProcXDGAQueryModes);
static DISPATCH_PROC(ProcXDGASetMode);
static DISPATCH_PROC(ProcXDGAOpenFramebuffer);
static DISPATCH_PROC(ProcXDGACloseFramebuffer);
static DISPATCH_PROC(ProcXDGASetViewport);
static DISPATCH_PROC(ProcXDGAInstallColormap);
static DISPATCH_PROC(ProcXDGASelectInput);
static DISPATCH_PROC(ProcXDGAFillRectangle);
static DISPATCH_PROC(ProcXDGACopyArea);
static DISPATCH_PROC(ProcXDGACopyTransparentArea);
static DISPATCH_PROC(ProcXDGAGetViewportStatus);
static DISPATCH_PROC(ProcXDGASync);
static DISPATCH_PROC(ProcXDGASetClientVersion);
static DISPATCH_PROC(ProcXDGAChangePixmapMode);
static DISPATCH_PROC(ProcXDGACreateColormap);
static void XDGAResetProc(ExtensionEntry *extEntry);
static void DGAClientStateChange (CallbackListPtr*, void *, void *);
static ClientPtr DGAClients[MAXSCREENS];
unsigned char DGAReqCode = 0;
int DGAErrorBase;
int DGAEventBase;
static int DGAGeneration = 0;
static int DGAClientPrivateIndex;
static int DGACallbackRefCount = 0;
/* This holds the client's version information */
typedef struct {
int major;
int minor;
} DGAPrivRec, *DGAPrivPtr;
#define DGAPRIV(c) ((c)->devPrivates[DGAClientPrivateIndex].ptr)
void
XFree86DGAExtensionInit(INITARGS)
{
ExtensionEntry* extEntry;
if ((extEntry = AddExtension(XF86DGANAME,
XF86DGANumberEvents,
XF86DGANumberErrors,
ProcXDGADispatch,
SProcXDGADispatch,
XDGAResetProc,
StandardMinorOpcode))) {
int i;
for(i = 0; i < MAXSCREENS; i++)
DGAClients[i] = NULL;
DGAReqCode = (unsigned char)extEntry->base;
DGAErrorBase = extEntry->errorBase;
DGAEventBase = extEntry->eventBase;
for (i = KeyPress; i <= MotionNotify; i++)
SetCriticalEvent (DGAEventBase + i);
}
/*
* Allocate a client private index to hold the client's version
* information.
*/
if (DGAGeneration != serverGeneration) {
DGAClientPrivateIndex = AllocateClientPrivateIndex();
/*
* Allocate 0 length, and use the private to hold a pointer to
* our DGAPrivRec.
*/
if (!AllocateClientPrivate(DGAClientPrivateIndex, 0)) {
ErrorF("XFree86DGAExtensionInit: AllocateClientPrivate failed\n");
return;
}
DGAGeneration = serverGeneration;
}
}
static void
XDGAResetProc (ExtensionEntry *extEntry)
{
DeleteCallback (&ClientStateCallback, DGAClientStateChange, NULL);
DGACallbackRefCount = 0;
}
static int
ProcXDGAQueryVersion(ClientPtr client)
{
xXDGAQueryVersionReply rep;
REQUEST_SIZE_MATCH(xXDGAQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XDGA_MAJOR_VERSION;
rep.minorVersion = XDGA_MINOR_VERSION;
WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXDGAOpenFramebuffer(ClientPtr client)
{
REQUEST(xXDGAOpenFramebufferReq);
xXDGAOpenFramebufferReply rep;
char *deviceName;
int nameSize;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode;
REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if(!DGAOpenFramebuffer(stuff->screen, &deviceName,
(unsigned char**)(&rep.mem1),
(int*)&rep.size, (int*)&rep.offset, (int*)&rep.extra))
{
return BadAlloc;
}
nameSize = deviceName ? (strlen(deviceName) + 1) : 0;
rep.length = (nameSize + 3) >> 2;
WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *)&rep);
if(rep.length)
WriteToClient(client, nameSize, deviceName);
return (client->noClientException);
}
static int
ProcXDGACloseFramebuffer(ClientPtr client)
{
REQUEST(xXDGACloseFramebufferReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode;
REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
DGACloseFramebuffer(stuff->screen);
return (client->noClientException);
}
static int
ProcXDGAQueryModes(ClientPtr client)
{
int i, num, size;
REQUEST(xXDGAQueryModesReq);
xXDGAQueryModesReply rep;
xXDGAModeInfo info;
XDGAModePtr mode;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
rep.type = X_Reply;
rep.length = 0;
rep.number = 0;
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen)) {
rep.number = 0;
rep.length = 0;
WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
return (client->noClientException);
}
if(!(num = DGAGetModes(stuff->screen))) {
WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
return (client->noClientException);
}
if(!(mode = (XDGAModePtr)xalloc(num * sizeof(XDGAModeRec))))
return BadAlloc;
for(i = 0; i < num; i++)
DGAGetModeInfo(stuff->screen, mode + i, i + 1);
size = num * sz_xXDGAModeInfo;
for(i = 0; i < num; i++)
size += (strlen(mode[i].name) + 4) & ~3L; /* plus NULL */
rep.number = num;
rep.length = size >> 2;
WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
for(i = 0; i < num; i++) {
size = strlen(mode[i].name) + 1;
info.byte_order = mode[i].byteOrder;
info.depth = mode[i].depth;
info.num = mode[i].num;
info.bpp = mode[i].bitsPerPixel;
info.name_size = (size + 3) & ~3L;
info.vsync_num = mode[i].VSync_num;
info.vsync_den = mode[i].VSync_den;
info.flags = mode[i].flags;
info.image_width = mode[i].imageWidth;
info.image_height = mode[i].imageHeight;
info.pixmap_width = mode[i].pixmapWidth;
info.pixmap_height = mode[i].pixmapHeight;
info.bytes_per_scanline = mode[i].bytesPerScanline;
info.red_mask = mode[i].red_mask;
info.green_mask = mode[i].green_mask;
info.blue_mask = mode[i].blue_mask;
info.visual_class = mode[i].visualClass;
info.viewport_width = mode[i].viewportWidth;
info.viewport_height = mode[i].viewportHeight;
info.viewport_xstep = mode[i].xViewportStep;
info.viewport_ystep = mode[i].yViewportStep;
info.viewport_xmax = mode[i].maxViewportX;
info.viewport_ymax = mode[i].maxViewportY;
info.viewport_flags = mode[i].viewportFlags;
info.reserved1 = mode[i].reserved1;
info.reserved2 = mode[i].reserved2;
WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
WriteToClient(client, size, mode[i].name);
}
xfree(mode);
return (client->noClientException);
}
static void
DGAClientStateChange (
CallbackListPtr* pcbl,
void * nulldata,
void * calldata
){
NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
ClientPtr client = NULL;
int i;
for(i = 0; i < screenInfo.numScreens; i++) {
if(DGAClients[i] == pci->client) {
client = pci->client;
break;
}
}
if(client &&
((client->clientState == ClientStateGone) ||
(client->clientState == ClientStateRetained))) {
XDGAModeRec mode;
PixmapPtr pPix;
DGAClients[i] = NULL;
DGASelectInput(i, NULL, 0);
DGASetMode(i, 0, &mode, &pPix);
if(--DGACallbackRefCount == 0)
DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
}
}
static int
ProcXDGASetMode(ClientPtr client)
{
REQUEST(xXDGASetModeReq);
xXDGASetModeReply rep;
XDGAModeRec mode;
xXDGAModeInfo info;
PixmapPtr pPix;
int size;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXDGASetModeReq);
rep.type = X_Reply;
rep.length = 0;
rep.offset = 0;
rep.flags = 0;
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode;
if(DGAClients[stuff->screen] &&
(DGAClients[stuff->screen] != client))
return DGAErrorBase + XF86DGANoDirectVideoMode;
if(!stuff->mode) {
if(DGAClients[stuff->screen]) {
if(--DGACallbackRefCount == 0)
DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
}
DGAClients[stuff->screen] = NULL;
DGASelectInput(stuff->screen, NULL, 0);
DGASetMode(stuff->screen, 0, &mode, &pPix);
WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
return (client->noClientException);
}
if(Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
return BadValue;
if(!DGAClients[stuff->screen]) {
if(DGACallbackRefCount++ == 0)
AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
}
DGAClients[stuff->screen] = client;
if(pPix) {
if(AddResource(stuff->pid, RT_PIXMAP, (void *)(pPix))) {
pPix->drawable.id = (int)stuff->pid;
rep.flags = DGA_PIXMAP_AVAILABLE;
}
}
size = strlen(mode.name) + 1;
info.byte_order = mode.byteOrder;
info.depth = mode.depth;
info.num = mode.num;
info.bpp = mode.bitsPerPixel;
info.name_size = (size + 3) & ~3L;
info.vsync_num = mode.VSync_num;
info.vsync_den = mode.VSync_den;
info.flags = mode.flags;
info.image_width = mode.imageWidth;
info.image_height = mode.imageHeight;
info.pixmap_width = mode.pixmapWidth;
info.pixmap_height = mode.pixmapHeight;
info.bytes_per_scanline = mode.bytesPerScanline;
info.red_mask = mode.red_mask;
info.green_mask = mode.green_mask;
info.blue_mask = mode.blue_mask;
info.visual_class = mode.visualClass;
info.viewport_width = mode.viewportWidth;
info.viewport_height = mode.viewportHeight;
info.viewport_xstep = mode.xViewportStep;
info.viewport_ystep = mode.yViewportStep;
info.viewport_xmax = mode.maxViewportX;
info.viewport_ymax = mode.maxViewportY;
info.viewport_flags = mode.viewportFlags;
info.reserved1 = mode.reserved1;
info.reserved2 = mode.reserved2;
rep.length = (sz_xXDGAModeInfo + info.name_size) >> 2;
WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
WriteToClient(client, size, mode.name);
return (client->noClientException);
}
static int
ProcXDGASetViewport(ClientPtr client)
{
REQUEST(xXDGASetViewportReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASetViewportReq);
DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags);
return (client->noClientException);
}
static int
ProcXDGAInstallColormap(ClientPtr client)
{
ColormapPtr cmap;
REQUEST(xXDGAInstallColormapReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
cmap = (ColormapPtr)LookupIDByType(stuff->cmap, RT_COLORMAP);
if (cmap) {
DGAInstallCmap(cmap);
return (client->noClientException);
} else {
client->errorValue = stuff->cmap;
return (BadColor);
}
return (client->noClientException);
}
static int
ProcXDGASelectInput(ClientPtr client)
{
REQUEST(xXDGASelectInputReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASelectInputReq);
if(DGAClients[stuff->screen] == client)
DGASelectInput(stuff->screen, client, stuff->mask);
return (client->noClientException);
}
static int
ProcXDGAFillRectangle(ClientPtr client)
{
REQUEST(xXDGAFillRectangleReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
if(Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
stuff->width, stuff->height, stuff->color))
return BadMatch;
return (client->noClientException);
}
static int
ProcXDGACopyArea(ClientPtr client)
{
REQUEST(xXDGACopyAreaReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
if(Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
stuff->width, stuff->height, stuff->dstx, stuff->dsty))
return BadMatch;
return (client->noClientException);
}
static int
ProcXDGACopyTransparentArea(ClientPtr client)
{
REQUEST(xXDGACopyTransparentAreaReq);
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
if(Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
stuff->width, stuff->height, stuff->dstx, stuff->dsty, stuff->key))
return BadMatch;
return (client->noClientException);
}
static int
ProcXDGAGetViewportStatus(ClientPtr client)
{
REQUEST(xXDGAGetViewportStatusReq);
xXDGAGetViewportStatusReply rep;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.status = DGAGetViewportStatus(stuff->screen);
WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXDGASync(ClientPtr client)
{
REQUEST(xXDGASyncReq);
xXDGASyncReply rep;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASyncReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
DGASync(stuff->screen);
WriteToClient(client, sizeof(xXDGASyncReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXDGASetClientVersion(ClientPtr client)
{
REQUEST(xXDGASetClientVersionReq);
DGAPrivPtr pPriv;
REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
if ((pPriv = DGAPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(DGAPrivRec));
/* XXX Need to look into freeing this */
if (!pPriv)
return BadAlloc;
DGAPRIV(client) = pPriv;
}
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
return (client->noClientException);
}
static int
ProcXDGAChangePixmapMode(ClientPtr client)
{
REQUEST(xXDGAChangePixmapModeReq);
xXDGAChangePixmapModeReply rep;
int x, y;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
x = stuff->x;
y = stuff->y;
if(!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
return BadMatch;
rep.x = x;
rep.y = y;
WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXDGACreateColormap(ClientPtr client)
{
REQUEST(xXDGACreateColormapReq);
int result;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
if(DGAClients[stuff->screen] != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
if(!stuff->mode)
return BadValue;
result = DGACreateColormap(stuff->screen, client, stuff->id,
stuff->mode, stuff->alloc);
if(result != Success)
return result;
return (client->noClientException);
}
static int
SProcXDGADispatch (ClientPtr client)
{
return DGAErrorBase + XF86DGAClientNotLocal;
}
#if 0
#define DGA_REQ_DEBUG
#endif
#ifdef DGA_REQ_DEBUG
static char *dgaMinor[] = {
"QueryVersion",
"GetVideoLL",
"DirectVideo",
"GetViewPortSize",
"SetViewPort",
"GetVidPage",
"SetVidPage",
"InstallColormap",
"QueryDirectVideo",
"ViewPortChanged",
"10",
"11",
"QueryModes",
"SetMode",
"SetViewport",
"InstallColormap",
"SelectInput",
"FillRectangle",
"CopyArea",
"CopyTransparentArea",
"GetViewportStatus",
"Sync",
"OpenFramebuffer",
"CloseFramebuffer",
"SetClientVersion",
"ChangePixmapMode",
"CreateColormap",
};
#endif
static int
ProcXDGADispatch (ClientPtr client)
{
REQUEST(xReq);
if (!LocalClient(client))
return DGAErrorBase + XF86DGAClientNotLocal;
#ifdef DGA_REQ_DEBUG
if (stuff->data <= X_XDGACreateColormap)
fprintf (stderr, " DGA %s\n", dgaMinor[stuff->data]);
#endif
/* divert old protocol */
#if 1
if( (stuff->data <= X_XF86DGAViewPortChanged) &&
(stuff->data >= X_XF86DGAGetVideoLL))
return ProcXF86DGADispatch(client);
#endif
switch (stuff->data){
case X_XDGAQueryVersion:
return ProcXDGAQueryVersion(client);
case X_XDGAQueryModes:
return ProcXDGAQueryModes(client);
case X_XDGASetMode:
return ProcXDGASetMode(client);
case X_XDGAOpenFramebuffer:
return ProcXDGAOpenFramebuffer(client);
case X_XDGACloseFramebuffer:
return ProcXDGACloseFramebuffer(client);
case X_XDGASetViewport:
return ProcXDGASetViewport(client);
case X_XDGAInstallColormap:
return ProcXDGAInstallColormap(client);
case X_XDGASelectInput:
return ProcXDGASelectInput(client);
case X_XDGAFillRectangle:
return ProcXDGAFillRectangle(client);
case X_XDGACopyArea:
return ProcXDGACopyArea(client);
case X_XDGACopyTransparentArea:
return ProcXDGACopyTransparentArea(client);
case X_XDGAGetViewportStatus:
return ProcXDGAGetViewportStatus(client);
case X_XDGASync:
return ProcXDGASync(client);
case X_XDGASetClientVersion:
return ProcXDGASetClientVersion(client);
case X_XDGAChangePixmapMode:
return ProcXDGAChangePixmapMode(client);
case X_XDGACreateColormap:
return ProcXDGACreateColormap(client);
default:
return BadRequest;
}
}
#ifdef EXTMODULE
void
XFree86DGARegister(INITARGS)
{
XDGAEventBase = &DGAEventBase;
}
#endif
/* $XFree86$ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _XF86DGAEXT_H_
#define _XF86DGAEXT_H_
extern DISPATCH_PROC(ProcXF86DGADispatch);
#endif /* _XF86DGAEXT_H_ */
/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.41 2003/11/17 22:20:27 dawes Exp $ */
/*
* Copyright (c) 1995, 1996 The XFree86 Project, Inc
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "scrnintstr.h"
#include "inputstr.h"
#include "servermd.h"
#define _XF86MISC_SERVER_
#undef _XF86MISC_SAVER_COMPAT_
#include <nx-X11/extensions/xf86mscstr.h>
#include "swaprep.h"
#include "xf86.h"
#include <nx-X11/Xfuncproto.h>
#include "xf86miscproc.h"
#if 0
#include <nx-X11/Xtrans/Xtrans.h>
#include "../os/osdep.h"
#include <nx-X11/Xauth.h>
#ifndef USL
#ifndef Lynx
#include <sys/socket.h>
#else
#include <socket.h>
#endif
#endif /* USL */
#endif
#ifdef EXTMODULE
#include "xf86_ansic.h"
#endif
static int miscErrorBase;
static int MiscGeneration = 0;
static int MiscClientPrivateIndex;
/* This holds the client's version information */
typedef struct {
int major;
int minor;
} MiscPrivRec, *MiscPrivPtr;
#define MPRIV(c) ((c)->devPrivates[MiscClientPrivateIndex].ptr)
static void XF86MiscResetProc(
ExtensionEntry* /* extEntry */
);
static void
ClientVersion(ClientPtr client, int *major, int *minor)
{
MiscPrivPtr pPriv;
pPriv = MPRIV(client);
if (!pPriv) {
if (major) *major = 0;
if (minor) *minor = 0;
return;
}
if (major) *major = pPriv->major;
if (minor) *minor = pPriv->minor;
}
static DISPATCH_PROC(ProcXF86MiscDispatch);
static DISPATCH_PROC(ProcXF86MiscQueryVersion);
static DISPATCH_PROC(ProcXF86MiscGetKbdSettings);
static DISPATCH_PROC(ProcXF86MiscGetMouseSettings);
static DISPATCH_PROC(ProcXF86MiscSetKbdSettings);
static DISPATCH_PROC(ProcXF86MiscSetMouseSettings);
static DISPATCH_PROC(ProcXF86MiscSetGrabKeysState);
static DISPATCH_PROC(ProcXF86MiscSetClientVersion);
static DISPATCH_PROC(ProcXF86MiscGetFilePaths);
static DISPATCH_PROC(ProcXF86MiscPassMessage);
#ifdef _XF86MISC_SAVER_COMPAT_
static DISPATCH_PROC(ProcXF86MiscGetSaver);
static DISPATCH_PROC(ProcXF86MiscSetSaver);
#endif
static DISPATCH_PROC(SProcXF86MiscDispatch);
static DISPATCH_PROC(SProcXF86MiscQueryVersion);
static DISPATCH_PROC(SProcXF86MiscGetKbdSettings);
static DISPATCH_PROC(SProcXF86MiscGetMouseSettings);
static DISPATCH_PROC(SProcXF86MiscSetKbdSettings);
static DISPATCH_PROC(SProcXF86MiscSetMouseSettings);
static DISPATCH_PROC(SProcXF86MiscSetGrabKeysState);
static DISPATCH_PROC(SProcXF86MiscSetClientVersion);
static DISPATCH_PROC(SProcXF86MiscGetFilePaths);
static DISPATCH_PROC(SProcXF86MiscPassMessage);
#ifdef _XF86MISC_SAVER_COMPAT_
static DISPATCH_PROC(SProcXF86MiscGetSaver);
static DISPATCH_PROC(SProcXF86MiscSetSaver);
#endif
#if 0
static unsigned char XF86MiscReqCode = 0;
#endif
#ifdef DEBUG
# define DEBUG_P(x) ErrorF(x"\n");
#else
# define DEBUG_P(x) /**/
#endif
#define MISCERR(x) (miscErrorBase + x)
void
XFree86MiscExtensionInit(void)
{
ExtensionEntry* extEntry;
DEBUG_P("XFree86MiscExtensionInit");
if (!xf86GetModInDevEnabled())
return;
/*
* Allocate a client private index to hold the client's version
* information.
*/
if (MiscGeneration != serverGeneration) {
MiscClientPrivateIndex = AllocateClientPrivateIndex();
/*
* Allocate 0 length, and use the private to hold a pointer to our
* MiscPrivRec.
*/
if (!AllocateClientPrivate(MiscClientPrivateIndex, 0)) {
ErrorF("XFree86MiscExtensionInit: "
"AllocateClientPrivate failed\n");
return;
}
MiscGeneration = serverGeneration;
}
if (
(extEntry = AddExtension(XF86MISCNAME,
XF86MiscNumberEvents,
XF86MiscNumberErrors,
ProcXF86MiscDispatch,
SProcXF86MiscDispatch,
XF86MiscResetProc,
StandardMinorOpcode))) {
#if 0
XF86MiscReqCode = (unsigned char)extEntry->base;
#endif
miscErrorBase = extEntry->errorBase;
}
}
/*ARGSUSED*/
static void
XF86MiscResetProc (extEntry)
ExtensionEntry* extEntry;
{
}
static int
ProcXF86MiscQueryVersion(client)
register ClientPtr client;
{
xXF86MiscQueryVersionReply rep;
register int n;
DEBUG_P("XF86MiscQueryVersion");
REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XF86MISC_MAJOR_VERSION;
rep.minorVersion = XF86MISC_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xXF86MiscQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
#ifdef _XF86MISC_SAVER_COMPAT_
/* THESE HAVE NOT BEEN CONVERTED TO THE NEW DESIGN */
/*
* This will go away, but remains for now for compatibility with older
* clients.
*/
static int
ProcXF86MiscSetSaver(client)
register ClientPtr client;
{
REQUEST(xXF86MiscSetSaverReq);
ScrnInfoPtr vptr;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
if (stuff->suspendTime < 0)
return BadValue;
if (stuff->offTime < 0)
return BadValue;
return (client->noClientException);
}
/*
* This will go away, but remains for now for compatibility with older
* clients.
*/
static int
ProcXF86MiscGetSaver(client)
register ClientPtr client;
{
REQUEST(xXF86MiscGetSaverReq);
xXF86MiscGetSaverReply rep;
register int n;
ScrnInfoPtr vptr;
if (stuff->screen > screenInfo.numScreens)
return BadValue;
vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.suspendTime = 0;
rep.offTime = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.suspendTime, n);
swapl(&rep.offTime, n);
}
WriteToClient(client, SIZEOF(xXF86MiscGetSaverReply), (char *)&rep);
return (client->noClientException);
}
#endif /* _XF86MISC_SAVER_COMPAT_ */
static int
ProcXF86MiscGetMouseSettings(client)
register ClientPtr client;
{
xXF86MiscGetMouseSettingsReply rep;
char *devname;
void * mouse;
register int n;
DEBUG_P("XF86MiscGetMouseSettings");
REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
if (!MiscExtGetMouseSettings(&mouse, &devname))
return BadValue;
rep.mousetype = MiscExtGetMouseValue(mouse, MISC_MSE_PROTO);
rep.baudrate = MiscExtGetMouseValue(mouse, MISC_MSE_BAUDRATE);
rep.samplerate = MiscExtGetMouseValue(mouse, MISC_MSE_SAMPLERATE);
rep.resolution = MiscExtGetMouseValue(mouse, MISC_MSE_RESOLUTION);
rep.buttons = MiscExtGetMouseValue(mouse, MISC_MSE_BUTTONS);
rep.emulate3buttons = MiscExtGetMouseValue(mouse, MISC_MSE_EM3BUTTONS);
rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT);
rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE);
rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS);
rep.devnamelen = (devname? strlen(devname): 0);
rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) -
sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.mousetype, n);
swapl(&rep.baudrate, n);
swapl(&rep.samplerate, n);
swapl(&rep.resolution, n);
swapl(&rep.buttons, n);
swapl(&rep.emulate3buttons, n);
swapl(&rep.emulate3timeout, n);
swapl(&rep.chordmiddle, n);
swapl(&rep.flags, n);
}
WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep);
MiscExtDestroyStruct(mouse, MISC_POINTER);
if (rep.devnamelen)
WriteToClient(client, rep.devnamelen, devname);
return (client->noClientException);
}
static int
ProcXF86MiscGetKbdSettings(client)
register ClientPtr client;
{
xXF86MiscGetKbdSettingsReply rep;
void * kbd;
register int n;
DEBUG_P("XF86MiscGetKbdSettings");
REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!MiscExtGetKbdSettings(&kbd))
return BadValue;
rep.kbdtype = MiscExtGetKbdValue(kbd, MISC_KBD_TYPE);
rep.rate = MiscExtGetKbdValue(kbd, MISC_KBD_RATE);
rep.delay = MiscExtGetKbdValue(kbd, MISC_KBD_DELAY);
rep.servnumlock = MiscExtGetKbdValue(kbd, MISC_KBD_SERVNUMLOCK);
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.kbdtype, n);
swapl(&rep.rate, n);
swapl(&rep.delay, n);
}
WriteToClient(client, SIZEOF(xXF86MiscGetKbdSettingsReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86MiscSetMouseSettings(client)
register ClientPtr client;
{
MiscExtReturn ret;
void * mouse;
char *devname = NULL;
int major, minor;
REQUEST(xXF86MiscSetMouseSettingsReq);
DEBUG_P("XF86MiscSetMouseSettings");
REQUEST_AT_LEAST_SIZE(xXF86MiscSetMouseSettingsReq);
ClientVersion(client, &major, &minor);
if (xf86GetVerbosity() > 1) {
ErrorF("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n",
(int)stuff->mousetype, (int)stuff->baudrate,
(int)stuff->samplerate, stuff->chordmiddle);
ErrorF(" em3but: %d em3tim: %d res: %d flags: %ld\n",
stuff->emulate3buttons, (int)stuff->emulate3timeout,
(int)stuff->resolution, (unsigned long)stuff->flags);
}
if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (void *) 0)
return BadAlloc;
MiscExtSetMouseValue(mouse, MISC_MSE_PROTO, stuff->mousetype);
MiscExtSetMouseValue(mouse, MISC_MSE_BAUDRATE, stuff->baudrate);
MiscExtSetMouseValue(mouse, MISC_MSE_SAMPLERATE, stuff->samplerate);
MiscExtSetMouseValue(mouse, MISC_MSE_RESOLUTION, stuff->resolution);
MiscExtSetMouseValue(mouse, MISC_MSE_BUTTONS, stuff->buttons);
MiscExtSetMouseValue(mouse, MISC_MSE_EM3BUTTONS, stuff->emulate3buttons);
MiscExtSetMouseValue(mouse, MISC_MSE_EM3TIMEOUT, stuff->emulate3timeout);
MiscExtSetMouseValue(mouse, MISC_MSE_CHORDMIDDLE, stuff->chordmiddle);
MiscExtSetMouseValue(mouse, MISC_MSE_FLAGS, stuff->flags);
if ((major > 0 || minor > 5) && stuff->devnamelen) {
int size = sizeof(xXF86MiscSetMouseSettingsReq) + stuff->devnamelen;
size = (size + 3) >> 2;
if (client->req_len < size)
return BadLength;
if (stuff->devnamelen) {
if (!(devname = xalloc(stuff->devnamelen)))
return BadAlloc;
strncpy(devname,(char*)(&stuff[1]),stuff->devnamelen);
if (xf86GetVerbosity() > 1)
ErrorF("SetMouseSettings - device: %s\n",devname);
MiscExtSetMouseDevice(mouse, devname);
}
}
ret = MiscExtApply(mouse, MISC_POINTER);
if (devname)
xfree(devname);
switch ((ret)) {
case MISC_RET_SUCCESS: break;
case MISC_RET_BADVAL: return BadValue;
case MISC_RET_BADMSEPROTO: return MISCERR(XF86MiscBadMouseProtocol);
case MISC_RET_BADBAUDRATE: return MISCERR(XF86MiscBadMouseBaudRate);
case MISC_RET_BADFLAGS: return MISCERR(XF86MiscBadMouseFlags);
case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo);
case MISC_RET_NOMODULE: return MISCERR(XF86MiscNoModule);
default:
ErrorF("Unexpected return from MiscExtApply(POINTER) = %d\n", ret);
return BadImplementation;
}
if (xf86GetVerbosity() > 1)
ErrorF("SetMouseSettings - Succeeded\n");
return (client->noClientException);
}
static int
ProcXF86MiscSetKbdSettings(client)
register ClientPtr client;
{
MiscExtReturn ret;
void * kbd;
REQUEST(xXF86MiscSetKbdSettingsReq);
DEBUG_P("XF86MiscSetKbdSettings");
REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
if (xf86GetVerbosity() > 1)
ErrorF("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n",
(int)stuff->kbdtype, (int)stuff->rate,
(int)stuff->delay, stuff->servnumlock);
if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (void *) 0)
return BadAlloc;
MiscExtSetKbdValue(kbd, MISC_KBD_TYPE, stuff->kbdtype);
MiscExtSetKbdValue(kbd, MISC_KBD_RATE, stuff->rate);
MiscExtSetKbdValue(kbd, MISC_KBD_DELAY, stuff->delay);
MiscExtSetKbdValue(kbd, MISC_KBD_SERVNUMLOCK, stuff->servnumlock);
switch ((ret = MiscExtApply(kbd, MISC_KEYBOARD))) {
case MISC_RET_SUCCESS: break;
case MISC_RET_BADVAL: return BadValue;
case MISC_RET_BADKBDTYPE: return MISCERR(XF86MiscBadKbdType);
default:
ErrorF("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret);
return BadImplementation;
}
if (xf86GetVerbosity() > 1)
ErrorF("SetKbdSettings - Succeeded\n");
return (client->noClientException);
}
static int
ProcXF86MiscSetGrabKeysState(client)
register ClientPtr client;
{
int n, status;
xXF86MiscSetGrabKeysStateReply rep;
REQUEST(xXF86MiscSetGrabKeysStateReq);
DEBUG_P("XF86MiscSetGrabKeysState");
REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq);
if ((status = MiscExtSetGrabKeysState(client, stuff->enable)) == 0) {
if (xf86GetVerbosity() > 1)
ErrorF("SetGrabKeysState - %s\n",
stuff->enable ? "enabled" : "disabled");
}
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.status = status;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.status, n);
}
WriteToClient(client, SIZEOF(xXF86MiscSetGrabKeysStateReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86MiscSetClientVersion(ClientPtr client)
{
REQUEST(xXF86MiscSetClientVersionReq);
MiscPrivPtr pPriv;
DEBUG_P("XF86MiscSetClientVersion");
REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
if ((pPriv = MPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(MiscPrivRec));
if (!pPriv)
return BadAlloc;
MPRIV(client) = pPriv;
}
ErrorF("SetClientVersion: %i %i\n",stuff->major,stuff->minor);
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
return (client->noClientException);
}
static int
ProcXF86MiscGetFilePaths(client)
register ClientPtr client;
{
xXF86MiscGetFilePathsReply rep;
const char *configfile;
const char *modulepath;
const char *logfile;
register int n;
DEBUG_P("XF86MiscGetFilePaths");
REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile))
return BadValue;
rep.configlen = (configfile? strlen(configfile): 0);
rep.modulelen = (modulepath? strlen(modulepath): 0);
rep.loglen = (logfile? strlen(logfile): 0);
rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) +
((rep.configlen + 3) & ~3) +
((rep.modulelen + 3) & ~3) +
((rep.loglen + 3) & ~3) ) >> 2;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.configlen, n);
swaps(&rep.modulelen, n);
swaps(&rep.loglen, n);
}
WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep);
if (rep.configlen)
WriteToClient(client, rep.configlen, (char *)configfile);
if (rep.modulelen)
WriteToClient(client, rep.modulelen, (char *)modulepath);
if (rep.loglen)
WriteToClient(client, rep.loglen, (char *)logfile);
return (client->noClientException);
}
static int
ProcXF86MiscPassMessage(client)
register ClientPtr client;
{
xXF86MiscPassMessageReply rep;
char *msgtype, *msgval, *retstr;
int retval, size;
register int n;
REQUEST(xXF86MiscPassMessageReq);
DEBUG_P("XF86MiscPassMessage");
REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq);
size = (sizeof(xXF86MiscPassMessageReq) + 3) >> 2;
size+= (stuff->typelen + 3) >> 2;
size+= (stuff->vallen + 3) >> 2;
if (client->req_len < size)
return BadLength;
if (stuff->typelen) {
if (!(msgtype = xalloc(stuff->typelen)))
return BadAlloc;
strncpy(msgtype,(char*)(&stuff[1]),stuff->typelen);
} else return BadValue;
if (stuff->vallen) {
if (!(msgval = xalloc(stuff->vallen))) {
xfree(msgtype);
return BadAlloc;
}
strncpy(msgval,(char*)((char*)&stuff[1] + ((stuff->typelen + 3) & ~3)),
stuff->vallen);
} else {
xfree(msgtype);
return BadValue;
}
if ((retval = MiscExtPassMessage(stuff->screen,msgtype,msgval,&retstr)) != 0) {
xfree(msgtype);
xfree(msgval);
return retval;
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.mesglen = (retstr? strlen(retstr): 0);
rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) +
((rep.mesglen + 3) & ~3)) >> 2;
rep.status = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.mesglen, n);
}
WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep);
if (rep.mesglen)
WriteToClient(client, rep.mesglen, (char *)retstr);
xfree(msgtype);
xfree(msgval);
return (client->noClientException);
}
static int
ProcXF86MiscDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XF86MiscQueryVersion:
return ProcXF86MiscQueryVersion(client);
#ifdef _XF86MISC_SAVER_COMPAT_
case X_XF86MiscGetSaver:
return ProcXF86MiscGetSaver(client);
case X_XF86MiscSetSaver:
return ProcXF86MiscSetSaver(client);
#endif
case X_XF86MiscGetMouseSettings:
return ProcXF86MiscGetMouseSettings(client);
case X_XF86MiscGetKbdSettings:
return ProcXF86MiscGetKbdSettings(client);
case X_XF86MiscSetClientVersion:
return ProcXF86MiscSetClientVersion(client);
case X_XF86MiscGetFilePaths:
return ProcXF86MiscGetFilePaths(client);
case X_XF86MiscPassMessage:
return ProcXF86MiscPassMessage(client);
default:
if (!xf86GetModInDevEnabled())
return miscErrorBase + XF86MiscModInDevDisabled;
if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) {
switch (stuff->data) {
case X_XF86MiscSetMouseSettings:
return ProcXF86MiscSetMouseSettings(client);
case X_XF86MiscSetKbdSettings:
return ProcXF86MiscSetKbdSettings(client);
case X_XF86MiscSetGrabKeysState:
return ProcXF86MiscSetGrabKeysState(client);
default:
return BadRequest;
}
} else
return miscErrorBase + XF86MiscModInDevClientNotLocal;
}
}
static int
SProcXF86MiscQueryVersion(client)
register ClientPtr client;
{
register int n;
REQUEST(xXF86MiscQueryVersionReq);
swaps(&stuff->length, n);
return ProcXF86MiscQueryVersion(client);
}
#ifdef _XF86MISC_SAVER_COMPAT_
static int
SProcXF86MiscGetSaver(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscGetSaverReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
swaps(&stuff->screen, n);
return ProcXF86MiscGetSaver(client);
}
static int
SProcXF86MiscSetSaver(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscSetSaverReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
swaps(&stuff->screen, n);
swapl(&stuff->suspendTime, n);
swapl(&stuff->offTime, n);
return ProcXF86MiscSetSaver(client);
}
#endif /* _XF86MISC_SAVER_COMPAT_ */
static int
SProcXF86MiscGetMouseSettings(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscGetMouseSettingsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
return ProcXF86MiscGetMouseSettings(client);
}
static int
SProcXF86MiscGetKbdSettings(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscGetKbdSettingsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
return ProcXF86MiscGetKbdSettings(client);
}
static int
SProcXF86MiscSetMouseSettings(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscSetMouseSettingsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq);
swapl(&stuff->mousetype, n);
swapl(&stuff->baudrate, n);
swapl(&stuff->samplerate, n);
swapl(&stuff->resolution, n);
swapl(&stuff->buttons, n);
swapl(&stuff->emulate3timeout, n);
swapl(&stuff->flags, n);
return ProcXF86MiscSetMouseSettings(client);
}
static int
SProcXF86MiscSetKbdSettings(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscSetKbdSettingsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
swapl(&stuff->kbdtype, n);
swapl(&stuff->rate, n);
swapl(&stuff->delay, n);
return ProcXF86MiscSetKbdSettings(client);
}
static int
SProcXF86MiscSetGrabKeysState(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscSetGrabKeysStateReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq);
swaps(&stuff->enable, n);
return ProcXF86MiscSetGrabKeysState(client);
}
static int
SProcXF86MiscSetClientVersion(ClientPtr client)
{
register int n;
REQUEST(xXF86MiscSetClientVersionReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
swaps(&stuff->major, n);
swaps(&stuff->minor, n);
return ProcXF86MiscSetClientVersion(client);
}
static int
SProcXF86MiscGetFilePaths(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscGetFilePathsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq);
return ProcXF86MiscGetFilePaths(client);
}
static int
SProcXF86MiscPassMessage(client)
ClientPtr client;
{
register int n;
REQUEST(xXF86MiscPassMessageReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86MiscPassMessageReq);
return ProcXF86MiscPassMessage(client);
}
static int
SProcXF86MiscDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XF86MiscQueryVersion:
return SProcXF86MiscQueryVersion(client);
#ifdef _XF86MISC_SAVER_COMPAT_
case X_XF86MiscGetSaver:
return SProcXF86MiscGetSaver(client);
case X_XF86MiscSetSaver:
return SProcXF86MiscSetSaver(client);
#endif
case X_XF86MiscGetMouseSettings:
return SProcXF86MiscGetMouseSettings(client);
case X_XF86MiscGetKbdSettings:
return SProcXF86MiscGetKbdSettings(client);
case X_XF86MiscSetClientVersion:
return SProcXF86MiscSetClientVersion(client);
case X_XF86MiscGetFilePaths:
return SProcXF86MiscGetFilePaths(client);
case X_XF86MiscPassMessage:
return SProcXF86MiscPassMessage(client);
default:
if (!xf86GetModInDevEnabled())
return miscErrorBase + XF86MiscModInDevDisabled;
if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) {
switch (stuff->data) {
case X_XF86MiscSetMouseSettings:
return SProcXF86MiscSetMouseSettings(client);
case X_XF86MiscSetKbdSettings:
return SProcXF86MiscSetKbdSettings(client);
case X_XF86MiscSetGrabKeysState:
return SProcXF86MiscSetGrabKeysState(client);
default:
return BadRequest;
}
} else
return miscErrorBase + XF86MiscModInDevClientNotLocal;
}
}
/* $XFree86: xc/programs/Xserver/Xext/xf86miscproc.h,v 1.5 2002/11/20 04:04:58 dawes Exp $ */
/* Prototypes for Pointer/Keyboard functions that the DDX must provide */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _XF86MISCPROC_H_
#define _XF86MISCPROC_H_
typedef enum {
MISC_MSE_PROTO,
MISC_MSE_BAUDRATE,
MISC_MSE_SAMPLERATE,
MISC_MSE_RESOLUTION,
MISC_MSE_BUTTONS,
MISC_MSE_EM3BUTTONS,
MISC_MSE_EM3TIMEOUT,
MISC_MSE_CHORDMIDDLE,
MISC_MSE_FLAGS
} MiscExtMseValType;
typedef enum {
MISC_KBD_TYPE,
MISC_KBD_RATE,
MISC_KBD_DELAY,
MISC_KBD_SERVNUMLOCK
} MiscExtKbdValType;
typedef enum {
MISC_RET_SUCCESS,
MISC_RET_BADVAL,
MISC_RET_BADMSEPROTO,
MISC_RET_BADBAUDRATE,
MISC_RET_BADFLAGS,
MISC_RET_BADCOMBO,
MISC_RET_BADKBDTYPE,
MISC_RET_NOMODULE
} MiscExtReturn;
typedef enum {
MISC_POINTER,
MISC_KEYBOARD
} MiscExtStructType;
#define MISC_MSEFLAG_CLEARDTR 1
#define MISC_MSEFLAG_CLEARRTS 2
#define MISC_MSEFLAG_REOPEN 128
void XFree86MiscExtensionInit(void);
Bool MiscExtGetMouseSettings(void **mouse, char **devname);
int MiscExtGetMouseValue(void * mouse, MiscExtMseValType valtype);
Bool MiscExtSetMouseValue(void * mouse, MiscExtMseValType valtype, int value);
Bool MiscExtGetKbdSettings(void **kbd);
int MiscExtGetKbdValue(void * kbd, MiscExtKbdValType valtype);
Bool MiscExtSetKbdValue(void * kbd, MiscExtKbdValType valtype, int value);
int MiscExtSetGrabKeysState(ClientPtr client, int enable);
void * MiscExtCreateStruct(MiscExtStructType mse_or_kbd);
void MiscExtDestroyStruct(void * structure, MiscExtStructType mse_or_kbd);
MiscExtReturn MiscExtApply(void * structure, MiscExtStructType mse_or_kbd);
Bool MiscExtSetMouseDevice(void * mouse, char* device);
Bool MiscExtGetFilePaths(const char **configfile, const char **modulepath,
const char **logfile);
int MiscExtPassMessage(int scrn, const char *msgtype, const char *msgval,
char **retstr);
#endif
/* $XFree86: xc/programs/Xserver/Xext/xf86vmode.c,v 3.58 2003/11/06 18:37:57 tsi Exp $ */
/*
Copyright 1995 Kaleb S. KEITHLEY
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL Kaleb S. KEITHLEY 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 Kaleb S. KEITHLEY
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
from Kaleb S. KEITHLEY
*/
/* $XdotOrg: xc/programs/Xserver/Xext/xf86vmode.c,v 1.8 2005/07/16 03:49:58 kem Exp $ */
/* $Xorg: xf86vmode.c,v 1.3 2000/08/17 19:47:59 cpqbld Exp $ */
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#define NEED_REPLIES
#define NEED_EVENTS
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "scrnintstr.h"
#include "servermd.h"
#define _XF86VIDMODE_SERVER_
#include <nx-X11/extensions/xf86vmstr.h>
#include "swaprep.h"
#include "xf86.h"
#include "vidmodeproc.h"
#ifdef EXTMODULE
#include "xf86_ansic.h"
#endif
#define DEFAULT_XF86VIDMODE_VERBOSITY 3
static int VidModeErrorBase;
static int VidModeGeneration = 0;
static int VidModeClientPrivateIndex;
/* This holds the client's version information */
typedef struct {
int major;
int minor;
} VidModePrivRec, *VidModePrivPtr;
#define VMPRIV(c) ((c)->devPrivates[VidModeClientPrivateIndex].ptr)
static void XF86VidModeResetProc(
ExtensionEntry* /* extEntry */
);
static DISPATCH_PROC(ProcXF86VidModeDispatch);
static DISPATCH_PROC(ProcXF86VidModeGetAllModeLines);
static DISPATCH_PROC(ProcXF86VidModeGetModeLine);
static DISPATCH_PROC(ProcXF86VidModeGetMonitor);
static DISPATCH_PROC(ProcXF86VidModeLockModeSwitch);
static DISPATCH_PROC(ProcXF86VidModeAddModeLine);
static DISPATCH_PROC(ProcXF86VidModeDeleteModeLine);
static DISPATCH_PROC(ProcXF86VidModeModModeLine);
static DISPATCH_PROC(ProcXF86VidModeValidateModeLine);
static DISPATCH_PROC(ProcXF86VidModeQueryVersion);
static DISPATCH_PROC(ProcXF86VidModeSwitchMode);
static DISPATCH_PROC(ProcXF86VidModeSwitchToMode);
static DISPATCH_PROC(ProcXF86VidModeGetViewPort);
static DISPATCH_PROC(ProcXF86VidModeSetViewPort);
static DISPATCH_PROC(ProcXF86VidModeGetDotClocks);
static DISPATCH_PROC(ProcXF86VidModeSetGamma);
static DISPATCH_PROC(ProcXF86VidModeGetGamma);
static DISPATCH_PROC(ProcXF86VidModeSetClientVersion);
static DISPATCH_PROC(ProcXF86VidModeGetGammaRamp);
static DISPATCH_PROC(ProcXF86VidModeSetGammaRamp);
static DISPATCH_PROC(ProcXF86VidModeGetGammaRampSize);
static DISPATCH_PROC(SProcXF86VidModeDispatch);
static DISPATCH_PROC(SProcXF86VidModeGetAllModeLines);
static DISPATCH_PROC(SProcXF86VidModeGetModeLine);
static DISPATCH_PROC(SProcXF86VidModeGetMonitor);
static DISPATCH_PROC(SProcXF86VidModeLockModeSwitch);
static DISPATCH_PROC(SProcXF86VidModeAddModeLine);
static DISPATCH_PROC(SProcXF86VidModeDeleteModeLine);
static DISPATCH_PROC(SProcXF86VidModeModModeLine);
static DISPATCH_PROC(SProcXF86VidModeValidateModeLine);
static DISPATCH_PROC(SProcXF86VidModeQueryVersion);
static DISPATCH_PROC(SProcXF86VidModeSwitchMode);
static DISPATCH_PROC(SProcXF86VidModeSwitchToMode);
static DISPATCH_PROC(SProcXF86VidModeGetViewPort);
static DISPATCH_PROC(SProcXF86VidModeSetViewPort);
static DISPATCH_PROC(SProcXF86VidModeGetDotClocks);
static DISPATCH_PROC(SProcXF86VidModeSetGamma);
static DISPATCH_PROC(SProcXF86VidModeGetGamma);
static DISPATCH_PROC(SProcXF86VidModeSetClientVersion);
static DISPATCH_PROC(SProcXF86VidModeGetGammaRamp);
static DISPATCH_PROC(SProcXF86VidModeSetGammaRamp);
static DISPATCH_PROC(SProcXF86VidModeGetGammaRampSize);
#if 0
static unsigned char XF86VidModeReqCode = 0;
#endif
/* The XF86VIDMODE_EVENTS code is far from complete */
#ifdef XF86VIDMODE_EVENTS
static int XF86VidModeEventBase = 0;
static void SXF86VidModeNotifyEvent();
xXF86VidModeNotifyEvent * /* from */,
xXF86VidModeNotifyEvent * /* to */
);
extern WindowPtr *WindowTable;
static RESTYPE EventType; /* resource type for event masks */
typedef struct _XF86VidModeEvent *XF86VidModeEventPtr;
typedef struct _XF86VidModeEvent {
XF86VidModeEventPtr next;
ClientPtr client;
ScreenPtr screen;
XID resource;
CARD32 mask;
} XF86VidModeEventRec;
static int XF86VidModeFreeEvents();
typedef struct _XF86VidModeScreenPrivate {
XF86VidModeEventPtr events;
Bool hasWindow;
} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
static int ScreenPrivateIndex;
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (void *) v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
#define New(t) (xalloc (sizeof (t)))
#endif
#ifdef DEBUG
# define DEBUG_P(x) ErrorF(x"\n");
#else
# define DEBUG_P(x) /**/
#endif
void
XFree86VidModeExtensionInit(void)
{
ExtensionEntry* extEntry;
ScreenPtr pScreen;
int i;
Bool enabled = FALSE;
DEBUG_P("XFree86VidModeExtensionInit");
#ifdef XF86VIDMODE_EVENTS
EventType = CreateNewResourceType(XF86VidModeFreeEvents);
ScreenPrivateIndex = AllocateScreenPrivateIndex ();
#endif
for(i = 0; i < screenInfo.numScreens; i++) {
pScreen = screenInfo.screens[i];
if (VidModeExtensionInit(pScreen))
enabled = TRUE;
#ifdef XF86VIDMODE_EVENTS
SetScreenPrivate (pScreen, NULL);
#endif
}
/* This means that the DDX doesn't want the vidmode extension enabled */
if (!enabled)
return;
/*
* Allocate a client private index to hold the client's version
* information.
*/
if (VidModeGeneration != serverGeneration) {
VidModeClientPrivateIndex = AllocateClientPrivateIndex();
/*
* Allocate 0 length, and use the private to hold a pointer to our
* VidModePrivRec.
*/
if (!AllocateClientPrivate(VidModeClientPrivateIndex, 0)) {
ErrorF("XFree86VidModeExtensionInit: "
"AllocateClientPrivate failed\n");
return;
}
VidModeGeneration = serverGeneration;
}
if (
#ifdef XF86VIDMODE_EVENTS
EventType && ScreenPrivateIndex != -1 &&
#endif
(extEntry = AddExtension(XF86VIDMODENAME,
XF86VidModeNumberEvents,
XF86VidModeNumberErrors,
ProcXF86VidModeDispatch,
SProcXF86VidModeDispatch,
XF86VidModeResetProc,
StandardMinorOpcode))) {
#if 0
XF86VidModeReqCode = (unsigned char)extEntry->base;
#endif
VidModeErrorBase = extEntry->errorBase;
#ifdef XF86VIDMODE_EVENTS
XF86VidModeEventBase = extEntry->eventBase;
EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
#endif
}
}
/*ARGSUSED*/
static void
XF86VidModeResetProc (extEntry)
ExtensionEntry* extEntry;
{
}
static int
ClientMajorVersion(ClientPtr client)
{
VidModePrivPtr pPriv;
pPriv = VMPRIV(client);
if (!pPriv)
return 0;
else
return pPriv->major;
}
#ifdef XF86VIDMODE_EVENTS
static void
CheckScreenPrivate (pScreen)
ScreenPtr pScreen;
{
SetupScreen (pScreen);
if (!pPriv)
return;
if (!pPriv->events && !pPriv->hasWindow) {
xfree (pPriv);
SetScreenPrivate (pScreen, NULL);
}
}
static XF86VidModeScreenPrivatePtr
MakeScreenPrivate (pScreen)
ScreenPtr pScreen;
{
SetupScreen (pScreen);
if (pPriv)
return pPriv;
pPriv = New (XF86VidModeScreenPrivateRec);
if (!pPriv)
return 0;
pPriv->events = 0;
pPriv->hasWindow = FALSE;
SetScreenPrivate (pScreen, pPriv);
return pPriv;
}
static unsigned long
getEventMask (ScreenPtr pScreen, ClientPtr client)
{
SetupScreen(pScreen);
XF86VidModeEventPtr pEv;
if (!pPriv)
return 0;
for (pEv = pPriv->events; pEv; pEv = pEv->next)
if (pEv->client == client)
return pEv->mask;
return 0;
}
static Bool
setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
{
SetupScreen(pScreen);
XF86VidModeEventPtr pEv, *pPrev;
if (getEventMask (pScreen, client) == mask)
return TRUE;
if (!pPriv) {
pPriv = MakeScreenPrivate (pScreen);
if (!pPriv)
return FALSE;
}
for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
if (pEv->client == client)
break;
if (mask == 0) {
*pPrev = pEv->next;
xfree (pEv);
CheckScreenPrivate (pScreen);
} else {
if (!pEv) {
pEv = New (ScreenSaverEventRec);
if (!pEv) {
CheckScreenPrivate (pScreen);
return FALSE;
}
*pPrev = pEv;
pEv->next = NULL;
pEv->client = client;
pEv->screen = pScreen;
pEv->resource = FakeClientID (client->index);
}
pEv->mask = mask;
}
return TRUE;
}
static int
XF86VidModeFreeEvents(void * value, XID id)
{
XF86VidModeEventPtr pOld = (XF86VidModeEventPtr)value;
ScreenPtr pScreen = pOld->screen;
SetupScreen (pScreen);
XF86VidModeEventPtr pEv, *pPrev;
if (!pPriv)
return TRUE;
for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
if (pEv == pOld)
break;
if (!pEv)
return TRUE;
*pPrev = pEv->next;
xfree (pEv);
CheckScreenPrivate (pScreen);
return TRUE;
}
static void
SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
{
XF86VidModeScreenPrivatePtr pPriv;
XF86VidModeEventPtr pEv;
unsigned long mask;
xXF86VidModeNotifyEvent ev;
ClientPtr client;
int kind;
UpdateCurrentTimeIf ();
mask = XF86VidModeNotifyMask;
pScreen = screenInfo.screens[pScreen->myNum];
pPriv = GetScreenPrivate(pScreen);
if (!pPriv)
return;
kind = XF86VidModeModeChange;
for (pEv = pPriv->events; pEv; pEv = pEv->next)
{
client = pEv->client;
if (client->clientGone)
continue;
if (!(pEv->mask & mask))
continue;
ev.type = XF86VidModeNotify + XF86VidModeEventBase;
ev.state = state;
ev.sequenceNumber = client->sequence;
ev.timestamp = currentTime.milliseconds;
ev.root = WindowTable[pScreen->myNum]->drawable.id;
ev.kind = kind;
ev.forced = forced;
WriteEventsToClient (client, 1, (xEvent *) &ev);
}
}
static void
SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent *from,
xXF86VidModeNotifyEvent *to)
{
to->type = from->type;
to->state = from->state;
cpswaps (from->sequenceNumber, to->sequenceNumber);
cpswapl (from->timestamp, to->timestamp);
cpswapl (from->root, to->root);
to->kind = from->kind;
to->forced = from->forced;
}
#endif
static int
ProcXF86VidModeQueryVersion(ClientPtr client)
{
xXF86VidModeQueryVersionReply rep;
register int n;
DEBUG_P("XF86VidModeQueryVersion");
REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XF86VIDMODE_MAJOR_VERSION;
rep.minorVersion = XF86VIDMODE_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86VidModeGetModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeGetModeLineReq);
xXF86VidModeGetModeLineReply rep;
xXF86OldVidModeGetModeLineReply oldrep;
void * mode;
register int n;
int dotClock;
int ver;
DEBUG_P("XF86VidModeGetModeline");
ver = ClientMajorVersion(client);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
rep.type = X_Reply;
if (ver < 2) {
rep.length = (SIZEOF(xXF86OldVidModeGetModeLineReply) -
SIZEOF(xGenericReply)) >> 2;
} else {
rep.length = (SIZEOF(xXF86VidModeGetModeLineReply) -
SIZEOF(xGenericReply)) >> 2;
}
rep.sequenceNumber = client->sequence;
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
return BadValue;
rep.dotclock = dotClock;
rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
rep.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
rep.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
rep.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
rep.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
rep.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
rep.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
rep.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
rep.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("GetModeLine - scrn: %d clock: %ld\n",
stuff->screen, (unsigned long)rep.dotclock);
ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
rep.hdisplay, rep.hsyncstart,
rep.hsyncend, rep.htotal);
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
rep.vdisplay, rep.vsyncstart, rep.vsyncend,
rep.vtotal, (unsigned long)rep.flags);
}
/*
* Older servers sometimes had server privates that the VidMode
* extention made available. So to be compatiable pretend that
* there are no server privates to pass to the client
*/
rep.privsize = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.dotclock, n);
swaps(&rep.hdisplay, n);
swaps(&rep.hsyncstart, n);
swaps(&rep.hsyncend, n);
swaps(&rep.htotal, n);
swaps(&rep.hskew, n);
swaps(&rep.vdisplay, n);
swaps(&rep.vsyncstart, n);
swaps(&rep.vsyncend, n);
swaps(&rep.vtotal, n);
swapl(&rep.flags, n);
swapl(&rep.privsize, n);
}
if (ver < 2) {
oldrep.type = rep.type;
oldrep.sequenceNumber = rep.sequenceNumber;
oldrep.length = rep.length;
oldrep.dotclock = rep.dotclock;
oldrep.hdisplay = rep.hdisplay;
oldrep.hsyncstart = rep.hsyncstart;
oldrep.hsyncend = rep.hsyncend;
oldrep.htotal = rep.htotal;
oldrep.vdisplay = rep.vdisplay;
oldrep.vsyncstart = rep.vsyncstart;
oldrep.vsyncend = rep.vsyncend;
oldrep.vtotal = rep.vtotal;
oldrep.flags = rep.flags;
oldrep.privsize = rep.privsize;
WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
(char *)&oldrep);
} else {
WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
(char *)&rep);
}
return (client->noClientException);
}
static int
ProcXF86VidModeGetAllModeLines(ClientPtr client)
{
REQUEST(xXF86VidModeGetAllModeLinesReq);
xXF86VidModeGetAllModeLinesReply rep;
xXF86VidModeModeInfo mdinf;
xXF86OldVidModeModeInfo oldmdinf;
void * mode;
int modecount, dotClock;
register int n;
int ver;
DEBUG_P("XF86VidModeGetAllModelines");
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
ver = ClientMajorVersion(client);
modecount = VidModeGetNumOfModes(stuff->screen);
if (modecount < 1)
return (VidModeErrorBase + XF86VidModeExtensionDisabled);
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
return BadValue;
rep.type = X_Reply;
rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
SIZEOF(xGenericReply);
if (ver < 2)
rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
else
rep.length += modecount * sizeof(xXF86VidModeModeInfo);
rep.length >>= 2;
rep.sequenceNumber = client->sequence;
rep.modecount = modecount;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.modecount, n);
}
WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), (char *)&rep);
do {
mdinf.dotclock = dotClock;
mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
mdinf.privsize = 0;
if (client->swapped) {
swapl(&mdinf.dotclock, n);
swaps(&mdinf.hdisplay, n);
swaps(&mdinf.hsyncstart, n);
swaps(&mdinf.hsyncend, n);
swaps(&mdinf.htotal, n);
swaps(&mdinf.hskew, n);
swaps(&mdinf.vdisplay, n);
swaps(&mdinf.vsyncstart, n);
swaps(&mdinf.vsyncend, n);
swaps(&mdinf.vtotal, n);
swapl(&mdinf.flags, n);
swapl(&mdinf.privsize, n);
}
if (ver < 2) {
oldmdinf.dotclock = mdinf.dotclock;
oldmdinf.hdisplay = mdinf.hdisplay;
oldmdinf.hsyncstart = mdinf.hsyncstart;
oldmdinf.hsyncend = mdinf.hsyncend;
oldmdinf.htotal = mdinf.htotal;
oldmdinf.vdisplay = mdinf.vdisplay;
oldmdinf.vsyncstart = mdinf.vsyncstart;
oldmdinf.vsyncend = mdinf.vsyncend;
oldmdinf.vtotal = mdinf.vtotal;
oldmdinf.flags = mdinf.flags;
oldmdinf.privsize = mdinf.privsize;
WriteToClient(client, sizeof(xXF86OldVidModeModeInfo),
(char *)&oldmdinf);
} else {
WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf);
}
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return (client->noClientException);
}
#define MODEMATCH(mode,stuff) \
(VidModeGetModeValue(mode, VIDMODE_H_DISPLAY) == stuff->hdisplay \
&& VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART) == stuff->hsyncstart \
&& VidModeGetModeValue(mode, VIDMODE_H_SYNCEND) == stuff->hsyncend \
&& VidModeGetModeValue(mode, VIDMODE_H_TOTAL) == stuff->htotal \
&& VidModeGetModeValue(mode, VIDMODE_V_DISPLAY) == stuff->vdisplay \
&& VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART) == stuff->vsyncstart \
&& VidModeGetModeValue(mode, VIDMODE_V_SYNCEND) == stuff->vsyncend \
&& VidModeGetModeValue(mode, VIDMODE_V_TOTAL) == stuff->vtotal \
&& VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
static int
ProcXF86VidModeAddModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeAddModeLineReq);
xXF86OldVidModeAddModeLineReq *oldstuff =
(xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
xXF86VidModeAddModeLineReq newstuff;
void * mode;
int len;
int dotClock;
int ver;
DEBUG_P("XF86VidModeAddModeline");
ver = ClientMajorVersion(client);
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
stuff->hsyncstart = oldstuff->hsyncstart;
stuff->hsyncend = oldstuff->hsyncend;
stuff->htotal = oldstuff->htotal;
stuff->hskew = 0;
stuff->vdisplay = oldstuff->vdisplay;
stuff->vsyncstart = oldstuff->vsyncstart;
stuff->vsyncend = oldstuff->vsyncend;
stuff->vtotal = oldstuff->vtotal;
stuff->flags = oldstuff->flags;
stuff->privsize = oldstuff->privsize;
stuff->after_dotclock = oldstuff->after_dotclock;
stuff->after_hdisplay = oldstuff->after_hdisplay;
stuff->after_hsyncstart = oldstuff->after_hsyncstart;
stuff->after_hsyncend = oldstuff->after_hsyncend;
stuff->after_htotal = oldstuff->after_htotal;
stuff->after_hskew = 0;
stuff->after_vdisplay = oldstuff->after_vdisplay;
stuff->after_vsyncstart = oldstuff->after_vsyncstart;
stuff->after_vsyncend = oldstuff->after_vsyncend;
stuff->after_vtotal = oldstuff->after_vtotal;
stuff->after_flags = oldstuff->after_flags;
}
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("AddModeLine - scrn: %d clock: %ld\n",
(int)stuff->screen, (unsigned long)stuff->dotclock);
ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
stuff->hdisplay, stuff->hsyncstart,
stuff->hsyncend, stuff->htotal);
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, (unsigned long)stuff->flags);
ErrorF(" after - scrn: %d clock: %ld\n",
(int)stuff->screen, (unsigned long)stuff->after_dotclock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
stuff->after_hdisplay, stuff->after_hsyncstart,
stuff->after_hsyncend, stuff->after_htotal);
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
stuff->after_vdisplay, stuff->after_vsyncstart,
stuff->after_vsyncend, stuff->after_vtotal,
(unsigned long)stuff->after_flags);
}
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
len = client->req_len - (sizeof(xXF86OldVidModeAddModeLineReq) >> 2);
} else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
len = client->req_len - (sizeof(xXF86VidModeAddModeLineReq) >> 2);
}
if (len != stuff->privsize)
return BadLength;
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (stuff->hsyncstart < stuff->hdisplay ||
stuff->hsyncend < stuff->hsyncstart ||
stuff->htotal < stuff->hsyncend ||
stuff->vsyncstart < stuff->vdisplay ||
stuff->vsyncend < stuff->vsyncstart ||
stuff->vtotal < stuff->vsyncend)
return BadValue;
if (stuff->after_hsyncstart < stuff->after_hdisplay ||
stuff->after_hsyncend < stuff->after_hsyncstart ||
stuff->after_htotal < stuff->after_hsyncend ||
stuff->after_vsyncstart < stuff->after_vdisplay ||
stuff->after_vsyncend < stuff->after_vsyncstart ||
stuff->after_vtotal < stuff->after_vsyncend)
return BadValue;
if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
Bool found = FALSE;
if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
do {
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
== dotClock) && MODEMATCH(mode, stuff)) {
found = TRUE;
break;
}
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
}
if (!found)
return BadValue;
}
mode = VidModeCreateMode();
if (mode == NULL)
return BadValue;
VidModeSetModeValue(mode, VIDMODE_CLOCK, stuff->dotclock);
VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
ErrorF("AddModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
case MODE_OK:
break;
case MODE_HSYNC:
case MODE_H_ILLEGAL:
xfree(mode);
return VidModeErrorBase + XF86VidModeBadHTimings;
case MODE_VSYNC:
case MODE_V_ILLEGAL:
xfree(mode);
return VidModeErrorBase + XF86VidModeBadVTimings;
default:
xfree(mode);
return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
/* Check that the driver is happy with the mode */
if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
xfree(mode);
return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
VidModeSetCrtcForMode(stuff->screen, mode);
VidModeAddModeline(stuff->screen, mode);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
ErrorF("AddModeLine - Succeeded\n");
return client->noClientException;
}
static int
ProcXF86VidModeDeleteModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeDeleteModeLineReq);
xXF86OldVidModeDeleteModeLineReq *oldstuff =
(xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
xXF86VidModeDeleteModeLineReq newstuff;
void * mode;
int len, dotClock;
int ver;
DEBUG_P("XF86VidModeDeleteModeline");
ver = ClientMajorVersion(client);
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
stuff->hsyncstart = oldstuff->hsyncstart;
stuff->hsyncend = oldstuff->hsyncend;
stuff->htotal = oldstuff->htotal;
stuff->hskew = 0;
stuff->vdisplay = oldstuff->vdisplay;
stuff->vsyncstart = oldstuff->vsyncstart;
stuff->vsyncend = oldstuff->vsyncend;
stuff->vtotal = oldstuff->vtotal;
stuff->flags = oldstuff->flags;
stuff->privsize = oldstuff->privsize;
}
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("DeleteModeLine - scrn: %d clock: %ld\n",
(int)stuff->screen, (unsigned long)stuff->dotclock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
stuff->hdisplay, stuff->hsyncstart,
stuff->hsyncend, stuff->htotal);
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, (unsigned long)stuff->flags);
}
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
len = client->req_len - (sizeof(xXF86OldVidModeDeleteModeLineReq) >> 2);
} else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
len = client->req_len - (sizeof(xXF86VidModeDeleteModeLineReq) >> 2);
}
if (len != stuff->privsize) {
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, "
"len = %d, length = %d\n",
(unsigned long)client->req_len,
(int)sizeof(xXF86VidModeDeleteModeLineReq)>>2,
(unsigned long)stuff->privsize, len, stuff->length);
}
return BadLength;
}
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
return BadValue;
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("Checking against clock: %d (%d)\n",
VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
VidModeGetModeValue(mode, VIDMODE_FLAGS));
}
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
MODEMATCH(mode, stuff))
return BadValue;
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
return BadValue;
do {
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("Checking against clock: %d (%d)\n",
VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
VidModeGetModeValue(mode, VIDMODE_FLAGS));
}
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
MODEMATCH(mode, stuff)) {
VidModeDeleteModeline(stuff->screen, mode);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
ErrorF("DeleteModeLine - Succeeded\n");
return(client->noClientException);
}
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return BadValue;
}
static int
ProcXF86VidModeModModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeModModeLineReq);
xXF86OldVidModeModModeLineReq *oldstuff =
(xXF86OldVidModeModModeLineReq *)client->requestBuffer;
xXF86VidModeModModeLineReq newstuff;
void * mode, modetmp;
int len, dotClock;
int ver;
DEBUG_P("XF86VidModeModModeline");
ver = ClientMajorVersion(client);
if (ver < 2 ) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->hdisplay = oldstuff->hdisplay;
stuff->hsyncstart = oldstuff->hsyncstart;
stuff->hsyncend = oldstuff->hsyncend;
stuff->htotal = oldstuff->htotal;
stuff->hskew = 0;
stuff->vdisplay = oldstuff->vdisplay;
stuff->vsyncstart = oldstuff->vsyncstart;
stuff->vsyncend = oldstuff->vsyncend;
stuff->vtotal = oldstuff->vtotal;
stuff->flags = oldstuff->flags;
stuff->privsize = oldstuff->privsize;
}
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
(int)stuff->screen, stuff->hdisplay, stuff->hsyncstart,
stuff->hsyncend, stuff->htotal);
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, (unsigned long)stuff->flags);
}
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
len = client->req_len - (sizeof(xXF86OldVidModeModModeLineReq) >> 2);
} else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
len = client->req_len - (sizeof(xXF86VidModeModModeLineReq) >> 2);
}
if (len != stuff->privsize)
return BadLength;
if (stuff->hsyncstart < stuff->hdisplay ||
stuff->hsyncend < stuff->hsyncstart ||
stuff->htotal < stuff->hsyncend ||
stuff->vsyncstart < stuff->vdisplay ||
stuff->vsyncend < stuff->vsyncstart ||
stuff->vtotal < stuff->vsyncend)
return BadValue;
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
return BadValue;
modetmp = VidModeCreateMode();
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
ErrorF("ModModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
case MODE_OK:
break;
case MODE_HSYNC:
case MODE_H_ILLEGAL:
xfree(modetmp);
return VidModeErrorBase + XF86VidModeBadHTimings;
case MODE_VSYNC:
case MODE_V_ILLEGAL:
xfree(modetmp);
return VidModeErrorBase + XF86VidModeBadVTimings;
default:
xfree(modetmp);
return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
/* Check that the driver is happy with the mode */
if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
xfree(modetmp);
return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
xfree(modetmp);
VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
VidModeSetCrtcForMode(stuff->screen, mode);
VidModeSwitchMode(stuff->screen, mode);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
ErrorF("ModModeLine - Succeeded\n");
return(client->noClientException);
}
static int
ProcXF86VidModeValidateModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeValidateModeLineReq);
xXF86OldVidModeValidateModeLineReq *oldstuff =
(xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
xXF86VidModeValidateModeLineReq newstuff;
xXF86VidModeValidateModeLineReply rep;
void * mode, modetmp = NULL;
int len, status, dotClock;
int ver;
DEBUG_P("XF86VidModeValidateModeline");
ver = ClientMajorVersion(client);
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
stuff->hsyncstart = oldstuff->hsyncstart;
stuff->hsyncend = oldstuff->hsyncend;
stuff->htotal = oldstuff->htotal;
stuff->hskew = 0;
stuff->vdisplay = oldstuff->vdisplay;
stuff->vsyncstart = oldstuff->vsyncstart;
stuff->vsyncend = oldstuff->vsyncend;
stuff->vtotal = oldstuff->vtotal;
stuff->flags = oldstuff->flags;
stuff->privsize = oldstuff->privsize;
}
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("ValidateModeLine - scrn: %d clock: %ld\n",
(int)stuff->screen, (unsigned long)stuff->dotclock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
stuff->hdisplay, stuff->hsyncstart,
stuff->hsyncend, stuff->htotal);
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, (unsigned long)stuff->flags);
}
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
len = client->req_len -
(sizeof(xXF86OldVidModeValidateModeLineReq) >> 2);
} else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
len = client->req_len - (sizeof(xXF86VidModeValidateModeLineReq) >> 2);
}
if (len != stuff->privsize)
return BadLength;
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
status = MODE_OK;
if (stuff->hsyncstart < stuff->hdisplay ||
stuff->hsyncend < stuff->hsyncstart ||
stuff->htotal < stuff->hsyncend ||
stuff->vsyncstart < stuff->vdisplay ||
stuff->vsyncend < stuff->vsyncstart ||
stuff->vtotal < stuff->vsyncend)
{
status = MODE_BAD;
goto status_reply;
}
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
return BadValue;
modetmp = VidModeCreateMode();
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
ErrorF("ValidateModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
if ((status = VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
goto status_reply;
/* Check that the driver is happy with the mode */
status = VidModeCheckModeForDriver(stuff->screen, modetmp);
status_reply:
if(modetmp)
xfree(modetmp);
rep.type = X_Reply;
rep.length = (SIZEOF(xXF86VidModeValidateModeLineReply)
- SIZEOF(xGenericReply)) >> 2;
rep.sequenceNumber = client->sequence;
rep.status = status;
if (client->swapped) {
register int n;
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.status, n);
}
WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
return(client->noClientException);
}
static int
ProcXF86VidModeSwitchMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchModeReq);
DEBUG_P("XF86VidModeSwitchMode");
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
VidModeZoomViewport(stuff->screen, (short)stuff->zoom);
return (client->noClientException);
}
static int
ProcXF86VidModeSwitchToMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchToModeReq);
xXF86OldVidModeSwitchToModeReq *oldstuff =
(xXF86OldVidModeSwitchToModeReq *)client->requestBuffer;
xXF86VidModeSwitchToModeReq newstuff;
void * mode;
int len, dotClock;
int ver;
DEBUG_P("XF86VidModeSwitchToMode");
ver = ClientMajorVersion(client);
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
stuff->hsyncstart = oldstuff->hsyncstart;
stuff->hsyncend = oldstuff->hsyncend;
stuff->htotal = oldstuff->htotal;
stuff->hskew = 0;
stuff->vdisplay = oldstuff->vdisplay;
stuff->vsyncstart = oldstuff->vsyncstart;
stuff->vsyncend = oldstuff->vsyncend;
stuff->vtotal = oldstuff->vtotal;
stuff->flags = oldstuff->flags;
stuff->privsize = oldstuff->privsize;
}
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("SwitchToMode - scrn: %d clock: %ld\n",
(int)stuff->screen, (unsigned long)stuff->dotclock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
stuff->hdisplay, stuff->hsyncstart,
stuff->hsyncend, stuff->htotal);
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, (unsigned long)stuff->flags);
}
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
len = client->req_len - (sizeof(xXF86OldVidModeSwitchToModeReq) >> 2);
} else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
len = client->req_len - (sizeof(xXF86VidModeSwitchToModeReq) >> 2);
}
if (len != stuff->privsize)
return BadLength;
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
return BadValue;
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
&& MODEMATCH(mode, stuff))
return (client->noClientException);
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
return BadValue;
do {
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
ErrorF("Checking against clock: %d (%d)\n",
VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
VidModeGetModeValue(mode, VIDMODE_FLAGS));
}
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
MODEMATCH(mode, stuff)) {
if (!VidModeSwitchMode(stuff->screen, mode))
return BadValue;
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
ErrorF("SwitchToMode - Succeeded\n");
return(client->noClientException);
}
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return BadValue;
}
static int
ProcXF86VidModeLockModeSwitch(ClientPtr client)
{
REQUEST(xXF86VidModeLockModeSwitchReq);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
DEBUG_P("XF86VidModeLockModeSwitch");
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeLockZoom(stuff->screen, (short)stuff->lock))
return VidModeErrorBase + XF86VidModeZoomLocked;
return (client->noClientException);
}
static int
ProcXF86VidModeGetMonitor(ClientPtr client)
{
REQUEST(xXF86VidModeGetMonitorReq);
xXF86VidModeGetMonitorReply rep;
register int n;
CARD32 *hsyncdata, *vsyncdata;
int i, nHsync, nVrefresh;
void * monitor;
DEBUG_P("XF86VidModeGetMonitor");
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetMonitor(stuff->screen, &monitor))
return BadValue;
nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
rep.type = X_Reply;
if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
rep.vendorLength = strlen((char *)(VidModeGetMonitorValue(monitor,
VIDMODE_MON_VENDOR, 0)).ptr);
else
rep.vendorLength = 0;
if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
rep.modelLength = strlen((char *)(VidModeGetMonitorValue(monitor,
VIDMODE_MON_MODEL, 0)).ptr);
else
rep.modelLength = 0;
rep.length = (SIZEOF(xXF86VidModeGetMonitorReply) - SIZEOF(xGenericReply) +
(nHsync + nVrefresh) * sizeof(CARD32) +
((rep.vendorLength + 3) & ~3) +
((rep.modelLength + 3) & ~3)) >> 2;
rep.sequenceNumber = client->sequence;
rep.nhsync = nHsync;
rep.nvsync = nVrefresh;
hsyncdata = ALLOCATE_LOCAL(nHsync * sizeof(CARD32));
if (!hsyncdata) {
return BadAlloc;
}
vsyncdata = ALLOCATE_LOCAL(nVrefresh * sizeof(CARD32));
if (!vsyncdata) {
DEALLOCATE_LOCAL(hsyncdata);
return BadAlloc;
}
for (i = 0; i < nHsync; i++) {
hsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
VIDMODE_MON_HSYNC_LO, i)).f |
(unsigned short)(VidModeGetMonitorValue(monitor,
VIDMODE_MON_HSYNC_HI, i)).f << 16;
}
for (i = 0; i < nVrefresh; i++) {
vsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
VIDMODE_MON_VREFRESH_LO, i)).f |
(unsigned short)(VidModeGetMonitorValue(monitor,
VIDMODE_MON_VREFRESH_HI, i)).f << 16;
}
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
}
WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nHsync * sizeof(CARD32),
hsyncdata);
WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32),
vsyncdata);
if (rep.vendorLength)
WriteToClient(client, rep.vendorLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr);
if (rep.modelLength)
WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
DEALLOCATE_LOCAL(hsyncdata);
DEALLOCATE_LOCAL(vsyncdata);
return (client->noClientException);
}
static int
ProcXF86VidModeGetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeGetViewPortReq);
xXF86VidModeGetViewPortReply rep;
int x, y, n;
DEBUG_P("XF86VidModeGetViewPort");
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
VidModeGetViewPort(stuff->screen, &x, &y);
rep.x = x;
rep.y = y;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.x, n);
swapl(&rep.y, n);
}
WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86VidModeSetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeSetViewPortReq);
DEBUG_P("XF86VidModeSetViewPort");
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
return BadValue;
return (client->noClientException);
}
static int
ProcXF86VidModeGetDotClocks(ClientPtr client)
{
REQUEST(xXF86VidModeGetDotClocksReq);
xXF86VidModeGetDotClocksReply rep;
register int n;
int numClocks;
CARD32 dotclock;
int *Clocks = NULL;
Bool ClockProg;
DEBUG_P("XF86VidModeGetDotClocks");
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
rep.type = X_Reply;
rep.length = (SIZEOF(xXF86VidModeGetDotClocksReply)
- SIZEOF(xGenericReply) + numClocks) >> 2;
rep.sequenceNumber = client->sequence;
rep.clocks = numClocks;
rep.maxclocks = MAXCLOCKS;
rep.flags = 0;
if (!ClockProg) {
Clocks = ALLOCATE_LOCAL(numClocks * sizeof(int));
if (!Clocks)
return BadValue;
if (!VidModeGetClocks(stuff->screen, Clocks)) {
DEALLOCATE_LOCAL(Clocks);
return BadValue;
}
}
if (ClockProg) {
rep.flags |= CLKFLAG_PROGRAMABLE;
}
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.clocks, n);
swapl(&rep.maxclocks, n);
swapl(&rep.flags, n);
}
WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *)&rep);
if (!ClockProg) {
for (n = 0; n < numClocks; n++) {
dotclock = *Clocks++;
if (client->swapped) {
WriteSwappedDataToClient(client, 4, (char *)&dotclock);
} else {
WriteToClient(client, 4, (char *)&dotclock);
}
}
}
DEALLOCATE_LOCAL(Clocks);
return (client->noClientException);
}
static int
ProcXF86VidModeSetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeSetGammaReq);
DEBUG_P("XF86VidModeSetGamma");
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeSetGamma(stuff->screen, ((float)stuff->red)/10000.,
((float)stuff->green)/10000., ((float)stuff->blue)/10000.))
return BadValue;
return (client->noClientException);
}
static int
ProcXF86VidModeGetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaReq);
xXF86VidModeGetGammaReply rep;
register int n;
float red, green, blue;
DEBUG_P("XF86VidModeGetGamma");
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
return BadValue;
rep.red = (CARD32)(red * 10000.);
rep.green = (CARD32)(green * 10000.);
rep.blue = (CARD32)(blue * 10000.);
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.red, n);
swapl(&rep.green, n);
swapl(&rep.blue, n);
}
WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcXF86VidModeSetGammaRamp(ClientPtr client)
{
CARD16 *r, *g, *b;
int length;
REQUEST(xXF86VidModeSetGammaRampReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
return BadValue;
length = (stuff->size + 1) & ~1;
REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
r = (CARD16*)&stuff[1];
g = r + length;
b = g + length;
if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
return BadValue;
return (client->noClientException);
}
static int
ProcXF86VidModeGetGammaRamp(ClientPtr client)
{
CARD16 *ramp = NULL;
int n, length, i;
xXF86VidModeGetGammaRampReply rep;
REQUEST(xXF86VidModeGetGammaRampReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
return BadValue;
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
length = (stuff->size + 1) & ~1;
if(stuff->size) {
if(!(ramp = xalloc(length * 3 * sizeof(CARD16))))
return BadAlloc;
if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
ramp, ramp + length, ramp + (length * 2)))
return BadValue;
}
rep.type = X_Reply;
rep.length = (length >> 1) * 3;
rep.sequenceNumber = client->sequence;
rep.size = stuff->size;
if(client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.size, n);
for(i = 0; i < length * 3; i++)
swaps(&ramp[i],n);
}
WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *)&rep);
if(stuff->size) {
WriteToClient(client, rep.length << 2, (char*)ramp);
xfree(ramp);
}
return (client->noClientException);
}
static int
ProcXF86VidModeGetGammaRampSize(ClientPtr client)
{
xXF86VidModeGetGammaRampSizeReply rep;
int n;
REQUEST(xXF86VidModeGetGammaRampSizeReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.size = VidModeGetGammaRampSize(stuff->screen);
if(client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.size, n);
}
WriteToClient(client,sizeof(xXF86VidModeGetGammaRampSizeReply),(char*)&rep);
return (client->noClientException);
}
static int
ProcXF86VidModeGetPermissions(ClientPtr client)
{
xXF86VidModeGetPermissionsReply rep;
int n;
REQUEST(xXF86VidModeGetPermissionsReq);
if(stuff->screen >= screenInfo.numScreens)
return BadValue;
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.permissions = XF86VM_READ_PERMISSION;
if (xf86GetVidModeEnabled() &&
(xf86GetVidModeAllowNonLocal() || LocalClient (client))) {
rep.permissions |= XF86VM_WRITE_PERMISSION;
}
if(client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.permissions, n);
}
WriteToClient(client,sizeof(xXF86VidModeGetPermissionsReply),(char*)&rep);
return (client->noClientException);
}
static int
ProcXF86VidModeSetClientVersion(ClientPtr client)
{
REQUEST(xXF86VidModeSetClientVersionReq);
VidModePrivPtr pPriv;
DEBUG_P("XF86VidModeSetClientVersion");
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
if ((pPriv = VMPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(VidModePrivRec));
if (!pPriv)
return BadAlloc;
VMPRIV(client) = pPriv;
}
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
return (client->noClientException);
}
static int
ProcXF86VidModeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XF86VidModeQueryVersion:
return ProcXF86VidModeQueryVersion(client);
case X_XF86VidModeGetModeLine:
return ProcXF86VidModeGetModeLine(client);
case X_XF86VidModeGetMonitor:
return ProcXF86VidModeGetMonitor(client);
case X_XF86VidModeGetAllModeLines:
return ProcXF86VidModeGetAllModeLines(client);
case X_XF86VidModeValidateModeLine:
return ProcXF86VidModeValidateModeLine(client);
case X_XF86VidModeGetViewPort:
return ProcXF86VidModeGetViewPort(client);
case X_XF86VidModeGetDotClocks:
return ProcXF86VidModeGetDotClocks(client);
case X_XF86VidModeSetClientVersion:
return ProcXF86VidModeSetClientVersion(client);
case X_XF86VidModeGetGamma:
return ProcXF86VidModeGetGamma(client);
case X_XF86VidModeGetGammaRamp:
return ProcXF86VidModeGetGammaRamp(client);
case X_XF86VidModeGetGammaRampSize:
return ProcXF86VidModeGetGammaRampSize(client);
case X_XF86VidModeGetPermissions:
return ProcXF86VidModeGetPermissions(client);
default:
if (!xf86GetVidModeEnabled())
return VidModeErrorBase + XF86VidModeExtensionDisabled;
if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
switch (stuff->data) {
case X_XF86VidModeAddModeLine:
return ProcXF86VidModeAddModeLine(client);
case X_XF86VidModeDeleteModeLine:
return ProcXF86VidModeDeleteModeLine(client);
case X_XF86VidModeModModeLine:
return ProcXF86VidModeModModeLine(client);
case X_XF86VidModeSwitchMode:
return ProcXF86VidModeSwitchMode(client);
case X_XF86VidModeSwitchToMode:
return ProcXF86VidModeSwitchToMode(client);
case X_XF86VidModeLockModeSwitch:
return ProcXF86VidModeLockModeSwitch(client);
case X_XF86VidModeSetViewPort:
return ProcXF86VidModeSetViewPort(client);
case X_XF86VidModeSetGamma:
return ProcXF86VidModeSetGamma(client);
case X_XF86VidModeSetGammaRamp:
return ProcXF86VidModeSetGammaRamp(client);
default:
return BadRequest;
}
} else
return VidModeErrorBase + XF86VidModeClientNotLocal;
}
}
static int
SProcXF86VidModeQueryVersion(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeQueryVersionReq);
swaps(&stuff->length, n);
return ProcXF86VidModeQueryVersion(client);
}
static int
SProcXF86VidModeGetModeLine(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetModeLineReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetModeLine(client);
}
static int
SProcXF86VidModeGetAllModeLines(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetAllModeLines(client);
}
static int
SProcXF86VidModeAddModeLine(ClientPtr client)
{
xXF86OldVidModeAddModeLineReq *oldstuff =
(xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
int ver;
register int n;
REQUEST(xXF86VidModeAddModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
swapl(&oldstuff->screen, n);
swaps(&oldstuff->hdisplay, n);
swaps(&oldstuff->hsyncstart, n);
swaps(&oldstuff->hsyncend, n);
swaps(&oldstuff->htotal, n);
swaps(&oldstuff->vdisplay, n);
swaps(&oldstuff->vsyncstart, n);
swaps(&oldstuff->vsyncend, n);
swaps(&oldstuff->vtotal, n);
swapl(&oldstuff->flags, n);
swapl(&oldstuff->privsize, n);
SwapRestL(oldstuff);
} else {
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
swapl(&stuff->screen, n);
swaps(&stuff->hdisplay, n);
swaps(&stuff->hsyncstart, n);
swaps(&stuff->hsyncend, n);
swaps(&stuff->htotal, n);
swaps(&stuff->hskew, n);
swaps(&stuff->vdisplay, n);
swaps(&stuff->vsyncstart, n);
swaps(&stuff->vsyncend, n);
swaps(&stuff->vtotal, n);
swapl(&stuff->flags, n);
swapl(&stuff->privsize, n);
SwapRestL(stuff);
}
return ProcXF86VidModeAddModeLine(client);
}
static int
SProcXF86VidModeDeleteModeLine(ClientPtr client)
{
xXF86OldVidModeDeleteModeLineReq *oldstuff =
(xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
int ver;
register int n;
REQUEST(xXF86VidModeDeleteModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
swapl(&oldstuff->screen, n);
swaps(&oldstuff->hdisplay, n);
swaps(&oldstuff->hsyncstart, n);
swaps(&oldstuff->hsyncend, n);
swaps(&oldstuff->htotal, n);
swaps(&oldstuff->vdisplay, n);
swaps(&oldstuff->vsyncstart, n);
swaps(&oldstuff->vsyncend, n);
swaps(&oldstuff->vtotal, n);
swapl(&oldstuff->flags, n);
swapl(&oldstuff->privsize, n);
SwapRestL(oldstuff);
} else {
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
swapl(&stuff->screen, n);
swaps(&stuff->hdisplay, n);
swaps(&stuff->hsyncstart, n);
swaps(&stuff->hsyncend, n);
swaps(&stuff->htotal, n);
swaps(&stuff->hskew, n);
swaps(&stuff->vdisplay, n);
swaps(&stuff->vsyncstart, n);
swaps(&stuff->vsyncend, n);
swaps(&stuff->vtotal, n);
swapl(&stuff->flags, n);
swapl(&stuff->privsize, n);
SwapRestL(stuff);
}
return ProcXF86VidModeDeleteModeLine(client);
}
static int
SProcXF86VidModeModModeLine(ClientPtr client)
{
xXF86OldVidModeModModeLineReq *oldstuff =
(xXF86OldVidModeModModeLineReq *)client->requestBuffer;
int ver;
register int n;
REQUEST(xXF86VidModeModModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
swapl(&oldstuff->screen, n);
swaps(&oldstuff->hdisplay, n);
swaps(&oldstuff->hsyncstart, n);
swaps(&oldstuff->hsyncend, n);
swaps(&oldstuff->htotal, n);
swaps(&oldstuff->vdisplay, n);
swaps(&oldstuff->vsyncstart, n);
swaps(&oldstuff->vsyncend, n);
swaps(&oldstuff->vtotal, n);
swapl(&oldstuff->flags, n);
swapl(&oldstuff->privsize, n);
SwapRestL(oldstuff);
} else {
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
swapl(&stuff->screen, n);
swaps(&stuff->hdisplay, n);
swaps(&stuff->hsyncstart, n);
swaps(&stuff->hsyncend, n);
swaps(&stuff->htotal, n);
swaps(&stuff->hskew, n);
swaps(&stuff->vdisplay, n);
swaps(&stuff->vsyncstart, n);
swaps(&stuff->vsyncend, n);
swaps(&stuff->vtotal, n);
swapl(&stuff->flags, n);
swapl(&stuff->privsize, n);
SwapRestL(stuff);
}
return ProcXF86VidModeModModeLine(client);
}
static int
SProcXF86VidModeValidateModeLine(ClientPtr client)
{
xXF86OldVidModeValidateModeLineReq *oldstuff =
(xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
int ver;
register int n;
REQUEST(xXF86VidModeValidateModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
swapl(&oldstuff->screen, n);
swaps(&oldstuff->hdisplay, n);
swaps(&oldstuff->hsyncstart, n);
swaps(&oldstuff->hsyncend, n);
swaps(&oldstuff->htotal, n);
swaps(&oldstuff->vdisplay, n);
swaps(&oldstuff->vsyncstart, n);
swaps(&oldstuff->vsyncend, n);
swaps(&oldstuff->vtotal, n);
swapl(&oldstuff->flags, n);
swapl(&oldstuff->privsize, n);
SwapRestL(oldstuff);
} else {
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
swapl(&stuff->screen, n);
swaps(&stuff->hdisplay, n);
swaps(&stuff->hsyncstart, n);
swaps(&stuff->hsyncend, n);
swaps(&stuff->htotal, n);
swaps(&stuff->hskew, n);
swaps(&stuff->vdisplay, n);
swaps(&stuff->vsyncstart, n);
swaps(&stuff->vsyncend, n);
swaps(&stuff->vtotal, n);
swapl(&stuff->flags, n);
swapl(&stuff->privsize, n);
SwapRestL(stuff);
}
return ProcXF86VidModeValidateModeLine(client);
}
static int
SProcXF86VidModeSwitchMode(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeSwitchModeReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
swaps(&stuff->screen, n);
swaps(&stuff->zoom, n);
return ProcXF86VidModeSwitchMode(client);
}
static int
SProcXF86VidModeSwitchToMode(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeSwitchToModeReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeSwitchToMode(client);
}
static int
SProcXF86VidModeLockModeSwitch(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->screen, n);
swaps(&stuff->lock, n);
return ProcXF86VidModeLockModeSwitch(client);
}
static int
SProcXF86VidModeGetMonitor(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetMonitorReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetMonitor(client);
}
static int
SProcXF86VidModeGetViewPort(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetViewPortReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetViewPort(client);
}
static int
SProcXF86VidModeSetViewPort(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeSetViewPortReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
swaps(&stuff->screen, n);
swapl(&stuff->x, n);
swapl(&stuff->y, n);
return ProcXF86VidModeSetViewPort(client);
}
static int
SProcXF86VidModeGetDotClocks(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetDotClocksReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetDotClocks(client);
}
static int
SProcXF86VidModeSetClientVersion(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeSetClientVersionReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
swaps(&stuff->major, n);
swaps(&stuff->minor, n);
return ProcXF86VidModeSetClientVersion(client);
}
static int
SProcXF86VidModeSetGamma(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeSetGammaReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
swaps(&stuff->screen, n);
swapl(&stuff->red, n);
swapl(&stuff->green, n);
swapl(&stuff->blue, n);
return ProcXF86VidModeSetGamma(client);
}
static int
SProcXF86VidModeGetGamma(ClientPtr client)
{
register int n;
REQUEST(xXF86VidModeGetGammaReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetGamma(client);
}
static int
SProcXF86VidModeSetGammaRamp(ClientPtr client)
{
CARD16 *ramp;
int length, n;
REQUEST(xXF86VidModeSetGammaRampReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
swaps(&stuff->size, n);
swaps(&stuff->screen, n);
length = ((stuff->size + 1) & ~1) * 6;
REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
ramp = (CARD16*)&stuff[1];
while(length--) {
swaps(ramp, n);
ramp++;
}
return ProcXF86VidModeSetGammaRamp(client);
}
static int
SProcXF86VidModeGetGammaRamp(ClientPtr client)
{
int n;
REQUEST(xXF86VidModeGetGammaRampReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
swaps(&stuff->size, n);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetGammaRamp(client);
}
static int
SProcXF86VidModeGetGammaRampSize(ClientPtr client)
{
int n;
REQUEST(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetGammaRampSize(client);
}
static int
SProcXF86VidModeGetPermissions(ClientPtr client)
{
int n;
REQUEST(xXF86VidModeGetPermissionsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
swaps(&stuff->screen, n);
return ProcXF86VidModeGetPermissions(client);
}
static int
SProcXF86VidModeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XF86VidModeQueryVersion:
return SProcXF86VidModeQueryVersion(client);
case X_XF86VidModeGetModeLine:
return SProcXF86VidModeGetModeLine(client);
case X_XF86VidModeGetMonitor:
return SProcXF86VidModeGetMonitor(client);
case X_XF86VidModeGetAllModeLines:
return SProcXF86VidModeGetAllModeLines(client);
case X_XF86VidModeGetViewPort:
return SProcXF86VidModeGetViewPort(client);
case X_XF86VidModeValidateModeLine:
return SProcXF86VidModeValidateModeLine(client);
case X_XF86VidModeGetDotClocks:
return SProcXF86VidModeGetDotClocks(client);
case X_XF86VidModeSetClientVersion:
return SProcXF86VidModeSetClientVersion(client);
case X_XF86VidModeGetGamma:
return SProcXF86VidModeGetGamma(client);
case X_XF86VidModeGetGammaRamp:
return SProcXF86VidModeGetGammaRamp(client);
case X_XF86VidModeGetGammaRampSize:
return SProcXF86VidModeGetGammaRampSize(client);
case X_XF86VidModeGetPermissions:
return SProcXF86VidModeGetPermissions(client);
default:
if (!xf86GetVidModeEnabled())
return VidModeErrorBase + XF86VidModeExtensionDisabled;
if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
switch (stuff->data) {
case X_XF86VidModeAddModeLine:
return SProcXF86VidModeAddModeLine(client);
case X_XF86VidModeDeleteModeLine:
return SProcXF86VidModeDeleteModeLine(client);
case X_XF86VidModeModModeLine:
return SProcXF86VidModeModModeLine(client);
case X_XF86VidModeSwitchMode:
return SProcXF86VidModeSwitchMode(client);
case X_XF86VidModeSwitchToMode:
return SProcXF86VidModeSwitchToMode(client);
case X_XF86VidModeLockModeSwitch:
return SProcXF86VidModeLockModeSwitch(client);
case X_XF86VidModeSetViewPort:
return SProcXF86VidModeSetViewPort(client);
case X_XF86VidModeSetGamma:
return SProcXF86VidModeSetGamma(client);
case X_XF86VidModeSetGammaRamp:
return SProcXF86VidModeSetGammaRamp(client);
default:
return BadRequest;
}
} else
return VidModeErrorBase + XF86VidModeClientNotLocal;
}
}
......@@ -104,24 +104,18 @@ int ProcInitialConnection();
#include "swaprep.h"
#include "swapreq.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#include "../Xext/panoramiX.h"
#include "../Xext/panoramiXsrv.h"
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <nx-X11/extensions/security.h>
#endif
#ifdef XAPPGROUP
#include <nx-X11/extensions/Xagsrv.h>
#endif
#ifdef XKB
#define XKB_IN_SERVER
#include "inputstr.h"
#include <nx-X11/extensions/XKBsrv.h>
#endif
#ifdef LBX
#include "lbxserve.h"
#endif
#define mskcnt ((MAXCLIENTS + 31) / 32)
#define BITMASK(i) (1U << ((i) & 31))
......
......@@ -207,13 +207,9 @@ the X11 protocol. This increases performance when using X
applications over a network, especially a slow one.
The NX_Xext library contains a handful of X11 extensions:
- Double Buffer extension (DBE/Xdbe)
- Display Power Management Signaling (DPMS) extension
- X11 Nonrectangular Window Shape extension (Xshape)
- The MIT Shared Memory extension (MIT-SHM/Xshm)
- TOG-CUP (colormap) protocol extension (Xcup)
- X Extended Visual Information extension (XEvi)
- X11 Double-Buffering, Multi-Buffering, and Stereo extension (Xmbuf)
This package contains all necessary include files and libraries
needed to develop applications that require these.
......@@ -563,26 +559,11 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans
%defattr(-,root,root)
%{_libdir}/libNX_Xext.so
%dir %{_includedir}/nx-X11/extensions
%{_includedir}/nx-X11/extensions/MITMisc.h
%{_includedir}/nx-X11/extensions/XEVI.h
%{_includedir}/nx-X11/extensions/XEVIstr.h
%{_includedir}/nx-X11/extensions/XLbx.h
%{_includedir}/nx-X11/extensions/XShm.h
%{_includedir}/nx-X11/extensions/Xag.h
%{_includedir}/nx-X11/extensions/Xagsrv.h
%{_includedir}/nx-X11/extensions/Xagstr.h
%{_includedir}/nx-X11/extensions/Xcup.h
%{_includedir}/nx-X11/extensions/Xcupstr.h
%{_includedir}/nx-X11/extensions/Xdbe.h
%{_includedir}/nx-X11/extensions/Xdbeproto.h
%{_includedir}/nx-X11/extensions/Xext.h
%{_includedir}/nx-X11/extensions/dpms.h
%{_includedir}/nx-X11/extensions/dpmsstr.h
%{_includedir}/nx-X11/extensions/extutil.h
%{_includedir}/nx-X11/extensions/lbxstr.h
%{_includedir}/nx-X11/extensions/mitmiscstr.h
%{_includedir}/nx-X11/extensions/multibuf.h
%{_includedir}/nx-X11/extensions/multibufst.h
%{_includedir}/nx-X11/extensions/security.h
%{_includedir}/nx-X11/extensions/securstr.h
%{_includedir}/nx-X11/extensions/shape.h
......@@ -650,17 +631,8 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans
%defattr(-,root,root)
%{_includedir}/nx-X11/X10.h
%dir %{_includedir}/nx-X11/extensions
%{_includedir}/nx-X11/extensions/Xevie.h
%{_includedir}/nx-X11/extensions/lbxbuf.h
%{_includedir}/nx-X11/extensions/lbxbufstr.h
%{_includedir}/nx-X11/extensions/lbxdeltastr.h
%{_includedir}/nx-X11/extensions/lbximage.h
%{_includedir}/nx-X11/extensions/lbxopts.h
%{_includedir}/nx-X11/extensions/lbxzlib.h
%{_includedir}/nx-X11/extensions/panoramiXext.h
%{_includedir}/nx-X11/extensions/record.h
%{_includedir}/nx-X11/extensions/xf86dga1.h
%{_includedir}/nx-X11/extensions/xf86vmode.h
%{_includedir}/nx-X11/misc.h
%{_includedir}/nx-X11/os.h
......@@ -690,10 +662,10 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans
%{_includedir}/nx-X11/ap_keysym.h
%{_includedir}/nx-X11/keysym.h
%{_includedir}/nx-X11/keysymdef.h
%{_includedir}/nx-X11/extensions/Xdbeproto.h
%{_includedir}/nx-X11/extensions/XI.h
%{_includedir}/nx-X11/extensions/XIproto.h
%{_includedir}/nx-X11/extensions/XResproto.h
%{_includedir}/nx-X11/extensions/Xeviestr.h
%{_includedir}/nx-X11/extensions/bigreqstr.h
%{_includedir}/nx-X11/extensions/composite.h
%{_includedir}/nx-X11/extensions/compositeproto.h
......@@ -711,23 +683,10 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans
%{_includedir}/nx-X11/extensions/xcmiscstr.h
%{_includedir}/nx-X11/extensions/xf86bigfont.h
%{_includedir}/nx-X11/extensions/xf86bigfstr.h
%{_includedir}/nx-X11/extensions/xf86dga.h
%{_includedir}/nx-X11/extensions/xf86dga1str.h
%{_includedir}/nx-X11/extensions/xf86dgastr.h
%{_includedir}/nx-X11/extensions/xf86misc.h
%{_includedir}/nx-X11/extensions/xf86mscstr.h
%{_includedir}/nx-X11/extensions/xf86vmstr.h
%{_includedir}/nx-X11/extensions/xfixesproto.h
%{_includedir}/nx-X11/extensions/xfixeswire.h
%{_includedir}/nx-X11/extensions/xtestconst.h
%{_includedir}/nx-X11/extensions/xteststr.h
%{_includedir}/nx-X11/extensions/xtrapbits.h
%{_includedir}/nx-X11/extensions/xtrapddmi.h
%{_includedir}/nx-X11/extensions/xtrapdi.h
%{_includedir}/nx-X11/extensions/xtrapemacros.h
%{_includedir}/nx-X11/extensions/xtraplib.h
%{_includedir}/nx-X11/extensions/xtraplibp.h
%{_includedir}/nx-X11/extensions/xtrapproto.h
%files -n nxagent
%defattr(-,root,root)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment