remove Xserver directory

ulab-original
jsorg71 15 years ago
parent 330577c754
commit 8dbdc68e74

@ -1,53 +0,0 @@
OBJS = rdpmain.o rdpdraw.o rdpinput.o rdpmisc.o rdpup.o miinitext.o
CFLAGS = -O2 -fno-strength-reduce -ansi -pedantic
CFLAGS += -I. -I../../../../exports/include/X11
CFLAGS += -I../../../../include/fonts
CFLAGS += -I../../../../exports/include/X11
CFLAGS += -I../../cfb -I../../mfb -I../../mi
CFLAGS += -I../../include -I../../os
CFLAGS += -I../../../../../include
CFLAGS += -I/usr/local/include
CFLAGS += -I../../../.././ -I../../../../exports/include
CFLAGS += -I../../../../include/extensions
CFLAGS += -I../../dbe
CFLAGS += -I../../record
CFLAGS += -I../../render
CFLAGS += -Dlinux -D__i386__
CFLAGS += -D_POSIX_C_SOURCE=199309L
CFLAGS += -D_POSIX_SOURCE -D_XOPEN_SOURCE=500L
CFLAGS += -D_BSD_SOURCE -D_SVID_SOURCE -D_REENTRANT
CFLAGS += -DSHAPE -DBIGREQS -DGLXEXT -DGLX_USE_MESA -DMITMISC -DXTEST
CFLAGS += -DPANORAMIX -DRANDR -DRENDER -DXCMISC -DXSYNC -DXRECORD
CFLAGS += -D_GNU_SOURCE -DLBX -DXAPPGROUP -DXCSECURITY -DTOGCUP
CFLAGS += -DXF86BIGFONT -DDPMSExtension -DSINGLEDEPTH -DXvExtension
CFLAGS += -DXFree86Server -DXvMCExtension -DSMART_SCHEDULE -DXResExtension
CFLAGS += -DX_BYTE_ORDER=X_LITTLE_ENDIAN -DXTRAP -DMITSHM -DDBE -DEVI
CFLAGS += -DSCREENSAVER -DXV -DXVMC -DFONTCACHE
#CFLAGS += -DXINPUT -DXKB
CFLAGS += -DGCCUSESGAS -DSTATIC_COLOR -DAVOID_GLYPHBLT -DPIXPRIV
CFLAGS += -DNDEBUG -DFUNCPROTO=15 -DNARROWPROTO -DDDXOSINIT
CFLAGS += -DSERVER_LOCK -DDDXOSFATALERROR -DPART_NET
CFLAGS += -DDDXTIME
CFLAGS += -D_HAVE_XALLOC_DECLS
#CFLAGS += -DXVNCRELEASE=\"tight1.2.9\"
all: rdp
rdp: $(OBJS)
$(AR) rvu librdp.a $(OBJS)
ranlib librdp.a
clean:
rm -f $(OBJS) librdp.a
miinitext.o: ../../mi/miinitext.c
$(CC) $(CFLAGS) -c ../../mi/miinitext.c

@ -1,98 +0,0 @@
/*
Copyright 2005-2008 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.
*/
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);
static void
rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
DDXPointPtr pptInit, int * pwidthInit, int fSorted);
static void
rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char * psrc,
DDXPointPtr ppt, int * pwidth, int nspans, int fSorted);
static void
rdpPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char * pBits);
static RegionPtr
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty);
static RegionPtr
rdpCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
GCPtr pGC, int srcx, int srcy, int width, int height,
int dstx, int dsty, unsigned long bitPlane);
static void
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit);
static void
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit);
static void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs);
static void
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
xRectangle * pRects);
static void
rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs);
static void
rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count,
DDXPointPtr pPts);
static void
rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
xRectangle * prectInit);
static void
rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs);
static int
rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char * chars);
static int
rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short * chars);
static void
rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char * chars);
static void
rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count,
unsigned short * chars);
static void
rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr * ppci, pointer pglyphBase);
static void
rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr * ppci,
pointer pglyphBase);
static void
rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y);

@ -1,414 +0,0 @@
/*
Copyright 2005-2008 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 <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include "X11/X.h"
#define NEED_EVENTS
#include "X11/Xproto.h"
#include "X11/Xos.h"
#include "scrnintstr.h"
#include "servermd.h"
#define PSZ 8
#include "cfb.h"
#include "mibstore.h"
#include "colormapst.h"
#include "gcstruct.h"
#include "input.h"
#include "mipointer.h"
#include "dixstruct.h"
#include "propertyst.h"
#include <Xatom.h>
#include <errno.h>
#include <sys/param.h>
#include "dix.h"
#include <X11/keysym.h>
#include "dixfontstr.h"
#include "osdep.h"
#include "fontstruct.h"
#include <cursorstr.h>
#include "picturestr.h"
#include <netinet/tcp.h>
/* test to see if this is xorg source or xfree86 */
#ifdef XORGSERVER
# define RDP_IS_XORG
#else
# include <xf86Version.h>
# if (XF86_VERSION_MAJOR == 4 && XF86_VERSION_MINOR > 3)
# define RDP_IS_XFREE86
# elif (XF86_VERSION_MAJOR > 4)
# define RDP_IS_XFREE86
# else
# define RDP_IS_XORG
# endif
#endif
/* Per-screen (framebuffer) structure. There is only one of these, since we
don't allow the X server to have multiple screens. */
typedef struct
{
int width;
int paddedWidthInBytes;
int height;
int depth;
int bitsPerPixel;
int sizeInBytes;
char* pfbMemory;
Pixel blackPixel;
Pixel whitePixel;
/* wrapped screen functions */
/* Random screen procedures */
CloseScreenProcPtr CloseScreen;
/* GC procedures */
CreateGCProcPtr CreateGC;
/* Window Procedures */
PaintWindowBackgroundProcPtr PaintWindowBackground;
PaintWindowBorderProcPtr PaintWindowBorder;
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground;
ScreenWakeupHandlerProcPtr WakeupHandler;
CompositeProcPtr Composite;
/* Backing store procedures */
RestoreAreasProcPtr RestoreAreas;
/*InstallColormapProcPtr InstallColormap;*/
} rdpScreenInfo;
typedef rdpScreenInfo* rdpScreenInfoPtr;
typedef struct
{
GCFuncs* funcs;
GCOps* ops;
} rdpGCRec;
typedef rdpGCRec* rdpGCPtr;
/* rdpmisc.c */
void
rdpLog(char *format, ...);
int
rdpBitsPerPixel(int depth);
void
rdpClientStateChange(CallbackListPtr* cbl, pointer myData, pointer clt);
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);
void
g_memcpy(void* d_ptr, const void* s_ptr, 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
g_tcp_bind(int sck, char* port);
int
g_tcp_listen(int sck);
/* rdpdraw.c */
Bool
rdpCloseScreen(int i, ScreenPtr pScreen);
Bool
rdpCreateGC(GCPtr pGC);
void
rdpPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what);
void
rdpPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what);
void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion);
void
rdpClearToBackground(WindowPtr pWin, int x, int y, int w, int h,
Bool generateExposures);
RegionPtr
rdpRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed);
void
rdpInstallColormap(ColormapPtr pmap);
void
rdpUninstallColormap(ColormapPtr pmap);
int
rdpListInstalledColormaps(ScreenPtr pScreen, Colormap* pmaps);
void
rdpStoreColors(ColormapPtr pmap, int ndef, xColorItem* pdefs);
Bool
rdpSaveScreen(ScreenPtr pScreen, int on);
Bool
rdpRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
Bool
rdpUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
void
rdpCursorLimits(ScreenPtr pScreen, CursorPtr pCursor,
BoxPtr pHotBox, BoxPtr pTopLeftBox);
void
rdpConstrainCursor(ScreenPtr pScreen, BoxPtr pBox);
Bool
rdpSetCursorPosition(ScreenPtr pScreen, int x, int y, Bool generateEvent);
Bool
rdpDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor);
void
rdpRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor,
Bool displayed);
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);
/* rdpkbdptr.c */
int
rdpKeybdProc(DeviceIntPtr pDevice, int onoff);
int
rdpMouseProc(DeviceIntPtr pDevice, int onoff);
Bool
rdpCursorOffScreen(ScreenPtr* ppScreen, int* x, int* y);
void
rdpCrossScreen(ScreenPtr pScreen, Bool entering);
Bool
rdpSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
Bool
rdpSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
void
rdpSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y);
void
rdpSpriteMoveCursor(ScreenPtr pScreen, int x, int y);
void
PtrAddEvent(int buttonMask, int x, int y);
void
KbdAddEvent(int down, int param1, int param2, int param3, int param4);
/* rdpup.c */
int
rdpup_init(void);
int
rdpup_check(void);
int
rdpup_begin_update(void);
int
rdpup_end_update(void);
int
rdpup_fill_rect(short x, short y, int cx, int cy);
int
rdpup_screen_blt(short x, short y, int cx, int cy, short srcx, short srcy);
int
rdpup_set_clip(short x, short y, int cx, int cy);
int
rdpup_reset_clip(void);
int
rdpup_set_fgcolor(int fgcolor);
int
rdpup_set_bgcolor(int bgcolor);
int
rdpup_set_opcode(int opcode);
int
rdpup_paint_rect(short x, short y, int cx, int cy,
char* bmpdata, int width, int height,
short srcx, short srcy);
int
rdpup_set_pen(int style, int width);
int
rdpup_draw_line(short x1, short y1, short x2, short y2);
void
rdpup_send_area(int x, int y, int w, int h);
#if defined(__sparc__) || defined(__PPC__)
#define B_ENDIAN
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#define L_ENDIAN
#elif __BYTE_ORDER == __BIG_ENDIAN
#define B_ENDIAN
#endif
/* check if we need to align data */
#if defined(__sparc__) || defined(__alpha__) || defined(__hppa__) || \
defined(__AIX__) || defined(__PPC__) || defined(__mips__) || \
defined(__ia64__)
#define NEED_ALIGN
#endif
/* parser state */
struct stream
{
char* p;
char* end;
char* data;
int size;
/* offsets of various headers */
char* iso_hdr;
char* mcs_hdr;
char* sec_hdr;
char* rdp_hdr;
char* channel_hdr;
char* next_packet;
};
/******************************************************************************/
#define s_push_layer(s, h, n) \
{ \
(s)->h = (s)->p; \
(s)->p += (n); \
}
/******************************************************************************/
#define s_pop_layer(s, h) \
{ \
(s)->p = (s)->h; \
}
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define out_uint16_le(s, v) \
{ \
*((s)->p) = (unsigned char)((v) >> 0); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 8); \
(s)->p++; \
}
#else
#define out_uint16_le(s, v) \
{ \
*((unsigned short*)((s)->p)) = (unsigned short)(v); \
(s)->p += 2; \
}
#endif
/******************************************************************************/
#define init_stream(s, v) \
{ \
if ((v) > (s)->size) \
{ \
g_free((s)->data); \
(s)->data = (char*)g_malloc((v), 0); \
(s)->size = (v); \
} \
(s)->p = (s)->data; \
(s)->end = (s)->data; \
(s)->next_packet = 0; \
}
/******************************************************************************/
#define out_uint8p(s, v, n) \
{ \
g_memcpy((s)->p, (v), (n)); \
(s)->p += (n); \
}
/******************************************************************************/
#define out_uint8a(s, v, n) \
{ \
out_uint8p((s), (v), (n)); \
}
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define out_uint32_le(s, v) \
{ \
*((s)->p) = (unsigned char)((v) >> 0); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 8); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 16); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 24); \
(s)->p++; \
}
#else
#define out_uint32_le(s, v) \
{ \
*((unsigned int*)((s)->p)) = (v); \
(s)->p += 4; \
}
#endif
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define in_uint32_le(s, v) \
{ \
(v) = (unsigned int) \
( \
(*((unsigned char*)((s)->p + 0)) << 0) | \
(*((unsigned char*)((s)->p + 1)) << 8) | \
(*((unsigned char*)((s)->p + 2)) << 16) | \
(*((unsigned char*)((s)->p + 3)) << 24) \
); \
(s)->p += 4; \
}
#else
#define in_uint32_le(s, v) \
{ \
(v) = *((unsigned int*)((s)->p)); \
(s)->p += 4; \
}
#endif
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define in_uint16_le(s, v) \
{ \
(v) = (unsigned short) \
( \
(*((unsigned char*)((s)->p + 0)) << 0) | \
(*((unsigned char*)((s)->p + 1)) << 8) \
); \
(s)->p += 2; \
}
#else
#define in_uint16_le(s, v) \
{ \
(v) = *((unsigned short*)((s)->p)); \
(s)->p += 2; \
}
#endif
/******************************************************************************/
#define s_mark_end(s) \
{ \
(s)->end = (s)->p; \
}
/******************************************************************************/
#define make_stream(s) \
{ \
(s) = (struct stream*)g_malloc(sizeof(struct stream), 1); \
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,532 +0,0 @@
/*
Copyright 2005-2008 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 file called from main.c
Sets up the functions
*/
#include "rdp.h"
rdpScreenInfo g_rdpScreen; /* the one screen */
ScreenPtr g_pScreen = 0;
int g_rdpGCIndex = -1;
int g_firstTime = 1;
/* set all these at once, use function set_bpp */
/* only allow 8 and 16 bpp for not, adding 32 later */
int g_bpp = 16;
int g_Bpp = 2;
int g_Bpp_mask = 0xffff;
static int g_redBits = 5;
static int g_greenBits = 6;
static int g_blueBits = 5;
extern int monitorResolution;
extern int defaultColorVisualClass;
extern char* display;
/*static HWEventQueueType alwaysCheckForInput[2] = { 0, 1 };
static HWEventQueueType* mieqCheckForInput[2];*/
static int g_initOutputCalled = 0;
/******************************************************************************/
/* returns error, zero is good */
static int
set_bpp(int bpp)
{
int rv;
rv = 0;
g_bpp = bpp;
if (g_bpp == 8)
{
g_Bpp = 1;
g_Bpp_mask = 0xff;
g_redBits = 3;
g_greenBits = 3;
g_blueBits = 2;
}
else if (g_bpp == 16)
{
g_Bpp = 2;
g_Bpp_mask = 0xffff;
g_redBits = 5;
g_greenBits = 6;
g_blueBits = 5;
}
else if (g_bpp == 32)
{
g_Bpp = 4;
g_Bpp_mask = 0xffffff;
g_redBits = 8;
g_greenBits = 8;
g_blueBits = 8;
}
else
{
rv = 1;
}
return rv;
}
/******************************************************************************/
/* these are in rdpkbptr.c */
static miPointerSpriteFuncRec rdpSpritePointerFuncs =
{
rdpSpriteRealizeCursor,
rdpSpriteUnrealizeCursor,
rdpSpriteSetCursor,
rdpSpriteMoveCursor,
};
/******************************************************************************/
/* these are in rdpkbptr.c */
static miPointerScreenFuncRec rdpPointerCursorFuncs =
{
rdpCursorOffScreen,
rdpCrossScreen,
miPointerWarpCursor /* don't need to set last 2 funcs
EnqueueEvent and NewEventScreen */
};
/******************************************************************************/
static void
rdpWakeupHandler(int i, pointer blockData, unsigned long err,
pointer pReadmask)
{
g_pScreen->WakeupHandler = g_rdpScreen.WakeupHandler;
g_pScreen->WakeupHandler(i, blockData, err, pReadmask);
g_pScreen->WakeupHandler = rdpWakeupHandler;
}
/******************************************************************************/
static void
rdpBlockHandler1(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
{
}
/******************************************************************************/
static void
rdpWakeupHandler1(pointer blockData, int result, pointer pReadmask)
{
rdpup_check();
}
/******************************************************************************/
/* returns boolean, true if everything is ok */
static Bool
rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
{
int dpix;
int dpiy;
int ret;
VisualPtr vis;
PictureScreenPtr ps;
g_pScreen = pScreen;
/*dpix = 75;
dpiy = 75;*/
dpix = 100;
dpiy = 100;
if (monitorResolution != 0)
{
dpix = monitorResolution;
dpiy = monitorResolution;
}
g_rdpScreen.paddedWidthInBytes = PixmapBytePad(g_rdpScreen.width,
g_rdpScreen.depth);
g_rdpScreen.bitsPerPixel = rdpBitsPerPixel(g_rdpScreen.depth);
ErrorF("screen width %d height %d depth %d bpp %d\n", g_rdpScreen.width,
g_rdpScreen.height, g_rdpScreen.depth, g_rdpScreen.bitsPerPixel);
ErrorF("dpix %d dpiy %d\n", dpix, dpiy);
if (g_rdpScreen.pfbMemory == 0)
{
g_rdpScreen.sizeInBytes =
(g_rdpScreen.paddedWidthInBytes * g_rdpScreen.height);
ErrorF("buffer size %d\n", g_rdpScreen.sizeInBytes);
g_rdpScreen.pfbMemory = (char*)Xalloc(g_rdpScreen.sizeInBytes);
memset(g_rdpScreen.pfbMemory, 0, g_rdpScreen.sizeInBytes);
}
if (g_rdpScreen.pfbMemory == 0)
{
return 0;
}
miClearVisualTypes();
if (defaultColorVisualClass == -1)
{
defaultColorVisualClass = TrueColor;
}
if (!miSetVisualTypes(g_rdpScreen.depth,
miGetDefaultVisualMask(g_rdpScreen.depth),
8, defaultColorVisualClass))
{
return 0;
}
miSetPixmapDepths();
switch (g_rdpScreen.bitsPerPixel)
{
case 8:
ret = fbScreenInit(pScreen, g_rdpScreen.pfbMemory,
g_rdpScreen.width, g_rdpScreen.height,
dpix, dpiy, g_rdpScreen.paddedWidthInBytes);
break;
case 16:
ret = fbScreenInit(pScreen, g_rdpScreen.pfbMemory,
g_rdpScreen.width, g_rdpScreen.height,
dpix, dpiy, g_rdpScreen.paddedWidthInBytes / 2);
break;
case 32:
ret = fbScreenInit(pScreen, g_rdpScreen.pfbMemory,
g_rdpScreen.width, g_rdpScreen.height,
dpix, dpiy, g_rdpScreen.paddedWidthInBytes / 4);
break;
default:
return 0;
}
if (!ret)
{
return 0;
}
miInitializeBackingStore(pScreen);
/* this is for rgb, not bgr, just doing rgb for now */
vis = g_pScreen->visuals + g_pScreen->numVisuals;
while (--vis >= pScreen->visuals)
{
if ((vis->class | DynamicClass) == DirectColor)
{
vis->offsetBlue = 0;
vis->blueMask = (1 << g_blueBits) - 1;
vis->offsetGreen = g_blueBits;
vis->greenMask = ((1 << g_greenBits) - 1) << vis->offsetGreen;
vis->offsetRed = g_blueBits + g_greenBits;
vis->redMask = ((1 << g_redBits) - 1) << vis->offsetRed;
}
}
if (g_rdpScreen.bitsPerPixel > 4)
{
fbPictureInit(pScreen, 0, 0);
}
if (!AllocateGCPrivate(pScreen, g_rdpGCIndex, sizeof(rdpGCRec)))
{
FatalError("rdpScreenInit: AllocateGCPrivate failed\n");
}
/* Random screen procedures */
g_rdpScreen.CloseScreen = pScreen->CloseScreen;
/* GC procedures */
g_rdpScreen.CreateGC = pScreen->CreateGC;
/* Window Procedures */
g_rdpScreen.PaintWindowBackground = pScreen->PaintWindowBackground;
g_rdpScreen.PaintWindowBorder = pScreen->PaintWindowBorder;
g_rdpScreen.CopyWindow = pScreen->CopyWindow;
g_rdpScreen.ClearToBackground = pScreen->ClearToBackground;
/* Backing store procedures */
g_rdpScreen.RestoreAreas = pScreen->RestoreAreas;
g_rdpScreen.WakeupHandler = pScreen->WakeupHandler;
ps = GetPictureScreenIfSet(pScreen);
if (ps)
{
g_rdpScreen.Composite = ps->Composite;
}
/* testing something here */
/*rdpScreen.InstallColormap = pScreen->InstallColormap;*/
pScreen->blackPixel = g_rdpScreen.blackPixel;
pScreen->whitePixel = g_rdpScreen.whitePixel;
/* Random screen procedures */
pScreen->CloseScreen = rdpCloseScreen;
pScreen->WakeupHandler = rdpWakeupHandler;
if (ps)
{
ps->Composite = rdpComposite;
}
pScreen->SaveScreen = rdpSaveScreen;
/* GC procedures */
pScreen->CreateGC = rdpCreateGC;
/* Window Procedures */
pScreen->PaintWindowBackground = rdpPaintWindowBackground;
pScreen->PaintWindowBorder = rdpPaintWindowBorder;
pScreen->CopyWindow = rdpCopyWindow;
pScreen->ClearToBackground = rdpClearToBackground;
/* Backing store procedures */
pScreen->RestoreAreas = rdpRestoreAreas;
/* Colormap procedures */
/*pScreen->InstallColormap = rdpInstallColormap;*/
/*pScreen->UninstallColormap = rdpUninstallColormap;*/
/*pScreen->ListInstalledColormaps = rdpListInstalledColormaps;*/
/*pScreen->StoreColors = rdpStoreColors;*/
miPointerInitialize(pScreen, &rdpSpritePointerFuncs,
&rdpPointerCursorFuncs, 1);
vis = pScreen->visuals;
while (vis->vid != pScreen->rootVisual)
{
vis++;
}
if (vis == 0)
{
rdpLog("rdpScreenInit: couldn't find root visual\n");
exit(1);
}
/*vis->offsetBlue = 0;*/
/*vis->blueMask = (1 << blueBits) - 1;*/
/*vis->offsetGreen = blueBits;*/
/*vis->greenMask = ((1 << greenBits) - 1) << vis->offsetGreen;*/
/*vis->offsetRed = vis->offsetGreen + greenBits;*/
/*vis->redMask = ((1 << redBits) - 1) << vis->offsetRed;*/
if (g_rdpScreen.bitsPerPixel == 1)
{
ret = mfbCreateDefColormap(pScreen);
}
else
{
ret = fbCreateDefColormap(pScreen);
}
if (ret)
{
ret = rdpup_init();
}
if (ret)
{
RegisterBlockAndWakeupHandlers(rdpBlockHandler1, rdpWakeupHandler1, NULL);
}
return ret;
}
/******************************************************************************/
/* this is the first function called, it can be called many times
returns the number or parameters processed
if it dosen't apply to the rdp part, return 0 */
int
ddxProcessArgument(int argc, char** argv, int i)
{
if (g_firstTime)
{
memset(&g_rdpScreen, 0, sizeof(g_rdpScreen));
g_rdpScreen.width = 800;
g_rdpScreen.height = 600;
g_rdpScreen.depth = 8;
set_bpp(8);
/*rdpScreen.whitePixel = 0xffff;*/
g_rdpScreen.blackPixel = 1;
/*rdpScreen.blackPixel = 0xffff;*/
g_firstTime = 0;
}
if (strcmp (argv[i], "-geometry") == 0)
{
if (i + 1 >= argc)
{
UseMsg();
}
if (sscanf(argv[i + 1], "%dx%d", &g_rdpScreen.width,
&g_rdpScreen.height) != 2)
{
ErrorF("Invalid geometry %s\n", argv[i + 1]);
UseMsg();
}
return 2;
}
if (strcmp (argv[i], "-depth") == 0)
{
if (i + 1 >= argc)
{
UseMsg();
}
g_rdpScreen.depth = atoi(argv[i + 1]);
if (set_bpp(g_rdpScreen.depth) != 0)
{
UseMsg();
}
return 2;
}
return 0;
}
/******************************************************************************/
void
OsVendorInit(void)
{
}
#ifdef RDP_IS_XORG
/******************************************************************************/
CARD32
GetTimeInMillis(void)
{
struct timeval tp;
X_GETTIMEOFDAY(&tp);
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
}
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
void
ddxInitGlobals(void)
{
}
#endif
/* Common pixmap formats */
static PixmapFormatRec formats[MAXFORMATS] =
{
{ 1, 1, BITMAP_SCANLINE_PAD },
{ 4, 8, BITMAP_SCANLINE_PAD },
{ 8, 8, BITMAP_SCANLINE_PAD },
{ 15, 16, BITMAP_SCANLINE_PAD },
{ 16, 16, BITMAP_SCANLINE_PAD },
{ 24, 32, BITMAP_SCANLINE_PAD },
{ 32, 32, BITMAP_SCANLINE_PAD },
};
static int numFormats = 7;
/******************************************************************************/
/* InitOutput is called every time the server resets. It should call
AddScreen for each screen (but we only ever have one), and in turn this
will call rdpScreenInit. */
void
InitOutput(ScreenInfo* screenInfo, int argc, char** argv)
{
int i;
g_initOutputCalled = 1;
/* initialize pixmap formats */
screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
screenInfo->numPixmapFormats = numFormats;
for (i = 0; i < numFormats; i++)
{
screenInfo->formats[i] = formats[i];
}
g_rdpGCIndex = AllocateGCPrivateIndex();
if (g_rdpGCIndex < 0)
{
FatalError("InitOutput: AllocateGCPrivateIndex failed\n");
}
if (!AddCallback(&ClientStateCallback, rdpClientStateChange, NULL))
{
rdpLog("InitOutput: AddCallback failed\n");
return;
}
/* initialize screen */
if (AddScreen(rdpScreenInit, argc, argv) == -1)
{
FatalError("Couldn't add screen\n");
}
}
/******************************************************************************/
void
InitInput(int argc, char** argv)
{
DeviceIntPtr p;
DeviceIntPtr k;
k = AddInputDevice(rdpKeybdProc, 1);
p = AddInputDevice(rdpMouseProc, 1);
RegisterKeyboardDevice(k);
RegisterPointerDevice(p);
miRegisterPointerDevice(screenInfo.screens[0], p);
mieqInit(k, p);
/*
mieqCheckForInput[0] = checkForInput[0];
mieqCheckForInput[1] = checkForInput[1];
SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
*/
}
/******************************************************************************/
void
ddxGiveUp(void)
{
char unixSocketName[32];
Xfree(g_rdpScreen.pfbMemory);
if (g_initOutputCalled)
{
sprintf(unixSocketName, "/tmp/.X11-unix/X%s", display);
unlink(unixSocketName);
}
}
/******************************************************************************/
Bool
LegalModifier(unsigned int key, DevicePtr pDev)
{
return 1; /* true */
}
/******************************************************************************/
void
ProcessInputEvents(void)
{
mieqProcessInputEvents();
miPointerUpdate();
}
/******************************************************************************/
/* needed for some reason? todo
needs to be rfb */
void
rfbRootPropertyChange(PropertyPtr pProp)
{
}
/******************************************************************************/
void
AbortDDX(void)
{
ddxGiveUp();
}
/******************************************************************************/
void
OsVendorFatalError(void)
{
}
/******************************************************************************/
/* print the command list parameters and exit the program */
void
ddxUseMsg(void)
{
ErrorF("\n");
ErrorF("X11rdp specific options\n");
ErrorF("-geometry WxH set framebuffer width & height\n");
ErrorF("-depth D set framebuffer depth\n");
ErrorF("\n");
exit(1);
}
/******************************************************************************/
void
OsVendorPreInit(void)
{
}

@ -1,995 +0,0 @@
/*
Copyright 2005-2008 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 "rdp.h"
/******************************************************************************/
/* print a time-stamped message to the log file (stderr). */
void
rdpLog(char *format, ...)
{
va_list args;
char buf[256];
time_t clock;
va_start(args, format);
time(&clock);
strftime(buf, 255, "%d/%m/%y %T ", localtime(&clock));
fprintf(stderr, buf);
vfprintf(stderr, format, args);
fflush(stderr);
va_end(args);
}
/******************************************************************************/
int
rdpBitsPerPixel(int depth)
{
if (depth == 1)
{
return 1;
}
else if (depth <= 8)
{
return 8;
}
else if (depth <= 16)
{
return 16;
}
else
{
return 32;
}
}
/******************************************************************************/
void
rdpClientStateChange(CallbackListPtr* cbl, pointer myData, pointer clt)
{
dispatchException &= ~DE_RESET; /* hack - force server not to reset */
}
/******************************************************************************/
int
DPMSSupported(void)
{
return 0;
}
/******************************************************************************/
int
DPSMGet(int* level)
{
return -1;
}
/******************************************************************************/
void
DPMSSet(int level)
{
}
/******************************************************************************/
void
AddOtherInputDevices(void)
{
}
/******************************************************************************/
void
OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int* status)
{
}
/******************************************************************************/
int
SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev,
int* valuators, int first_valuator, int num_valuators)
{
return BadMatch;
}
/******************************************************************************/
int
SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode)
{
return BadMatch;
}
/******************************************************************************/
int
ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev)
{
return BadMatch;
}
/******************************************************************************/
int
ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev,
void* control)
{
return BadMatch;
}
/******************************************************************************/
int
ChangePointerDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev,
unsigned char x, unsigned char y)
{
return BadMatch;
}
/******************************************************************************/
void
CloseInputDevice(DeviceIntPtr d, ClientPtr client)
{
}
/* the g_ functions from os_calls.c */
/*****************************************************************************/
int
g_tcp_recv(int sck, void* ptr, int len, int flags)
{
#if defined(_WIN32)
return recv(sck, (char*)ptr, len, flags);
#else
return recv(sck, ptr, len, flags);
#endif
}
/*****************************************************************************/
void
g_tcp_close(int sck)
{
if (sck == 0)
{
return;
}
shutdown(sck, 2);
#if defined(_WIN32)
closesocket(sck);
#else
close(sck);
#endif
}
/*****************************************************************************/
int
g_tcp_last_error_would_block(int sck)
{
#if defined(_WIN32)
return WSAGetLastError() == WSAEWOULDBLOCK;
#else
return errno == EWOULDBLOCK;
#endif
}
/*****************************************************************************/
void
g_sleep(int msecs)
{
#if defined(_WIN32)
Sleep(msecs);
#else
usleep(msecs * 1000);
#endif
}
/*****************************************************************************/
int
g_tcp_send(int sck, void* ptr, int len, int flags)
{
#if defined(_WIN32)
return send(sck, (char*)ptr, len, flags);
#else
return send(sck, ptr, len, flags);
#endif
}
/*****************************************************************************/
void*
g_malloc(int size, int zero)
{
char* rv;
rv = (char*)malloc(size);
if (zero)
{
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);
#if defined(_WIN32)
setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (char*)&i, sizeof(i));
#else
setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (void*)&i, sizeof(i));
#endif
return rv;
}
/*****************************************************************************/
void
g_memcpy(void* d_ptr, const void* s_ptr, int size)
{
memcpy(d_ptr, s_ptr, size);
}
/*****************************************************************************/
int
g_tcp_set_no_delay(int sck)
{
int i;
i = 1;
#if defined(_WIN32)
setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (char*)&i, sizeof(i));
#else
setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (void*)&i, sizeof(i));
#endif
return 0;
}
/*****************************************************************************/
int
g_tcp_set_non_blocking(int sck)
{
unsigned long i;
#if defined(_WIN32)
i = 1;
ioctlsocket(sck, FIONBIO, &i);
#else
i = fcntl(sck, F_GETFL);
i = i | O_NONBLOCK;
fcntl(sck, F_SETFL, i);
#endif
return 0;
}
/*****************************************************************************/
int
g_tcp_accept(int sck)
{
struct sockaddr_in s;
#if defined(_WIN32)
signed int i;
#else
unsigned int i;
#endif
i = sizeof(struct sockaddr_in);
memset(&s, 0, i);
return accept(sck, (struct sockaddr*)&s, &i);
}
/*****************************************************************************/
int
g_tcp_select(int sck1, int sck2)
{
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);
}
max = sck1;
if (sck2 > max)
{
max = sck2;
}
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;
}
}
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_listen(int sck)
{
return listen(sck, 2);
}
/*
stub for XpClient* functions.
*/
/*****************************************************************************/
Bool
XpClientIsBitmapClient(ClientPtr client)
{
return 1;
}
/*****************************************************************************/
Bool
XpClientIsPrintClient(ClientPtr client, FontPathElementPtr fpe)
{
return 0;
}
/*****************************************************************************/
int
PrinterOptions(int argc, char** argv, int i)
{
return i;
}
/*****************************************************************************/
void
PrinterInitOutput(ScreenInfo* pScreenInfo, int argc, char** argv)
{
}
/*****************************************************************************/
void PrinterUseMsg(void)
{
}
/*****************************************************************************/
void PrinterInitGlobals(void)
{
}
#ifdef RDP_IS_XORG
#define NEED_XF86_TYPES
#include <xf86_libc.h>
#define XF86FILE_magic 0x58464856 /* "XFHV" */
typedef struct _xf86_file_
{
INT32 fileno;
INT32 magic;
FILE* filehnd;
char* fname;
} XF86FILE_priv;
XF86FILE_priv stdhnd[3] =
{
{ 0, XF86FILE_magic, NULL, "$stdinp$" },
{ 0, XF86FILE_magic, NULL, "$stdout$" },
{ 0, XF86FILE_magic, NULL, "$stderr$" }
};
XF86FILE* xf86stdin = (XF86FILE*)&stdhnd[0];
XF86FILE* xf86stdout = (XF86FILE*)&stdhnd[1];
XF86FILE* xf86stderr = (XF86FILE*)&stdhnd[2];
double xf86HUGE_VAL;
int xf86errno;
Bool noFontCacheExtension = 1;
#define mapnum(e) case (xf86_##e): err = e; break;
/*****************************************************************************/
static int
xf86GetErrno(void)
{
int err;
switch (errno)
{
case 0:
return 0;
mapnum(EACCES);
mapnum(EAGAIN);
mapnum(EBADF);
mapnum(EEXIST);
mapnum(EFAULT);
mapnum(EINTR);
mapnum(EINVAL);
mapnum(EISDIR);
mapnum(ELOOP); /* not POSIX 1 */
mapnum(EMFILE);
mapnum(ENAMETOOLONG);
mapnum(ENFILE);
mapnum(ENOENT);
mapnum(ENOMEM);
mapnum(ENOSPC);
mapnum(ENOTDIR);
mapnum(EPIPE);
mapnum(EROFS);
mapnum(ETXTBSY); /* not POSIX 1 */
mapnum(ENOTTY);
mapnum(EBUSY);
mapnum(ENODEV);
mapnum(EIO);
default:
return xf86_UNKNOWN;
}
return (int)strerror(err);
}
/*****************************************************************************/
static void
_xf86checkhndl(XF86FILE_priv* f, const char* func)
{
if (!f || f->magic != XF86FILE_magic ||
!f->filehnd || !f->fname)
{
FatalError("libc_wrapper error: passed invalid FILE handle to %s", func);
exit(42);
}
}
/*****************************************************************************/
void
xf86WrapperInit(void)
{
if (stdhnd[0].filehnd == NULL)
{
stdhnd[0].filehnd = stdin;
}
if (stdhnd[1].filehnd == NULL)
{
stdhnd[1].filehnd = stdout;
}
if (stdhnd[2].filehnd == NULL)
{
stdhnd[2].filehnd = stderr;
}
xf86HUGE_VAL = HUGE_VAL;
}
/*****************************************************************************/
int
xf86strcmp(const char* s1, const char* s2)
{
return strcmp(s1, s2);
}
/*****************************************************************************/
char*
xf86strchr(const char* s, int c)
{
return strchr(s, c);
}
/*****************************************************************************/
double
xf86fabs(double x)
{
return fabs(x);
}
/*****************************************************************************/
double
xf86exp(double x)
{
return exp(x);
}
/*****************************************************************************/
double
xf86log(double x)
{
return log(x);
}
/*****************************************************************************/
double
xf86sin(double x)
{
return sin(x);
}
/*****************************************************************************/
double
xf86cos(double x)
{
return cos(x);
}
/*****************************************************************************/
double
xf86sqrt(double x)
{
return sqrt(x);
}
/*****************************************************************************/
double
xf86floor(double x)
{
return floor(x);
}
/*****************************************************************************/
void
xf86free(void* p)
{
xfree(p);
}
/*****************************************************************************/
int
xf86fclose(XF86FILE* f)
{
XF86FILE_priv* fp = (XF86FILE_priv*)f;
int ret;
_xf86checkhndl(fp, "xf86fclose");
/* somewhat bad check */
if (fp->fileno < 3 && fp->fname[0] == '$')
{
/* assume this is stdin/out/err, don't dispose */
ret = fclose(fp->filehnd);
}
else
{
ret = fclose(fp->filehnd);
fp->magic = 0; /* invalidate */
xfree(fp->fname);
xfree(fp);
}
return ret ? -1 : 0;
}
/*****************************************************************************/
int
xf86fflush(XF86FILE* f)
{
XF86FILE_priv* fp = (XF86FILE_priv*)f;
_xf86checkhndl(fp,"xf86fflush");
return fflush(fp->filehnd);
}
/*****************************************************************************/
int
xf86fprintf(XF86FILE* f, const char *format, ...)
{
XF86FILE_priv* fp = (XF86FILE_priv*)f;
int ret;
va_list args;
va_start(args, format);
#ifdef DEBUG
ErrorF("xf86fprintf for XF86FILE %p\n", fp);
#endif
_xf86checkhndl(fp,"xf86fprintf");
ret = vfprintf(fp->filehnd,format,args);
va_end(args);
return ret;
}
/*****************************************************************************/
char*
xf86strdup(const char* s)
{
return xstrdup(s);
}
/*****************************************************************************/
XF86FILE*
xf86fopen(const char* fn, const char* mode)
{
XF86FILE_priv* fp;
FILE* f = fopen(fn, mode);
xf86errno = xf86GetErrno();
if (!f)
{
return 0;
}
fp = (XF86FILE_priv*)xalloc(sizeof(XF86FILE_priv));
fp->magic = XF86FILE_magic;
fp->filehnd = f;
fp->fileno = fileno(f);
fp->fname = (char*)xf86strdup(fn);
#ifdef DEBUG
ErrorF("xf86fopen(%s,%s) yields FILE %p XF86FILE %p\n",
fn,mode,f,fp);
#endif
return (XF86FILE*)fp;
}
/*****************************************************************************/
int
xf86sprintf(char* s, const char* format, ...)
{
int ret;
va_list args;
va_start(args, format);
ret = vsprintf(s, format, args);
va_end(args);
return ret;
}
/*****************************************************************************/
double
xf86atof(const char* s)
{
return atof(s);
}
/*****************************************************************************/
xf86size_t
xf86strlen(const char* s)
{
return (xf86size_t)strlen(s);
}
/*****************************************************************************/
void
xf86exit(int ex)
{
ErrorF("Module called exit() function with value=%d\n", ex);
exit(ex);
}
/*****************************************************************************/
int
xf86vsprintf(char* s, const char* format, va_list ap)
{
return vsprintf(s, format, ap);
}
/*****************************************************************************/
double
xf86frexp(double x, int* exp)
{
return frexp(x, exp);
}
/*****************************************************************************/
void*
xf86memcpy(void* dest, const void* src, xf86size_t n)
{
return memcpy(dest, src, (size_t)n);
}
/*****************************************************************************/
int
xf86memcmp(const void* s1, const void* s2, xf86size_t n)
{
return memcmp(s1, s2, (size_t)n);
}
/*****************************************************************************/
int
xf86ffs(int mask)
{
int n;
if (mask == 0)
{
return 0;
}
for (n = 1; (mask & 1) == 0; n++)
{
mask >>= 1;
}
return n;
}
/*****************************************************************************/
void
xf86abort(void)
{
ErrorF("Module called abort() function\n");
abort();
}
/*****************************************************************************/
double
xf86ldexp(double x, int exp)
{
return ldexp(x, exp);
}
/*****************************************************************************/
char*
xf86getenv(const char* a)
{
/* Only allow this when the real and effective uids are the same */
if (getuid() != geteuid())
{
return NULL;
}
else
{
return getenv(a);
}
}
/*****************************************************************************/
void*
xf86memset(void* s, int c, xf86size_t n)
{
return memset(s, c, (size_t)n);
}
/*****************************************************************************/
void*
xf86malloc(xf86size_t n)
{
return (void*)xalloc((size_t)n);
}
/*****************************************************************************/
void*
xf86calloc(xf86size_t sz, xf86size_t n)
{
return (void*)xcalloc((size_t)sz, (size_t)n);
}
/*****************************************************************************/
double
xf86pow(double x, double y)
{
return pow(x, y);
}
/*****************************************************************************/
int
xf86vsnprintf(char* s, xf86size_t len, const char* format, va_list ap)
{
return vsnprintf(s, (size_t)len, format, ap);
}
/*****************************************************************************/
char*
xf86strstr(const char* s1, const char* s2)
{
return strstr(s1, s2);
}
/*****************************************************************************/
char*
xf86strncat(char* dest, const char* src, xf86size_t n)
{
return strncat(dest, src, (size_t)n);
}
/*****************************************************************************/
char*
xf86strcpy(char* dest, const char* src)
{
return strcpy(dest, src);
}
/*****************************************************************************/
char*
xf86strncpy(char* dest, const char* src, xf86size_t n)
{
return strncpy(dest, src, (size_t)n);
}
/*****************************************************************************/
int
xf86strncmp(const char* s1, const char* s2, xf86size_t n)
{
return strncmp(s1, s2, (size_t)n);
}
/*****************************************************************************/
double
xf86strtod(const char* s, char** end)
{
return strtod(s, end);
}
/*****************************************************************************/
int
xf86printf(const char* format, ...)
{
int ret;
va_list args;
va_start(args, format);
ret = printf(format, args);
va_end(args);
return ret;
}
/*****************************************************************************/
void*
xf86realloc(void* p, xf86size_t n)
{
return (void*)xrealloc(p, n);
}
/*****************************************************************************/
int
xf86atoi(const char* s)
{
return atoi(s);
}
/*****************************************************************************/
int
xf86vfprintf(XF86FILE* f, const char *format, va_list ap)
{
XF86FILE_priv* fp = (XF86FILE_priv*)f;
#ifdef DEBUG
ErrorF("xf86vfprintf for XF86FILE %p\n", fp);
#endif
_xf86checkhndl(fp,"xf86vfprintf");
return vfprintf(fp->filehnd, format, ap);
}
/*****************************************************************************/
void*
xf86bsearch(const void* key, const void* base, xf86size_t nmemb,
xf86size_t size, int (*compar)(const void*, const void*))
{
return bsearch(key, base, (size_t)nmemb, (size_t)size, compar);
}
/*****************************************************************************/
int
xf86sscanf(char* s, const char* format, ...)
{
int ret;
va_list args;
va_start(args, format);
ret = vsscanf(s,format,args);
va_end(args);
return ret;
}
/*****************************************************************************/
char*
xf86strtok(char* s1, const char* s2)
{
return strtok(s1, s2);
}
/*****************************************************************************/
void
xf86qsort(void* base, xf86size_t nmemb, xf86size_t size,
int (*comp)(const void *, const void *))
{
qsort(base, nmemb, size, comp);
}
/*****************************************************************************/
char*
xf86strcat(char* dest, const char* src)
{
return strcat(dest, src);
}
/*****************************************************************************/
xf86size_t
xf86strcspn(const char* s1, const char* s2)
{
return (xf86size_t)strcspn(s1, s2);
}
/*****************************************************************************/
int
xf86abs(int x)
{
return abs(x);
}
/*****************************************************************************/
double
xf86atan2(double x, double y)
{
return atan2(x, y);
}
/*****************************************************************************/
void*
xf86memmove(void* dest, const void* src, xf86size_t n)
{
return memmove(dest, src, (size_t)n);
}
/*****************************************************************************/
void
xf86bzero(void* s, unsigned int n)
{
memset(s, 0, n);
}
/* other, what is this? */
/*****************************************************************************/
void
FontCacheExtensionInit(INITARGS)
{
}
#endif

@ -1,841 +0,0 @@
/*
Copyright 2005-2008 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 "arch.h"*/
/*#include "parse.h"*/
/*#include "os_calls.h"*/
#define DEBUG_OUT_UP(arg)
/*#define DEBUG_OUT_UP(arg) ErrorF arg*/
static int g_listen_sck = 0;
static int g_sck = 0;
static int g_sck_closed = 0;
static int g_connected = 0;
static int g_begin = 0;
static struct stream* g_out_s = 0;
static struct stream* g_in_s = 0;
static int g_button_mask = 0;
static int g_cursor_x = 0;
static int g_cursor_y = 0;
static OsTimerPtr g_timer = 0;
static int g_scheduled = 0;
static int g_count = 0;
extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */
extern int g_Bpp_mask; /* from rdpmain.c */
extern rdpScreenInfo g_rdpScreen; /* from rdpmain.c */
extern char* display;
static void
rdpScheduleDeferredUpdate(void);
/*
0 GXclear, 0
1 GXnor, DPon
2 GXandInverted, DPna
3 GXcopyInverted, Pn
4 GXandReverse, PDna
5 GXinvert, Dn
6 GXxor, DPx
7 GXnand, DPan
8 GXand, DPa
9 GXequiv, DPxn
a GXnoop, D
b GXorInverted, DPno
c GXcopy, P
d GXorReverse, PDno
e GXor, DPo
f GXset 1
*/
static int rdp_opcodes[16] =
{
0x00, /* GXclear 0x0 0 */
0x88, /* GXand 0x1 src AND dst */
0x44, /* GXandReverse 0x2 src AND NOT dst */
0xcc, /* GXcopy 0x3 src */
0x22, /* GXandInverted 0x4 NOT src AND dst */
0xaa, /* GXnoop 0x5 dst */
0x66, /* GXxor 0x6 src XOR dst */
0xee, /* GXor 0x7 src OR dst */
0x11, /* GXnor 0x8 NOT src AND NOT dst */
0x99, /* GXequiv 0x9 NOT src XOR dst */
0x55, /* GXinvert 0xa NOT dst */
0xdd, /* GXorReverse 0xb src OR NOT dst */
0x33, /* GXcopyInverted 0xc NOT src */
0xbb, /* GXorInverted 0xd NOT src OR dst */
0x77, /* GXnand 0xe NOT src OR NOT dst */
0xff /* GXset 0xf 1 */
};
/******************************************************************************/
/* returns error */
static int
rdpup_recv(char* data, int len)
{
int rcvd;
if (g_sck_closed)
{
return 1;
}
while (len > 0)
{
rcvd = g_tcp_recv(g_sck, data, len, 0);
if (rcvd == -1)
{
if (g_tcp_last_error_would_block(g_sck))
{
g_sleep(1);
}
else
{
RemoveEnabledDevice(g_sck);
g_connected = 0;
g_tcp_close(g_sck);
g_sck = 0;
g_sck_closed = 1;
return 1;
}
}
else if (rcvd == 0)
{
RemoveEnabledDevice(g_sck);
g_connected = 0;
g_tcp_close(g_sck);
g_sck = 0;
g_sck_closed = 1;
return 1;
}
else
{
data += rcvd;
len -= rcvd;
}
}
return 0;
}
/*****************************************************************************/
/* returns error */
static int
rdpup_send(char* data, int len)
{
int sent;
DEBUG_OUT_UP(("rdpup_send - sending %d bytes\n", len));
if (g_sck_closed)
{
return 1;
}
while (len > 0)
{
sent = g_tcp_send(g_sck, data, len, 0);
if (sent == -1)
{
if (g_tcp_last_error_would_block(g_sck))
{
g_sleep(1);
}
else
{
RemoveEnabledDevice(g_sck);
g_connected = 0;
g_tcp_close(g_sck);
g_sck = 0;
g_sck_closed = 1;
return 1;
}
}
else if (sent == 0)
{
RemoveEnabledDevice(g_sck);
g_connected = 0;
g_tcp_close(g_sck);
g_sck = 0;
g_sck_closed = 1;
return 1;
}
else
{
data += sent;
len -= sent;
}
}
return 0;
}
/******************************************************************************/
static int
rdpup_send_msg(struct stream* s)
{
int len;
int rv;
rv = 1;
if (s != 0)
{
len = s->end - s->data;
if (len > s->size)
{
ErrorF("overrun error len %d count %d\n", len, g_count);
}
s_pop_layer(s, iso_hdr);
out_uint16_le(s, 1);
out_uint16_le(s, g_count);
out_uint32_le(s, len - 8);
rv = rdpup_send(s->data, len);
}
if (rv != 0)
{
ErrorF("error in rdpup_send_msg\n");
}
return rv;
}
/******************************************************************************/
static int
rdpup_recv_msg(struct stream* s)
{
int len;
int rv;
rv = 1;
if (s != 0)
{
init_stream(s, 4);
rv = rdpup_recv(s->data, 4);
if (rv == 0)
{
in_uint32_le(s, len);
if (len > 3)
{
init_stream(s, len);
rv = rdpup_recv(s->data, len - 4);
}
}
}
if (rv != 0)
{
ErrorF("error in rdpup_recv_msg\n");
}
return rv;
}
/******************************************************************************/
static int
rdpup_process_msg(struct stream* s)
{
int msg_type;
int msg;
int param1;
int param2;
int param3;
int param4;
in_uint16_le(s, msg_type);
if (msg_type == 103)
{
in_uint32_le(s, msg);
in_uint32_le(s, param1);
in_uint32_le(s, param2);
in_uint32_le(s, param3);
in_uint32_le(s, param4);
DEBUG_OUT_UP(("rdpup_process_msg - msg %d param1 %d param2 %d param3 %d \
param4 %d\n", msg, param1, param2, param3, param4));
/*ErrorF("rdpup_process_msg - msg %d param1 %d param2 %d param3 %d \
param4 %d\n", msg, param1, param2, param3, param4);*/
switch (msg)
{
case 15: /* key down */
case 16: /* key up */
KbdAddEvent(msg == 15, param1, param2, param3, param4);
break;
case 17: /* from RDP_INPUT_SYNCHRONIZE */
#if 0
/* scroll lock */
if (param1 & 1)
{
KbdAddEvent(1, 70, 0, 70, 0);
}
else
{
KbdAddEvent(0, 70, 49152, 70, 49152);
}
/* num lock */
if (param1 & 2)
{
KbdAddEvent(1, 69, 0, 69, 0);
}
else
{
KbdAddEvent(0, 69, 49152, 69, 49152);
}
/* caps lock */
if (param1 & 4)
{
KbdAddEvent(1, 58, 0, 58, 0);
}
else
{
KbdAddEvent(0, 58, 49152, 58, 49152);
}
#endif
break;
case 100:
g_cursor_x = param1;
g_cursor_y = param2;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 101:
g_button_mask = g_button_mask & (~1);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 102:
g_button_mask = g_button_mask | 1;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 103:
g_button_mask = g_button_mask & (~4);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 104:
g_button_mask = g_button_mask | 4;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 105:
g_button_mask = g_button_mask & (~2);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 106:
g_button_mask = g_button_mask | 2;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 107:
g_button_mask = g_button_mask & (~8);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 108:
g_button_mask = g_button_mask | 8;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 109:
g_button_mask = g_button_mask & (~16);
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 110:
g_button_mask = g_button_mask | 16;
PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y);
break;
case 200:
rdpup_begin_update();
rdpup_send_area((param1 >> 16) & 0xffff, param1 & 0xffff,
(param2 >> 16) & 0xffff, param2 & 0xffff);
rdpup_end_update();
break;
}
}
else
{
ErrorF("unknown message type in rdpup_process_msg\n");
}
return 0;
}
/******************************************************************************/
int
rdpup_init(void)
{
char text[256];
int i;
i = atoi(display);
if (i < 1)
{
return 0;
}
g_sprintf(text, "62%2.2d", i);
if (g_in_s == 0)
{
make_stream(g_in_s);
init_stream(g_in_s, 8192);
}
if (g_out_s == 0)
{
make_stream(g_out_s);
init_stream(g_out_s, 8192 * g_Bpp + 100);
}
if (g_listen_sck == 0)
{
g_listen_sck = g_tcp_socket();
if (g_tcp_bind(g_listen_sck, text) != 0)
{
return 0;
}
g_tcp_listen(g_listen_sck);
AddEnabledDevice(g_listen_sck);
}
return 1;
}
/******************************************************************************/
int
rdpup_check(void)
{
int sel;
sel = g_tcp_select(g_listen_sck, g_sck);
if (sel & 1)
{
if (g_sck == 0)
{
g_sck = g_tcp_accept(g_listen_sck);
if (g_sck == -1)
{
g_sck = 0;
}
else
{
g_tcp_set_non_blocking(g_sck);
g_tcp_set_no_delay(g_sck);
g_connected = 1;
g_sck_closed = 0;
AddEnabledDevice(g_sck);
}
}
else
{
ErrorF("rejecting connection\n");
g_sleep(10);
g_tcp_close(g_tcp_accept(g_listen_sck));
}
}
if (sel & 2)
{
if (rdpup_recv_msg(g_in_s) == 0)
{
rdpup_process_msg(g_in_s);
}
}
return 0;
}
/******************************************************************************/
int
rdpup_begin_update(void)
{
if (g_connected)
{
if (g_begin)
{
return 0;
}
init_stream(g_out_s, 0);
s_push_layer(g_out_s, iso_hdr, 8);
out_uint16_le(g_out_s, 1);
DEBUG_OUT_UP(("begin %d\n", g_count));
g_begin = 1;
g_count = 1;
}
return 0;
}
/******************************************************************************/
int
rdpup_end_update(void)
{
if (g_connected && g_begin)
{
rdpScheduleDeferredUpdate();
}
return 0;
}
/******************************************************************************/
int
rdpup_pre_check(int in_size)
{
if (!g_begin)
{
rdpup_begin_update();
}
if ((g_out_s->p - g_out_s->data) > (g_out_s->size - (in_size + 20)))
{
/*ErrorF("%d %d\n", in_size, g_out_s->size);*/
s_mark_end(g_out_s);
rdpup_send_msg(g_out_s);
g_count = 0;
init_stream(g_out_s, 0);
s_push_layer(g_out_s, iso_hdr, 8);
}
return 0;
}
/******************************************************************************/
int
rdpup_fill_rect(short x, short y, int cx, int cy)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_fill_rect\n"));
rdpup_pre_check(10);
out_uint16_le(g_out_s, 3);
g_count++;
out_uint16_le(g_out_s, x);
out_uint16_le(g_out_s, y);
out_uint16_le(g_out_s, cx);
out_uint16_le(g_out_s, cy);
}
return 0;
}
/******************************************************************************/
int
rdpup_screen_blt(short x, short y, int cx, int cy, short srcx, short srcy)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_screen_blt\n"));
rdpup_pre_check(14);
out_uint16_le(g_out_s, 4);
g_count++;
out_uint16_le(g_out_s, x);
out_uint16_le(g_out_s, y);
out_uint16_le(g_out_s, cx);
out_uint16_le(g_out_s, cy);
out_uint16_le(g_out_s, srcx);
out_uint16_le(g_out_s, srcy);
}
return 0;
}
/******************************************************************************/
int
rdpup_set_clip(short x, short y, int cx, int cy)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_set_clip\n"));
rdpup_pre_check(10);
out_uint16_le(g_out_s, 10);
g_count++;
out_uint16_le(g_out_s, x);
out_uint16_le(g_out_s, y);
out_uint16_le(g_out_s, cx);
out_uint16_le(g_out_s, cy);
}
return 0;
}
/******************************************************************************/
int
rdpup_reset_clip(void)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_reset_clip\n"));
rdpup_pre_check(2);
out_uint16_le(g_out_s, 11);
g_count++;
}
return 0;
}
/******************************************************************************/
int
rdpup_set_fgcolor(int fgcolor)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_set_fgcolor\n"));
rdpup_pre_check(6);
out_uint16_le(g_out_s, 12);
g_count++;
fgcolor = fgcolor & g_Bpp_mask;
out_uint32_le(g_out_s, fgcolor);
}
return 0;
}
/******************************************************************************/
int
rdpup_set_bgcolor(int bgcolor)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_set_bgcolor\n"));
rdpup_pre_check(6);
out_uint16_le(g_out_s, 13);
g_count++;
bgcolor = bgcolor & g_Bpp_mask;
out_uint32_le(g_out_s, bgcolor);
}
return 0;
}
/******************************************************************************/
int
rdpup_set_opcode(int opcode)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_set_opcode\n"));
rdpup_pre_check(4);
out_uint16_le(g_out_s, 14);
g_count++;
out_uint16_le(g_out_s, rdp_opcodes[opcode & 0xf]);
}
return 0;
}
/******************************************************************************/
int
rdpup_set_pen(int style, int width)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_set_pen\n"));
rdpup_pre_check(6);
out_uint16_le(g_out_s, 17);
g_count++;
out_uint16_le(g_out_s, style);
out_uint16_le(g_out_s, width);
}
return 0;
}
/******************************************************************************/
int
rdpup_draw_line(short x1, short y1, short x2, short y2)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_draw_line\n"));
rdpup_pre_check(10);
out_uint16_le(g_out_s, 18);
g_count++;
out_uint16_le(g_out_s, x1);
out_uint16_le(g_out_s, y1);
out_uint16_le(g_out_s, x2);
out_uint16_le(g_out_s, y2);
}
return 0;
}
/******************************************************************************/
int
rdpup_set_cursor(short x, short y, char* cur_data, char* cur_mask)
{
if (g_connected)
{
DEBUG_OUT_UP((" rdpup_set_cursor\n"));
rdpup_pre_check(6 + 32 * (32 * 3) + 32 * (32 / 8));
out_uint16_le(g_out_s, 19);
g_count++;
out_uint16_le(g_out_s, x);
out_uint16_le(g_out_s, y);
out_uint8a(g_out_s, cur_data, 32 * (32 * 3));
out_uint8a(g_out_s, cur_mask, 32 * (32 / 8));
}
return 0;
}
/******************************************************************************/
static int
get_single_color(int x, int y, int w, int h)
{
int rv;
int i;
int j;
int p;
unsigned char* i8;
unsigned short* i16;
rv = -1;
if (g_Bpp == 1)
{
for (i = 0; i < h; i++)
{
i8 = (unsigned char*)(g_rdpScreen.pfbMemory +
((y + i) * g_rdpScreen.paddedWidthInBytes) + (x * g_Bpp));
if (i == 0)
{
p = *i8;
}
for (j = 0; j < w; j++)
{
if (i8[j] != p)
{
return -1;
}
}
}
rv = p;
}
else if (g_Bpp == 2)
{
for (i = 0; i < h; i++)
{
i16 = (unsigned short*)(g_rdpScreen.pfbMemory +
((y + i) * g_rdpScreen.paddedWidthInBytes) + (x * g_Bpp));
if (i == 0)
{
p = *i16;
}
for (j = 0; j < w; j++)
{
if (i16[j] != p)
{
return -1;
}
}
}
rv = p;
}
return rv;
}
/******************************************************************************/
/* split the bitmap up into 64 x 64 pixel areas */
void
rdpup_send_area(int x, int y, int w, int h)
{
char* s;
int i;
int single_color;
int lx;
int ly;
int lh;
int lw;
if (x >= g_rdpScreen.width)
{
return;
}
if (y >= g_rdpScreen.height)
{
return;
}
if (x < 0)
{
w += x;
x = 0;
}
if (y < 0)
{
h += y;
y = 0;
}
if (w <= 0)
{
return;
}
if (h <= 0)
{
return;
}
if (x + w > g_rdpScreen.width)
{
w = g_rdpScreen.width - x;
}
if (y + h > g_rdpScreen.height)
{
h = g_rdpScreen.height - y;
}
/*ErrorF("%d\n", w * h);*/
if (g_connected && g_begin)
{
DEBUG_OUT_UP((" rdpup_send_area\n"));
ly = y;
while (ly < y + h)
{
lx = x;
while (lx < x + w)
{
lw = MIN(64, (x + w) - lx);
lh = MIN(64, (y + h) - ly);
single_color = get_single_color(lx, ly, lw, lh);
if (single_color != -1)
{
/*ErrorF("%d sending single color\n", g_count);*/
rdpup_set_fgcolor(single_color);
rdpup_fill_rect(lx, ly, lw, lh);
}
else
{
rdpup_pre_check(lw * lh * g_Bpp + 42);
out_uint16_le(g_out_s, 5);
g_count++;
out_uint16_le(g_out_s, lx);
out_uint16_le(g_out_s, ly);
out_uint16_le(g_out_s, lw);
out_uint16_le(g_out_s, lh);
out_uint32_le(g_out_s, lw * lh * g_Bpp);
for (i = 0; i < lh; i++)
{
s = (g_rdpScreen.pfbMemory +
((ly + i) * g_rdpScreen.paddedWidthInBytes) + (lx * g_Bpp));
out_uint8a(g_out_s, s, lw * g_Bpp);
}
out_uint16_le(g_out_s, lw);
out_uint16_le(g_out_s, lh);
out_uint16_le(g_out_s, 0);
out_uint16_le(g_out_s, 0);
}
lx += 64;
}
ly += 64;
}
}
}
/******************************************************************************/
static CARD32
rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg)
{
if (g_connected && g_begin)
{
DEBUG_OUT_UP(("end %d\n", g_count));
out_uint16_le(g_out_s, 2);
g_count++;
s_mark_end(g_out_s);
rdpup_send_msg(g_out_s);
}
g_count = 0;
g_begin = 0;
g_scheduled = 0;
return 0;
}
/******************************************************************************/
static void
rdpScheduleDeferredUpdate(void)
{
if (!g_scheduled)
{
g_scheduled = 1;
g_timer = TimerSet(g_timer, 0, 40, rdpDeferredUpdateCallback, 0);
}
}

@ -1,32 +0,0 @@
LDFLAGS = -L../../lib/Xau -L../../lib/Xdmcp -L../../lib/freetype2
LIBS = dbe/libdbe.a \
dix/libdix.a \
fb/libfb.a \
GL/glx/libglx.a \
GL/mesa/GLcore/libGLcore.a \
hw/rdp/librdp.a \
lbx/liblbx.a \
mfb/libmfb.a \
mi/libmi.a \
os/libos.a \
randr/librandr.a \
record/librecord.a \
render/librender.a \
Xext/libexts.a \
Xext/libext.a \
xkb/libxkb.a \
Xi/libxinput.a \
XTrap/libxtrap.a \
../../lib/lbxutil/liblbxutil.a \
../../lib/font/libXfont.a \
-lfreetype -lz -lm -lXau -lXdmcp
# dix/libxpstubs.a \
all: x11rdp
x11rdp:
make -C hw/rdp
$(CC) $(LDFLAGS) -o X11rdp $(LIBS) $(LIBS)

@ -1,18 +0,0 @@
readme for X11rdp server.
Directions for Xfree 4.5, 4.6 and Xorg 6.8.2, 6.9.0.
make sure these are installed.
gcc, make, bison, flex, g++, ncursors, libpng-dev, expat-dev,
freetype-dev
First run make World.
This is the most dificult part.
copy makefile_x11rdp to /xc/programs/Xserver
copy /hw/rdp directory to /xc/programs/Xserver
run make -f makefile_x11rdp
Jay
Loading…
Cancel
Save