aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/Imakefile21
-rw-r--r--nx-X11/lib/Xxf86dga/Imakefile63
-rw-r--r--nx-X11/lib/Xxf86dga/XDGA.man673
-rw-r--r--nx-X11/lib/Xxf86dga/XF86DGA.c722
-rw-r--r--nx-X11/lib/Xxf86dga/XF86DGA2.c968
-rw-r--r--nx-X11/lib/Xxf86dga/Xxf86dga-def.cpp16
-rw-r--r--nx-X11/lib/Xxf86misc/Imakefile40
-rw-r--r--nx-X11/lib/Xxf86misc/XF86Misc.c406
-rw-r--r--nx-X11/lib/Xxf86misc/XF86Misc.man217
-rw-r--r--nx-X11/lib/Xxf86misc/Xxf86misc-def.cpp14
-rw-r--r--nx-X11/lib/Xxf86vm/Imakefile40
-rw-r--r--nx-X11/lib/Xxf86vm/XF86VM.man425
-rw-r--r--nx-X11/lib/Xxf86vm/XF86VMode.c1231
-rw-r--r--nx-X11/lib/Xxf86vm/Xxf86vm-def.cpp16
14 files changed, 0 insertions, 4852 deletions
diff --git a/nx-X11/lib/Imakefile b/nx-X11/lib/Imakefile
index 1799ae0b3..20c68f97e 100644
--- a/nx-X11/lib/Imakefile
+++ b/nx-X11/lib/Imakefile
@@ -15,18 +15,6 @@ NULL =
XKBLIBDIR = xkbfile
#endif
-#if BuildXF86MiscLibrary
-XF86MISCLIBDIR = Xxf86misc
-#endif
-
-#if BuildXF86VidModeLibrary
-XF86VMLIBDIR = Xxf86vm
-#endif
-
-#if BuildXF86DGALibrary
-XF86DGALIBDIR = Xxf86dga
-#endif
-
#if BuildXineramaLibrary
XINERAMADIR=Xinerama
#endif
@@ -43,12 +31,6 @@ XFIXESLIBDIR = Xfixes
COMPOSITELIBDIR = Xcomposite
#endif
-XF86EXTLIBS = \
- $(XF86MISCLIBDIR) \
- $(XF86VMLIBDIR) \
- $(XF86DGALIBDIR) \
- $(NULL)
-
#if BuildXauLib
XAULIBDIR = Xau
#endif
@@ -72,9 +54,6 @@ LINTSUBDIRS = \
$(X11LIBDIR) \
$(OLDXLIBDIR) \
$(XEXTLIBDIR) \
- $(XF86MISCLIBDIR) \
- $(XF86VMLIBDIR) \
- $(XF86DGALIBDIR) \
$(XTSTLIBDIR) \
$(XKBLIBDIR) \
$(XINERAMADIR) \
diff --git a/nx-X11/lib/Xxf86dga/Imakefile b/nx-X11/lib/Xxf86dga/Imakefile
deleted file mode 100644
index 0be675720..000000000
--- a/nx-X11/lib/Xxf86dga/Imakefile
+++ /dev/null
@@ -1,63 +0,0 @@
-XCOMM $XdotOrg: xc/lib/Xxf86dga/Imakefile,v 1.3 2005/10/18 14:58:52 alanc Exp $
-XCOMM $XFree86: xc/lib/Xxf86dga/Imakefile,v 3.6 2003/05/05 20:42:30 tsi Exp $
-
-#define DoNormalLib NormalLibXxf86dga
-#define DoSharedLib SharedLibXxf86dga
-#define DoExtraLib SharedLibXxf86dga
-#define DoDebugLib DebugLibXxf86dga
-#define DoProfileLib ProfileLibXxf86dga
-#define LibName Xxf86dga
-#define SoRev SOXXF86DGAREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXxf86dgaReqs
-REQUIREDLIBS = SharedXxf86dgaReqs
-#endif
-
-XF86DGASRCS = XF86DGA.c XF86DGA2.c
-XF86DGAOBJS = XF86DGA.o XF86DGA2.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
-#if defined(HasNetBSDApertureDriver) && HasNetBSDApertureDriver
-APERTURE_DEFINES = -DHAS_APERTURE_DRV
-#endif
-
- DEFINES = $(ALLOC_DEFINES) $(APERTURE_DEFINES)
- SRCS = $(XF86DGASRCS)
- OBJS = $(XF86DGAOBJS)
- LINTLIBS = $(LINTXLIB)
-
-#define IncludeSharedObjectInNormalLib
-
-#include <Library.tmpl>
-
-InstallGenManPage(XDGA,$(LIBMANDIR),$(LIBMANSUFFIX))
-#if ExpandManNames
-DGAFUNCS = XDGAQueryExtension \
- XDGAQueryVersion \
- XDGAQueryModes \
- XDGASetMode \
- XDGAOpenFramebuffer \
- XDGACloseFramebuffer \
- XDGASetViewport \
- XDGAInstallColormap \
- XDGACreateColormap \
- XDGASelectInput \
- XDGAFillRectangle \
- XDGACopyArea \
- XDGACopyTransparentArea \
- XDGAGetViewportStatus \
- XDGASync \
- XDGASetClientVersion \
- XDGAChangePixmapMode \
- XDGAKeyEventToXKeyEvent
-
-InstallGenManPageAliases(XDGA,$(LIBMANDIR),$(LIBMANSUFFIX),XF86DGA XFree86-DGA $(DGAFUNCS))
-#endif
-
-DependTarget()
diff --git a/nx-X11/lib/Xxf86dga/XDGA.man b/nx-X11/lib/Xxf86dga/XDGA.man
deleted file mode 100644
index 9c7beefbb..000000000
--- a/nx-X11/lib/Xxf86dga/XDGA.man
+++ /dev/null
@@ -1,673 +0,0 @@
-.\" $XFree86$
-.\"
-.TH XDGA 3 __vendorversion__
-.SH NAME
-XDGA \- Client library for the XFree86-DGA extension.
-.SH SYNOPSIS
-.B #include <X11/extensions/xf86dga.h>
-.HP
-Bool
-.BR XDGAQueryExtension (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int *" eventBase ,
-.br
-.RI "int *" errorBase )
-.HP
-Bool
-.BR XDGAQueryVersion (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int *" majorVersion ,
-.br
-.RI "int *" minorVersion )
-.HP
-XDGAMode
-.RB * XDGAQueryModes (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "int *" num )
-.HP
-XDGADevice
-.RB * XDGASetMode (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "int " mode )
-.HP
-Bool
-.BR XDGAOpenFramebuffer (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen )
-.HP
-void
-.BR XDGACloseFramebuffer (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen )
-.HP
-void
-.BR XDGASetViewport (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "int " x ,
-.br
-.RI "int " y ,
-.br
-.RI "int " flags )
-.HP
-void
-.BR XDGAInstallColormap (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "Colormap " cmap )
-.HP
-Colormap
-.BR XDGACreateColormap (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "XDGADevice *" device ,
-.br
-.RI "int " alloc )
-.HP
-void
-.BR XDGASelectInput (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "long " event_mask )
-.HP
-void
-.BR XDGAFillRectangle (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "int " x ,
-.br
-.RI "int " y ,
-.br
-.RI "unsigned int " width ,
-.br
-.RI "unsigned int " height ,
-.br
-.RI "unsigned long " color )
-.HP
-void
-.BR XDGACopyArea (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "int " srcx ,
-.br
-.RI "int " srcy ,
-.br
-.RI "unsigned int " width ,
-.br
-.RI "unsigned int " height ,
-.br
-.RI "int " dstx ,
-.br
-.RI "int " dsty )
-.HP
-void
-.BR XDGACopyTransparentArea (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "int " srcx ,
-.br
-.RI "int " srcy ,
-.br
-.RI "unsigned int " width ,
-.br
-.RI "unsigned int " height ,
-.br
-.RI "int " dstx ,
-.br
-.RI "int " dsty ,
-.br
-.RI "unsigned long " key )
-.HP
-int
-.BR XDGAGetViewportStatus (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen )
-.HP
-void
-.BR XDGASync (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen )
-.HP
-Bool
-.BR XDGASetClientVersion (
-.br
-.RI "Display *" dpy )
-.HP
-void
-.BR XDGAChangePixmapMode (
-.br
-.RI "Display *" dpy ,
-.br
-.RI "int " screen ,
-.br
-.RI "int *" x ,
-.br
-.RI "int *" y ,
-.br
-.RI "int " mode )
-.HP
-void
-.BR XDGAKeyEventToXKeyEvent (
-.br
-.RI "XDGAKeyEvent *" dk ,
-.br
-.RI "XKeyEvent *" xk )
-
-.SH DESCRIPTION
-The
-.B XFree86-DGA
-extension is an X server extension for allowing client programs direct
-access to the video frame buffer. This is a brief description of the
-programming interface for version 2.0 of the
-.B XFree86-DGA
-extension.
-.PP
-.B XFree86-DGA
-is not intended as a direct rendering API, but rather, as a mechanism
-to "get the X Server out of the way" so that some other direct rendering
-API can have full access to the hardware. With this in mind, DGA does
-provide clients some direct access to the hardware without requiring a
-separate rendering API, but this access is limited to direct linear
-framebuffer access.
-.PP
-Most of the reasons for the
-.B XFree86-DGA
-extension's existence are now better served in other ways. Further
-development of this extension is not expected, and it may be deprecated
-in a future release. The features that continue to be useful will either
-be provided through other existing mechanisms, or through an extension
-that address those needs more specifically.
-.PP
-.B XFree86-DGA
-is initialized by passing a number corresponding to a valid
-.I XDGAMode
-to
-.BR XDGASetMode ().
-Clients can get a list of valid modes from
-.BR XDGAQueryModes ().
-Each
-.I XDGAMode
-corresponds to a different framebuffer layout.
-.PP
-.BR XDGAQueryModes ()
-returns a pointer to an array of
-.IR XDGAMode s
-which are valid for the given screen.
-.I num
-is the number of elements in the array. The returned array can be freed
-with XFree(3). The
-.I XDGAMode
-structure is as follows:
-.PP
-.nf
-.ta .5i 2i
-typedef struct {
- int num;
- char *name;
- float verticalRefresh;
- int flags;
- int imageWidth;
- int imageHeight;
- int pixmapWidth;
- int pixmapHeight;
- int bytesPerScanline;
- int byteOrder;
- int depth;
- int bitsPerPixel;
- unsigned long redMask;
- unsigned long greenMask;
- unsigned long blueMask;
- short visualClass;
- int viewportWidth;
- int viewportHeight;
- int xViewportStep;
- int yViewportStep;
- int maxViewportX;
- int maxViewportY;
- int viewportFlags;
- int reserved1;
- int reserved2;
-.br
-} XDGAMode;
-.fi
-.TP 8
-.I num
-A unique identifying number
-.RI ( num
-> 0) for the mode. This is the number referenced when initializing the mode.
-.TP 8
-.I name
-The name of the corresponding modeline as given in the __xconfigfile__ file.
-.TP 8
-.I verticalRefresh
-The vertical refresh rate for the modeline (in Hz).
-.TP 8
-.I flags
-Any of the following may be OR'd together:
-.RS 8
-.TP 4
-.B XDGAConcurrentAccess
-Indicates that concurrent client/server access to the framebuffer is
-possible. If this flag is not set it is very important to call
-.BR XDGASync ()
-before directly accessing the framebuffer if a call to
-.BR XDGAFillRectangle (),
-.BR XDGACopyArea ()
-or
-.BR XDGACopyTransparentArea ()
-or any Xlib rendering function has been made prior to such accesses.
-.TP 4
-.B XDGASolidFillRect
-Indicates that
-.BR XDGAFillRectangle ()
-is supported.
-.TP 4
-.B XDGABlitRect
-Indicates that
-.BR XDGACopyArea ()
-is supported.
-.TP 4
-.B XDGABlitTransRect
-Indicates that
-.BR XDGACopyTransparentArea ()
-is supported.
-.TP 4
-.B XDGAPixmap
-Indicates that a Pixmap will be returned when the mode is initialized.
-This means that rendering with Xlib is possible for this mode.
-.TP 4
-.B XDGAInterlaced
-.TP 4
-.B XDGADoublescan
-Indicates that the mode is an interlaced or doublescan mode.
-.RE
-.TP 8
-.I imageWidth
-.TP 8
-.I imageHeight
-The width and height of the framebuffer area accessible by the client.
-This rectangle is always justified to the upper left-hand corner.
-.TP 8
-.I pixmapWidth
-.TP 8
-.I pixmapHeight
-The width and height of the framebuffer area accessible by Xlib. This
-rectangle is always justified to the upper left-hand corner. These
-fields are only valid if the
-.B XDGAPixmap
-flag is set in the
-.I flags
-field.
-.TP 8
-.I bytesPerScanline
-The pitch of the framebuffer in bytes.
-.TP 8
-.I byteOrder
-.B MSBFirst
-or
-.BR LSBFirst .
-.TP 8
-.I depth
-The number of bits in each pixel which contain usable data.
-.TP 8
-.I bitsPerPixel
-The number of bits taken up by each pixel.
-.TP 8
-.I redMask
-.TP 8
-.I greenMask
-.TP 8
-.I blueMask
-The RGB masks. These do not apply to color-indexed modes.
-.TP 8
-.I visualClass
-.BR TrueColor ,
-.BR PseudoColor ,
-.BR DirectColor ,
-etc.
-.TP 8
-.I viewportWidth
-.TP 8
-.I viewportHeight
-The dimensions of the portion of the framebuffer which will be displayed
-on the screen.
-.TP 8
-.I xViewPortStep
-.TP 8
-.I yViewPortStep
-The granularity of the x,y viewport positioning possible with the
-.BR XDGASetViewport ()
-function.
-.TP 8
-.I maxViewportX
-.TP 8
-.I maxViewportY
-The maximum x and y positions possible with the
-.BR XDGASetViewport ()
-function.
-.TP 8
-.I viewportFlags
-Any of the following may be OR'd together
-.RS 8
-.TP 4
-.B XDGAFlipRetrace
-Indicates that the hardware can switch viewports during the vertical
-retrace.
-.TP 4
-.B XDGAFlipImmediate
-Indicates that the hardware can switch viewports immediately without
-waiting for the vertical retrace.
-.RE
-.PP
-.BR XDGASetMode ()
-initialises the
-.I XDGAMode
-corresponding to
-.IR num .
-To exit DGA mode and return to normal server operation, call
-.BR XDGASetMode ()
-with
-.I num
-set to zero.
-.BR XDGASetMode ()
-returns a pointer to an
-.I XDGADevice
-if successful. The XDGADevice can be freed with XFree(3). The
-.I XDGADevice
-structure is as follows:
-.PP
-.nf
-.ta .5i 2i
-typedef struct {
- XDGAMode mode;
- unsigned char *data;
- Pixmap pixmap;
-.br
-} XDGADevice;
-.fi
-.TP 8
-.I mode
-The
-.I XDGAMode
-structure, identical to the information returned by
-.BR XDGAQueryModes ().
-.TP 8
-.I data
-If direct framebuffer access is desired and possible, this field will
-contain a pointer to the mapped framebuffer memory. Generally, this
-field will be zero unless a call to
-.BR XDGAOpenFramebuffer ()
-is made prior to initialization of the mode.
-.TP 8
-.I pixmap
-If the mode supports Xlib rendering as indicated by
-.B XDGAPixmap
-in the
-.I flags
-field, this will contain a Pixmap handle suitable for passing as the
-drawable argument to Xlib functions. This field will be zero if Xlib
-rendering is not supported.
-.PP
-.BR XDGAQueryExtension ()
-checks for the presence of the extension and returns the event and error bases.
-.PP
-.BR XDGAQueryVersion ()
-returns the
-.B XFree86-DGA
-major and minor version numbers.
-.PP
-.BR XDGAOpenFramebuffer ()
-maps the framebuffer memory. The client needs sufficient privileges to be
-able to do this.
-.BR XDGAOpenFramebuffer ()
-should be called prior to initializing a DGA mode if direct framebuffer
-access is desired for that mode.
-.BR XDGAOpenFramebuffer ()
-does not need to be called if direct framebuffer access is not required.
-If the framebuffer is opened,
-.PP
-.BR XDGACloseFramebuffer ()
-should be called prior to client exit to unmap the memory.
-.PP
-.BR XDGAChangePixmapMode ()
-can be used to change between two pixmap sizes in cases where a Pixmap is
-available for Xlib rendering. The following values for the
-.I mode
-parameter are available:
-.RS 8
-.TP 4
-.B XDGAPixmapModeLarge
-The pixmap size is defined by the
-.I pixmapWidth
-and
-.I pixmapHeight
-fields in the
-.I XDGAMode
-structure. The
-.I x
-and
-.I y
-values are ignored in this case.
-.TP 4
-.B XDGAPixmapModeSmall
-The pixmap size is defined by the
-.I viewportWidth
-and
-.I viewportHeight
-fields in the
-.I XDGAMode
-structure. In this mode, the
-.I x
-and
-.I y
-values specify where in the framebuffer this pixmap rectangle is located.
-It may be placed anywhere within the Xlib renderable region described
-by the
-.I pixmapWidth
-and
-.I pixmapHeight
-fields in the
-.IR XDGAMode .
-The
-.I x
-and
-.I y
-values returned are the resultant location of the pixmap and may be
-different from the requested x,y location due to platform specific
-alignment constraints. All Xlib rendering is clipped to this pixmap
-rectangle.
-.RE
-.PP
-.BR XDGASetViewport ()
-sets the upper left-hand corner of the rectangle of framebuffer that is
-to be displayed on the screen. Not all locations may be supported by
-the hardware and requested locations will be adjusted according to the
-.I xViewPortStep
-and
-.I yViewPortStep
-fields in the
-.IR XDGAMode .
-.PP
-.I flags
-can be
-.B XDGAFlipRetrace
-or
-.B XDGAFlipImmediate
-to adjust the viewport location at the next vertical retrace or
-immediately. Values other than the supported values advertised in the
-mode's
-.I viewportFlags
-field will result in hardware-specific default behavior.
-.B XDGAFlipImmediate
-will block until the flip is completed.
-.B XDGAFlipRetrace
-will generally NOT block so it is necessary to monitor the viewport
-status with
-.BR XDGAGetViewportStatus ().
-.B XDGAFlipImmediate
-requests during pending
-.B XDGAFlipRetrace
-requests will be ignored.
-.PP
-.BR XDGAGetViewportStatus ()
-keeps track of the
-.BR XDGASetViewport ()
-requests still pending. The return value of the function will have
-consecutive bits set (LSB justified), each bit representing a pending
-viewport change. For example:
-.PP
-.nf
- while(XDGAGetViewportStatus(dpy, screen));
-.fi
-.PP
-waits for all pending viewport changes to finish.
-.PP
-.nf
- while(0x2 & XDGAGetViewportStatus(dpy, screen));
-.fi
-.PP
-waits until all but the last viewport changes have completed.
-.PP
-.BR XDGACreateColormap ()
-is similar to the Xlib function XCreateColormap(3) except that it takes
-an
-.I XDGADevice
-as an argument instead of a Window and Visual. Though XCreateColormap(3)
-may create usable colormaps in some cases,
-.BR XDGACreateColormap ()
-is the preferred method for creating colormaps in DGA since there may
-not be an advertised visual compatible with the DGA device.
-.PP
-.BR XDGAInstallColormap ()
-must be used to install colormaps in DGA mode. XInstallColormap(3) will
-not work.
-.PP
-.BR XDGASelectInput ()
-enables DGA's own event mechanism. This function is similar to
-XSelectInput(3), and all Xlib Key, Button and Motion masks are supported.
-The following DGA events are defined:
-.PP
-.nf
-.ta .5i 2i
-typedef struct {
- int type; /\(** ButtonPress or ButtonRelease + the DGA event base*/
- unsigned long serial; /\(** # or last request processed by the server */
- Display *display; /\(** Display the event was read from */
- int screen; /\(** The screen number the event came from */
- Time time; /\(** milliseconds */
- unsigned int state; /\(** key or button mask */
- unsigned int button; /\(** detail */
-.br
-} XDGAButtonEvent;
-.fi
-.PP
-.nf
-.ta .5i 2i
-typedef struct {
- int type; /\(** KeyPress or KeyRelease + the DGA event base*/
- unsigned long serial; /\(** # or last request processed by the server */
- Display *display; /\(** Display the event was read from */
- int screen; /\(** The screen number the event came from */
- Time time; /\(** milliseconds */
- unsigned int state; /\(** key or button mask */
- unsigned int keycode; /\(** detail */
-.br
-} XDGAKeyEvent;
-.fi
-.PP
-.nf
-.ta .5i 2i
-typedef struct {
- int type; /\(** MotionNotify + the DGA event base*/
- unsigned long serial; /\(** # or last request processed by the server */
- Display *display; /\(** Display the event was read from */
- int screen; /\(** The screen number the event came from */
- Time time; /\(** milliseconds */
- unsigned int state; /\(** key or button mask */
- int dx; /\(** relative pointer motion */
- int dy; /\(** relative pointer motion */
-.br
-} XDGAMotionEvent;
-.fi
-.PP
-.BR XDGAKeyEventToXKeyEvent ()
-is a helper function to translate
-.IR XDGAKeyEvent s
-into
-.IR XKeyEvent s
-suitable for use with XLookupKeysym(3).
-.PP
-.BR XDGAFillRectangle (),
-.BR XDGACopyArea (),
-and
-.BR XDGACopyTransparentArea ()
-are included with some reservation since DGA is not intended as a
-rendering API. These are merely convenience routines and are optionally
-supported. The associated flags will be set in the
-.IR XDGAMode 's
-.I flags
-field if these functions are supported. These functions will be no-ops
-otherwise. they do not provide direct access to the hardware, but are
-simply context-less operations performed by the server.
-.PP
-.BR XDGASync ()
-blocks until all server rendering to the framebuffer completes. If Xlib
-or the 3 rendering functions above are used,
-.BR XDGASync ()
-must be called before the client directly accesses the framebuffer as
-the server rendering is asynchronous with the client and may have not
-completed. This is especially important if the
-.B XDGAConcurrentAccess
-flag is not set in the
-.IR XDGAMode 's
-.I flags
-field since concurrent access by the server and client may result in a
-system lockup.
-.SH SEE ALSO
-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__)
-.SH AUTHORS
-.B XFree86-DGA
-version 2 was written by Mark Vojkovich. Version 1 was written by Jon
-Tombs, Harm Hanemaayer, Mark Vojkovich.
-
diff --git a/nx-X11/lib/Xxf86dga/XF86DGA.c b/nx-X11/lib/Xxf86dga/XF86DGA.c
deleted file mode 100644
index 95d7596e2..000000000
--- a/nx-X11/lib/Xxf86dga/XF86DGA.c
+++ /dev/null
@@ -1,722 +0,0 @@
-/* $XFree86: xc/lib/Xxf86dga/XF86DGA.c,v 3.23tsi Exp $ */
-/*
-
-Copyright (c) 1995 Jon Tombs
-Copyright (c) 1995,1996 The XFree86 Project, Inc
-
-*/
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#ifdef __UNIXOS2__ /* needed here to override certain constants in X headers */
-#define INCL_DOS
-#define INCL_DOSIOCTL
-#define I_NEED_OS2_H
-#include <os2.h>
-#endif
-
-#if defined(linux)
-#define HAS_MMAP_ANON
-#include <sys/types.h>
-#include <sys/mman.h>
-/* kernel header doesn't work with -ansi */
-/* #include <asm/page.h> */ /* PAGE_SIZE */
-#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
-#define HAS_GETPAGESIZE
-#endif /* linux */
-
-#if defined(CSRG_BASED)
-#define HAS_MMAP_ANON
-#define HAS_GETPAGESIZE
-#include <sys/types.h>
-#include <sys/mman.h>
-#endif /* CSRG_BASED */
-
-#if defined(DGUX)
-#define HAS_GETPAGESIZE
-#define MMAP_DEV_ZERO
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#endif /* DGUX */
-
-#if defined(SVR4) && !defined(DGUX)
-#define MMAP_DEV_ZERO
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#endif /* SVR4 && !DGUX */
-
-#if defined(sun) && !defined(SVR4) /* SunOS */
-#define MMAP_DEV_ZERO /* doesn't SunOS have MAP_ANON ?? */
-#define HAS_GETPAGESIZE
-#include <sys/types.h>
-#include <sys/mman.h>
-#endif /* sun && !SVR4 */
-
-#ifdef XNO_SYSCONF
-#undef _SC_PAGESIZE
-#endif
-
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/xf86dga.h>
-#include <X11/extensions/xf86dgastr.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-extern XExtDisplayInfo* xdga_find_display(Display*);
-extern char *xdga_extension_name;
-
-#define XF86DGACheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xdga_extension_name, val)
-
-/*****************************************************************************
- * *
- * public XFree86-DGA Extension routines *
- * *
- *****************************************************************************/
-
-Bool XF86DGAQueryExtension (
- Display *dpy,
- int *event_basep,
- int *error_basep
-){
- return XDGAQueryExtension(dpy, event_basep, error_basep);
-}
-
-Bool XF86DGAQueryVersion(
- Display* dpy,
- int* majorVersion,
- int* minorVersion
-){
- return XDGAQueryVersion(dpy, majorVersion, minorVersion);
-}
-
-Bool XF86DGAGetVideoLL(
- Display* dpy,
- int screen,
- int *offset,
- int *width,
- int *bank_size,
- int *ram_size
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAGetVideoLLReply rep;
- xXF86DGAGetVideoLLReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAGetVideoLL, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAGetVideoLL;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *offset = /*(char *)*/rep.offset;
- *width = rep.width;
- *bank_size = rep.bank_size;
- *ram_size = rep.ram_size;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-
-Bool XF86DGADirectVideoLL(
- Display* dpy,
- int screen,
- int enable
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGADirectVideoReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGADirectVideo, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGADirectVideo;
- req->screen = screen;
- req->enable = enable;
- UnlockDisplay(dpy);
- SyncHandle();
- XSync(dpy,False);
- return True;
-}
-
-Bool XF86DGAGetViewPortSize(
- Display* dpy,
- int screen,
- int *width,
- int *height
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAGetViewPortSizeReply rep;
- xXF86DGAGetViewPortSizeReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAGetViewPortSize, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAGetViewPortSize;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *width = rep.width;
- *height = rep.height;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-
-Bool XF86DGASetViewPort(
- Display* dpy,
- int screen,
- int x,
- int y
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGASetViewPortReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGASetViewPort, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGASetViewPort;
- req->screen = screen;
- req->x = x;
- req->y = y;
- UnlockDisplay(dpy);
- SyncHandle();
- XSync(dpy,False);
- return True;
-}
-
-
-Bool XF86DGAGetVidPage(
- Display* dpy,
- int screen,
- int *vpage
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAGetVidPageReply rep;
- xXF86DGAGetVidPageReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAGetVidPage, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAGetVidPage;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *vpage = rep.vpage;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-
-Bool XF86DGASetVidPage(
- Display* dpy,
- int screen,
- int vpage
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGASetVidPageReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGASetVidPage, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGASetVidPage;
- req->screen = screen;
- req->vpage = vpage;
- UnlockDisplay(dpy);
- SyncHandle();
- XSync(dpy,False);
- return True;
-}
-
-Bool XF86DGAInstallColormap(
- Display* dpy,
- int screen,
- Colormap cmap
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAInstallColormapReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAInstallColormap, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAInstallColormap;
- req->screen = screen;
- req->id = cmap;
- UnlockDisplay(dpy);
- SyncHandle();
- XSync(dpy,False);
- return True;
-}
-
-Bool XF86DGAQueryDirectVideo(
- Display *dpy,
- int screen,
- int *flags
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAQueryDirectVideoReply rep;
- xXF86DGAQueryDirectVideoReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAQueryDirectVideo, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAQueryDirectVideo;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *flags = rep.flags;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86DGAViewPortChanged(
- Display *dpy,
- int screen,
- int n
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAViewPortChangedReply rep;
- xXF86DGAViewPortChangedReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAViewPortChanged, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAViewPortChanged;
- req->screen = screen;
- req->n = n;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.result;
-}
-
-
-
-/* Helper functions */
-
-#include <X11/Xmd.h>
-#include <X11/extensions/xf86dga.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#if defined(ISC)
-# define HAS_SVR3_MMAP
-# include <sys/types.h>
-# include <errno.h>
-
-# include <sys/at_ansi.h>
-# include <sys/kd.h>
-
-# include <sys/sysmacros.h>
-# include <sys/immu.h>
-# include <sys/region.h>
-
-# include <sys/mmap.h>
-#else
-# if defined(Lynx) && defined(NO_MMAP)
-# include <sys/types.h>
-# include <errno.h>
-# include <smem.h>
-# else
-# if !defined(__UNIXOS2__)
-# include <sys/mman.h>
-# endif
-# endif
-#endif
-#include <sys/wait.h>
-#include <signal.h>
-#include <unistd.h>
-
-#if defined(SVR4) && !defined(sun)
-#define DEV_MEM "/dev/pmem"
-#elif defined(SVR4) && defined(sun)
-#define DEV_MEM "/dev/xsvc"
-#elif defined(HAS_APERTURE_DRV)
-#define DEV_MEM "/dev/xf86"
-#else
-#define DEV_MEM "/dev/mem"
-#endif
-
-typedef struct {
- unsigned long physaddr; /* actual requested physical address */
- unsigned long size; /* actual requested map size */
- unsigned long delta; /* delta to account for page alignment */
- void * vaddr; /* mapped address, without the delta */
- int refcount; /* reference count */
-} MapRec, *MapPtr;
-
-typedef struct {
- Display * display;
- int screen;
- MapPtr map;
-} ScrRec, *ScrPtr;
-
-static int mapFd = -1;
-static int numMaps = 0;
-static int numScrs = 0;
-static MapPtr *mapList = NULL;
-static ScrPtr *scrList = NULL;
-
-static MapPtr
-AddMap(void)
-{
- MapPtr *old;
-
- old = mapList;
- mapList = realloc(mapList, sizeof(MapPtr) * (numMaps + 1));
- if (!mapList) {
- mapList = old;
- return NULL;
- }
- mapList[numMaps] = malloc(sizeof(MapRec));
- if (!mapList[numMaps])
- return NULL;
- return mapList[numMaps++];
-}
-
-static ScrPtr
-AddScr(void)
-{
- ScrPtr *old;
-
- old = scrList;
- scrList = realloc(scrList, sizeof(ScrPtr) * (numScrs + 1));
- if (!scrList) {
- scrList = old;
- return NULL;
- }
- scrList[numScrs] = malloc(sizeof(ScrRec));
- if (!scrList[numScrs])
- return NULL;
- return scrList[numScrs++];
-}
-
-static MapPtr
-FindMap(unsigned long address, unsigned long size)
-{
- int i;
-
- for (i = 0; i < numMaps; i++) {
- if (mapList[i]->physaddr == address &&
- mapList[i]->size == size)
- return mapList[i];
- }
- return NULL;
-}
-
-static ScrPtr
-FindScr(Display *display, int screen)
-{
- int i;
-
- for (i = 0; i < numScrs; i++) {
- if (scrList[i]->display == display &&
- scrList[i]->screen == screen)
- return scrList[i];
- }
- return NULL;
-}
-
-static void *
-MapPhysAddress(unsigned long address, unsigned long size)
-{
- unsigned long offset, delta;
- int pagesize = -1;
- void *vaddr;
- MapPtr mp;
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- struct kd_memloc mloc;
-#elif defined(__UNIXOS2__)
- APIRET rc;
- ULONG action;
- HFILE hfd;
-#endif
-
- if ((mp = FindMap(address, size))) {
- mp->refcount++;
- return (void *)((unsigned long)mp->vaddr + mp->delta);
- }
-
-#if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE)
- pagesize = sysconf(_SC_PAGESIZE);
-#endif
-#ifdef _SC_PAGE_SIZE
- if (pagesize == -1)
- pagesize = sysconf(_SC_PAGE_SIZE);
-#endif
-#ifdef HAS_GETPAGESIZE
- if (pagesize == -1)
- pagesize = getpagesize();
-#endif
-#ifdef PAGE_SIZE
- if (pagesize == -1)
- pagesize = PAGE_SIZE;
-#endif
- if (pagesize == -1)
- pagesize = 4096;
-
- delta = address % pagesize;
- offset = address - delta;
-
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- if (mapFd < 0) {
- if ((mapFd = open("/dev/mmap", O_RDWR)) < 0)
- return NULL;
- }
- mloc.vaddr = (char *)0;
- mloc.physaddr = (char *)offset;
- mloc.length = size + delta;
- mloc.ioflg=1;
-
- if ((vaddr = (void *)ioctl(mapFd, MAP, &mloc)) == (void *)-1)
- return NULL;
-#elif defined (__UNIXOS2__)
- /*
- * Dragon warning here! /dev/pmap$ is never closed, except on progam exit.
- * Consecutive calling of this routine will make PMAP$ driver run out
- * of memory handles. Some umap/close mechanism should be provided
- */
-
- rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
- OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);
- if (rc != 0)
- return NULL;
- {
- struct map_ioctl {
- union {
- ULONG phys;
- void* user;
- } a;
- ULONG size;
- } pmap,dmap;
- ULONG plen,dlen;
-#define XFREE86_PMAP 0x76
-#define PMAP_MAP 0x44
-
- pmap.a.phys = offset;
- pmap.size = size + delta;
- rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
- (PULONG)&pmap, sizeof(pmap), &plen,
- (PULONG)&dmap, sizeof(dmap), &dlen);
- if (rc == 0) {
- vaddr = dmap.a.user;
- }
- }
- if (rc != 0)
- return NULL;
-#elif defined(Lynx) && defined(NO_MMAP)
- vaddr = (void *)smem_create("XF86DGA", (char *)offset,
- size + delta, SM_READ|SM_WRITE);
-#else
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
- if (mapFd < 0) {
- if ((mapFd = open(DEV_MEM, O_RDWR)) < 0)
- return NULL;
- }
- vaddr = (void *)mmap(NULL, size + delta, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mapFd, (off_t)offset);
- if (vaddr == (void *)-1)
- return NULL;
-#endif
-
- if (!vaddr) {
- if (!(mp = AddMap()))
- return NULL;
- mp->physaddr = address;
- mp->size = size;
- mp->delta = delta;
- mp->vaddr = vaddr;
- mp->refcount = 1;
- }
- return (void *)((unsigned long)vaddr + delta);
-}
-
-/*
- * Still need to find a clean way of detecting the death of a DGA app
- * and returning things to normal - Jon
- * This is here to help debugging without rebooting... Also C-A-BS
- * should restore text mode.
- */
-
-int
-XF86DGAForkApp(int screen)
-{
- pid_t pid;
- int status;
- int i;
-
- /* fork the app, parent hangs around to clean up */
- if ((pid = fork()) > 0) {
- ScrPtr sp;
-
- waitpid(pid, &status, 0);
- for (i = 0; i < numScrs; i++) {
- sp = scrList[i];
- XF86DGADirectVideoLL(sp->display, sp->screen, 0);
- XSync(sp->display, False);
- }
- if (WIFEXITED(status))
- _exit(0);
- else
- _exit(-1);
- }
- return pid;
-}
-
-
-Bool
-XF86DGADirectVideo(
- Display *dis,
- int screen,
- int enable
-){
- ScrPtr sp;
- MapPtr mp = NULL;
-
- if ((sp = FindScr(dis, screen)))
- mp = sp->map;
-
- if (enable & XF86DGADirectGraphics) {
-#if !defined(ISC) && !defined(HAS_SVR3_MMAP) \
- && !(defined(Lynx) && defined(NO_MMAP)) \
- && !defined(__UNIXOS2__)
- if (mp && mp->vaddr)
- mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ | PROT_WRITE);
-#endif
- } else {
-#if !defined(ISC) && !defined(HAS_SVR3_MMAP) \
- && !(defined(Lynx) && defined(NO_MMAP)) \
- && !defined(__UNIXOS2__)
- if (mp && mp->vaddr)
- mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ);
-#elif defined(Lynx) && defined(NO_MMAP)
- /* XXX this doesn't allow enable after disable */
- smem_create(NULL, mp->vaddr, mp->size + mp->delta, SM_DETACH);
- smem_remove("XF86DGA");
-#endif
- }
-
- XF86DGADirectVideoLL(dis, screen, enable);
- return 1;
-}
-
-
-static void
-XF86cleanup(int sig)
-{
- ScrPtr sp;
- int i;
- static char beenhere = 0;
-
- if (beenhere)
- _exit(3);
- beenhere = 1;
-
- for (i = 0; i < numScrs; i++) {
- sp = scrList[i];
- XF86DGADirectVideo(sp->display, sp->screen, 0);
- XSync(sp->display, False);
- }
- _exit(3);
-}
-
-Bool
-XF86DGAGetVideo(
- Display *dis,
- int screen,
- char **addr,
- int *width,
- int *bank,
- int *ram
-){
- /*unsigned long*/ int offset;
- static int beenHere = 0;
- ScrPtr sp;
- MapPtr mp;
-
- if (!(sp = FindScr(dis, screen))) {
- if (!(sp = AddScr())) {
- fprintf(stderr, "XF86DGAGetVideo: malloc failure\n");
- exit(-2);
- }
- sp->display = dis;
- sp->screen = screen;
- sp->map = NULL;
- }
-
- XF86DGAGetVideoLL(dis, screen , &offset, width, bank, ram);
-
- *addr = MapPhysAddress(offset, *bank);
- if (*addr == NULL) {
- fprintf(stderr, "XF86DGAGetVideo: failed to map video memory (%s)\n",
- strerror(errno));
- exit(-2);
- }
-
- if ((mp = FindMap(offset, *bank)))
- sp->map = mp;
-
- if (!beenHere) {
- beenHere = 1;
- atexit((void(*)(void))XF86cleanup);
- /* one shot XF86cleanup attempts */
- signal(SIGSEGV, XF86cleanup);
-#ifdef SIGBUS
- signal(SIGBUS, XF86cleanup);
-#endif
- signal(SIGHUP, XF86cleanup);
- signal(SIGFPE, XF86cleanup);
- }
-
- return 1;
-}
-
diff --git a/nx-X11/lib/Xxf86dga/XF86DGA2.c b/nx-X11/lib/Xxf86dga/XF86DGA2.c
deleted file mode 100644
index 533901fca..000000000
--- a/nx-X11/lib/Xxf86dga/XF86DGA2.c
+++ /dev/null
@@ -1,968 +0,0 @@
-/* $XFree86: xc/lib/Xxf86dga/XF86DGA2.c,v 1.23 2003/05/05 20:42:30 tsi Exp $ */
-/*
-
-Copyright (c) 1995 Jon Tombs
-Copyright (c) 1995,1996 The XFree86 Project, Inc
-
-*/
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#ifdef __UNIXOS2__ /* needed here to override certain constants in X headers */
-#define INCL_DOS
-#define INCL_DOSIOCTL
-#define I_NEED_OS2_H
-#include <os2.h>
-#endif
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/xf86dga.h>
-#include <X11/extensions/xf86dgastr.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <stdio.h>
-
-
-/* If you change this, change the Bases[] array below as well */
-#define MAX_HEADS 16
-
-char *xdga_extension_name = XF86DGANAME;
-
-static XExtensionInfo _xdga_info_data;
-static XExtensionInfo *xdga_info = &_xdga_info_data;
-
-
-Bool XDGAMapFramebuffer(int, char *, unsigned char*, CARD32, CARD32, CARD32);
-void XDGAUnmapFramebuffer(int);
-unsigned char* XDGAGetMappedMemory(int);
-
-#define XDGACheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xdga_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int xdga_close_display(Display *dpy, XExtCodes *codes);
-static Bool xdga_wire_to_event(Display *dpy, XEvent *event, xEvent *wire_ev);
-static Status xdga_event_to_wire(Display *dpy, XEvent *event, xEvent *wire_ev);
-
-static XExtensionHooks xdga_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- xdga_close_display, /* close_display */
- xdga_wire_to_event, /* wire_to_event */
- xdga_event_to_wire, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_CLOSE_DISPLAY (xdga_close_display, xdga_info)
-
-
-XExtDisplayInfo* xdga_find_display(Display*);
-XEXT_GENERATE_FIND_DISPLAY (xdga_find_display, xdga_info,
- "XFree86-DGA",
- &xdga_extension_hooks,
- 0, NULL)
-
-
-static Status
-xdga_event_to_wire(
- Display *dpy,
- XEvent *event,
- xEvent *wire_ev
-){
- return True;
-}
-
-static Bool
-xdga_wire_to_event(
- Display *dpy,
- XEvent *event,
- xEvent *wire_ev
-){
- dgaEvent *wire = (dgaEvent *) wire_ev;
- XDGAButtonEvent *bevent;
- XDGAKeyEvent *kevent;
- XDGAMotionEvent *mevent;
- XExtDisplayInfo *info = xdga_find_display (dpy);
-
- XDGACheckExtension (dpy, info, False);
-
- switch((wire->u.u.type & 0x7f) - info->codes->first_event) {
- case MotionNotify:
- mevent = (XDGAMotionEvent*)event;
- mevent->type = wire->u.u.type & 0x7F;
- mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
- mevent->display = dpy;
- mevent->screen = wire->u.event.screen;
- mevent->time = wire->u.event.time;
- mevent->state = wire->u.event.state;
- mevent->dx = wire->u.event.dx;
- mevent->dy = wire->u.event.dy;
- return True;
- case ButtonPress:
- case ButtonRelease:
- bevent = (XDGAButtonEvent*)event;
- bevent->type = wire->u.u.type & 0x7F;
- bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
- bevent->display = dpy;
- bevent->screen = wire->u.event.screen;
- bevent->time = wire->u.event.time;
- bevent->state = wire->u.event.state;
- bevent->button = wire->u.u.detail;
- return True;
- case KeyPress:
- case KeyRelease:
- kevent = (XDGAKeyEvent*)event;
- kevent->type = wire->u.u.type & 0x7F;
- kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
- kevent->display = dpy;
- kevent->screen = wire->u.event.screen;
- kevent->time = wire->u.event.time;
- kevent->state = wire->u.event.state;
- kevent->keycode = wire->u.u.detail;
- return True;
- }
-
- return False;
-}
-
-
-Bool XDGAQueryExtension (
- Display *dpy,
- int *event_basep,
- int *error_basep
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Bool XDGAQueryVersion(
- Display *dpy,
- int *majorVersion,
- int *minorVersion
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAQueryVersionReply rep;
- xXDGAQueryVersionReq *req;
-
- XDGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XDGAQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- if (*majorVersion >= 2)
- {
- int i, j;
-
- for (i = 0, j = info->codes->first_event;
- i < XF86DGANumberEvents;
- i++, j++)
- {
- XESetWireToEvent (dpy, j, xdga_wire_to_event);
- XESetEventToWire (dpy, j, xdga_event_to_wire);
- }
- XDGASetClientVersion(dpy);
- }
- return True;
-}
-
-Bool XDGASetClientVersion(
- Display *dpy
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGASetClientVersionReq *req;
-
- XDGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XDGASetClientVersion, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGASetClientVersion;
- req->major = XDGA_MAJOR_VERSION;
- req->minor = XDGA_MINOR_VERSION;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XDGAOpenFramebuffer(
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAOpenFramebufferReply rep;
- xXDGAOpenFramebufferReq *req;
- char *deviceName = NULL;
- Bool ret;
-
- XDGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XDGAOpenFramebuffer, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAOpenFramebuffer;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- if(rep.length) {
- deviceName = Xmalloc(rep.length << 2);
- _XRead(dpy, deviceName, rep.length << 2);
- }
-
- ret = XDGAMapFramebuffer(screen, deviceName,
- (unsigned char*)(long)rep.mem1,
- rep.size, rep.offset, rep.extra);
-
- if(deviceName)
- Xfree(deviceName);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return ret;
-}
-
-void XDGACloseFramebuffer(
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGACloseFramebufferReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- XDGAUnmapFramebuffer(screen);
-
- LockDisplay(dpy);
- GetReq(XDGACloseFramebuffer, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGACloseFramebuffer;
- req->screen = screen;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-
-XDGAMode* XDGAQueryModes(
- Display *dpy,
- int screen,
- int *num
-){
- XExtDisplayInfo *dinfo = xdga_find_display (dpy);
- xXDGAQueryModesReply rep;
- xXDGAQueryModesReq *req;
- XDGAMode *modes = NULL;
-
- *num = 0;
-
- XDGACheckExtension (dpy, dinfo, NULL);
-
- LockDisplay(dpy);
- GetReq(XDGAQueryModes, req);
- req->reqType = dinfo->codes->major_opcode;
- req->dgaReqType = X_XDGAQueryModes;
- req->screen = screen;
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- if(rep.length) {
- xXDGAModeInfo info;
- int i, size;
- char *offset;
-
- size = rep.length << 2;
- size -= rep.number * sz_xXDGAModeInfo; /* find text size */
- modes = (XDGAMode*)Xmalloc((rep.number * sizeof(XDGAMode)) + size);
- offset = (char*)(&modes[rep.number]); /* start of text */
-
-
- if(modes) {
- for(i = 0; i < rep.number; i++) {
- _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
-
- modes[i].num = info.num;
- modes[i].verticalRefresh =
- (float)info.vsync_num / (float)info.vsync_den;
- modes[i].flags = info.flags;
- modes[i].imageWidth = info.image_width;
- modes[i].imageHeight = info.image_height;
- modes[i].pixmapWidth = info.pixmap_width;
- modes[i].pixmapHeight = info.pixmap_height;
- modes[i].bytesPerScanline = info.bytes_per_scanline;
- modes[i].byteOrder = info.byte_order;
- modes[i].depth = info.depth;
- modes[i].bitsPerPixel = info.bpp;
- modes[i].redMask = info.red_mask;
- modes[i].greenMask = info.green_mask;
- modes[i].blueMask = info.blue_mask;
- modes[i].visualClass = info.visual_class;
- modes[i].viewportWidth = info.viewport_width;
- modes[i].viewportHeight = info.viewport_height;
- modes[i].xViewportStep = info.viewport_xstep;
- modes[i].yViewportStep = info.viewport_ystep;
- modes[i].maxViewportX = info.viewport_xmax;
- modes[i].maxViewportY = info.viewport_ymax;
- modes[i].viewportFlags = info.viewport_flags;
- modes[i].reserved1 = info.reserved1;
- modes[i].reserved2 = info.reserved2;
-
- _XRead(dpy, offset, info.name_size);
- modes[i].name = offset;
- offset += info.name_size;
- }
- *num = rep.number;
- } else
- _XEatData(dpy, rep.length << 2);
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return modes;
-}
-
-
-XDGADevice *
-XDGASetMode(
- Display *dpy,
- int screen,
- int mode
-){
- XExtDisplayInfo *dinfo = xdga_find_display (dpy);
- xXDGASetModeReply rep;
- xXDGASetModeReq *req;
- XDGADevice *dev = NULL;
- Pixmap pid;
-
- XDGACheckExtension (dpy, dinfo, NULL);
-
- LockDisplay(dpy);
- GetReq(XDGASetMode, req);
- req->reqType = dinfo->codes->major_opcode;
- req->dgaReqType = X_XDGASetMode;
- req->screen = screen;
- req->mode = mode;
- req->pid = pid = XAllocID(dpy);
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- if(rep.length) {
- xXDGAModeInfo info;
- int size;
-
- size = rep.length << 2;
- size -= sz_xXDGAModeInfo; /* get text size */
-
- dev = (XDGADevice*)Xmalloc(sizeof(XDGADevice) + size);
-
- if(dev) {
- _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
-
- dev->mode.num = info.num;
- dev->mode.verticalRefresh =
- (float)info.vsync_num / (float)info.vsync_den;
- dev->mode.flags = info.flags;
- dev->mode.imageWidth = info.image_width;
- dev->mode.imageHeight = info.image_height;
- dev->mode.pixmapWidth = info.pixmap_width;
- dev->mode.pixmapHeight = info.pixmap_height;
- dev->mode.bytesPerScanline = info.bytes_per_scanline;
- dev->mode.byteOrder = info.byte_order;
- dev->mode.depth = info.depth;
- dev->mode.bitsPerPixel = info.bpp;
- dev->mode.redMask = info.red_mask;
- dev->mode.greenMask = info.green_mask;
- dev->mode.blueMask = info.blue_mask;
- dev->mode.visualClass = info.visual_class;
- dev->mode.viewportWidth = info.viewport_width;
- dev->mode.viewportHeight = info.viewport_height;
- dev->mode.xViewportStep = info.viewport_xstep;
- dev->mode.yViewportStep = info.viewport_ystep;
- dev->mode.maxViewportX = info.viewport_xmax;
- dev->mode.maxViewportY = info.viewport_ymax;
- dev->mode.viewportFlags = info.viewport_flags;
- dev->mode.reserved1 = info.reserved1;
- dev->mode.reserved2 = info.reserved2;
-
- dev->mode.name = (char*)(&dev[1]);
- _XRead(dpy, dev->mode.name, info.name_size);
-
- dev->pixmap = (rep.flags & XDGAPixmap) ? pid : 0;
- dev->data = XDGAGetMappedMemory(screen);
-
- if(dev->data)
- dev->data += rep.offset;
- }
- /* not sure what to do if the allocation fails */
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return dev;
-}
-
-
-void XDGASetViewport(
- Display *dpy,
- int screen,
- int x,
- int y,
- int flags
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGASetViewportReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGASetViewport, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGASetViewport;
- req->screen = screen;
- req->x = x;
- req->y = y;
- req->flags = flags;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-void XDGAInstallColormap(
- Display *dpy,
- int screen,
- Colormap cmap
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAInstallColormapReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGAInstallColormap, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAInstallColormap;
- req->screen = screen;
- req->cmap = cmap;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XDGASelectInput(
- Display *dpy,
- int screen,
- long mask
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGASelectInputReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGASelectInput, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGASelectInput;
- req->screen = screen;
- req->mask = mask;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XDGAFillRectangle(
- Display *dpy,
- int screen,
- int x,
- int y,
- unsigned int width,
- unsigned int height,
- unsigned long color
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAFillRectangleReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGAFillRectangle, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAFillRectangle;
- req->screen = screen;
- req->x = x;
- req->y = y;
- req->width = width;
- req->height = height;
- req->color = color;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XDGACopyArea(
- Display *dpy,
- int screen,
- int srcx,
- int srcy,
- unsigned int width,
- unsigned int height,
- int dstx,
- int dsty
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGACopyAreaReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGACopyArea, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGACopyArea;
- req->screen = screen;
- req->srcx = srcx;
- req->srcy = srcy;
- req->width = width;
- req->height = height;
- req->dstx = dstx;
- req->dsty = dsty;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XDGACopyTransparentArea(
- Display *dpy,
- int screen,
- int srcx,
- int srcy,
- unsigned int width,
- unsigned int height,
- int dstx,
- int dsty,
- unsigned long key
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGACopyTransparentAreaReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGACopyTransparentArea, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGACopyTransparentArea;
- req->screen = screen;
- req->srcx = srcx;
- req->srcy = srcy;
- req->width = width;
- req->height = height;
- req->dstx = dstx;
- req->dsty = dsty;
- req->key = key;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-int XDGAGetViewportStatus(
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAGetViewportStatusReply rep;
- xXDGAGetViewportStatusReq *req;
- int status = 0;
-
- XDGACheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XDGAGetViewportStatus, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAGetViewportStatus;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
- status = rep.status;
- UnlockDisplay(dpy);
- SyncHandle();
- return status;
-}
-
-void XDGASync(
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGASyncReply rep;
- xXDGASyncReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGASync, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGASync;
- req->screen = screen;
- _XReply(dpy, (xReply *)&rep, 0, xFalse);
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-void XDGAChangePixmapMode(
- Display *dpy,
- int screen,
- int *x,
- int *y,
- int mode
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAChangePixmapModeReq *req;
- xXDGAChangePixmapModeReply rep;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGAChangePixmapMode, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAChangePixmapMode;
- req->screen = screen;
- req->x = *x;
- req->y = *y;
- req->flags = mode;
- _XReply(dpy, (xReply *)&rep, 0, xFalse);
- *x = rep.x;
- *y = rep.y;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-Colormap XDGACreateColormap(
- Display *dpy,
- int screen,
- XDGADevice *dev,
- int alloc
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGACreateColormapReq *req;
- Colormap cid;
-
- XDGACheckExtension (dpy, info, -1);
-
- LockDisplay(dpy);
- GetReq(XDGACreateColormap, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGACreateColormap;
- req->screen = screen;
- req->mode = dev->mode.num;
- req->alloc = alloc;
- cid = req->id = XAllocID(dpy);
- UnlockDisplay(dpy);
- SyncHandle();
-
- return cid;
-}
-
-
-void XDGAKeyEventToXKeyEvent(
- XDGAKeyEvent* dk,
- XKeyEvent* xk
-){
- xk->type = dk->type;
- xk->serial = dk->serial;
- xk->send_event = False;
- xk->display = dk->display;
- xk->window = RootWindow(dk->display, dk->screen);
- xk->root = xk->window;
- xk->subwindow = None;
- xk->time = dk->time;
- xk->x = xk->y = xk->x_root = xk->y_root = 0;
- xk->state = dk->state;
- xk->keycode = dk->keycode;
- xk->same_screen = True;
-}
-
-#include <X11/Xmd.h>
-#include <X11/extensions/xf86dga.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#if defined(ISC)
-# define HAS_SVR3_MMAP
-# include <sys/types.h>
-# include <errno.h>
-
-# include <sys/at_ansi.h>
-# include <sys/kd.h>
-
-# include <sys/sysmacros.h>
-# include <sys/immu.h>
-# include <sys/region.h>
-
-# include <sys/mmap.h>
-#else
-# if defined(Lynx) && defined(NO_MMAP)
-# include <sys/types.h>
-# include <errno.h>
-# include <smem.h>
-# else
-# if !defined(__UNIXOS2__)
-# include <sys/mman.h>
-# endif
-# endif
-#endif
-#include <sys/wait.h>
-#include <signal.h>
-#include <unistd.h>
-
-#if defined(SVR4) && !defined(sun)
-#define DEV_MEM "/dev/pmem"
-#elif defined(SVR4) && defined(sun)
-#define DEV_MEM "/dev/xsvc"
-#elif defined(HAS_APERTURE_DRV)
-#define DEV_MEM "/dev/xf86"
-#else
-#define DEV_MEM "/dev/mem"
-#endif
-
-
-
-typedef struct _DGAMapRec{
- unsigned char *physical;
- unsigned char *virtual;
- CARD32 size;
- int fd;
- int screen;
- struct _DGAMapRec *next;
-} DGAMapRec, *DGAMapPtr;
-
-static Bool
-DGAMapPhysical(int, char*, unsigned char*, CARD32, CARD32, CARD32, DGAMapPtr);
-static void DGAUnmapPhysical(DGAMapPtr);
-
-static DGAMapPtr _Maps = NULL;
-
-
-unsigned char*
-XDGAGetMappedMemory(int screen)
-{
- DGAMapPtr pMap = _Maps;
- unsigned char *pntr = NULL;
-
- while(pMap != NULL) {
- if(pMap->screen == screen) {
- pntr = pMap->virtual;
- break;
- }
- pMap = pMap->next;
- }
-
- return pntr;
-}
-
-Bool
-XDGAMapFramebuffer(
- int screen,
- char *name, /* optional device name */
- unsigned char* base, /* physical memory */
- CARD32 size, /* size */
- CARD32 offset, /* optional offset */
- CARD32 extra /* optional extra data */
-){
- DGAMapPtr pMap = _Maps;
- Bool result;
-
- /* is it already mapped ? */
- while(pMap != NULL) {
- if(pMap->screen == screen)
- return True;
- pMap = pMap->next;
- }
-
- if(extra & XDGANeedRoot) {
- /* we should probably check if we have root permissions and
- return False here */
-
- }
-
- pMap = (DGAMapPtr)Xmalloc(sizeof(DGAMapRec));
-
- result = DGAMapPhysical(screen, name, base, size, offset, extra, pMap);
-
- if(result) {
- pMap->next = _Maps;
- _Maps = pMap;
- } else
- Xfree(pMap);
-
- return result;
-}
-
-void
-XDGAUnmapFramebuffer(int screen)
-{
- DGAMapPtr pMap = _Maps;
- DGAMapPtr pPrev = NULL;
-
- /* is it already mapped */
- while(pMap != NULL) {
- if(pMap->screen == screen)
- break;
- pPrev = pMap;
- pMap = pMap->next;
- }
-
- if(!pMap)
- return;
-
- DGAUnmapPhysical(pMap);
-
- if(!pPrev)
- _Maps = pMap->next;
- else
- pPrev->next = pMap->next;
-
- Xfree(pMap);
-}
-
-
-static Bool
-DGAMapPhysical(
- int screen,
- char *name, /* optional device name */
- unsigned char* base, /* physical memory */
- CARD32 size, /* size */
- CARD32 offset, /* optional offset */
- CARD32 extra, /* optional extra data */
- DGAMapPtr pMap
-) {
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- struct kd_memloc mloc;
-#elif defined(__UNIXOS2__)
- APIRET rc;
- ULONG action;
- HFILE hfd;
-#endif
-
- base += offset;
-
- pMap->screen = screen;
- pMap->physical = base;
- pMap->size = size;
-
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- if ((pMap->fd = open("/dev/mmap", O_RDWR)) < 0)
- return False;
- mloc.vaddr = (char *)0;
- mloc.physaddr = (char *)base;
- mloc.length = size;
- mloc.ioflg=1;
-
- if ((pMap->virtual = (void *)ioctl(pMap->fd, MAP, &mloc)) == (void *)-1)
- return False;
-#elif defined (__UNIXOS2__)
- /*
- * Dragon warning here! /dev/pmap$ is never closed, except on progam exit.
- * Consecutive calling of this routine will make PMAP$ driver run out
- * of memory handles. Some umap/close mechanism should be provided
- */
-
- rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
- OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);
- if (rc != 0)
- return False;
- {
- struct map_ioctl {
- union {
- ULONG phys;
- void* user;
- } a;
- ULONG size;
- } pmap,dmap;
- ULONG plen,dlen;
-#define XFREE86_PMAP 0x76
-#define PMAP_MAP 0x44
-
- pmap.a.phys = base;
- pmap.size = size;
- rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
- (PULONG)&pmap, sizeof(pmap), &plen,
- (PULONG)&dmap, sizeof(dmap), &dlen);
- if (rc == 0) {
- pMap->virtual = dmap.a.user;
- }
- }
- if (rc != 0)
- return False;
-#elif defined (Lynx) && defined(NO_MMAP)
- pMap->virtual = smem_create("XF86DGA", (char*)base, size, SM_READ|SM_WRITE);
-#else
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
- if (!name)
- name = DEV_MEM;
- if ((pMap->fd = open(name, O_RDWR)) < 0)
- return False;
- pMap->virtual = mmap(NULL, size, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, pMap->fd, (off_t)base);
- if (pMap->virtual == (void *)-1)
- return False;
- mprotect(pMap->virtual, size, PROT_READ | PROT_WRITE);
-#endif
-
- return True;
-}
-
-
-
-static void
-DGAUnmapPhysical(DGAMapPtr pMap)
-{
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- /* XXX Add unmapping code here. */
-#elif defined (__UNIXOS2__)
- /* XXX Add unmapping code here. */
-#elif defined(Lynx) && defined(NO_MMAP)
- /* XXX this doesn't allow enable after disable */
- smem_create(NULL, pMap->virtual, pMap->size, SM_DETACH);
- smem_remove("XF86DGA");
-#else
- if (pMap->virtual && pMap->virtual != (void *)-1) {
- mprotect(pMap->virtual,pMap->size, PROT_READ);
- munmap(pMap->virtual, pMap->size);
- pMap->virtual = 0;
- }
- if (pMap->fd >= 0) {
- close(pMap->fd);
- pMap->fd = -1;
- }
-#endif
-}
diff --git a/nx-X11/lib/Xxf86dga/Xxf86dga-def.cpp b/nx-X11/lib/Xxf86dga/Xxf86dga-def.cpp
deleted file mode 100644
index 2318b39c3..000000000
--- a/nx-X11/lib/Xxf86dga/Xxf86dga-def.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-LIBRARY libXxf86dga
-EXPORTS
- XF86DGAQueryExtension
- XF86DGAQueryDirectVideo
- XF86DGAQueryVersion
- XF86DGAInstallColormap
- XF86DGAGetVideoLL
- XF86DGADirectVideoLL
-; XF86DGAGetViewPort
- XF86DGASetViewPort
- XF86DGAGetVidPage
- XF86DGASetVidPage
- XF86DGADirectVideo
- XF86DGAGetVideo
-
-/* $XFree86$ */
diff --git a/nx-X11/lib/Xxf86misc/Imakefile b/nx-X11/lib/Xxf86misc/Imakefile
deleted file mode 100644
index db46af416..000000000
--- a/nx-X11/lib/Xxf86misc/Imakefile
+++ /dev/null
@@ -1,40 +0,0 @@
-XCOMM $XFree86: xc/lib/Xxf86misc/Imakefile,v 3.3 2002/10/16 00:37:34 dawes Exp $
-XCOMM $XdotOrg: xc/lib/Xxf86misc/Imakefile,v 1.3 2005/05/14 18:35:56 alanc Exp $
-
-#define DoNormalLib NormalLibXxf86misc
-#define DoSharedLib SharedLibXxf86misc
-#define DoExtraLib SharedLibXxf86misc
-#define DoDebugLib DebugLibXxf86misc
-#define DoProfileLib ProfileLibXxf86misc
-#define LibName Xxf86misc
-#define SoRev SOXXF86MISCREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXxf86miscReqs
-REQUIREDLIBS = SharedXxf86miscReqs
-#endif
-
-XF86MISCSRCS = XF86Misc.c
-XF86MISCOBJS = XF86Misc.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- SRCS = $(XF86MISCSRCS)
- OBJS = $(XF86MISCOBJS)
- LINTLIBS = $(LINTXLIB)
-
-#define IncludeSharedObjectInNormalLib
-
-#include <Library.tmpl>
-
-InstallGenManPage(XF86Misc,$(LIBMANDIR),$(LIBMANSUFFIX))
-#if ExpandManNames
-InstallGenManPageAliases(XF86Misc,$(LIBMANDIR),$(LIBMANSUFFIX),XF86MiscQueryExtension XF86MiscQueryVersion XF86MiscGetSaver XF86MiscSetSaver XF86MiscGetMouseSettings XF86MiscSetMouseSettings XF86MiscGetKbdSettings XF86MiscSetKbdSettings)
-#endif
-
-DependTarget()
diff --git a/nx-X11/lib/Xxf86misc/XF86Misc.c b/nx-X11/lib/Xxf86misc/XF86Misc.c
deleted file mode 100644
index b0669d527..000000000
--- a/nx-X11/lib/Xxf86misc/XF86Misc.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/* $XFree86: xc/lib/Xxf86misc/XF86Misc.c,v 3.12 2002/11/20 04:04:57 dawes Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 The XFree86 Project, Inc
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/xf86mscstr.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-static XExtensionInfo _xf86misc_info_data;
-static XExtensionInfo *xf86misc_info = &_xf86misc_info_data;
-static char *xf86misc_extension_name = XF86MISCNAME;
-
-#define XF86MiscCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xf86misc_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display *dpy, XExtCodes *codes);
-
-static /* const */ XExtensionHooks xf86misc_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, xf86misc_info,
- xf86misc_extension_name,
- &xf86misc_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86misc_info)
-
-
-/*****************************************************************************
- * *
- * public XFree86-Misc Extension routines *
- * *
- *****************************************************************************/
-
-Bool XF86MiscQueryExtension (dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *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;
- }
-}
-
-Bool XF86MiscQueryVersion(dpy, majorVersion, minorVersion)
- Display* dpy;
- int* majorVersion;
- int* minorVersion;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscQueryVersionReply rep;
- xXF86MiscQueryVersionReq *req;
-
- XF86MiscCheckExtension (dpy, info, False);
- LockDisplay(dpy);
- GetReq(XF86MiscQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- if (*majorVersion > 0 || *minorVersion > 5)
- XF86MiscSetClientVersion(dpy);
-
- return True;
-}
-
-Bool
-XF86MiscSetClientVersion(Display *dpy)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86MiscSetClientVersionReq *req;
-
- XF86MiscCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscSetClientVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscSetClientVersion;
- req->major = XF86MISC_MAJOR_VERSION;
- req->minor = XF86MISC_MINOR_VERSION;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86MiscGetMouseSettings(dpy, mouseinfo)
- Display* dpy;
- XF86MiscMouseSettings *mouseinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscGetMouseSettingsReply rep;
- xXF86MiscGetMouseSettingsReq *req;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscGetMouseSettings, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscGetMouseSettings;
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xXF86MiscGetMouseSettingsReply) - SIZEOF(xReply))>>2,
- xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- mouseinfo->type = rep.mousetype;
- mouseinfo->baudrate = rep.baudrate;
- mouseinfo->samplerate = rep.samplerate;
- mouseinfo->resolution = rep.resolution;
- mouseinfo->buttons = rep.buttons;
- mouseinfo->emulate3buttons = rep.emulate3buttons;
- mouseinfo->emulate3timeout = rep.emulate3timeout;
- mouseinfo->chordmiddle = rep.chordmiddle;
- mouseinfo->flags = rep.flags;
- if (rep.devnamelen > 0) {
- if (!(mouseinfo->device = Xcalloc(rep.devnamelen + 1, 1))) {
- _XEatData(dpy, (rep.devnamelen+3) & ~3);
- Xfree(mouseinfo->device);
- return False;
- }
- _XReadPad(dpy, mouseinfo->device, rep.devnamelen);
- } else
- mouseinfo->device = NULL;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86MiscGetKbdSettings(dpy, kbdinfo)
- Display* dpy;
- XF86MiscKbdSettings *kbdinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscGetKbdSettingsReply rep;
- xXF86MiscGetKbdSettingsReq *req;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscGetKbdSettings, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscGetKbdSettings;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- kbdinfo->type = rep.kbdtype;
- kbdinfo->rate = rep.rate;
- kbdinfo->delay = rep.delay;
- kbdinfo->servnumlock = rep.servnumlock;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86MiscSetMouseSettings(dpy, mouseinfo)
- Display* dpy;
- XF86MiscMouseSettings *mouseinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscSetMouseSettingsReq *req;
- int majorVersion, minorVersion;
-
- XF86MiscCheckExtension (dpy, info, False);
- XF86MiscQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- GetReq(XF86MiscSetMouseSettings, req);
-
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscSetMouseSettings;
- req->mousetype = mouseinfo->type;
- req->baudrate = mouseinfo->baudrate;
- req->samplerate = mouseinfo->samplerate;
- req->resolution = mouseinfo->resolution;
- req->buttons = mouseinfo->buttons;
- req->emulate3buttons = mouseinfo->emulate3buttons;
- req->emulate3timeout = mouseinfo->emulate3timeout;
- req->chordmiddle = mouseinfo->chordmiddle;
- req->flags = mouseinfo->flags;
- if (majorVersion > 0 || minorVersion > 5) {
- int len;
- if ((len = strlen(mouseinfo->device))) {
- req->devnamelen = len + 1;
- len = (req->devnamelen + 3) >> 2;
- SetReqLen(req,len,len);
- Data(dpy, mouseinfo->device, req->devnamelen);
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86MiscSetKbdSettings(dpy, kbdinfo)
- Display* dpy;
- XF86MiscKbdSettings *kbdinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscSetKbdSettingsReq *req;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscSetKbdSettings, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscSetKbdSettings;
- req->kbdtype = kbdinfo->type;
- req->rate = kbdinfo->rate;
- req->delay = kbdinfo->delay;
- req->servnumlock = kbdinfo->servnumlock;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-int XF86MiscSetGrabKeysState(dpy, enable)
- Display* dpy;
- Bool enable;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscSetGrabKeysStateReply rep;
- xXF86MiscSetGrabKeysStateReq *req;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscSetGrabKeysState, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscSetGrabKeysState;
- req->enable = enable;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.status;
-}
-
-Bool XF86MiscGetFilePaths(dpy, filpaths)
- Display* dpy;
- XF86MiscFilePaths *filpaths;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscGetFilePathsReply rep;
- xXF86MiscGetFilePathsReq *req;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscGetFilePaths, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscGetFilePaths;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- if (rep.configlen) {
- if (!(filpaths->configfile = Xcalloc(rep.configlen + 1, 1))) {
- _XEatData(dpy, ((rep.configlen+3) & ~3) + ((rep.modulelen+3) & ~3)
- + ((rep.loglen+3) & ~3));
- return False;
- }
- }
-
- if (rep.modulelen) {
- if (!(filpaths->modulepath = Xcalloc(rep.modulelen + 1, 1))) {
- _XEatData(dpy, ((rep.configlen+3) & ~3) + ((rep.modulelen+3) & ~3)
- + ((rep.loglen+3) & ~3));
- if (filpaths->configfile)
- Xfree(filpaths->configfile);
- return False;
- }
- }
-
- if (rep.loglen) {
- if (!(filpaths->logfile = Xcalloc(rep.loglen + 1, 1))) {
- _XEatData(dpy, ((rep.configlen+3) & ~3) + ((rep.modulelen+3) & ~3)
- + ((rep.loglen+3) & ~3));
- if (filpaths->configfile)
- Xfree(filpaths->configfile);
- if (filpaths->modulepath)
- Xfree(filpaths->modulepath);
- return False;
- }
- }
-
- if (rep.configlen)
- _XReadPad(dpy, filpaths->configfile, rep.configlen);
- else
- filpaths->configfile = "";
-
- if (rep.modulelen)
- _XReadPad(dpy, filpaths->modulepath, rep.modulelen);
- else
- filpaths->modulepath = "";
-
- if (rep.loglen)
- _XReadPad(dpy, filpaths->logfile, rep.loglen);
- else
- filpaths->logfile = "";
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status XF86MiscPassMessage(dpy, screen, msgtype, msgval, retmsg)
- Display* dpy;
- int screen;
- const char* msgtype;
- const char* msgval;
- char** retmsg;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscPassMessageReply rep;
- xXF86MiscPassMessageReq *req;
- int len;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscPassMessage, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscPassMessage;
- req->screen = screen;
- if ((len = strlen(msgtype))) {
- req->typelen = len + 1;
- len = (req->typelen + 3) >> 2;
- SetReqLen(req,len,len);
- Data(dpy, msgtype, req->typelen);
- }
- if ((len = strlen(msgval))) {
- req->vallen = len + 1;
- len = (req->vallen + 3) >> 2;
- SetReqLen(req,len,len);
- Data(dpy, msgval, req->vallen);
- }
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return BadImplementation;
- }
-
- if (rep.mesglen) {
- if (!(*retmsg = Xcalloc(rep.mesglen + 1, 1))) {
- _XEatData(dpy, ((rep.mesglen+3) & ~3));
- return BadAlloc;
- }
- _XReadPad(dpy, *retmsg, rep.mesglen);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.status;
-}
-
diff --git a/nx-X11/lib/Xxf86misc/XF86Misc.man b/nx-X11/lib/Xxf86misc/XF86Misc.man
deleted file mode 100644
index 2c80dff0b..000000000
--- a/nx-X11/lib/Xxf86misc/XF86Misc.man
+++ /dev/null
@@ -1,217 +0,0 @@
-.\" $XdotOrg: xc/lib/Xxf86misc/XF86Misc.man,v 1.2 2004/04/23 19:23:08 eich Exp $
-.\" $TOG: XF86Misc.man /main/7 1997/07/19 10:30:32 kaleb $
-.\"
-.\"
-.\"
-.\" Copyright (c) 1996 Joe Moss, The XFree86 Project
-.\"
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man,v 3.12 2002/12/22 00:46:54 dawes Exp $
-.de ZN
-.ie t \fB\^\\$1\^\fR\\$2
-.el \fI\^\\$1\^\fP\\$2
-..
-.TH XF86MISC __libmansuffix__ __vendorversion__ "X FUNCTIONS"
-.SH NAME
-XF86MiscQueryExtension, XF86MiscQueryVersion, XF86MiscGetMouseSettings, XF86MiscSetMouseSettings, XF86MiscGetKbdSettings, XF86MiscSetKbdSettings \- Extension library for the XFree86-Misc X extension.
-.SH SYNTAX
-.nf
-.LP
-\&#include <X11/extensions/xf86misc.h>
-.LP
-Bool XF86MiscQueryExtension(
- Display *\fIdisplay\fP\^,
- int *\fIevent_base_return\fP\^,
- int *\fIerror_base_return\fP\^);
-.LP
-Bool XF86MiscQueryVersion(
- Display *\fIdisplay\fP\^,
- int *\fImajor_version_return\fP\^,
- int *\fIminor_version_return\fP\^);
-.ig
-.LP
-Status XF86MiscGetSaver(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int *\fIsuspend_time_return\fP\^,
- int *\fIoff_time_return\fP\^);
-.LP
-Status XF86MiscSetSaver(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int \fIsuspend_time\fP\^,
- int \fIoff_time\fP\^);
-..
-.LP
-Status XF86MiscGetMouseSettings(
- Display *\fIdisplay\fP\^,
- XF86MiscMouseSettings *\fImseinfo\fP\^);
-.LP
-Status XF86MiscSetMouseSettings(
- Display *\fIdisplay\fP\^,
- XF86MiscMouseSettings *\fImseinfo\fP\^);
-.LP
-Status XF86MiscGetKbdSettings(
- Display *\fIdisplay\fP\^,
- XF86MiscKbdSettings *\fIkbdinfo\fP\^);
-.LP
-Status XF86MiscSetKbdSettings(
- Display *\fIdisplay\fP\^,
- XF86MiscKbdSettings *\fIkbdinfo\fP\^);
-.fi
-.SH ARGUMENTS
-.IP \fIdisplay\fP 2i
-Specifies the connection to the X server.
-.IP \fIscreen\fP 2i
-Specifies which screen number the setting apply to.
-.IP \fIevent_base_return\fP 2i
-Returns the base event number for the extension.
-.IP \fIerror_base_return\fP 2i
-Returns the base error number for the extension.
-.IP \fImajor_version_return\fP 2i
-Returns the major version number of the extension.
-.IP \fIminor_version_return\fP 2i
-Returns the minor version number of the extension.
-.ig
-.IP \fIsuspend_time_return\fP 2i
-Returns the number of seconds of idle time the server
-will wait before activating the monitor's suspend mode.
-.IP \fIoff_time_return\fP 2i
-Returns the number of seconds of idle time the server
-will wait before causing the monitor to powerdown.
-.IP \fIsuspend_time\fP 2i
-Specifies the number of seconds of idle time the server
-should wait before activating the monitor's suspend mode.
-.IP \fIoff_time\fP 2i
-Specifies the number of seconds of idle time the server
-should wait before causing the monitor to powerdown.
-..
-.IP \fImseinfo\fP 2i
-Specifies a structure which contains the mouse parameters.
-.IP \fIkbdinfo\fP 2i
-Specifies a structure which contains the keyboard parameters.
-.SH STRUCTURES
-.nf
-.ta 3i
-\fIMouse:\fP
-typedef struct {
- char *device; /\(** returned path to device */
- int type; /\(** mouse protocol */
- int baudrate; /\(** 1200, 2400, 4800, or 9600 */
- int samplerate; /\(** samples per second */
- int resolution; /\(** resolution, count per inch */
- int buttons; /\(** number of buttons */
- Bool emulate3buttons; /\(** Button1+Button3 -> Button2 ? */
- int emulate3timeout; /\(** in milliseconds */
- Bool chordmiddle; /\(** Button1+Button3 == Button2 ? */
- int flags; /\(** Device open flags */
-} XF86MiscMouseSettings;
-.LP
-\fIKeyboard:\fP
-typedef struct {
- int type; /\(** of keyboard: 84-key, 101-key, Xqueue */
- int rate; /\(** repeat rate */
- int delay; /\(** delay until repeat starts */
- Bool servnumlock; /\(** Server handles NumLock ? */
-} XF86MiscKbdSettings;
-.fi
-.SH DESCRIPTION
-These functions provide an interface to the
-\fIXFree86-Misc\fP extension
-which allows various server settings to be
-queried and changed dynamically.
-Applications that use these functions must be linked with
-.ZN -lXxf86misc
-.SS "POWER-SAVER FUNCTIONS"
-The
-.ZN XF86MiscGetSaver
-and
-.ZN XF86MiscSetSaver
-functions have been removed. This functionality is now provided by
-the DPMS extension.
-.SS "MOUSE FUNCTIONS"
-Mouse parameters can be queried using the function
-.ZN XF86MiscGetMouseSettings .
-The structure pointed to by its second argument is filled in
-with the current mouse settings.
-.PP
-Not all fields are valid in all cases.
-For example, when the protocol indicates a bus mouse (i.e. the
-type field has value
-.ZN MTYPE_BUSMOUSE
-as defined in
-.ZN xf86misc.h ),
-then the value in the
-.ZN baudrate
-field should be ignored as it does not apply to bus mice.
-.PP
-The
-.ZN samplerate
-field contains the resolution in lines per inch when
-using the Hitachi tablet protocol.
-.PP
-The device field of the structure points to dynamically
-allocated storage which should be freed by the caller.
-.PP
-Any of the fields of the structure can be altered and then passed
-to the
-.ZN XF86MiscSetMouseSettings
-function to change their value in the server,
-with the following restrictions:
-.RS 5
-.IP 1) 3
-The device can not be changed
-.IP 2) 3
-The protocol can not be changed to or from Xqueue or OsMouse
-.IP 3) 3
-The buttons field can not be changed
-.IP 4) 3
-Invalid combinations of parameters are not allowed
-.RE
-.PP
-The server will generate an error if any of the above is attempted,
-except the first \- the contents of the device field are simply ignored.
-.PP
-A change of the protocol causes the device to be closed and reopened.
-Changes to the baud rate, sample rate, resolution or flags,
-when applicable to the
-selected protocol, also cause a reopen of the device.
-A reopen can be forced by using the MF_REOPEN flag, except in the
-case of the OsMouse and Xqueue protocols which ignore all attempts
-to reopen the device.
-.SS "KEYBOARD FUNCTIONS"
-The
-.ZN XF86MiscGetKbdSettings
-function allows you to retrieve the current keyboard-related
-settings from the server.
-.PP
-Using the
-.ZN XF86MiscSetKbdSettings
-function, the keyboard autorepeat delay and rate can be set.
-Requests to change the
-.ZN type
-and
-.ZN servnumlock
-fields are ignored (except for checking for an invalid keyboard type).
-This is expected to change in a future release.
-.SS "OTHER FUNCTIONS"
-Two functions,
-.ZN XF86MiscQueryExtension
-and
-.ZN XF86MiscQueryVersion ,
-are provided which allow the client to query some information
-regarding the extension itself.
-.SH PREDEFINED VALUES
-The header file
-.ZN X11/extensions/xf86misc.h
-contains definitions for
-.IP \fBMTYPE_\fP* 1i
-Mouse protocols
-.IP \fBKTYPE_\fP* 1i
-Keyboard types
-.IP \fBMF_\fP* 1i
-Mouse flags
-.SH "SEE ALSO"
-xset(__appmansuffix__), __xconfigfile__(__filemansuffix__)
-.SH AUTHORS
-Joe Moss and David Dawes, The XFree86 Project, Inc.
-
diff --git a/nx-X11/lib/Xxf86misc/Xxf86misc-def.cpp b/nx-X11/lib/Xxf86misc/Xxf86misc-def.cpp
deleted file mode 100644
index 74b1df8e6..000000000
--- a/nx-X11/lib/Xxf86misc/Xxf86misc-def.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-LIBRARY XXF86MISC
-EXPORTS
- XF86MiscQueryExtension
- XF86MiscQueryVersion
- XF86MiscSetKbdSettings
- XF86MiscGetKbdSettings
- XF86MiscSetMouseSettings
- XF86MiscGetMouseSettings
- XF86MiscGetFilePaths
-; XF86MiscSetSaver
-; XF86MiscGetSaver
-
-
-/* $XFree86: xc/lib/Xxf86misc/Xxf86misc-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */
diff --git a/nx-X11/lib/Xxf86vm/Imakefile b/nx-X11/lib/Xxf86vm/Imakefile
deleted file mode 100644
index 84a29eb1d..000000000
--- a/nx-X11/lib/Xxf86vm/Imakefile
+++ /dev/null
@@ -1,40 +0,0 @@
-XCOMM $XFree86: xc/lib/Xxf86vm/Imakefile,v 3.3 2002/10/16 00:37:34 dawes Exp $
-XCOMM $XdotOrg: xc/lib/Xxf86vm/Imakefile,v 1.3 2005/05/14 18:35:56 alanc Exp $
-
-#define DoNormalLib NormalLibXxf86vm
-#define DoSharedLib SharedLibXxf86vm
-#define DoExtraLib SharedLibXxf86vm
-#define DoDebugLib DebugLibXxf86vm
-#define DoProfileLib ProfileLibXxf86vm
-#define LibName Xxf86vm
-#define SoRev SOXXF86VMREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXxf86vmReqs
-REQUIREDLIBS = SharedXxf86vmReqs
-#endif
-
-VIDMODESRCS = XF86VMode.c
-VIDMODEOBJS = XF86VMode.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- SRCS = $(VIDMODESRCS)
- OBJS = $(VIDMODEOBJS)
- LINTLIBS = $(LINTXLIB)
-
-#define IncludeSharedObjectInNormalLib
-
-#include <Library.tmpl>
-
-InstallGenManPageLong(XF86VM,$(LIBMANDIR),XF86VidMode,$(LIBMANSUFFIX))
-#if ExpandManNames
-InstallGenManPageAliases(XF86VidMode,$(LIBMANDIR),$(LIBMANSUFFIX),XF86VidModeQueryExtension XF86VidModeQueryVersion XF86VidModeGetModeLine XF86VidModeGetAllModeLines XF86VidModeDeleteModeLine XF86VidModeModModeLine XF86VidModeSwitchMode XF86VidModeSwitchToMode XF86VidModeLockModeSwitch XF86VidModeGetMonitor XF86VidModeGetViewPort XF86VidModeSetViewPort XF86VidModeValidateModeLine XF86VidModeSetClientVersion XF86VidModeGetDotClocks XF86VidModeGetGamma XF86VidModeSetGamma XF86VidModeSetGammaRamp XF86VidModeGetGammaRamp XF86VidModeGetGammaRampSize XF86VidModeGetPermissions)
-#endif
-
-DependTarget()
diff --git a/nx-X11/lib/Xxf86vm/XF86VM.man b/nx-X11/lib/Xxf86vm/XF86VM.man
deleted file mode 100644
index 6e53ad158..000000000
--- a/nx-X11/lib/Xxf86vm/XF86VM.man
+++ /dev/null
@@ -1,425 +0,0 @@
-.\" $XdotOrg: xc/lib/Xxf86vm/XF86VM.man,v 1.2 2004/04/23 19:23:08 eich Exp $
-.\" $TOG: XF86VM.man /main/6 1997/07/19 10:30:39 kaleb $
-.\"
-.\"
-.\"
-.\"
-.\" Copyright (c) 1996 Joe Moss, The XFree86 Project
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man,v 3.14 2003/10/02 13:29:56 eich Exp $
-.\"
-.de ZN
-.ie t \fB\^\\$1\^\fR\\$2
-.el \fI\^\\$1\^\fP\\$2
-..
-.TH XF86VIDMODE __libmansuffix__ __vendorversion__
-.SH NAME
-XF86VidModeQueryExtension, XF86VidModeQueryVersion, XF86VidModeSetClientVersion, XF86VidModeGetModeLine, XF86VidModeGetAllModeLines, XF86VidModeDeleteModeLine, XF86VidModeModModeLine, XF86VidModeValidateModeLine, XF86VidModeSwitchMode, XF86VidModeSwitchToMode, XF86VidModeLockModeSwitch, XF86VidModeGetMonitor, XF86VidModeGetViewPort, XF86VidModeSetViewPort, XF86VidModeGetDotClocks, XF86VidModeGetGamma, XF86VidModeSetGamma, XF86VidModeGetGammaRamp, XF86VidModeSetGammaRamp, XF86VidModeGetGammaRampSize, XF86VidModeGetPermissions \- Extension libary for the XFree86-VidMode X extension
-.SH SYNTAX
-.nf
-.LP
-\&#include <X11/extensions/xf86vmode.h>
-.LP
-Bool XF86VidModeQueryExtension(
- Display *\fIdisplay\fP\^,
- int *\fIevent_base_return\fP\^,
- int *\fIerror_base_return\fP\^);
-.LP
-Bool XF86VidModeQueryVersion(
- Display *\fIdisplay\fP\^,
- int *\fImajor_version_return\fP\^,
- int *\fIminor_version_return\fP\^);
-.LP
-Bool XF86VidModeSetClientVersion(
- Display *\fIdisplay\fP\^);
-.LP
-Bool XF86VidModeGetModeLine(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int *\fIdotclock_return\fP\^,
- XF86VidModeModeLine *\fImodeline\fP\^);
-.LP
-Bool XF86VidModeGetAllModeLines(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int *\fImodecount_return\fP\^,
- XF86VidModeModeInfo ***\fImodesinfo\fP\^);
-.ig
-.LP
-Bool XF86VidModeAddModeLine(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- XF86VidModeModeInfo *\fImodeline\fP\,
- XF86VidModeModeInfo *\fIaftermode\fP\^);
-..
-.LP
-Bool XF86VidModeDeleteModeLine(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- XF86VidModeModeInfo *\fImodeline\fP\^);
-.LP
-Bool XF86VidModeModModeLine(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- XF86VidModeModeLine *\fImodeline\fP\^);
-.LP
-Status XF86VidModeValidateModeLine(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- XF86VidModeModeLine *\fImodeline\fP\^);
-.LP
-Bool XF86VidModeSwitchMode(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int \fIzoom\fP\^);
-.LP
-Bool XF86VidModeSwitchToMode(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- XF86VidModeModeInfo *\fImodeline\fP\^);
-.LP
-Bool XF86VidModeLockModeSwitch(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int \fIlock\fP\^);
-.LP
-Bool XF86VidModeGetMonitor(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- XF86VidModeMonitor *\fImonitor\fP\^);
-.LP
-Bool XF86VidModeGetViewPort(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int *\fIx_return\fP\^,
- int *\fIy_return\fP\^);
-.LP
-Bool XF86VidModeSetViewPort(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int \fIx\fP\^,
- int \fIy\fP\^);
-.LP
-XF86VidModeGetDotClocks(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int *\fIflags return\fP\^,
- int *\fInumber of clocks return\fP\^,
- int *\fImax dot clock return\fP\^,
- int **\fIclocks return\fP\^);
-.LP
-XF86VidModeGetGamma(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- XF86VidModeGamma *\fIGamma\fP\^);
-.LP
-XF86VidModeSetGamma(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- XF86VidModeGamma *\fIGamma\fP\^);
-.LP
-XF86VidModeGetGammaRamp(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int \fIsize\fP\^,
- unsigned short *\fIred array\fP\^,
- unsigned short *\fIgreen array\fP\^,
- unsigned short *\fIblue array\fP\^);
-.LP
-XF86VidModeSetGammaRamp(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int \fIsize\fP\^,
- unsigned short *\fIred array\fP\^,
- unsigned short *\fIgreen array\fP\^,
- unsigned short *\fIblue array\fP\^);
-.LP
-XF86VidModeGetGammaRampSize(
- Display *\fIdisplay\fP\^,
- int \fIscreen\fP\^,
- int *\fIsize\fP\^);
-.fi
-.SH ARGUMENTS
-.IP \fIdisplay\fP 2i
-Specifies the connection to the X server.
-.IP \fIscreen\fP 2i
-Specifies which screen number the setting apply to.
-.IP \fIevent_base_return\fP 2i
-Returns the base event number for the extension.
-.IP \fIerror_base_return\fP 2i
-Returns the base error number for the extension.
-.IP \fImajor_version_return\fP 2i
-Returns the major version number of the extension.
-.IP \fIminor_version_return\fP 2i
-Returns the minor version number of the extension.
-.IP \fIdotclock_return\fP 2i
-Returns the clock for the mode line.
-.IP \fImodecount_return\fP 2i
-Returns the number of video modes available in the server.
-.IP \fIzoom\fP 2i
-If greater than zero, indicates that the server should switch to
-the next mode, otherwise switch to the previous mode.
-.IP \fIlock\fP 2i
-Indicates that mode switching should be locked, if non-zero.
-.IP \fImodeline\fP 2i
-Specifies or returns the timing values for a video mode.
-.ig
-.IP \fIaftermode\fP 2i
-Specifies the timing values for the video mode after which the
-new mode will added.
-..
-.IP \fImodesinfo\fP 2i
-Returns the timing values and dotclocks for all of the available
-video modes.
-.IP \fImonitor\fP 2i
-Returns information about the monitor.
-.IP \fIx\fP 2i
-Specifies the desired X location for the viewport.
-.IP \fIx_return\fP 2i
-Returns the current X location of the viewport.
-.IP \fIy\fP 2i
-Specifies the desired Y location for the viewport.
-.IP \fIy_return\fP 2i
-Returns the current Y location of the viewport.
-.SH STRUCTURES
-.nf
-.ta 2.25i 3.5i
-\fIVideo Mode Settings:\fP
-typedef struct {
- unsigned short hdisplay; /\(** Number of display pixels horizontally */
- unsigned short hsyncstart; /\(** Horizontal sync start */
- unsigned short hsyncend; /\(** Horizontal sync end */
- unsigned short htotal; /\(** Total horizontal pixels */
- unsigned short vdisplay; /\(** Number of display pixels vertically */
- unsigned short vsyncstart; /\(** Vertical sync start */
- unsigned short vsyncend; /\(** Vertical sync start */
- unsigned short vtotal; /\(** Total vertical pixels */
- unsigned int flags; /\(** Mode flags */
- int privsize; /\(** Size of private */
- INT32 *private; /\(** Server privates */
-} XF86VidModeModeLine;
-.sp
-typedef struct {
- unsigned int dotclock; /\(** Pixel clock */
- unsigned short hdisplay; /\(** Number of display pixels horizontally */
- unsigned short hsyncstart; /\(** Horizontal sync start */
- unsigned short hsyncend; /\(** Horizontal sync end */
- unsigned short htotal; /\(** Total horizontal pixels */
- unsigned short vdisplay; /\(** Number of display pixels vertically */
- unsigned short vsyncstart; /\(** Vertical sync start */
- unsigned short vsyncend; /\(** Vertical sync start */
- unsigned short vtotal; /\(** Total vertical pixels */
- unsigned int flags; /\(** Mode flags */
- int privsize; /\(** Size of private */
- INT32 *private; /\(** Server privates */
-} XF86VidModeModeInfo;
-.LP
-\fIMonitor information:\fP
-typedef struct {
- char* vendor; /\(** Name of manufacturer */
- char* model; /\(** Model name */
- float EMPTY; /\(** unused, for backward compatibility */
- unsigned char nhsync; /\(** Number of horiz sync ranges */
- XF86VidModeSyncRange* hsync; /\(** Horizontal sync ranges */
- unsigned char nvsync; /\(** Number of vert sync ranges */
- XF86VidModeSyncRange* vsync; /\(** Vertical sync ranges */
-} XF86VidModeMonitor;
-.sp
-typedef struct {
- float hi; /\(** Top of range */
- float lo; /\(** Bottom of range */
-} XF86VidModeSyncRange;
-.LP
-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;
-.LP
-typedef struct {
- float red; /\(** Red Gamma value */
- float green; /\(** Green Gamma value */
- float blue; /\(** Blue Gamma value */
-} XF86VidModeGamma;
-.fi
-.SH DESCRIPTION
-These functions provide an interface to the server extension
-\fIXFree86-VidModeExtension\fP
-which allows the video modes to be
-queried and adjusted dynamically and mode switching to be controlled.
-Applications that use these functions must be linked with
-.ZN -lXxf86vm
-.SS "MODELINE FUNCTIONS"
-The
-.ZN XF86VidModeGetModeLine
-function is used to query the settings for the currently selected
-video mode. The calling program should pass a pointer to a
-.ZN XF86VidModeModeLine
-structure that it has already allocated. The function fills in
-the fields of the structure.
-.PP
-If there are any server private values (currently only applicable to
-the S3 server) the function will allocate storage for them.
-Therefore, if the
-.ZN privsize
-field is non-zero, the calling program should call
-.ZN Xfree(private)
-to free the storage.
-.PP
-.ZN XF86VidModeGetAllModeLines
-returns the settings for all video modes.
-The calling program supplies the address of a pointer which will be
-set by the function to point to an array of
-.ZN XF86VidModeModeInfo
-structures. The memory occupied by the array is dynamically allocated
-by the
-.ZN XF86VidModeGetAllModeLines
-function and should be freed by the caller.
-The first element of the array corresponds to the current video mode.
-.PP
-The
-.ZN XF86VidModeModModeLine
-function can be used to change the settings of the current video mode
-provided the requested settings are valid (e.g. they don't exceed the
-capabilities of the monitor).
-.PP
-.ig
-To add a mode to the list of available modes, the
-.ZN XF86VidModeAddModeLine
-function can be used.
-Assuming the settings are valid, the video mode will be added after
-the existing mode which matches the timings specified by the
-.ZN aftermode
-parameter.
-To be considered a match, all of the fields of the given
-.ZN XF86VidModeModeInfo
-structure must match, except the
-.ZN privsize
-and
-.ZN private
-fields.
-If the
-.ZN aftermode
-parameter is zero, the mode will be added
-after the current mode.
-.PP
-..
-Modes can be deleted with the
-.ZN XF86VidModeDeleteModeLine
-function. The specified mode must match an existing mode.
-To be considered a match, all of the fields of the given
-.ZN XF86VidModeModeInfo
-structure must match, except the
-.ZN privsize
-and
-.ZN private
-fields.
-If the mode to be deleted is the current mode, a mode switch
-to the next mode will occur first. The last remaining mode can not
-be deleted.
-.PP
-The validity of a mode can be checked with the
-.ZN XF86VidModeValidateModeLine
-function.
-If the specified mode can be used by the server (i.e. meets all the
-constraints placed upon a mode by the combination of the server, card,
-and monitor) the function returns
-.ZN MODE_OK ,
-otherwise it returns a value indicating the reason why the mode is
-invalid (as defined in \fIxf86.h\fP)
-.SS "MODE SWITCH FUNCTIONS"
-When the function
-.ZN XF86VidModeSwitchMode
-is called, the server will change the video mode to next (or previous)
-video mode. The
-.ZN XF86VidModeSwitchToMode
-function can be used to switch directly to the specified mode.
-Matching is as specified in the description of the
-.ZN XF86VidModeAddModeLine
-function above.
-The
-.ZN XF86VidModeLockModeSwitch
-function can be used to allow or disallow mode switching whether
-the request to switch modes comes from a call to the
-.ZN XF86VidModeSwitchMode
-or
-.ZN XF86VidModeSwitchToMode
-functions or from one of the mode switch key sequences.
-.PP
-.RB Note:
-Because of the asynchronous nature of the X protocol, a call to
-.ZN XFlush
-is needed if the application wants to see the mode change immediately.
-To be informed of the execution status of the request, a
-custom error handler should be installed using
-.ZN XSetErrorHandler
-before calling the mode switching function.
-.SS "MONITOR FUNCTIONS"
-Information known to the server about the monitor is returned by the
-.ZN XF86VidModeGetMonitor
-function. The
-.ZN hsync
-and
-.ZN vsync
-fields each point to an array of
-.ZN XF86VidModeSyncRange
-structures. The arrays contain
-.ZN nhsync
-and
-.ZN nvsync
-elements, respectively.
-The
-.ZN hi
-and
-.ZN low
-values will be equal if a discreate value was given in the
-.ZN XF86Config
-file.
-.PP
-The
-.ZN vendor ,
-.ZN model ,
-.ZN hsync ,
-and
-.ZN vsync
-fields point to dynamically allocated storage that should be freed
-by the caller.
-.SS "VIEWPORT FUNCTIONS"
-The
-.ZN XF86VidModeGetViewPort
-and
-.ZN XF86VidModeSetViewPort
-functions can be used to, respectively, query and change the location
-of the upper left corner of the viewport into the virtual screen.
-.SS "OTHER FUNCTIONS"
-The
-.ZN XF86VidModeQueryVersion
-function can be used to determine the version of the extension
-built into the server.
-.PP
-The function
-.ZN XF86VidModeQueryExtension
-returns the lowest numbered error and event values
-assigned to the extension.
-.SH BUGS
-The
-XF86VidModeSetClientVersion,
-XF86VidModeGetDotClocks,
-XF86VidModeGetGamma,
-XF86VidModeSetGamma,
-XF86VidModeSetGammaRamp,
-XF86VidModeGetGammaRamp,
-XF86VidModeGetGammaRampSize,
-and
-XF86VidModeGetPermissions
-functions need to be documented. In the meantime, check the source
-code for information about how to use them.
-.SH SEE ALSO
-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), XFlush(__libmansuffix__), XSetErrorHandler(__libmansuffix__), xvidtune(__appmansuffix__)
-.SH AUTHORS
-Kaleb Keithley, Jon Tombs, David Dawes, and Joe Moss
diff --git a/nx-X11/lib/Xxf86vm/XF86VMode.c b/nx-X11/lib/Xxf86vm/XF86VMode.c
deleted file mode 100644
index edff93fe5..000000000
--- a/nx-X11/lib/Xxf86vm/XF86VMode.c
+++ /dev/null
@@ -1,1231 +0,0 @@
-/* $XConsortium: XF86VMode.c /main/2 1995/11/14 18:17:58 kaleb $ */
-/* $XFree86: xc/lib/Xxf86vm/XF86VMode.c,v 3.33 2002/10/16 00:37:34 dawes Exp $ */
-/*
-
-Copyright (c) 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.
-
-*/
-/* $XConsortium: XF86VMode.c /main/4 1996/01/16 07:52:25 kaleb CHECKEDOUT $ */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/xf86vmstr.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-#ifndef MODE_BAD
-#define MODE_BAD 255
-#endif
-
-static XExtensionInfo _xf86vidmode_info_data;
-static XExtensionInfo *xf86vidmode_info = &_xf86vidmode_info_data;
-static char *xf86vidmode_extension_name = XF86VIDMODENAME;
-
-#define XF86VidModeCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xf86vidmode_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static XEXT_CLOSE_DISPLAY_PROTO(close_display);
-static /* const */ XExtensionHooks xf86vidmode_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, xf86vidmode_info,
- xf86vidmode_extension_name,
- &xf86vidmode_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86vidmode_info)
-
-
-/*****************************************************************************
- * *
- * public XFree86-VidMode Extension routines *
- * *
- *****************************************************************************/
-
-Bool
-XF86VidModeQueryExtension (dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *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;
- }
-}
-
-Bool
-XF86VidModeQueryVersion(dpy, majorVersion, minorVersion)
- Display* dpy;
- int* majorVersion;
- int* minorVersion;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeQueryVersionReply rep;
- xXF86VidModeQueryVersionReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- if (*majorVersion >= 2)
- XF86VidModeSetClientVersion(dpy);
- return True;
-}
-
-Bool
-XF86VidModeSetClientVersion(Display *dpy)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86VidModeSetClientVersionReq *req;
-
- XF86VidModeCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeSetClientVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSetClientVersion;
- req->major = XF86VIDMODE_MAJOR_VERSION;
- req->minor = XF86VIDMODE_MINOR_VERSION;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeSetGamma(Display *dpy, int screen, XF86VidModeGamma *Gamma)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86VidModeSetGammaReq *req;
-
- XF86VidModeCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeSetGamma, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSetGamma;
- req->screen = screen;
- req->red = (CARD32)(Gamma->red * 10000.);
- req->green = (CARD32)(Gamma->green * 10000.);
- req->blue = (CARD32)(Gamma->blue * 10000.);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetGamma(Display *dpy, int screen, XF86VidModeGamma *Gamma)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetGammaReply rep;
- xXF86VidModeGetGammaReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetGamma, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetGamma;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- Gamma->red = ((float)rep.red) / 10000.;
- Gamma->green = ((float)rep.green) / 10000.;
- Gamma->blue = ((float)rep.blue) / 10000.;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetModeLine(dpy, screen, dotclock, modeline)
- Display* dpy;
- int screen;
- int* dotclock;
- XF86VidModeModeLine* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetModeLineReply rep;
- xXF86OldVidModeGetModeLineReply oldrep;
- xXF86VidModeGetModeLineReq *req;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, False);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetModeLine;
- req->screen = screen;
-
- if (majorVersion < 2) {
- if (!_XReply(dpy, (xReply *)&oldrep,
- (SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *dotclock = oldrep.dotclock;
- modeline->hdisplay = oldrep.hdisplay;
- modeline->hsyncstart = oldrep.hsyncstart;
- modeline->hsyncend = oldrep.hsyncend;
- modeline->htotal = oldrep.htotal;
- modeline->hskew = 0;
- modeline->vdisplay = oldrep.vdisplay;
- modeline->vsyncstart = oldrep.vsyncstart;
- modeline->vsyncend = oldrep.vsyncend;
- modeline->vtotal = oldrep.vtotal;
- modeline->flags = oldrep.flags;
- modeline->privsize = oldrep.privsize;
- } else {
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *dotclock = rep.dotclock;
- modeline->hdisplay = rep.hdisplay;
- modeline->hsyncstart = rep.hsyncstart;
- modeline->hsyncend = rep.hsyncend;
- modeline->htotal = rep.htotal;
- modeline->hskew = rep.hskew;
- modeline->vdisplay = rep.vdisplay;
- modeline->vsyncstart = rep.vsyncstart;
- modeline->vsyncend = rep.vsyncend;
- modeline->vtotal = rep.vtotal;
- modeline->flags = rep.flags;
- modeline->privsize = rep.privsize;
- }
-
- if (modeline->privsize > 0) {
- if (!(modeline->private = Xcalloc(modeline->privsize, sizeof(INT32)))) {
- _XEatData(dpy, (modeline->privsize) * sizeof(INT32));
- Xfree(modeline->private);
- return False;
- }
- _XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
- } else {
- modeline->private = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetAllModeLines(dpy, screen, modecount, modelinesPtr)
- Display* dpy;
- int screen;
- int* modecount;
- XF86VidModeModeInfo ***modelinesPtr;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetAllModeLinesReply rep;
- xXF86VidModeGetAllModeLinesReq *req;
- XF86VidModeModeInfo *mdinfptr, **modelines;
- xXF86VidModeModeInfo xmdline;
- xXF86OldVidModeModeInfo oldxmdline;
- int i;
- int majorVersion, minorVersion;
- Bool protocolBug = False;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- /*
- * Note: There was a bug in the protocol implementation in versions
- * 0.x with x < 8 (the .private field wasn't being passed over the wire).
- * Check the server's version, and accept the old format if appropriate.
- */
-
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
- if (majorVersion == 0 && minorVersion < 8) {
- protocolBug = True;
-#ifdef DEBUG
- fprintf(stderr, "XF86VidModeGetAllModeLines: Warning: Xserver is"
- "running an old version (%d.%d)\n", majorVersion,
- minorVersion);
-#endif
- }
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetAllModeLines, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetAllModeLines;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xXF86VidModeGetAllModeLinesReply) - SIZEOF(xReply)) >> 2, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *modecount = rep.modecount;
-
- if (!(modelines = (XF86VidModeModeInfo **) Xcalloc(rep.modecount,
- sizeof(XF86VidModeModeInfo *)
- +sizeof(XF86VidModeModeInfo)))) {
- if (majorVersion < 2)
- _XEatData(dpy, (rep.modecount) * sizeof(xXF86OldVidModeModeInfo));
- else
- _XEatData(dpy, (rep.modecount) * sizeof(xXF86VidModeModeInfo));
- Xfree(modelines);
- return False;
- }
- mdinfptr = (XF86VidModeModeInfo *) (
- (char *) modelines
- + rep.modecount*sizeof(XF86VidModeModeInfo *)
- );
-
- for (i = 0; i < rep.modecount; i++) {
- modelines[i] = mdinfptr++;
- if (majorVersion < 2) {
- _XRead(dpy, (char*)&oldxmdline, sizeof(xXF86OldVidModeModeInfo));
- modelines[i]->dotclock = oldxmdline.dotclock;
- modelines[i]->hdisplay = oldxmdline.hdisplay;
- modelines[i]->hsyncstart = oldxmdline.hsyncstart;
- modelines[i]->hsyncend = oldxmdline.hsyncend;
- modelines[i]->htotal = oldxmdline.htotal;
- modelines[i]->hskew = 0;
- modelines[i]->vdisplay = oldxmdline.vdisplay;
- modelines[i]->vsyncstart = oldxmdline.vsyncstart;
- modelines[i]->vsyncend = oldxmdline.vsyncend;
- modelines[i]->vtotal = oldxmdline.vtotal;
- modelines[i]->flags = oldxmdline.flags;
- if (protocolBug) {
- modelines[i]->privsize = 0;
- modelines[i]->private = NULL;
- } else {
- modelines[i]->privsize = oldxmdline.privsize;
- if (oldxmdline.privsize > 0) {
- if (!(modelines[i]->private =
- Xcalloc(oldxmdline.privsize, sizeof(INT32)))) {
- _XEatData(dpy, (oldxmdline.privsize) * sizeof(INT32));
- Xfree(modelines[i]->private);
- } else {
- _XRead(dpy, (char*)modelines[i]->private,
- oldxmdline.privsize * sizeof(INT32));
- }
- } else {
- modelines[i]->private = NULL;
- }
- }
- } else {
- _XRead(dpy, (char*)&xmdline, sizeof(xXF86VidModeModeInfo));
- modelines[i]->dotclock = xmdline.dotclock;
- modelines[i]->hdisplay = xmdline.hdisplay;
- modelines[i]->hsyncstart = xmdline.hsyncstart;
- modelines[i]->hsyncend = xmdline.hsyncend;
- modelines[i]->htotal = xmdline.htotal;
- modelines[i]->hskew = xmdline.hskew;
- modelines[i]->vdisplay = xmdline.vdisplay;
- modelines[i]->vsyncstart = xmdline.vsyncstart;
- modelines[i]->vsyncend = xmdline.vsyncend;
- modelines[i]->vtotal = xmdline.vtotal;
- modelines[i]->flags = xmdline.flags;
- if (protocolBug) {
- modelines[i]->privsize = 0;
- modelines[i]->private = NULL;
- } else {
- modelines[i]->privsize = xmdline.privsize;
- if (xmdline.privsize > 0) {
- if (!(modelines[i]->private =
- Xcalloc(xmdline.privsize, sizeof(INT32)))) {
- _XEatData(dpy, (xmdline.privsize) * sizeof(INT32));
- Xfree(modelines[i]->private);
- } else {
- _XRead(dpy, (char*)modelines[i]->private,
- xmdline.privsize * sizeof(INT32));
- }
- } else {
- modelines[i]->private = NULL;
- }
- }
- }
- }
- *modelinesPtr = modelines;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-/*
- * GetReq replacement for use with VidMode protocols earlier than 2.0
- */
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define GetOldReq(name, oldname, req) \
- if ((dpy->bufptr + SIZEOF(x##oldname##Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x##oldname##Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = X_##name;\
- req->length = (SIZEOF(x##oldname##Req))>>2;\
- dpy->bufptr += SIZEOF(x##oldname##Req);\
- dpy->request++
-
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
-#define GetOldReq(name, oldname, req) \
- if ((dpy->bufptr + SIZEOF(x/**/oldname/**/Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x/**/oldname/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = X_/**/name;\
- req->length = (SIZEOF(x/**/oldname/**/Req))>>2;\
- dpy->bufptr += SIZEOF(x/**/oldname/**/Req);\
- dpy->request++
-#endif
-
-Bool
-XF86VidModeAddModeLine (dpy, screen, newmodeline, aftermodeline)
- Display *dpy;
- int screen;
- XF86VidModeModeInfo* newmodeline;
- XF86VidModeModeInfo* aftermodeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeAddModeLineReq *req;
- xXF86OldVidModeAddModeLineReq *oldreq;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, False);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeAddModeLine, XF86OldVidModeAddModeLine, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeAddModeLine;
- oldreq->screen = screen;
- oldreq->dotclock = newmodeline->dotclock;
- oldreq->hdisplay = newmodeline->hdisplay;
- oldreq->hsyncstart = newmodeline->hsyncstart;
- oldreq->hsyncend = newmodeline->hsyncend;
- oldreq->htotal = newmodeline->htotal;
- oldreq->vdisplay = newmodeline->vdisplay;
- oldreq->vsyncstart = newmodeline->vsyncstart;
- oldreq->vsyncend = newmodeline->vsyncend;
- oldreq->vtotal = newmodeline->vtotal;
- oldreq->flags = newmodeline->flags;
- oldreq->privsize = newmodeline->privsize;
- if (aftermodeline != NULL) {
- oldreq->after_dotclock = aftermodeline->dotclock;
- oldreq->after_hdisplay = aftermodeline->hdisplay;
- oldreq->after_hsyncstart = aftermodeline->hsyncstart;
- oldreq->after_hsyncend = aftermodeline->hsyncend;
- oldreq->after_htotal = aftermodeline->htotal;
- oldreq->after_vdisplay = aftermodeline->vdisplay;
- oldreq->after_vsyncstart = aftermodeline->vsyncstart;
- oldreq->after_vsyncend = aftermodeline->vsyncend;
- oldreq->after_vtotal = aftermodeline->vtotal;
- oldreq->after_flags = aftermodeline->flags;
- } else {
- oldreq->after_dotclock = 0;
- oldreq->after_hdisplay = 0;
- oldreq->after_hsyncstart = 0;
- oldreq->after_hsyncend = 0;
- oldreq->after_htotal = 0;
- oldreq->after_vdisplay = 0;
- oldreq->after_vsyncstart = 0;
- oldreq->after_vsyncend = 0;
- oldreq->after_vtotal = 0;
- oldreq->after_flags = 0;
- }
- if (newmodeline->privsize) {
- oldreq->length += newmodeline->privsize;
- Data32(dpy, (long *) newmodeline->private,
- newmodeline->privsize * sizeof(INT32));
- }
- } else {
- GetReq(XF86VidModeAddModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeAddModeLine;
- req->screen = screen;
- req->dotclock = newmodeline->dotclock;
- req->hdisplay = newmodeline->hdisplay;
- req->hsyncstart = newmodeline->hsyncstart;
- req->hsyncend = newmodeline->hsyncend;
- req->htotal = newmodeline->htotal;
- req->hskew = newmodeline->hskew;
- req->vdisplay = newmodeline->vdisplay;
- req->vsyncstart = newmodeline->vsyncstart;
- req->vsyncend = newmodeline->vsyncend;
- req->vtotal = newmodeline->vtotal;
- req->flags = newmodeline->flags;
- req->privsize = newmodeline->privsize;
- if (aftermodeline != NULL) {
- req->after_dotclock = aftermodeline->dotclock;
- req->after_hdisplay = aftermodeline->hdisplay;
- req->after_hsyncstart = aftermodeline->hsyncstart;
- req->after_hsyncend = aftermodeline->hsyncend;
- req->after_htotal = aftermodeline->htotal;
- req->after_hskew = aftermodeline->hskew;
- req->after_vdisplay = aftermodeline->vdisplay;
- req->after_vsyncstart = aftermodeline->vsyncstart;
- req->after_vsyncend = aftermodeline->vsyncend;
- req->after_vtotal = aftermodeline->vtotal;
- req->after_flags = aftermodeline->flags;
- } else {
- req->after_dotclock = 0;
- req->after_hdisplay = 0;
- req->after_hsyncstart = 0;
- req->after_hsyncend = 0;
- req->after_htotal = 0;
- req->after_hskew = 0;
- req->after_vdisplay = 0;
- req->after_vsyncstart = 0;
- req->after_vsyncend = 0;
- req->after_vtotal = 0;
- req->after_flags = 0;
- }
- if (newmodeline->privsize) {
- req->length += newmodeline->privsize;
- Data32(dpy, (long *) newmodeline->private,
- newmodeline->privsize * sizeof(INT32));
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeDeleteModeLine (dpy, screen, modeline)
- Display *dpy;
- int screen;
- XF86VidModeModeInfo* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeDeleteModeLineReq *req;
- xXF86OldVidModeDeleteModeLineReq *oldreq;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, 0);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeDeleteModeLine, XF86OldVidModeDeleteModeLine, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeDeleteModeLine;
- oldreq->screen = screen;
- oldreq->dotclock = modeline->dotclock;
- oldreq->hdisplay = modeline->hdisplay;
- oldreq->hsyncstart = modeline->hsyncstart;
- oldreq->hsyncend = modeline->hsyncend;
- oldreq->htotal = modeline->htotal;
- oldreq->vdisplay = modeline->vdisplay;
- oldreq->vsyncstart = modeline->vsyncstart;
- oldreq->vsyncend = modeline->vsyncend;
- oldreq->vtotal = modeline->vtotal;
- oldreq->flags = modeline->flags;
- oldreq->privsize = modeline->privsize;
- if (modeline->privsize) {
- oldreq->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- } else {
- GetReq(XF86VidModeDeleteModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeDeleteModeLine;
- req->screen = screen;
- req->dotclock = modeline->dotclock;
- req->hdisplay = modeline->hdisplay;
- req->hsyncstart = modeline->hsyncstart;
- req->hsyncend = modeline->hsyncend;
- req->htotal = modeline->htotal;
- req->hskew = modeline->hskew;
- req->vdisplay = modeline->vdisplay;
- req->vsyncstart = modeline->vsyncstart;
- req->vsyncend = modeline->vsyncend;
- req->vtotal = modeline->vtotal;
- req->flags = modeline->flags;
- req->privsize = modeline->privsize;
- if (modeline->privsize) {
- req->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeModModeLine (dpy, screen, modeline)
- Display *dpy;
- int screen;
- XF86VidModeModeLine* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeModModeLineReq *req;
- xXF86OldVidModeModModeLineReq *oldreq;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, 0);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeModModeLine, XF86OldVidModeModModeLine, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeModModeLine;
- oldreq->screen = screen;
- oldreq->hdisplay = modeline->hdisplay;
- oldreq->hsyncstart = modeline->hsyncstart;
- oldreq->hsyncend = modeline->hsyncend;
- oldreq->htotal = modeline->htotal;
- oldreq->vdisplay = modeline->vdisplay;
- oldreq->vsyncstart = modeline->vsyncstart;
- oldreq->vsyncend = modeline->vsyncend;
- oldreq->vtotal = modeline->vtotal;
- oldreq->flags = modeline->flags;
- oldreq->privsize = modeline->privsize;
- if (modeline->privsize) {
- oldreq->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- } else {
- GetReq(XF86VidModeModModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeModModeLine;
- req->screen = screen;
- req->hdisplay = modeline->hdisplay;
- req->hsyncstart = modeline->hsyncstart;
- req->hsyncend = modeline->hsyncend;
- req->htotal = modeline->htotal;
- req->hskew = modeline->hskew;
- req->vdisplay = modeline->vdisplay;
- req->vsyncstart = modeline->vsyncstart;
- req->vsyncend = modeline->vsyncend;
- req->vtotal = modeline->vtotal;
- req->flags = modeline->flags;
- req->privsize = modeline->privsize;
- if (modeline->privsize) {
- req->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XF86VidModeValidateModeLine (dpy, screen, modeline)
- Display *dpy;
- int screen;
- XF86VidModeModeInfo* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeValidateModeLineReq *req;
- xXF86OldVidModeValidateModeLineReq *oldreq;
- xXF86VidModeValidateModeLineReply rep;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, 0);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
-
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeValidateModeLine, XF86OldVidModeValidateModeLine, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeValidateModeLine;
- oldreq->screen = screen;
- oldreq->dotclock = modeline->dotclock;
- oldreq->hdisplay = modeline->hdisplay;
- oldreq->hsyncstart = modeline->hsyncstart;
- oldreq->hsyncend = modeline->hsyncend;
- oldreq->htotal = modeline->htotal;
- oldreq->vdisplay = modeline->vdisplay;
- oldreq->vsyncstart = modeline->vsyncstart;
- oldreq->vsyncend = modeline->vsyncend;
- oldreq->vtotal = modeline->vtotal;
- oldreq->flags = modeline->flags;
- oldreq->privsize = modeline->privsize;
- if (modeline->privsize) {
- oldreq->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- } else {
- GetReq(XF86VidModeValidateModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeValidateModeLine;
- req->screen = screen;
- req->dotclock = modeline->dotclock;
- req->hdisplay = modeline->hdisplay;
- req->hsyncstart = modeline->hsyncstart;
- req->hsyncend = modeline->hsyncend;
- req->htotal = modeline->htotal;
- req->hskew = modeline->hskew;
- req->vdisplay = modeline->vdisplay;
- req->vsyncstart = modeline->vsyncstart;
- req->vsyncend = modeline->vsyncend;
- req->vtotal = modeline->vtotal;
- req->flags = modeline->flags;
- req->privsize = modeline->privsize;
- if (modeline->privsize) {
- req->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return MODE_BAD;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.status;
-}
-
-Bool
-XF86VidModeSwitchMode(dpy, screen, zoom)
- Display* dpy;
- int screen;
- int zoom;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeSwitchModeReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeSwitchMode, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSwitchMode;
- req->screen = screen;
- req->zoom = zoom;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeSwitchToMode(dpy, screen, modeline)
- Display* dpy;
- int screen;
- XF86VidModeModeInfo* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeSwitchToModeReq *req;
- xXF86OldVidModeSwitchToModeReq *oldreq;
- int majorVersion, minorVersion;
- Bool protocolBug = False;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- /*
- * Note: There was a bug in the protocol implementation in versions
- * 0.x with x < 8 (the .private field wasn't expected to be sent over
- * the wire). Check the server's version, and accept the old format
- * if appropriate.
- */
-
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
- if (majorVersion == 0 && minorVersion < 8) {
- protocolBug = True;
-#ifdef DEBUG
- fprintf(stderr, "XF86VidModeSwitchToMode: Warning: Xserver is"
- "running an old version (%d.%d)\n", majorVersion,
- minorVersion);
-#endif
- }
-
- LockDisplay(dpy);
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeSwitchToMode, XF86OldVidModeSwitchToMode, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeSwitchToMode;
- oldreq->screen = screen;
- oldreq->dotclock = modeline->dotclock;
- oldreq->hdisplay = modeline->hdisplay;
- oldreq->hsyncstart = modeline->hsyncstart;
- oldreq->hsyncend = modeline->hsyncend;
- oldreq->htotal = modeline->htotal;
- oldreq->vdisplay = modeline->vdisplay;
- oldreq->vsyncstart = modeline->vsyncstart;
- oldreq->vsyncend = modeline->vsyncend;
- oldreq->vtotal = modeline->vtotal;
- oldreq->flags = modeline->flags;
- if (protocolBug) {
- oldreq->privsize = 0;
- } else {
- oldreq->privsize = modeline->privsize;
- if (modeline->privsize) {
- oldreq->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- } else {
- GetReq(XF86VidModeSwitchToMode, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSwitchToMode;
- req->screen = screen;
- req->dotclock = modeline->dotclock;
- req->hdisplay = modeline->hdisplay;
- req->hsyncstart = modeline->hsyncstart;
- req->hsyncend = modeline->hsyncend;
- req->htotal = modeline->htotal;
- req->hskew = modeline->hskew;
- req->vdisplay = modeline->vdisplay;
- req->vsyncstart = modeline->vsyncstart;
- req->vsyncend = modeline->vsyncend;
- req->vtotal = modeline->vtotal;
- req->flags = modeline->flags;
- if (protocolBug) {
- req->privsize = 0;
- } else {
- req->privsize = modeline->privsize;
- if (modeline->privsize) {
- req->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeLockModeSwitch(dpy, screen, lock)
- Display* dpy;
- int screen;
- int lock;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeLockModeSwitchReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeLockModeSwitch, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeLockModeSwitch;
- req->screen = screen;
- req->lock = lock;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetMonitor(dpy, screen, monitor)
- Display* dpy;
- int screen;
- XF86VidModeMonitor* monitor;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetMonitorReply rep;
- xXF86VidModeGetMonitorReq *req;
- CARD32 syncrange;
- int i;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetMonitor, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetMonitor;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- monitor->nhsync = rep.nhsync;
- monitor->nvsync = rep.nvsync;
-#if 0
- monitor->bandwidth = (float)rep.bandwidth / 1e6;
-#endif
- if (rep.vendorLength) {
- if (!(monitor->vendor = (char *)Xcalloc(rep.vendorLength + 1, 1))) {
- _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
- ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
- return False;
- }
- } else {
- monitor->vendor = NULL;
- }
- if (rep.modelLength) {
- if (!(monitor->model = Xcalloc(rep.modelLength + 1, 1))) {
- _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
- ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
- if (monitor->vendor)
- Xfree(monitor->vendor);
- return False;
- }
- } else {
- monitor->model = NULL;
- }
- if (!(monitor->hsync = Xcalloc(rep.nhsync, sizeof(XF86VidModeSyncRange)))) {
- _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
- ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
-
- if (monitor->vendor)
- Xfree(monitor->vendor);
- if (monitor->model)
- Xfree(monitor->model);
- return False;
- }
- if (!(monitor->vsync = Xcalloc(rep.nvsync, sizeof(XF86VidModeSyncRange)))) {
- _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
- ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
- if (monitor->vendor)
- Xfree(monitor->vendor);
- if (monitor->model)
- Xfree(monitor->model);
- Xfree(monitor->hsync);
- return False;
- }
- for (i = 0; i < rep.nhsync; i++) {
- _XRead(dpy, (char *)&syncrange, 4);
- monitor->hsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0;
- monitor->hsync[i].hi = (float)(syncrange >> 16) / 100.0;
- }
- for (i = 0; i < rep.nvsync; i++) {
- _XRead(dpy, (char *)&syncrange, 4);
- monitor->vsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0;
- monitor->vsync[i].hi = (float)(syncrange >> 16) / 100.0;
- }
- if (rep.vendorLength)
- _XReadPad(dpy, monitor->vendor, rep.vendorLength);
- else
- monitor->vendor = "";
- if (rep.modelLength)
- _XReadPad(dpy, monitor->model, rep.modelLength);
- else
- monitor->model = "";
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetViewPort(dpy, screen, x, y)
- Display* dpy;
- int screen;
- int *x, *y;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetViewPortReply rep;
- xXF86VidModeGetViewPortReq *req;
- int majorVersion, minorVersion;
- Bool protocolBug = False;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- /*
- * Note: There was a bug in the protocol implementation in versions
- * 0.x with x < 8 (no reply was sent, so the client would hang)
- * Check the server's version, and don't wait for a reply with older
- * versions.
- */
-
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
- if (majorVersion == 0 && minorVersion < 8) {
- protocolBug = True;
-#ifdef DEBUG
- fprintf(stderr, "XF86VidModeGetViewPort: Warning: Xserver is"
- "running an old version (%d.%d)\n", majorVersion,
- minorVersion);
-#endif
- }
- LockDisplay(dpy);
- GetReq(XF86VidModeGetViewPort, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetViewPort;
- req->screen = screen;
- if (protocolBug) {
- *x = 0;
- *y = 0;
- } else {
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *x = rep.x;
- *y = rep.y;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeSetViewPort(dpy, screen, x, y)
- Display* dpy;
- int screen;
- int x, y;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeSetViewPortReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeSetViewPort, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSetViewPort;
- req->screen = screen;
- req->x = x;
- req->y = y;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetDotClocks(dpy, screen,
- flagsPtr, numclocksPtr, maxclocksPtr, clocksPtr)
- Display* dpy;
- int screen;
- int *flagsPtr, *numclocksPtr, *maxclocksPtr, *clocksPtr[];
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetDotClocksReply rep;
- xXF86VidModeGetDotClocksReq *req;
- int i, *dotclocks;
- CARD32 dotclk;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetDotClocks, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetDotClocks;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xXF86VidModeGetDotClocksReply) - SIZEOF(xReply)) >> 2, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *numclocksPtr = rep.clocks;
- *maxclocksPtr = rep.maxclocks;
- *flagsPtr = rep.flags;
-
- if (!(dotclocks = (int*) Xcalloc(rep.clocks, sizeof(int)))) {
- _XEatData(dpy, (rep.clocks) * 4);
- Xfree(dotclocks);
- return False;
- }
-
- for (i = 0; i < rep.clocks; i++) {
- _XRead(dpy, (char*)&dotclk, 4);
- dotclocks[i] = dotclk;
- }
- *clocksPtr = dotclocks;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeSetGammaRamp (
- Display *dpy,
- int screen,
- int size,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-)
-{
- int length = (size + 1) & ~1;
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeSetGammaRampReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
- LockDisplay(dpy);
- GetReq(XF86VidModeSetGammaRamp, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSetGammaRamp;
- req->screen = screen;
- req->length += (length >> 1) * 3;
- req->size = size;
- _XSend(dpy, (char*)red, size * 2);
- _XSend(dpy, (char*)green, size * 2);
- _XSend(dpy, (char*)blue, size * 2);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-
-Bool
-XF86VidModeGetGammaRamp (
- Display *dpy,
- int screen,
- int size,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetGammaRampReq *req;
- xXF86VidModeGetGammaRampReply rep;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetGammaRamp, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetGammaRamp;
- req->screen = screen;
- req->size = size;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- if(rep.size) {
- _XRead(dpy, (char*)red, rep.size << 1);
- _XRead(dpy, (char*)green, rep.size << 1);
- _XRead(dpy, (char*)blue, rep.size << 1);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86VidModeGetGammaRampSize(
- Display *dpy,
- int screen,
- int *size
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetGammaRampSizeReq *req;
- xXF86VidModeGetGammaRampSizeReply rep;
-
- *size = 0;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetGammaRampSize, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetGammaRampSize;
- req->screen = screen;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- *size = rep.size;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86VidModeGetPermissions(
- Display *dpy,
- int screen,
- int *permissions
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetPermissionsReq *req;
- xXF86VidModeGetPermissionsReply rep;
-
- *permissions = 0;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetPermissions, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetPermissions;
- req->screen = screen;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- *permissions = rep.permissions;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
diff --git a/nx-X11/lib/Xxf86vm/Xxf86vm-def.cpp b/nx-X11/lib/Xxf86vm/Xxf86vm-def.cpp
deleted file mode 100644
index 0f7b4f335..000000000
--- a/nx-X11/lib/Xxf86vm/Xxf86vm-def.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-LIBRARY XXF86VM
-EXPORTS
- XF86VidModeQueryExtension
- XF86VidModeQueryVersion
- XF86VidModeGetModeLine
- XF86VidModeGetAllModeLines
- XF86VidModeModModeLine
- XF86VidModeSwitchMode
- XF86VidModeLockModeSwitch
- XF86VidModeGetMonitor
- XF86VidModeGetGamma
- XF86VidModeSetGamma
- XF86VidModeSwitchToMode
- XF86VidModeAddModeLine
-
-/* $XFree86$ */