summaryrefslogtreecommitdiffstats
path: root/xorg
diff options
context:
space:
mode:
Diffstat (limited to 'xorg')
-rw-r--r--xorg/server/Makefile16
-rw-r--r--xorg/server/module/Makefile22
-rw-r--r--xorg/server/module/rdp.h96
-rw-r--r--xorg/server/module/rdpComposite.c76
-rw-r--r--xorg/server/module/rdpComposite.h32
-rw-r--r--xorg/server/module/rdpCopyArea.c55
-rw-r--r--xorg/server/module/rdpCopyArea.h29
-rw-r--r--xorg/server/module/rdpCopyPlane.c59
-rw-r--r--xorg/server/module/rdpCopyPlane.h30
-rw-r--r--xorg/server/module/rdpCursor.c91
-rw-r--r--xorg/server/module/rdpCursor.h44
-rw-r--r--xorg/server/module/rdpDraw.c148
-rw-r--r--xorg/server/module/rdpDraw.h70
-rw-r--r--xorg/server/module/rdpFillPolygon.c52
-rw-r--r--xorg/server/module/rdpFillPolygon.h30
-rw-r--r--xorg/server/module/rdpFillSpans.c52
-rw-r--r--xorg/server/module/rdpFillSpans.h29
-rw-r--r--xorg/server/module/rdpGC.c236
-rw-r--r--xorg/server/module/rdpGC.h30
-rw-r--r--xorg/server/module/rdpGlyphs.c79
-rw-r--r--xorg/server/module/rdpGlyphs.h33
-rw-r--r--xorg/server/module/rdpImageGlyphBlt.c52
-rw-r--r--xorg/server/module/rdpImageGlyphBlt.h30
-rw-r--r--xorg/server/module/rdpImageText16.c50
-rw-r--r--xorg/server/module/rdpImageText16.h29
-rw-r--r--xorg/server/module/rdpImageText8.c51
-rw-r--r--xorg/server/module/rdpImageText8.h29
-rw-r--r--xorg/server/module/rdpMain.c86
-rw-r--r--xorg/server/module/rdpMisc.c415
-rw-r--r--xorg/server/module/rdpMisc.h78
-rw-r--r--xorg/server/module/rdpPolyArc.c48
-rw-r--r--xorg/server/module/rdpPolyArc.h28
-rw-r--r--xorg/server/module/rdpPolyFillArc.c48
-rw-r--r--xorg/server/module/rdpPolyFillArc.h28
-rw-r--r--xorg/server/module/rdpPolyFillRect.c50
-rw-r--r--xorg/server/module/rdpPolyFillRect.h29
-rw-r--r--xorg/server/module/rdpPolyGlyphBlt.c52
-rw-r--r--xorg/server/module/rdpPolyGlyphBlt.h30
-rw-r--r--xorg/server/module/rdpPolyPoint.c50
-rw-r--r--xorg/server/module/rdpPolyPoint.h29
-rw-r--r--xorg/server/module/rdpPolyRectangle.c51
-rw-r--r--xorg/server/module/rdpPolyRectangle.h29
-rw-r--r--xorg/server/module/rdpPolySegment.c48
-rw-r--r--xorg/server/module/rdpPolySegment.h28
-rw-r--r--xorg/server/module/rdpPolyText16.c55
-rw-r--r--xorg/server/module/rdpPolyText16.h29
-rw-r--r--xorg/server/module/rdpPolyText8.c55
-rw-r--r--xorg/server/module/rdpPolyText8.h29
-rw-r--r--xorg/server/module/rdpPolylines.c50
-rw-r--r--xorg/server/module/rdpPolylines.h29
-rw-r--r--xorg/server/module/rdpPri.c176
-rw-r--r--xorg/server/module/rdpPri.h47
-rw-r--r--xorg/server/module/rdpPushPixels.c50
-rw-r--r--xorg/server/module/rdpPushPixels.h29
-rw-r--r--xorg/server/module/rdpPutImage.c51
-rw-r--r--xorg/server/module/rdpPutImage.h29
-rw-r--r--xorg/server/module/rdpRandR.c309
-rw-r--r--xorg/server/module/rdpRandR.h60
-rw-r--r--xorg/server/module/rdpReg.c233
-rw-r--r--xorg/server/module/rdpReg.h60
-rw-r--r--xorg/server/module/rdpSetSpans.c52
-rw-r--r--xorg/server/module/rdpSetSpans.h29
-rw-r--r--xorg/server/readme.txt46
-rw-r--r--xorg/server/xrdpdev/Makefile16
-rw-r--r--xorg/server/xrdpdev/xorg.conf68
-rw-r--r--xorg/server/xrdpdev/xrdpdev.c705
-rw-r--r--xorg/server/xrdpkeyb/Makefile16
-rw-r--r--xorg/server/xrdpkeyb/rdpKeyboard.c467
-rw-r--r--xorg/server/xrdpmouse/Makefile16
-rw-r--r--xorg/server/xrdpmouse/rdpMouse.c246
-rw-r--r--xorg/tests/randr/trandr.c14
71 files changed, 5640 insertions, 3 deletions
diff --git a/xorg/server/Makefile b/xorg/server/Makefile
new file mode 100644
index 00000000..12548dd9
--- /dev/null
+++ b/xorg/server/Makefile
@@ -0,0 +1,16 @@
+
+all: allmake
+
+allmake:
+ cd module; $(MAKE) $(MFLAGS)
+ cd xrdpdev; $(MAKE) $(MFLAGS)
+ cd xrdpkeyb; $(MAKE) $(MFLAGS)
+ cd xrdpmouse; $(MAKE) $(MFLAGS)
+
+clean: allclean
+
+allclean:
+ cd module; $(MAKE) clean
+ cd xrdpdev; $(MAKE) clean
+ cd xrdpkeyb; $(MAKE) clean
+ cd xrdpmouse; $(MAKE) clean
diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile
new file mode 100644
index 00000000..66b09f91
--- /dev/null
+++ b/xorg/server/module/Makefile
@@ -0,0 +1,22 @@
+
+OBJS = rdpDraw.o rdpPri.o rdpGC.o rdpFillSpans.o rdpSetSpans.o rdpPutImage.o \
+rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \
+rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \
+rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \
+rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \
+rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \
+rdpComposite.o rdpGlyphs.o
+
+CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1
+
+LDFLAGS =
+
+LIBS =
+
+all: libxorgxrdp.so
+
+libxorgxrdp.so: $(OBJS) Makefile
+ $(CC) -shared -o libxorgxrdp.so $(LDFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f $(OBJS) libxorgxrdp.so
diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h
new file mode 100644
index 00000000..085e114f
--- /dev/null
+++ b/xorg/server/module/rdp.h
@@ -0,0 +1,96 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef _RDP_H
+#define _RDP_H
+
+#include <xorg-server.h>
+#include <scrnintstr.h>
+#include <gcstruct.h>
+#include <mipointer.h>
+#include <randrstr.h>
+
+#include "rdpPri.h"
+
+#define PixelDPI 100
+#define PixelToMM(_size) (((_size) * 254 + (PixelDPI) * 5) / ((PixelDPI) * 10))
+
+/* move this to common header */
+struct _rdpRec
+{
+ int width;
+ int height;
+ int depth;
+ int paddedWidthInBytes;
+ int sizeInBytes;
+ int num_modes;
+ int bitsPerPixel;
+ char *pfbMemory;
+ ScreenPtr pScreen;
+ rdpDevPrivateKey privateKeyRecGC;
+ rdpDevPrivateKey privateKeyRecPixmap;
+
+ CopyWindowProcPtr CopyWindow;
+ CreateGCProcPtr CreateGC;
+ CreatePixmapProcPtr CreatePixmap;
+ DestroyPixmapProcPtr DestroyPixmap;
+ ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
+ CloseScreenProcPtr CloseScreen;
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+
+ miPointerScreenFuncPtr pCursorFuncs;
+
+ /* RandR */
+ RRSetConfigProcPtr rrSetConfig;
+ RRGetInfoProcPtr rrGetInfo;
+ RRScreenSetSizeProcPtr rrScreenSetSize;
+ RRCrtcSetProcPtr rrCrtcSet;
+ RRCrtcSetGammaProcPtr rrCrtcSetGamma;
+ RRCrtcGetGammaProcPtr rrCrtcGetGamma;
+ RROutputSetPropertyProcPtr rrOutputSetProperty;
+ RROutputValidateModeProcPtr rrOutputValidateMode;
+ RRModeDestroyProcPtr rrModeDestroy;
+ RROutputGetPropertyProcPtr rrOutputGetProperty;
+ RRGetPanningProcPtr rrGetPanning;
+ RRSetPanningProcPtr rrSetPanning;
+
+};
+typedef struct _rdpRec rdpRec;
+typedef struct _rdpRec * rdpPtr;
+#define XRDPPTR(_p) ((rdpPtr)((_p)->driverPrivate))
+
+struct _rdpGCRec
+{
+ GCFuncs *funcs;
+ GCOps *ops;
+};
+typedef struct _rdpGCRec rdpGCRec;
+typedef struct _rdpGCRec * rdpGCPtr;
+
+struct _rdpPixmapRec
+{
+ int i1;
+};
+typedef struct _rdpPixmapRec rdpPixmapRec;
+typedef struct _rdpPixmapRec * rdpPixmapPtr;
+
+#endif
diff --git a/xorg/server/module/rdpComposite.c b/xorg/server/module/rdpComposite.c
new file mode 100644
index 00000000..a2c5568e
--- /dev/null
+++ b/xorg/server/module/rdpComposite.c
@@ -0,0 +1,76 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+composite(alpha blending) calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <picture.h>
+
+#include "rdp.h"
+#include "rdpComposite.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpCompositeOrg(PictureScreenPtr ps, rdpPtr dev,
+ CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height)
+{
+ ps->Composite = dev->Composite;
+ ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
+ xDst, yDst, width, height);
+ ps->Composite = rdpComposite;
+}
+
+/******************************************************************************/
+void
+rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen;
+ rdpPtr dev;
+ ScrnInfoPtr pScrn;
+ PictureScreenPtr ps;
+
+ LLOGLN(10, ("rdpComposite:"));
+ pScreen = pSrc->pDrawable->pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ ps = GetPictureScreen(pScreen);
+ rdpCompositeOrg(ps, dev, op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
+ xDst, yDst, width, height);
+}
diff --git a/xorg/server/module/rdpComposite.h b/xorg/server/module/rdpComposite.h
new file mode 100644
index 00000000..8924c1b4
--- /dev/null
+++ b/xorg/server/module/rdpComposite.h
@@ -0,0 +1,32 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+composite(alpha blending) calls
+
+*/
+
+#ifndef _RDPCOMPOSITE_H
+#define _RDPCOMPOSITE_H
+
+void
+rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height);
+
+#endif
diff --git a/xorg/server/module/rdpCopyArea.c b/xorg/server/module/rdpCopyArea.c
new file mode 100644
index 00000000..dd32644e
--- /dev/null
+++ b/xorg/server/module/rdpCopyArea.c
@@ -0,0 +1,55 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static RegionPtr
+rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+ RegionPtr rv;
+
+ GC_OP_PROLOGUE(pGC);
+ rv = pGC->ops->CopyArea(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
+ GC_OP_EPILOGUE(pGC);
+ return rv;
+}
+
+/******************************************************************************/
+RegionPtr
+rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ RegionPtr rv;
+
+ LLOGLN(10, ("rdpCopyArea:"));
+ /* do original call */
+ rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
+ return rv;
+}
diff --git a/xorg/server/module/rdpCopyArea.h b/xorg/server/module/rdpCopyArea.h
new file mode 100644
index 00000000..654b6edc
--- /dev/null
+++ b/xorg/server/module/rdpCopyArea.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPCOPYAREA_H
+#define __RDPCOPYAREA_H
+
+RegionPtr
+rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty);
+
+#endif
diff --git a/xorg/server/module/rdpCopyPlane.c b/xorg/server/module/rdpCopyPlane.c
new file mode 100644
index 00000000..9b89125c
--- /dev/null
+++ b/xorg/server/module/rdpCopyPlane.c
@@ -0,0 +1,59 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static RegionPtr
+rdpCopyPlaneOrg(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ RegionPtr rv;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ rv = pGC->ops->CopyPlane(pSrc, pDst, pGC, srcx, srcy,
+ w, h, dstx, dsty, bitPlane);
+ GC_OP_EPILOGUE(pGC);
+ return rv;
+}
+
+/******************************************************************************/
+RegionPtr
+rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ RegionPtr rv;
+
+ LLOGLN(10, ("rdpCopyPlane:"));
+ /* do original call */
+ rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
+ dstx, dsty, bitPlane);
+ return rv;
+}
diff --git a/xorg/server/module/rdpCopyPlane.h b/xorg/server/module/rdpCopyPlane.h
new file mode 100644
index 00000000..85a79e76
--- /dev/null
+++ b/xorg/server/module/rdpCopyPlane.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPCOPYPLANE_H
+#define __RDPCOPYPLANE_H
+
+RegionPtr
+rdpCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane);
+
+#endif
diff --git a/xorg/server/module/rdpCursor.c b/xorg/server/module/rdpCursor.c
new file mode 100644
index 00000000..82aafd78
--- /dev/null
+++ b/xorg/server/module/rdpCursor.c
@@ -0,0 +1,91 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+cursor
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+Bool
+rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
+{
+ LLOGLN(0, ("rdpSpriteRealizeCursor:"));
+ return 1;
+}
+
+/******************************************************************************/
+Bool
+rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
+{
+ LLOGLN(0, ("rdpSpriteUnrealizeCursor:"));
+ return 1;
+}
+
+/******************************************************************************/
+void
+rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
+ int x, int y)
+{
+ LLOGLN(0, ("rdpSpriteSetCursor:"));
+}
+
+/******************************************************************************/
+void
+rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y)
+{
+ LLOGLN(0, ("rdpSpriteMoveCursor:"));
+}
+
+/******************************************************************************/
+Bool
+rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+ LLOGLN(0, ("rdpSpriteDeviceCursorInitialize:"));
+ return 1;
+}
+
+/******************************************************************************/
+void
+rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+ LLOGLN(0, ("rdpSpriteDeviceCursorCleanup:"));
+}
diff --git a/xorg/server/module/rdpCursor.h b/xorg/server/module/rdpCursor.h
new file mode 100644
index 00000000..b847d842
--- /dev/null
+++ b/xorg/server/module/rdpCursor.h
@@ -0,0 +1,44 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+misc draw calls
+
+*/
+
+#ifndef __RDPCURSOR_H
+#define __RDPCURSOR_H
+
+#include <xorg-server.h>
+#include <xf86.h>
+
+Bool
+rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs);
+Bool
+rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs);
+void
+rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
+ int x, int y);
+void
+rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y);
+Bool
+rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr);
+void
+rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr);
+
+#endif
diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c
new file mode 100644
index 00000000..7abcb406
--- /dev/null
+++ b/xorg/server/module/rdpDraw.c
@@ -0,0 +1,148 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+misc draw calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/*****************************************************************************/
+PixmapPtr
+rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ PixmapPtr rv;
+
+ LLOGLN(10, ("rdpCreatePixmap: width %d height %d depth %d",
+ width, height, depth));
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ pScreen->CreatePixmap = dev->CreatePixmap;
+ rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
+ pScreen->CreatePixmap = rdpCreatePixmap;
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpDestroyPixmap(PixmapPtr pPixmap)
+{
+ Bool rv;
+ ScreenPtr pScreen;
+ rdpPtr dev;
+ ScrnInfoPtr pScrn;
+
+ LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt));
+ pScreen = pPixmap->drawable.pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ pScreen->DestroyPixmap = dev->DestroyPixmap;
+ rv = pScreen->DestroyPixmap(pPixmap);
+ pScreen->DestroyPixmap = rdpDestroyPixmap;
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ Bool rv;
+ ScreenPtr pScreen;
+ rdpPtr dev;
+ ScrnInfoPtr pScrn;
+
+ LLOGLN(10, ("rdpModifyPixmapHeader:"));
+ pScreen = pPixmap->drawable.pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader;
+ rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
+ devKind, pPixData);
+ pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader;
+ return rv;
+}
+
+/*****************************************************************************/
+void
+rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
+{
+ ScrnInfoPtr pScrn;
+ ScreenPtr pScreen;
+ rdpPtr dev;
+
+ pScreen = pWin->drawable.pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ dev->pScreen->CopyWindow = dev->CopyWindow;
+ dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
+ dev->pScreen->CopyWindow = rdpCopyWindow;
+}
+
+/*****************************************************************************/
+Bool
+rdpCloseScreen(int index, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ Bool rv;
+
+ LLOGLN(0, ("rdpCloseScreen:"));
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ dev->pScreen->CloseScreen = dev->CloseScreen;
+ rv = dev->pScreen->CloseScreen(index, pScreen);
+ dev->pScreen->CloseScreen = rdpCloseScreen;
+ return rv;
+}
+
+/******************************************************************************/
+WindowPtr
+rdpGetRootWindowPtr(ScreenPtr pScreen)
+{
+#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0)
+ return WindowTable[pScreen->myNum]; /* in globals.c */
+#else
+ return pScreen->root;
+#endif
+}
diff --git a/xorg/server/module/rdpDraw.h b/xorg/server/module/rdpDraw.h
new file mode 100644
index 00000000..ba696541
--- /dev/null
+++ b/xorg/server/module/rdpDraw.h
@@ -0,0 +1,70 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+misc draw calls
+
+*/
+
+#ifndef __RDPDRAW_H
+#define __RDPDRAW_H
+
+#include <xorg-server.h>
+#include <xf86.h>
+
+/******************************************************************************/
+#define GC_OP_PROLOGUE(_pGC) \
+do { \
+ rdpPtr dev; \
+ ScreenPtr pScreen; \
+ ScrnInfoPtr pScrn; \
+ pScreen = (_pGC)->pScreen; \
+ pScrn = xf86Screens[pScreen->myNum]; \
+ dev = XRDPPTR(pScrn); \
+ priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
+ oldFuncs = (_pGC)->funcs; \
+ (_pGC)->funcs = priv->funcs; \
+ (_pGC)->ops = priv->ops; \
+} while (0)
+
+/******************************************************************************/
+#define GC_OP_EPILOGUE(_pGC) \
+do { \
+ priv->ops = (_pGC)->ops; \
+ (_pGC)->funcs = oldFuncs; \
+ (_pGC)->ops = &g_rdpGCOps; \
+} while (0)
+
+extern GCOps g_rdpGCOps; /* in rdpGC.c */
+
+PixmapPtr
+rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
+Bool
+rdpDestroyPixmap(PixmapPtr pPixmap);
+Bool
+rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData);
+void
+rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion);
+Bool
+rdpCloseScreen(int index, ScreenPtr pScreen);
+WindowPtr
+rdpGetRootWindowPtr(ScreenPtr pScreen);
+
+#endif
diff --git a/xorg/server/module/rdpFillPolygon.c b/xorg/server/module/rdpFillPolygon.c
new file mode 100644
index 00000000..38043c0b
--- /dev/null
+++ b/xorg/server/module/rdpFillPolygon.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpFillPolygonOrg(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->FillPolygon(pDrawable, pGC, shape, mode, count, pPts);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts)
+{
+ LLOGLN(10, ("rdpFillPolygon:"));
+ /* do original call */
+ rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
+}
diff --git a/xorg/server/module/rdpFillPolygon.h b/xorg/server/module/rdpFillPolygon.h
new file mode 100644
index 00000000..89da9ae0
--- /dev/null
+++ b/xorg/server/module/rdpFillPolygon.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPFILLPOLYGON_H
+#define __RDPFILLPOLYGON_H
+
+void
+rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts);
+
+#endif
diff --git a/xorg/server/module/rdpFillSpans.c b/xorg/server/module/rdpFillSpans.c
new file mode 100644
index 00000000..dbd4cc1e
--- /dev/null
+++ b/xorg/server/module/rdpFillSpans.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LDEBUG 0
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpFillSpansOrg(DrawablePtr pDrawable, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted)
+{
+ LLOGLN(0, ("rdpFillSpans:"));
+ /* do original call */
+ rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
+}
diff --git a/xorg/server/module/rdpFillSpans.h b/xorg/server/module/rdpFillSpans.h
new file mode 100644
index 00000000..7e014e6b
--- /dev/null
+++ b/xorg/server/module/rdpFillSpans.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPFILLSPANS_H
+#define __RDPFILLSPANS_H
+
+void
+rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int* pwidthInit, int fSorted);
+
+#endif
diff --git a/xorg/server/module/rdpGC.c b/xorg/server/module/rdpGC.c
new file mode 100644
index 00000000..3a585e2c
--- /dev/null
+++ b/xorg/server/module/rdpGC.c
@@ -0,0 +1,236 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+GC related calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+#include "rdpFillSpans.h"
+#include "rdpSetSpans.h"
+#include "rdpPutImage.h"
+#include "rdpCopyArea.h"
+#include "rdpCopyPlane.h"
+#include "rdpPolyPoint.h"
+#include "rdpPolylines.h"
+#include "rdpPolySegment.h"
+#include "rdpPolyRectangle.h"
+#include "rdpPolyArc.h"
+#include "rdpFillPolygon.h"
+#include "rdpPolyFillRect.h"
+#include "rdpPolyFillArc.h"
+#include "rdpPolyText8.h"
+#include "rdpPolyText16.h"
+#include "rdpImageText8.h"
+#include "rdpImageText16.h"
+#include "rdpImageGlyphBlt.h"
+#include "rdpPolyGlyphBlt.h"
+#include "rdpPushPixels.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+#define GC_FUNC_PROLOGUE(_pGC) \
+ do { \
+ rdpPtr dev; \
+ ScreenPtr pScreen; \
+ ScrnInfoPtr pScrn; \
+ pScreen = _pGC->pScreen; \
+ pScrn = xf86Screens[pScreen->myNum]; \
+ dev = XRDPPTR(pScrn); \
+ priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
+ (_pGC)->funcs = priv->funcs; \
+ if (priv->ops != 0) \
+ { \
+ (_pGC)->ops = priv->ops; \
+ } \
+ } while (0)
+
+/******************************************************************************/
+#define GC_FUNC_EPILOGUE(_pGC) \
+ do { \
+ priv->funcs = (_pGC)->funcs; \
+ (_pGC)->funcs = &g_rdpGCFuncs; \
+ if (priv->ops != 0) \
+ { \
+ priv->ops = (_pGC)->ops; \
+ (_pGC)->ops = &g_rdpGCOps; \
+ } \
+ } while (0)
+
+static void
+rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d);
+static void
+rdpChangeGC(GCPtr pGC, unsigned long mask);
+static void
+rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst);
+static void
+rdpDestroyGC(GCPtr pGC);
+static void
+rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects);
+static void
+rdpDestroyClip(GCPtr pGC);
+static void
+rdpCopyClip(GCPtr dst, GCPtr src);
+
+GCFuncs g_rdpGCFuncs =
+{
+ rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip,
+ rdpDestroyClip, rdpCopyClip
+};
+
+GCOps g_rdpGCOps =
+{
+ rdpFillSpans, rdpSetSpans, rdpPutImage, rdpCopyArea, rdpCopyPlane,
+ rdpPolyPoint, rdpPolylines, rdpPolySegment, rdpPolyRectangle,
+ rdpPolyArc, rdpFillPolygon, rdpPolyFillRect, rdpPolyFillArc,
+ rdpPolyText8, rdpPolyText16, rdpImageText8, rdpImageText16,
+ rdpImageGlyphBlt, rdpPolyGlyphBlt, rdpPushPixels
+};
+
+/******************************************************************************/
+static void
+rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpValidateGC:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ValidateGC(pGC, changes, d);
+ priv->ops = pGC->ops;
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpChangeGC(GCPtr pGC, unsigned long mask)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpChangeGC:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ChangeGC(pGC, mask);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpCopyGC:"));
+ GC_FUNC_PROLOGUE(dst);
+ dst->funcs->CopyGC(src, mask, dst);
+ GC_FUNC_EPILOGUE(dst);
+}
+
+/******************************************************************************/
+static void
+rdpDestroyGC(GCPtr pGC)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpDestroyGC:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->DestroyGC(pGC);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpChangeClip:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpDestroyClip(GCPtr pGC)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpDestroyClip:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->DestroyClip(pGC);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpCopyClip(GCPtr dst, GCPtr src)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpCopyClip:"));
+ GC_FUNC_PROLOGUE(dst);
+ dst->funcs->CopyClip(dst, src);
+ GC_FUNC_EPILOGUE(dst);
+}
+
+/*****************************************************************************/
+Bool
+rdpCreateGC(GCPtr pGC)
+{
+ Bool rv;
+ rdpPtr dev;
+ ScreenPtr pScreen;
+ ScrnInfoPtr pScrn;
+ rdpGCPtr priv;
+
+ LLOGLN(10, ("rdpCreateGC:"));
+ pScreen = pGC->pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ priv = (rdpGCPtr)rdpGetGCPrivate(pGC, dev->privateKeyRecGC);
+ pScreen->CreateGC = dev->CreateGC;
+ rv = pScreen->CreateGC(pGC);
+ if (rv)
+ {
+ priv->funcs = pGC->funcs;
+ priv->ops = 0;
+ pGC->funcs = &g_rdpGCFuncs;
+ }
+ pScreen->CreateGC = rdpCreateGC;
+ return rv;
+}
diff --git a/xorg/server/module/rdpGC.h b/xorg/server/module/rdpGC.h
new file mode 100644
index 00000000..4ad129a2
--- /dev/null
+++ b/xorg/server/module/rdpGC.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+GC related calls
+
+*/
+
+#ifndef _RDPGC_H
+#define _RDPGC_H
+
+Bool
+rdpCreateGC(GCPtr pGC);
+
+#endif
diff --git a/xorg/server/module/rdpGlyphs.c b/xorg/server/module/rdpGlyphs.c
new file mode 100644
index 00000000..3a222e79
--- /dev/null
+++ b/xorg/server/module/rdpGlyphs.c
@@ -0,0 +1,79 @@
+/*
+Copyright 2012-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+gylph(font) calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <picture.h>
+#include <glyphstr.h>
+
+#include "rdp.h"
+#include "rdpGlyphs.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpGlyphsOrg(PictureScreenPtr ps, rdpPtr dev,
+ CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
+ GlyphPtr *glyphs)
+{
+ ps->Glyphs = dev->Glyphs;
+ ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc,
+ nlists, lists, glyphs);
+ ps->Glyphs = rdpGlyphs;
+}
+
+/******************************************************************************/
+void
+rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen;
+ rdpPtr dev;
+ ScrnInfoPtr pScrn;
+ PictureScreenPtr ps;
+
+ LLOGLN(10, ("rdpGlyphs:"));
+ pScreen = pSrc->pDrawable->pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ ps = GetPictureScreen(pScreen);
+ rdpGlyphsOrg(ps, dev, op, pSrc, pDst, maskFormat, xSrc, ySrc,
+ nlists, lists, glyphs);
+}
diff --git a/xorg/server/module/rdpGlyphs.h b/xorg/server/module/rdpGlyphs.h
new file mode 100644
index 00000000..d451d9f9
--- /dev/null
+++ b/xorg/server/module/rdpGlyphs.h
@@ -0,0 +1,33 @@
+/*
+Copyright 2012-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+gylph(font) calls
+
+*/
+
+#ifndef _RDPGLYPHS_H
+#define _RDPGLYPHS_H
+
+void
+rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
+ GlyphPtr *glyphs);
+
+#endif
diff --git a/xorg/server/module/rdpImageGlyphBlt.c b/xorg/server/module/rdpImageGlyphBlt.c
new file mode 100644
index 00000000..0b0d7ce8
--- /dev/null
+++ b/xorg/server/module/rdpImageGlyphBlt.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpImageGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->ImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ LLOGLN(10, ("rdpImageGlyphBlt:"));
+ /* do original call */
+ rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+}
diff --git a/xorg/server/module/rdpImageGlyphBlt.h b/xorg/server/module/rdpImageGlyphBlt.h
new file mode 100644
index 00000000..c5483c7e
--- /dev/null
+++ b/xorg/server/module/rdpImageGlyphBlt.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPIMAGEGLYPHBLT_H
+#define __RDPIMAGEGLYPHBLT_H
+
+void
+rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr* ppci, pointer pglyphBase);
+
+#endif
diff --git a/xorg/server/module/rdpImageText16.c b/xorg/server/module/rdpImageText16.c
new file mode 100644
index 00000000..8ddd9bf3
--- /dev/null
+++ b/xorg/server/module/rdpImageText16.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->ImageText16(pDrawable, pGC, x, y, count, chars);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ LLOGLN(10, ("rdpImageText16:"));
+ /* do original call */
+ rdpImageText16Org(pDrawable, pGC, x, y, count, chars);
+}
diff --git a/xorg/server/module/rdpImageText16.h b/xorg/server/module/rdpImageText16.h
new file mode 100644
index 00000000..0ffb90f2
--- /dev/null
+++ b/xorg/server/module/rdpImageText16.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPIMAGETEXT16_H
+#define __RDPIMAGETEXT16_H
+
+void
+rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short* chars);
+
+#endif
diff --git a/xorg/server/module/rdpImageText8.c b/xorg/server/module/rdpImageText8.c
new file mode 100644
index 00000000..ab41753b
--- /dev/null
+++ b/xorg/server/module/rdpImageText8.c
@@ -0,0 +1,51 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->ImageText8(pDrawable, pGC, x, y, count, chars);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ LLOGLN(10, ("rdpImageText8:"));
+ /* do original call */
+ rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
+ return;
+}
diff --git a/xorg/server/module/rdpImageText8.h b/xorg/server/module/rdpImageText8.h
new file mode 100644
index 00000000..dc0c4ec5
--- /dev/null
+++ b/xorg/server/module/rdpImageText8.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPIMAGETEXT8_H
+#define __RDPIMAGETEXT8_H
+
+void
+rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char* chars);
+
+#endif
diff --git a/xorg/server/module/rdpMain.c b/xorg/server/module/rdpMain.c
new file mode 100644
index 00000000..9930764c
--- /dev/null
+++ b/xorg/server/module/rdpMain.c
@@ -0,0 +1,86 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+rdp module main
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+#define XRDP_DRIVER_NAME "XORGXRDP"
+#define XRDP_NAME "XORGXRDP"
+#define XRDP_VERSION 1000
+
+#define PACKAGE_VERSION_MAJOR 1
+#define PACKAGE_VERSION_MINOR 0
+#define PACKAGE_VERSION_PATCHLEVEL 0
+
+static int g_initialised = 0;
+
+/*****************************************************************************/
+static pointer
+xorgxrdpSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
+{
+ LLOGLN(0, ("xorgxrdpSetup:"));
+ if (!g_initialised)
+ {
+ g_initialised = 1;
+ }
+ return (pointer) 1;
+}
+
+static MODULESETUPPROTO(xorgxrdpSetup);
+static XF86ModuleVersionInfo RDPVersRec =
+{
+ XRDP_DRIVER_NAME,
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ PACKAGE_VERSION_MAJOR,
+ PACKAGE_VERSION_MINOR,
+ PACKAGE_VERSION_PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ 0,
+ { 0, 0, 0, 0 }
+};
+
+XF86ModuleData xorgxrdpModuleData = { &RDPVersRec, xorgxrdpSetup, NULL };
diff --git a/xorg/server/module/rdpMisc.c b/xorg/server/module/rdpMisc.c
new file mode 100644
index 00000000..34e71110
--- /dev/null
+++ b/xorg/server/module/rdpMisc.c
@@ -0,0 +1,415 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+the rest
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/un.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+/******************************************************************************/
+int
+rdpBitsPerPixel(int depth)
+{
+ if (depth == 1)
+ {
+ return 1;
+ }
+ else if (depth <= 8)
+ {
+ return 8;
+ }
+ else if (depth <= 16)
+ {
+ return 16;
+ }
+ else
+ {
+ return 32;
+ }
+}
+
+/* the g_ functions from os_calls.c */
+
+/*****************************************************************************/
+int
+g_tcp_recv(int sck, void *ptr, int len, int flags)
+{
+ return recv(sck, ptr, len, flags);
+}
+
+/*****************************************************************************/
+void
+g_tcp_close(int sck)
+{
+ if (sck == 0)
+ {
+ return;
+ }
+
+ shutdown(sck, 2);
+ close(sck);
+}
+
+/*****************************************************************************/
+int
+g_tcp_last_error_would_block(int sck)
+{
+ return (errno == EWOULDBLOCK) || (errno == EINPROGRESS);
+}
+
+/*****************************************************************************/
+void
+g_sleep(int msecs)
+{
+ usleep(msecs * 1000);
+}
+
+/*****************************************************************************/
+int
+g_tcp_send(int sck, void *ptr, int len, int flags)
+{
+ return send(sck, ptr, len, flags);
+}
+
+/*****************************************************************************/
+void *
+g_malloc(int size, int zero)
+{
+ char *rv;
+
+ rv = (char *)malloc(size);
+ if (zero)
+ {
+ if (rv != 0)
+ {
+ memset(rv, 0, size);
+ }
+ }
+ return rv;
+}
+
+/*****************************************************************************/
+void
+g_free(void *ptr)
+{
+ if (ptr != 0)
+ {
+ free(ptr);
+ }
+}
+
+/*****************************************************************************/
+void
+g_sprintf(char *dest, char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ vsprintf(dest, format, ap);
+ va_end(ap);
+}
+
+/*****************************************************************************/
+int
+g_tcp_socket(void)
+{
+ int rv;
+ int i;
+
+ i = 1;
+ rv = socket(PF_INET, SOCK_STREAM, 0);
+ setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
+ setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (void *)&i, sizeof(i));
+ return rv;
+}
+
+/*****************************************************************************/
+int
+g_tcp_local_socket_dgram(void)
+{
+ return socket(AF_UNIX, SOCK_DGRAM, 0);
+}
+
+/*****************************************************************************/
+int
+g_tcp_local_socket_stream(void)
+{
+ return socket(AF_UNIX, SOCK_STREAM, 0);
+}
+
+/*****************************************************************************/
+void
+g_memcpy(void *d_ptr, const void *s_ptr, int size)
+{
+ memcpy(d_ptr, s_ptr, size);
+}
+
+/*****************************************************************************/
+void
+g_memset(void *d_ptr, const unsigned char chr, int size)
+{
+ memset(d_ptr, chr, size);
+}
+
+/*****************************************************************************/
+int
+g_tcp_set_no_delay(int sck)
+{
+ int i;
+
+ i = 1;
+ setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
+ return 0;
+}
+
+/*****************************************************************************/
+int
+g_tcp_set_non_blocking(int sck)
+{
+ unsigned long i;
+
+ i = fcntl(sck, F_GETFL);
+ i = i | O_NONBLOCK;
+ fcntl(sck, F_SETFL, i);
+ return 0;
+}
+
+/*****************************************************************************/
+int
+g_tcp_accept(int sck)
+{
+ struct sockaddr_in s;
+ unsigned int i;
+
+ i = sizeof(struct sockaddr_in);
+ memset(&s, 0, i);
+ return accept(sck, (struct sockaddr *)&s, &i);
+}
+
+/*****************************************************************************/
+int
+g_tcp_select(int sck1, int sck2, int sck3)
+{
+ fd_set rfds;
+ struct timeval time;
+ int max;
+ int rv;
+
+ time.tv_sec = 0;
+ time.tv_usec = 0;
+ FD_ZERO(&rfds);
+
+ if (sck1 > 0)
+ {
+ FD_SET(((unsigned int)sck1), &rfds);
+ }
+
+ if (sck2 > 0)
+ {
+ FD_SET(((unsigned int)sck2), &rfds);
+ }
+
+ if (sck3 > 0)
+ {
+ FD_SET(((unsigned int)sck3), &rfds);
+ }
+
+ max = sck1;
+
+ if (sck2 > max)
+ {
+ max = sck2;
+ }
+
+ if (sck3 > max)
+ {
+ max = sck3;
+ }
+
+ rv = select(max + 1, &rfds, 0, 0, &time);
+
+ if (rv > 0)
+ {
+ rv = 0;
+
+ if (FD_ISSET(((unsigned int)sck1), &rfds))
+ {
+ rv = rv | 1;
+ }
+
+ if (FD_ISSET(((unsigned int)sck2), &rfds))
+ {
+ rv = rv | 2;
+ }
+
+ if (FD_ISSET(((unsigned int)sck3), &rfds))
+ {
+ rv = rv | 4;
+ }
+ }
+ else
+ {
+ rv = 0;
+ }
+
+ return rv;
+}
+
+/*****************************************************************************/
+int
+g_tcp_bind(int sck, char *port)
+{
+ struct sockaddr_in s;
+
+ memset(&s, 0, sizeof(struct sockaddr_in));
+ s.sin_family = AF_INET;
+ s.sin_port = htons(atoi(port));
+ s.sin_addr.s_addr = INADDR_ANY;
+ return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_in));
+}
+
+/*****************************************************************************/
+int
+g_tcp_local_bind(int sck, char *port)
+{
+ struct sockaddr_un s;
+
+ memset(&s, 0, sizeof(struct sockaddr_un));
+ s.sun_family = AF_UNIX;
+ strcpy(s.sun_path, port);
+ return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_un));
+}
+
+/*****************************************************************************/
+int
+g_tcp_listen(int sck)
+{
+ return listen(sck, 2);
+}
+
+/*****************************************************************************/
+/* returns boolean */
+int
+g_create_dir(const char *dirname)
+{
+ return mkdir(dirname, (mode_t) - 1) == 0;
+}
+
+/*****************************************************************************/
+/* returns boolean, non zero if the directory exists */
+int
+g_directory_exist(const char *dirname)
+{
+ struct stat st;
+
+ if (stat(dirname, &st) == 0)
+ {
+ return S_ISDIR(st.st_mode);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+/*****************************************************************************/
+/* returns error */
+int
+g_chmod_hex(const char *filename, int flags)
+{
+ int fl;
+
+ fl = 0;
+ fl |= (flags & 0x4000) ? S_ISUID : 0;
+ fl |= (flags & 0x2000) ? S_ISGID : 0;
+ fl |= (flags & 0x1000) ? S_ISVTX : 0;
+ fl |= (flags & 0x0400) ? S_IRUSR : 0;
+ fl |= (flags & 0x0200) ? S_IWUSR : 0;
+ fl |= (flags & 0x0100) ? S_IXUSR : 0;
+ fl |= (flags & 0x0040) ? S_IRGRP : 0;
+ fl |= (flags & 0x0020) ? S_IWGRP : 0;
+ fl |= (flags & 0x0010) ? S_IXGRP : 0;
+ fl |= (flags & 0x0004) ? S_IROTH : 0;
+ fl |= (flags & 0x0002) ? S_IWOTH : 0;
+ fl |= (flags & 0x0001) ? S_IXOTH : 0;
+ return chmod(filename, fl);
+}
+
+/*****************************************************************************/
+/* produce a hex dump */
+void
+g_hexdump(unsigned char *p, unsigned int len)
+{
+ unsigned char *line;
+ int i;
+ int thisline;
+ int offset;
+
+ offset = 0;
+ line = p;
+
+ while (offset < len)
+ {
+ ErrorF("%04x ", offset);
+ thisline = len - offset;
+
+ if (thisline > 16)
+ {
+ thisline = 16;
+ }
+
+ for (i = 0; i < thisline; i++)
+ {
+ ErrorF("%02x ", line[i]);
+ }
+
+ for (; i < 16; i++)
+ {
+ ErrorF(" ");
+ }
+
+ for (i = 0; i < thisline; i++)
+ {
+ ErrorF("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
+ }
+
+ ErrorF("\n");
+ offset += thisline;
+ line += thisline;
+ }
+}
diff --git a/xorg/server/module/rdpMisc.h b/xorg/server/module/rdpMisc.h
new file mode 100644
index 00000000..8318f7bd
--- /dev/null
+++ b/xorg/server/module/rdpMisc.h
@@ -0,0 +1,78 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+the rest
+
+*/
+
+#ifndef __RDPMISC_H
+#define __RDPMISC_H
+
+int
+rdpBitsPerPixel(int depth);
+int
+g_tcp_recv(int sck, void *ptr, int len, int flags);
+void
+g_tcp_close(int sck);
+int
+g_tcp_last_error_would_block(int sck);
+void
+g_sleep(int msecs);
+int
+g_tcp_send(int sck, void *ptr, int len, int flags);
+void *
+g_malloc(int size, int zero);
+void
+g_free(void *ptr);
+void
+g_sprintf(char *dest, char *format, ...);
+int
+g_tcp_socket(void);
+int
+g_tcp_local_socket_dgram(void);
+int
+g_tcp_local_socket_stream(void);
+void
+g_memcpy(void *d_ptr, const void *s_ptr, int size);
+void
+g_memset(void *d_ptr, const unsigned char chr, int size);
+int
+g_tcp_set_no_delay(int sck);
+int
+g_tcp_set_non_blocking(int sck);
+int
+g_tcp_accept(int sck);
+int
+g_tcp_select(int sck1, int sck2, int sck3);
+int
+g_tcp_bind(int sck, char *port);
+int
+g_tcp_local_bind(int sck, char *port);
+int
+g_tcp_listen(int sck);
+int
+g_create_dir(const char *dirname);
+int
+g_directory_exist(const char *dirname);
+int
+g_chmod_hex(const char *filename, int flags);
+void
+g_hexdump(unsigned char *p, unsigned int len);
+
+#endif
diff --git a/xorg/server/module/rdpPolyArc.c b/xorg/server/module/rdpPolyArc.c
new file mode 100644
index 00000000..63fc699b
--- /dev/null
+++ b/xorg/server/module/rdpPolyArc.c
@@ -0,0 +1,48 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyArc(pDrawable, pGC, narcs, parcs);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
+{
+ LLOGLN(10, ("rdpPolyArc:"));
+ /* do original call */
+ rdpPolyArcOrg(pDrawable, pGC, narcs, parcs);
+}
diff --git a/xorg/server/module/rdpPolyArc.h b/xorg/server/module/rdpPolyArc.h
new file mode 100644
index 00000000..7ebadc35
--- /dev/null
+++ b/xorg/server/module/rdpPolyArc.h
@@ -0,0 +1,28 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYARC_H
+#define __RDPPOLYARC_H
+
+void
+rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs);
+
+#endif
diff --git a/xorg/server/module/rdpPolyFillArc.c b/xorg/server/module/rdpPolyFillArc.c
new file mode 100644
index 00000000..b53a1131
--- /dev/null
+++ b/xorg/server/module/rdpPolyFillArc.c
@@ -0,0 +1,48 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolyFillArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyFillArc(pDrawable, pGC, narcs, parcs);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
+{
+ LLOGLN(10, ("rdpPolyFillArc:"));
+ /* do original call */
+ rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs);
+}
diff --git a/xorg/server/module/rdpPolyFillArc.h b/xorg/server/module/rdpPolyFillArc.h
new file mode 100644
index 00000000..9a9846e1
--- /dev/null
+++ b/xorg/server/module/rdpPolyFillArc.h
@@ -0,0 +1,28 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYFILLARC_H
+#define __RDPPOLYFILLARC_H
+
+void
+rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs);
+
+#endif
diff --git a/xorg/server/module/rdpPolyFillRect.c b/xorg/server/module/rdpPolyFillRect.c
new file mode 100644
index 00000000..dc929f9f
--- /dev/null
+++ b/xorg/server/module/rdpPolyFillRect.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ LLOGLN(10, ("rdpPolyFillRect:"));
+ /* do original call */
+ rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
+}
diff --git a/xorg/server/module/rdpPolyFillRect.h b/xorg/server/module/rdpPolyFillRect.h
new file mode 100644
index 00000000..94ac4b59
--- /dev/null
+++ b/xorg/server/module/rdpPolyFillRect.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYFILLRECT_H
+#define __RDPPOLYFILLRECT_H
+
+void
+rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
+ xRectangle* prectInit);
+
+#endif
diff --git a/xorg/server/module/rdpPolyGlyphBlt.c b/xorg/server/module/rdpPolyGlyphBlt.c
new file mode 100644
index 00000000..5265ed72
--- /dev/null
+++ b/xorg/server/module/rdpPolyGlyphBlt.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolyGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ LLOGLN(10, ("rdpPolyGlyphBlt:"));
+ /* do original call */
+ rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+}
diff --git a/xorg/server/module/rdpPolyGlyphBlt.h b/xorg/server/module/rdpPolyGlyphBlt.h
new file mode 100644
index 00000000..9c6519d8
--- /dev/null
+++ b/xorg/server/module/rdpPolyGlyphBlt.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYGLYPHBLT_H
+#define __RDPPOLYGLYPHBLT_H
+
+void
+rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr* ppci, pointer pglyphBase);
+
+#endif
diff --git a/xorg/server/module/rdpPolyPoint.c b/xorg/server/module/rdpPolyPoint.c
new file mode 100644
index 00000000..6c9c77c1
--- /dev/null
+++ b/xorg/server/module/rdpPolyPoint.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolyPointOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr in_pts)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr in_pts)
+{
+ LLOGLN(10, ("rdpPolyPoint:"));
+ /* do original call */
+ rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
+}
diff --git a/xorg/server/module/rdpPolyPoint.h b/xorg/server/module/rdpPolyPoint.h
new file mode 100644
index 00000000..87bf9459
--- /dev/null
+++ b/xorg/server/module/rdpPolyPoint.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYPOINT_H
+#define __RDPPOLYPOINT_H
+
+void
+rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr in_pts);
+
+#endif
diff --git a/xorg/server/module/rdpPolyRectangle.c b/xorg/server/module/rdpPolyRectangle.c
new file mode 100644
index 00000000..e80b8178
--- /dev/null
+++ b/xorg/server/module/rdpPolyRectangle.c
@@ -0,0 +1,51 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
+ xRectangle *rects)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyRectangle(pDrawable, pGC, nrects, rects);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+/* tested with pGC->lineWidth = 0, 1, 2, 4 and opcodes 3 and 6 */
+void
+rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
+ xRectangle *rects)
+{
+ LLOGLN(10, ("rdpPolyRectangle:"));
+ /* do original call */
+ rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
+}
diff --git a/xorg/server/module/rdpPolyRectangle.h b/xorg/server/module/rdpPolyRectangle.h
new file mode 100644
index 00000000..d09446d5
--- /dev/null
+++ b/xorg/server/module/rdpPolyRectangle.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYRECTANGLE_H
+#define __RDPPOLYRECTANGLE_H
+
+void
+rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
+ xRectangle* rects);
+
+#endif
diff --git a/xorg/server/module/rdpPolySegment.c b/xorg/server/module/rdpPolySegment.c
new file mode 100644
index 00000000..f4a9d40c
--- /dev/null
+++ b/xorg/server/module/rdpPolySegment.c
@@ -0,0 +1,48 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolySegment(pDrawable, pGC, nseg, pSegs);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
+{
+ LLOGLN(10, ("rdpPolySegment:"));
+ /* do original call */
+ rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
+}
diff --git a/xorg/server/module/rdpPolySegment.h b/xorg/server/module/rdpPolySegment.h
new file mode 100644
index 00000000..8c5f33ab
--- /dev/null
+++ b/xorg/server/module/rdpPolySegment.h
@@ -0,0 +1,28 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYSEGMENT_H
+#define __RDPPOLYSEGMENT_H
+
+void
+rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs);
+
+#endif
diff --git a/xorg/server/module/rdpPolyText16.c b/xorg/server/module/rdpPolyText16.c
new file mode 100644
index 00000000..b5eac8c5
--- /dev/null
+++ b/xorg/server/module/rdpPolyText16.c
@@ -0,0 +1,55 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+int
+rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ int rv;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ rv = pGC->ops->PolyText16(pDrawable, pGC, x, y, count, chars);
+ GC_OP_EPILOGUE(pGC);
+ return rv;
+}
+
+/******************************************************************************/
+int
+rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ int rv;
+
+ LLOGLN(10, ("rdpPolyText16:"));
+ /* do original call */
+ rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
+ return rv;
+}
diff --git a/xorg/server/module/rdpPolyText16.h b/xorg/server/module/rdpPolyText16.h
new file mode 100644
index 00000000..bcfa8379
--- /dev/null
+++ b/xorg/server/module/rdpPolyText16.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYTEXT16_H
+#define __RDPPOLYTEXT16_H
+
+int
+rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short* chars);
+
+#endif
diff --git a/xorg/server/module/rdpPolyText8.c b/xorg/server/module/rdpPolyText8.c
new file mode 100644
index 00000000..8931a4c1
--- /dev/null
+++ b/xorg/server/module/rdpPolyText8.c
@@ -0,0 +1,55 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+int
+rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ int rv;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ rv = pGC->ops->PolyText8(pDrawable, pGC, x, y, count, chars);
+ GC_OP_EPILOGUE(pGC);
+ return rv;
+}
+
+/******************************************************************************/
+int
+rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ int rv;
+
+ LLOGLN(10, ("rdpPolyText8:"));
+ /* do original call */
+ rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
+ return rv;
+}
diff --git a/xorg/server/module/rdpPolyText8.h b/xorg/server/module/rdpPolyText8.h
new file mode 100644
index 00000000..95e80412
--- /dev/null
+++ b/xorg/server/module/rdpPolyText8.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYTEXT8_H
+#define __RDPPOLYTEXT8_H
+
+int
+rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char* chars);
+
+#endif
diff --git a/xorg/server/module/rdpPolylines.c b/xorg/server/module/rdpPolylines.c
new file mode 100644
index 00000000..b439db28
--- /dev/null
+++ b/xorg/server/module/rdpPolylines.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit)
+{
+ LLOGLN(10, ("rdpPolylines:"));
+ /* do original call */
+ rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
+}
diff --git a/xorg/server/module/rdpPolylines.h b/xorg/server/module/rdpPolylines.h
new file mode 100644
index 00000000..2df3d388
--- /dev/null
+++ b/xorg/server/module/rdpPolylines.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPOLYLINES_H
+#define __RDPPOLYLINES_H
+
+void
+rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit);
+
+#endif
diff --git a/xorg/server/module/rdpPri.c b/xorg/server/module/rdpPri.c
new file mode 100644
index 00000000..43f3d883
--- /dev/null
+++ b/xorg/server/module/rdpPri.c
@@ -0,0 +1,176 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+to deal with privates changing in xorg versions
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdpPri.h"
+#include "rdpMisc.h"
+
+#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((5) * 100000) + ((0) * 1000) + 0)
+/* 1.1, 1.2, 1.3, 1.4 */
+#define XRDP_PRI 1
+#elif XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0)
+/* 1.5, 1.6, 1.7, 1.8 */
+#define XRDP_PRI 2
+#else
+/* 1.9, 1.10, 1.11, 1.12 */
+#define XRDP_PRI 3
+#endif
+
+#define PTR2INT(_ptr) ((int) ((long) ((void*) (_ptr))))
+#define INT2PTR(_int) ((void *) ((long) ((int) (_int))))
+
+#if XRDP_PRI == 3
+static DevPrivateKeyRec g_privateKeyRecGC;
+static DevPrivateKeyRec g_privateKeyRecPixmap;
+static DevPrivateKeyRec g_privateKeyRecWindow;
+#elif XRDP_PRI == 2
+static int g_privateKeyRecGC = 0;
+static int g_privateKeyRecPixmap = 0;
+static int g_privateKeyRecWindow = 0;
+#endif
+
+/*****************************************************************************/
+rdpDevPrivateKey
+rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes)
+{
+ rdpDevPrivateKey rv;
+
+#if XRDP_PRI == 1
+ rv = INT2PTR(AllocateGCPrivateIndex());
+ AllocateGCPrivate(pScreen, PTR2INT(rv), bytes);
+#elif XRDP_PRI == 2
+ dixRequestPrivate(&g_privateKeyRecGC, bytes);
+ rv = &g_privateKeyRecGC;
+#else
+ dixRegisterPrivateKey(&g_privateKeyRecGC, PRIVATE_GC, bytes);
+ rv = &g_privateKeyRecGC;
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+rdpDevPrivateKey
+rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes)
+{
+ rdpDevPrivateKey rv;
+
+#if XRDP_PRI == 1
+ rv = INT2PTR(AllocatePixmapPrivateIndex());
+ AllocatePixmapPrivate(pScreen, PTR2INT(rv), bytes);
+#elif XRDP_PRI == 2
+ dixRequestPrivate(&g_privateKeyRecPixmap, bytes);
+ rv = &g_privateKeyRecPixmap;
+#else
+ dixRegisterPrivateKey(&g_privateKeyRecPixmap, PRIVATE_PIXMAP, bytes);
+ rv = &g_privateKeyRecPixmap;
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+rdpDevPrivateKey
+rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes)
+{
+ rdpDevPrivateKey rv;
+
+#if XRDP_PRI == 1
+ rv = INT2PTR(AllocateWindowPrivateIndex());
+ AllocateWindowPrivate(pScreen, PTR2INT(rv), bytes);
+#elif XRDP_PRI == 2
+ dixRequestPrivate(&g_privateKeyRecWindow, bytes);
+ rv = &g_privateKeyRecWindow;
+#else
+ dixRegisterPrivateKey(&g_privateKeyRecWindow, PRIVATE_WINDOW, bytes);
+ rv = &g_privateKeyRecWindow;
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+void *
+rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key)
+{
+ void *rv;
+
+#if XRDP_PRI == 1
+ rv = pGC->devPrivates[PTR2INT(key)].ptr;
+#else
+ rv = dixLookupPrivate(&(pGC->devPrivates), key);
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+void *
+rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key)
+{
+ void *rv;
+
+#if XRDP_PRI == 1
+ rv = pPixmap->devPrivates[PTR2INT(key)].ptr;
+#else
+ rv = dixLookupPrivate(&(pPixmap->devPrivates), key);
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+void *
+rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key)
+{
+ void *rv;
+
+#if XRDP_PRI == 1
+ rv = pWindow->devPrivates[PTR2INT(key)].ptr;
+#else
+ rv = dixLookupPrivate(&(pWindow->devPrivates), key);
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+int
+rdpPrivateInit(void)
+{
+#if XRDP_PRI == 3
+ g_memset(&g_privateKeyRecGC, 0, sizeof(g_privateKeyRecGC));
+ g_memset(&g_privateKeyRecWindow, 0, sizeof(g_privateKeyRecWindow));
+ g_memset(&g_privateKeyRecPixmap, 0, sizeof(g_privateKeyRecPixmap));
+#endif
+ return 0;
+}
diff --git a/xorg/server/module/rdpPri.h b/xorg/server/module/rdpPri.h
new file mode 100644
index 00000000..625947a3
--- /dev/null
+++ b/xorg/server/module/rdpPri.h
@@ -0,0 +1,47 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+to deal with privates changing in xorg versions
+
+*/
+
+#ifndef _XRDPPRI_H
+#define _XRDPPRI_H
+
+#include <screenint.h>
+#include <gc.h>
+
+typedef void* rdpDevPrivateKey;
+
+rdpDevPrivateKey
+rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes);
+rdpDevPrivateKey
+rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes);
+rdpDevPrivateKey
+rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes);
+void*
+rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key);
+void*
+rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key);
+void*
+rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key);
+int
+rdpPrivateInit(void);
+
+#endif
diff --git a/xorg/server/module/rdpPushPixels.c b/xorg/server/module/rdpPushPixels.c
new file mode 100644
index 00000000..3491d556
--- /dev/null
+++ b/xorg/server/module/rdpPushPixels.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPushPixelsOrg(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PushPixels(pGC, pBitMap, pDst, w, h, x, y);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y)
+{
+ LLOGLN(10, ("rdpPushPixels:"));
+ /* do original call */
+ rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
+}
diff --git a/xorg/server/module/rdpPushPixels.h b/xorg/server/module/rdpPushPixels.h
new file mode 100644
index 00000000..2e0cd1d1
--- /dev/null
+++ b/xorg/server/module/rdpPushPixels.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPUSHPIXELS_H
+#define __RDPPUSHPIXELS_H
+
+void
+rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y);
+
+#endif
diff --git a/xorg/server/module/rdpPutImage.c b/xorg/server/module/rdpPutImage.c
new file mode 100644
index 00000000..2d9faa89
--- /dev/null
+++ b/xorg/server/module/rdpPutImage.c
@@ -0,0 +1,51 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pBits)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PutImage(pDst, pGC, depth, x, y, w, h, leftPad,
+ format, pBits);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pBits)
+{
+ LLOGLN(10, ("rdpPutImage:"));
+ /* do original call */
+ rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
+}
diff --git a/xorg/server/module/rdpPutImage.h b/xorg/server/module/rdpPutImage.h
new file mode 100644
index 00000000..82e27872
--- /dev/null
+++ b/xorg/server/module/rdpPutImage.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPPUTIMAGE_H
+#define __RDPPUTIMAGE_H
+
+void
+rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char* pBits);
+
+#endif
diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c
new file mode 100644
index 00000000..fd080184
--- /dev/null
+++ b/xorg/server/module/rdpRandR.c
@@ -0,0 +1,309 @@
+/*
+Copyright 2011-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+RandR draw calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+#include "rdpDraw.h"
+#include "rdpReg.h"
+#include "rdpMisc.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+Bool
+rdpRRRegisterSize(ScreenPtr pScreen, int width, int height)
+{
+ int mmwidth;
+ int mmheight;
+ RRScreenSizePtr pSize;
+
+ LLOGLN(0, ("rdpRRRegisterSize: width %d height %d", width, height));
+ mmwidth = PixelToMM(width);
+ mmheight = PixelToMM(height);
+ pSize = RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
+ /* Tell RandR what the current config is */
+ RRSetCurrentConfig(pScreen, RR_Rotate_0, 0, pSize);
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
+ RRScreenSizePtr pSize)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ rrScrPrivPtr pRRScrPriv;
+ Bool rv;
+
+ LLOGLN(0, ("rdpRRSetConfig:"));
+ rv = TRUE;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+#if 0
+ pRRScrPriv = rrGetScrPriv(pScreen);
+ if (pRRScrPriv != 0)
+ {
+ if (dev->rrSetConfig != 0)
+ {
+ LLOGLN(0, ("rdpRRSetConfig: here"));
+ pRRScrPriv->rrSetConfig = dev->rrSetConfig;
+ rv = pRRScrPriv->rrSetConfig(pScreen, rotateKind, rate, pSize);
+ pRRScrPriv->rrSetConfig = rdpRRSetConfig;
+ }
+ }
+#endif
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
+{
+ int width;
+ int height;
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ rrScrPrivPtr pRRScrPriv;
+ Bool rv;
+
+ LLOGLN(0, ("rdpRRGetInfo:"));
+ rv = TRUE;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+#if 0
+ pRRScrPriv = rrGetScrPriv(pScreen);
+ if (pRRScrPriv != 0)
+ {
+ if (dev->rrGetInfo != 0)
+ {
+ LLOGLN(0, ("rdpRRGetInfo: here"));
+ pRRScrPriv->rrGetInfo = dev->rrGetInfo;
+ rv = pRRScrPriv->rrGetInfo(pScreen, pRotations);
+ pRRScrPriv->rrGetInfo = rdpRRGetInfo;
+ }
+ }
+#else
+ *pRotations = RR_Rotate_0;
+ width = dev->width;
+ height = dev->height;
+ rdpRRRegisterSize(pScreen, width, height);
+#endif
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
+ CARD32 mmWidth, CARD32 mmHeight)
+{
+ WindowPtr root;
+ PixmapPtr screenPixmap;
+ BoxRec box;
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+
+ LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d",
+ width, height, (int)mmWidth, (int)mmHeight));
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ root = rdpGetRootWindowPtr(pScreen);
+ if ((width < 1) || (height < 1))
+ {
+ LLOGLN(10, (" error width %d height %d", width, height));
+ return FALSE;
+ }
+ dev->width = width;
+ dev->height = height;
+ dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth);
+ dev->sizeInBytes = dev->paddedWidthInBytes * dev->height;
+ pScreen->width = width;
+ pScreen->height = height;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+ screenPixmap = pScreen->GetScreenPixmap(pScreen);
+ g_free(dev->pfbMemory);
+ dev->pfbMemory = (char *) g_malloc(dev->sizeInBytes, 1);
+ if (screenPixmap != 0)
+ {
+ pScreen->ModifyPixmapHeader(screenPixmap, width, height,
+ -1, -1,
+ dev->paddedWidthInBytes,
+ dev->pfbMemory);
+ }
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+ rdpRegionInit(&root->winSize, &box, 1);
+ rdpRegionInit(&root->borderSize, &box, 1);
+ rdpRegionReset(&root->borderClip, &box);
+ rdpRegionBreak(&root->clipList);
+ root->drawable.width = width;
+ root->drawable.height = height;
+ ResizeChildrenWinSize(root, 0, 0, 0, 0);
+ RRGetInfo(pScreen, 1);
+ LLOGLN(0, (" screen resized to %dx%d", pScreen->width, pScreen->height));
+ RRScreenSizeNotify(pScreen);
+ xf86EnableDisableFBAccess(pScreen->myNum, FALSE);
+ xf86EnableDisableFBAccess(pScreen->myNum, TRUE);
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
+ int x, int y, Rotation rotation, int numOutputs,
+ RROutputPtr *outputs)
+{
+ LLOGLN(0, ("rdpRRCrtcSet:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
+{
+ LLOGLN(0, ("rdpRRCrtcSetGamma:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
+{
+ LLOGLN(0, ("rdpRRCrtcGetGamma: %p %p %p %p", crtc, crtc->gammaRed,
+ crtc->gammaBlue, crtc->gammaGreen));
+ crtc->gammaSize = 1;
+ if (crtc->gammaRed == NULL)
+ {
+ crtc->gammaRed = g_malloc(32, 1);
+ }
+ if (crtc->gammaBlue == NULL)
+ {
+ crtc->gammaBlue = g_malloc(32, 1);
+ }
+ if (crtc->gammaGreen == NULL)
+ {
+ crtc->gammaGreen = g_malloc(32, 1);
+ }
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
+ RRPropertyValuePtr value)
+{
+ LLOGLN(0, ("rdpRROutputSetProperty:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
+ RRModePtr mode)
+{
+ LLOGLN(0, ("rdpRROutputValidateMode:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+void
+rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode)
+{
+ LLOGLN(0, ("rdpRRModeDestroy:"));
+}
+
+/******************************************************************************/
+Bool
+rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property)
+{
+ LLOGLN(0, ("rdpRROutputGetProperty:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea,
+ BoxPtr trackingArea, INT16 *border)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+
+ LLOGLN(0, ("rdpRRGetPanning: %p", crtc));
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+
+ if (totalArea != 0)
+ {
+ totalArea->x1 = 0;
+ totalArea->y1 = 0;
+ totalArea->x2 = dev->width;
+ totalArea->y2 = dev->height;
+ }
+
+ if (trackingArea != 0)
+ {
+ trackingArea->x1 = 0;
+ trackingArea->y1 = 0;
+ trackingArea->x2 = dev->width;
+ trackingArea->y2 = dev->height;
+ }
+
+ if (border != 0)
+ {
+ border[0] = 0;
+ border[1] = 0;
+ border[2] = 0;
+ border[3] = 0;
+ }
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRSetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea,
+ BoxPtr trackingArea, INT16 *border)
+{
+ LLOGLN(0, ("rdpRRSetPanning:"));
+ return TRUE;
+}
diff --git a/xorg/server/module/rdpRandR.h b/xorg/server/module/rdpRandR.h
new file mode 100644
index 00000000..3aba7e1a
--- /dev/null
+++ b/xorg/server/module/rdpRandR.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2011-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef _RDPRANDR_H
+#define _RDPRANDR_H
+
+Bool
+rdpRRRegisterSize(ScreenPtr pScreen, int width, int height);
+Bool
+rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations);
+Bool
+rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
+ RRScreenSizePtr pSize);
+Bool
+rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
+ CARD32 mmWidth, CARD32 mmHeight);
+Bool
+rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
+ int x, int y, Rotation rotation, int numOutputs,
+ RROutputPtr* outputs);
+Bool
+rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc);
+Bool
+rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc);
+Bool
+rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
+ RRPropertyValuePtr value);
+Bool
+rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
+ RRModePtr mode);
+void
+rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode);
+Bool
+rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property);
+Bool
+rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
+ BoxPtr trackingArea, INT16* border);
+Bool
+rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
+ BoxPtr trackingArea, INT16* border);
+
+#endif
diff --git a/xorg/server/module/rdpReg.c b/xorg/server/module/rdpReg.c
new file mode 100644
index 00000000..3a343f14
--- /dev/null
+++ b/xorg/server/module/rdpReg.c
@@ -0,0 +1,233 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+to deal with regions changing in xorg versions
+
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+/*
+miRegionCopy -> RegionCopy
+miTranslateRegion -> RegionTranslate
+miRegionNotEmpty -> RegionNotEmpty
+miIntersect -> RegionIntersect
+miRectIn -> RegionContainsRect
+miRegionInit -> RegionInit
+miRegionUninit -> RegionUninit
+miRectsToRegion -> RegionFromRects
+miRegionDestroy -> RegionDestroy
+miRegionCreate -> RegionCreate
+miUnion -> RegionUnion
+miRegionExtents -> RegionExtents
+miRegionReset -> RegionReset
+miRegionBreak -> RegionBreak
+*/
+
+#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0)
+/* 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 */
+#define XRDP_REG 1
+#else
+/* 1.9, 1.10, 1.11, 1.12 */
+#define XRDP_REG 2
+#endif
+
+/*****************************************************************************/
+Bool
+rdpRegionCopy(RegionPtr dst, RegionPtr src)
+{
+#if XRDP_REG == 1
+ return miRegionCopy(dst, src);
+#else
+ return RegionCopy(dst, src);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionTranslate(RegionPtr pReg, int x, int y)
+{
+#if XRDP_REG == 1
+ miTranslateRegion(pReg, x, y);
+#else
+ RegionTranslate(pReg, x, y);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionNotEmpty(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ return miRegionNotEmpty(pReg);
+#else
+ return RegionNotEmpty(pReg);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
+{
+#if XRDP_REG == 1
+ return miIntersect(newReg, reg1, reg2);
+#else
+ return RegionIntersect(newReg, reg1, reg2);
+#endif
+}
+
+/*****************************************************************************/
+int
+rdpRegionContainsRect(RegionPtr region, BoxPtr prect)
+{
+#if XRDP_REG == 1
+ return miRectIn(region, prect);
+#else
+ return RegionContainsRect(region, prect);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionInit(RegionPtr pReg, BoxPtr rect, int size)
+{
+#if XRDP_REG == 1
+ miRegionInit(pReg, rect, size);
+#else
+ RegionInit(pReg, rect, size);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionUninit(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ miRegionUninit(pReg);
+#else
+ RegionUninit(pReg);
+#endif
+}
+
+/*****************************************************************************/
+RegionPtr
+rdpRegionFromRects(int nrects, xRectanglePtr prect, int ctype)
+{
+#if XRDP_REG == 1
+ return miRectsToRegion(nrects, prect, ctype);
+#else
+ return RegionFromRects(nrects, prect, ctype);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionDestroy(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ miRegionDestroy(pReg);
+#else
+ RegionDestroy(pReg);
+#endif
+}
+
+/*****************************************************************************/
+RegionPtr
+rdpRegionCreate(BoxPtr rect, int size)
+{
+#if XRDP_REG == 1
+ return miRegionCreate(rect, size);
+#else
+ return RegionCreate(rect, size);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
+{
+#if XRDP_REG == 1
+ return miUnion(newReg, reg1, reg2);
+#else
+ return RegionUnion(newReg, reg1, reg2);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionSubtract(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
+{
+#if XRDP_REG == 1
+ return miSubtract(newReg, reg1, reg2);
+#else
+ return RegionSubtract(newReg, reg1, reg2);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect)
+{
+#if XRDP_REG == 1
+ return miInverse(newReg, reg1, invRect);
+#else
+ return RegionInverse(newReg, reg1, invRect);
+#endif
+}
+
+/*****************************************************************************/
+BoxPtr
+rdpRegionExtents(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ return miRegionExtents(pReg);
+#else
+ return RegionExtents(pReg);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionReset(RegionPtr pReg, BoxPtr pBox)
+{
+#if XRDP_REG == 1
+ miRegionReset(pReg, pBox);
+#else
+ RegionReset(pReg, pBox);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionBreak(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ return miRegionBreak(pReg);
+#else
+ return RegionBreak(pReg);
+#endif
+}
diff --git a/xorg/server/module/rdpReg.h b/xorg/server/module/rdpReg.h
new file mode 100644
index 00000000..b788cd69
--- /dev/null
+++ b/xorg/server/module/rdpReg.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+to deal with regions changing in xorg versions
+
+*/
+
+#ifndef __RDPREG_H
+#define __RDPREG_H
+
+Bool
+rdpRegionCopy(RegionPtr dst, RegionPtr src);
+void
+rdpRegionTranslate(RegionPtr pReg, int x, int y);
+Bool
+rdpRegionNotEmpty(RegionPtr pReg);
+Bool
+rdpRegionIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
+int
+rdpRegionContainsRect(RegionPtr region, BoxPtr prect);
+void
+rdpRegionInit(RegionPtr pReg, BoxPtr rect, int size);
+void
+rdpRegionUninit(RegionPtr pReg);
+RegionPtr
+rdpRegionFromRects(int nrects, xRectanglePtr prect, int ctype);
+void
+rdpRegionDestroy(RegionPtr pReg);
+RegionPtr
+rdpRegionCreate(BoxPtr rect, int size);
+Bool
+rdpRegionUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
+Bool
+rdpRegionSubtract(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
+Bool
+rdpRegionInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect);
+BoxPtr
+rdpRegionExtents(RegionPtr pReg);
+void
+rdpRegionReset(RegionPtr pReg, BoxPtr pBox);
+Bool
+rdpRegionBreak(RegionPtr pReg);
+
+#endif
diff --git a/xorg/server/module/rdpSetSpans.c b/xorg/server/module/rdpSetSpans.c
new file mode 100644
index 00000000..1bd9ed80
--- /dev/null
+++ b/xorg/server/module/rdpSetSpans.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LDEBUG 0
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpSetSpansOrg(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->SetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
+{
+ LLOGLN(0, ("rdpSetSpans:"));
+ /* do original call */
+ rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
+}
diff --git a/xorg/server/module/rdpSetSpans.h b/xorg/server/module/rdpSetSpans.h
new file mode 100644
index 00000000..acaedd66
--- /dev/null
+++ b/xorg/server/module/rdpSetSpans.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef __RDPSETSPANS_H
+#define __RDPSETSPANS_H
+
+void
+rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
+ DDXPointPtr ppt, int* pwidth, int nspans, int fSorted);
+
+#endif
diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt
new file mode 100644
index 00000000..1207efda
--- /dev/null
+++ b/xorg/server/readme.txt
@@ -0,0 +1,46 @@
+
+Notes for building xrdpdev_drv.so and libxorgxrdp.so
+
+
+
+to run it
+create /etc/X11/xrdp
+copy xorg.conf into it
+
+copy xrdpdev_drv.so to /usr/lib/xorg/modules/drivers
+copy libxorgxrdp.so to /usr/lib/xorg/modules
+
+copy xrdpmouse_drv.so to /usr/lib/xorg/modules/input
+copy xrdpkeyb_drv.so to /usr/lib/xorg/modules/input
+
+start xserver like this
+Xorg -modulepath /usr/lib/xorg/modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -nohwaccess -ac :10
+or this on older Xorg but need /dev/vc/ thing below
+Xorg -modulepath /home/jay/xorg-modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -ac vt7 :10
+
+older Xorg don't have -nohwaccess so you need to run Xorg as root
+or do something like this.
+
+sudo rm /dev/tty0
+sudo mknod -m 666 /dev/tty0 c 4 0
+
+sudo mkdir /dev/vc/
+sudo mknod -m 666 /dev/vc/7 c 7 7
+
+--modules
+ libfb.so
+ libint10.so
+ libvbe.so
+ libxorgxrdp.so
+----drivers
+ xrdpdev_drv.so
+----extensions
+ libdbe.so
+ libdri.so
+ libdri2.so
+ libextmod.so
+ libglx.so
+ librecord.so
+----input
+ xrdpkeyb_drv.so
+ xrdpmouse_drv.so
diff --git a/xorg/server/xrdpdev/Makefile b/xorg/server/xrdpdev/Makefile
new file mode 100644
index 00000000..0219959e
--- /dev/null
+++ b/xorg/server/xrdpdev/Makefile
@@ -0,0 +1,16 @@
+
+OBJS = xrdpdev.o
+
+CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 -I../module
+
+LDFLAGS =
+
+LIBS =
+
+all: xrdpdev_drv.so
+
+xrdpdev_drv.so: $(OBJS) Makefile
+ $(CC) -shared -o xrdpdev_drv.so $(LDFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f $(OBJS) xrdpdev_drv.so
diff --git a/xorg/server/xrdpdev/xorg.conf b/xorg/server/xrdpdev/xorg.conf
new file mode 100644
index 00000000..1c9d7cfc
--- /dev/null
+++ b/xorg/server/xrdpdev/xorg.conf
@@ -0,0 +1,68 @@
+
+Section "ServerLayout"
+ Identifier "X11 Server"
+ Screen "Screen (xrdpdev)"
+ InputDevice "xrdpMouse" "CorePointer"
+ InputDevice "xrdpKeyboard" "CoreKeyboard"
+EndSection
+
+Section "ServerFlags"
+ Option "DontVTSwitch" "on"
+ Option "AutoAddDevices" "off"
+EndSection
+
+Section "Files"
+ FontPath "/usr/X11R6/lib/X11/fonts/misc/:unscaled"
+ FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
+ FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
+ FontPath "/usr/X11R6/lib/X11/fonts/viewtouch"
+EndSection
+
+Section "Module"
+ Load "dbe"
+ Load "ddc"
+ Load "extmod"
+ Load "glx"
+ Load "int10"
+ Load "record"
+ Load "vbe"
+ Load "xorgxrdp"
+ Load "fb"
+EndSection
+
+Section "InputDevice"
+ Identifier "xrdpKeyboard"
+ Driver "xrdpkeyb"
+EndSection
+
+Section "InputDevice"
+ Identifier "xrdpMouse"
+ Driver "xrdpmouse"
+EndSection
+
+Section "Monitor"
+ Identifier "Monitor"
+ Option "DPMS"
+ HorizSync 30-80
+ VertRefresh 60-75
+ ModeLine "1920x1080" 138.500 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync
+ ModeLine "1280x720" 74.25 1280 1720 1760 1980 720 725 730 750 +HSync +VSync
+ Modeline "1368x768" 72.25 1368 1416 1448 1528 768 771 781 790 +hsync -vsync
+ Modeline "1600x900" 119.00 1600 1696 1864 2128 900 901 904 932 -hsync +vsync
+EndSection
+
+Section "Device"
+ Identifier "Video Card (xrdpdev)"
+ Driver "xrdpdev"
+EndSection
+
+Section "Screen"
+ Identifier "Screen (xrdpdev)"
+ Device "Video Card (xrdpdev)"
+ Monitor "Monitor"
+ DefaultDepth 24
+ SubSection "Display"
+ Depth 24
+ Modes "640x480" "800x600" "1024x768" "1280x720" "1280x1024" "1600x900" "1920x1080"
+ EndSubSection
+EndSection
diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c
new file mode 100644
index 00000000..cc863d4d
--- /dev/null
+++ b/xorg/server/xrdpdev/xrdpdev.c
@@ -0,0 +1,705 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+This is the main driver file
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+#include <randrstr.h>
+
+#include "rdp.h"
+#include "rdpPri.h"
+#include "rdpDraw.h"
+#include "rdpGC.h"
+#include "rdpCursor.h"
+#include "rdpRandR.h"
+#include "rdpMisc.h"
+#include "rdpComposite.h"
+#include "rdpGlyphs.h"
+
+#define XRDP_DRIVER_NAME "XRDPDEV"
+#define XRDP_NAME "XRDPDEV"
+#define XRDP_VERSION 1000
+
+#define PACKAGE_VERSION_MAJOR 1
+#define PACKAGE_VERSION_MINOR 0
+#define PACKAGE_VERSION_PATCHLEVEL 0
+
+#define LLOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do \
+ { \
+ if (_level < LLOG_LEVEL) \
+ { \
+ ErrorF _args ; \
+ ErrorF("\n"); \
+ } \
+ } \
+ while (0)
+
+int g_bpp = 32;
+int g_depth = 24;
+int g_rgb_bits = 8;
+int g_redOffset = 16;
+int g_redBits = 8;
+int g_greenOffset = 8;
+int g_greenBits = 8;
+int g_blueOffset = 0;
+int g_blueBits = 8;
+
+static int g_setup_done = 0;
+static OsTimerPtr g_timer = 0;
+
+/* Supported "chipsets" */
+static SymTabRec g_Chipsets[] =
+{
+ { 0, XRDP_DRIVER_NAME },
+ { -1, 0 }
+};
+
+static XF86ModuleVersionInfo g_VersRec =
+{
+ XRDP_DRIVER_NAME,
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ PACKAGE_VERSION_MAJOR,
+ PACKAGE_VERSION_MINOR,
+ PACKAGE_VERSION_PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ 0,
+ { 0, 0, 0, 0 }
+};
+
+/*****************************************************************************/
+static Bool
+rdpAllocRec(ScrnInfoPtr pScrn)
+{
+ LLOGLN(10, ("rdpAllocRec:"));
+ if (pScrn->driverPrivate != 0)
+ {
+ return TRUE;
+ }
+ /* xnfcalloc exits if alloc failed */
+ pScrn->driverPrivate = xnfcalloc(sizeof(rdpRec), 1);
+ return TRUE;
+}
+
+/*****************************************************************************/
+static void
+rdpFreeRec(ScrnInfoPtr pScrn)
+{
+ LLOGLN(10, ("rdpFreeRec:"));
+ if (pScrn->driverPrivate == 0)
+ {
+ return;
+ }
+ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = 0;
+}
+
+/*****************************************************************************/
+static Bool
+rdpPreInit(ScrnInfoPtr pScrn, int flags)
+{
+ rgb zeros1;
+ Gamma zeros2;
+ int got_res_match;
+ char **modename;
+ DisplayModePtr mode;
+ rdpPtr dev;
+
+ LLOGLN(0, ("rdpPreInit:"));
+ if (flags & PROBE_DETECT)
+ {
+ return FALSE;
+ }
+ if (pScrn->numEntities != 1)
+ {
+ return FALSE;
+ }
+
+ rdpPrivateInit();
+
+ rdpAllocRec(pScrn);
+ dev = XRDPPTR(pScrn);
+
+ dev->width = 1024;
+ dev->height = 768;
+
+ pScrn->monitor = pScrn->confScreen->monitor;
+ pScrn->bitsPerPixel = g_bpp;
+ pScrn->virtualX = dev->width;
+ pScrn->displayWidth = dev->width;
+ pScrn->virtualY = dev->height;
+ pScrn->progClock = 1;
+ pScrn->rgbBits = g_rgb_bits;
+ pScrn->depth = g_depth;
+ pScrn->chipset = XRDP_DRIVER_NAME;
+ pScrn->currentMode = pScrn->modes;
+ pScrn->offset.blue = g_blueOffset;
+ pScrn->offset.green = g_greenOffset;
+ pScrn->offset.red = g_redOffset;
+ pScrn->mask.blue = ((1 << g_blueBits) - 1) << pScrn->offset.blue;
+ pScrn->mask.green = ((1 << g_greenBits) - 1) << pScrn->offset.green;
+ pScrn->mask.red = ((1 << g_redBits) - 1) << pScrn->offset.red;
+
+ if (!xf86SetDepthBpp(pScrn, g_depth, g_bpp, g_bpp,
+ Support24bppFb | Support32bppFb |
+ SupportConvert32to24 | SupportConvert24to32))
+ {
+ LLOGLN(0, ("rdpPreInit: xf86SetDepthBpp failed"));
+ rdpFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86PrintDepthBpp(pScrn);
+ g_memset(&zeros1, 0, sizeof(zeros1));
+ if (!xf86SetWeight(pScrn, zeros1, zeros1))
+ {
+ LLOGLN(0, ("rdpPreInit: xf86SetWeight failed"));
+ rdpFreeRec(pScrn);
+ return FALSE;
+ }
+ g_memset(&zeros2, 0, sizeof(zeros2));
+ if (!xf86SetGamma(pScrn, zeros2))
+ {
+ LLOGLN(0, ("rdpPreInit: xf86SetGamma failed"));
+ rdpFreeRec(pScrn);
+ return FALSE;
+ }
+ if (!xf86SetDefaultVisual(pScrn, -1))
+ {
+ LLOGLN(0, ("rdpPreInit: xf86SetDefaultVisual failed"));
+ rdpFreeRec(pScrn);
+ return FALSE;
+ }
+ xf86SetDpi(pScrn, 0, 0);
+ if (0 == pScrn->display->modes)
+ {
+ LLOGLN(0, ("rdpPreInit: modes error"));
+ rdpFreeRec(pScrn);
+ return FALSE;
+ }
+
+ pScrn->virtualX = pScrn->display->virtualX;
+ pScrn->virtualY = pScrn->display->virtualY;
+
+ got_res_match = 0;
+ for (modename = pScrn->display->modes; *modename != 0; modename++)
+ {
+ for (mode = pScrn->monitor->Modes; mode != 0; mode = mode->next)
+ {
+ LLOGLN(10, ("%s %s", mode->name, *modename));
+ if (0 == strcmp(mode->name, *modename))
+ {
+ break;
+ }
+ }
+ if (0 == mode)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" not found\n",
+ *modename);
+ continue;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" ok\n", *modename);
+ LLOGLN(10, ("%d %d %d %d", mode->HDisplay, dev->width,
+ mode->VDisplay, dev->height));
+ if ((mode->HDisplay == dev->width) && (mode->VDisplay == dev->height))
+ {
+ pScrn->virtualX = mode->HDisplay;
+ pScrn->virtualY = mode->VDisplay;
+ got_res_match = 1;
+ }
+ if (got_res_match)
+ {
+ pScrn->modes = xf86DuplicateMode(mode);
+ pScrn->modes->next = pScrn->modes;
+ pScrn->modes->prev = pScrn->modes;
+ dev->num_modes = 1;
+ break;
+ }
+ }
+ pScrn->currentMode = pScrn->modes;
+ xf86PrintModes(pScrn);
+ LLOGLN(10, ("rdpPreInit: out fPtr->num_modes %d", dev->num_modes));
+ if (!got_res_match)
+ {
+ LLOGLN(0, ("rdpPreInit: could not find screen resolution %dx%d",
+ dev->width, dev->height));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/******************************************************************************/
+static miPointerSpriteFuncRec g_rdpSpritePointerFuncs =
+{
+ /* these are in rdpCursor.c */
+ rdpSpriteRealizeCursor,
+ rdpSpriteUnrealizeCursor,
+ rdpSpriteSetCursor,
+ rdpSpriteMoveCursor,
+ rdpSpriteDeviceCursorInitialize,
+ rdpSpriteDeviceCursorCleanup
+};
+
+/******************************************************************************/
+static Bool
+rdpSaveScreen(ScreenPtr pScreen, int on)
+{
+ LLOGLN(0, ("rdpSaveScreen:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+static Bool
+rdpResizeSession(rdpPtr dev, int width, int height)
+{
+ int mmwidth;
+ int mmheight;
+ RRScreenSizePtr pSize;
+ Bool ok;
+
+ LLOGLN(0, ("rdpResizeSession: width %d height %d", width, height));
+ mmwidth = PixelToMM(width);
+ mmheight = PixelToMM(height);
+
+ pSize = RRRegisterSize(dev->pScreen, width, height, mmwidth, mmheight);
+ RRSetCurrentConfig(dev->pScreen, RR_Rotate_0, 0, pSize);
+
+ ok = TRUE;
+ if ((dev->width != width) || (dev->height != height))
+ {
+ LLOGLN(0, (" calling RRScreenSizeSet"));
+ ok = RRScreenSizeSet(dev->pScreen, width, height, mmwidth, mmheight);
+ LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok));
+ }
+ return ok;
+}
+
+/******************************************************************************/
+/* returns error */
+static CARD32
+rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg)
+{
+ ScreenPtr pScreen;
+ rrScrPrivPtr pRRScrPriv;
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ char *envvar;
+ int width;
+ int height;
+
+ pScreen = (ScreenPtr) arg;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ LLOGLN(10, ("rdpDeferredRandR:"));
+ pRRScrPriv = rrGetScrPriv(pScreen);
+ if (pRRScrPriv == 0)
+ {
+ LLOGLN(0, ("rdpDeferredRandR: rrGetScrPriv failed"));
+ return 1;
+ }
+
+ dev->rrSetConfig = pRRScrPriv->rrSetConfig;
+ dev->rrGetInfo = pRRScrPriv->rrGetInfo;
+ dev->rrScreenSetSize = pRRScrPriv->rrScreenSetSize;
+ dev->rrCrtcSet = pRRScrPriv->rrCrtcSet;
+ dev->rrCrtcSetGamma = pRRScrPriv->rrCrtcSetGamma;
+ dev->rrCrtcGetGamma = pRRScrPriv->rrCrtcGetGamma;
+ dev->rrOutputSetProperty = pRRScrPriv->rrOutputSetProperty;
+ dev->rrOutputValidateMode = pRRScrPriv->rrOutputValidateMode;
+ dev->rrModeDestroy = pRRScrPriv->rrModeDestroy;
+ dev->rrOutputGetProperty = pRRScrPriv->rrOutputGetProperty;
+ dev->rrGetPanning = pRRScrPriv->rrGetPanning;
+ dev->rrSetPanning = pRRScrPriv->rrSetPanning;
+
+ LLOGLN(10, (" rrSetConfig = %p", dev->rrSetConfig));
+ LLOGLN(10, (" rrGetInfo = %p", dev->rrGetInfo));
+ LLOGLN(10, (" rrScreenSetSize = %p", dev->rrScreenSetSize));
+ LLOGLN(10, (" rrCrtcSet = %p", dev->rrCrtcSet));
+ LLOGLN(10, (" rrCrtcSetGamma = %p", dev->rrCrtcSetGamma));
+ LLOGLN(10, (" rrCrtcGetGamma = %p", dev->rrCrtcGetGamma));
+ LLOGLN(10, (" rrOutputSetProperty = %p", dev->rrOutputSetProperty));
+ LLOGLN(10, (" rrOutputValidateMode = %p", dev->rrOutputValidateMode));
+ LLOGLN(10, (" rrModeDestroy = %p", dev->rrModeDestroy));
+ LLOGLN(10, (" rrOutputGetProperty = %p", dev->rrOutputGetProperty));
+ LLOGLN(10, (" rrGetPanning = %p", dev->rrGetPanning));
+ LLOGLN(10, (" rrSetPanning = %p", dev->rrSetPanning));
+
+ pRRScrPriv->rrSetConfig = rdpRRSetConfig;
+ pRRScrPriv->rrGetInfo = rdpRRGetInfo;
+ pRRScrPriv->rrScreenSetSize = rdpRRScreenSetSize;
+ pRRScrPriv->rrCrtcSet = rdpRRCrtcSet;
+ pRRScrPriv->rrCrtcSetGamma = rdpRRCrtcSetGamma;
+ pRRScrPriv->rrCrtcGetGamma = rdpRRCrtcGetGamma;
+ pRRScrPriv->rrOutputSetProperty = rdpRROutputSetProperty;
+ pRRScrPriv->rrOutputValidateMode = rdpRROutputValidateMode;
+ pRRScrPriv->rrModeDestroy = rdpRRModeDestroy;
+ pRRScrPriv->rrOutputGetProperty = rdpRROutputGetProperty;
+ pRRScrPriv->rrGetPanning = rdpRRGetPanning;
+ pRRScrPriv->rrSetPanning = rdpRRSetPanning;
+
+ rdpResizeSession(dev, dev->width, dev->height);
+
+ envvar = getenv("XRDP_START_WIDTH");
+ if (envvar != 0)
+ {
+ width = atoi(envvar);
+ if ((width >= 16) && (width < 8192))
+ {
+ envvar = getenv("XRDP_START_HEIGHT");
+ if (envvar != 0)
+ {
+ height = atoi(envvar);
+ if ((height >= 16) && (height < 8192))
+ {
+ rdpResizeSession(dev, width, height);
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+/*****************************************************************************/
+static Bool
+rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ VisualPtr vis;
+ Bool vis_found;
+ PictureScreenPtr ps;
+
+ pScrn = xf86Screens[scrnIndex];
+ dev = XRDPPTR(pScrn);
+
+ dev->pScreen = pScreen;
+
+ miClearVisualTypes();
+ miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, TrueColor);
+ miSetPixmapDepths();
+ LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d rgbBits %d depth %d",
+ pScrn->virtualX, pScrn->virtualY, pScrn->rgbBits, pScrn->depth));
+
+ dev->depth = pScrn->depth;
+ dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth);
+ dev->bitsPerPixel = rdpBitsPerPixel(dev->depth);
+ dev->sizeInBytes = dev->paddedWidthInBytes * dev->height;
+ LLOGLN(0, ("rdpScreenInit: pfbMemory bytes %d", dev->sizeInBytes));
+ dev->pfbMemory = (char *) g_malloc(dev->sizeInBytes, 1);
+ if (!fbScreenInit(pScreen, dev->pfbMemory,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+ pScrn->bitsPerPixel))
+ {
+ LLOGLN(0, ("rdpScreenInit: fbScreenInit failed"));
+ return FALSE;
+ }
+ miInitializeBackingStore(pScreen);
+
+#if 0
+ /* XVideo */
+ if (rdp_xv_init(pScreen, pScrn) != 0)
+ {
+ LLOGLN(0, ("rdpScreenInit: rdp_xv_init failed"));
+ }
+#endif
+
+ vis = pScreen->visuals + (pScreen->numVisuals - 1);
+ while (vis >= pScreen->visuals)
+ {
+ if ((vis->class | DynamicClass) == DirectColor)
+ {
+ vis->offsetBlue = pScrn->offset.blue;
+ vis->blueMask = pScrn->mask.blue;
+ vis->offsetGreen = pScrn->offset.green;
+ vis->greenMask = pScrn->mask.green;
+ vis->offsetRed = pScrn->offset.red;
+ vis->redMask = pScrn->mask.red;
+ }
+ vis--;
+ }
+ fbPictureInit(pScreen, 0, 0);
+ xf86SetBlackWhitePixels(pScreen);
+ xf86SetBackingStore(pScreen);
+
+#if 1
+ /* hardware cursor */
+ dev->pCursorFuncs = xf86GetPointerScreenFuncs();
+ miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs,
+ dev->pCursorFuncs, 0);
+#else
+ /* software cursor */
+ dev->pCursorFuncs = xf86GetPointerScreenFuncs();
+ miDCInitialize(pScreen, dev->pCursorFuncs);
+#endif
+
+ fbCreateDefColormap(pScreen);
+
+ /* must assign this one */
+ pScreen->SaveScreen = rdpSaveScreen;
+
+ vis_found = FALSE;
+ vis = pScreen->visuals + (pScreen->numVisuals - 1);
+ while (vis >= pScreen->visuals)
+ {
+ if (vis->vid == pScreen->rootVisual)
+ {
+ vis_found = TRUE;
+ }
+ vis--;
+ }
+ if (!vis_found)
+ {
+ LLOGLN(0, ("rdpScreenInit: no root visual"));
+ return FALSE;
+ }
+
+ dev->privateKeyRecGC = rdpAllocateGCPrivate(pScreen, sizeof(rdpGCRec));
+ dev->privateKeyRecPixmap = rdpAllocatePixmapPrivate(pScreen, sizeof(rdpPixmapRec));
+
+ dev->CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = rdpCopyWindow;
+
+ dev->CreateGC = pScreen->CreateGC;
+ pScreen->CreateGC = rdpCreateGC;
+
+ dev->CreatePixmap = pScreen->CreatePixmap;
+ pScreen->CreatePixmap = rdpCreatePixmap;
+
+ dev->DestroyPixmap = pScreen->DestroyPixmap;
+ pScreen->DestroyPixmap = rdpDestroyPixmap;
+
+ dev->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;
+ pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader;
+
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps != 0)
+ {
+ /* composite */
+ dev->Composite = ps->Composite;
+ ps->Composite = rdpComposite;
+ /* glyphs */
+ dev->Glyphs = ps->Glyphs;
+ ps->Glyphs = rdpGlyphs;
+ }
+
+ g_timer = TimerSet(g_timer, 0, 10, rdpDeferredRandR, pScreen);
+
+ LLOGLN(0, ("rdpScreenInit: out"));
+ return TRUE;
+}
+
+/*****************************************************************************/
+static Bool
+rdpSwitchMode(int a, DisplayModePtr b, int c)
+{
+ LLOGLN(0, ("rdpSwitchMode:"));
+ return TRUE;
+}
+
+/*****************************************************************************/
+static void
+rdpAdjustFrame(int a, int b, int c, int d)
+{
+ LLOGLN(10, ("rdpAdjustFrame:"));
+}
+
+/*****************************************************************************/
+static Bool
+rdpEnterVT(int a, int b)
+{
+ LLOGLN(0, ("rdpEnterVT:"));
+ return TRUE;
+}
+
+/*****************************************************************************/
+static void
+rdpLeaveVT(int a, int b)
+{
+ LLOGLN(0, ("rdpLeaveVT:"));
+}
+
+/*****************************************************************************/
+static ModeStatus
+rdpValidMode(int a, DisplayModePtr b, Bool c, int d)
+{
+ LLOGLN(0, ("rdpValidMode:"));
+ return 0;
+}
+
+/*****************************************************************************/
+static Bool
+rdpProbe(DriverPtr drv, int flags)
+{
+ int num_dev_sections;
+ int i;
+ int entity;
+ GDevPtr *dev_sections;
+ Bool found_screen;
+ ScrnInfoPtr pscrn;
+
+ LLOGLN(0, ("rdpProbe:"));
+ if (flags & PROBE_DETECT)
+ {
+ return FALSE;
+ }
+ /* fbScreenInit, fbPictureInit, ... */
+ if (!xf86LoadDrvSubModule(drv, "fb"))
+ {
+ LLOGLN(0, ("rdpProbe: xf86LoadDrvSubModule for fb failed"));
+ return FALSE;
+ }
+
+ num_dev_sections = xf86MatchDevice(XRDP_DRIVER_NAME, &dev_sections);
+ if (num_dev_sections <= 0)
+ {
+ LLOGLN(0, ("rdpProbe: xf86MatchDevice failed"));
+ return FALSE;
+ }
+
+ pscrn = 0;
+ found_screen = FALSE;
+ for (i = 0; i < num_dev_sections; i++)
+ {
+ entity = xf86ClaimFbSlot(drv, 0, dev_sections[i], 1);
+ pscrn = xf86ConfigFbEntity(pscrn, 0, entity, 0, 0, 0, 0);
+ if (pscrn)
+ {
+ LLOGLN(10, ("rdpProbe: found screen"));
+ found_screen = 1;
+ pscrn->driverVersion = XRDP_VERSION;
+ pscrn->driverName = XRDP_DRIVER_NAME;
+ pscrn->name = XRDP_NAME;
+ pscrn->Probe = rdpProbe;
+ pscrn->PreInit = rdpPreInit;
+ pscrn->ScreenInit = rdpScreenInit;
+ pscrn->SwitchMode = rdpSwitchMode;
+ pscrn->AdjustFrame = rdpAdjustFrame;
+ pscrn->EnterVT = rdpEnterVT;
+ pscrn->LeaveVT = rdpLeaveVT;
+ pscrn->ValidMode = rdpValidMode;
+
+ xf86DrvMsg(pscrn->scrnIndex, X_INFO, "%s", "using default device\n");
+ }
+ }
+ free(dev_sections);
+ return found_screen;
+}
+
+/*****************************************************************************/
+static const OptionInfoRec *
+rdpAvailableOptions(int chipid, int busid)
+{
+ LLOGLN(0, ("rdpAvailableOptions:"));
+ return 0;
+}
+
+#ifndef HW_SKIP_CONSOLE
+#define HW_SKIP_CONSOLE 4
+#endif
+
+/*****************************************************************************/
+static Bool
+rdpDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr)
+{
+ xorgHWFlags *flags;
+ int rv;
+
+ rv = FALSE;
+ LLOGLN(0, ("rdpDriverFunc: op %d", (int)op));
+ if (op == GET_REQUIRED_HW_INTERFACES)
+ {
+ flags = (xorgHWFlags *) ptr;
+ *flags = HW_SKIP_CONSOLE;
+ rv = TRUE;
+ }
+ return rv;
+}
+
+/*****************************************************************************/
+static void
+rdpIdentify(int flags)
+{
+ LLOGLN(0, ("rdpIdentify:"));
+ xf86PrintChipsets(XRDP_NAME, "driver for xrdp", g_Chipsets);
+}
+
+/*****************************************************************************/
+_X_EXPORT DriverRec g_DriverRec =
+{
+ XRDP_VERSION,
+ XRDP_DRIVER_NAME,
+ rdpIdentify,
+ rdpProbe,
+ rdpAvailableOptions,
+ 0,
+ 0,
+ rdpDriverFunc
+};
+
+/*****************************************************************************/
+static pointer
+xrdpdevSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ LLOGLN(0, ("xrdpdevSetup:"));
+ if (!g_setup_done)
+ {
+ g_setup_done = 1;
+ xf86AddDriver(&g_DriverRec, module, HaveDriverFuncs);
+ return (pointer)1;
+ }
+ else
+ {
+ if (errmaj != 0)
+ {
+ *errmaj = LDR_ONCEONLY;
+ }
+ return 0;
+ }
+}
+
+/* <drivername>ModuleData */
+_X_EXPORT XF86ModuleData xrdpdevModuleData =
+{
+ &g_VersRec,
+ xrdpdevSetup,
+ 0
+};
diff --git a/xorg/server/xrdpkeyb/Makefile b/xorg/server/xrdpkeyb/Makefile
new file mode 100644
index 00000000..c8654851
--- /dev/null
+++ b/xorg/server/xrdpkeyb/Makefile
@@ -0,0 +1,16 @@
+
+OBJS = rdpKeyboard.o
+
+CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 -I../module
+
+LDFLAGS =
+
+LIBS =
+
+all: xrdpkeyb_drv.so
+
+xrdpkeyb_drv.so: $(OBJS) Makefile
+ $(CC) -shared -o xrdpkeyb_drv.so $(LDFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f $(OBJS) xrdpkeyb_drv.so
diff --git a/xorg/server/xrdpkeyb/rdpKeyboard.c b/xorg/server/xrdpkeyb/rdpKeyboard.c
new file mode 100644
index 00000000..4fda5e76
--- /dev/null
+++ b/xorg/server/xrdpkeyb/rdpKeyboard.c
@@ -0,0 +1,467 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+xrdp keyboard module
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include "xf86Xinput.h"
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "X11/keysym.h"
+
+#include "rdp.h"
+
+/* if 1, a keystroke is done every minute, down, then up */
+#define XRDPKB_TEST 0
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+#define XRDP_DRIVER_NAME "XRDPKEYB"
+#define XRDP_NAME "XRDPKEYB"
+#define XRDP_VERSION 1000
+
+#define PACKAGE_VERSION_MAJOR 1
+#define PACKAGE_VERSION_MINOR 0
+#define PACKAGE_VERSION_PATCHLEVEL 0
+
+#define MIN_KEY_CODE 8
+#define MAX_KEY_CODE 255
+#define NO_OF_KEYS ((MAX_KEY_CODE - MIN_KEY_CODE) + 1)
+#define GLYPHS_PER_KEY 2
+/* control */
+#define CONTROL_L_KEY_CODE 37
+#define CONTROL_R_KEY_CODE 109
+/* shift */
+#define SHIFT_L_KEY_CODE 50
+#define SHIFT_R_KEY_CODE 62
+/* win keys */
+#define SUPER_L_KEY_CODE 115
+#define SUPER_R_KEY_CODE 116
+/* alt */
+#define ALT_L_KEY_CODE 64
+#define ALT_R_KEY_CODE 113
+/* caps lock */
+#define CAPS_LOCK_KEY_CODE 66
+/* num lock */
+#define NUM_LOCK_KEY_CODE 77
+
+#define N_PREDEFINED_KEYS \
+ (sizeof(g_kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY))
+
+static DeviceIntPtr g_keyboard = 0;
+static OsTimerPtr g_timer = 0;
+
+static KeySym g_kbdMap[] =
+{
+ NoSymbol, NoSymbol, /* 8 */
+ XK_Escape, NoSymbol, /* 9 */
+ XK_1, XK_exclam, /* 10 */
+ XK_2, XK_at,
+ XK_3, XK_numbersign,
+ XK_4, XK_dollar,
+ XK_5, XK_percent,
+ XK_6, XK_asciicircum,
+ XK_7, XK_ampersand,
+ XK_8, XK_asterisk,
+ XK_9, XK_parenleft,
+ XK_0, XK_parenright,
+ XK_minus, XK_underscore, /* 20 */
+ XK_equal, XK_plus,
+ XK_BackSpace, NoSymbol,
+ XK_Tab, XK_ISO_Left_Tab,
+ XK_Q, NoSymbol,
+ XK_W, NoSymbol,
+ XK_E, NoSymbol,
+ XK_R, NoSymbol,
+ XK_T, NoSymbol,
+ XK_Y, NoSymbol,
+ XK_U, NoSymbol, /* 30 */
+ XK_I, NoSymbol,
+ XK_O, NoSymbol,
+ XK_P, NoSymbol,
+ XK_bracketleft, XK_braceleft,
+ XK_bracketright, XK_braceright,
+ XK_Return, NoSymbol,
+ XK_Control_L, NoSymbol,
+ XK_A, NoSymbol,
+ XK_S, NoSymbol,
+ XK_D, NoSymbol, /* 40 */
+ XK_F, NoSymbol,
+ XK_G, NoSymbol,
+ XK_H, NoSymbol,
+ XK_J, NoSymbol,
+ XK_K, NoSymbol,
+ XK_L, NoSymbol,
+ XK_semicolon, XK_colon,
+ XK_apostrophe, XK_quotedbl,
+ XK_grave, XK_asciitilde,
+ XK_Shift_L, NoSymbol, /* 50 */
+ XK_backslash, XK_bar,
+ XK_Z, NoSymbol,
+ XK_X, NoSymbol,
+ XK_C, NoSymbol,
+ XK_V, NoSymbol,
+ XK_B, NoSymbol,
+ XK_N, NoSymbol,
+ XK_M, NoSymbol,
+ XK_comma, XK_less,
+ XK_period, XK_greater, /* 60 */
+ XK_slash, XK_question,
+ XK_Shift_R, NoSymbol,
+ XK_KP_Multiply, NoSymbol,
+ XK_Alt_L, NoSymbol,
+ XK_space, NoSymbol,
+ XK_Caps_Lock, NoSymbol,
+ XK_F1, NoSymbol,
+ XK_F2, NoSymbol,
+ XK_F3, NoSymbol,
+ XK_F4, NoSymbol, /* 70 */
+ XK_F5, NoSymbol,
+ XK_F6, NoSymbol,
+ XK_F7, NoSymbol,
+ XK_F8, NoSymbol,
+ XK_F9, NoSymbol,
+ XK_F10, NoSymbol,
+ XK_Num_Lock, NoSymbol,
+ XK_Scroll_Lock, NoSymbol,
+ XK_KP_Home, XK_KP_7,
+ XK_KP_Up, XK_KP_8, /* 80 */
+ XK_KP_Prior, XK_KP_9,
+ XK_KP_Subtract, NoSymbol,
+ XK_KP_Left, XK_KP_4,
+ XK_KP_Begin, XK_KP_5,
+ XK_KP_Right, XK_KP_6,
+ XK_KP_Add, NoSymbol,
+ XK_KP_End, XK_KP_1,
+ XK_KP_Down, XK_KP_2,
+ XK_KP_Next, XK_KP_3,
+ XK_KP_Insert, XK_KP_0, /* 90 */
+ XK_KP_Delete, XK_KP_Decimal,
+ NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol,
+ XK_F11, NoSymbol,
+ XK_F12, NoSymbol,
+ XK_Home, NoSymbol,
+ XK_Up, NoSymbol,
+ XK_Prior, NoSymbol,
+ XK_Left, NoSymbol, /* 100 */
+ XK_Print, NoSymbol,
+ XK_Right, NoSymbol,
+ XK_End, NoSymbol,
+ XK_Down, NoSymbol,
+ XK_Next, NoSymbol,
+ XK_Insert, NoSymbol,
+ XK_Delete, NoSymbol,
+ XK_KP_Enter, NoSymbol,
+ XK_Control_R, NoSymbol,
+ XK_Pause, NoSymbol, /* 110 */
+ XK_Print, NoSymbol,
+ XK_KP_Divide, NoSymbol,
+ XK_Alt_R, NoSymbol,
+ NoSymbol, NoSymbol,
+ XK_Super_L, NoSymbol,
+ XK_Super_R, NoSymbol,
+ XK_Menu, NoSymbol,
+ NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, /* 120 */
+ NoSymbol, NoSymbol
+};
+
+/******************************************************************************/
+static void
+rdpEnqueueKey(int type, int scancode)
+{
+ if (type == KeyPress)
+ {
+ /* need this cause rdp and X11 repeats are different */
+ xf86PostKeyboardEvent(g_keyboard, scancode, FALSE);
+ xf86PostKeyboardEvent(g_keyboard, scancode, TRUE);
+ }
+ else
+ {
+ xf86PostKeyboardEvent(g_keyboard, scancode, FALSE);
+ }
+}
+
+#if XRDPKB_TEST
+/******************************************************************************/
+static CARD32
+rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg)
+{
+ LLOGLN(0, ("rdpDeferredUpdateCallback:"));
+
+ rdpEnqueueKey(KeyPress, 115);
+ rdpEnqueueKey(KeyRelease, 115);
+
+ g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0);
+ return 0;
+}
+#endif
+
+/******************************************************************************/
+void
+rdpkeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ int i;
+
+ LLOGLN(0, ("rdpkeybDeviceInit:"));
+ LLOGLN(10, (" MAP_LENGTH %d GLYPHS_PER_KEY %d N_PREDEFINED_KEYS %d",
+ MAP_LENGTH, GLYPHS_PER_KEY, (int) N_PREDEFINED_KEYS));
+
+ for (i = 0; i < MAP_LENGTH; i++)
+ {
+ pModMap[i] = NoSymbol;
+ }
+
+ pModMap[SHIFT_L_KEY_CODE] = ShiftMask;
+ pModMap[SHIFT_R_KEY_CODE] = ShiftMask;
+ pModMap[CAPS_LOCK_KEY_CODE] = LockMask;
+ pModMap[CONTROL_L_KEY_CODE] = ControlMask;
+ pModMap[CONTROL_R_KEY_CODE] = ControlMask;
+ pModMap[ALT_L_KEY_CODE] = Mod1Mask;
+ pModMap[ALT_R_KEY_CODE] = Mod1Mask;
+ pModMap[NUM_LOCK_KEY_CODE] = Mod2Mask;
+ pModMap[SUPER_L_KEY_CODE] = Mod4Mask;
+ pModMap[SUPER_R_KEY_CODE] = Mod4Mask;
+ pKeySyms->minKeyCode = MIN_KEY_CODE;
+ pKeySyms->maxKeyCode = MAX_KEY_CODE;
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ i = sizeof(KeySym) * MAP_LENGTH * GLYPHS_PER_KEY;
+ pKeySyms->map = (KeySym *)malloc(i);
+ if (pKeySyms->map == 0)
+ {
+ LLOGLN(0, ("rdpkeybDeviceInit: malloc failed"));
+ exit(1);
+ }
+ else
+ {
+ memset(pKeySyms->map, 0, i);
+ }
+
+ for (i = 0; i < MAP_LENGTH * GLYPHS_PER_KEY; i++)
+ {
+ pKeySyms->map[i] = NoSymbol;
+ }
+
+ for (i = 0; i < N_PREDEFINED_KEYS * GLYPHS_PER_KEY; i++)
+ {
+ pKeySyms->map[i] = g_kbdMap[i];
+ }
+}
+
+/******************************************************************************/
+static void
+rdpkeybDeviceOn(void)
+{
+ LLOGLN(0, ("rdpkeybDeviceOn:"));
+}
+
+/******************************************************************************/
+static void
+rdpkeybDeviceOff(void)
+{
+ LLOGLN(0, ("rdpkeybDeviceOff:"));
+}
+
+/******************************************************************************/
+static void
+rdpkeybBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
+{
+ LLOGLN(0, ("rdpkeybBell:"));
+}
+
+/******************************************************************************/
+static void
+rdpkeybChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
+{
+ LLOGLN(0, ("rdpkeybChangeKeyboardControl:"));
+}
+
+/******************************************************************************/
+static int
+rdpkeybControl(DeviceIntPtr device, int what)
+{
+ KeySymsRec keySyms;
+ CARD8 modMap[MAP_LENGTH];
+ DevicePtr pDev;
+ XkbRMLVOSet set;
+
+ LLOGLN(0, ("rdpkeybControl: what %d", what));
+ pDev = (DevicePtr)device;
+
+ switch (what)
+ {
+ case DEVICE_INIT:
+ rdpkeybDeviceInit(device, &keySyms, modMap);
+ memset(&set, 0, sizeof(set));
+ set.rules = "base";
+ set.model = "pc104";
+ set.layout = "us";
+ set.variant = "";
+ set.options = "";
+ InitKeyboardDeviceStruct(device, &set, rdpkeybBell,
+ rdpkeybChangeKeyboardControl);
+ g_keyboard = device;
+#if XRDPKB_TEST
+ g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0);
+#endif
+ break;
+ case DEVICE_ON:
+ pDev->on = 1;
+ rdpkeybDeviceOn();
+ break;
+ case DEVICE_OFF:
+ pDev->on = 0;
+ rdpkeybDeviceOff();
+ break;
+ case DEVICE_CLOSE:
+ if (pDev->on)
+ {
+ rdpkeybDeviceOff();
+ }
+ break;
+ }
+ return Success;
+}
+
+#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 1)
+
+/* debian 6
+ ubuntu 10.04 */
+
+/******************************************************************************/
+static InputInfoPtr
+rdpkeybPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
+{
+ InputInfoPtr info;
+
+ LLOGLN(0, ("rdpkeybPreInit: drv %p dev %p, flags 0x%x",
+ drv, dev, flags));
+ info = xf86AllocateInput(drv, 0);
+ info->name = dev->identifier;
+ info->device_control = rdpkeybControl;
+ info->flags = XI86_CONFIGURED | XI86_ALWAYS_CORE | XI86_SEND_DRAG_EVENTS |
+ XI86_CORE_KEYBOARD | XI86_KEYBOARD_CAPABLE;
+ info->type_name = "Keyboard";
+ info->fd = -1;
+ info->conf_idev = dev;
+
+ return info;
+}
+
+#else
+
+/* debian 7
+ ubuntu 12.04 */
+
+/******************************************************************************/
+static int
+rdpkeybPreInit(InputDriverPtr drv, InputInfoPtr info, int flags)
+{
+ LLOGLN(0, ("rdpkeybPreInit: drv %p info %p, flags 0x%x",
+ drv, info, flags));
+ info->device_control = rdpkeybControl;
+ info->type_name = "Keyboard";
+
+ return 0;
+}
+
+#endif
+
+/******************************************************************************/
+static void
+rdpkeybUnInit(InputDriverPtr drv, InputInfoPtr info, int flags)
+{
+ LLOGLN(0, ("rdpkeybUnInit: drv %p info %p, flags 0x%x",
+ drv, info, flags));
+}
+
+/******************************************************************************/
+static InputDriverRec rdpkeyb =
+{
+ PACKAGE_VERSION_MAJOR, /* version */
+ XRDP_NAME, /* name */
+ NULL, /* identify */
+ rdpkeybPreInit, /* preinit */
+ rdpkeybUnInit, /* uninit */
+ NULL, /* module */
+ 0 /* ref count */
+};
+
+/******************************************************************************/
+static void
+rdpkeybUnplug(pointer p)
+{
+ LLOGLN(0, ("rdpkeybUnplug:"));
+}
+
+/******************************************************************************/
+static pointer
+rdpkeybPlug(pointer module, pointer options, int *errmaj, int *errmin)
+{
+ LLOGLN(0, ("rdpkeybPlug:"));
+ xf86AddInputDriver(&rdpkeyb, module, 0);
+ return module;
+}
+
+/******************************************************************************/
+static XF86ModuleVersionInfo rdpkeybVersionRec =
+{
+ XRDP_DRIVER_NAME,
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ PACKAGE_VERSION_MAJOR,
+ PACKAGE_VERSION_MINOR,
+ PACKAGE_VERSION_PATCHLEVEL,
+ ABI_CLASS_XINPUT,
+ ABI_XINPUT_VERSION,
+ MOD_CLASS_XINPUT,
+ { 0, 0, 0, 0 }
+};
+
+/******************************************************************************/
+XF86ModuleData xrdpkeybModuleData =
+{
+ &rdpkeybVersionRec,
+ rdpkeybPlug,
+ rdpkeybUnplug
+};
diff --git a/xorg/server/xrdpmouse/Makefile b/xorg/server/xrdpmouse/Makefile
new file mode 100644
index 00000000..dfcabc88
--- /dev/null
+++ b/xorg/server/xrdpmouse/Makefile
@@ -0,0 +1,16 @@
+
+OBJS = rdpMouse.o
+
+CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 -I../module
+
+LDFLAGS =
+
+LIBS =
+
+all: xrdpmouse_drv.so
+
+xrdpmouse_drv.so: $(OBJS) Makefile
+ $(CC) -shared -o xrdpmouse_drv.so $(LDFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f $(OBJS) xrdpmouse_drv.so
diff --git a/xorg/server/xrdpmouse/rdpMouse.c b/xorg/server/xrdpmouse/rdpMouse.c
new file mode 100644
index 00000000..7142a4ee
--- /dev/null
+++ b/xorg/server/xrdpmouse/rdpMouse.c
@@ -0,0 +1,246 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+xrdp mouse module
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include "xf86Xinput.h"
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+#include <exevents.h>
+#include <xserver-properties.h>
+
+#include "rdp.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+#define XRDP_DRIVER_NAME "XRDPMOUSE"
+#define XRDP_NAME "XRDPMOUSE"
+#define XRDP_VERSION 1000
+
+#define PACKAGE_VERSION_MAJOR 1
+#define PACKAGE_VERSION_MINOR 0
+#define PACKAGE_VERSION_PATCHLEVEL 0
+
+/******************************************************************************/
+static void
+rdpmouseDeviceInit(void)
+{
+ LLOGLN(0, ("rdpmouseDeviceInit:"));
+}
+
+/******************************************************************************/
+static void
+rdpmouseDeviceOn(DeviceIntPtr pDev)
+{
+ LLOGLN(0, ("rdpmouseDeviceOn:"));
+}
+
+/******************************************************************************/
+static void
+rdpmouseDeviceOff(void)
+{
+ LLOGLN(0, ("rdpmouseDeviceOff:"));
+}
+
+/******************************************************************************/
+static void
+rdpmouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl)
+{
+ LLOGLN(0, ("rdpmouseCtrl:"));
+}
+
+/******************************************************************************/
+static int
+rdpmouseControl(DeviceIntPtr device, int what)
+{
+ BYTE map[6];
+ DevicePtr pDev;
+ Atom btn_labels[6];
+ Atom axes_labels[2];
+
+ LLOGLN(0, ("rdpmouseControl: what %d", what));
+ pDev = (DevicePtr)device;
+
+ switch (what)
+ {
+ case DEVICE_INIT:
+ rdpmouseDeviceInit();
+ map[0] = 0;
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ map[4] = 4;
+ map[5] = 5;
+
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
+ InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpmouseCtrl,
+ GetMotionHistorySize(), 2, axes_labels);
+
+ break;
+ case DEVICE_ON:
+ pDev->on = 1;
+ rdpmouseDeviceOn(device);
+ break;
+ case DEVICE_OFF:
+ pDev->on = 0;
+ rdpmouseDeviceOff();
+ break;
+ case DEVICE_CLOSE:
+
+ if (pDev->on)
+ {
+ rdpmouseDeviceOff();
+ }
+
+ break;
+ }
+
+ return Success;
+}
+
+#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 1)
+
+/* debian 6
+ ubuntu 10.04 */
+
+/******************************************************************************/
+static InputInfoPtr
+rdpmousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
+{
+ InputInfoPtr info;
+
+ LLOGLN(0, ("rdpmousePreInit: drv %p dev %p, flags 0x%x",
+ drv, dev, flags));
+ info = xf86AllocateInput(drv, 0);
+ info->name = dev->identifier;
+ info->device_control = rdpmouseControl;
+ info->flags = XI86_CONFIGURED | XI86_ALWAYS_CORE | XI86_SEND_DRAG_EVENTS |
+ XI86_CORE_POINTER | XI86_POINTER_CAPABLE;
+ info->type_name = "Mouse";
+ info->fd = -1;
+ info->conf_idev = dev;
+
+ return info;
+}
+
+#else
+
+/* debian 7
+ ubuntu 12.04 */
+
+/******************************************************************************/
+static int
+rdpmousePreInit(InputDriverPtr drv, InputInfoPtr info, int flags)
+{
+ LLOGLN(0, ("rdpmousePreInit: drv %p info %p, flags 0x%x",
+ drv, info, flags));
+ info->device_control = rdpmouseControl;
+ info->type_name = "Mouse";
+ return 0;
+}
+
+#endif
+
+/******************************************************************************/
+static void
+rdpmouseUnInit(InputDriverPtr drv, InputInfoPtr info, int flags)
+{
+ LLOGLN(0, ("rdpmouseUnInit: drv %p info %p, flags 0x%x",
+ drv, info, flags));
+}
+
+/******************************************************************************/
+static InputDriverRec rdpmouse =
+{
+ PACKAGE_VERSION_MAJOR, /* version */
+ XRDP_NAME, /* name */
+ NULL, /* identify */
+ rdpmousePreInit, /* preinit */
+ rdpmouseUnInit, /* uninit */
+ NULL, /* module */
+ 0 /* ref count */
+};
+
+/******************************************************************************/
+static void
+rdpmouseUnplug(pointer p)
+{
+ LLOGLN(0, ("rdpmouseUnplug:"));
+}
+
+/******************************************************************************/
+static pointer
+rdpmousePlug(pointer module, pointer options, int *errmaj, int *errmin)
+{
+ LLOGLN(0, ("rdpmousePlug:"));
+ xf86AddInputDriver(&rdpmouse, module, 0);
+ return module;
+}
+
+/******************************************************************************/
+static XF86ModuleVersionInfo rdpmouseVersionRec =
+{
+ XRDP_DRIVER_NAME,
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ PACKAGE_VERSION_MAJOR,
+ PACKAGE_VERSION_MINOR,
+ PACKAGE_VERSION_PATCHLEVEL,
+ ABI_CLASS_XINPUT,
+ ABI_XINPUT_VERSION,
+ MOD_CLASS_XINPUT,
+ { 0, 0, 0, 0 }
+};
+
+/******************************************************************************/
+XF86ModuleData xrdpmouseModuleData =
+{
+ &rdpmouseVersionRec,
+ rdpmousePlug,
+ rdpmouseUnplug
+};
diff --git a/xorg/tests/randr/trandr.c b/xorg/tests/randr/trandr.c
index 77ce2c33..4f7be527 100644
--- a/xorg/tests/randr/trandr.c
+++ b/xorg/tests/randr/trandr.c
@@ -31,17 +31,22 @@
#include <X11/extensions/Xrandr.h>
static int
-process_randr(Display *disp, Window win, int event_base, XEvent *ev)
+process_randr(Display *disp, Screen *screen, int screenNumber, Window win,
+ int event_base, XEvent *ev)
{
XRRScreenChangeNotifyEvent *rr_screen_change_notify;
switch (ev->type - event_base)
{
case RRScreenChangeNotify:
+ XRRUpdateConfiguration(ev);
rr_screen_change_notify = (XRRScreenChangeNotifyEvent *) ev;
printf("RRScreenChangeNotify: width %d height %d\n",
rr_screen_change_notify->width,
rr_screen_change_notify->height);
+ printf("DisplayWidth %d DisplayHeight %d\n",
+ DisplayWidth(disp, screenNumber),
+ DisplayHeight(disp, screenNumber));
break;
}
return 0;
@@ -119,7 +124,9 @@ main(int argc, char **argv)
case ConfigureNotify:
if (ev.xconfigure.window == root_window)
{
- printf("ConfigureNotify for root window width %d height %d\n",
+ XRRUpdateConfiguration(&ev);
+ printf("ConfigureNotify for root window "
+ "width %d height %d\n",
ev.xconfigure.width, ev.xconfigure.height);
}
break;
@@ -128,7 +135,8 @@ main(int argc, char **argv)
(ev.type < rr_event_base + RRNumberEvents))
{
printf("randr\n");
- process_randr(disp, win, rr_event_base, &ev);
+ process_randr(disp, screen, screenNumber, win,
+ rr_event_base, &ev);
}
break;
}