summaryrefslogtreecommitdiffstats
path: root/xorg/X11R7.6
diff options
context:
space:
mode:
Diffstat (limited to 'xorg/X11R7.6')
-rwxr-xr-xxorg/X11R7.6/buildx.sh13
-rw-r--r--xorg/X11R7.6/rdp/rdpCopyArea.c926
-rw-r--r--xorg/X11R7.6/rdp/rdpCopyPlane.c314
-rw-r--r--xorg/X11R7.6/rdp/rdpFillPolygon.c326
-rw-r--r--xorg/X11R7.6/rdp/rdpFillSpans.c104
-rw-r--r--xorg/X11R7.6/rdp/rdpImageGlyphBlt.c259
-rw-r--r--xorg/X11R7.6/rdp/rdpImageText16.c261
-rw-r--r--xorg/X11R7.6/rdp/rdpImageText8.c261
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyArc.c335
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyFillArc.c335
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyFillRect.c390
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c261
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyPoint.c402
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyRectangle.c442
-rw-r--r--xorg/X11R7.6/rdp/rdpPolySegment.c324
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyText16.c267
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyText8.c267
-rw-r--r--xorg/X11R7.6/rdp/rdpPolylines.c385
-rw-r--r--xorg/X11R7.6/rdp/rdpPushPixels.c256
-rw-r--r--xorg/X11R7.6/rdp/rdpPutImage.c267
-rw-r--r--xorg/X11R7.6/rdp/rdpSetSpans.c208
-rw-r--r--xorg/X11R7.6/rdp/rdpdraw.c1847
-rw-r--r--xorg/X11R7.6/rdp/rdpinput.c1461
-rw-r--r--xorg/X11R7.6/rdp/rdpmain.c938
-rw-r--r--xorg/X11R7.6/rdp/rdpmisc.c535
-rw-r--r--xorg/X11R7.6/rdp/rdprandr.c299
-rw-r--r--xorg/X11R7.6/rdp/rdpup.c2908
27 files changed, 7603 insertions, 6988 deletions
diff --git a/xorg/X11R7.6/buildx.sh b/xorg/X11R7.6/buildx.sh
index 279f72cb..5a593f1a 100755
--- a/xorg/X11R7.6/buildx.sh
+++ b/xorg/X11R7.6/buildx.sh
@@ -1,6 +1,7 @@
#!/bin/sh
-# build.sh: a script for building X11R7.6 X server for use with xrdp #
+# buildx.sh: a script for building X11R7.6 X server for use with xrdp
+#
# Copyright 2011-2012 Jay Sorg Jay.Sorg@gmail.com
#
# Authors
@@ -26,7 +27,7 @@ download_file()
{
file=$1
- # if we already have the file, don't re-download it
+ # if we already have the file, don't download it
if [ -r downloads/$file ]; then
return 0
fi
@@ -277,10 +278,10 @@ count=0
if [ $# -lt 1 ]; then
echo ""
- echo "usage: build.sh <installation dir>"
- echo "usage: build.sh <clean>"
- echo "usage: build.sh default"
- echo "usage: build.sh <installation dir> drop - set env and run bash in rdp dir"
+ echo "usage: buildx.sh <installation dir>"
+ echo "usage: buildx.sh <clean>"
+ echo "usage: buildx.sh default"
+ echo "usage: buildx.sh <installation dir> drop - set env and run bash in rdp dir"
echo ""
exit 1
fi
diff --git a/xorg/X11R7.6/rdp/rdpCopyArea.c b/xorg/X11R7.6/rdp/rdpCopyArea.c
index 674bce13..e7657396 100644
--- a/xorg/X11R7.6/rdp/rdpCopyArea.c
+++ b/xorg/X11R7.6/rdp/rdpCopyArea.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -51,14 +51,14 @@ 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;
+ 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;
}
/******************************************************************************/
@@ -67,262 +67,282 @@ rdpCopyAreaWndToWnd(WindowPtr pSrcWnd, WindowPtr pDstWnd, GCPtr pGC,
int srcx, int srcy, int w, int h,
int dstx, int dsty)
{
- int cd;
- int lsrcx;
- int lsrcy;
- int ldstx;
- int ldsty;
- int num_clips;
- int dx;
- int dy;
- int j;
- BoxRec box;
- RegionPtr rv;
- RegionRec clip_reg;
-
- LLOGLN(10, ("rdpCopyAreaWndToWnd:"));
-
- rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstWnd->drawable),
- pGC, srcx, srcy, w, h, dstx, dsty);
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC);
- lsrcx = pSrcWnd->drawable.x + srcx;
- lsrcy = pSrcWnd->drawable.y + srcy;
- ldstx = pDstWnd->drawable.x + dstx;
- ldsty = pDstWnd->drawable.y + dsty;
- if (cd == 1)
- {
- rdpup_begin_update();
- rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
- rdpup_end_update();
- }
- else if (cd == 2)
- {
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
+ int cd;
+ int lsrcx;
+ int lsrcy;
+ int ldstx;
+ int ldsty;
+ int num_clips;
+ int dx;
+ int dy;
+ int j;
+ BoxRec box;
+ RegionPtr rv;
+ RegionRec clip_reg;
+
+ LLOGLN(10, ("rdpCopyAreaWndToWnd:"));
+
+ rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstWnd->drawable),
+ pGC, srcx, srcy, w, h, dstx, dsty);
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC);
+ lsrcx = pSrcWnd->drawable.x + srcx;
+ lsrcy = pSrcWnd->drawable.y + srcy;
+ ldstx = pDstWnd->drawable.x + dstx;
+ ldsty = pDstWnd->drawable.y + dsty;
+
+ if (cd == 1)
{
- rdpup_begin_update();
- dx = dstx - srcx;
- dy = dsty - srcy;
- if ((dy < 0) || ((dy == 0) && (dx < 0)))
- {
- for (j = 0; j < num_clips; j++)
- {
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
- }
- }
- else
- {
- for (j = num_clips - 1; j >= 0; j--)
+ rdpup_begin_update();
+ rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
+ rdpup_end_update();
+ }
+ else if (cd == 2)
+ {
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
+ rdpup_begin_update();
+ dx = dstx - srcx;
+ dy = dsty - srcy;
+
+ if ((dy < 0) || ((dy == 0) && (dx < 0)))
+ {
+ for (j = 0; j < num_clips; j++)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
+ }
+ }
+ else
+ {
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
+ }
+ }
+
+ rdpup_reset_clip();
+ rdpup_end_update();
}
- }
- rdpup_reset_clip();
- rdpup_end_update();
}
- }
- RegionUninit(&clip_reg);
- return rv;
+
+ RegionUninit(&clip_reg);
+ return rv;
}
/******************************************************************************/
static RegionPtr
rdpCopyAreaWndToPixmap(WindowPtr pSrcWnd,
- PixmapPtr pDstPixmap, rdpPixmapRec* pDstPriv,
+ PixmapPtr pDstPixmap, rdpPixmapRec *pDstPriv,
GCPtr pGC, int srcx, int srcy, int w, int h,
int dstx, int dsty)
{
- int cd;
- int lsrcx;
- int lsrcy;
- int ldstx;
- int ldsty;
- int num_clips;
- int dx;
- int dy;
- int j;
- BoxRec box;
- RegionPtr rv;
- RegionRec clip_reg;
-
- LLOGLN(10, ("rdpCopyAreaWndToPixmap:"));
-
- rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstPixmap->drawable),
- pGC, srcx, srcy, w, h, dstx, dsty);
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
- lsrcx = pSrcWnd->drawable.x + srcx;
- lsrcy = pSrcWnd->drawable.y + srcy;
- ldstx = pDstPixmap->drawable.x + dstx;
- ldsty = pDstPixmap->drawable.y + dsty;
- if (cd == 1)
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- rdpup_begin_update();
- rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
- rdpup_end_update();
- rdpup_switch_os_surface(-1);
- }
- else if (cd == 2)
- {
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
+ int cd;
+ int lsrcx;
+ int lsrcy;
+ int ldstx;
+ int ldsty;
+ int num_clips;
+ int dx;
+ int dy;
+ int j;
+ BoxRec box;
+ RegionPtr rv;
+ RegionRec clip_reg;
+
+ LLOGLN(10, ("rdpCopyAreaWndToPixmap:"));
+
+ rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstPixmap->drawable),
+ pGC, srcx, srcy, w, h, dstx, dsty);
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
+ lsrcx = pSrcWnd->drawable.x + srcx;
+ lsrcy = pSrcWnd->drawable.y + srcy;
+ ldstx = pDstPixmap->drawable.x + dstx;
+ ldsty = pDstPixmap->drawable.y + dsty;
+
+ if (cd == 1)
{
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- rdpup_begin_update();
- dx = dstx - srcx;
- dy = dsty - srcy;
- if ((dy < 0) || ((dy == 0) && (dx < 0)))
- {
- for (j = 0; j < num_clips; j++)
- {
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
- }
- }
- else
- {
- for (j = num_clips - 1; j >= 0; j--)
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ rdpup_begin_update();
+ rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
+ rdpup_end_update();
+ rdpup_switch_os_surface(-1);
+ }
+ else if (cd == 2)
+ {
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ rdpup_begin_update();
+ dx = dstx - srcx;
+ dy = dsty - srcy;
+
+ if ((dy < 0) || ((dy == 0) && (dx < 0)))
+ {
+ for (j = 0; j < num_clips; j++)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
+ }
+ }
+ else
+ {
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
+ }
+ }
+
+ rdpup_reset_clip();
+ rdpup_end_update();
+ rdpup_switch_os_surface(-1);
}
- }
- rdpup_reset_clip();
- rdpup_end_update();
- rdpup_switch_os_surface(-1);
}
- }
- RegionUninit(&clip_reg);
- return rv;
+
+ RegionUninit(&clip_reg);
+ return rv;
}
/******************************************************************************/
/* draw from an off screen pixmap to a visible window */
static RegionPtr
-rdpCopyAreaPixmapToWnd(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
+rdpCopyAreaPixmapToWnd(PixmapPtr pSrcPixmap, rdpPixmapRec *pSrcPriv,
WindowPtr pDstWnd, GCPtr pGC,
int srcx, int srcy, int w, int h,
int dstx, int dsty)
{
- int lsrcx;
- int lsrcy;
- int ldstx;
- int ldsty;
- int cd;
- int j;
- int num_clips;
- RegionPtr rv;
- RegionRec clip_reg;
- BoxRec box;
-
- LLOGLN(10, ("rdpCopyAreaPixmapToWnd:"));
-
- rv = rdpCopyAreaOrg(&(pSrcPixmap->drawable), &(pDstWnd->drawable),
- pGC, srcx, srcy, w, h, dstx, dsty);
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC);
- ldstx = pDstWnd->drawable.x + dstx;
- ldsty = pDstWnd->drawable.y + dsty;
- lsrcx = pSrcPixmap->drawable.x + srcx;
- lsrcy = pSrcPixmap->drawable.y + srcy;
- if (cd == 1)
- {
- rdpup_begin_update();
- rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
- rdpup_end_update();
- }
- else if (cd == 2)
- {
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
+ int lsrcx;
+ int lsrcy;
+ int ldstx;
+ int ldsty;
+ int cd;
+ int j;
+ int num_clips;
+ RegionPtr rv;
+ RegionRec clip_reg;
+ BoxRec box;
+
+ LLOGLN(10, ("rdpCopyAreaPixmapToWnd:"));
+
+ rv = rdpCopyAreaOrg(&(pSrcPixmap->drawable), &(pDstWnd->drawable),
+ pGC, srcx, srcy, w, h, dstx, dsty);
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC);
+ ldstx = pDstWnd->drawable.x + dstx;
+ ldsty = pDstWnd->drawable.y + dsty;
+ lsrcx = pSrcPixmap->drawable.x + srcx;
+ lsrcy = pSrcPixmap->drawable.y + srcy;
+
+ if (cd == 1)
{
- rdpup_begin_update();
- LLOGLN(10, ("rdpCopyAreaPixmapToWnd: num_clips %d", num_clips));
- for (j = 0; j < num_clips; j++)
- {
- box = REGION_RECTS(&clip_reg)[j];
- LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d", w, h));
+ rdpup_begin_update();
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
- }
- rdpup_reset_clip();
- rdpup_end_update();
+ rdpup_end_update();
}
- }
- RegionUninit(&clip_reg);
- return rv;
+ else if (cd == 2)
+ {
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
+ {
+ rdpup_begin_update();
+ LLOGLN(10, ("rdpCopyAreaPixmapToWnd: num_clips %d", num_clips));
+
+ for (j = 0; j < num_clips; j++)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d", w, h));
+ rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
+ }
+
+ rdpup_reset_clip();
+ rdpup_end_update();
+ }
+ }
+
+ RegionUninit(&clip_reg);
+ return rv;
}
/******************************************************************************/
/* draw from an off screen pixmap to an off screen pixmap */
static RegionPtr
-rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
- PixmapPtr pDstPixmap, rdpPixmapRec* pDstPriv,
+rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec *pSrcPriv,
+ PixmapPtr pDstPixmap, rdpPixmapRec *pDstPriv,
GCPtr pGC, int srcx, int srcy, int w, int h,
int dstx, int dsty)
{
- int lsrcx;
- int lsrcy;
- int ldstx;
- int ldsty;
- int cd;
- int j;
- int num_clips;
- RegionPtr rv;
- RegionRec clip_reg;
- BoxRec box;
-
- LLOGLN(10, ("rdpCopyAreaPixmapToPixmap:"));
-
- rv = rdpCopyAreaOrg(&(pSrcPixmap->drawable), &(pDstPixmap->drawable),
- pGC, srcx, srcy, w, h, dstx, dsty);
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
- LLOGLN(10, ("rdpCopyAreaPixmapToPixmap: cd %d", cd));
- ldstx = pDstPixmap->drawable.x + dstx;
- ldsty = pDstPixmap->drawable.y + dsty;
- lsrcx = pSrcPixmap->drawable.x + srcx;
- lsrcy = pSrcPixmap->drawable.y + srcy;
- if (cd == 1)
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- rdpup_begin_update();
- rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
- LLOGLN(10, ("%d %d %d %d %d %d", ldstx, ldsty, w, h, lsrcx, lsrcy));
- rdpup_end_update();
- rdpup_switch_os_surface(-1);
- }
- else if (cd == 2)
- {
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
+ int lsrcx;
+ int lsrcy;
+ int ldstx;
+ int ldsty;
+ int cd;
+ int j;
+ int num_clips;
+ RegionPtr rv;
+ RegionRec clip_reg;
+ BoxRec box;
+
+ LLOGLN(10, ("rdpCopyAreaPixmapToPixmap:"));
+
+ rv = rdpCopyAreaOrg(&(pSrcPixmap->drawable), &(pDstPixmap->drawable),
+ pGC, srcx, srcy, w, h, dstx, dsty);
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
+ LLOGLN(10, ("rdpCopyAreaPixmapToPixmap: cd %d", cd));
+ ldstx = pDstPixmap->drawable.x + dstx;
+ ldsty = pDstPixmap->drawable.y + dsty;
+ lsrcx = pSrcPixmap->drawable.x + srcx;
+ lsrcy = pSrcPixmap->drawable.y + srcy;
+
+ if (cd == 1)
{
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- rdpup_begin_update();
- LLOGLN(10, ("rdpCopyAreaPixmapToPixmap: num_clips %d", num_clips));
- for (j = 0; j < num_clips; j++)
- {
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ rdpup_begin_update();
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
LLOGLN(10, ("%d %d %d %d %d %d", ldstx, ldsty, w, h, lsrcx, lsrcy));
- }
- rdpup_reset_clip();
- rdpup_end_update();
- rdpup_switch_os_surface(-1);
+ rdpup_end_update();
+ rdpup_switch_os_surface(-1);
}
- }
- RegionUninit(&clip_reg);
- return rv;
+ else if (cd == 2)
+ {
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ rdpup_begin_update();
+ LLOGLN(10, ("rdpCopyAreaPixmapToPixmap: num_clips %d", num_clips));
+
+ for (j = 0; j < num_clips; j++)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
+ LLOGLN(10, ("%d %d %d %d %d %d", ldstx, ldsty, w, h, lsrcx, lsrcy));
+ }
+
+ rdpup_reset_clip();
+ rdpup_end_update();
+ rdpup_switch_os_surface(-1);
+ }
+ }
+
+ RegionUninit(&clip_reg);
+ return rv;
}
/******************************************************************************/
@@ -330,234 +350,268 @@ RegionPtr
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty)
{
- RegionPtr rv;
- RegionRec clip_reg;
- RegionRec box_reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int j;
- int can_do_screen_blt;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- struct image_data id;
- BoxRec box;
- BoxPtr pbox;
- PixmapPtr pSrcPixmap;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pSrcPriv;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
- WindowPtr pDstWnd;
- WindowPtr pSrcWnd;
-
- LLOGLN(10, ("rdpCopyArea:"));
-
- if (pSrc->type == DRAWABLE_WINDOW)
- {
- pSrcWnd = (WindowPtr)pSrc;
- if (pSrcWnd->viewable)
+ RegionPtr rv;
+ RegionRec clip_reg;
+ RegionRec box_reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int j;
+ int can_do_screen_blt;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ struct image_data id;
+ BoxRec box;
+ BoxPtr pbox;
+ PixmapPtr pSrcPixmap;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pSrcPriv;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+ WindowPtr pDstWnd;
+ WindowPtr pSrcWnd;
+
+ LLOGLN(10, ("rdpCopyArea:"));
+
+ if (pSrc->type == DRAWABLE_WINDOW)
{
- rdpup_check_dirty_screen(&g_screenPriv);
- if (pDst->type == DRAWABLE_WINDOW)
- {
- pDstWnd = (WindowPtr)pDst;
- if (pDstWnd->viewable)
+ rdpup_check_dirty_screen(&g_screenPriv);
+
+ if (pDst->type == DRAWABLE_WINDOW)
{
- can_do_screen_blt = pGC->alu == GXcopy;
- if (can_do_screen_blt)
- {
- return rdpCopyAreaWndToWnd(pSrcWnd, pDstWnd, pGC,
- srcx, srcy, w, h, dstx, dsty);
- }
+ pDstWnd = (WindowPtr)pDst;
+
+ if (pDstWnd->viewable)
+ {
+ can_do_screen_blt = pGC->alu == GXcopy;
+
+ if (can_do_screen_blt)
+ {
+ return rdpCopyAreaWndToWnd(pSrcWnd, pDstWnd, pGC,
+ srcx, srcy, w, h, dstx, dsty);
+ }
+ }
}
- }
- else if (pDst->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDst;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ else if (pDst->type == DRAWABLE_PIXMAP)
{
- can_do_screen_blt = pGC->alu == GXcopy;
- if (can_do_screen_blt)
- {
- rdpup_check_dirty(pDstPixmap, pDstPriv);
- return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC,
- srcx, srcy, w, h, dstx, dsty);
- }
+ pDstPixmap = (PixmapPtr)pDst;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ if (pDst->type == DRAWABLE_WINDOW)
+ {
+ pDstWnd = (WindowPtr)pDst;
+
+ if (pDstWnd->viewable)
+ {
+ can_do_screen_blt = pGC->alu == GXcopy;
+
+ if (can_do_screen_blt)
+ {
+ return rdpCopyAreaWndToWnd(pSrcWnd, pDstWnd, pGC,
+ srcx, srcy, w, h, dstx, dsty);
+ }
+ }
+ }
+ else if (pDst->type == DRAWABLE_PIXMAP)
+ {
+ pDstPixmap = (PixmapPtr)pDst;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ can_do_screen_blt = pGC->alu == GXcopy;
+
+ if (can_do_screen_blt)
+ {
+ rdpup_check_dirty(pDstPixmap, pDstPriv);
+ return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC,
+ srcx, srcy, w, h, dstx, dsty);
+ }
+ }
+ }
+ }
}
- }
- }
- }
- if (pSrc->type == DRAWABLE_PIXMAP)
- {
- pSrcPixmap = (PixmapPtr)pSrc;
- pSrcPriv = GETPIXPRIV(pSrcPixmap);
- if (XRDP_IS_OS(pSrcPriv))
- {
- if (pDst->type == DRAWABLE_WINDOW)
- {
- pDstWnd = (WindowPtr)pDst;
- if (pDstWnd->viewable)
+
+ if (pSrc->type == DRAWABLE_PIXMAP)
{
- rdpup_check_dirty_screen(&g_screenPriv);
- rdpup_check_dirty(pSrcPixmap, pSrcPriv);
- return rdpCopyAreaPixmapToWnd(pSrcPixmap, pSrcPriv, pDstWnd, pGC,
- srcx, srcy, w, h, dstx, dsty);
+ pSrcPixmap = (PixmapPtr)pSrc;
+ pSrcPriv = GETPIXPRIV(pSrcPixmap);
+
+ if (XRDP_IS_OS(pSrcPriv))
+ {
+ rdpup_check_dirty_screen(&g_screenPriv);
+ rdpup_check_dirty(pSrcPixmap, pSrcPriv);
+ return rdpCopyAreaPixmapToWnd(pSrcPixmap, pSrcPriv, pDstWnd, pGC,
+ srcx, srcy, w, h, dstx, dsty);
+ }
}
- }
- else if (pDst->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDst;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+
+ /* do original call */
+ rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDst->type == DRAWABLE_PIXMAP)
{
- if (g_can_do_pix_to_pix)
- {
- rdpup_check_dirty(pSrcPixmap, pSrcPriv);
- rdpup_check_dirty(pDstPixmap, pDstPriv);
- return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv,
- pDstPixmap, pDstPriv,
- pGC, srcx, srcy, w, h,
- dstx, dsty);
- }
+ pDstPixmap = (PixmapPtr)pDst;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpCopyArea: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
+ }
+ }
+ else
+ {
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpCopyArea: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
}
- }
- }
- }
-
- /* do original call */
- rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDst->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDst;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
- {
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpCopyArea: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
}
- }
- else
- {
- if (pDst->type == DRAWABLE_WINDOW)
+ else
{
- pDstWnd = (WindowPtr)pDst;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ if (pDst->type == DRAWABLE_WINDOW)
{
- LLOGLN(0, ("rdpCopyArea: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ pDstWnd = (WindowPtr)pDst;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpCopyArea: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
+ }
}
- else
+
+ if (!post_process)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ return rv;
}
- }
- }
- }
- if (!post_process)
- {
- return rv;
- }
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDst, pGC);
- if (cd == 1)
- {
- if (dirty_type != 0)
- {
- box.x1 = pDst->x + dstx;
- box.y1 = pDst->y + dsty;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h);
- rdpup_end_update();
- }
- }
- else if (cd == 2)
- {
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
- {
- if (dirty_type != 0)
- {
- box.x1 = pDst->x + dstx;
- box.y1 = pDst->y + dsty;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&box_reg, &box, 0);
- RegionIntersect(&clip_reg, &clip_reg, &box_reg);
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
- RegionUninit(&box_reg);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- box.x1 = pDst->x + dstx;
- box.y1 = pDst->y + dsty;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&box_reg, &box, 0);
- RegionIntersect(&clip_reg, &clip_reg, &box_reg);
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips < 10)
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDst, pGC);
+
+ if (cd == 1)
{
- for (j = num_clips - 1; j >= 0; j--)
- {
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
+ if (dirty_type != 0)
+ {
+ box.x1 = pDst->x + dstx;
+ box.y1 = pDst->y + dsty;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h);
+ rdpup_end_update();
+ }
}
- else
+ else if (cd == 2)
+ {
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ box.x1 = pDst->x + dstx;
+ box.y1 = pDst->y + dsty;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&box_reg, &box, 0);
+ RegionIntersect(&clip_reg, &clip_reg, &box_reg);
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
+ RegionUninit(&box_reg);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ box.x1 = pDst->x + dstx;
+ box.y1 = pDst->y + dsty;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&box_reg, &box, 0);
+ RegionIntersect(&clip_reg, &clip_reg, &box_reg);
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips < 10)
+ {
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+ }
+ else
+ {
+ pbox = RegionExtents(&clip_reg);
+ rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ }
+
+ RegionUninit(&box_reg);
+ rdpup_end_update();
+ }
+ }
+ }
+
+ RegionUninit(&clip_reg);
+
+ if (reset_surface)
{
- pbox = RegionExtents(&clip_reg);
- rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
+ rdpup_switch_os_surface(-1);
}
- RegionUninit(&box_reg);
- rdpup_end_update();
- }
+
+ return rv;
}
- }
- RegionUninit(&clip_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
- return rv;
-}
diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c
index 46514b42..6c871720 100644
--- a/xorg/X11R7.6/rdp/rdpCopyPlane.c
+++ b/xorg/X11R7.6/rdp/rdpCopyPlane.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -51,15 +51,15 @@ 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 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;
}
/******************************************************************************/
@@ -68,161 +68,171 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
GCPtr pGC, int srcx, int srcy, int w, int h,
int dstx, int dsty, unsigned long bitPlane)
{
- RegionPtr rv;
- RegionRec clip_reg;
- RegionRec box_reg;
- RegionRec reg1;
- RegionRec reg2;
- int cd;
- int num_clips;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- BoxPtr pbox;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpCopyPlane:"));
-
- /* do original call */
- rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
- dstx, dsty, bitPlane);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDst->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDst;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
- {
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpCopyPlane: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
- }
- }
- else
- {
- if (pDst->type == DRAWABLE_WINDOW)
+ RegionPtr rv;
+ RegionRec clip_reg;
+ RegionRec box_reg;
+ RegionRec reg1;
+ RegionRec reg2;
+ int cd;
+ int num_clips;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ BoxPtr pbox;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpCopyPlane:"));
+
+ /* do original call */
+ rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
+ dstx, dsty, bitPlane);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDst->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDst;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstPixmap = (PixmapPtr)pDst;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
{
- LLOGLN(0, ("rdpCopyPlane: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpCopyPlane: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ pDstWnd = (WindowPtr)pDst;
+
+ if (pDstWnd->viewable)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpCopyPlane: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return rv;
- }
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDst, pGC);
- if (cd == 1)
- {
- if (dirty_type != 0)
+ if (!post_process)
{
- box.x1 = pDst->x + dstx;
- box.y1 = pDst->y + dsty;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return rv;
}
- else if (got_id)
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDst, pGC);
+
+ if (cd == 1)
{
- rdpup_begin_update();
- rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h);
- rdpup_end_update();
+ if (dirty_type != 0)
+ {
+ box.x1 = pDst->x + dstx;
+ box.y1 = pDst->y + dsty;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h);
+ rdpup_end_update();
+ }
}
- }
- else if (cd == 2)
- {
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
+ else if (cd == 2)
{
- if (dirty_type != 0)
- {
- box.x1 = pDst->x + dstx;
- box.y1 = pDst->y + dsty;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&reg1, &box, 0);
- RegionInit(&reg2, NullBox, 0);
- RegionCopy(&reg2, &clip_reg);
- RegionIntersect(&reg1, &reg1, &reg2);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
- RegionUninit(&reg2);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- box.x1 = pDst->x + dstx;
- box.y1 = pDst->y + dsty;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&box_reg, &box, 0);
- RegionIntersect(&clip_reg, &clip_reg, &box_reg);
num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips < 10)
- {
- for (j = num_clips - 1; j >= 0; j--)
- {
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- }
- }
- else
+
+ if (num_clips > 0)
{
- pbox = RegionExtents(&clip_reg);
- rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
+ if (dirty_type != 0)
+ {
+ box.x1 = pDst->x + dstx;
+ box.y1 = pDst->y + dsty;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&reg1, &box, 0);
+ RegionInit(&reg2, NullBox, 0);
+ RegionCopy(&reg2, &clip_reg);
+ RegionIntersect(&reg1, &reg1, &reg2);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ RegionUninit(&reg2);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ box.x1 = pDst->x + dstx;
+ box.y1 = pDst->y + dsty;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&box_reg, &box, 0);
+ RegionIntersect(&clip_reg, &clip_reg, &box_reg);
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips < 10)
+ {
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+ }
+ else
+ {
+ pbox = RegionExtents(&clip_reg);
+ rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ }
+
+ RegionUninit(&box_reg);
+ rdpup_end_update();
+ }
}
- RegionUninit(&box_reg);
- rdpup_end_update();
- }
}
- }
- RegionUninit(&clip_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
- return rv;
+
+ RegionUninit(&clip_reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
+
+ return rv;
}
diff --git a/xorg/X11R7.6/rdp/rdpFillPolygon.c b/xorg/X11R7.6/rdp/rdpFillPolygon.c
index 5286b616..6ecba893 100644
--- a/xorg/X11R7.6/rdp/rdpFillPolygon.c
+++ b/xorg/X11R7.6/rdp/rdpFillPolygon.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -51,12 +51,12 @@ rdpFillPolygonOrg(DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count,
DDXPointPtr pPts)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->FillPolygon(pDrawable, pGC, shape, mode, count, pPts);
- GC_OP_EPILOGUE(pGC);
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->FillPolygon(pDrawable, pGC, shape, mode, count, pPts);
+ GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
@@ -65,168 +65,184 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count,
DDXPointPtr pPts)
{
- RegionRec clip_reg;
- RegionRec box_reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int maxx;
- int maxy;
- int minx;
- int miny;
- int i;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpFillPolygon:"));
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = 0;
- box.y2 = 0;
- if (count > 0)
- {
- maxx = pPts[0].x;
- maxy = pPts[0].y;
- minx = maxx;
- miny = maxy;
- for (i = 1; i < count; i++)
+ RegionRec clip_reg;
+ RegionRec box_reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int maxx;
+ int maxy;
+ int minx;
+ int miny;
+ int i;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpFillPolygon:"));
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = 0;
+ box.y2 = 0;
+
+ if (count > 0)
{
- if (pPts[i].x > maxx)
- {
- maxx = pPts[i].x;
- }
- if (pPts[i].x < minx)
- {
- minx = pPts[i].x;
- }
- if (pPts[i].y > maxy)
- {
- maxy = pPts[i].y;
- }
- if (pPts[i].y < miny)
- {
- miny = pPts[i].y;
- }
- }
- box.x1 = pDrawable->x + minx;
- box.y1 = pDrawable->y + miny;
- box.x2 = pDrawable->x + maxx + 1;
- box.y2 = pDrawable->y + maxy + 1;
- }
-
- /* do original call */
- rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
- {
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpFillPolygon: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ maxx = pPts[0].x;
+ maxy = pPts[0].y;
+ minx = maxx;
+ miny = maxy;
+
+ for (i = 1; i < count; i++)
+ {
+ if (pPts[i].x > maxx)
+ {
+ maxx = pPts[i].x;
+ }
+
+ if (pPts[i].x < minx)
+ {
+ minx = pPts[i].x;
+ }
+
+ if (pPts[i].y > maxy)
+ {
+ maxy = pPts[i].y;
+ }
+
+ if (pPts[i].y < miny)
+ {
+ miny = pPts[i].y;
+ }
+ }
+
+ box.x1 = pDrawable->x + minx;
+ box.y1 = pDrawable->y + miny;
+ box.x2 = pDrawable->x + maxx + 1;
+ box.y2 = pDrawable->y + maxy + 1;
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ /* do original call */
+ rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
{
- LLOGLN(0, ("rdpFillPolygon: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpFillPolygon: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpFillPolygon: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
-
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return;
}
- else if (got_id)
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+
+ if (cd == 1)
{
- rdpup_begin_update();
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_end_update();
+ if (dirty_type != 0)
+ {
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_end_update();
+ }
}
- }
- else if (cd == 2)
- {
- RegionInit(&box_reg, &box, 0);
- RegionIntersect(&clip_reg, &clip_reg, &box_reg);
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
+ else if (cd == 2)
{
- if (dirty_type != 0)
- {
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ RegionInit(&box_reg, &box, 0);
+ RegionIntersect(&clip_reg, &clip_reg, &box_reg);
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
}
- rdpup_end_update();
- }
+
+ RegionUninit(&box_reg);
+ }
+
+ RegionUninit(&clip_reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
}
- RegionUninit(&box_reg);
- }
- RegionUninit(&clip_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
}
diff --git a/xorg/X11R7.6/rdp/rdpFillSpans.c b/xorg/X11R7.6/rdp/rdpFillSpans.c
index 1f655d01..7e006c88 100644
--- a/xorg/X11R7.6/rdp/rdpFillSpans.c
+++ b/xorg/X11R7.6/rdp/rdpFillSpans.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -45,70 +45,56 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
static void
rdpFillSpansOrg(DrawablePtr pDrawable, GCPtr pGC, int nInit,
- DDXPointPtr pptInit, int* pwidthInit, int fSorted)
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
- GC_OP_EPILOGUE(pGC);
+ 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)
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{
- RegionRec clip_reg;
- int cd;
- int got_id;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
-
- LLOGLN(0, ("rdpFillSpans: todo"));
-
- /* do original call */
- rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
-
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+ RegionRec clip_reg;
+ int cd;
+ int got_id;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+
+ LLOGLN(0, ("rdpFillSpans: todo"));
+
+ /* do original call */
+ rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
+
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
- }
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ return;
+ }
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+
+ if (cd == 1)
+ {
+ }
+ else if (cd == 2)
+ {
+ }
+
+ RegionUninit(&clip_reg);
+ rdpup_switch_os_surface(-1);
}
- }
- if (!got_id)
- {
- return;
- }
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd == 1)
- {
- }
- else if (cd == 2)
- {
- }
- RegionUninit(&clip_reg);
- rdpup_switch_os_surface(-1);
-}
diff --git a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c
index 156066a0..af1095af 100644
--- a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c
+++ b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -49,156 +49,157 @@ extern int g_con_number; /* in rdpup.c */
void
rdpImageGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
- CharInfoPtr* ppci, pointer pglyphBase)
+ CharInfoPtr *ppci, pointer pglyphBase)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->ImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- GC_OP_EPILOGUE(pGC);
+ 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)
+ CharInfoPtr *ppci, pointer pglyphBase)
{
- RegionRec reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpImageGlyphBlt:"));
-
- if (nglyph != 0)
- {
- GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
- }
-
- /* do original call */
- rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpImageGlyphBlt:"));
+
+ if (nglyph != 0)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpImageGlyphBlt: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ /* do original call */
+ rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- LLOGLN(0, ("rdpImageGlyphBlt: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpImageGlyphBlt: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
-
- RegionInit(&reg, NullBox, 0);
- if (nglyph == 0)
- {
- cd = 0;
- }
- else
- {
- cd = rdp_get_clip(&reg, pDrawable, pGC);
- }
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return;
}
- else if (got_id)
+
+ RegionInit(&reg, NullBox, 0);
+
+ if (nglyph == 0)
{
- rdpup_begin_update();
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_end_update();
+ cd = 0;
}
- }
- else if (cd == 2)
- {
- RegionInit(&reg1, &box, 0);
- RegionIntersect(&reg, &reg, &reg1);
- num_clips = REGION_NUM_RECTS(&reg);
- if (num_clips > 0)
+ else
{
- if (dirty_type != 0)
- {
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ cd = rdp_get_clip(&reg, pDrawable, pGC);
+ }
+
+ if (cd == 1)
+ {
+ if (dirty_type != 0)
{
- box = REGION_RECTS(&reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
}
- rdpup_end_update();
- }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_end_update();
+ }
+ }
+ else if (cd == 2)
+ {
+ RegionInit(&reg1, &box, 0);
+ RegionIntersect(&reg, &reg, &reg1);
+ num_clips = REGION_NUM_RECTS(&reg);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionUninit(&reg1);
}
- RegionUninit(&reg1);
- }
- RegionUninit(&reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
- return;
+
+ RegionUninit(&reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
+
+ return;
}
diff --git a/xorg/X11R7.6/rdp/rdpImageText16.c b/xorg/X11R7.6/rdp/rdpImageText16.c
index ea2938ca..6e3b5262 100644
--- a/xorg/X11R7.6/rdp/rdpImageText16.c
+++ b/xorg/X11R7.6/rdp/rdpImageText16.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -48,156 +48,157 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
void
rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, unsigned short* chars)
+ int x, int y, int count, unsigned short *chars)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->ImageText16(pDrawable, pGC, x, y, count, chars);
- GC_OP_EPILOGUE(pGC);
+ 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)
+ int x, int y, int count, unsigned short *chars)
{
- RegionRec reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpImageText16:"));
-
- if (count != 0)
- {
- GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
- }
-
- /* do original call */
- rdpImageText16Org(pDrawable, pGC, x, y, count, chars);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpImageText16:"));
+
+ if (count != 0)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpImageText16: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ /* do original call */
+ rdpImageText16Org(pDrawable, pGC, x, y, count, chars);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- LLOGLN(0, ("rdpImageText16: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpImageText16: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
-
- RegionInit(&reg, NullBox, 0);
- if (count == 0)
- {
- cd = 0;
- }
- else
- {
- cd = rdp_get_clip(&reg, pDrawable, pGC);
- }
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return;
}
- else if (got_id)
+
+ RegionInit(&reg, NullBox, 0);
+
+ if (count == 0)
{
- rdpup_begin_update();
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_end_update();
+ cd = 0;
}
- }
- else if (cd == 2)
- {
- RegionInit(&reg1, &box, 0);
- RegionIntersect(&reg, &reg, &reg1);
- num_clips = REGION_NUM_RECTS(&reg);
- if (num_clips > 0)
+ else
{
- if (dirty_type != 0)
- {
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ cd = rdp_get_clip(&reg, pDrawable, pGC);
+ }
+
+ if (cd == 1)
+ {
+ if (dirty_type != 0)
{
- box = REGION_RECTS(&reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
}
- rdpup_end_update();
- }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_end_update();
+ }
+ }
+ else if (cd == 2)
+ {
+ RegionInit(&reg1, &box, 0);
+ RegionIntersect(&reg, &reg, &reg1);
+ num_clips = REGION_NUM_RECTS(&reg);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionUninit(&reg1);
}
- RegionUninit(&reg1);
- }
- RegionUninit(&reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
- return;
+
+ RegionUninit(&reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
+
+ return;
}
diff --git a/xorg/X11R7.6/rdp/rdpImageText8.c b/xorg/X11R7.6/rdp/rdpImageText8.c
index 2f34e12e..f97d05a9 100644
--- a/xorg/X11R7.6/rdp/rdpImageText8.c
+++ b/xorg/X11R7.6/rdp/rdpImageText8.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -48,156 +48,157 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
void
rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, char* chars)
+ int x, int y, int count, char *chars)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->ImageText8(pDrawable, pGC, x, y, count, chars);
- GC_OP_EPILOGUE(pGC);
+ 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)
+ int x, int y, int count, char *chars)
{
- RegionRec reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpImageText8:"));
-
- if (count != 0)
- {
- GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
- }
-
- /* do original call */
- rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpImageText8:"));
+
+ if (count != 0)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpImageText8: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ /* do original call */
+ rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- LLOGLN(0, ("rdpImageText8: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpImageText8: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
-
- RegionInit(&reg, NullBox, 0);
- if (count == 0)
- {
- cd = 0;
- }
- else
- {
- cd = rdp_get_clip(&reg, pDrawable, pGC);
- }
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return;
}
- else if (got_id)
+
+ RegionInit(&reg, NullBox, 0);
+
+ if (count == 0)
{
- rdpup_begin_update();
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_end_update();
+ cd = 0;
}
- }
- else if (cd == 2)
- {
- RegionInit(&reg1, &box, 0);
- RegionIntersect(&reg, &reg, &reg1);
- num_clips = REGION_NUM_RECTS(&reg);
- if (num_clips > 0)
+ else
{
- if (dirty_type != 0)
- {
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ cd = rdp_get_clip(&reg, pDrawable, pGC);
+ }
+
+ if (cd == 1)
+ {
+ if (dirty_type != 0)
{
- box = REGION_RECTS(&reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
}
- rdpup_end_update();
- }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_end_update();
+ }
+ }
+ else if (cd == 2)
+ {
+ RegionInit(&reg1, &box, 0);
+ RegionIntersect(&reg, &reg, &reg1);
+ num_clips = REGION_NUM_RECTS(&reg);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionUninit(&reg1);
}
- RegionUninit(&reg1);
- }
- RegionUninit(&reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
- return;
+
+ RegionUninit(&reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
+
+ return;
}
diff --git a/xorg/X11R7.6/rdp/rdpPolyArc.c b/xorg/X11R7.6/rdp/rdpPolyArc.c
index 5686bcd5..c23a78fb 100644
--- a/xorg/X11R7.6/rdp/rdpPolyArc.c
+++ b/xorg/X11R7.6/rdp/rdpPolyArc.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -47,181 +47,208 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
void
-rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
+rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->PolyArc(pDrawable, pGC, narcs, parcs);
- GC_OP_EPILOGUE(pGC);
+ 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)
+rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
- RegionRec clip_reg;
- RegionPtr tmpRegion;
- int cd;
- int lw;
- int extra;
- int i;
- int num_clips;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- xRectangle* rects;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolyArc:"));
-
- rects = 0;
- if (narcs > 0)
- {
- rects = (xRectangle*)g_malloc(narcs * sizeof(xRectangle), 0);
- lw = pGC->lineWidth;
- if (lw == 0)
+ RegionRec clip_reg;
+ RegionPtr tmpRegion;
+ int cd;
+ int lw;
+ int extra;
+ int i;
+ int num_clips;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ xRectangle *rects;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolyArc:"));
+
+ rects = 0;
+
+ if (narcs > 0)
{
- lw = 1;
- }
- extra = lw / 2;
- for (i = 0; i < narcs; i++)
- {
- rects[i].x = (parcs[i].x - extra) + pDrawable->x;
- rects[i].y = (parcs[i].y - extra) + pDrawable->y;
- rects[i].width = parcs[i].width + lw;
- rects[i].height = parcs[i].height + lw;
- }
- }
-
- /* do original call */
- rdpPolyArcOrg(pDrawable, pGC, narcs, parcs);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
- {
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolyArc: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
- }
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ rects = (xRectangle *)g_malloc(narcs * sizeof(xRectangle), 0);
+ lw = pGC->lineWidth;
+
+ if (lw == 0)
{
- LLOGLN(0, ("rdpPolyArc: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ lw = 1;
}
- else
+
+ extra = lw / 2;
+
+ for (i = 0; i < narcs; i++)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ rects[i].x = (parcs[i].x - extra) + pDrawable->x;
+ rects[i].y = (parcs[i].y - extra) + pDrawable->y;
+ rects[i].width = parcs[i].width + lw;
+ rects[i].height = parcs[i].height + lw;
}
- }
}
- }
- if (!post_process)
- {
- g_free(rects);
- return;
- }
-
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd == 1)
- {
- if (rects != 0)
+
+ /* do original call */
+ rdpPolyArcOrg(pDrawable, pGC, narcs, parcs);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
- num_clips = REGION_NUM_RECTS(tmpRegion);
- if (num_clips > 0)
- {
- if (dirty_type != 0)
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
{
- draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpPolyArc: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
}
- else if (got_id)
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- rdpup_begin_update();
- for (i = num_clips - 1; i >= 0; i--)
- {
- box = REGION_RECTS(tmpRegion)[i];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
- rdpup_end_update();
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
- RegionDestroy(tmpRegion);
}
- }
- else if (cd == 2)
- {
- if (rects != 0)
+
+ if (!post_process)
{
- tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
- RegionIntersect(tmpRegion, tmpRegion, &clip_reg);
- num_clips = REGION_NUM_RECTS(tmpRegion);
- if (num_clips > 0)
- {
- if (dirty_type != 0)
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolyArc: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else if (got_id)
+ }
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+
+ if (cd == 1)
+ {
+ if (rects != 0)
{
- rdpup_begin_update();
- for (i = num_clips - 1; i >= 0; i--)
- {
- box = REGION_RECTS(tmpRegion)[i];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
- rdpup_end_update();
+ tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
+ num_clips = REGION_NUM_RECTS(tmpRegion);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (i = num_clips - 1; i >= 0; i--)
+ {
+ box = REGION_RECTS(tmpRegion)[i];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionDestroy(tmpRegion);
}
- }
- RegionDestroy(tmpRegion);
}
- }
- RegionUninit(&clip_reg);
- g_free(rects);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
+ else if (cd == 2)
+ {
+ if (rects != 0)
+ {
+ tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
+ RegionIntersect(tmpRegion, tmpRegion, &clip_reg);
+ num_clips = REGION_NUM_RECTS(tmpRegion);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (i = num_clips - 1; i >= 0; i--)
+ {
+ box = REGION_RECTS(tmpRegion)[i];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionDestroy(tmpRegion);
+ }
+ }
+
+ RegionUninit(&clip_reg);
+ g_free(rects);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
}
diff --git a/xorg/X11R7.6/rdp/rdpPolyFillArc.c b/xorg/X11R7.6/rdp/rdpPolyFillArc.c
index edd30577..f3fd27ef 100644
--- a/xorg/X11R7.6/rdp/rdpPolyFillArc.c
+++ b/xorg/X11R7.6/rdp/rdpPolyFillArc.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -47,181 +47,208 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
void
-rdpPolyFillArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
+rdpPolyFillArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->PolyFillArc(pDrawable, pGC, narcs, parcs);
- GC_OP_EPILOGUE(pGC);
+ 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)
+rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
- RegionRec clip_reg;
- RegionPtr tmpRegion;
- int cd;
- int lw;
- int extra;
- int i;
- int num_clips;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- xRectangle* rects;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolyFillArc:"));
-
- rects = 0;
- if (narcs > 0)
- {
- rects = (xRectangle*)g_malloc(narcs * sizeof(xRectangle), 0);
- lw = pGC->lineWidth;
- if (lw == 0)
+ RegionRec clip_reg;
+ RegionPtr tmpRegion;
+ int cd;
+ int lw;
+ int extra;
+ int i;
+ int num_clips;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ xRectangle *rects;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolyFillArc:"));
+
+ rects = 0;
+
+ if (narcs > 0)
{
- lw = 1;
- }
- extra = lw / 2;
- for (i = 0; i < narcs; i++)
- {
- rects[i].x = (parcs[i].x - extra) + pDrawable->x;
- rects[i].y = (parcs[i].y - extra) + pDrawable->y;
- rects[i].width = parcs[i].width + lw;
- rects[i].height = parcs[i].height + lw;
- }
- }
-
- /* do original call */
- rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
- {
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolyFillArc: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
- }
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ rects = (xRectangle *)g_malloc(narcs * sizeof(xRectangle), 0);
+ lw = pGC->lineWidth;
+
+ if (lw == 0)
{
- LLOGLN(0, ("rdpPolyFillArc: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ lw = 1;
}
- else
+
+ extra = lw / 2;
+
+ for (i = 0; i < narcs; i++)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ rects[i].x = (parcs[i].x - extra) + pDrawable->x;
+ rects[i].y = (parcs[i].y - extra) + pDrawable->y;
+ rects[i].width = parcs[i].width + lw;
+ rects[i].height = parcs[i].height + lw;
}
- }
}
- }
- if (!post_process)
- {
- g_free(rects);
- return;
- }
-
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd == 1)
- {
- if (rects != 0)
+
+ /* do original call */
+ rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
- num_clips = REGION_NUM_RECTS(tmpRegion);
- if (num_clips > 0)
- {
- if (dirty_type != 0)
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
{
- draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpPolyFillArc: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLY;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
}
- else if (got_id)
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- rdpup_begin_update();
- for (i = num_clips - 1; i >= 0; i--)
- {
- box = REGION_RECTS(tmpRegion)[i];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
- rdpup_end_update();
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
- RegionDestroy(tmpRegion);
}
- }
- else if (cd == 2)
- {
- if (rects != 0)
+
+ if (!post_process)
{
- tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
- RegionIntersect(tmpRegion, tmpRegion, &clip_reg);
- num_clips = REGION_NUM_RECTS(tmpRegion);
- if (num_clips > 0)
- {
- if (dirty_type != 0)
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolyFillArc: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else if (got_id)
+ }
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+
+ if (cd == 1)
+ {
+ if (rects != 0)
{
- rdpup_begin_update();
- for (i = num_clips - 1; i >= 0; i--)
- {
- box = REGION_RECTS(tmpRegion)[i];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
- rdpup_end_update();
+ tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
+ num_clips = REGION_NUM_RECTS(tmpRegion);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (i = num_clips - 1; i >= 0; i--)
+ {
+ box = REGION_RECTS(tmpRegion)[i];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionDestroy(tmpRegion);
}
- }
- RegionDestroy(tmpRegion);
}
- }
- RegionUninit(&clip_reg);
- g_free(rects);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
+ else if (cd == 2)
+ {
+ if (rects != 0)
+ {
+ tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
+ RegionIntersect(tmpRegion, tmpRegion, &clip_reg);
+ num_clips = REGION_NUM_RECTS(tmpRegion);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (i = num_clips - 1; i >= 0; i--)
+ {
+ box = REGION_RECTS(tmpRegion)[i];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionDestroy(tmpRegion);
+ }
+ }
+
+ RegionUninit(&clip_reg);
+ g_free(rects);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
}
diff --git a/xorg/X11R7.6/rdp/rdpPolyFillRect.c b/xorg/X11R7.6/rdp/rdpPolyFillRect.c
index 5cbead6f..778c8620 100644
--- a/xorg/X11R7.6/rdp/rdpPolyFillRect.c
+++ b/xorg/X11R7.6/rdp/rdpPolyFillRect.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -48,221 +48,231 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
static void
rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
- xRectangle* prectInit)
+ xRectangle *prectInit)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
- GC_OP_EPILOGUE(pGC);
+ 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)
+ xRectangle *prectInit)
{
- int j;
- int cd;
- int num_clips;
- RegionRec clip_reg;
- RegionPtr fill_reg;
- BoxRec box;
-
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
-
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolyFillRect:"));
-
- /* make a copy of rects */
- fill_reg = RegionFromRects(nrectFill, prectInit, CT_NONE);
-
- /* do original call */
- rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
- {
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolyFillRect: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_FILL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
- }
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+ int j;
+ int cd;
+ int num_clips;
+ RegionRec clip_reg;
+ RegionPtr fill_reg;
+ BoxRec box;
+
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolyFillRect:"));
+
+ /* make a copy of rects */
+ fill_reg = RegionFromRects(nrectFill, prectInit, CT_NONE);
+
+ /* do original call */
+ rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
post_process = 1;
- if (g_do_dirty_ons)
+
+ if (g_do_dirty_os)
{
- LLOGLN(0, ("rdpPolyFillRect: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ LLOGLN(10, ("rdpPolyFillRect: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_FILL;
}
else
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
}
- }
}
- }
- if (!post_process)
- {
- RegionDestroy(fill_reg);
- return;
- }
- RegionTranslate(fill_reg, pDrawable->x, pDrawable->y);
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd == 1) /* no clip */
- {
- if (dirty_type != 0)
+ else
{
- if (pGC->fillStyle == 0 && /* solid fill */
- (pGC->alu == GXclear ||
- pGC->alu == GXset ||
- pGC->alu == GXinvert ||
- pGC->alu == GXnoop ||
- pGC->alu == GXand ||
- pGC->alu == GXcopy /*||
- pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
- {
- draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
- pGC->alu);
- }
- else
- {
- draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, RDI_IMGLL);
- }
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolyFillRect: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
+ }
}
- else if (got_id)
+
+ if (!post_process)
{
- rdpup_begin_update();
- if (pGC->fillStyle == 0 && /* solid fill */
- (pGC->alu == GXclear ||
- pGC->alu == GXset ||
- pGC->alu == GXinvert ||
- pGC->alu == GXnoop ||
- pGC->alu == GXand ||
- pGC->alu == GXcopy /*||
- pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
- {
- rdpup_set_fgcolor(pGC->fgPixel);
- rdpup_set_opcode(pGC->alu);
- for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--)
+ RegionDestroy(fill_reg);
+ return;
+ }
+
+ RegionTranslate(fill_reg, pDrawable->x, pDrawable->y);
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+
+ if (cd == 1) /* no clip */
+ {
+ if (dirty_type != 0)
{
- box = REGION_RECTS(fill_reg)[j];
- rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ if (pGC->fillStyle == 0 && /* solid fill */
+ (pGC->alu == GXclear ||
+ pGC->alu == GXset ||
+ pGC->alu == GXinvert ||
+ pGC->alu == GXnoop ||
+ pGC->alu == GXand ||
+ pGC->alu == GXcopy /*||
+ pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
+ {
+ draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
+ pGC->alu);
+ }
+ else
+ {
+ draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, RDI_IMGLL);
+ }
}
- rdpup_set_opcode(GXcopy);
- }
- else /* non solid fill */
- {
- for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--)
+ else if (got_id)
{
- box = REGION_RECTS(fill_reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
+ rdpup_begin_update();
+
+ if (pGC->fillStyle == 0 && /* solid fill */
+ (pGC->alu == GXclear ||
+ pGC->alu == GXset ||
+ pGC->alu == GXinvert ||
+ pGC->alu == GXnoop ||
+ pGC->alu == GXand ||
+ pGC->alu == GXcopy /*||
+ pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
+ {
+ rdpup_set_fgcolor(pGC->fgPixel);
+ rdpup_set_opcode(pGC->alu);
+
+ for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(fill_reg)[j];
+ rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ }
+ else /* non solid fill */
+ {
+ for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(fill_reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+ }
+
+ rdpup_end_update();
}
- }
- rdpup_end_update();
}
- }
- else if (cd == 2) /* clip */
- {
- RegionIntersect(&clip_reg, &clip_reg, fill_reg);
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
+ else if (cd == 2) /* clip */
{
- if (dirty_type != 0)
- {
- if (pGC->fillStyle == 0 && /* solid fill */
- (pGC->alu == GXclear ||
- pGC->alu == GXset ||
- pGC->alu == GXinvert ||
- pGC->alu == GXnoop ||
- pGC->alu == GXand ||
- pGC->alu == GXcopy /*||
- pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
- {
- draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
- pGC->alu);
- }
- else
+ RegionIntersect(&clip_reg, &clip_reg, fill_reg);
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
{
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, RDI_IMGLL);
- }
- }
- else if (got_id)
- {
- rdpup_begin_update();
- if (pGC->fillStyle == 0 && /* solid fill */
- (pGC->alu == GXclear ||
- pGC->alu == GXset ||
- pGC->alu == GXinvert ||
- pGC->alu == GXnoop ||
- pGC->alu == GXand ||
- pGC->alu == GXcopy /*||
+ if (dirty_type != 0)
+ {
+ if (pGC->fillStyle == 0 && /* solid fill */
+ (pGC->alu == GXclear ||
+ pGC->alu == GXset ||
+ pGC->alu == GXinvert ||
+ pGC->alu == GXnoop ||
+ pGC->alu == GXand ||
+ pGC->alu == GXcopy /*||
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
- {
- rdpup_set_fgcolor(pGC->fgPixel);
- rdpup_set_opcode(pGC->alu);
- for (j = num_clips - 1; j >= 0; j--)
- {
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- }
- rdpup_set_opcode(GXcopy);
- }
- else /* non solid fill */
- {
- for (j = num_clips - 1; j >= 0; j--)
- {
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- }
+ {
+ draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
+ pGC->alu);
+ }
+ else
+ {
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, RDI_IMGLL);
+ }
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ if (pGC->fillStyle == 0 && /* solid fill */
+ (pGC->alu == GXclear ||
+ pGC->alu == GXset ||
+ pGC->alu == GXinvert ||
+ pGC->alu == GXnoop ||
+ pGC->alu == GXand ||
+ pGC->alu == GXcopy /*||
+ pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
+ {
+ rdpup_set_fgcolor(pGC->fgPixel);
+ rdpup_set_opcode(pGC->alu);
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ }
+ else /* non solid fill */
+ {
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+ }
+
+ rdpup_end_update();
+ }
}
- rdpup_end_update();
- }
}
- }
- RegionUninit(&clip_reg);
- RegionDestroy(fill_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
+
+ RegionUninit(&clip_reg);
+ RegionDestroy(fill_reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
}
diff --git a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c
index f67f80b7..9a9aa22a 100644
--- a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c
+++ b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -49,157 +49,158 @@ extern int g_con_number; /* in rdpup.c */
void
rdpPolyGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
- CharInfoPtr* ppci, pointer pglyphBase)
+ CharInfoPtr *ppci, pointer pglyphBase)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->PolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- GC_OP_EPILOGUE(pGC);
+ 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)
+ CharInfoPtr *ppci, pointer pglyphBase)
{
- RegionRec reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolyGlyphBlt:"));
-
- if (nglyph != 0)
- {
- GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
- }
-
- /* do original call */
- rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolyGlyphBlt:"));
+
+ if (nglyph != 0)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolyGlyphBlt: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ /* do original call */
+ rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- LLOGLN(0, ("rdpPolyGlyphBlt: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolyGlyphBlt: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
-
- RegionInit(&reg, NullBox, 0);
- if (nglyph == 0)
- {
- cd = 0;
- }
- else
- {
- cd = rdp_get_clip(&reg, pDrawable, pGC);
- }
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return;
}
- else if (got_id)
+
+ RegionInit(&reg, NullBox, 0);
+
+ if (nglyph == 0)
{
- rdpup_begin_update();
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_end_update();
+ cd = 0;
}
- }
- else if (cd == 2)
- {
- RegionInit(&reg1, &box, 0);
- RegionIntersect(&reg, &reg, &reg1);
- num_clips = REGION_NUM_RECTS(&reg);
- if (num_clips > 0)
+ else
{
- if (dirty_type != 0)
- {
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ cd = rdp_get_clip(&reg, pDrawable, pGC);
+ }
+
+ if (cd == 1)
+ {
+ if (dirty_type != 0)
{
- box = REGION_RECTS(&reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
}
- rdpup_end_update();
- }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_end_update();
+ }
+ }
+ else if (cd == 2)
+ {
+ RegionInit(&reg1, &box, 0);
+ RegionIntersect(&reg, &reg, &reg1);
+ num_clips = REGION_NUM_RECTS(&reg);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionUninit(&reg1);
}
- RegionUninit(&reg1);
- }
- RegionUninit(&reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
- return;
+
+ RegionUninit(&reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
+
+ return;
}
diff --git a/xorg/X11R7.6/rdp/rdpPolyPoint.c b/xorg/X11R7.6/rdp/rdpPolyPoint.c
index 48a993a0..7ab89106 100644
--- a/xorg/X11R7.6/rdp/rdpPolyPoint.c
+++ b/xorg/X11R7.6/rdp/rdpPolyPoint.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -50,12 +50,12 @@ void
rdpPolyPointOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr in_pts)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts);
- GC_OP_EPILOGUE(pGC);
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts);
+ GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
@@ -63,219 +63,219 @@ void
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr in_pts)
{
- RegionRec clip_reg;
- RegionRec reg1;
- RegionRec reg2;
- int num_clips;
- int cd;
- int x;
- int y;
- int i;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- BoxRec total_box;
- DDXPointPtr pts;
- DDXPointRec stack_pts[32];
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolyPoint:"));
- LLOGLN(10, ("rdpPolyPoint: npt %d", npt));
-
- if (npt > 32)
- {
- pts = (DDXPointPtr)g_malloc(sizeof(DDXPointRec) * npt, 0);
- }
- else
- {
- pts = stack_pts;
- }
- for (i = 0; i < npt; i++)
- {
- pts[i].x = pDrawable->x + in_pts[i].x;
- pts[i].y = pDrawable->y + in_pts[i].y;
- if (i == 0)
+ RegionRec clip_reg;
+ RegionRec reg1;
+ RegionRec reg2;
+ int num_clips;
+ int cd;
+ int x;
+ int y;
+ int i;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ BoxRec total_box;
+ DDXPointPtr pts;
+ DDXPointRec stack_pts[32];
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolyPoint:"));
+ LLOGLN(10, ("rdpPolyPoint: npt %d", npt));
+
+ if (npt > 32)
{
- total_box.x1 = pts[0].x;
- total_box.y1 = pts[0].y;
- total_box.x2 = pts[0].x;
- total_box.y2 = pts[0].y;
+ pts = (DDXPointPtr)g_malloc(sizeof(DDXPointRec) * npt, 0);
}
else
{
- if (pts[i].x < total_box.x1)
- {
- total_box.x1 = pts[i].x;
- }
- if (pts[i].y < total_box.y1)
- {
- total_box.y1 = pts[i].y;
- }
- if (pts[i].x > total_box.x2)
- {
- total_box.x2 = pts[i].x;
- }
- if (pts[i].y > total_box.y2)
- {
- total_box.y2 = pts[i].y;
- }
- }
- /* todo, use this total_box */
- }
-
- /* do original call */
- rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
- {
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolyPoint: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ pts = stack_pts;
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ for (i = 0; i < npt; i++)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
- {
- LLOGLN(0, ("rdpPolyPoint: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
- }
- else
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolyPoint: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
-
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd == 1)
- {
- if (npt > 0)
+
+ /* do original call */
+ rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- if (dirty_type != 0)
- {
- RegionInit(&reg1, NullBox, 0);
- for (i = 0; i < npt; i++)
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
{
- box.x1 = pts[i].x;
- box.y1 = pts[i].y;
- box.x2 = box.x1 + 1;
- box.y2 = box.y1 + 1;
- RegionInit(&reg2, &box, 0);
- RegionUnion(&reg1, &reg1, &reg2);
- RegionUninit(&reg2);
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpPolyPoint: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
}
- draw_item_add_fill_region(pDirtyPriv, &reg1, pGC->fgPixel,
- pGC->alu);
- RegionUninit(&reg1);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- rdpup_set_fgcolor(pGC->fgPixel);
- for (i = 0; i < npt; i++)
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- x = pts[i].x;
- y = pts[i].y;
- rdpup_fill_rect(x, y, 1, 1);
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- rdpup_end_update();
- }
}
- }
- else if (cd == 2)
- {
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (npt > 0 && num_clips > 0)
+
+ if (!post_process)
+ {
+ return;
+ }
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+
+ if (cd == 1)
{
- if (dirty_type != 0)
- {
- RegionInit(&reg1, NullBox, 0);
- for (i = 0; i < npt; i++)
+ if (npt > 0)
{
- box.x1 = pts[i].x;
- box.y1 = pts[i].y;
- box.x2 = box.x1 + 1;
- box.y2 = box.y1 + 1;
- RegionInit(&reg2, &box, 0);
- RegionUnion(&reg1, &reg1, &reg2);
- RegionUninit(&reg2);
+ if (dirty_type != 0)
+ {
+ RegionInit(&reg1, NullBox, 0);
+
+ for (i = 0; i < npt; i++)
+ {
+ box.x1 = pts[i].x;
+ box.y1 = pts[i].y;
+ box.x2 = box.x1 + 1;
+ box.y2 = box.y1 + 1;
+ RegionInit(&reg2, &box, 0);
+ RegionUnion(&reg1, &reg1, &reg2);
+ RegionUninit(&reg2);
+ }
+
+ draw_item_add_fill_region(pDirtyPriv, &reg1, pGC->fgPixel,
+ pGC->alu);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_set_fgcolor(pGC->fgPixel);
+
+ for (i = 0; i < npt; i++)
+ {
+ x = pts[i].x;
+ y = pts[i].y;
+ rdpup_fill_rect(x, y, 1, 1);
+ }
+
+ rdpup_end_update();
+ }
}
- RegionIntersect(&reg1, &reg1, &clip_reg);
- draw_item_add_fill_region(pDirtyPriv, &reg1, pGC->fgPixel,
- pGC->alu);
- RegionUninit(&reg1);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- rdpup_set_fgcolor(pGC->fgPixel);
- for (j = num_clips - 1; j >= 0; j--)
+ }
+ else if (cd == 2)
+ {
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (npt > 0 && num_clips > 0)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- for (i = 0; i < npt; i++)
- {
- x = pts[i].x;
- y = pts[i].y;
- rdpup_fill_rect(x, y, 1, 1);
- }
+ if (dirty_type != 0)
+ {
+ RegionInit(&reg1, NullBox, 0);
+
+ for (i = 0; i < npt; i++)
+ {
+ box.x1 = pts[i].x;
+ box.y1 = pts[i].y;
+ box.x2 = box.x1 + 1;
+ box.y2 = box.y1 + 1;
+ RegionInit(&reg2, &box, 0);
+ RegionUnion(&reg1, &reg1, &reg2);
+ RegionUninit(&reg2);
+ }
+
+ RegionIntersect(&reg1, &reg1, &clip_reg);
+ draw_item_add_fill_region(pDirtyPriv, &reg1, pGC->fgPixel,
+ pGC->alu);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_set_fgcolor(pGC->fgPixel);
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+
+ for (i = 0; i < npt; i++)
+ {
+ x = pts[i].x;
+ y = pts[i].y;
+ rdpup_fill_rect(x, y, 1, 1);
+ }
+ }
+
+ rdpup_reset_clip();
+ rdpup_end_update();
+ }
}
- rdpup_reset_clip();
- rdpup_end_update();
- }
}
- }
- RegionUninit(&clip_reg);
- if (pts != stack_pts)
- {
- g_free(pts);
- }
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
+
+ RegionUninit(&clip_reg);
+
+ if (pts != stack_pts)
+ {
+ g_free(pts);
+ }
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
}
diff --git a/xorg/X11R7.6/rdp/rdpPolyRectangle.c b/xorg/X11R7.6/rdp/rdpPolyRectangle.c
index 97218821..3512bf58 100644
--- a/xorg/X11R7.6/rdp/rdpPolyRectangle.c
+++ b/xorg/X11R7.6/rdp/rdpPolyRectangle.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -48,250 +48,262 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
static void
rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
- xRectangle* rects)
+ xRectangle *rects)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->PolyRectangle(pDrawable, pGC, nrects, rects);
- GC_OP_EPILOGUE(pGC);
+ 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)
+ xRectangle *rects)
{
- RegionRec clip_reg;
- RegionPtr fill_reg;
- int num_clips;
- int cd;
- int lw;
- int i;
- int j;
- int up;
- int down;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- xRectangle* regRects;
- xRectangle* r;
- xRectangle* rect1;
- BoxRec box;
- struct image_data id;
-
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolyRectangle:"));
-
- /* make a copy of rects */
- rect1 = (xRectangle*)g_malloc(sizeof(xRectangle) * nrects, 0);
- for (i = 0; i < nrects; i++)
- {
- rect1[i] = rects[i];
- }
-
- /* do original call */
- rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec clip_reg;
+ RegionPtr fill_reg;
+ int num_clips;
+ int cd;
+ int lw;
+ int i;
+ int j;
+ int up;
+ int down;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ xRectangle *regRects;
+ xRectangle *r;
+ xRectangle *rect1;
+ BoxRec box;
+ struct image_data id;
+
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolyRectangle:"));
+
+ /* make a copy of rects */
+ rect1 = (xRectangle *)g_malloc(sizeof(xRectangle) * nrects, 0);
+
+ for (i = 0; i < nrects; i++)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolyRectangle: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ rect1[i] = rects[i];
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ /* do original call */
+ rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
- {
- LLOGLN(0, ("rdpPolyRectangle: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
- }
- else
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolyRectangle: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- g_free(rect1);
- return;
- }
-
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- regRects = 0;
- if ((cd != 0) && (nrects > 0))
- {
- regRects = (xRectangle*)g_malloc(nrects * 4 * sizeof(xRectangle), 0);
- lw = pGC->lineWidth;
- if (lw < 1)
+ else
{
- lw = 1;
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
+ }
}
- up = lw / 2;
- down = 1 + (lw - 1) / 2;
- for (i = 0; i < nrects; i++)
+
+ if (!post_process)
{
- r = regRects + i * 4;
- r->x = (rect1[i].x + pDrawable->x) - up;
- r->y = (rect1[i].y + pDrawable->y) - up;
- r->width = rect1[i].width + up + down;
- r->height = lw;
- r++;
- r->x = (rect1[i].x + pDrawable->x) - up;
- r->y = (rect1[i].y + pDrawable->y) + down;
- r->width = lw;
- r->height = MAX(rect1[i].height - (up + down), 0);
- r++;
- r->x = ((rect1[i].x + rect1[i].width) + pDrawable->x) - up;
- r->y = (rect1[i].y + pDrawable->y) + down;
- r->width = lw;
- r->height = MAX(rect1[i].height - (up + down), 0);
- r++;
- r->x = (rect1[i].x + pDrawable->x) - up;
- r->y = ((rect1[i].y + rect1[i].height) + pDrawable->y) - up;
- r->width = rect1[i].width + up + down;
- r->height = lw;
+ g_free(rect1);
+ return;
}
- }
- if (cd == 1)
- {
- if (regRects != 0)
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+ regRects = 0;
+
+ if ((cd != 0) && (nrects > 0))
{
- if (dirty_type != 0)
- {
- fill_reg = RegionFromRects(nrects * 4, regRects, CT_NONE);
- if (pGC->lineStyle == LineSolid)
- {
- draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
- pGC->alu);
- }
- else
- {
- draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type);
- }
- RegionDestroy(fill_reg);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- if (pGC->lineStyle == LineSolid)
+ regRects = (xRectangle *)g_malloc(nrects * 4 * sizeof(xRectangle), 0);
+ lw = pGC->lineWidth;
+
+ if (lw < 1)
{
- rdpup_set_fgcolor(pGC->fgPixel);
- rdpup_set_opcode(pGC->alu);
- for (i = 0; i < nrects * 4; i++)
- {
- r = regRects + i;
- rdpup_fill_rect(r->x, r->y, r->width, r->height);
- }
- rdpup_set_opcode(GXcopy);
+ lw = 1;
}
- else
+
+ up = lw / 2;
+ down = 1 + (lw - 1) / 2;
+
+ for (i = 0; i < nrects; i++)
{
- for (i = 0; i < nrects * 4; i++)
- {
- r = regRects + i;
- rdpup_send_area(&id, r->x, r->y, r->width, r->height);
- }
+ r = regRects + i * 4;
+ r->x = (rect1[i].x + pDrawable->x) - up;
+ r->y = (rect1[i].y + pDrawable->y) - up;
+ r->width = rect1[i].width + up + down;
+ r->height = lw;
+ r++;
+ r->x = (rect1[i].x + pDrawable->x) - up;
+ r->y = (rect1[i].y + pDrawable->y) + down;
+ r->width = lw;
+ r->height = MAX(rect1[i].height - (up + down), 0);
+ r++;
+ r->x = ((rect1[i].x + rect1[i].width) + pDrawable->x) - up;
+ r->y = (rect1[i].y + pDrawable->y) + down;
+ r->width = lw;
+ r->height = MAX(rect1[i].height - (up + down), 0);
+ r++;
+ r->x = (rect1[i].x + pDrawable->x) - up;
+ r->y = ((rect1[i].y + rect1[i].height) + pDrawable->y) - up;
+ r->width = rect1[i].width + up + down;
+ r->height = lw;
}
- rdpup_end_update();
- }
}
- }
- else if (cd == 2)
- {
- if (regRects != 0)
+
+ if (cd == 1)
{
- fill_reg = RegionFromRects(nrects * 4, regRects, CT_NONE);
- RegionIntersect(&clip_reg, &clip_reg, fill_reg);
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
- {
- if (dirty_type != 0)
+ if (regRects != 0)
{
- if (pGC->lineStyle == LineSolid)
- {
- draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
- pGC->alu);
- }
- else
- {
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
- }
- }
- else if (got_id)
- {
- rdpup_begin_update();
- if (pGC->lineStyle == LineSolid)
- {
- rdpup_set_fgcolor(pGC->fgPixel);
- rdpup_set_opcode(pGC->alu);
- for (j = num_clips - 1; j >= 0; j--)
+ if (dirty_type != 0)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ fill_reg = RegionFromRects(nrects * 4, regRects, CT_NONE);
+
+ if (pGC->lineStyle == LineSolid)
+ {
+ draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
+ pGC->alu);
+ }
+ else
+ {
+ draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type);
+ }
+
+ RegionDestroy(fill_reg);
}
- rdpup_set_opcode(GXcopy);
- }
- else
- {
- for (j = num_clips - 1; j >= 0; j--)
+ else if (got_id)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_begin_update();
+
+ if (pGC->lineStyle == LineSolid)
+ {
+ rdpup_set_fgcolor(pGC->fgPixel);
+ rdpup_set_opcode(pGC->alu);
+
+ for (i = 0; i < nrects * 4; i++)
+ {
+ r = regRects + i;
+ rdpup_fill_rect(r->x, r->y, r->width, r->height);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ }
+ else
+ {
+ for (i = 0; i < nrects * 4; i++)
+ {
+ r = regRects + i;
+ rdpup_send_area(&id, r->x, r->y, r->width, r->height);
+ }
+ }
+
+ rdpup_end_update();
}
- }
- rdpup_end_update();
}
- }
- RegionDestroy(fill_reg);
}
- }
- RegionUninit(&clip_reg);
- g_free(regRects);
- g_free(rect1);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
+ else if (cd == 2)
+ {
+ if (regRects != 0)
+ {
+ fill_reg = RegionFromRects(nrects * 4, regRects, CT_NONE);
+ RegionIntersect(&clip_reg, &clip_reg, fill_reg);
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ if (pGC->lineStyle == LineSolid)
+ {
+ draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
+ pGC->alu);
+ }
+ else
+ {
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
+ }
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ if (pGC->lineStyle == LineSolid)
+ {
+ rdpup_set_fgcolor(pGC->fgPixel);
+ rdpup_set_opcode(pGC->alu);
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ }
+ else
+ {
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionDestroy(fill_reg);
+ }
+ }
+
+ RegionUninit(&clip_reg);
+ g_free(regRects);
+ g_free(rect1);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
}
diff --git a/xorg/X11R7.6/rdp/rdpPolySegment.c b/xorg/X11R7.6/rdp/rdpPolySegment.c
index c5fcc756..e723095c 100644
--- a/xorg/X11R7.6/rdp/rdpPolySegment.c
+++ b/xorg/X11R7.6/rdp/rdpPolySegment.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -47,178 +47,200 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
void
-rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
+rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->PolySegment(pDrawable, pGC, nseg, pSegs);
- GC_OP_EPILOGUE(pGC);
+ 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)
+rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
- RegionRec clip_reg;
- int cd;
- int i;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- xSegment* segs;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolySegment:"));
- LLOGLN(10, (" nseg %d", nseg));
-
- segs = 0;
- if (nseg) /* get the rects */
- {
- segs = (xSegment*)g_malloc(nseg * sizeof(xSegment), 0);
- for (i = 0; i < nseg; i++)
+ RegionRec clip_reg;
+ int cd;
+ int i;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ xSegment *segs;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolySegment:"));
+ LLOGLN(10, (" nseg %d", nseg));
+
+ segs = 0;
+
+ if (nseg) /* get the rects */
{
- segs[i].x1 = pSegs[i].x1 + pDrawable->x;
- segs[i].y1 = pSegs[i].y1 + pDrawable->y;
- segs[i].x2 = pSegs[i].x2 + pDrawable->x;
- segs[i].y2 = pSegs[i].y2 + pDrawable->y;
+ segs = (xSegment *)g_malloc(nseg * sizeof(xSegment), 0);
+
+ for (i = 0; i < nseg; i++)
+ {
+ segs[i].x1 = pSegs[i].x1 + pDrawable->x;
+ segs[i].y1 = pSegs[i].y1 + pDrawable->y;
+ segs[i].x2 = pSegs[i].x2 + pDrawable->x;
+ segs[i].y2 = pSegs[i].y2 + pDrawable->y;
+ }
}
- }
-
- /* do original call */
- rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+
+ /* do original call */
+ rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolySegment: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpPolySegment: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
+ }
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+ else
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- LLOGLN(0, ("rdpPolySegment: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else
+ }
+
+ if (!post_process)
+ {
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolySegment: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- g_free(segs);
- return;
- }
-
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- LLOGLN(10, ("rdpPolySegment: cd %d", cd));
- if (cd == 1) /* no clip */
- {
- if (segs != 0)
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+ LLOGLN(10, ("rdpPolySegment: cd %d", cd));
+
+ if (cd == 1) /* no clip */
{
- if (dirty_type != 0)
- {
- RegionUninit(&clip_reg);
- RegionInit(&clip_reg, NullBox, 0);
- RegionAroundSegs(&clip_reg, segs, nseg);
- draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
- pGC->alu, pGC->lineWidth, segs, nseg, 1);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- rdpup_set_fgcolor(pGC->fgPixel);
- rdpup_set_opcode(pGC->alu);
- rdpup_set_pen(0, pGC->lineWidth);
- for (i = 0; i < nseg; i++)
+ if (segs != 0)
{
- rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
+ if (dirty_type != 0)
+ {
+ RegionUninit(&clip_reg);
+ RegionInit(&clip_reg, NullBox, 0);
+ RegionAroundSegs(&clip_reg, segs, nseg);
+ draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
+ pGC->alu, pGC->lineWidth, segs, nseg, 1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_set_fgcolor(pGC->fgPixel);
+ rdpup_set_opcode(pGC->alu);
+ rdpup_set_pen(0, pGC->lineWidth);
+
+ for (i = 0; i < nseg; i++)
+ {
+ rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ rdpup_end_update();
+ }
}
- rdpup_set_opcode(GXcopy);
- rdpup_end_update();
- }
}
- }
- else if (cd == 2) /* clip */
- {
- if (segs != 0)
+ else if (cd == 2) /* clip */
{
- if (dirty_type != 0)
- {
- draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
- pGC->alu, pGC->lineWidth, segs, nseg, 1);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- rdpup_set_fgcolor(pGC->fgPixel);
- rdpup_set_opcode(pGC->alu);
- rdpup_set_pen(0, pGC->lineWidth);
- for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
+ if (segs != 0)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- for (i = 0; i < nseg; i++)
- {
- rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
- LLOGLN(10, (" %d %d %d %d", segs[i].x1, segs[i].y1,
- segs[i].x2, segs[i].y2));
- }
+ if (dirty_type != 0)
+ {
+ draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
+ pGC->alu, pGC->lineWidth, segs, nseg, 1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_set_fgcolor(pGC->fgPixel);
+ rdpup_set_opcode(pGC->alu);
+ rdpup_set_pen(0, pGC->lineWidth);
+
+ for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+
+ for (i = 0; i < nseg; i++)
+ {
+ rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
+ LLOGLN(10, (" %d %d %d %d", segs[i].x1, segs[i].y1,
+ segs[i].x2, segs[i].y2));
+ }
+ }
+
+ rdpup_reset_clip();
+ rdpup_set_opcode(GXcopy);
+ rdpup_end_update();
+ }
}
- rdpup_reset_clip();
- rdpup_set_opcode(GXcopy);
- rdpup_end_update();
- }
}
- }
- g_free(segs);
- RegionUninit(&clip_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
+
+ g_free(segs);
+ RegionUninit(&clip_reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
}
diff --git a/xorg/X11R7.6/rdp/rdpPolyText16.c b/xorg/X11R7.6/rdp/rdpPolyText16.c
index d2182514..0ae340f7 100644
--- a/xorg/X11R7.6/rdp/rdpPolyText16.c
+++ b/xorg/X11R7.6/rdp/rdpPolyText16.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -48,158 +48,159 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
int
rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, unsigned short* chars)
+ 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 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 x, int y, int count, unsigned short *chars)
{
- RegionRec reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int j;
- int rv;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolyText16:"));
-
- if (count != 0)
- {
- GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
- }
-
- /* do original call */
- rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int j;
+ int rv;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolyText16:"));
+
+ if (count != 0)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolyText16: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ /* do original call */
+ rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- LLOGLN(0, ("rdpPolyText16: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolyText16: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return rv;
- }
-
- RegionInit(&reg, NullBox, 0);
- if (count == 0)
- {
- cd = 0;
- }
- else
- {
- cd = rdp_get_clip(&reg, pDrawable, pGC);
- }
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return rv;
}
- else if (got_id)
+
+ RegionInit(&reg, NullBox, 0);
+
+ if (count == 0)
{
- rdpup_begin_update();
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_end_update();
+ cd = 0;
}
- }
- else if (cd == 2)
- {
- RegionInit(&reg1, &box, 0);
- RegionIntersect(&reg, &reg, &reg1);
- num_clips = REGION_NUM_RECTS(&reg);
- if (num_clips > 0)
+ else
+ {
+ cd = rdp_get_clip(&reg, pDrawable, pGC);
+ }
+
+ if (cd == 1)
{
- if (dirty_type != 0)
- {
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ if (dirty_type != 0)
{
- box = REGION_RECTS(&reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
}
- rdpup_end_update();
- }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_end_update();
+ }
+ }
+ else if (cd == 2)
+ {
+ RegionInit(&reg1, &box, 0);
+ RegionIntersect(&reg, &reg, &reg1);
+ num_clips = REGION_NUM_RECTS(&reg);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionUninit(&reg1);
}
- RegionUninit(&reg1);
- }
- RegionUninit(&reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
- return rv;
+
+ RegionUninit(&reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
+
+ return rv;
}
diff --git a/xorg/X11R7.6/rdp/rdpPolyText8.c b/xorg/X11R7.6/rdp/rdpPolyText8.c
index 29fb1667..8ca7d695 100644
--- a/xorg/X11R7.6/rdp/rdpPolyText8.c
+++ b/xorg/X11R7.6/rdp/rdpPolyText8.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -48,158 +48,159 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
int
rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, char* chars)
+ 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 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 x, int y, int count, char *chars)
{
- RegionRec reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int j;
- int rv;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolyText8:"));
-
- if (count != 0)
- {
- GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
- }
-
- /* do original call */
- rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int j;
+ int rv;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolyText8:"));
+
+ if (count != 0)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolyText8: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+ /* do original call */
+ rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- LLOGLN(0, ("rdpPolyText8: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolyText8: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return rv;
- }
-
- RegionInit(&reg, NullBox, 0);
- if (count == 0)
- {
- cd = 0;
- }
- else
- {
- cd = rdp_get_clip(&reg, pDrawable, pGC);
- }
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return rv;
}
- else if (got_id)
+
+ RegionInit(&reg, NullBox, 0);
+
+ if (count == 0)
{
- rdpup_begin_update();
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_end_update();
+ cd = 0;
}
- }
- else if (cd == 2)
- {
- RegionInit(&reg1, &box, 0);
- RegionIntersect(&reg, &reg, &reg1);
- num_clips = REGION_NUM_RECTS(&reg);
- if (num_clips > 0)
+ else
+ {
+ cd = rdp_get_clip(&reg, pDrawable, pGC);
+ }
+
+ if (cd == 1)
{
- if (dirty_type != 0)
- {
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ if (dirty_type != 0)
{
- box = REGION_RECTS(&reg)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
}
- rdpup_end_update();
- }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_end_update();
+ }
+ }
+ else if (cd == 2)
+ {
+ RegionInit(&reg1, &box, 0);
+ RegionIntersect(&reg, &reg, &reg1);
+ num_clips = REGION_NUM_RECTS(&reg);
+
+ if (num_clips > 0)
+ {
+ if (dirty_type != 0)
+ {
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionUninit(&reg1);
}
- RegionUninit(&reg1);
- }
- RegionUninit(&reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
- return rv;
+
+ RegionUninit(&reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
+
+ return rv;
}
diff --git a/xorg/X11R7.6/rdp/rdpPolylines.c b/xorg/X11R7.6/rdp/rdpPolylines.c
index 96635465..977de9fd 100644
--- a/xorg/X11R7.6/rdp/rdpPolylines.c
+++ b/xorg/X11R7.6/rdp/rdpPolylines.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -50,12 +50,12 @@ static void
rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit);
- GC_OP_EPILOGUE(pGC);
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit);
+ GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
@@ -63,204 +63,225 @@ void
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit)
{
- RegionRec clip_reg;
- int num_clips;
- int cd;
- int i;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- xSegment* segs;
- int nseg;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPolylines:"));
- LLOGLN(10, (" npt %d mode %d x %d y %d", npt, mode,
- pDrawable->x, pDrawable->y));
+ RegionRec clip_reg;
+ int num_clips;
+ int cd;
+ int i;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ xSegment *segs;
+ int nseg;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPolylines:"));
+ LLOGLN(10, (" npt %d mode %d x %d y %d", npt, mode,
+ pDrawable->x, pDrawable->y));
#if 0
- LLOGLN(0, (" points"));
- for (i = 0; i < npt; i++)
- {
- LLOGLN(0, (" %d %d", pptInit[i].x, pptInit[i].y));
- }
+ LLOGLN(0, (" points"));
+
+ for (i = 0; i < npt; i++)
+ {
+ LLOGLN(0, (" %d %d", pptInit[i].x, pptInit[i].y));
+ }
+
#endif
- /* convert lines to line segments */
- nseg = npt - 1;
- segs = 0;
- if (npt > 1)
- {
- segs = (xSegment*)g_malloc(sizeof(xSegment) * nseg, 0);
- segs[0].x1 = pptInit[0].x + pDrawable->x;
- segs[0].y1 = pptInit[0].y + pDrawable->y;
- if (mode == CoordModeOrigin)
+ /* convert lines to line segments */
+ nseg = npt - 1;
+ segs = 0;
+
+ if (npt > 1)
{
- segs[0].x2 = pptInit[1].x + pDrawable->x;
- segs[0].y2 = pptInit[1].y + pDrawable->y;
- for (i = 2; i < npt; i++)
- {
- segs[i - 1].x1 = segs[i - 2].x2;
- segs[i - 1].y1 = segs[i - 2].y2;
- segs[i - 1].x2 = pptInit[i].x + pDrawable->x;
- segs[i - 1].y2 = pptInit[i].y + pDrawable->y;
- }
+ segs = (xSegment *)g_malloc(sizeof(xSegment) * nseg, 0);
+ segs[0].x1 = pptInit[0].x + pDrawable->x;
+ segs[0].y1 = pptInit[0].y + pDrawable->y;
+
+ if (mode == CoordModeOrigin)
+ {
+ segs[0].x2 = pptInit[1].x + pDrawable->x;
+ segs[0].y2 = pptInit[1].y + pDrawable->y;
+
+ for (i = 2; i < npt; i++)
+ {
+ segs[i - 1].x1 = segs[i - 2].x2;
+ segs[i - 1].y1 = segs[i - 2].y2;
+ segs[i - 1].x2 = pptInit[i].x + pDrawable->x;
+ segs[i - 1].y2 = pptInit[i].y + pDrawable->y;
+ }
+ }
+ else
+ {
+ segs[0].x2 = segs[0].x1 + pptInit[1].x;
+ segs[0].y2 = segs[0].y1 + pptInit[1].y;
+
+ for (i = 2; i < npt; i++)
+ {
+ segs[i - 1].x1 = segs[i - 2].x2;
+ segs[i - 1].y1 = segs[i - 2].y2;
+ segs[i - 1].x2 = segs[i - 1].x1 + pptInit[i].x;
+ segs[i - 1].y2 = segs[i - 1].y1 + pptInit[i].y;
+ }
+ }
}
else
{
- segs[0].x2 = segs[0].x1 + pptInit[1].x;
- segs[0].y2 = segs[0].y1 + pptInit[1].y;
- for (i = 2; i < npt; i++)
- {
- segs[i - 1].x1 = segs[i - 2].x2;
- segs[i - 1].y1 = segs[i - 2].y2;
- segs[i - 1].x2 = segs[i - 1].x1 + pptInit[i].x;
- segs[i - 1].y2 = segs[i - 1].y1 + pptInit[i].y;
- }
+ LLOGLN(0, ("rdpPolylines: weird npt [%d]", npt));
}
- }
- else
- {
- LLOGLN(0, ("rdpPolylines: weird npt [%d]", npt));
- }
+
#if 0
- LLOGLN(0, (" segments"));
- for (i = 0; i < nseg; i++)
- {
- LLOGLN(0, (" %d %d %d %d", segs[i].x1, segs[i].y1,
- segs[i].x2, segs[i].y2));
- }
-#endif
+ LLOGLN(0, (" segments"));
- /* do original call */
- rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ for (i = 0; i < nseg; i++)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPolylines: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLL;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ LLOGLN(0, (" %d %d %d %d", segs[i].x1, segs[i].y1,
+ segs[i].x2, segs[i].y2));
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
+
+#endif
+
+ /* do original call */
+ rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
{
- LLOGLN(0, ("rdpPolylines: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpPolylines: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPolylines: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- g_free(segs);
- return;
- }
-
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd == 1)
- {
- if (segs != 0)
+
+ if (!post_process)
+ {
+ g_free(segs);
+ return;
+ }
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+
+ if (cd == 1)
{
- if (dirty_type != 0)
- {
- RegionUninit(&clip_reg);
- RegionInit(&clip_reg, NullBox, 0);
- RegionAroundSegs(&clip_reg, segs, nseg);
- draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
- pGC->alu, pGC->lineWidth, segs, nseg, 0);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- rdpup_set_fgcolor(pGC->fgPixel);
- rdpup_set_opcode(pGC->alu);
- rdpup_set_pen(0, pGC->lineWidth);
- for (i = 0; i < nseg; i++)
+ if (segs != 0)
{
- rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
+ if (dirty_type != 0)
+ {
+ RegionUninit(&clip_reg);
+ RegionInit(&clip_reg, NullBox, 0);
+ RegionAroundSegs(&clip_reg, segs, nseg);
+ draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
+ pGC->alu, pGC->lineWidth, segs, nseg, 0);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_set_fgcolor(pGC->fgPixel);
+ rdpup_set_opcode(pGC->alu);
+ rdpup_set_pen(0, pGC->lineWidth);
+
+ for (i = 0; i < nseg; i++)
+ {
+ rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ rdpup_end_update();
+ }
}
- rdpup_set_opcode(GXcopy);
- rdpup_end_update();
- }
}
- }
- else if (cd == 2)
- {
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (nseg != 0 && num_clips > 0)
+ else if (cd == 2)
{
- if (dirty_type != 0)
- {
- draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
- pGC->alu, pGC->lineWidth, segs, nseg, 0);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- rdpup_set_fgcolor(pGC->fgPixel);
- rdpup_set_opcode(pGC->alu);
- rdpup_set_pen(0, pGC->lineWidth);
- for (j = num_clips - 1; j >= 0; j--)
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (nseg != 0 && num_clips > 0)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- for (i = 0; i < nseg; i++)
- {
- rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
- }
+ if (dirty_type != 0)
+ {
+ draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
+ pGC->alu, pGC->lineWidth, segs, nseg, 0);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_set_fgcolor(pGC->fgPixel);
+ rdpup_set_opcode(pGC->alu);
+ rdpup_set_pen(0, pGC->lineWidth);
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+
+ for (i = 0; i < nseg; i++)
+ {
+ rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
+ }
+ }
+
+ rdpup_reset_clip();
+ rdpup_set_opcode(GXcopy);
+ rdpup_end_update();
+ }
}
- rdpup_reset_clip();
- rdpup_set_opcode(GXcopy);
- rdpup_end_update();
- }
}
- }
- g_free(segs);
- RegionUninit(&clip_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
+
+ g_free(segs);
+ RegionUninit(&clip_reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
}
diff --git a/xorg/X11R7.6/rdp/rdpPushPixels.c b/xorg/X11R7.6/rdp/rdpPushPixels.c
index 2df01b8e..be55d25a 100644
--- a/xorg/X11R7.6/rdp/rdpPushPixels.c
+++ b/xorg/X11R7.6/rdp/rdpPushPixels.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -50,12 +50,12 @@ void
rdpPushPixelsOrg(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->PushPixels(pGC, pBitMap, pDst, w, h, x, y);
- GC_OP_EPILOGUE(pGC);
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PushPixels(pGC, pBitMap, pDst, w, h, x, y);
+ GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
@@ -63,139 +63,143 @@ void
rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y)
{
- RegionRec clip_reg;
- RegionRec box_reg;
- RegionRec reg1;
- int num_clips;
- int cd;
- int j;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- BoxRec box;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(10, ("rdpPushPixels:"));
-
- /* do original call */
- rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDst->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDst;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec clip_reg;
+ RegionRec box_reg;
+ RegionRec reg1;
+ int num_clips;
+ int cd;
+ int j;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ BoxRec box;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(10, ("rdpPushPixels:"));
+
+ /* do original call */
+ rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDst->type == DRAWABLE_PIXMAP)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPushPixels: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
- }
- }
- else
- {
- if (pDst->type == DRAWABLE_WINDOW)
- {
- pDstWnd = (WindowPtr)pDst;
- if (pDstWnd->viewable)
- {
post_process = 1;
- if (g_do_dirty_ons)
+
+ if (g_do_dirty_os)
{
- LLOGLN(0, ("rdpPushPixels: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ LLOGLN(10, ("rdpPushPixels: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLY;
}
else
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
+ }
+ else
+ {
+ pDstWnd = (WindowPtr)pDst;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPushPixels: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
-
- memset(&box, 0, sizeof(box));
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDst, pGC);
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- box.x1 = pDst->x + x;
- box.y1 = pDst->y + y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return;
}
- else if (got_id)
+
+ memset(&box, 0, sizeof(box));
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDst, pGC);
+
+ if (cd == 1)
{
- rdpup_begin_update();
- rdpup_send_area(0, pDst->x + x, pDst->y + y, w, h);
- rdpup_end_update();
+ if (dirty_type != 0)
+ {
+ box.x1 = pDst->x + x;
+ box.y1 = pDst->y + y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(0, pDst->x + x, pDst->y + y, w, h);
+ rdpup_end_update();
+ }
}
- }
- else if (cd == 2)
- {
- box.x1 = pDst->x + x;
- box.y1 = pDst->y + y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&box_reg, &box, 0);
- RegionIntersect(&clip_reg, &clip_reg, &box_reg);
- num_clips = REGION_NUM_RECTS(&clip_reg);
- if (num_clips > 0)
+ else if (cd == 2)
{
- if (dirty_type != 0)
- {
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
- RegionUninit(&reg1);
- }
- else if (got_id)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ box.x1 = pDst->x + x;
+ box.y1 = pDst->y + y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&box_reg, &box, 0);
+ RegionIntersect(&clip_reg, &clip_reg, &box_reg);
+ num_clips = REGION_NUM_RECTS(&clip_reg);
+
+ if (num_clips > 0)
{
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ if (dirty_type != 0)
+ {
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
}
- rdpup_end_update();
- }
+
+ RegionUninit(&box_reg);
+ }
+
+ RegionUninit(&clip_reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
}
- RegionUninit(&box_reg);
- }
- RegionUninit(&clip_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
}
diff --git a/xorg/X11R7.6/rdp/rdpPutImage.c b/xorg/X11R7.6/rdp/rdpPutImage.c
index 9464a513..fde2c0eb 100644
--- a/xorg/X11R7.6/rdp/rdpPutImage.c
+++ b/xorg/X11R7.6/rdp/rdpPutImage.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -48,153 +48,162 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
static void
rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char* pBits)
+ int w, int h, int leftPad, int format, char *pBits)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ 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);
+ 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)
+ int w, int h, int leftPad, int format, char *pBits)
{
- RegionRec clip_reg;
- int cd;
- int j;
- int reset_surface;
- int post_process;
- int got_id;
- int dirty_type;
- BoxRec box;
- struct image_data id;
-
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
- RegionRec reg1;
- RegionRec reg2;
-
- LLOGLN(10, ("rdpPutImage:"));
- LLOGLN(10, ("rdpPutImage: drawable id 0x%x", (int)(pDst->id)));
-
- /* do original call */
- rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDst->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDst;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec clip_reg;
+ int cd;
+ int j;
+ int reset_surface;
+ int post_process;
+ int got_id;
+ int dirty_type;
+ BoxRec box;
+ struct image_data id;
+
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+ RegionRec reg1;
+ RegionRec reg2;
+
+ LLOGLN(10, ("rdpPutImage:"));
+ LLOGLN(10, ("rdpPutImage: drawable id 0x%x", (int)(pDst->id)));
+
+ /* do original call */
+ rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDst->type == DRAWABLE_PIXMAP)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpPutImage: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
- }
- }
- else
- {
- if (pDst->type == DRAWABLE_WINDOW)
- {
- pDstWnd = (WindowPtr)pDst;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstPixmap = (PixmapPtr)pDst;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
{
- LLOGLN(0, ("rdpPutImage: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpPutImage: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLY;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
}
- else
+ }
+ else
+ {
+ pDstWnd = (WindowPtr)pDst;
+
+ if (pDstWnd->viewable)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpPutImage: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDst, pGC);
- if (cd == 1)
- {
- if (dirty_type != 0)
+
+ if (!post_process)
{
- box.x1 = pDst->x + x;
- box.y1 = pDst->y + y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ return;
}
- else if (got_id)
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDst, pGC);
+
+ if (cd == 1)
{
- rdpup_begin_update();
- rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
- rdpup_end_update();
+ if (dirty_type != 0)
+ {
+ box.x1 = pDst->x + x;
+ box.y1 = pDst->y + y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
+ rdpup_end_update();
+ }
}
- }
- else if (cd == 2)
- {
- if (dirty_type != 0)
+ else if (cd == 2)
{
- box.x1 = pDst->x + x;
- box.y1 = pDst->y + y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- RegionInit(&reg1, &box, 0);
- RegionInit(&reg2, NullBox, 0);
- RegionCopy(&reg2, &clip_reg);
- RegionIntersect(&reg1, &reg1, &reg2);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
- RegionUninit(&reg2);
+ if (dirty_type != 0)
+ {
+ box.x1 = pDst->x + x;
+ box.y1 = pDst->y + y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&reg1, &box, 0);
+ RegionInit(&reg2, NullBox, 0);
+ RegionCopy(&reg2, &clip_reg);
+ RegionIntersect(&reg1, &reg1, &reg2);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ RegionUninit(&reg2);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+
+ for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&clip_reg)[j];
+ rdpup_set_clip(box.x1, box.y1, (box.x2 - box.x1), (box.y2 - box.y1));
+ rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
+ }
+
+ rdpup_reset_clip();
+ rdpup_end_update();
+ }
}
- else if (got_id)
+
+ RegionUninit(&clip_reg);
+
+ if (reset_surface)
{
- rdpup_begin_update();
- for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
- {
- box = REGION_RECTS(&clip_reg)[j];
- rdpup_set_clip(box.x1, box.y1, (box.x2 - box.x1), (box.y2 - box.y1));
- rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
- }
- rdpup_reset_clip();
- rdpup_end_update();
+ rdpup_switch_os_surface(-1);
}
- }
- RegionUninit(&clip_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
}
diff --git a/xorg/X11R7.6/rdp/rdpSetSpans.c b/xorg/X11R7.6/rdp/rdpSetSpans.c
index ed9bc404..34d3ec84 100644
--- a/xorg/X11R7.6/rdp/rdpSetSpans.c
+++ b/xorg/X11R7.6/rdp/rdpSetSpans.c
@@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -45,107 +45,121 @@ extern int g_con_number; /* in rdpup.c */
/******************************************************************************/
void
-rdpSetSpansOrg(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
- DDXPointPtr ppt, int* pwidth, int nspans, int fSorted)
+rdpSetSpansOrg(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
- rdpGCPtr priv;
- GCFuncs* oldFuncs;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
- GC_OP_PROLOGUE(pGC);
- pGC->ops->SetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
- GC_OP_EPILOGUE(pGC);
+ 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)
+rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
- RegionRec clip_reg;
- int cd;
- int got_id;
- int dirty_type;
- int post_process;
- int reset_surface;
- struct image_data id;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
-
- LLOGLN(0, ("rdpSetSpans: todo"));
-
- /* do original call */
- rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)pDrawable;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ RegionRec clip_reg;
+ int cd;
+ int got_id;
+ int dirty_type;
+ int post_process;
+ int reset_surface;
+ struct image_data id;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+
+ LLOGLN(0, ("rdpSetSpans: todo"));
+
+ /* do original call */
+ rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpSetSpans: gettig dirty"));
- pDstPriv->is_dirty = 1;
- pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- }
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ pDstPixmap = (PixmapPtr)pDrawable;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpSetSpans: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ pDirtyPriv = pDstPriv;
+ dirty_type = RDI_IMGLY;
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ }
+ }
+ }
+ else
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ pDstWnd = (WindowPtr)pDrawable;
+
+ if (pDstWnd->viewable)
+ {
+ post_process = 1;
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
+ }
+ }
+
+ if (!post_process)
+ {
+ return;
+ }
+
+ RegionInit(&clip_reg, NullBox, 0);
+ cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+
+ if (cd == 1)
+ {
+ if (dirty_type != 0)
+ {
+ }
+ else if (got_id)
+ {
+ }
+ }
+ else if (cd == 2)
+ {
+ if (dirty_type != 0)
+ {
+ }
+ else if (got_id)
+ {
+ }
+ }
+
+ RegionUninit(&clip_reg);
+
+ if (reset_surface)
+ {
+ rdpup_switch_os_surface(-1);
+ }
}
- }
- else
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- pDstWnd = (WindowPtr)pDrawable;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
- }
- }
- }
- if (!post_process)
- {
- return;
- }
- RegionInit(&clip_reg, NullBox, 0);
- cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd == 1)
- {
- if (dirty_type != 0)
- {
- }
- else if (got_id)
- {
- }
- }
- else if (cd == 2)
- {
- if (dirty_type != 0)
- {
- }
- else if (got_id)
- {
- }
- }
- RegionUninit(&clip_reg);
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
-}
diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c
index 95cdd487..f279bdb2 100644
--- a/xorg/X11R7.6/rdp/rdpdraw.c
+++ b/xorg/X11R7.6/rdp/rdpdraw.c
@@ -48,9 +48,9 @@ Xserver drawing ops and funcs
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
@@ -71,17 +71,17 @@ static int g_doing_font = 0;
GCFuncs g_rdpGCFuncs =
{
- rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip,
- rdpDestroyClip, rdpCopyClip
+ 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
+ rdpFillSpans, rdpSetSpans, rdpPutImage, rdpCopyArea, rdpCopyPlane,
+ rdpPolyPoint, rdpPolylines, rdpPolySegment, rdpPolyRectangle,
+ rdpPolyArc, rdpFillPolygon, rdpPolyFillRect, rdpPolyFillArc,
+ rdpPolyText8, rdpPolyText16, rdpImageText8, rdpImageText16,
+ rdpImageGlyphBlt, rdpPolyGlyphBlt, rdpPushPixels
};
/******************************************************************************/
@@ -91,87 +91,95 @@ GCOps g_rdpGCOps =
int
rdp_get_clip(RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC)
{
- WindowPtr pWindow;
- RegionPtr temp;
- BoxRec box;
- int rv;
-
- rv = 0;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- switch (pGC->clientClipType)
- {
- case CT_NONE:
- rv = 1;
- break;
- case CT_REGION:
- rv = 2;
- RegionCopy(pRegion, pGC->clientClip);
- break;
- default:
- rdpLog("unimp clip type %d\n", pGC->clientClipType);
- break;
- }
- if (rv == 2) /* check if the clip is the entire pixmap */
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pDrawable->width;
- box.y2 = pDrawable->height;
- if (RegionContainsRect(pRegion, &box) == rgnIN)
- {
- rv = 1;
- }
- }
- }
- else if (pDrawable->type == DRAWABLE_WINDOW)
- {
- pWindow = (WindowPtr)pDrawable;
- if (pWindow->viewable)
+ WindowPtr pWindow;
+ RegionPtr temp;
+ BoxRec box;
+ int rv;
+
+ rv = 0;
+
+ if (pDrawable->type == DRAWABLE_PIXMAP)
{
- if (pGC->subWindowMode == IncludeInferiors)
- {
- temp = &pWindow->borderClip;
- }
- else
- {
- temp = &pWindow->clipList;
- }
- if (RegionNotEmpty(temp))
- {
switch (pGC->clientClipType)
{
- case CT_NONE:
- rv = 2;
- RegionCopy(pRegion, temp);
- break;
- case CT_REGION:
- rv = 2;
- RegionCopy(pRegion, pGC->clientClip);
- RegionTranslate(pRegion,
- pDrawable->x + pGC->clipOrg.x,
- pDrawable->y + pGC->clipOrg.y);
- RegionIntersect(pRegion, pRegion, temp);
- break;
- default:
- rdpLog("unimp clip type %d\n", pGC->clientClipType);
- break;
+ case CT_NONE:
+ rv = 1;
+ break;
+ case CT_REGION:
+ rv = 2;
+ RegionCopy(pRegion, pGC->clientClip);
+ break;
+ default:
+ rdpLog("unimp clip type %d\n", pGC->clientClipType);
+ break;
+ }
+
+ if (rv == 2) /* check if the clip is the entire pixmap */
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pDrawable->width;
+ box.y2 = pDrawable->height;
+
+ if (RegionContainsRect(pRegion, &box) == rgnIN)
+ {
+ rv = 1;
+ }
}
- if (rv == 2) /* check if the clip is the entire screen */
+ }
+ else if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ pWindow = (WindowPtr)pDrawable;
+
+ if (pWindow->viewable)
{
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = g_rdpScreen.width;
- box.y2 = g_rdpScreen.height;
- if (RegionContainsRect(pRegion, &box) == rgnIN)
- {
- rv = 1;
- }
+ if (pGC->subWindowMode == IncludeInferiors)
+ {
+ temp = &pWindow->borderClip;
+ }
+ else
+ {
+ temp = &pWindow->clipList;
+ }
+
+ if (RegionNotEmpty(temp))
+ {
+ switch (pGC->clientClipType)
+ {
+ case CT_NONE:
+ rv = 2;
+ RegionCopy(pRegion, temp);
+ break;
+ case CT_REGION:
+ rv = 2;
+ RegionCopy(pRegion, pGC->clientClip);
+ RegionTranslate(pRegion,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+ RegionIntersect(pRegion, pRegion, temp);
+ break;
+ default:
+ rdpLog("unimp clip type %d\n", pGC->clientClipType);
+ break;
+ }
+
+ if (rv == 2) /* check if the clip is the entire screen */
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = g_rdpScreen.width;
+ box.y2 = g_rdpScreen.height;
+
+ if (RegionContainsRect(pRegion, &box) == rgnIN)
+ {
+ rv = 1;
+ }
+ }
+ }
}
- }
}
- }
- return rv;
+
+ return rv;
}
/******************************************************************************/
@@ -179,453 +187,484 @@ void
GetTextBoundingBox(DrawablePtr pDrawable, FontPtr font, int x, int y,
int n, BoxPtr pbox)
{
- int maxAscent;
- int maxDescent;
- int maxCharWidth;
-
- if (FONTASCENT(font) > FONTMAXBOUNDS(font, ascent))
- {
- maxAscent = FONTASCENT(font);
- }
- else
- {
- maxAscent = FONTMAXBOUNDS(font, ascent);
- }
- if (FONTDESCENT(font) > FONTMAXBOUNDS(font, descent))
- {
- maxDescent = FONTDESCENT(font);
- }
- else
- {
- maxDescent = FONTMAXBOUNDS(font, descent);
- }
- if (FONTMAXBOUNDS(font, rightSideBearing) >
- FONTMAXBOUNDS(font, characterWidth))
- {
- maxCharWidth = FONTMAXBOUNDS(font, rightSideBearing);
- }
- else
- {
- maxCharWidth = FONTMAXBOUNDS(font, characterWidth);
- }
- pbox->x1 = pDrawable->x + x;
- pbox->y1 = pDrawable->y + y - maxAscent;
- pbox->x2 = pbox->x1 + maxCharWidth * n;
- pbox->y2 = pbox->y1 + maxAscent + maxDescent;
- if (FONTMINBOUNDS(font, leftSideBearing) < 0)
- {
- pbox->x1 += FONTMINBOUNDS(font, leftSideBearing);
- }
+ int maxAscent;
+ int maxDescent;
+ int maxCharWidth;
+
+ if (FONTASCENT(font) > FONTMAXBOUNDS(font, ascent))
+ {
+ maxAscent = FONTASCENT(font);
+ }
+ else
+ {
+ maxAscent = FONTMAXBOUNDS(font, ascent);
+ }
+
+ if (FONTDESCENT(font) > FONTMAXBOUNDS(font, descent))
+ {
+ maxDescent = FONTDESCENT(font);
+ }
+ else
+ {
+ maxDescent = FONTMAXBOUNDS(font, descent);
+ }
+
+ if (FONTMAXBOUNDS(font, rightSideBearing) >
+ FONTMAXBOUNDS(font, characterWidth))
+ {
+ maxCharWidth = FONTMAXBOUNDS(font, rightSideBearing);
+ }
+ else
+ {
+ maxCharWidth = FONTMAXBOUNDS(font, characterWidth);
+ }
+
+ pbox->x1 = pDrawable->x + x;
+ pbox->y1 = pDrawable->y + y - maxAscent;
+ pbox->x2 = pbox->x1 + maxCharWidth * n;
+ pbox->y2 = pbox->y1 + maxAscent + maxDescent;
+
+ if (FONTMINBOUNDS(font, leftSideBearing) < 0)
+ {
+ pbox->x1 += FONTMINBOUNDS(font, leftSideBearing);
+ }
}
/******************************************************************************/
#define GC_FUNC_PROLOGUE(_pGC) \
-{ \
- priv = (rdpGCPtr)(dixGetPrivateAddr(&(_pGC->devPrivates), &g_rdpGCIndex)); \
- (_pGC)->funcs = priv->funcs; \
- if (priv->ops != 0) \
- { \
- (_pGC)->ops = priv->ops; \
- } \
-}
+ { \
+ priv = (rdpGCPtr)(dixGetPrivateAddr(&(_pGC->devPrivates), &g_rdpGCIndex)); \
+ (_pGC)->funcs = priv->funcs; \
+ if (priv->ops != 0) \
+ { \
+ (_pGC)->ops = priv->ops; \
+ } \
+ }
/******************************************************************************/
#define GC_FUNC_EPILOGUE(_pGC) \
-{ \
- priv->funcs = (_pGC)->funcs; \
- (_pGC)->funcs = &g_rdpGCFuncs; \
- if (priv->ops != 0) \
- { \
- priv->ops = (_pGC)->ops; \
- (_pGC)->ops = &g_rdpGCOps; \
- } \
-}
+ { \
+ priv->funcs = (_pGC)->funcs; \
+ (_pGC)->funcs = &g_rdpGCFuncs; \
+ if (priv->ops != 0) \
+ { \
+ priv->ops = (_pGC)->ops; \
+ (_pGC)->ops = &g_rdpGCOps; \
+ } \
+ }
/******************************************************************************/
static void
rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
{
- rdpGCRec* priv;
- int wrap;
- RegionPtr pRegion;
-
- LLOGLN(10, ("rdpValidateGC:"));
- GC_FUNC_PROLOGUE(pGC);
- pGC->funcs->ValidateGC(pGC, changes, d);
- if (g_wrapPixmap)
- {
- wrap = 1;
- }
- else
- {
- wrap = (d->type == DRAWABLE_WINDOW) && ((WindowPtr)d)->viewable;
+ rdpGCRec *priv;
+ int wrap;
+ RegionPtr pRegion;
+
+ LLOGLN(10, ("rdpValidateGC:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ValidateGC(pGC, changes, d);
+
+ if (g_wrapPixmap)
+ {
+ wrap = 1;
+ }
+ else
+ {
+ wrap = (d->type == DRAWABLE_WINDOW) && ((WindowPtr)d)->viewable;
+
+ if (wrap)
+ {
+ if (pGC->subWindowMode == IncludeInferiors)
+ {
+ pRegion = &(((WindowPtr)d)->borderClip);
+ }
+ else
+ {
+ pRegion = &(((WindowPtr)d)->clipList);
+ }
+
+ wrap = RegionNotEmpty(pRegion);
+ }
+ }
+
+ priv->ops = 0;
+
if (wrap)
{
- if (pGC->subWindowMode == IncludeInferiors)
- {
- pRegion = &(((WindowPtr)d)->borderClip);
- }
- else
- {
- pRegion = &(((WindowPtr)d)->clipList);
- }
- wrap = RegionNotEmpty(pRegion);
+ priv->ops = pGC->ops;
}
- }
- priv->ops = 0;
- if (wrap)
- {
- priv->ops = pGC->ops;
- }
- GC_FUNC_EPILOGUE(pGC);
+
+ GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpChangeGC(GCPtr pGC, unsigned long mask)
{
- rdpGCRec* priv;
+ rdpGCRec *priv;
- LLOGLN(10, ("in rdpChangeGC"));
- GC_FUNC_PROLOGUE(pGC);
- pGC->funcs->ChangeGC(pGC, mask);
- GC_FUNC_EPILOGUE(pGC);
+ LLOGLN(10, ("in 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;
+ rdpGCRec *priv;
- LLOGLN(10, ("in rdpCopyGC"));
- GC_FUNC_PROLOGUE(dst);
- dst->funcs->CopyGC(src, mask, dst);
- GC_FUNC_EPILOGUE(dst);
+ LLOGLN(10, ("in rdpCopyGC"));
+ GC_FUNC_PROLOGUE(dst);
+ dst->funcs->CopyGC(src, mask, dst);
+ GC_FUNC_EPILOGUE(dst);
}
/******************************************************************************/
static void
rdpDestroyGC(GCPtr pGC)
{
- rdpGCRec* priv;
+ rdpGCRec *priv;
- LLOGLN(10, ("in rdpDestroyGC"));
- GC_FUNC_PROLOGUE(pGC);
- pGC->funcs->DestroyGC(pGC);
- GC_FUNC_EPILOGUE(pGC);
+ LLOGLN(10, ("in 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;
+ rdpGCRec *priv;
- LLOGLN(10, ("in rdpChangeClip"));
- GC_FUNC_PROLOGUE(pGC);
- pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
- GC_FUNC_EPILOGUE(pGC);
+ LLOGLN(10, ("in rdpChangeClip"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
+ GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpDestroyClip(GCPtr pGC)
{
- rdpGCRec* priv;
+ rdpGCRec *priv;
- LLOGLN(10, ("in rdpDestroyClip"));
- GC_FUNC_PROLOGUE(pGC);
- pGC->funcs->DestroyClip(pGC);
- GC_FUNC_EPILOGUE(pGC);
+ LLOGLN(10, ("in rdpDestroyClip"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->DestroyClip(pGC);
+ GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpCopyClip(GCPtr dst, GCPtr src)
{
- rdpGCRec* priv;
+ rdpGCRec *priv;
- LLOGLN(0, ("in rdpCopyClip"));
- GC_FUNC_PROLOGUE(dst);
- dst->funcs->CopyClip(dst, src);
- GC_FUNC_EPILOGUE(dst);
+ LLOGLN(0, ("in rdpCopyClip"));
+ GC_FUNC_PROLOGUE(dst);
+ dst->funcs->CopyClip(dst, src);
+ GC_FUNC_EPILOGUE(dst);
}
/******************************************************************************/
#define GC_OP_PROLOGUE(_pGC) \
-{ \
- priv = (rdpGCPtr)dixGetPrivateAddr(&(pGC->devPrivates), &g_rdpGCIndex); \
- oldFuncs = _pGC->funcs; \
- (_pGC)->funcs = priv->funcs; \
- (_pGC)->ops = priv->ops; \
-}
+ { \
+ priv = (rdpGCPtr)dixGetPrivateAddr(&(pGC->devPrivates), &g_rdpGCIndex); \
+ oldFuncs = _pGC->funcs; \
+ (_pGC)->funcs = priv->funcs; \
+ (_pGC)->ops = priv->ops; \
+ }
/******************************************************************************/
#define GC_OP_EPILOGUE(_pGC) \
-{ \
- priv->ops = (_pGC)->ops; \
- (_pGC)->funcs = oldFuncs; \
- (_pGC)->ops = &g_rdpGCOps; \
-}
+ { \
+ priv->ops = (_pGC)->ops; \
+ (_pGC)->funcs = oldFuncs; \
+ (_pGC)->ops = &g_rdpGCOps; \
+ }
/******************************************************************************/
Bool
rdpCloseScreen(int i, ScreenPtr pScreen)
{
- LLOGLN(10, ("in rdpCloseScreen"));
- pScreen->CloseScreen = g_rdpScreen.CloseScreen;
- pScreen->CreateGC = g_rdpScreen.CreateGC;
- //pScreen->PaintWindowBackground = g_rdpScreen.PaintWindowBackground;
- //pScreen->PaintWindowBorder = g_rdpScreen.PaintWindowBorder;
- pScreen->CopyWindow = g_rdpScreen.CopyWindow;
- pScreen->ClearToBackground = g_rdpScreen.ClearToBackground;
- pScreen->RestoreAreas = g_rdpScreen.RestoreAreas;
- return 1;
+ LLOGLN(10, ("in rdpCloseScreen"));
+ pScreen->CloseScreen = g_rdpScreen.CloseScreen;
+ pScreen->CreateGC = g_rdpScreen.CreateGC;
+ //pScreen->PaintWindowBackground = g_rdpScreen.PaintWindowBackground;
+ //pScreen->PaintWindowBorder = g_rdpScreen.PaintWindowBorder;
+ pScreen->CopyWindow = g_rdpScreen.CopyWindow;
+ pScreen->ClearToBackground = g_rdpScreen.ClearToBackground;
+ pScreen->RestoreAreas = g_rdpScreen.RestoreAreas;
+ return 1;
}
/******************************************************************************/
int
-draw_item_add(rdpPixmapRec* priv, struct rdp_draw_item* di)
+draw_item_add(rdpPixmapRec *priv, struct rdp_draw_item *di)
{
- if (priv->draw_item_tail == 0)
- {
- priv->draw_item_tail = di;
- priv->draw_item_head = di;
- }
- else
- {
- di->prev = priv->draw_item_tail;
- priv->draw_item_tail->next = di;
- priv->draw_item_tail = di;
- }
- if (priv == &g_screenPriv)
- {
- rdpScheduleDeferredUpdate();
- }
- return 0;
+ if (priv->draw_item_tail == 0)
+ {
+ priv->draw_item_tail = di;
+ priv->draw_item_head = di;
+ }
+ else
+ {
+ di->prev = priv->draw_item_tail;
+ priv->draw_item_tail->next = di;
+ priv->draw_item_tail = di;
+ }
+
+ if (priv == &g_screenPriv)
+ {
+ rdpScheduleDeferredUpdate();
+ }
+
+ return 0;
}
/******************************************************************************/
int
-draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di)
+draw_item_remove(rdpPixmapRec *priv, struct rdp_draw_item *di)
{
- if (di->prev != 0)
- {
- di->prev->next = di->next;
- }
- if (di->next != 0)
- {
- di->next->prev = di->prev;
- }
- if (priv->draw_item_head == di)
- {
- priv->draw_item_head = di->next;
- }
- if (priv->draw_item_tail == di)
- {
- priv->draw_item_tail = di->prev;
- }
- if (di->type == RDI_LINE)
- {
- if (di->u.line.segs != 0)
+ if (di->prev != 0)
+ {
+ di->prev->next = di->next;
+ }
+
+ if (di->next != 0)
{
- g_free(di->u.line.segs);
+ di->next->prev = di->prev;
}
- }
- RegionDestroy(di->reg);
- g_free(di);
- return 0;
+
+ if (priv->draw_item_head == di)
+ {
+ priv->draw_item_head = di->next;
+ }
+
+ if (priv->draw_item_tail == di)
+ {
+ priv->draw_item_tail = di->prev;
+ }
+
+ if (di->type == RDI_LINE)
+ {
+ if (di->u.line.segs != 0)
+ {
+ g_free(di->u.line.segs);
+ }
+ }
+
+ RegionDestroy(di->reg);
+ g_free(di);
+ return 0;
}
/******************************************************************************/
int
-draw_item_remove_all(rdpPixmapRec* priv)
+draw_item_remove_all(rdpPixmapRec *priv)
{
- struct rdp_draw_item* di;
+ struct rdp_draw_item *di;
- di = priv->draw_item_head;
- while (di != 0)
- {
- draw_item_remove(priv, di);
di = priv->draw_item_head;
- }
- return 0;
+
+ while (di != 0)
+ {
+ draw_item_remove(priv, di);
+ di = priv->draw_item_head;
+ }
+
+ return 0;
}
/******************************************************************************/
int
-draw_item_pack(rdpPixmapRec* priv)
+draw_item_pack(rdpPixmapRec *priv)
{
- struct rdp_draw_item* di;
- struct rdp_draw_item* di_prev;
+ struct rdp_draw_item *di;
+ struct rdp_draw_item *di_prev;
#if 1
- /* look for repeating draw types */
- if (priv->draw_item_head != 0)
- {
- if (priv->draw_item_head->next != 0)
+
+ /* look for repeating draw types */
+ if (priv->draw_item_head != 0)
{
- di_prev = priv->draw_item_head;
- di = priv->draw_item_head->next;
- while (di != 0)
- {
- if ((di_prev->type == RDI_IMGLL) && (di->type == RDI_IMGLL))
- {
- LLOGLN(10, ("draw_item_pack: packing RDI_IMGLL"));
- RegionUnion(di_prev->reg, di_prev->reg, di->reg);
- draw_item_remove(priv, di);
- di = di_prev->next;
- }
- else if ((di_prev->type == RDI_IMGLY) && (di->type == RDI_IMGLY))
+ if (priv->draw_item_head->next != 0)
{
- LLOGLN(10, ("draw_item_pack: packing RDI_IMGLY"));
- RegionUnion(di_prev->reg, di_prev->reg, di->reg);
- draw_item_remove(priv, di);
- di = di_prev->next;
+ di_prev = priv->draw_item_head;
+ di = priv->draw_item_head->next;
+
+ while (di != 0)
+ {
+ if ((di_prev->type == RDI_IMGLL) && (di->type == RDI_IMGLL))
+ {
+ LLOGLN(10, ("draw_item_pack: packing RDI_IMGLL"));
+ RegionUnion(di_prev->reg, di_prev->reg, di->reg);
+ draw_item_remove(priv, di);
+ di = di_prev->next;
+ }
+ else if ((di_prev->type == RDI_IMGLY) && (di->type == RDI_IMGLY))
+ {
+ LLOGLN(10, ("draw_item_pack: packing RDI_IMGLY"));
+ RegionUnion(di_prev->reg, di_prev->reg, di->reg);
+ draw_item_remove(priv, di);
+ di = di_prev->next;
+ }
+ else
+ {
+ di_prev = di;
+ di = di_prev->next;
+ }
+ }
}
- else
- {
- di_prev = di;
- di = di_prev->next;
- }
- }
}
- }
+
#endif
#if 1
- /* subtract regions */
- if (priv->draw_item_tail != 0)
- {
- if (priv->draw_item_tail->prev != 0)
+
+ /* subtract regions */
+ if (priv->draw_item_tail != 0)
{
- di = priv->draw_item_tail;
- while (di->prev != 0)
- {
- /* skip subtract flag
- * draw items like line can't be used to clear(subtract) previous
- * draw items since they are not opaque
- * eg they can not be the 'S' in 'D = M - S'
- * the region for line draw items is the clip region */
- if ((di->flags & 1) == 0)
+ if (priv->draw_item_tail->prev != 0)
{
- di_prev = di->prev;
- while (di_prev != 0)
- {
- /* D = M - S */
- RegionSubtract(di_prev->reg, di_prev->reg, di->reg);
- di_prev = di_prev->prev;
- }
+ di = priv->draw_item_tail;
+
+ while (di->prev != 0)
+ {
+ /* skip subtract flag
+ * draw items like line can't be used to clear(subtract) previous
+ * draw items since they are not opaque
+ * eg they can not be the 'S' in 'D = M - S'
+ * the region for line draw items is the clip region */
+ if ((di->flags & 1) == 0)
+ {
+ di_prev = di->prev;
+
+ while (di_prev != 0)
+ {
+ /* D = M - S */
+ RegionSubtract(di_prev->reg, di_prev->reg, di->reg);
+ di_prev = di_prev->prev;
+ }
+ }
+
+ di = di->prev;
+ }
}
- di = di->prev;
- }
}
- }
+
#endif
#if 1
- /* remove draw items with empty regions */
- di = priv->draw_item_head;
- di_prev = 0;
- while (di != 0)
- {
- if (!RegionNotEmpty(di->reg))
- {
- LLOGLN(10, ("draw_item_pack: removing empty item type %d", di->type));
- draw_item_remove(priv, di);
- di = di_prev == 0 ? priv->draw_item_head : di_prev->next;
- }
- else
+ /* remove draw items with empty regions */
+ di = priv->draw_item_head;
+ di_prev = 0;
+
+ while (di != 0)
{
- di_prev = di;
- di = di->next;
+ if (!RegionNotEmpty(di->reg))
+ {
+ LLOGLN(10, ("draw_item_pack: removing empty item type %d", di->type));
+ draw_item_remove(priv, di);
+ di = di_prev == 0 ? priv->draw_item_head : di_prev->next;
+ }
+ else
+ {
+ di_prev = di;
+ di = di->next;
+ }
}
- }
+
#endif
- return 0;
+ return 0;
}
/******************************************************************************/
int
-draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int opcode,
+draw_item_add_img_region(rdpPixmapRec *priv, RegionPtr reg, int opcode,
int type)
{
- struct rdp_draw_item* di;
-
- di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1);
- di->type = type;
- di->reg = RegionCreate(NullBox, 0);
- RegionCopy(di->reg, reg);
- di->u.img.opcode = opcode;
- draw_item_add(priv, di);
- return 0;
+ struct rdp_draw_item *di;
+
+ di = (struct rdp_draw_item *)g_malloc(sizeof(struct rdp_draw_item), 1);
+ di->type = type;
+ di->reg = RegionCreate(NullBox, 0);
+ RegionCopy(di->reg, reg);
+ di->u.img.opcode = opcode;
+ draw_item_add(priv, di);
+ return 0;
}
/******************************************************************************/
int
-draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color,
+draw_item_add_fill_region(rdpPixmapRec *priv, RegionPtr reg, int color,
int opcode)
{
- struct rdp_draw_item* di;
-
- di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1);
- di->type = RDI_FILL;
- di->u.fill.fg_color = color;
- di->u.fill.opcode = opcode;
- di->reg = RegionCreate(NullBox, 0);
- RegionCopy(di->reg, reg);
- draw_item_add(priv, di);
- return 0;
+ struct rdp_draw_item *di;
+
+ di = (struct rdp_draw_item *)g_malloc(sizeof(struct rdp_draw_item), 1);
+ di->type = RDI_FILL;
+ di->u.fill.fg_color = color;
+ di->u.fill.opcode = opcode;
+ di->reg = RegionCreate(NullBox, 0);
+ RegionCopy(di->reg, reg);
+ draw_item_add(priv, di);
+ return 0;
}
/******************************************************************************/
int
-draw_item_add_line_region(rdpPixmapRec* priv, RegionPtr reg, int color,
- int opcode, int width, xSegment* segs, int nseg,
+draw_item_add_line_region(rdpPixmapRec *priv, RegionPtr reg, int color,
+ int opcode, int width, xSegment *segs, int nseg,
int is_segment)
{
- struct rdp_draw_item* di;
-
- LLOGLN(10, ("draw_item_add_line_region:"));
- di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1);
- di->type = RDI_LINE;
- di->u.line.fg_color = color;
- di->u.line.opcode = opcode;
- di->u.line.width = width;
- di->u.line.segs = (xSegment*)g_malloc(sizeof(xSegment) * nseg, 1);
- memcpy(di->u.line.segs, segs, sizeof(xSegment) * nseg);
- di->u.line.nseg = nseg;
- if (is_segment)
- {
- di->u.line.flags = 1;
- }
- di->reg = RegionCreate(NullBox, 0);
- di->flags |= 1;
- RegionCopy(di->reg, reg);
- draw_item_add(priv, di);
- return 0;
+ struct rdp_draw_item *di;
+
+ LLOGLN(10, ("draw_item_add_line_region:"));
+ di = (struct rdp_draw_item *)g_malloc(sizeof(struct rdp_draw_item), 1);
+ di->type = RDI_LINE;
+ di->u.line.fg_color = color;
+ di->u.line.opcode = opcode;
+ di->u.line.width = width;
+ di->u.line.segs = (xSegment *)g_malloc(sizeof(xSegment) * nseg, 1);
+ memcpy(di->u.line.segs, segs, sizeof(xSegment) * nseg);
+ di->u.line.nseg = nseg;
+
+ if (is_segment)
+ {
+ di->u.line.flags = 1;
+ }
+
+ di->reg = RegionCreate(NullBox, 0);
+ di->flags |= 1;
+ RegionCopy(di->reg, reg);
+ draw_item_add(priv, di);
+ return 0;
}
/******************************************************************************/
int
-draw_item_add_srcblt_region(rdpPixmapRec* priv, RegionPtr reg,
+draw_item_add_srcblt_region(rdpPixmapRec *priv, RegionPtr reg,
int srcx, int srcy, int dstx, int dsty,
int cx, int cy)
{
- struct rdp_draw_item* di;
-
- LLOGLN(10, ("draw_item_add_srcblt_region:"));
- di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1);
- di->type = RDI_SCRBLT;
- di->u.scrblt.srcx = srcx;
- di->u.scrblt.srcy = srcy;
- di->u.scrblt.dstx = dstx;
- di->u.scrblt.dsty = dsty;
- di->u.scrblt.cx = cx;
- di->u.scrblt.cy = cy;
- di->reg = RegionCreate(NullBox, 0);
- RegionCopy(di->reg, reg);
- draw_item_add(priv, di);
- return 0;
+ struct rdp_draw_item *di;
+
+ LLOGLN(10, ("draw_item_add_srcblt_region:"));
+ di = (struct rdp_draw_item *)g_malloc(sizeof(struct rdp_draw_item), 1);
+ di->type = RDI_SCRBLT;
+ di->u.scrblt.srcx = srcx;
+ di->u.scrblt.srcy = srcy;
+ di->u.scrblt.dstx = dstx;
+ di->u.scrblt.dsty = dsty;
+ di->u.scrblt.cx = cx;
+ di->u.scrblt.cy = cy;
+ di->reg = RegionCreate(NullBox, 0);
+ RegionCopy(di->reg, reg);
+ draw_item_add(priv, di);
+ return 0;
}
/******************************************************************************/
@@ -633,325 +672,352 @@ PixmapPtr
rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint)
{
- PixmapPtr rv;
- rdpPixmapRec* priv;
- int org_width;
-
- org_width = width;
- /* width must be a multiple of 4 in rdp */
- width = (width + 3) & ~3;
- LLOGLN(10, ("rdpCreatePixmap: width %d org_width %d depth %d screen depth %d",
- width, org_width, depth, g_rdpScreen.depth));
- pScreen->CreatePixmap = g_rdpScreen.CreatePixmap;
- rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
- priv = GETPIXPRIV(rv);
- priv->rdpindex = -1;
- if ((rv->drawable.depth >= g_rdpScreen.depth) &&
- (org_width > 1) && (height > 1))
- {
- priv->allocBytes = width * height * g_Bpp;
- priv->rdpindex = rdpup_add_os_bitmap(rv, priv);
- if (priv->rdpindex >= 0)
+ PixmapPtr rv;
+ rdpPixmapRec *priv;
+ int org_width;
+
+ org_width = width;
+ /* width must be a multiple of 4 in rdp */
+ width = (width + 3) & ~3;
+ LLOGLN(10, ("rdpCreatePixmap: width %d org_width %d depth %d screen depth %d",
+ width, org_width, depth, g_rdpScreen.depth));
+ pScreen->CreatePixmap = g_rdpScreen.CreatePixmap;
+ rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
+ priv = GETPIXPRIV(rv);
+ priv->rdpindex = -1;
+
+ if ((rv->drawable.depth >= g_rdpScreen.depth) &&
+ (org_width > 1) && (height > 1))
{
- priv->status = 1;
- rdpup_create_os_surface(priv->rdpindex, width, height);
+ priv->allocBytes = width * height * g_Bpp;
+ priv->rdpindex = rdpup_add_os_bitmap(rv, priv);
+
+ if (priv->rdpindex >= 0)
+ {
+ priv->status = 1;
+ rdpup_create_os_surface(priv->rdpindex, width, height);
+ }
}
- }
- pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0);
- pScreen->CreatePixmap = rdpCreatePixmap;
- return rv;
+
+ pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0);
+ pScreen->CreatePixmap = rdpCreatePixmap;
+ return rv;
}
-extern struct rdpup_os_bitmap* g_os_bitmaps;
+extern struct rdpup_os_bitmap *g_os_bitmaps;
/******************************************************************************/
Bool
rdpDestroyPixmap(PixmapPtr pPixmap)
{
- Bool rv;
- ScreenPtr pScreen;
- rdpPixmapRec* priv;
-
- LLOGLN(10, ("rdpDestroyPixmap:"));
- priv = GETPIXPRIV(pPixmap);
- LLOGLN(10, ("status %d refcnt %d", priv->status, pPixmap->refcnt));
- if (pPixmap->refcnt < 2)
- {
- if (XRDP_IS_OS(priv))
+ Bool rv;
+ ScreenPtr pScreen;
+ rdpPixmapRec *priv;
+
+ LLOGLN(10, ("rdpDestroyPixmap:"));
+ priv = GETPIXPRIV(pPixmap);
+ LLOGLN(10, ("status %d refcnt %d", priv->status, pPixmap->refcnt));
+
+ if (pPixmap->refcnt < 2)
{
- rdpup_remove_os_bitmap(priv->rdpindex);
- rdpup_delete_os_surface(priv->rdpindex);
- draw_item_remove_all(priv);
+ if (XRDP_IS_OS(priv))
+ {
+ rdpup_remove_os_bitmap(priv->rdpindex);
+ rdpup_delete_os_surface(priv->rdpindex);
+ draw_item_remove_all(priv);
+ }
}
- }
- pScreen = pPixmap->drawable.pScreen;
- pScreen->DestroyPixmap = g_rdpScreen.DestroyPixmap;
- rv = pScreen->DestroyPixmap(pPixmap);
- pScreen->DestroyPixmap = rdpDestroyPixmap;
- return rv;
+
+ pScreen = pPixmap->drawable.pScreen;
+ pScreen->DestroyPixmap = g_rdpScreen.DestroyPixmap;
+ rv = pScreen->DestroyPixmap(pPixmap);
+ pScreen->DestroyPixmap = rdpDestroyPixmap;
+ return rv;
}
/******************************************************************************/
Bool
rdpCreateWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen;
- rdpWindowRec* priv;
- Bool rv;
-
- LLOGLN(10, ("rdpCreateWindow:"));
- priv = GETWINPRIV(pWindow);
- LLOGLN(10, (" %p status %d", priv, priv->status));
- pScreen = pWindow->drawable.pScreen;
- pScreen->CreateWindow = g_rdpScreen.CreateWindow;
- rv = pScreen->CreateWindow(pWindow);
- pScreen->CreateWindow = rdpCreateWindow;
- if (g_use_rail)
- {
- }
- return rv;
+ ScreenPtr pScreen;
+ rdpWindowRec *priv;
+ Bool rv;
+
+ LLOGLN(10, ("rdpCreateWindow:"));
+ priv = GETWINPRIV(pWindow);
+ LLOGLN(10, (" %p status %d", priv, priv->status));
+ pScreen = pWindow->drawable.pScreen;
+ pScreen->CreateWindow = g_rdpScreen.CreateWindow;
+ rv = pScreen->CreateWindow(pWindow);
+ pScreen->CreateWindow = rdpCreateWindow;
+
+ if (g_use_rail)
+ {
+ }
+
+ return rv;
}
/******************************************************************************/
Bool
rdpDestroyWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen;
- rdpWindowRec* priv;
- Bool rv;
-
- LLOGLN(10, ("rdpDestroyWindow:"));
- priv = GETWINPRIV(pWindow);
- pScreen = pWindow->drawable.pScreen;
- pScreen->DestroyWindow = g_rdpScreen.DestroyWindow;
- rv = pScreen->DestroyWindow(pWindow);
- pScreen->DestroyWindow = rdpDestroyWindow;
- if (g_use_rail)
- {
- }
- return rv;
+ ScreenPtr pScreen;
+ rdpWindowRec *priv;
+ Bool rv;
+
+ LLOGLN(10, ("rdpDestroyWindow:"));
+ priv = GETWINPRIV(pWindow);
+ pScreen = pWindow->drawable.pScreen;
+ pScreen->DestroyWindow = g_rdpScreen.DestroyWindow;
+ rv = pScreen->DestroyWindow(pWindow);
+ pScreen->DestroyWindow = rdpDestroyWindow;
+
+ if (g_use_rail)
+ {
+ }
+
+ return rv;
}
/******************************************************************************/
Bool
rdpPositionWindow(WindowPtr pWindow, int x, int y)
{
- ScreenPtr pScreen;
- rdpWindowRec* priv;
- Bool rv;
-
- LLOGLN(10, ("rdpPositionWindow:"));
- priv = GETWINPRIV(pWindow);
- pScreen = pWindow->drawable.pScreen;
- pScreen->PositionWindow = g_rdpScreen.PositionWindow;
- rv = pScreen->PositionWindow(pWindow, x, y);
- pScreen->PositionWindow = rdpPositionWindow;
- if (g_use_rail)
- {
- if (priv->status == 1)
+ ScreenPtr pScreen;
+ rdpWindowRec *priv;
+ Bool rv;
+
+ LLOGLN(10, ("rdpPositionWindow:"));
+ priv = GETWINPRIV(pWindow);
+ pScreen = pWindow->drawable.pScreen;
+ pScreen->PositionWindow = g_rdpScreen.PositionWindow;
+ rv = pScreen->PositionWindow(pWindow, x, y);
+ pScreen->PositionWindow = rdpPositionWindow;
+
+ if (g_use_rail)
{
- LLOGLN(10, ("rdpPositionWindow:"));
- LLOGLN(10, (" x %d y %d", x, y));
+ if (priv->status == 1)
+ {
+ LLOGLN(10, ("rdpPositionWindow:"));
+ LLOGLN(10, (" x %d y %d", x, y));
+ }
}
- }
- return rv;
+
+ return rv;
}
/******************************************************************************/
Bool
rdpRealizeWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen;
- rdpWindowRec* priv;
- Bool rv;
-
- LLOGLN(10, ("rdpRealizeWindow:"));
- priv = GETWINPRIV(pWindow);
- pScreen = pWindow->drawable.pScreen;
- pScreen->RealizeWindow = g_rdpScreen.RealizeWindow;
- rv = pScreen->RealizeWindow(pWindow);
- pScreen->RealizeWindow = rdpRealizeWindow;
- if (g_use_rail)
- {
- if ((pWindow != g_invalidate_window) && (pWindow->parent != 0))
+ ScreenPtr pScreen;
+ rdpWindowRec *priv;
+ Bool rv;
+
+ LLOGLN(10, ("rdpRealizeWindow:"));
+ priv = GETWINPRIV(pWindow);
+ pScreen = pWindow->drawable.pScreen;
+ pScreen->RealizeWindow = g_rdpScreen.RealizeWindow;
+ rv = pScreen->RealizeWindow(pWindow);
+ pScreen->RealizeWindow = rdpRealizeWindow;
+
+ if (g_use_rail)
{
- if (XR_IS_ROOT(pWindow->parent))
- {
- LLOGLN(10, ("rdpRealizeWindow:"));
- LLOGLN(10, (" pWindow %p id 0x%x pWindow->parent %p id 0x%x x %d "
- "y %d width %d height %d",
- pWindow, pWindow->drawable.id,
- pWindow->parent, pWindow->parent->drawable.id,
- pWindow->drawable.x, pWindow->drawable.y,
- pWindow->drawable.width, pWindow->drawable.height));
- priv->status = 1;
- rdpup_create_window(pWindow, priv);
- }
+ if ((pWindow != g_invalidate_window) && (pWindow->parent != 0))
+ {
+ if (XR_IS_ROOT(pWindow->parent))
+ {
+ LLOGLN(10, ("rdpRealizeWindow:"));
+ LLOGLN(10, (" pWindow %p id 0x%x pWindow->parent %p id 0x%x x %d "
+ "y %d width %d height %d",
+ pWindow, pWindow->drawable.id,
+ pWindow->parent, pWindow->parent->drawable.id,
+ pWindow->drawable.x, pWindow->drawable.y,
+ pWindow->drawable.width, pWindow->drawable.height));
+ priv->status = 1;
+ rdpup_create_window(pWindow, priv);
+ }
+ }
}
- }
- return rv;
+
+ return rv;
}
/******************************************************************************/
Bool
rdpUnrealizeWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen;
- rdpWindowRec* priv;
- Bool rv;
-
- LLOGLN(10, ("rdpUnrealizeWindow:"));
- priv = GETWINPRIV(pWindow);
- pScreen = pWindow->drawable.pScreen;
- pScreen->UnrealizeWindow = g_rdpScreen.UnrealizeWindow;
- rv = pScreen->UnrealizeWindow(pWindow);
- pScreen->UnrealizeWindow = rdpUnrealizeWindow;
- if (g_use_rail)
- {
- if (priv->status == 1)
+ ScreenPtr pScreen;
+ rdpWindowRec *priv;
+ Bool rv;
+
+ LLOGLN(10, ("rdpUnrealizeWindow:"));
+ priv = GETWINPRIV(pWindow);
+ pScreen = pWindow->drawable.pScreen;
+ pScreen->UnrealizeWindow = g_rdpScreen.UnrealizeWindow;
+ rv = pScreen->UnrealizeWindow(pWindow);
+ pScreen->UnrealizeWindow = rdpUnrealizeWindow;
+
+ if (g_use_rail)
{
- LLOGLN(10, ("rdpUnrealizeWindow:"));
- priv->status = 0;
- rdpup_delete_window(pWindow, priv);
+ if (priv->status == 1)
+ {
+ LLOGLN(10, ("rdpUnrealizeWindow:"));
+ priv->status = 0;
+ rdpup_delete_window(pWindow, priv);
+ }
}
- }
- return rv;
+
+ return rv;
}
/******************************************************************************/
Bool
rdpChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
{
- ScreenPtr pScreen;
- rdpWindowRec* priv;
- Bool rv;
-
- LLOGLN(10, ("rdpChangeWindowAttributes:"));
- priv = GETWINPRIV(pWindow);
- pScreen = pWindow->drawable.pScreen;
- pScreen->ChangeWindowAttributes = g_rdpScreen.ChangeWindowAttributes;
- rv = pScreen->ChangeWindowAttributes(pWindow, mask);
- pScreen->ChangeWindowAttributes = rdpChangeWindowAttributes;
- if (g_use_rail)
- {
- }
- return rv;
+ ScreenPtr pScreen;
+ rdpWindowRec *priv;
+ Bool rv;
+
+ LLOGLN(10, ("rdpChangeWindowAttributes:"));
+ priv = GETWINPRIV(pWindow);
+ pScreen = pWindow->drawable.pScreen;
+ pScreen->ChangeWindowAttributes = g_rdpScreen.ChangeWindowAttributes;
+ rv = pScreen->ChangeWindowAttributes(pWindow, mask);
+ pScreen->ChangeWindowAttributes = rdpChangeWindowAttributes;
+
+ if (g_use_rail)
+ {
+ }
+
+ return rv;
}
/******************************************************************************/
void
rdpWindowExposures(WindowPtr pWindow, RegionPtr pRegion, RegionPtr pBSRegion)
{
- ScreenPtr pScreen;
- rdpWindowRec* priv;
-
- LLOGLN(10, ("rdpWindowExposures:"));
- priv = GETWINPRIV(pWindow);
- pScreen = pWindow->drawable.pScreen;
- pScreen->WindowExposures = g_rdpScreen.WindowExposures;
- pScreen->WindowExposures(pWindow, pRegion, pBSRegion);
- if (g_use_rail)
- {
- }
- pScreen->WindowExposures = rdpWindowExposures;
+ ScreenPtr pScreen;
+ rdpWindowRec *priv;
+
+ LLOGLN(10, ("rdpWindowExposures:"));
+ priv = GETWINPRIV(pWindow);
+ pScreen = pWindow->drawable.pScreen;
+ pScreen->WindowExposures = g_rdpScreen.WindowExposures;
+ pScreen->WindowExposures(pWindow, pRegion, pBSRegion);
+
+ if (g_use_rail)
+ {
+ }
+
+ pScreen->WindowExposures = rdpWindowExposures;
}
/******************************************************************************/
Bool
rdpCreateGC(GCPtr pGC)
{
- rdpGCRec* priv;
- Bool rv;
-
- LLOGLN(10, ("in rdpCreateGC\n"));
- priv = GETGCPRIV(pGC);
- g_pScreen->CreateGC = g_rdpScreen.CreateGC;
- rv = g_pScreen->CreateGC(pGC);
- if (rv)
- {
- priv->funcs = pGC->funcs;
- priv->ops = 0;
- pGC->funcs = &g_rdpGCFuncs;
- }
- else
- {
- rdpLog("error in rdpCreateGC, CreateGC failed\n");
- }
- g_pScreen->CreateGC = rdpCreateGC;
- return rv;
+ rdpGCRec *priv;
+ Bool rv;
+
+ LLOGLN(10, ("in rdpCreateGC\n"));
+ priv = GETGCPRIV(pGC);
+ g_pScreen->CreateGC = g_rdpScreen.CreateGC;
+ rv = g_pScreen->CreateGC(pGC);
+
+ if (rv)
+ {
+ priv->funcs = pGC->funcs;
+ priv->ops = 0;
+ pGC->funcs = &g_rdpGCFuncs;
+ }
+ else
+ {
+ rdpLog("error in rdpCreateGC, CreateGC failed\n");
+ }
+
+ g_pScreen->CreateGC = rdpCreateGC;
+ return rv;
}
/******************************************************************************/
void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
{
- RegionRec reg;
- RegionRec clip;
- int dx;
- int dy;
- int i;
- int j;
- int num_clip_rects;
- int num_reg_rects;
- BoxRec box1;
- BoxRec box2;
-
- LLOGLN(10, ("in rdpCopyWindow"));
- RegionInit(&reg, NullBox, 0);
- RegionCopy(&reg, pOldRegion);
- g_pScreen->CopyWindow = g_rdpScreen.CopyWindow;
- g_pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
- RegionInit(&clip, NullBox, 0);
- RegionCopy(&clip, &pWin->borderClip);
- dx = pWin->drawable.x - ptOldOrg.x;
- dy = pWin->drawable.y - ptOldOrg.y;
- if (g_do_dirty_ons)
- {
- LLOGLN(0, ("rdpCopyWindow: gettig dirty TODO"));
- //draw_item_add_srcblt_region
- }
- else
- {
- rdpup_begin_update();
- num_clip_rects = REGION_NUM_RECTS(&clip);
- num_reg_rects = REGION_NUM_RECTS(&reg);
- /* should maybe sort the rects instead of checking dy < 0 */
- /* If we can depend on the rects going from top to bottom, left
- to right we are ok */
- if (dy < 0 || (dy == 0 && dx < 0))
+ RegionRec reg;
+ RegionRec clip;
+ int dx;
+ int dy;
+ int i;
+ int j;
+ int num_clip_rects;
+ int num_reg_rects;
+ BoxRec box1;
+ BoxRec box2;
+
+ LLOGLN(10, ("in rdpCopyWindow"));
+ RegionInit(&reg, NullBox, 0);
+ RegionCopy(&reg, pOldRegion);
+ g_pScreen->CopyWindow = g_rdpScreen.CopyWindow;
+ g_pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
+ RegionInit(&clip, NullBox, 0);
+ RegionCopy(&clip, &pWin->borderClip);
+ dx = pWin->drawable.x - ptOldOrg.x;
+ dy = pWin->drawable.y - ptOldOrg.y;
+
+ if (g_do_dirty_ons)
{
- for (j = 0; j < num_clip_rects; j++)
- {
- box1 = REGION_RECTS(&clip)[j];
- rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1);
- for (i = 0; i < num_reg_rects; i++)
- {
- box2 = REGION_RECTS(&reg)[i];
- rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1,
- box2.y2 - box2.y1, box2.x1, box2.y1);
- }
- }
+ LLOGLN(0, ("rdpCopyWindow: gettig dirty TODO"));
+ //draw_item_add_srcblt_region
}
else
{
- for (j = num_clip_rects - 1; j >= 0; j--)
- {
- box1 = REGION_RECTS(&clip)[j];
- rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1);
- for (i = num_reg_rects - 1; i >= 0; i--)
+ rdpup_begin_update();
+ num_clip_rects = REGION_NUM_RECTS(&clip);
+ num_reg_rects = REGION_NUM_RECTS(&reg);
+
+ /* should maybe sort the rects instead of checking dy < 0 */
+ /* If we can depend on the rects going from top to bottom, left
+ to right we are ok */
+ if (dy < 0 || (dy == 0 && dx < 0))
+ {
+ for (j = 0; j < num_clip_rects; j++)
+ {
+ box1 = REGION_RECTS(&clip)[j];
+ rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1);
+
+ for (i = 0; i < num_reg_rects; i++)
+ {
+ box2 = REGION_RECTS(&reg)[i];
+ rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1,
+ box2.y2 - box2.y1, box2.x1, box2.y1);
+ }
+ }
+ }
+ else
{
- box2 = REGION_RECTS(&reg)[i];
- rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1,
- box2.y2 - box2.y1, box2.x1, box2.y1);
+ for (j = num_clip_rects - 1; j >= 0; j--)
+ {
+ box1 = REGION_RECTS(&clip)[j];
+ rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1);
+
+ for (i = num_reg_rects - 1; i >= 0; i--)
+ {
+ box2 = REGION_RECTS(&reg)[i];
+ rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1,
+ box2.y2 - box2.y1, box2.x1, box2.y1);
+ }
+ }
}
- }
+
+ rdpup_reset_clip();
+ rdpup_end_update();
}
- rdpup_reset_clip();
- rdpup_end_update();
- }
- RegionUninit(&reg);
- RegionUninit(&clip);
- g_pScreen->CopyWindow = rdpCopyWindow;
+
+ RegionUninit(&reg);
+ RegionUninit(&clip);
+ g_pScreen->CopyWindow = rdpCopyWindow;
}
/******************************************************************************/
@@ -959,133 +1025,148 @@ void
rdpClearToBackground(WindowPtr pWin, int x, int y, int w, int h,
Bool generateExposures)
{
- int j;
- BoxRec box;
- RegionRec reg;
-
- LLOGLN(10, ("in rdpClearToBackground"));
- g_pScreen->ClearToBackground = g_rdpScreen.ClearToBackground;
- g_pScreen->ClearToBackground(pWin, x, y, w, h, generateExposures);
- if (!generateExposures)
- {
- if (w > 0 && h > 0)
- {
- box.x1 = x;
- box.y1 = y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
- }
- else
- {
- box.x1 = pWin->drawable.x;
- box.y1 = pWin->drawable.y;
- box.x2 = box.x1 + pWin->drawable.width;
- box.y2 = box.y1 + pWin->drawable.height;
- }
- RegionInit(&reg, &box, 0);
- RegionIntersect(&reg, &reg, &pWin->clipList);
- if (g_do_dirty_ons)
- {
- draw_item_add_img_region(&g_screenPriv, &reg, GXcopy, RDI_IMGLL);
- }
- else
+ int j;
+ BoxRec box;
+ RegionRec reg;
+
+ LLOGLN(10, ("in rdpClearToBackground"));
+ g_pScreen->ClearToBackground = g_rdpScreen.ClearToBackground;
+ g_pScreen->ClearToBackground(pWin, x, y, w, h, generateExposures);
+
+ if (!generateExposures)
{
- rdpup_begin_update();
- for (j = REGION_NUM_RECTS(&reg) - 1; j >= 0; j--)
- {
- box = REGION_RECTS(&reg)[j];
- rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- }
- rdpup_end_update();
+ if (w > 0 && h > 0)
+ {
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ }
+ else
+ {
+ box.x1 = pWin->drawable.x;
+ box.y1 = pWin->drawable.y;
+ box.x2 = box.x1 + pWin->drawable.width;
+ box.y2 = box.y1 + pWin->drawable.height;
+ }
+
+ RegionInit(&reg, &box, 0);
+ RegionIntersect(&reg, &reg, &pWin->clipList);
+
+ if (g_do_dirty_ons)
+ {
+ draw_item_add_img_region(&g_screenPriv, &reg, GXcopy, RDI_IMGLL);
+ }
+ else
+ {
+ rdpup_begin_update();
+
+ for (j = REGION_NUM_RECTS(&reg) - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg)[j];
+ rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+
+ RegionUninit(&reg);
}
- RegionUninit(&reg);
- }
- g_pScreen->ClearToBackground = rdpClearToBackground;
+
+ g_pScreen->ClearToBackground = rdpClearToBackground;
}
/******************************************************************************/
RegionPtr
rdpRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed)
{
- RegionRec reg;
- RegionPtr rv;
- int j;
- BoxRec box;
-
- LLOGLN(0, ("in rdpRestoreAreas"));
- RegionInit(&reg, NullBox, 0);
- RegionCopy(&reg, prgnExposed);
- g_pScreen->RestoreAreas = g_rdpScreen.RestoreAreas;
- rv = g_pScreen->RestoreAreas(pWin, prgnExposed);
- if (g_do_dirty_ons)
- {
- draw_item_add_img_region(&g_screenPriv, &reg, GXcopy, RDI_IMGLL);
- }
- else
- {
- rdpup_begin_update();
- for (j = REGION_NUM_RECTS(&reg) - 1; j >= 0; j--)
+ RegionRec reg;
+ RegionPtr rv;
+ int j;
+ BoxRec box;
+
+ LLOGLN(0, ("in rdpRestoreAreas"));
+ RegionInit(&reg, NullBox, 0);
+ RegionCopy(&reg, prgnExposed);
+ g_pScreen->RestoreAreas = g_rdpScreen.RestoreAreas;
+ rv = g_pScreen->RestoreAreas(pWin, prgnExposed);
+
+ if (g_do_dirty_ons)
{
- box = REGION_RECTS(&reg)[j];
- rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ draw_item_add_img_region(&g_screenPriv, &reg, GXcopy, RDI_IMGLL);
}
- rdpup_end_update();
- }
- RegionUninit(&reg);
- g_pScreen->RestoreAreas = rdpRestoreAreas;
- return rv;
+ else
+ {
+ rdpup_begin_update();
+
+ for (j = REGION_NUM_RECTS(&reg) - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg)[j];
+ rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+
+ RegionUninit(&reg);
+ g_pScreen->RestoreAreas = rdpRestoreAreas;
+ return rv;
}
/******************************************************************************/
void
rdpInstallColormap(ColormapPtr pmap)
{
- ColormapPtr oldpmap;
+ ColormapPtr oldpmap;
- oldpmap = g_rdpInstalledColormap;
- if (pmap != oldpmap)
- {
- if (oldpmap != (ColormapPtr)None)
+ oldpmap = g_rdpInstalledColormap;
+
+ if (pmap != oldpmap)
{
- WalkTree(pmap->pScreen, TellLostMap, (char*)&oldpmap->mid);
+ if (oldpmap != (ColormapPtr)None)
+ {
+ WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
+ }
+
+ /* Install pmap */
+ g_rdpInstalledColormap = pmap;
+ WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
+ /*rfbSetClientColourMaps(0, 0);*/
}
- /* Install pmap */
- g_rdpInstalledColormap = pmap;
- WalkTree(pmap->pScreen, TellGainedMap, (char*)&pmap->mid);
- /*rfbSetClientColourMaps(0, 0);*/
- }
- /*g_rdpScreen.InstallColormap(pmap);*/
+
+ /*g_rdpScreen.InstallColormap(pmap);*/
}
/******************************************************************************/
void
rdpUninstallColormap(ColormapPtr pmap)
{
- ColormapPtr curpmap;
+ ColormapPtr curpmap;
+
+ curpmap = g_rdpInstalledColormap;
- curpmap = g_rdpInstalledColormap;
- if (pmap == curpmap)
- {
- if (pmap->mid != pmap->pScreen->defColormap)
+ if (pmap == curpmap)
{
- //curpmap = (ColormapPtr)LookupIDByType(pmap->pScreen->defColormap,
- // RT_COLORMAP);
- //pmap->pScreen->InstallColormap(curpmap);
+ if (pmap->mid != pmap->pScreen->defColormap)
+ {
+ //curpmap = (ColormapPtr)LookupIDByType(pmap->pScreen->defColormap,
+ // RT_COLORMAP);
+ //pmap->pScreen->InstallColormap(curpmap);
+ }
}
- }
}
/******************************************************************************/
int
-rdpListInstalledColormaps(ScreenPtr pScreen, Colormap* pmaps)
+rdpListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
- *pmaps = g_rdpInstalledColormap->mid;
- return 1;
+ *pmaps = g_rdpInstalledColormap->mid;
+ return 1;
}
/******************************************************************************/
void
-rdpStoreColors(ColormapPtr pmap, int ndef, xColorItem* pdefs)
+rdpStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs)
{
}
@@ -1093,7 +1174,7 @@ rdpStoreColors(ColormapPtr pmap, int ndef, xColorItem* pdefs)
Bool
rdpSaveScreen(ScreenPtr pScreen, int on)
{
- return 1;
+ return 1;
}
/******************************************************************************/
@@ -1103,150 +1184,160 @@ 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)
{
- BoxRec box;
- PictureScreenPtr ps;
- RegionRec reg1;
- RegionRec reg2;
- DrawablePtr p;
- int dirty_type;
- int j;
- int num_clips;
- int post_process;
- int reset_surface;
- int got_id;
- int lx;
- int ly;
- WindowPtr pDstWnd;
- PixmapPtr pDstPixmap;
- rdpPixmapRec* pDstPriv;
- rdpPixmapRec* pDirtyPriv;
- struct image_data id;
-
- LLOGLN(10, ("rdpComposite:"));
- ps = GetPictureScreen(g_pScreen);
- ps->Composite = g_rdpScreen.Composite;
- ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height);
- ps->Composite = rdpComposite;
-
- p = pDst->pDrawable;
-
- dirty_type = 0;
- pDirtyPriv = 0;
- post_process = 0;
- reset_surface = 0;
- got_id = 0;
- if (p->type == DRAWABLE_PIXMAP)
- {
- pDstPixmap = (PixmapPtr)p;
- pDstPriv = GETPIXPRIV(pDstPixmap);
- if (XRDP_IS_OS(pDstPriv))
+ BoxRec box;
+ PictureScreenPtr ps;
+ RegionRec reg1;
+ RegionRec reg2;
+ DrawablePtr p;
+ int dirty_type;
+ int j;
+ int num_clips;
+ int post_process;
+ int reset_surface;
+ int got_id;
+ int lx;
+ int ly;
+ WindowPtr pDstWnd;
+ PixmapPtr pDstPixmap;
+ rdpPixmapRec *pDstPriv;
+ rdpPixmapRec *pDirtyPriv;
+ struct image_data id;
+
+ LLOGLN(10, ("rdpComposite:"));
+ ps = GetPictureScreen(g_pScreen);
+ ps->Composite = g_rdpScreen.Composite;
+ ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc,
+ xMask, yMask, xDst, yDst, width, height);
+ ps->Composite = rdpComposite;
+
+ p = pDst->pDrawable;
+
+ dirty_type = 0;
+ pDirtyPriv = 0;
+ post_process = 0;
+ reset_surface = 0;
+ got_id = 0;
+
+ if (p->type == DRAWABLE_PIXMAP)
{
- post_process = 1;
- if (g_do_dirty_os)
- {
- LLOGLN(10, ("rdpComposite: gettig dirty"));
- pDstPriv->is_dirty = 1;
- dirty_type = g_doing_font ? RDI_IMGLL : RDI_IMGLY;
- pDirtyPriv = pDstPriv;
-
- }
- else
- {
- rdpup_switch_os_surface(pDstPriv->rdpindex);
- reset_surface = 1;
- rdpup_get_pixmap_image_rect(pDstPixmap, &id);
- got_id = 1;
- LLOGLN(10, ("rdpComposite: offscreen"));
- }
- }
- }
- else
- {
- if (p->type == DRAWABLE_WINDOW)
- {
- pDstWnd = (WindowPtr)p;
- if (pDstWnd->viewable)
- {
- post_process = 1;
- if (g_do_dirty_ons)
+ pDstPixmap = (PixmapPtr)p;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+
+ if (XRDP_IS_OS(pDstPriv))
{
- LLOGLN(0, ("rdpComposite: gettig dirty"));
- g_screenPriv.is_dirty = 1;
- pDirtyPriv = &g_screenPriv;
- dirty_type = RDI_IMGLL;
+ post_process = 1;
+
+ if (g_do_dirty_os)
+ {
+ LLOGLN(10, ("rdpComposite: gettig dirty"));
+ pDstPriv->is_dirty = 1;
+ dirty_type = g_doing_font ? RDI_IMGLL : RDI_IMGLY;
+ pDirtyPriv = pDstPriv;
+
+ }
+ else
+ {
+ rdpup_switch_os_surface(pDstPriv->rdpindex);
+ reset_surface = 1;
+ rdpup_get_pixmap_image_rect(pDstPixmap, &id);
+ got_id = 1;
+ LLOGLN(10, ("rdpComposite: offscreen"));
+ }
}
- else
+ }
+ else
+ {
+ pDstWnd = (WindowPtr)p;
+
+ if (pDstWnd->viewable)
{
- rdpup_get_screen_image_rect(&id);
- got_id = 1;
- LLOGLN(10, ("rdpComposite: screen"));
+ post_process = 1;
+
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(0, ("rdpComposite: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ LLOGLN(10, ("rdpComposite: screen"));
+ }
}
- }
}
- }
- if (!post_process)
- {
- return;
- }
-
- if (pDst->clientClipType == CT_REGION)
- {
- box.x1 = p->x + xDst;
- box.y1 = p->y + yDst;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
- RegionInit(&reg1, &box, 0);
- RegionInit(&reg2, NullBox, 0);
- RegionCopy(&reg2, pDst->clientClip);
- lx = p->x + pDst->clipOrigin.x;
- ly = p->y + pDst->clipOrigin.y;
- RegionTranslate(&reg2, lx, ly);
- RegionIntersect(&reg1, &reg1, &reg2);
- if (dirty_type != 0)
+
+ if (!post_process)
{
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ return;
}
- else if (got_id)
+
+ if (pDst->clientClipType == CT_REGION)
{
- num_clips = REGION_NUM_RECTS(&reg1);
- if (num_clips > 0)
- {
- rdpup_begin_update();
- for (j = num_clips - 1; j >= 0; j--)
+ box.x1 = p->x + xDst;
+ box.y1 = p->y + yDst;
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
+ RegionInit(&reg1, &box, 0);
+ RegionInit(&reg2, NullBox, 0);
+ RegionCopy(&reg2, pDst->clientClip);
+ lx = p->x + pDst->clipOrigin.x;
+ ly = p->y + pDst->clipOrigin.y;
+ RegionTranslate(&reg2, lx, ly);
+ RegionIntersect(&reg1, &reg1, &reg2);
+
+ if (dirty_type != 0)
{
- box = REGION_RECTS(&reg1)[j];
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
}
- rdpup_end_update();
- }
+ else if (got_id)
+ {
+ num_clips = REGION_NUM_RECTS(&reg1);
+
+ if (num_clips > 0)
+ {
+ rdpup_begin_update();
+
+ for (j = num_clips - 1; j >= 0; j--)
+ {
+ box = REGION_RECTS(&reg1)[j];
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_end_update();
+ }
+ }
+
+ RegionUninit(&reg1);
+ RegionUninit(&reg2);
}
- RegionUninit(&reg1);
- RegionUninit(&reg2);
- }
- else
- {
- box.x1 = p->x + xDst;
- box.y1 = p->y + yDst;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
- if (dirty_type != 0)
+ else
{
- RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
- RegionUninit(&reg1);
+ box.x1 = p->x + xDst;
+ box.y1 = p->y + yDst;
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
+
+ if (dirty_type != 0)
+ {
+ RegionInit(&reg1, &box, 0);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ RegionUninit(&reg1);
+ }
+ else if (got_id)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ rdpup_end_update();
+ }
}
- else if (got_id)
+
+ if (reset_surface)
{
- rdpup_begin_update();
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- rdpup_end_update();
+ rdpup_switch_os_surface(-1);
}
- }
- if (reset_surface)
- {
- rdpup_switch_os_surface(-1);
- }
}
/******************************************************************************/
@@ -1254,27 +1345,29 @@ void
rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
- GlyphPtr* glyphs)
+ GlyphPtr *glyphs)
{
- PictureScreenPtr ps;
- int index;
-
- LLOGLN(10, ("rdpGlyphs:"));
- LLOGLN(10, ("rdpGlyphs: nlists %d len %d", nlists, lists->len));
- rdpup_set_hints(1, 1);
- g_doing_font = 1;
- for (index = 0; index < lists->len; index++)
- {
- LLOGLN(10, (" index %d size %d refcnt %d width %d height %d",
- index, (int)(glyphs[index]->size), (int)(glyphs[index]->refcnt),
- glyphs[index]->info.width, glyphs[index]->info.height));
- }
- ps = GetPictureScreen(g_pScreen);
- ps->Glyphs = g_rdpScreen.Glyphs;
- ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc,
- nlists, lists, glyphs);
- ps->Glyphs = rdpGlyphs;
- rdpup_set_hints(0, 1);
- g_doing_font = 0;
- LLOGLN(10, ("rdpGlyphs: out"));
+ PictureScreenPtr ps;
+ int index;
+
+ LLOGLN(10, ("rdpGlyphs:"));
+ LLOGLN(10, ("rdpGlyphs: nlists %d len %d", nlists, lists->len));
+ rdpup_set_hints(1, 1);
+ g_doing_font = 1;
+
+ for (index = 0; index < lists->len; index++)
+ {
+ LLOGLN(10, (" index %d size %d refcnt %d width %d height %d",
+ index, (int)(glyphs[index]->size), (int)(glyphs[index]->refcnt),
+ glyphs[index]->info.width, glyphs[index]->info.height));
+ }
+
+ ps = GetPictureScreen(g_pScreen);
+ ps->Glyphs = g_rdpScreen.Glyphs;
+ ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc,
+ nlists, lists, glyphs);
+ ps->Glyphs = rdpGlyphs;
+ rdpup_set_hints(0, 1);
+ g_doing_font = 0;
+ LLOGLN(10, ("rdpGlyphs: out"));
}
diff --git a/xorg/X11R7.6/rdp/rdpinput.c b/xorg/X11R7.6/rdp/rdpinput.c
index 1256d0e0..b8e1746a 100644
--- a/xorg/X11R7.6/rdp/rdpinput.c
+++ b/xorg/X11R7.6/rdp/rdpinput.c
@@ -80,161 +80,161 @@ static int g_scroll_lock_down = 0;
#define NUM_LOCK_KEY_CODE 77
#define N_PREDEFINED_KEYS \
- (sizeof(g_kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY))
+ (sizeof(g_kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY))
/* Copied from Xvnc/lib/font/util/utilbitmap.c */
static unsigned char g_reverse_byte[0x100] =
{
- 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
- 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
- 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
- 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
- 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
- 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
- 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
- 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
- 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
- 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
- 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
- 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
- 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
- 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
- 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
- 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
- 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
- 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
- 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
- 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
- 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
- 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
- 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
- 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
- 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
- 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
- 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
- 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
- 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
- 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
- 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
- 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
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
+ 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
};
#if 0
@@ -242,346 +242,369 @@ static KeySym g_kbdMap[] =
static void
rdpSendBell(void)
{
- DEBUG_OUT_INPUT(("rdpSendBell\n"));
+ DEBUG_OUT_INPUT(("rdpSendBell\n"));
}
#endif
/******************************************************************************/
void
-KbdDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8* pModMap)
-{
- int i;
-
- DEBUG_OUT_INPUT(("KbdDeviceInit\n"));
- 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*)g_malloc(i, 1);
- if (pKeySyms->map == 0)
- {
- rdpLog("KbdDeviceInit g_malloc failed\n");
- exit(1);
- }
- 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];
- }
+KbdDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ int i;
+
+ DEBUG_OUT_INPUT(("KbdDeviceInit\n"));
+
+ 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 *)g_malloc(i, 1);
+
+ if (pKeySyms->map == 0)
+ {
+ rdpLog("KbdDeviceInit g_malloc failed\n");
+ exit(1);
+ }
+
+ 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];
+ }
}
/******************************************************************************/
void
KbdDeviceOn(void)
{
- DEBUG_OUT_INPUT(("KbdDeviceOn\n"));
+ DEBUG_OUT_INPUT(("KbdDeviceOn\n"));
}
/******************************************************************************/
void
KbdDeviceOff(void)
{
- DEBUG_OUT_INPUT(("KbdDeviceOff\n"));
+ DEBUG_OUT_INPUT(("KbdDeviceOff\n"));
}
/******************************************************************************/
void
rdpBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
{
- ErrorF("rdpBell:\n");
+ ErrorF("rdpBell:\n");
}
/******************************************************************************/
void
-rdpChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl* ctrl)
+rdpChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
{
- ErrorF("rdpChangeKeyboardControl:\n");
+ ErrorF("rdpChangeKeyboardControl:\n");
}
/******************************************************************************/
int
rdpKeybdProc(DeviceIntPtr pDevice, int onoff)
{
- KeySymsRec keySyms;
- CARD8 modMap[MAP_LENGTH];
- DevicePtr pDev;
- XkbRMLVOSet set;
-
- DEBUG_OUT_INPUT(("rdpKeybdProc\n"));
- pDev = (DevicePtr)pDevice;
- switch (onoff)
- {
- case DEVICE_INIT:
- KbdDeviceInit(pDevice, &keySyms, modMap);
- memset(&set, 0, sizeof(set));
- set.rules = "base";
- set.model = "pc104";
- set.layout = "us";
- set.variant = "";
- set.options = "";
- InitKeyboardDeviceStruct(pDevice, &set, rdpBell,
- rdpChangeKeyboardControl);
- //XkbDDXChangeControls(pDevice, 0, 0);
- break;
- case DEVICE_ON:
- pDev->on = 1;
- KbdDeviceOn();
- break;
- case DEVICE_OFF:
- pDev->on = 0;
- KbdDeviceOff();
- break;
- case DEVICE_CLOSE:
- if (pDev->on)
- {
- KbdDeviceOff();
- }
- break;
- }
- return Success;
+ KeySymsRec keySyms;
+ CARD8 modMap[MAP_LENGTH];
+ DevicePtr pDev;
+ XkbRMLVOSet set;
+
+ DEBUG_OUT_INPUT(("rdpKeybdProc\n"));
+ pDev = (DevicePtr)pDevice;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ KbdDeviceInit(pDevice, &keySyms, modMap);
+ memset(&set, 0, sizeof(set));
+ set.rules = "base";
+ set.model = "pc104";
+ set.layout = "us";
+ set.variant = "";
+ set.options = "";
+ InitKeyboardDeviceStruct(pDevice, &set, rdpBell,
+ rdpChangeKeyboardControl);
+ //XkbDDXChangeControls(pDevice, 0, 0);
+ break;
+ case DEVICE_ON:
+ pDev->on = 1;
+ KbdDeviceOn();
+ break;
+ case DEVICE_OFF:
+ pDev->on = 0;
+ KbdDeviceOff();
+ break;
+ case DEVICE_CLOSE:
+
+ if (pDev->on)
+ {
+ KbdDeviceOff();
+ }
+
+ break;
+ }
+
+ return Success;
}
/******************************************************************************/
void
-PtrDeviceControl(DeviceIntPtr dev, PtrCtrl* ctrl)
+PtrDeviceControl(DeviceIntPtr dev, PtrCtrl *ctrl)
{
- DEBUG_OUT_INPUT(("PtrDeviceControl\n"));
+ DEBUG_OUT_INPUT(("PtrDeviceControl\n"));
}
/******************************************************************************/
void
PtrDeviceInit(void)
{
- DEBUG_OUT_INPUT(("PtrDeviceInit\n"));
+ DEBUG_OUT_INPUT(("PtrDeviceInit\n"));
}
/******************************************************************************/
void
PtrDeviceOn(DeviceIntPtr pDev)
{
- DEBUG_OUT_INPUT(("PtrDeviceOn\n"));
+ DEBUG_OUT_INPUT(("PtrDeviceOn\n"));
}
/******************************************************************************/
void
PtrDeviceOff(void)
{
- DEBUG_OUT_INPUT(("PtrDeviceOff\n"));
+ DEBUG_OUT_INPUT(("PtrDeviceOff\n"));
}
/******************************************************************************/
static void
-rdpMouseCtrl(DeviceIntPtr pDevice, PtrCtrl* pCtrl)
+rdpMouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl)
{
- ErrorF("rdpMouseCtrl:\n");
+ ErrorF("rdpMouseCtrl:\n");
}
/******************************************************************************/
int
rdpMouseProc(DeviceIntPtr pDevice, int onoff)
{
- BYTE map[6];
- DevicePtr pDev;
- Atom btn_labels[6];
- Atom axes_labels[2];
-
- DEBUG_OUT_INPUT(("rdpMouseProc\n"));
- pDev = (DevicePtr)pDevice;
- switch (onoff)
- {
- case DEVICE_INIT:
- PtrDeviceInit();
- 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;
- PtrDeviceOn(pDevice);
- break;
- case DEVICE_OFF:
- pDev->on = 0;
- PtrDeviceOff();
- break;
- case DEVICE_CLOSE:
- if (pDev->on)
- {
- PtrDeviceOff();
- }
- break;
- }
- return Success;
+ BYTE map[6];
+ DevicePtr pDev;
+ Atom btn_labels[6];
+ Atom axes_labels[2];
+
+ DEBUG_OUT_INPUT(("rdpMouseProc\n"));
+ pDev = (DevicePtr)pDevice;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ PtrDeviceInit();
+ 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;
+ PtrDeviceOn(pDevice);
+ break;
+ case DEVICE_OFF:
+ pDev->on = 0;
+ PtrDeviceOff();
+ break;
+ case DEVICE_CLOSE:
+
+ if (pDev->on)
+ {
+ PtrDeviceOff();
+ }
+
+ break;
+ }
+
+ return Success;
}
/******************************************************************************/
Bool
-rdpCursorOffScreen(ScreenPtr* ppScreen, int* x, int* y)
+rdpCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
{
- DEBUG_OUT_INPUT(("rdpCursorOffScreen\n"));
- return 0;
+ DEBUG_OUT_INPUT(("rdpCursorOffScreen\n"));
+ return 0;
}
/******************************************************************************/
void
rdpCrossScreen(ScreenPtr pScreen, Bool entering)
{
- DEBUG_OUT_INPUT(("rdpCrossScreen\n"));
+ DEBUG_OUT_INPUT(("rdpCrossScreen\n"));
}
/******************************************************************************/
void
rdpPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y)
{
- ErrorF("rdpPointerWarpCursor:\n");
- miPointerWarpCursor(pDev, pScr, x, y);
+ ErrorF("rdpPointerWarpCursor:\n");
+ miPointerWarpCursor(pDev, pScr, x, y);
}
/******************************************************************************/
void
-rdpPointerEnqueueEvent(DeviceIntPtr pDev, InternalEvent* event)
+rdpPointerEnqueueEvent(DeviceIntPtr pDev, InternalEvent *event)
{
- ErrorF("rdpPointerEnqueueEvent:\n");
+ ErrorF("rdpPointerEnqueueEvent:\n");
}
/******************************************************************************/
void
rdpPointerNewEventScreen(DeviceIntPtr pDev, ScreenPtr pScr, Bool fromDIX)
{
- ErrorF("rdpPointerNewEventScreen:\n");
+ ErrorF("rdpPointerNewEventScreen:\n");
}
/******************************************************************************/
Bool
rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
{
- DEBUG_OUT_INPUT(("rdpSpriteRealizeCursor\n"));
- return 1;
+ DEBUG_OUT_INPUT(("rdpSpriteRealizeCursor\n"));
+ return 1;
}
/******************************************************************************/
Bool
rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
{
- DEBUG_OUT_INPUT(("hi rdpSpriteUnrealizeCursor\n"));
- return 1;
+ DEBUG_OUT_INPUT(("hi rdpSpriteUnrealizeCursor\n"));
+ return 1;
}
/******************************************************************************/
int
-get_pixel_safe(char* data, int x, int y, int width, int height, int bpp)
+get_pixel_safe(char *data, int x, int y, int width, int height, int bpp)
{
- int start;
- int shift;
- int c;
+ int start;
+ int shift;
+ int c;
- if (x < 0)
- {
- return 0;
- }
- if (y < 0)
- {
- return 0;
- }
- if (x >= width)
- {
- return 0;
- }
- if (y >= height)
- {
- return 0;
- }
- if (bpp == 1)
- {
- width = (width + 7) / 8;
- start = (y * width) + x / 8;
- shift = x % 8;
- c = (unsigned char)(data[start]);
+ if (x < 0)
+ {
+ return 0;
+ }
+
+ if (y < 0)
+ {
+ return 0;
+ }
+
+ if (x >= width)
+ {
+ return 0;
+ }
+
+ if (y >= height)
+ {
+ return 0;
+ }
+
+ if (bpp == 1)
+ {
+ width = (width + 7) / 8;
+ start = (y * width) + x / 8;
+ shift = x % 8;
+ c = (unsigned char)(data[start]);
#if (X_BYTE_ORDER == X_LITTLE_ENDIAN)
- return (g_reverse_byte[c] & (0x80 >> shift)) != 0;
+ return (g_reverse_byte[c] & (0x80 >> shift)) != 0;
#else
- return (c & (0x80 >> shift)) != 0;
+ return (c & (0x80 >> shift)) != 0;
#endif
- }
- return 0;
+ }
+
+ return 0;
}
/******************************************************************************/
void
-set_pixel_safe(char* data, int x, int y, int width, int height, int bpp,
+set_pixel_safe(char *data, int x, int y, int width, int height, int bpp,
int pixel)
{
- int start;
- int shift;
-
- if (x < 0)
- {
- return;
- }
- if (y < 0)
- {
- return;
- }
- if (x >= width)
- {
- return;
- }
- if (y >= height)
- {
- return;
- }
- if (bpp == 1)
- {
- width = (width + 7) / 8;
- start = (y * width) + x / 8;
- shift = x % 8;
- if (pixel & 1)
- {
- data[start] = data[start] | (0x80 >> shift);
- }
- else
- {
- data[start] = data[start] & ~(0x80 >> shift);
- }
- }
- else if (bpp == 24)
- {
- *(data + (3 * (y * width + x)) + 0) = pixel >> 0;
- *(data + (3 * (y * width + x)) + 1) = pixel >> 8;
- *(data + (3 * (y * width + x)) + 2) = pixel >> 16;
- }
+ int start;
+ int shift;
+
+ if (x < 0)
+ {
+ return;
+ }
+
+ if (y < 0)
+ {
+ return;
+ }
+
+ if (x >= width)
+ {
+ return;
+ }
+
+ if (y >= height)
+ {
+ return;
+ }
+
+ if (bpp == 1)
+ {
+ width = (width + 7) / 8;
+ start = (y * width) + x / 8;
+ shift = x % 8;
+
+ if (pixel & 1)
+ {
+ data[start] = data[start] | (0x80 >> shift);
+ }
+ else
+ {
+ data[start] = data[start] & ~(0x80 >> shift);
+ }
+ }
+ else if (bpp == 24)
+ {
+ *(data + (3 * (y * width + x)) + 0) = pixel >> 0;
+ *(data + (3 * (y * width + x)) + 1) = pixel >> 8;
+ *(data + (3 * (y * width + x)) + 2) = pixel >> 16;
+ }
}
/******************************************************************************/
@@ -589,217 +612,231 @@ void
rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y)
{
- char cur_data[32 * (32 * 3)];
- char cur_mask[32 * (32 / 8)];
- char* mask;
- char* data;
- int i;
- int j;
- int w;
- int h;
- int p;
- int xhot;
- int yhot;
- int paddedRowBytes;
- int fgcolor;
- int bgcolor;
-
- if (pCurs == 0)
- {
- return;
- }
- if (pCurs->bits == 0)
- {
- return;
- }
- w = pCurs->bits->width;
- h = pCurs->bits->height;
- paddedRowBytes = PixmapBytePad(w, 1);
- xhot = pCurs->bits->xhot;
- yhot = pCurs->bits->yhot;
- /* ErrorF("xhot %d yhot %d\n", xhot, yhot); */
- data = (char*)(pCurs->bits->source);
- mask = (char*)(pCurs->bits->mask);
- fgcolor = (((pCurs->foreRed >> 8) & 0xff) << 16) |
- (((pCurs->foreGreen >> 8) & 0xff) << 8) |
- ((pCurs->foreBlue >> 8) & 0xff);
- bgcolor = (((pCurs->backRed >> 8) & 0xff) << 16) |
- (((pCurs->backGreen >> 8) & 0xff) << 8) |
- ((pCurs->backBlue >> 8) & 0xff);
- memset(cur_data, 0, sizeof(cur_data));
- memset(cur_mask, 0, sizeof(cur_mask));
- for (j = 0; j < 32; j++)
- {
- for (i = 0; i < 32; i++)
- {
- p = get_pixel_safe(mask, i, j, paddedRowBytes * 8, h, 1);
- set_pixel_safe(cur_mask, i, 31 - j, 32, 32, 1, !p);
- if (p != 0)
- {
- p = get_pixel_safe(data, i, j, paddedRowBytes * 8, h, 1);
- p = p ? fgcolor : bgcolor;
- set_pixel_safe(cur_data, i, 31 - j, 32, 32, 24, p);
- }
- }
- }
- rdpup_begin_update();
- rdpup_set_cursor(xhot, yhot, cur_data, cur_mask);
- rdpup_end_update();
+ char cur_data[32 * (32 * 3)];
+ char cur_mask[32 * (32 / 8)];
+ char *mask;
+ char *data;
+ int i;
+ int j;
+ int w;
+ int h;
+ int p;
+ int xhot;
+ int yhot;
+ int paddedRowBytes;
+ int fgcolor;
+ int bgcolor;
+
+ if (pCurs == 0)
+ {
+ return;
+ }
+
+ if (pCurs->bits == 0)
+ {
+ return;
+ }
+
+ w = pCurs->bits->width;
+ h = pCurs->bits->height;
+ paddedRowBytes = PixmapBytePad(w, 1);
+ xhot = pCurs->bits->xhot;
+ yhot = pCurs->bits->yhot;
+ /* ErrorF("xhot %d yhot %d\n", xhot, yhot); */
+ data = (char *)(pCurs->bits->source);
+ mask = (char *)(pCurs->bits->mask);
+ fgcolor = (((pCurs->foreRed >> 8) & 0xff) << 16) |
+ (((pCurs->foreGreen >> 8) & 0xff) << 8) |
+ ((pCurs->foreBlue >> 8) & 0xff);
+ bgcolor = (((pCurs->backRed >> 8) & 0xff) << 16) |
+ (((pCurs->backGreen >> 8) & 0xff) << 8) |
+ ((pCurs->backBlue >> 8) & 0xff);
+ memset(cur_data, 0, sizeof(cur_data));
+ memset(cur_mask, 0, sizeof(cur_mask));
+
+ for (j = 0; j < 32; j++)
+ {
+ for (i = 0; i < 32; i++)
+ {
+ p = get_pixel_safe(mask, i, j, paddedRowBytes * 8, h, 1);
+ set_pixel_safe(cur_mask, i, 31 - j, 32, 32, 1, !p);
+
+ if (p != 0)
+ {
+ p = get_pixel_safe(data, i, j, paddedRowBytes * 8, h, 1);
+ p = p ? fgcolor : bgcolor;
+ set_pixel_safe(cur_data, i, 31 - j, 32, 32, 24, p);
+ }
+ }
+ }
+
+ rdpup_begin_update();
+ rdpup_set_cursor(xhot, yhot, cur_data, cur_mask);
+ rdpup_end_update();
}
/******************************************************************************/
void
rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y)
{
- DEBUG_OUT_INPUT(("hi rdpSpriteMoveCursor\n"));
+ DEBUG_OUT_INPUT(("hi rdpSpriteMoveCursor\n"));
}
/******************************************************************************/
Bool
rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
{
- ErrorF("rdpSpriteDeviceCursorInitialize:\n");
- return 1;
+ ErrorF("rdpSpriteDeviceCursorInitialize:\n");
+ return 1;
}
/******************************************************************************/
void
rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
{
- ErrorF("rdpSpriteDeviceCursorCleanup:\n");
+ ErrorF("rdpSpriteDeviceCursorCleanup:\n");
}
/******************************************************************************/
static void
rdpEnqueueMotion(int x, int y)
{
- int i;
- int n;
- int valuators[2];
- EventListPtr rdp_events;
- xEvent* pev;
+ int i;
+ int n;
+ int valuators[2];
+ EventListPtr rdp_events;
+ xEvent *pev;
# if 0
- if (x < 128)
- {
- rdpup_begin_update();
- rdpup_send_area(0, 0, 1024, 768);
- rdpup_end_update();
- }
+
+ if (x < 128)
+ {
+ rdpup_begin_update();
+ rdpup_send_area(0, 0, 1024, 768);
+ rdpup_end_update();
+ }
+
#endif
- miPointerSetPosition(g_pointer, &x, &y);
- valuators[0] = x;
- valuators[1] = y;
+ miPointerSetPosition(g_pointer, &x, &y);
+ valuators[0] = x;
+ valuators[1] = y;
+
+ GetEventList(&rdp_events);
+ n = GetPointerEvents(rdp_events, g_pointer, MotionNotify, 0,
+ POINTER_ABSOLUTE | POINTER_SCREEN,
+ 0, 2, valuators);
- GetEventList(&rdp_events);
- n = GetPointerEvents(rdp_events, g_pointer, MotionNotify, 0,
- POINTER_ABSOLUTE | POINTER_SCREEN,
- 0, 2, valuators);
- for (i = 0; i < n; i++)
- {
- pev = (rdp_events + i)->event;
- mieqEnqueue(g_pointer, (InternalEvent*)pev);
- }
+ for (i = 0; i < n; i++)
+ {
+ pev = (rdp_events + i)->event;
+ mieqEnqueue(g_pointer, (InternalEvent *)pev);
+ }
}
/******************************************************************************/
static void
rdpEnqueueButton(int type, int buttons)
{
- int i;
- int n;
- EventListPtr rdp_events;
- xEvent* pev;
+ int i;
+ int n;
+ EventListPtr rdp_events;
+ xEvent *pev;
- i = GetEventList(&rdp_events);
- n = GetPointerEvents(rdp_events, g_pointer, type, buttons, 0, 0, 0, 0);
- for (i = 0; i < n; i++)
- {
- pev = (rdp_events + i)->event;
- mieqEnqueue(g_pointer, (InternalEvent*)pev);
- }
+ i = GetEventList(&rdp_events);
+ n = GetPointerEvents(rdp_events, g_pointer, type, buttons, 0, 0, 0, 0);
+
+ for (i = 0; i < n; i++)
+ {
+ pev = (rdp_events + i)->event;
+ mieqEnqueue(g_pointer, (InternalEvent *)pev);
+ }
}
/******************************************************************************/
static void
rdpEnqueueKey(int type, int scancode)
{
- int i;
- int n;
- EventListPtr rdp_events;
- xEvent* pev;
+ int i;
+ int n;
+ EventListPtr rdp_events;
+ xEvent *pev;
+
+ i = GetEventList(&rdp_events);
+ n = GetKeyboardEvents(rdp_events, g_keyboard, type, scancode);
- i = GetEventList(&rdp_events);
- n = GetKeyboardEvents(rdp_events, g_keyboard, type, scancode);
- for (i = 0; i < n; i++)
- {
- pev = (rdp_events + i)->event;
- mieqEnqueue(g_keyboard, (InternalEvent*)pev);
- }
+ for (i = 0; i < n; i++)
+ {
+ pev = (rdp_events + i)->event;
+ mieqEnqueue(g_keyboard, (InternalEvent *)pev);
+ }
}
/******************************************************************************/
void
PtrAddEvent(int buttonMask, int x, int y)
{
- int i;
- int type;
- int buttons;
+ int i;
+ int type;
+ int buttons;
- rdpEnqueueMotion(x, y);
- for (i = 0; i < 5; i++)
- {
- if ((buttonMask ^ g_old_button_mask) & (1 << i))
+ rdpEnqueueMotion(x, y);
+
+ for (i = 0; i < 5; i++)
{
- if (buttonMask & (1 << i))
- {
- type = ButtonPress;
- buttons = i + 1;
- rdpEnqueueButton(type, buttons);
- }
- else
- {
- type = ButtonRelease;
- buttons = i + 1;
- rdpEnqueueButton(type, buttons);
- }
+ if ((buttonMask ^ g_old_button_mask) & (1 << i))
+ {
+ if (buttonMask & (1 << i))
+ {
+ type = ButtonPress;
+ buttons = i + 1;
+ rdpEnqueueButton(type, buttons);
+ }
+ else
+ {
+ type = ButtonRelease;
+ buttons = i + 1;
+ rdpEnqueueButton(type, buttons);
+ }
+ }
}
- }
- g_old_button_mask = buttonMask;
+
+ g_old_button_mask = buttonMask;
}
/******************************************************************************/
void
check_keysa(void)
{
- if (g_ctrl_down != 0)
- {
- rdpEnqueueKey(KeyRelease, g_ctrl_down);
- g_ctrl_down = 0;
- }
- if (g_alt_down != 0)
- {
- rdpEnqueueKey(KeyRelease, g_alt_down);
- g_alt_down = 0;
- }
- if (g_shift_down != 0)
- {
- rdpEnqueueKey(KeyRelease, g_shift_down);
- g_shift_down = 0;
- }
+ if (g_ctrl_down != 0)
+ {
+ rdpEnqueueKey(KeyRelease, g_ctrl_down);
+ g_ctrl_down = 0;
+ }
+
+ if (g_alt_down != 0)
+ {
+ rdpEnqueueKey(KeyRelease, g_alt_down);
+ g_alt_down = 0;
+ }
+
+ if (g_shift_down != 0)
+ {
+ rdpEnqueueKey(KeyRelease, g_shift_down);
+ g_shift_down = 0;
+ }
}
/******************************************************************************/
void
sendDownUpKeyEvent(int type, int x_scancode)
{
- /* if type is keydown, send keydown + keyup */
- /* this allows us to ignore keyup events */
- if (type == KeyPress)
- {
- rdpEnqueueKey(KeyPress, x_scancode);
- rdpEnqueueKey(KeyRelease, x_scancode);
- }
+ /* if type is keydown, send keydown + keyup */
+ /* this allows us to ignore keyup events */
+ if (type == KeyPress)
+ {
+ rdpEnqueueKey(KeyPress, x_scancode);
+ rdpEnqueueKey(KeyRelease, x_scancode);
+ }
}
/**
@@ -812,182 +849,192 @@ sendDownUpKeyEvent(int type, int x_scancode)
void
KbdAddEvent(int down, int param1, int param2, int param3, int param4)
{
- int rdp_scancode;
- int x_scancode;
- int is_ext;
- int is_spe;
- int type;
+ int rdp_scancode;
+ int x_scancode;
+ int is_ext;
+ int is_spe;
+ int type;
#if 0
- fprintf(stderr, "down=0x%x param1=0x%x param2=0x%x param3=0x%x "
- "param4=0x%x\n", down, param1, param2, param3, param4);
+ fprintf(stderr, "down=0x%x param1=0x%x param2=0x%x param3=0x%x "
+ "param4=0x%x\n", down, param1, param2, param3, param4);
#endif
- type = down ? KeyPress : KeyRelease;
- rdp_scancode = param3;
- is_ext = param4 & 256; /* 0x100 */
- is_spe = param4 & 512; /* 0x200 */
- x_scancode = 0;
-
- switch (rdp_scancode)
- {
- case 58: /* caps lock */
- case 42: /* left shift */
- case 54: /* right shift */
- case 70: /* scroll lock */
- x_scancode = rdp_scancode + MIN_KEY_CODE;
- if (x_scancode > 0)
- {
- rdpEnqueueKey(type, x_scancode);
- }
-
- break;
-
- case 56: /* left - right alt button */
- if (is_ext)
- {
- x_scancode = 113; /* right alt button */
- }
- else
- {
- x_scancode = 64; /* left alt button */
- }
-
- rdpEnqueueKey(type, x_scancode);
- break;
-
- case 15: /* tab */
- if (!down && !g_tab_down)
- {
- check_keysa(); /* leave x_scancode 0 here, we don't want the tab key up */
- }
- else
- {
- sendDownUpKeyEvent(type, 23);
- }
-
- g_tab_down = down;
- break;
-
- case 29: /* left or right ctrl */
- /* this is to handle special case with pause key sending control first */
- if (is_spe)
- {
- if (down)
- {
- g_pause_spe = 1;
- /* leave x_scancode 0 here, we don't want the control key down */
- }
- }
- else
- {
- x_scancode = is_ext ? 109 : 37;
- g_ctrl_down = down ? x_scancode : 0;
- rdpEnqueueKey(type, x_scancode);
- }
- break;
-
- case 69: /* Pause or Num Lock */
- if (g_pause_spe)
- {
- x_scancode = 110;
- if (!down)
- {
- g_pause_spe = 0;
- }
- }
- else
- {
- x_scancode = g_ctrl_down ? 110 : 77;
- }
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 28: /* Enter or Return */
- x_scancode = is_ext ? 108 : 36;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 53: /* / */
- x_scancode = is_ext ? 112 : 61;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 55: /* * on KP or Print Screen */
- x_scancode = is_ext ? 111 : 63;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 71: /* 7 or Home */
- x_scancode = is_ext ? 97 : 79;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 72: /* 8 or Up */
- x_scancode = is_ext ? 98 : 80;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 73: /* 9 or PgUp */
- x_scancode = is_ext ? 99 : 81;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 75: /* 4 or Left */
- x_scancode = is_ext ? 100 : 83;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 77: /* 6 or Right */
- x_scancode = is_ext ? 102 : 85;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 79: /* 1 or End */
- x_scancode = is_ext ? 103 : 87;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 80: /* 2 or Down */
- x_scancode = is_ext ? 104 : 88;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 81: /* 3 or PgDn */
- x_scancode = is_ext ? 105 : 89;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 82: /* 0 or Insert */
- x_scancode = is_ext ? 106 : 90;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 83: /* . or Delete */
- x_scancode = is_ext ? 107 : 91;
- sendDownUpKeyEvent(type, x_scancode);
- break;
-
- case 91: /* left win key */
- rdpEnqueueKey(type, 115);
- break;
-
- case 92: /* right win key */
- rdpEnqueueKey(type, 116);
- break;
-
- case 93: /* menu key */
- rdpEnqueueKey(type, 117);
- break;
-
- default:
- x_scancode = rdp_scancode + MIN_KEY_CODE;
- if (x_scancode > 0)
- {
- sendDownUpKeyEvent(type, x_scancode);
- }
- break;
- }
+ type = down ? KeyPress : KeyRelease;
+ rdp_scancode = param3;
+ is_ext = param4 & 256; /* 0x100 */
+ is_spe = param4 & 512; /* 0x200 */
+ x_scancode = 0;
+
+ switch (rdp_scancode)
+ {
+ case 58: /* caps lock */
+ case 42: /* left shift */
+ case 54: /* right shift */
+ case 70: /* scroll lock */
+ x_scancode = rdp_scancode + MIN_KEY_CODE;
+
+ if (x_scancode > 0)
+ {
+ rdpEnqueueKey(type, x_scancode);
+ }
+
+ break;
+
+ case 56: /* left - right alt button */
+
+ if (is_ext)
+ {
+ x_scancode = 113; /* right alt button */
+ }
+ else
+ {
+ x_scancode = 64; /* left alt button */
+ }
+
+ rdpEnqueueKey(type, x_scancode);
+ break;
+
+ case 15: /* tab */
+
+ if (!down && !g_tab_down)
+ {
+ check_keysa(); /* leave x_scancode 0 here, we don't want the tab key up */
+ }
+ else
+ {
+ sendDownUpKeyEvent(type, 23);
+ }
+
+ g_tab_down = down;
+ break;
+
+ case 29: /* left or right ctrl */
+
+ /* this is to handle special case with pause key sending control first */
+ if (is_spe)
+ {
+ if (down)
+ {
+ g_pause_spe = 1;
+ /* leave x_scancode 0 here, we don't want the control key down */
+ }
+ }
+ else
+ {
+ x_scancode = is_ext ? 109 : 37;
+ g_ctrl_down = down ? x_scancode : 0;
+ rdpEnqueueKey(type, x_scancode);
+ }
+
+ break;
+
+ case 69: /* Pause or Num Lock */
+
+ if (g_pause_spe)
+ {
+ x_scancode = 110;
+
+ if (!down)
+ {
+ g_pause_spe = 0;
+ }
+ }
+ else
+ {
+ x_scancode = g_ctrl_down ? 110 : 77;
+ }
+
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 28: /* Enter or Return */
+ x_scancode = is_ext ? 108 : 36;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 53: /* / */
+ x_scancode = is_ext ? 112 : 61;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 55: /* * on KP or Print Screen */
+ x_scancode = is_ext ? 111 : 63;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 71: /* 7 or Home */
+ x_scancode = is_ext ? 97 : 79;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 72: /* 8 or Up */
+ x_scancode = is_ext ? 98 : 80;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 73: /* 9 or PgUp */
+ x_scancode = is_ext ? 99 : 81;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 75: /* 4 or Left */
+ x_scancode = is_ext ? 100 : 83;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 77: /* 6 or Right */
+ x_scancode = is_ext ? 102 : 85;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 79: /* 1 or End */
+ x_scancode = is_ext ? 103 : 87;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 80: /* 2 or Down */
+ x_scancode = is_ext ? 104 : 88;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 81: /* 3 or PgDn */
+ x_scancode = is_ext ? 105 : 89;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 82: /* 0 or Insert */
+ x_scancode = is_ext ? 106 : 90;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 83: /* . or Delete */
+ x_scancode = is_ext ? 107 : 91;
+ sendDownUpKeyEvent(type, x_scancode);
+ break;
+
+ case 91: /* left win key */
+ rdpEnqueueKey(type, 115);
+ break;
+
+ case 92: /* right win key */
+ rdpEnqueueKey(type, 116);
+ break;
+
+ case 93: /* menu key */
+ rdpEnqueueKey(type, 117);
+ break;
+
+ default:
+ x_scancode = rdp_scancode + MIN_KEY_CODE;
+
+ if (x_scancode > 0)
+ {
+ sendDownUpKeyEvent(type, x_scancode);
+ }
+
+ break;
+ }
}
/******************************************************************************/
@@ -997,26 +1044,28 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
void
KbdSync(int param1)
{
- int xkb_state;
-
- xkb_state = XkbStateFieldFromRec(&(g_keyboard->key->xkbInfo->state));
- if ((!(xkb_state & 0x02)) != (!(param1 & 4))) /* caps lock */
- {
- ErrorF("KbdSync: toggling caps lock\n");
- KbdAddEvent(1, 58, 0, 58, 0);
- KbdAddEvent(0, 58, 49152, 58, 49152);
- }
-
- if ((!(xkb_state & 0x10)) != (!(param1 & 2))) /* num lock */
- {
- ErrorF("KbdSync: toggling num lock\n");
- KbdAddEvent(1, 69, 0, 69, 0);
- KbdAddEvent(0, 69, 49152, 69, 49152);
- }
- if ((!(g_scroll_lock_down)) != (!(param1 & 1))) /* scroll lock */
- {
- ErrorF("KbdSync: toggling scroll lock\n");
- KbdAddEvent(1, 70, 0, 70, 0);
- KbdAddEvent(0, 70, 49152, 70, 49152);
- }
+ int xkb_state;
+
+ xkb_state = XkbStateFieldFromRec(&(g_keyboard->key->xkbInfo->state));
+
+ if ((!(xkb_state & 0x02)) != (!(param1 & 4))) /* caps lock */
+ {
+ ErrorF("KbdSync: toggling caps lock\n");
+ KbdAddEvent(1, 58, 0, 58, 0);
+ KbdAddEvent(0, 58, 49152, 58, 49152);
+ }
+
+ if ((!(xkb_state & 0x10)) != (!(param1 & 2))) /* num lock */
+ {
+ ErrorF("KbdSync: toggling num lock\n");
+ KbdAddEvent(1, 69, 0, 69, 0);
+ KbdAddEvent(0, 69, 49152, 69, 49152);
+ }
+
+ if ((!(g_scroll_lock_down)) != (!(param1 & 1))) /* scroll lock */
+ {
+ ErrorF("KbdSync: toggling scroll lock\n");
+ KbdAddEvent(1, 70, 0, 70, 0);
+ KbdAddEvent(0, 70, 49152, 70, 49152);
+ }
}
diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c
index 8e9a3ba2..bb0c34b4 100644
--- a/xorg/X11R7.6/rdp/rdpmain.c
+++ b/xorg/X11R7.6/rdp/rdpmain.c
@@ -72,33 +72,33 @@ static int g_initOutputCalled = 0;
/* Common pixmap formats */
static PixmapFormatRec g_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 },
+ { 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 g_numFormats = 7;
static miPointerSpriteFuncRec g_rdpSpritePointerFuncs =
{
- /* these are in rdpinput.c */
- rdpSpriteRealizeCursor,
- rdpSpriteUnrealizeCursor,
- rdpSpriteSetCursor,
- rdpSpriteMoveCursor,
- rdpSpriteDeviceCursorInitialize,
- rdpSpriteDeviceCursorCleanup
+ /* these are in rdpinput.c */
+ rdpSpriteRealizeCursor,
+ rdpSpriteUnrealizeCursor,
+ rdpSpriteSetCursor,
+ rdpSpriteMoveCursor,
+ rdpSpriteDeviceCursorInitialize,
+ rdpSpriteDeviceCursorCleanup
};
static miPointerScreenFuncRec g_rdpPointerCursorFuncs =
{
- /* these are in rdpinput.c */
- rdpCursorOffScreen,
- rdpCrossScreen,
- rdpPointerWarpCursor,
- rdpPointerEnqueueEvent,
- rdpPointerNewEventScreen
+ /* these are in rdpinput.c */
+ rdpCursorOffScreen,
+ rdpCrossScreen,
+ rdpPointerWarpCursor,
+ rdpPointerEnqueueEvent,
+ rdpPointerNewEventScreen
};
/******************************************************************************/
@@ -106,55 +106,57 @@ static miPointerScreenFuncRec g_rdpPointerCursorFuncs =
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 == 15)
- {
- g_Bpp = 2;
- g_Bpp_mask = 0x7fff;
- g_redBits = 5;
- g_greenBits = 5;
- g_blueBits = 5;
- }
- 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 == 24)
- {
- g_Bpp = 4;
- g_Bpp_mask = 0xffffff;
- g_redBits = 8;
- g_greenBits = 8;
- g_blueBits = 8;
- }
- 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;
+ 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 == 15)
+ {
+ g_Bpp = 2;
+ g_Bpp_mask = 0x7fff;
+ g_redBits = 5;
+ g_greenBits = 5;
+ g_blueBits = 5;
+ }
+ 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 == 24)
+ {
+ g_Bpp = 4;
+ g_Bpp_mask = 0xffffff;
+ g_redBits = 8;
+ g_greenBits = 8;
+ g_blueBits = 8;
+ }
+ 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;
}
/******************************************************************************/
@@ -162,9 +164,9 @@ 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;
+ g_pScreen->WakeupHandler = g_rdpScreen.WakeupHandler;
+ g_pScreen->WakeupHandler(i, blockData, err, pReadmask);
+ g_pScreen->WakeupHandler = rdpWakeupHandler;
}
/******************************************************************************/
@@ -177,7 +179,7 @@ rdpBlockHandler1(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
static void
rdpWakeupHandler1(pointer blockData, int result, pointer pReadmask)
{
- rdpup_check();
+ rdpup_check();
}
#if 0
@@ -185,15 +187,15 @@ rdpWakeupHandler1(pointer blockData, int result, pointer pReadmask)
static Bool
rdpDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- ErrorF("rdpDeviceCursorInitializeProcPtr:\n");
- return 1;
+ ErrorF("rdpDeviceCursorInitializeProcPtr:\n");
+ return 1;
}
/******************************************************************************/
static void
rdpDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- ErrorF("rdpDeviceCursorCleanupProcPtr:\n");
+ ErrorF("rdpDeviceCursorCleanupProcPtr:\n");
}
#endif
@@ -202,302 +204,328 @@ rdpDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
Bool
rdpCreateColormap(ColormapPtr pCmap)
{
- ErrorF("rdpCreateColormap:\n");
- return 1;
+ ErrorF("rdpCreateColormap:\n");
+ return 1;
}
/******************************************************************************/
static void
rdpDestroyColormap(ColormapPtr pColormap)
{
- ErrorF("rdpDestroyColormap:\n");
+ ErrorF("rdpDestroyColormap:\n");
}
#endif
/******************************************************************************/
/* returns boolean, true if everything is ok */
static Bool
-rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
+rdpScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
{
- int dpix;
- int dpiy;
- int ret;
- Bool vis_found;
- VisualPtr vis;
- PictureScreenPtr ps;
- rrScrPrivPtr pRRScrPriv;
-
- g_pScreen = pScreen;
- memset(&g_screenPriv, 0, sizeof(g_screenPriv));
-
- /*dpix = 75;
- dpiy = 75;*/
- dpix = PixelDPI;
- dpiy = PixelDPI;
- 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("\n");
- ErrorF("X11rdp, an X server for xrdp\n");
- ErrorF("Version %s\n", X11RDPVER);
- ErrorF("Copyright (C) 2005-2012 Jay Sorg\n");
- ErrorF("See http://xrdp.sf.net for information on xrdp.\n");
+ int dpix;
+ int dpiy;
+ int ret;
+ Bool vis_found;
+ VisualPtr vis;
+ PictureScreenPtr ps;
+ rrScrPrivPtr pRRScrPriv;
+
+ g_pScreen = pScreen;
+ memset(&g_screenPriv, 0, sizeof(g_screenPriv));
+
+ /*dpix = 75;
+ dpiy = 75;*/
+ dpix = PixelDPI;
+ dpiy = PixelDPI;
+
+ 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("\n");
+ ErrorF("X11rdp, an X server for xrdp\n");
+ ErrorF("Version %s\n", X11RDPVER);
+ ErrorF("Copyright (C) 2005-2012 Jay Sorg\n");
+ ErrorF("See http://xrdp.sf.net for information on xrdp.\n");
#if defined(XORG_VERSION_CURRENT) && defined (XVENDORNAME)
- ErrorF("Underlying X server release %d, %s\n",
- XORG_VERSION_CURRENT, XVENDORNAME);
+ ErrorF("Underlying X server release %d, %s\n",
+ XORG_VERSION_CURRENT, XVENDORNAME);
#endif
#if defined(XORG_RELEASE)
- ErrorF("Xorg %s\n", XORG_RELEASE);
+ ErrorF("Xorg %s\n", XORG_RELEASE);
#endif
- 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*)g_malloc(2048 * 2048 * 4, 1);
- }
- if (g_rdpScreen.pfbMemory == 0)
- {
- rdpLog("rdpScreenInit g_malloc failed\n");
- return 0;
- }
- miClearVisualTypes();
- if (defaultColorVisualClass == -1)
- {
- defaultColorVisualClass = TrueColor;
- }
- if (!miSetVisualTypes(g_rdpScreen.depth,
- miGetDefaultVisualMask(g_rdpScreen.depth),
- 8, defaultColorVisualClass))
- {
- rdpLog("rdpScreenInit miSetVisualTypes failed\n");
- 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, 8);
- break;
- case 16:
- ret = fbScreenInit(pScreen, g_rdpScreen.pfbMemory,
- g_rdpScreen.width, g_rdpScreen.height,
- dpix, dpiy, g_rdpScreen.paddedWidthInBytes / 2, 16);
- break;
- case 32:
- ret = fbScreenInit(pScreen, g_rdpScreen.pfbMemory,
- g_rdpScreen.width, g_rdpScreen.height,
- dpix, dpiy, g_rdpScreen.paddedWidthInBytes / 4, 32);
- break;
- default:
- ErrorF("rdpScreenInit: error\n");
- return 0;
- }
- if (!ret)
- {
- ErrorF("rdpScreenInit: error\n");
- return 0;
- }
-
- miInitializeBackingStore(pScreen);
-
- /* this is for rgb, not bgr, just doing rgb for now */
- vis = g_pScreen->visuals + (g_pScreen->numVisuals - 1);
- 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;
- }
- vis--;
- }
-
- if (g_rdpScreen.bitsPerPixel > 4)
- {
- fbPictureInit(pScreen, 0, 0);
- }
-
- if (!dixRegisterPrivateKey(&g_rdpGCIndex, PRIVATE_GC, sizeof(rdpGCRec)))
- {
- FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_GC failed\n");
- }
-
- if (!dixRegisterPrivateKey(&g_rdpWindowIndex, PRIVATE_WINDOW, sizeof(rdpWindowRec)))
- {
- FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_WINDOW failed\n");
- }
-
- if (!dixRegisterPrivateKey(&g_rdpPixmapIndex, PRIVATE_PIXMAP, sizeof(rdpPixmapRec)))
- {
- FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_PIXMAP failed\n");
- }
-
- /* Random screen procedures */
- g_rdpScreen.CloseScreen = pScreen->CloseScreen;
- /* GC procedures */
- g_rdpScreen.CreateGC = pScreen->CreateGC;
- /* Pixmap procudures */
- g_rdpScreen.CreatePixmap = pScreen->CreatePixmap;
- g_rdpScreen.DestroyPixmap = pScreen->DestroyPixmap;
-
- /* Window Procedures */
- g_rdpScreen.CreateWindow = pScreen->CreateWindow;
- g_rdpScreen.DestroyWindow = pScreen->DestroyWindow;
- g_rdpScreen.ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
- g_rdpScreen.RealizeWindow = pScreen->RealizeWindow;
- g_rdpScreen.UnrealizeWindow = pScreen->UnrealizeWindow;
- g_rdpScreen.PositionWindow = pScreen->PositionWindow;
- g_rdpScreen.WindowExposures = pScreen->WindowExposures;
- g_rdpScreen.CopyWindow = pScreen->CopyWindow;
- g_rdpScreen.ClearToBackground = pScreen->ClearToBackground;
-
- /* Backing store procedures */
- g_rdpScreen.RestoreAreas = pScreen->RestoreAreas;
- g_rdpScreen.WakeupHandler = pScreen->WakeupHandler;
-
- g_rdpScreen.CreateColormap = pScreen->CreateColormap;
- g_rdpScreen.DestroyColormap = pScreen->DestroyColormap;
-
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- {
- g_rdpScreen.Composite = ps->Composite;
- g_rdpScreen.Glyphs = ps->Glyphs;
-
- }
- pScreen->blackPixel = g_rdpScreen.blackPixel;
- pScreen->whitePixel = g_rdpScreen.whitePixel;
- /* Random screen procedures */
- pScreen->CloseScreen = rdpCloseScreen;
- pScreen->WakeupHandler = rdpWakeupHandler;
- if (ps)
- {
- ps->Composite = rdpComposite;
- ps->Glyphs = rdpGlyphs;
- }
- pScreen->SaveScreen = rdpSaveScreen;
- /* GC procedures */
- pScreen->CreateGC = rdpCreateGC;
-
- if (g_wrapPixmap)
- {
- /* Pixmap procedures */
- pScreen->CreatePixmap = rdpCreatePixmap;
- pScreen->DestroyPixmap = rdpDestroyPixmap;
- }
-
- if (g_wrapWindow)
- {
+ 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 *)g_malloc(2048 * 2048 * 4, 1);
+ }
+
+ if (g_rdpScreen.pfbMemory == 0)
+ {
+ rdpLog("rdpScreenInit g_malloc failed\n");
+ return 0;
+ }
+
+ miClearVisualTypes();
+
+ if (defaultColorVisualClass == -1)
+ {
+ defaultColorVisualClass = TrueColor;
+ }
+
+ if (!miSetVisualTypes(g_rdpScreen.depth,
+ miGetDefaultVisualMask(g_rdpScreen.depth),
+ 8, defaultColorVisualClass))
+ {
+ rdpLog("rdpScreenInit miSetVisualTypes failed\n");
+ 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, 8);
+ break;
+ case 16:
+ ret = fbScreenInit(pScreen, g_rdpScreen.pfbMemory,
+ g_rdpScreen.width, g_rdpScreen.height,
+ dpix, dpiy, g_rdpScreen.paddedWidthInBytes / 2, 16);
+ break;
+ case 32:
+ ret = fbScreenInit(pScreen, g_rdpScreen.pfbMemory,
+ g_rdpScreen.width, g_rdpScreen.height,
+ dpix, dpiy, g_rdpScreen.paddedWidthInBytes / 4, 32);
+ break;
+ default:
+ ErrorF("rdpScreenInit: error\n");
+ return 0;
+ }
+
+ if (!ret)
+ {
+ ErrorF("rdpScreenInit: error\n");
+ return 0;
+ }
+
+ miInitializeBackingStore(pScreen);
+
+ /* this is for rgb, not bgr, just doing rgb for now */
+ vis = g_pScreen->visuals + (g_pScreen->numVisuals - 1);
+
+ 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;
+ }
+
+ vis--;
+ }
+
+ if (g_rdpScreen.bitsPerPixel > 4)
+ {
+ fbPictureInit(pScreen, 0, 0);
+ }
+
+ if (!dixRegisterPrivateKey(&g_rdpGCIndex, PRIVATE_GC, sizeof(rdpGCRec)))
+ {
+ FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_GC failed\n");
+ }
+
+ if (!dixRegisterPrivateKey(&g_rdpWindowIndex, PRIVATE_WINDOW, sizeof(rdpWindowRec)))
+ {
+ FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_WINDOW failed\n");
+ }
+
+ if (!dixRegisterPrivateKey(&g_rdpPixmapIndex, PRIVATE_PIXMAP, sizeof(rdpPixmapRec)))
+ {
+ FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_PIXMAP failed\n");
+ }
+
+ /* Random screen procedures */
+ g_rdpScreen.CloseScreen = pScreen->CloseScreen;
+ /* GC procedures */
+ g_rdpScreen.CreateGC = pScreen->CreateGC;
+ /* Pixmap procudures */
+ g_rdpScreen.CreatePixmap = pScreen->CreatePixmap;
+ g_rdpScreen.DestroyPixmap = pScreen->DestroyPixmap;
+
/* Window Procedures */
- pScreen->CreateWindow = rdpCreateWindow;
- pScreen->DestroyWindow = rdpDestroyWindow;
- pScreen->ChangeWindowAttributes = rdpChangeWindowAttributes;
- pScreen->RealizeWindow = rdpRealizeWindow;
- pScreen->UnrealizeWindow = rdpUnrealizeWindow;
- pScreen->PositionWindow = rdpPositionWindow;
- pScreen->WindowExposures = rdpWindowExposures;
- }
+ g_rdpScreen.CreateWindow = pScreen->CreateWindow;
+ g_rdpScreen.DestroyWindow = pScreen->DestroyWindow;
+ g_rdpScreen.ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ g_rdpScreen.RealizeWindow = pScreen->RealizeWindow;
+ g_rdpScreen.UnrealizeWindow = pScreen->UnrealizeWindow;
+ g_rdpScreen.PositionWindow = pScreen->PositionWindow;
+ g_rdpScreen.WindowExposures = pScreen->WindowExposures;
+ g_rdpScreen.CopyWindow = pScreen->CopyWindow;
+ g_rdpScreen.ClearToBackground = pScreen->ClearToBackground;
+
+ /* Backing store procedures */
+ g_rdpScreen.RestoreAreas = pScreen->RestoreAreas;
+ g_rdpScreen.WakeupHandler = pScreen->WakeupHandler;
+
+ g_rdpScreen.CreateColormap = pScreen->CreateColormap;
+ g_rdpScreen.DestroyColormap = pScreen->DestroyColormap;
+
+ ps = GetPictureScreenIfSet(pScreen);
+
+ if (ps)
+ {
+ g_rdpScreen.Composite = ps->Composite;
+ g_rdpScreen.Glyphs = ps->Glyphs;
+
+ }
- pScreen->CopyWindow = rdpCopyWindow;
- pScreen->ClearToBackground = rdpClearToBackground;
+ pScreen->blackPixel = g_rdpScreen.blackPixel;
+ pScreen->whitePixel = g_rdpScreen.whitePixel;
+ /* Random screen procedures */
+ pScreen->CloseScreen = rdpCloseScreen;
+ pScreen->WakeupHandler = rdpWakeupHandler;
- /* Backing store procedures */
- pScreen->RestoreAreas = rdpRestoreAreas;
+ if (ps)
+ {
+ ps->Composite = rdpComposite;
+ ps->Glyphs = rdpGlyphs;
+ }
+
+ pScreen->SaveScreen = rdpSaveScreen;
+ /* GC procedures */
+ pScreen->CreateGC = rdpCreateGC;
+
+ if (g_wrapPixmap)
+ {
+ /* Pixmap procedures */
+ pScreen->CreatePixmap = rdpCreatePixmap;
+ pScreen->DestroyPixmap = rdpDestroyPixmap;
+ }
+
+ if (g_wrapWindow)
+ {
+ /* Window Procedures */
+ pScreen->CreateWindow = rdpCreateWindow;
+ pScreen->DestroyWindow = rdpDestroyWindow;
+ pScreen->ChangeWindowAttributes = rdpChangeWindowAttributes;
+ pScreen->RealizeWindow = rdpRealizeWindow;
+ pScreen->UnrealizeWindow = rdpUnrealizeWindow;
+ pScreen->PositionWindow = rdpPositionWindow;
+ pScreen->WindowExposures = rdpWindowExposures;
+ }
+
+ pScreen->CopyWindow = rdpCopyWindow;
+ pScreen->ClearToBackground = rdpClearToBackground;
+
+ /* Backing store procedures */
+ pScreen->RestoreAreas = rdpRestoreAreas;
#if 0
- pScreen->CreateColormap = rdpCreateColormap;
- pScreen->DestroyColormap = rdpDestroyColormap;
+ pScreen->CreateColormap = rdpCreateColormap;
+ pScreen->DestroyColormap = rdpDestroyColormap;
#endif
- miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs,
- &g_rdpPointerCursorFuncs, 1);
+ miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs,
+ &g_rdpPointerCursorFuncs, 1);
#if 0
- pScreen->DeviceCursorInitialize = rdpDeviceCursorInitialize;
- pScreen->DeviceCursorCleanup = rdpDeviceCursorCleanup;
+ pScreen->DeviceCursorInitialize = rdpDeviceCursorInitialize;
+ pScreen->DeviceCursorCleanup = rdpDeviceCursorCleanup;
#endif
- vis_found = 0;
- vis = g_pScreen->visuals + (g_pScreen->numVisuals - 1);
- while (vis >= pScreen->visuals)
- {
- if (vis->vid == pScreen->rootVisual)
+ vis_found = 0;
+ vis = g_pScreen->visuals + (g_pScreen->numVisuals - 1);
+
+ while (vis >= pScreen->visuals)
{
- vis_found = 1;
+ if (vis->vid == pScreen->rootVisual)
+ {
+ vis_found = 1;
+ }
+
+ vis--;
}
- vis--;
- }
- if (!vis_found)
- {
- rdpLog("rdpScreenInit: couldn't find root visual\n");
- exit(1);
- }
- ret = 1;
- if (ret)
- {
- ret = fbCreateDefColormap(pScreen);
- if (!ret)
+
+ if (!vis_found)
{
- ErrorF("rdpScreenInit: fbCreateDefColormap failed\n");
+ rdpLog("rdpScreenInit: couldn't find root visual\n");
+ exit(1);
}
- }
- if (ret)
- {
- ret = rdpup_init();
- if (!ret)
+
+ ret = 1;
+
+ if (ret)
+ {
+ ret = fbCreateDefColormap(pScreen);
+
+ if (!ret)
+ {
+ ErrorF("rdpScreenInit: fbCreateDefColormap failed\n");
+ }
+ }
+
+ if (ret)
+ {
+ ret = rdpup_init();
+
+ if (!ret)
+ {
+ ErrorF("rdpScreenInit: rdpup_init failed\n");
+ }
+ }
+
+ if (ret)
+ {
+ RegisterBlockAndWakeupHandlers(rdpBlockHandler1, rdpWakeupHandler1, NULL);
+ }
+
+ if (!RRScreenInit(pScreen))
{
- ErrorF("rdpScreenInit: rdpup_init failed\n");
+ ErrorF("rdpmain.c: RRScreenInit: screen init failed\n");
}
- }
- if (ret)
- {
- RegisterBlockAndWakeupHandlers(rdpBlockHandler1, rdpWakeupHandler1, NULL);
- }
- if (!RRScreenInit(pScreen))
- {
- ErrorF("rdpmain.c: RRScreenInit: screen init failed\n");
- }
- else
- {
- pRRScrPriv = rrGetScrPriv(pScreen);
- ErrorF("pRRScrPriv %p\n", pRRScrPriv);
+ else
+ {
+ pRRScrPriv = rrGetScrPriv(pScreen);
+ ErrorF("pRRScrPriv %p\n", pRRScrPriv);
- pRRScrPriv->rrSetConfig = rdpRRSetConfig;
+ pRRScrPriv->rrSetConfig = rdpRRSetConfig;
- pRRScrPriv->rrGetInfo = rdpRRGetInfo;
+ pRRScrPriv->rrGetInfo = rdpRRGetInfo;
- pRRScrPriv->rrScreenSetSize = rdpRRScreenSetSize;
- pRRScrPriv->rrCrtcSet = rdpRRCrtcSet;
- pRRScrPriv->rrCrtcGetGamma = rdpRRCrtcGetGamma;
- pRRScrPriv->rrCrtcSetGamma = rdpRRCrtcSetGamma;
- pRRScrPriv->rrOutputSetProperty = rdpRROutputSetProperty;
- pRRScrPriv->rrOutputValidateMode = rdpRROutputValidateMode;
- pRRScrPriv->rrModeDestroy = rdpRRModeDestroy;
+ pRRScrPriv->rrScreenSetSize = rdpRRScreenSetSize;
+ pRRScrPriv->rrCrtcSet = rdpRRCrtcSet;
+ pRRScrPriv->rrCrtcGetGamma = rdpRRCrtcGetGamma;
+ pRRScrPriv->rrCrtcSetGamma = rdpRRCrtcSetGamma;
+ pRRScrPriv->rrOutputSetProperty = rdpRROutputSetProperty;
+ pRRScrPriv->rrOutputValidateMode = rdpRROutputValidateMode;
+ pRRScrPriv->rrModeDestroy = rdpRRModeDestroy;
- pRRScrPriv->rrOutputGetProperty = rdpRROutputGetProperty;
- pRRScrPriv->rrGetPanning = rdpRRGetPanning;
- pRRScrPriv->rrSetPanning = rdpRRSetPanning;
+ pRRScrPriv->rrOutputGetProperty = rdpRROutputGetProperty;
+ pRRScrPriv->rrGetPanning = rdpRRGetPanning;
+ pRRScrPriv->rrSetPanning = rdpRRSetPanning;
- }
+ }
- ErrorF("rdpScreenInit: ret %d\n", ret);
+ ErrorF("rdpScreenInit: ret %d\n", ret);
- return ret;
+ return ret;
}
/******************************************************************************/
@@ -505,52 +533,61 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
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)
+ddxProcessArgument(int argc, char **argv, int i)
{
- if (g_firstTime)
- {
- memset(&g_rdpScreen, 0, sizeof(g_rdpScreen));
- g_rdpScreen.width = 1024;
- g_rdpScreen.height = 768;
- g_rdpScreen.depth = 24;
- set_bpp(24);
- g_rdpScreen.blackPixel = 1;
- g_firstTime = 0;
- RRExtensionInit();
- }
- 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;
- }
- if (strcmp(argv[i], "-uds") == 0)
- {
- g_use_uds = 1;
- return 1;
- }
- return 0;
+ if (g_firstTime)
+ {
+ memset(&g_rdpScreen, 0, sizeof(g_rdpScreen));
+ g_rdpScreen.width = 1024;
+ g_rdpScreen.height = 768;
+ g_rdpScreen.depth = 24;
+ set_bpp(24);
+ g_rdpScreen.blackPixel = 1;
+ g_firstTime = 0;
+ RRExtensionInit();
+ }
+
+ 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;
+ }
+
+ if (strcmp(argv[i], "-uds") == 0)
+ {
+ g_use_uds = 1;
+ return 1;
+ }
+
+ return 0;
}
/******************************************************************************/
@@ -568,27 +605,27 @@ ddxInitGlobals(void)
/******************************************************************************/
int
-XkbDDXSwitchScreen(DeviceIntPtr dev, KeyCode key, XkbAction* act)
+XkbDDXSwitchScreen(DeviceIntPtr dev, KeyCode key, XkbAction *act)
{
- ErrorF("XkbDDXSwitchScreen:\n");
- return 1;
+ ErrorF("XkbDDXSwitchScreen:\n");
+ return 1;
}
/******************************************************************************/
int
-XkbDDXPrivate(DeviceIntPtr dev, KeyCode key, XkbAction* act)
+XkbDDXPrivate(DeviceIntPtr dev, KeyCode key, XkbAction *act)
{
- ErrorF("XkbDDXPrivate:\n");
- return 0;
+ ErrorF("XkbDDXPrivate:\n");
+ return 0;
}
/******************************************************************************/
int
-XkbDDXTerminateServer(DeviceIntPtr dev, KeyCode key, XkbAction* act)
+XkbDDXTerminateServer(DeviceIntPtr dev, KeyCode key, XkbAction *act)
{
- ErrorF("XkbDDXTerminateServer:\n");
- GiveUp(1);
- return 0;
+ ErrorF("XkbDDXTerminateServer:\n");
+ GiveUp(1);
+ return 0;
}
/******************************************************************************/
@@ -596,50 +633,55 @@ XkbDDXTerminateServer(DeviceIntPtr dev, KeyCode key, XkbAction* act)
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)
+InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
{
- int i;
-
- ErrorF("InitOutput:\n");
- 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 = g_numFormats;
- for (i = 0; i < g_numFormats; i++)
- {
- screenInfo->formats[i] = g_formats[i];
- }
- 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");
- }
- ErrorF("InitOutput: out\n");
+ int i;
+
+ ErrorF("InitOutput:\n");
+ 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 = g_numFormats;
+
+ for (i = 0; i < g_numFormats; i++)
+ {
+ screenInfo->formats[i] = g_formats[i];
+ }
+
+ 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");
+ }
+
+ ErrorF("InitOutput: out\n");
}
/******************************************************************************/
void
-InitInput(int argc, char** argv)
+InitInput(int argc, char **argv)
{
- int rc;
+ int rc;
+
+ ErrorF("InitInput:\n");
+ rc = AllocDevicePair(serverClient, "X11rdp", &g_pointer, &g_keyboard,
+ rdpMouseProc, rdpKeybdProc, 0);
- ErrorF("InitInput:\n");
- rc = AllocDevicePair(serverClient, "X11rdp", &g_pointer, &g_keyboard,
- rdpMouseProc, rdpKeybdProc, 0);
- if (rc != Success)
- {
- FatalError("Failed to init X11rdp default devices.\n");
- }
+ if (rc != Success)
+ {
+ FatalError("Failed to init X11rdp default devices.\n");
+ }
- mieqInit();
+ mieqInit();
}
@@ -647,35 +689,37 @@ InitInput(int argc, char** argv)
void
ddxGiveUp(void)
{
- char unixSocketName[128];
+ char unixSocketName[128];
- ErrorF("ddxGiveUp:\n");
- g_free(g_rdpScreen.pfbMemory);
- if (g_initOutputCalled)
- {
- sprintf(unixSocketName, "/tmp/.X11-unix/X%s", display);
- unlink(unixSocketName);
- sprintf(unixSocketName, "/tmp/.xrdp/xrdp_disconnect_display_%s", display);
- unlink(unixSocketName);
- if(g_uds_data[0] != 0)
+ ErrorF("ddxGiveUp:\n");
+ g_free(g_rdpScreen.pfbMemory);
+
+ if (g_initOutputCalled)
{
- unlink(g_uds_data);
+ sprintf(unixSocketName, "/tmp/.X11-unix/X%s", display);
+ unlink(unixSocketName);
+ sprintf(unixSocketName, "/tmp/.xrdp/xrdp_disconnect_display_%s", display);
+ unlink(unixSocketName);
+
+ if (g_uds_data[0] != 0)
+ {
+ unlink(g_uds_data);
+ }
}
- }
}
/******************************************************************************/
Bool
LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
- return 1; /* true */
+ return 1; /* true */
}
/******************************************************************************/
void
ProcessInputEvents(void)
{
- mieqProcessInputEvents();
+ mieqProcessInputEvents();
}
/******************************************************************************/
@@ -690,7 +734,7 @@ rfbRootPropertyChange(PropertyPtr pProp)
void
AbortDDX(void)
{
- ddxGiveUp();
+ ddxGiveUp();
}
/******************************************************************************/
@@ -704,13 +748,13 @@ OsVendorFatalError(void)
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("-uds create and listen on /tmp/.xrdp/xrdp_display_x\n");
- ErrorF("\n");
- exit(1);
+ ErrorF("\n");
+ ErrorF("X11rdp specific options\n");
+ ErrorF("-geometry WxH set framebuffer width & height\n");
+ ErrorF("-depth D set framebuffer depth\n");
+ ErrorF("-uds create and listen on /tmp/.xrdp/xrdp_display_x\n");
+ ErrorF("\n");
+ exit(1);
}
/******************************************************************************/
@@ -723,19 +767,19 @@ OsVendorPreInit(void)
void
CloseInput(void)
{
- ErrorF("CloseInput\n");
+ ErrorF("CloseInput\n");
}
/******************************************************************************/
void
DDXRingBell(int volume, int pitch, int duration)
{
- ErrorF("DDXRingBell\n");
+ ErrorF("DDXRingBell\n");
}
/******************************************************************************/
void
DeleteInputDeviceRequest(DeviceIntPtr dev)
{
- ErrorF("DeleteInputDeviceRequest\n");
+ ErrorF("DeleteInputDeviceRequest\n");
}
diff --git a/xorg/X11R7.6/rdp/rdpmisc.c b/xorg/X11R7.6/rdp/rdpmisc.c
index d3defe27..c221dd15 100644
--- a/xorg/X11R7.6/rdp/rdpmisc.c
+++ b/xorg/X11R7.6/rdp/rdpmisc.c
@@ -32,60 +32,60 @@ Bool noFontCacheExtension = 1;
void
rdpLog(char *format, ...)
{
- va_list args;
- char buf[256];
- time_t clock;
+ 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, "%s", buf);
- vfprintf(stderr, format, args);
- fflush(stderr);
- va_end(args);
+ va_start(args, format);
+ time(&clock);
+ strftime(buf, 255, "%d/%m/%y %T ", localtime(&clock));
+ fprintf(stderr, "%s", 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;
- }
+ 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)
+rdpClientStateChange(CallbackListPtr *cbl, pointer myData, pointer clt)
{
- dispatchException &= ~DE_RESET; /* hack - force server not to reset */
+ dispatchException &= ~DE_RESET; /* hack - force server not to reset */
}
/******************************************************************************/
int
DPMSSupported(void)
{
- return 0;
+ return 0;
}
/******************************************************************************/
int
-DPSMGet(int* level)
+DPSMGet(int *level)
{
- return -1;
+ return -1;
}
/******************************************************************************/
@@ -102,38 +102,38 @@ AddOtherInputDevices(void)
/******************************************************************************/
void
-OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int* status)
+OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
{
}
/******************************************************************************/
int
SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev,
- int* valuators, int first_valuator, int num_valuators)
+ int *valuators, int first_valuator, int num_valuators)
{
- return BadMatch;
+ return BadMatch;
}
/******************************************************************************/
int
SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode)
{
- return BadMatch;
+ return BadMatch;
}
/******************************************************************************/
int
ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev)
{
- return BadMatch;
+ return BadMatch;
}
/******************************************************************************/
int
ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev,
- void* control)
+ void *control)
{
- return BadMatch;
+ return BadMatch;
}
/******************************************************************************/
@@ -141,7 +141,7 @@ int
ChangePointerDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev,
unsigned char x, unsigned char y)
{
- return BadMatch;
+ return BadMatch;
}
/******************************************************************************/
@@ -154,332 +154,357 @@ CloseInputDevice(DeviceIntPtr d, ClientPtr client)
/*****************************************************************************/
int
-g_tcp_recv(int sck, void* ptr, int len, int flags)
+g_tcp_recv(int sck, void *ptr, int len, int flags)
{
- return recv(sck, ptr, len, flags);
+ return recv(sck, ptr, len, flags);
}
/*****************************************************************************/
void
g_tcp_close(int sck)
{
- if (sck == 0)
- {
- return;
- }
- shutdown(sck, 2);
- close(sck);
+ if (sck == 0)
+ {
+ return;
+ }
+
+ shutdown(sck, 2);
+ close(sck);
}
/*****************************************************************************/
int
g_tcp_last_error_would_block(int sck)
{
- return (errno == EWOULDBLOCK) || (errno == EINPROGRESS);
+ return (errno == EWOULDBLOCK) || (errno == EINPROGRESS);
}
/*****************************************************************************/
void
g_sleep(int msecs)
{
- usleep(msecs * 1000);
+ usleep(msecs * 1000);
}
/*****************************************************************************/
int
-g_tcp_send(int sck, void* ptr, int len, int flags)
+g_tcp_send(int sck, void *ptr, int len, int flags)
{
- return send(sck, ptr, len, flags);
+ return send(sck, ptr, len, flags);
}
/*****************************************************************************/
-void*
+void *
g_malloc(int size, int zero)
{
- char* rv;
+ char *rv;
-//#ifdef _XSERVER64
+ //#ifdef _XSERVER64
#if 1
- /* I thought xalloc whould work here but I guess not, why, todo */
- rv = (char*)malloc(size);
+ /* I thought xalloc whould work here but I guess not, why, todo */
+ rv = (char *)malloc(size);
#else
- rv = (char*)Xalloc(size);
+ rv = (char *)Xalloc(size);
#endif
- if (zero)
- {
- if (rv != 0)
+
+ if (zero)
{
- memset(rv, 0, size);
+ if (rv != 0)
+ {
+ memset(rv, 0, size);
+ }
}
- }
- return rv;
+
+ return rv;
}
/*****************************************************************************/
void
-g_free(void* ptr)
+g_free(void *ptr)
{
- if (ptr != 0)
- {
-//#ifdef _XSERVER64
+ if (ptr != 0)
+ {
+ //#ifdef _XSERVER64
#if 1
- /* I thought xfree whould work here but I guess not, why, todo */
- free(ptr);
+ /* I thought xfree whould work here but I guess not, why, todo */
+ free(ptr);
#else
- Xfree(ptr);
+ Xfree(ptr);
#endif
- }
+ }
}
/*****************************************************************************/
void
-g_sprintf(char* dest, char* format, ...)
+g_sprintf(char *dest, char *format, ...)
{
- va_list ap;
+ va_list ap;
- va_start(ap, format);
- vsprintf(dest, format, ap);
- va_end(ap);
+ va_start(ap, format);
+ vsprintf(dest, format, ap);
+ va_end(ap);
}
/*****************************************************************************/
int
g_tcp_socket(void)
{
- int rv;
- int i;
+ 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;
+ 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);
+ return socket(AF_UNIX, SOCK_DGRAM, 0);
}
/*****************************************************************************/
int
g_tcp_local_socket_stream(void)
{
- return socket(AF_UNIX, SOCK_STREAM, 0);
+ return socket(AF_UNIX, SOCK_STREAM, 0);
}
/*****************************************************************************/
void
-g_memcpy(void* d_ptr, const void* s_ptr, int size)
+g_memcpy(void *d_ptr, const void *s_ptr, int size)
{
- memcpy(d_ptr, s_ptr, size);
+ memcpy(d_ptr, s_ptr, size);
}
/*****************************************************************************/
int
g_tcp_set_no_delay(int sck)
{
- int i;
+ int i;
- i = 1;
- setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (void*)&i, sizeof(i));
- return 0;
+ 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;
+ unsigned long i;
- i = fcntl(sck, F_GETFL);
- i = i | O_NONBLOCK;
- fcntl(sck, F_SETFL, i);
- return 0;
+ 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;
+ struct sockaddr_in s;
+ unsigned int i;
- i = sizeof(struct sockaddr_in);
- memset(&s, 0, i);
- return accept(sck, (struct sockaddr*)&s, &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))
+ fd_set rfds;
+ struct timeval time;
+ int max;
+ int rv;
+
+ time.tv_sec = 0;
+ time.tv_usec = 0;
+ FD_ZERO(&rfds);
+
+ if (sck1 > 0)
{
- rv = rv | 1;
+ FD_SET(((unsigned int)sck1), &rfds);
}
- if (FD_ISSET(((unsigned int)sck2), &rfds))
+
+ if (sck2 > 0)
{
- rv = rv | 2;
+ FD_SET(((unsigned int)sck2), &rfds);
}
- if (FD_ISSET(((unsigned int)sck3), &rfds))
+
+ if (sck3 > 0)
+ {
+ FD_SET(((unsigned int)sck3), &rfds);
+ }
+
+ max = sck1;
+
+ if (sck2 > max)
+ {
+ max = sck2;
+ }
+
+ if (sck3 > max)
{
- rv = rv | 4;
+ max = sck3;
}
- }
- else
- {
- rv = 0;
- }
- return rv;
+
+ 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)
+g_tcp_bind(int sck, char *port)
{
- struct sockaddr_in s;
+ 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));
+ 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)
+g_tcp_local_bind(int sck, char *port)
{
- struct sockaddr_un s;
+ 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));
+ 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);
+ return listen(sck, 2);
}
/*****************************************************************************/
/* returns boolean */
int
-g_create_dir(const char* dirname)
+g_create_dir(const char *dirname)
{
- return mkdir(dirname, (mode_t)-1) == 0;
+ return mkdir(dirname, (mode_t) - 1) == 0;
}
/*****************************************************************************/
/* returns boolean, non zero if the directory exists */
int
-g_directory_exist(const char* dirname)
+g_directory_exist(const char *dirname)
{
- struct stat st;
+ struct stat st;
- if (stat(dirname, &st) == 0)
- {
- return S_ISDIR(st.st_mode);
- }
- else
- {
- return 0;
- }
+ 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);
+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
-hexdump(unsigned char* p, unsigned int len)
+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;
+ unsigned char *line;
+ int i;
+ int thisline;
+ int offset;
- for (i = 0; i < thisline; i++)
- ErrorF("%02x ", line[i]);
+ offset = 0;
+ line = p;
- 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;
- }
+ 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;
+ }
}
/*
@@ -490,26 +515,26 @@ hexdump(unsigned char* p, unsigned int len)
Bool
XpClientIsBitmapClient(ClientPtr client)
{
- return 1;
+ return 1;
}
/*****************************************************************************/
Bool
XpClientIsPrintClient(ClientPtr client, FontPathElementPtr fpe)
{
- return 0;
+ return 0;
}
/*****************************************************************************/
int
-PrinterOptions(int argc, char** argv, int i)
+PrinterOptions(int argc, char **argv, int i)
{
- return i;
+ return i;
}
/*****************************************************************************/
void
-PrinterInitOutput(ScreenInfo* pScreenInfo, int argc, char** argv)
+PrinterInitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
{
}
@@ -533,40 +558,44 @@ FontCacheExtensionInit(INITARGS)
/******************************************************************************/
void
-RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg)
+RegionAroundSegs(RegionPtr reg, xSegment *segs, int nseg)
{
- int index;
- BoxRec box;
- RegionRec treg;
+ int index;
+ BoxRec box;
+ RegionRec treg;
- index = 0;
- while (index < nseg)
- {
- if (segs[index].x1 < segs[index].x2)
- {
- box.x1 = segs[index].x1;
- box.x2 = segs[index].x2;
- }
- else
- {
- box.x1 = segs[index].x2;
- box.x2 = segs[index].x1;
- }
- box.x2++;
- if (segs[index].y1 < segs[index].y2)
- {
- box.y1 = segs[index].y1;
- box.y2 = segs[index].y2;
- }
- else
+ index = 0;
+
+ while (index < nseg)
{
- box.y1 = segs[index].y2;
- box.y2 = segs[index].y1;
+ if (segs[index].x1 < segs[index].x2)
+ {
+ box.x1 = segs[index].x1;
+ box.x2 = segs[index].x2;
+ }
+ else
+ {
+ box.x1 = segs[index].x2;
+ box.x2 = segs[index].x1;
+ }
+
+ box.x2++;
+
+ if (segs[index].y1 < segs[index].y2)
+ {
+ box.y1 = segs[index].y1;
+ box.y2 = segs[index].y2;
+ }
+ else
+ {
+ box.y1 = segs[index].y2;
+ box.y2 = segs[index].y1;
+ }
+
+ box.y2++;
+ RegionInit(&treg, &box, 0);
+ RegionUnion(reg, reg, &treg);
+ RegionUninit(&treg);
+ index++;
}
- box.y2++;
- RegionInit(&treg, &box, 0);
- RegionUnion(reg, reg, &treg);
- RegionUninit(&treg);
- index++;
- }
}
diff --git a/xorg/X11R7.6/rdp/rdprandr.c b/xorg/X11R7.6/rdp/rdprandr.c
index ec011e8f..832d86d4 100644
--- a/xorg/X11R7.6/rdp/rdprandr.c
+++ b/xorg/X11R7.6/rdp/rdprandr.c
@@ -42,17 +42,17 @@ static XID g_wid = 0;
Bool
rdpRRRegisterSize(ScreenPtr pScreen, int width, int height)
{
- int mmwidth;
- int mmheight;
- RRScreenSizePtr pSize;
-
- ErrorF("rdpRRRegisterSize: width %d height %d\n", 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;
+ int mmwidth;
+ int mmheight;
+ RRScreenSizePtr pSize;
+
+ ErrorF("rdpRRRegisterSize: width %d height %d\n", 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;
}
/******************************************************************************/
@@ -60,24 +60,24 @@ Bool
rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
RRScreenSizePtr pSize)
{
- ErrorF("rdpRRSetConfig:\n");
- return TRUE;
+ ErrorF("rdpRRSetConfig:\n");
+ return TRUE;
}
/******************************************************************************/
Bool
-rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations)
+rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
{
- int width;
- int height;
+ int width;
+ int height;
- ErrorF("rdpRRGetInfo:\n");
- *pRotations = RR_Rotate_0;
+ ErrorF("rdpRRGetInfo:\n");
+ *pRotations = RR_Rotate_0;
- width = g_rdpScreen.width;
- height = g_rdpScreen.height;
- rdpRRRegisterSize(pScreen, width, height);
- return TRUE;
+ width = g_rdpScreen.width;
+ height = g_rdpScreen.height;
+ rdpRRRegisterSize(pScreen, width, height);
+ return TRUE;
}
/******************************************************************************/
@@ -86,35 +86,39 @@ rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations)
static int
rdpInvalidateArea(ScreenPtr pScreen, int x, int y, int cx, int cy)
{
- WindowPtr pWin;
- int result;
- int attri;
- XID attributes[4];
- Mask mask;
-
- DEBUG_OUT(("rdpInvalidateArea:\n"));
- mask = 0;
- attri = 0;
- attributes[attri++] = pScreen->blackPixel;
- mask |= CWBackPixel;
- attributes[attri++] = xTrue;
- mask |= CWOverrideRedirect;
- if (g_wid == 0)
- {
- g_wid = FakeClientID(0);
- }
- pWin = CreateWindow(g_wid, pScreen->root,
- x, y, cx, cy, 0, InputOutput, mask,
- attributes, 0, serverClient,
- wVisual(pScreen->root), &result);
- if (result == 0)
- {
- g_invalidate_window = pWin;
- MapWindow(pWin, serverClient);
- DeleteWindow(pWin, None);
- g_invalidate_window = pWin;
- }
- return 0;
+ WindowPtr pWin;
+ int result;
+ int attri;
+ XID attributes[4];
+ Mask mask;
+
+ DEBUG_OUT(("rdpInvalidateArea:\n"));
+ mask = 0;
+ attri = 0;
+ attributes[attri++] = pScreen->blackPixel;
+ mask |= CWBackPixel;
+ attributes[attri++] = xTrue;
+ mask |= CWOverrideRedirect;
+
+ if (g_wid == 0)
+ {
+ g_wid = FakeClientID(0);
+ }
+
+ pWin = CreateWindow(g_wid, pScreen->root,
+ x, y, cx, cy, 0, InputOutput, mask,
+ attributes, 0, serverClient,
+ wVisual(pScreen->root), &result);
+
+ if (result == 0)
+ {
+ g_invalidate_window = pWin;
+ MapWindow(pWin, serverClient);
+ DeleteWindow(pWin, None);
+ g_invalidate_window = pWin;
+ }
+
+ return 0;
}
/******************************************************************************/
@@ -122,84 +126,87 @@ Bool
rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
CARD32 mmWidth, CARD32 mmHeight)
{
- PixmapPtr screenPixmap;
- BoxRec box;
-
- ErrorF("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d\n",
- width, height, (int)mmWidth, (int)mmHeight);
-
- if ((width < 1) || (height < 1))
- {
- ErrorF(" error width %d height %d\n", width, height);
- return FALSE;
- }
- g_rdpScreen.width = width;
- g_rdpScreen.height = height;
- g_rdpScreen.paddedWidthInBytes =
- PixmapBytePad(g_rdpScreen.width, g_rdpScreen.depth);
- g_rdpScreen.sizeInBytes =
- g_rdpScreen.paddedWidthInBytes * g_rdpScreen.height;
- pScreen->width = width;
- pScreen->height = height;
- pScreen->mmWidth = mmWidth;
- pScreen->mmHeight = mmHeight;
-
- screenPixmap = pScreen->GetScreenPixmap(pScreen);
- if (screenPixmap != 0)
- {
- ErrorF(" resizing screenPixmap [%p] to %dx%d, currently at %dx%d\n",
- (void*)screenPixmap, width, height,
- screenPixmap->drawable.width, screenPixmap->drawable.height);
- pScreen->ModifyPixmapHeader(screenPixmap, width, height,
- g_rdpScreen.depth, g_rdpScreen.bitsPerPixel,
- g_rdpScreen.paddedWidthInBytes,
- g_rdpScreen.pfbMemory);
- ErrorF(" pixmap resized to %dx%d\n",
- screenPixmap->drawable.width, screenPixmap->drawable.height);
- }
- DEBUG_OUT((" root window %p\n", (void*)pScreen->root));
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = width;
- box.y2 = height;
- RegionInit(&pScreen->root->winSize, &box, 1);
- RegionInit(&pScreen->root->borderSize, &box, 1);
- RegionReset(&pScreen->root->borderClip, &box);
- RegionBreak(&pScreen->root->clipList);
- pScreen->root->drawable.width = width;
- pScreen->root->drawable.height = height;
- ResizeChildrenWinSize(pScreen->root, 0, 0, 0, 0);
- RRScreenSizeNotify(pScreen);
- rdpInvalidateArea(g_pScreen, 0, 0, g_rdpScreen.width, g_rdpScreen.height);
- ErrorF(" screen resized to %dx%d\n",
- pScreen->width, pScreen->height);
- return TRUE;
+ PixmapPtr screenPixmap;
+ BoxRec box;
+
+ ErrorF("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d\n",
+ width, height, (int)mmWidth, (int)mmHeight);
+
+ if ((width < 1) || (height < 1))
+ {
+ ErrorF(" error width %d height %d\n", width, height);
+ return FALSE;
+ }
+
+ g_rdpScreen.width = width;
+ g_rdpScreen.height = height;
+ g_rdpScreen.paddedWidthInBytes =
+ PixmapBytePad(g_rdpScreen.width, g_rdpScreen.depth);
+ g_rdpScreen.sizeInBytes =
+ g_rdpScreen.paddedWidthInBytes * g_rdpScreen.height;
+ pScreen->width = width;
+ pScreen->height = height;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+
+ screenPixmap = pScreen->GetScreenPixmap(pScreen);
+
+ if (screenPixmap != 0)
+ {
+ ErrorF(" resizing screenPixmap [%p] to %dx%d, currently at %dx%d\n",
+ (void *)screenPixmap, width, height,
+ screenPixmap->drawable.width, screenPixmap->drawable.height);
+ pScreen->ModifyPixmapHeader(screenPixmap, width, height,
+ g_rdpScreen.depth, g_rdpScreen.bitsPerPixel,
+ g_rdpScreen.paddedWidthInBytes,
+ g_rdpScreen.pfbMemory);
+ ErrorF(" pixmap resized to %dx%d\n",
+ screenPixmap->drawable.width, screenPixmap->drawable.height);
+ }
+
+ DEBUG_OUT((" root window %p\n", (void *)pScreen->root));
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+ RegionInit(&pScreen->root->winSize, &box, 1);
+ RegionInit(&pScreen->root->borderSize, &box, 1);
+ RegionReset(&pScreen->root->borderClip, &box);
+ RegionBreak(&pScreen->root->clipList);
+ pScreen->root->drawable.width = width;
+ pScreen->root->drawable.height = height;
+ ResizeChildrenWinSize(pScreen->root, 0, 0, 0, 0);
+ RRScreenSizeNotify(pScreen);
+ rdpInvalidateArea(g_pScreen, 0, 0, g_rdpScreen.width, g_rdpScreen.height);
+ ErrorF(" screen resized to %dx%d\n",
+ pScreen->width, pScreen->height);
+ return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
int x, int y, Rotation rotation, int numOutputs,
- RROutputPtr* outputs)
+ RROutputPtr *outputs)
{
- ErrorF("rdpRRCrtcSet:\n");
- return TRUE;
+ ErrorF("rdpRRCrtcSet:\n");
+ return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
{
- ErrorF("rdpRRCrtcSetGamma:\n");
- return TRUE;
+ ErrorF("rdpRRCrtcSetGamma:\n");
+ return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
{
- ErrorF("rdpRRCrtcGetGamma:\n");
- return TRUE;
+ ErrorF("rdpRRCrtcGetGamma:\n");
+ return TRUE;
}
/******************************************************************************/
@@ -207,8 +214,8 @@ Bool
rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
RRPropertyValuePtr value)
{
- ErrorF("rdpRROutputSetProperty:\n");
- return TRUE;
+ ErrorF("rdpRROutputSetProperty:\n");
+ return TRUE;
}
/******************************************************************************/
@@ -216,60 +223,64 @@ Bool
rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
RRModePtr mode)
{
- ErrorF("rdpRROutputValidateMode:\n");
- return TRUE;
+ ErrorF("rdpRROutputValidateMode:\n");
+ return TRUE;
}
/******************************************************************************/
void
rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode)
{
- ErrorF("rdpRRModeDestroy:\n");
+ ErrorF("rdpRRModeDestroy:\n");
}
/******************************************************************************/
Bool
rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property)
{
- ErrorF("rdpRROutputGetProperty:\n");
- return TRUE;
+ ErrorF("rdpRROutputGetProperty:\n");
+ return TRUE;
}
/******************************************************************************/
Bool
rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
- BoxPtr trackingArea, INT16* border)
+ BoxPtr trackingArea, INT16 *border)
{
- ErrorF("rdpRRGetPanning:\n");
- if (totalArea != 0)
- {
- totalArea->x1 = 0;
- totalArea->y1 = 0;
- totalArea->x2 = g_rdpScreen.width;
- totalArea->y2 = g_rdpScreen.height;
- }
- if (trackingArea != 0)
- {
- trackingArea->x1 = 0;
- trackingArea->y1 = 0;
- trackingArea->x2 = g_rdpScreen.width;
- trackingArea->y2 = g_rdpScreen.height;
- }
- if (border != 0)
- {
- border[0] = 0;
- border[1] = 0;
- border[2] = 0;
- border[3] = 0;
- }
- return TRUE;
+ ErrorF("rdpRRGetPanning:\n");
+
+ if (totalArea != 0)
+ {
+ totalArea->x1 = 0;
+ totalArea->y1 = 0;
+ totalArea->x2 = g_rdpScreen.width;
+ totalArea->y2 = g_rdpScreen.height;
+ }
+
+ if (trackingArea != 0)
+ {
+ trackingArea->x1 = 0;
+ trackingArea->y1 = 0;
+ trackingArea->x2 = g_rdpScreen.width;
+ trackingArea->y2 = g_rdpScreen.height;
+ }
+
+ if (border != 0)
+ {
+ border[0] = 0;
+ border[1] = 0;
+ border[2] = 0;
+ border[3] = 0;
+ }
+
+ return TRUE;
}
/******************************************************************************/
Bool
rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
- BoxPtr trackingArea, INT16* border)
+ BoxPtr trackingArea, INT16 *border)
{
- ErrorF("rdpRRSetPanning:\n");
- return TRUE;
+ ErrorF("rdpRRSetPanning:\n");
+ return TRUE;
}
diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c
index b9b5b92f..508b7618 100644
--- a/xorg/X11R7.6/rdp/rdpup.c
+++ b/xorg/X11R7.6/rdp/rdpup.c
@@ -24,9 +24,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
- do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
int g_con_number = 0; /* increments for each connection */
@@ -40,8 +40,8 @@ static int g_dis_listen_sck = 0;
//static int g_dis_connected = 0;
static int g_begin = 0;
-static struct stream* g_out_s = 0;
-static struct stream* g_in_s = 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;
@@ -65,13 +65,13 @@ extern rdpPixmapRec g_screenPriv; /* in rdpmain.c */
struct rdpup_os_bitmap
{
- int used;
- PixmapPtr pixmap;
- rdpPixmapPtr priv;
- int stamp;
+ int used;
+ PixmapPtr pixmap;
+ rdpPixmapPtr priv;
+ int stamp;
};
-static struct rdpup_os_bitmap* g_os_bitmaps = 0;
+static struct rdpup_os_bitmap *g_os_bitmaps = 0;
static int g_max_os_bitmaps = 0;
static int g_os_bitmap_stamp = 0;
@@ -80,8 +80,8 @@ static int g_pixmap_num_used = 0;
struct rdpup_top_window
{
- WindowPtr wnd;
- struct rdpup_top_window* next;
+ WindowPtr wnd;
+ struct rdpup_top_window *next;
};
/*
@@ -105,328 +105,363 @@ f GXset 1
static int g_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 */
+ 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 */
};
/*****************************************************************************/
static int
rdpup_disconnect(void)
{
- int index;
-
- RemoveEnabledDevice(g_sck);
- g_connected = 0;
- g_tcp_close(g_sck);
- g_sck = 0;
- g_sck_closed = 1;
- g_pixmap_byte_total = 0;
- g_pixmap_num_used = 0;
- if (g_max_os_bitmaps > 0)
- {
- for (index = 0; index < g_max_os_bitmaps; index++)
- {
- if (g_os_bitmaps[index].used)
- {
- if (g_os_bitmaps[index].priv != 0)
+ int index;
+
+ RemoveEnabledDevice(g_sck);
+ g_connected = 0;
+ g_tcp_close(g_sck);
+ g_sck = 0;
+ g_sck_closed = 1;
+ g_pixmap_byte_total = 0;
+ g_pixmap_num_used = 0;
+
+ if (g_max_os_bitmaps > 0)
+ {
+ for (index = 0; index < g_max_os_bitmaps; index++)
{
- g_os_bitmaps[index].priv->status = 0;
+ if (g_os_bitmaps[index].used)
+ {
+ if (g_os_bitmaps[index].priv != 0)
+ {
+ g_os_bitmaps[index].priv->status = 0;
+ }
+ }
}
- }
- }
- }
- g_max_os_bitmaps = 0;
- g_free(g_os_bitmaps);
- g_os_bitmaps = 0;
- g_use_rail = 0;
- return 0;
+ }
+
+ g_max_os_bitmaps = 0;
+ g_free(g_os_bitmaps);
+ g_os_bitmaps = 0;
+ g_use_rail = 0;
+ return 0;
}
/*****************************************************************************/
int
rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv)
{
- int index;
- int rv;
- int oldest;
- int oldest_index;
-
- if (!g_connected)
- {
- return -1;
- }
- if (g_os_bitmaps == 0)
- {
- return -1;
- }
- rv = -1;
- index = 0;
- while (index < g_max_os_bitmaps)
- {
- if (g_os_bitmaps[index].used == 0)
- {
- g_os_bitmaps[index].used = 1;
- g_os_bitmaps[index].pixmap = pixmap;
- g_os_bitmaps[index].priv = priv;
- g_os_bitmaps[index].stamp = g_os_bitmap_stamp;
- g_os_bitmap_stamp++;
- g_pixmap_num_used++;
- rv = index;
- break;
- }
- index++;
- }
- if (rv == -1)
- {
- /* find oldest */
- oldest = 0x7fffffff;
- oldest_index = 0;
+ int index;
+ int rv;
+ int oldest;
+ int oldest_index;
+
+ if (!g_connected)
+ {
+ return -1;
+ }
+
+ if (g_os_bitmaps == 0)
+ {
+ return -1;
+ }
+
+ rv = -1;
index = 0;
+
while (index < g_max_os_bitmaps)
{
- if (g_os_bitmaps[index].stamp < oldest)
- {
- oldest = g_os_bitmaps[index].stamp;
- oldest_index = index;
- }
- index++;
- }
- LLOGLN(10, ("rdpup_add_os_bitmap: evicting old, oldest_index %d", oldest_index));
- /* evict old */
- g_os_bitmaps[oldest_index].priv->status = 0;
- /* set new */
- g_os_bitmaps[oldest_index].pixmap = pixmap;
- g_os_bitmaps[oldest_index].priv = priv;
- g_os_bitmaps[oldest_index].stamp = g_os_bitmap_stamp;
- g_os_bitmap_stamp++;
- rv = oldest_index;
- }
- LLOGLN(10, ("rdpup_add_os_bitmap: new bitmap index %d", rv));
- LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used));
- return rv;
+ if (g_os_bitmaps[index].used == 0)
+ {
+ g_os_bitmaps[index].used = 1;
+ g_os_bitmaps[index].pixmap = pixmap;
+ g_os_bitmaps[index].priv = priv;
+ g_os_bitmaps[index].stamp = g_os_bitmap_stamp;
+ g_os_bitmap_stamp++;
+ g_pixmap_num_used++;
+ rv = index;
+ break;
+ }
+
+ index++;
+ }
+
+ if (rv == -1)
+ {
+ /* find oldest */
+ oldest = 0x7fffffff;
+ oldest_index = 0;
+ index = 0;
+
+ while (index < g_max_os_bitmaps)
+ {
+ if (g_os_bitmaps[index].stamp < oldest)
+ {
+ oldest = g_os_bitmaps[index].stamp;
+ oldest_index = index;
+ }
+
+ index++;
+ }
+
+ LLOGLN(10, ("rdpup_add_os_bitmap: evicting old, oldest_index %d", oldest_index));
+ /* evict old */
+ g_os_bitmaps[oldest_index].priv->status = 0;
+ /* set new */
+ g_os_bitmaps[oldest_index].pixmap = pixmap;
+ g_os_bitmaps[oldest_index].priv = priv;
+ g_os_bitmaps[oldest_index].stamp = g_os_bitmap_stamp;
+ g_os_bitmap_stamp++;
+ rv = oldest_index;
+ }
+
+ LLOGLN(10, ("rdpup_add_os_bitmap: new bitmap index %d", rv));
+ LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used));
+ return rv;
}
/*****************************************************************************/
int
rdpup_remove_os_bitmap(int rdpindex)
{
- LLOGLN(10, ("rdpup_remove_os_bitmap: index %d stamp %d",
- rdpindex, g_os_bitmaps[rdpindex].stamp));
- if (g_os_bitmaps == 0)
- {
- return 1;
- }
- if ((rdpindex < 0) && (rdpindex >= g_max_os_bitmaps))
- {
- return 1;
- }
- if (g_os_bitmaps[rdpindex].used)
- {
- g_os_bitmaps[rdpindex].used = 0;
- g_os_bitmaps[rdpindex].pixmap = 0;
- g_os_bitmaps[rdpindex].priv = 0;
- g_pixmap_num_used--;
- }
- LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used));
- return 0;
+ LLOGLN(10, ("rdpup_remove_os_bitmap: index %d stamp %d",
+ rdpindex, g_os_bitmaps[rdpindex].stamp));
+
+ if (g_os_bitmaps == 0)
+ {
+ return 1;
+ }
+
+ if ((rdpindex < 0) && (rdpindex >= g_max_os_bitmaps))
+ {
+ return 1;
+ }
+
+ if (g_os_bitmaps[rdpindex].used)
+ {
+ g_os_bitmaps[rdpindex].used = 0;
+ g_os_bitmaps[rdpindex].pixmap = 0;
+ g_os_bitmaps[rdpindex].priv = 0;
+ g_pixmap_num_used--;
+ }
+
+ LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used));
+ return 0;
}
/*****************************************************************************/
/* returns error */
static int
-rdpup_send(char* data, int len)
+rdpup_send(char *data, int len)
{
- int sent;
+ int sent;
- LLOGLN(10, ("rdpup_send - sending %d bytes", 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
- {
- rdpup_disconnect();
- return 1;
- }
- }
- else if (sent == 0)
+ LLOGLN(10, ("rdpup_send - sending %d bytes", len));
+
+ if (g_sck_closed)
{
- rdpup_disconnect();
- return 1;
+ return 1;
}
- else
+
+ while (len > 0)
{
- data += sent;
- len -= sent;
+ 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
+ {
+ rdpup_disconnect();
+ return 1;
+ }
+ }
+ else if (sent == 0)
+ {
+ rdpup_disconnect();
+ return 1;
+ }
+ else
+ {
+ data += sent;
+ len -= sent;
+ }
}
- }
- return 0;
+
+ return 0;
}
/******************************************************************************/
static int
-rdpup_send_msg(struct stream* s)
+rdpup_send_msg(struct stream *s)
{
- int len;
- int rv;
-
- rv = 1;
- if (s != 0)
- {
- len = (int)(s->end - s->data);
- if (len > s->size)
- {
- rdpLog("overrun error len %d count %d\n", len, g_count);
- }
- s_pop_layer(s, iso_hdr);
- out_uint16_le(s, 3);
- out_uint16_le(s, g_count);
- out_uint32_le(s, len - 8);
- rv = rdpup_send(s->data, len);
- }
- if (rv != 0)
- {
- rdpLog("error in rdpup_send_msg\n");
- }
- return rv;
+ int len;
+ int rv;
+
+ rv = 1;
+
+ if (s != 0)
+ {
+ len = (int)(s->end - s->data);
+
+ if (len > s->size)
+ {
+ rdpLog("overrun error len %d count %d\n", len, g_count);
+ }
+
+ s_pop_layer(s, iso_hdr);
+ out_uint16_le(s, 3);
+ out_uint16_le(s, g_count);
+ out_uint32_le(s, len - 8);
+ rv = rdpup_send(s->data, len);
+ }
+
+ if (rv != 0)
+ {
+ rdpLog("error in rdpup_send_msg\n");
+ }
+
+ return rv;
}
/******************************************************************************/
static int
rdpup_send_pending(void)
{
- if (g_connected && g_begin)
- {
- LLOGLN(10, ("end %d", g_count));
- out_uint16_le(g_out_s, 2);
- out_uint16_le(g_out_s, 4);
- g_count++;
- s_mark_end(g_out_s);
- rdpup_send_msg(g_out_s);
- }
- g_count = 0;
- g_begin = 0;
- return 0;
+ if (g_connected && g_begin)
+ {
+ LLOGLN(10, ("end %d", g_count));
+ out_uint16_le(g_out_s, 2);
+ out_uint16_le(g_out_s, 4);
+ g_count++;
+ s_mark_end(g_out_s);
+ rdpup_send_msg(g_out_s);
+ }
+
+ g_count = 0;
+ g_begin = 0;
+ return 0;
}
/******************************************************************************/
static CARD32
rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg)
{
- LLOGLN(10, ("rdpDeferredUpdateCallback"));
- if (g_do_dirty_ons)
- {
- rdpup_check_dirty_screen(&g_screenPriv);
- }
- else
- {
- rdpup_send_pending();
- }
- g_scheduled = 0;
- return 0;
+ LLOGLN(10, ("rdpDeferredUpdateCallback"));
+
+ if (g_do_dirty_ons)
+ {
+ rdpup_check_dirty_screen(&g_screenPriv);
+ }
+ else
+ {
+ rdpup_send_pending();
+ }
+
+ g_scheduled = 0;
+ return 0;
}
/******************************************************************************/
void
rdpScheduleDeferredUpdate(void)
{
- if (!g_scheduled)
- {
- g_scheduled = 1;
- g_timer = TimerSet(g_timer, 0, 40, rdpDeferredUpdateCallback, 0);
- }
+ if (!g_scheduled)
+ {
+ g_scheduled = 1;
+ g_timer = TimerSet(g_timer, 0, 40, rdpDeferredUpdateCallback, 0);
+ }
}
/******************************************************************************/
/* returns error */
static int
-rdpup_recv(char* data, int len)
+rdpup_recv(char *data, int len)
{
- int rcvd;
+ 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
- {
- rdpup_disconnect();
- return 1;
- }
- }
- else if (rcvd == 0)
+ if (g_sck_closed)
{
- rdpup_disconnect();
- return 1;
+ return 1;
}
- else
+
+ while (len > 0)
{
- data += rcvd;
- len -= rcvd;
+ 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
+ {
+ rdpup_disconnect();
+ return 1;
+ }
+ }
+ else if (rcvd == 0)
+ {
+ rdpup_disconnect();
+ return 1;
+ }
+ else
+ {
+ data += rcvd;
+ len -= rcvd;
+ }
}
- }
- return 0;
+
+ return 0;
}
/******************************************************************************/
static int
-rdpup_recv_msg(struct stream* s)
+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)
- {
- rdpLog("error in rdpup_recv_msg\n");
- }
- return rv;
+ 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)
+ {
+ rdpLog("error in rdpup_recv_msg\n");
+ }
+
+ return rv;
}
/******************************************************************************/
@@ -438,1057 +473,1161 @@ rdpup_recv_msg(struct stream* s)
static int
process_screen_size_msg(int width, int height, int bpp)
{
- RRScreenSizePtr pSize;
- int mmwidth;
- int mmheight;
- Bool ok;
-
- LLOGLN(0, ("process_screen_size_msg: set width %d height %d bpp %d",
- width, height, bpp));
- g_rdpScreen.rdp_width = width;
- g_rdpScreen.rdp_height = height;
- g_rdpScreen.rdp_bpp = bpp;
- if (bpp < 15)
- {
- g_rdpScreen.rdp_Bpp = 1;
- g_rdpScreen.rdp_Bpp_mask = 0xff;
- }
- else if (bpp == 15)
- {
- g_rdpScreen.rdp_Bpp = 2;
- g_rdpScreen.rdp_Bpp_mask = 0x7fff;
- }
- else if (bpp == 16)
- {
- g_rdpScreen.rdp_Bpp = 2;
- g_rdpScreen.rdp_Bpp_mask = 0xffff;
- }
- else if (bpp > 16)
- {
- g_rdpScreen.rdp_Bpp = 4;
- g_rdpScreen.rdp_Bpp_mask = 0xffffff;
- }
- mmwidth = PixelToMM(width);
- mmheight = PixelToMM(height);
-
- pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight);
- RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize);
- if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height))
- {
- LLOGLN(0, (" calling RRScreenSizeSet"));
- ok = RRScreenSizeSet(g_pScreen, width, height, mmwidth, mmheight);
- LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok));
- }
- return 0;
+ RRScreenSizePtr pSize;
+ int mmwidth;
+ int mmheight;
+ Bool ok;
+
+ LLOGLN(0, ("process_screen_size_msg: set width %d height %d bpp %d",
+ width, height, bpp));
+ g_rdpScreen.rdp_width = width;
+ g_rdpScreen.rdp_height = height;
+ g_rdpScreen.rdp_bpp = bpp;
+
+ if (bpp < 15)
+ {
+ g_rdpScreen.rdp_Bpp = 1;
+ g_rdpScreen.rdp_Bpp_mask = 0xff;
+ }
+ else if (bpp == 15)
+ {
+ g_rdpScreen.rdp_Bpp = 2;
+ g_rdpScreen.rdp_Bpp_mask = 0x7fff;
+ }
+ else if (bpp == 16)
+ {
+ g_rdpScreen.rdp_Bpp = 2;
+ g_rdpScreen.rdp_Bpp_mask = 0xffff;
+ }
+ else if (bpp > 16)
+ {
+ g_rdpScreen.rdp_Bpp = 4;
+ g_rdpScreen.rdp_Bpp_mask = 0xffffff;
+ }
+
+ mmwidth = PixelToMM(width);
+ mmheight = PixelToMM(height);
+
+ pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight);
+ RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize);
+
+ if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height))
+ {
+ LLOGLN(0, (" calling RRScreenSizeSet"));
+ ok = RRScreenSizeSet(g_pScreen, width, height, mmwidth, mmheight);
+ LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok));
+ }
+
+ return 0;
}
/******************************************************************************/
static int
l_bound_by(int val, int low, int high)
{
- if (val > high)
- {
- val = high;
- }
- if (val < low)
- {
- val = low;
- }
- return val;
+ if (val > high)
+ {
+ val = high;
+ }
+
+ if (val < low)
+ {
+ val = low;
+ }
+
+ return val;
}
/******************************************************************************/
static int
rdpup_send_caps(void)
{
- struct stream* ls;
- int len;
- int rv;
- int cap_count;
- int cap_bytes;
+ struct stream *ls;
+ int len;
+ int rv;
+ int cap_count;
+ int cap_bytes;
- make_stream(ls);
- init_stream(ls, 8192);
- s_push_layer(ls, iso_hdr, 8);
+ make_stream(ls);
+ init_stream(ls, 8192);
+ s_push_layer(ls, iso_hdr, 8);
- cap_count = 0;
- cap_bytes = 0;
+ cap_count = 0;
+ cap_bytes = 0;
#if 0
- out_uint16_le(ls, 0);
- out_uint16_le(ls, 4);
- cap_count++;
- cap_bytes += 4;
-
- out_uint16_le(ls, 1);
- out_uint16_le(ls, 4);
- cap_count++;
- cap_bytes += 4;
+ out_uint16_le(ls, 0);
+ out_uint16_le(ls, 4);
+ cap_count++;
+ cap_bytes += 4;
+
+ out_uint16_le(ls, 1);
+ out_uint16_le(ls, 4);
+ cap_count++;
+ cap_bytes += 4;
#endif
- s_mark_end(ls);
- len = (int)(ls->end - ls->data);
- s_pop_layer(ls, iso_hdr);
- out_uint16_le(ls, 2); /* caps */
- out_uint16_le(ls, cap_count); /* num caps */
- out_uint32_le(ls, cap_bytes); /* caps len after header */
-
- rv = rdpup_send(ls->data, len);
- if (rv != 0)
- {
- LLOGLN(0, ("rdpup_send_caps: rdpup_send failed"));
- }
- free_stream(ls);
- return rv;
+ s_mark_end(ls);
+ len = (int)(ls->end - ls->data);
+ s_pop_layer(ls, iso_hdr);
+ out_uint16_le(ls, 2); /* caps */
+ out_uint16_le(ls, cap_count); /* num caps */
+ out_uint32_le(ls, cap_bytes); /* caps len after header */
+
+ rv = rdpup_send(ls->data, len);
+
+ if (rv != 0)
+ {
+ LLOGLN(0, ("rdpup_send_caps: rdpup_send failed"));
+ }
+
+ free_stream(ls);
+ return rv;
}
/******************************************************************************/
static int
process_version_msg(int param1, int param2, int param3, int param4)
{
- LLOGLN(0, ("process_version_msg: version %d %d %d %d", param1, param2,
- param3, param4));
- if ((param1 > 0) || (param2 > 0) || (param3 > 0) || (param4 > 0))
- {
- rdpup_send_caps();
- }
- return 0;
+ LLOGLN(0, ("process_version_msg: version %d %d %d %d", param1, param2,
+ param3, param4));
+
+ if ((param1 > 0) || (param2 > 0) || (param3 > 0) || (param4 > 0))
+ {
+ rdpup_send_caps();
+ }
+
+ return 0;
}
/******************************************************************************/
static int
rdpup_send_rail(void)
{
- WindowPtr wnd;
- rdpWindowRec* priv;
-
- wnd = g_pScreen->root;
- if (wnd != 0)
- {
- wnd = wnd->lastChild;
- while (wnd != 0)
- {
- if (wnd->realized)
- {
- priv = GETWINPRIV(wnd);
- priv->status = 1;
- rdpup_create_window(wnd, priv);
- }
- wnd = wnd->prevSib;
- }
- }
- return 0;
+ WindowPtr wnd;
+ rdpWindowRec *priv;
+
+ wnd = g_pScreen->root;
+
+ if (wnd != 0)
+ {
+ wnd = wnd->lastChild;
+
+ while (wnd != 0)
+ {
+ if (wnd->realized)
+ {
+ priv = GETWINPRIV(wnd);
+ priv->status = 1;
+ rdpup_create_window(wnd, priv);
+ }
+
+ wnd = wnd->prevSib;
+ }
+ }
+
+ return 0;
}
/******************************************************************************/
static int
-rdpup_process_msg(struct stream* s)
+rdpup_process_msg(struct stream *s)
{
- int msg_type;
- int msg;
- int param1;
- int param2;
- int param3;
- int param4;
- int bytes;
- int i1;
-
- 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);
- LLOGLN(10, ("rdpup_process_msg - msg %d param1 %d param2 %d param3 %d "
- "param4 %d", 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 */
- KbdSync(param1);
- break;
- case 100:
- /* without the minus 2, strange things happen when dragging
- past the width or height */
- g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2);
- g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2);
- 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(0, (param1 >> 16) & 0xffff, param1 & 0xffff,
- (param2 >> 16) & 0xffff, param2 & 0xffff);
- rdpup_end_update();
- break;
- case 300:
- process_screen_size_msg(param1, param2, param3);
- break;
- case 301:
- process_version_msg(param1, param2, param3, param4);
- break;
+ int msg_type;
+ int msg;
+ int param1;
+ int param2;
+ int param3;
+ int param4;
+ int bytes;
+ int i1;
+
+ 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);
+ LLOGLN(10, ("rdpup_process_msg - msg %d param1 %d param2 %d param3 %d "
+ "param4 %d", 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 */
+ KbdSync(param1);
+ break;
+ case 100:
+ /* without the minus 2, strange things happen when dragging
+ past the width or height */
+ g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2);
+ g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2);
+ 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(0, (param1 >> 16) & 0xffff, param1 & 0xffff,
+ (param2 >> 16) & 0xffff, param2 & 0xffff);
+ rdpup_end_update();
+ break;
+ case 300:
+ process_screen_size_msg(param1, param2, param3);
+ break;
+ case 301:
+ process_version_msg(param1, param2, param3, param4);
+ break;
+ }
+ }
+ else if (msg_type == 104)
+ {
+ in_uint32_le(s, bytes);
+
+ if (bytes > sizeof(g_rdpScreen.client_info))
+ {
+ bytes = sizeof(g_rdpScreen.client_info);
+ }
+
+ memcpy(&(g_rdpScreen.client_info), s->p - 4, bytes);
+ g_rdpScreen.client_info.size = bytes;
+ LLOGLN(0, ("rdpup_process_msg: got client info bytes %d", bytes));
+ LLOGLN(0, (" jpeg support %d", g_rdpScreen.client_info.jpeg));
+ i1 = g_rdpScreen.client_info.offscreen_support_level;
+ LLOGLN(0, (" offscreen support %d", i1));
+ i1 = g_rdpScreen.client_info.offscreen_cache_size;
+ LLOGLN(0, (" offscreen size %d", i1));
+ i1 = g_rdpScreen.client_info.offscreen_cache_entries;
+ LLOGLN(0, (" offscreen entries %d", i1));
+
+ if (g_rdpScreen.client_info.offscreen_support_level > 0)
+ {
+ if (g_rdpScreen.client_info.offscreen_cache_entries > 0)
+ {
+ g_max_os_bitmaps = g_rdpScreen.client_info.offscreen_cache_entries;
+ g_free(g_os_bitmaps);
+ g_os_bitmaps = (struct rdpup_os_bitmap *)
+ g_malloc(sizeof(struct rdpup_os_bitmap) * g_max_os_bitmaps, 1);
+ }
+ }
+
+ if (g_rdpScreen.client_info.rail_support_level > 0)
+ {
+ g_use_rail = 1;
+ rdpup_send_rail();
+ }
}
- }
- else if (msg_type == 104)
- {
- in_uint32_le(s, bytes);
- if (bytes > sizeof(g_rdpScreen.client_info))
- {
- bytes = sizeof(g_rdpScreen.client_info);
- }
- memcpy(&(g_rdpScreen.client_info), s->p - 4, bytes);
- g_rdpScreen.client_info.size = bytes;
- LLOGLN(0, ("rdpup_process_msg: got client info bytes %d", bytes));
- LLOGLN(0, (" jpeg support %d", g_rdpScreen.client_info.jpeg));
- i1 = g_rdpScreen.client_info.offscreen_support_level;
- LLOGLN(0, (" offscreen support %d", i1));
- i1 = g_rdpScreen.client_info.offscreen_cache_size;
- LLOGLN(0, (" offscreen size %d", i1));
- i1 = g_rdpScreen.client_info.offscreen_cache_entries;
- LLOGLN(0, (" offscreen entries %d", i1));
- if (g_rdpScreen.client_info.offscreen_support_level > 0)
- {
- if (g_rdpScreen.client_info.offscreen_cache_entries > 0)
- {
- g_max_os_bitmaps = g_rdpScreen.client_info.offscreen_cache_entries;
- g_free(g_os_bitmaps);
- g_os_bitmaps = (struct rdpup_os_bitmap*)
- g_malloc(sizeof(struct rdpup_os_bitmap) * g_max_os_bitmaps, 1);
- }
- }
- if (g_rdpScreen.client_info.rail_support_level > 0)
- {
- g_use_rail = 1;
- rdpup_send_rail();
- }
- }
- else
- {
- rdpLog("unknown message type in rdpup_process_msg %d\n", msg_type);
- }
- return 0;
+ else
+ {
+ rdpLog("unknown message type in rdpup_process_msg %d\n", msg_type);
+ }
+
+ return 0;
}
/******************************************************************************/
void
-rdpup_get_screen_image_rect(struct image_data* id)
+rdpup_get_screen_image_rect(struct image_data *id)
{
- id->width = g_rdpScreen.width;
- id->height = g_rdpScreen.height;
- id->bpp = g_rdpScreen.rdp_bpp;
- id->Bpp = g_rdpScreen.rdp_Bpp;
- id->lineBytes = g_rdpScreen.paddedWidthInBytes;
- id->pixels = g_rdpScreen.pfbMemory;
+ id->width = g_rdpScreen.width;
+ id->height = g_rdpScreen.height;
+ id->bpp = g_rdpScreen.rdp_bpp;
+ id->Bpp = g_rdpScreen.rdp_Bpp;
+ id->lineBytes = g_rdpScreen.paddedWidthInBytes;
+ id->pixels = g_rdpScreen.pfbMemory;
}
/******************************************************************************/
void
-rdpup_get_pixmap_image_rect(PixmapPtr pPixmap, struct image_data* id)
+rdpup_get_pixmap_image_rect(PixmapPtr pPixmap, struct image_data *id)
{
- id->width = pPixmap->drawable.width;
- id->height = pPixmap->drawable.height;
- id->bpp = g_rdpScreen.rdp_bpp;
- id->Bpp = g_rdpScreen.rdp_Bpp;
- id->lineBytes = pPixmap->devKind;
- id->pixels = (char*)(pPixmap->devPrivate.ptr);
+ id->width = pPixmap->drawable.width;
+ id->height = pPixmap->drawable.height;
+ id->bpp = g_rdpScreen.rdp_bpp;
+ id->Bpp = g_rdpScreen.rdp_Bpp;
+ id->lineBytes = pPixmap->devKind;
+ id->pixels = (char *)(pPixmap->devPrivate.ptr);
}
/******************************************************************************/
int
rdpup_init(void)
{
- char text[256];
- int i;
+ char text[256];
+ int i;
- if (!g_directory_exist("/tmp/.xrdp"))
- {
- if (!g_create_dir("/tmp/.xrdp"))
+ if (!g_directory_exist("/tmp/.xrdp"))
{
- LLOGLN(0, ("rdpup_init: g_create_dir failed"));
- return 0;
+ if (!g_create_dir("/tmp/.xrdp"))
+ {
+ LLOGLN(0, ("rdpup_init: g_create_dir failed"));
+ return 0;
+ }
+
+ g_chmod_hex("/tmp/.xrdp", 0x1777);
}
- g_chmod_hex("/tmp/.xrdp", 0x1777);
- }
- i = atoi(display);
- if (i < 1)
- {
- return 0;
- }
- 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_use_uds)
- {
- g_sprintf(g_uds_data, "/tmp/.xrdp/xrdp_display_%s", display);
- if (g_listen_sck == 0)
- {
- g_listen_sck = g_tcp_local_socket_stream();
- if (g_tcp_local_bind(g_listen_sck, g_uds_data) != 0)
- {
- LLOGLN(0, ("rdpup_init: g_tcp_local_bind failed"));
- return 0;
- }
- g_tcp_listen(g_listen_sck);
- AddEnabledDevice(g_listen_sck);
- }
- }
- else
- {
- g_sprintf(text, "62%2.2d", i);
- if (g_listen_sck == 0)
- {
- g_listen_sck = g_tcp_socket();
- if (g_tcp_bind(g_listen_sck, text) != 0)
- {
+
+ i = atoi(display);
+
+ if (i < 1)
+ {
return 0;
- }
- g_tcp_listen(g_listen_sck);
- AddEnabledDevice(g_listen_sck);
}
- }
- g_dis_listen_sck = g_tcp_local_socket_dgram();
- if (g_dis_listen_sck != 0)
- {
- g_sprintf(text, "/tmp/.xrdp/xrdp_disconnect_display_%s", display);
- if (g_tcp_local_bind(g_dis_listen_sck, text) == 0)
+
+ 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_use_uds)
{
- AddEnabledDevice(g_dis_listen_sck);
+ g_sprintf(g_uds_data, "/tmp/.xrdp/xrdp_display_%s", display);
+
+ if (g_listen_sck == 0)
+ {
+ g_listen_sck = g_tcp_local_socket_stream();
+
+ if (g_tcp_local_bind(g_listen_sck, g_uds_data) != 0)
+ {
+ LLOGLN(0, ("rdpup_init: g_tcp_local_bind failed"));
+ return 0;
+ }
+
+ g_tcp_listen(g_listen_sck);
+ AddEnabledDevice(g_listen_sck);
+ }
}
else
{
- rdpLog("g_tcp_local_bind failed [%s]\n", text);
+ g_sprintf(text, "62%2.2d", i);
+
+ 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);
+ }
+ }
+
+ g_dis_listen_sck = g_tcp_local_socket_dgram();
+
+ if (g_dis_listen_sck != 0)
+ {
+ g_sprintf(text, "/tmp/.xrdp/xrdp_disconnect_display_%s", display);
+
+ if (g_tcp_local_bind(g_dis_listen_sck, text) == 0)
+ {
+ AddEnabledDevice(g_dis_listen_sck);
+ }
+ else
+ {
+ rdpLog("g_tcp_local_bind failed [%s]\n", text);
+ }
}
- }
- return 1;
+
+ return 1;
}
/******************************************************************************/
int
rdpup_check(void)
{
- int sel;
- int new_sck;
- char buf[8];
+ int sel;
+ int new_sck;
+ char buf[8];
+
+ sel = g_tcp_select(g_listen_sck, g_sck, g_dis_listen_sck);
+
+ if (sel & 1)
+ {
+ new_sck = g_tcp_accept(g_listen_sck);
+
+ if (new_sck == -1)
+ {
+ }
+ else
+ {
+ if (g_sck != 0)
+ {
+ /* should maybe ask is user wants to allow here with timeout */
+ rdpLog("replacing connection, already got a connection\n");
+ rdpup_disconnect();
+ }
+
+ rdpLog("got a connection\n");
+ g_sck = new_sck;
+ g_tcp_set_non_blocking(g_sck);
+ g_tcp_set_no_delay(g_sck);
+ g_connected = 1;
+ g_sck_closed = 0;
+ g_begin = 0;
+ g_con_number++;
+ AddEnabledDevice(g_sck);
+ }
+ }
- sel = g_tcp_select(g_listen_sck, g_sck, g_dis_listen_sck);
- if (sel & 1)
- {
- new_sck = g_tcp_accept(g_listen_sck);
- if (new_sck == -1)
+ if (sel & 2)
{
+ if (rdpup_recv_msg(g_in_s) == 0)
+ {
+ rdpup_process_msg(g_in_s);
+ }
}
- else
+
+ if (sel & 4)
{
- if (g_sck != 0)
- {
- /* should maybe ask is user wants to allow here with timeout */
- rdpLog("replacing connection, already got a connection\n");
- rdpup_disconnect();
- }
- rdpLog("got a connection\n");
- g_sck = new_sck;
- g_tcp_set_non_blocking(g_sck);
- g_tcp_set_no_delay(g_sck);
- g_connected = 1;
- g_sck_closed = 0;
- g_begin = 0;
- g_con_number++;
- AddEnabledDevice(g_sck);
- }
- }
- if (sel & 2)
- {
- if (rdpup_recv_msg(g_in_s) == 0)
- {
- rdpup_process_msg(g_in_s);
- }
- }
- if (sel & 4)
- {
- if (g_tcp_recv(g_dis_listen_sck, buf, 4, 0) > 0)
- {
- if (g_sck != 0)
- {
- rdpLog("disconnecting session via user request\n");
- rdpup_disconnect();
- }
- }
- }
- return 0;
+ if (g_tcp_recv(g_dis_listen_sck, buf, 4, 0) > 0)
+ {
+ if (g_sck != 0)
+ {
+ rdpLog("disconnecting session via user request\n");
+ rdpup_disconnect();
+ }
+ }
+ }
+
+ return 0;
}
/******************************************************************************/
int
rdpup_begin_update(void)
{
- LLOGLN(10, ("rdpup_begin_update"));
- 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); /* begin update */
- out_uint16_le(g_out_s, 4); /* size */
- LLOGLN(10, ("begin %d", g_count));
- g_begin = 1;
- g_count = 1;
- }
- return 0;
+ LLOGLN(10, ("rdpup_begin_update"));
+
+ 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); /* begin update */
+ out_uint16_le(g_out_s, 4); /* size */
+ LLOGLN(10, ("begin %d", g_count));
+ g_begin = 1;
+ g_count = 1;
+ }
+
+ return 0;
}
/******************************************************************************/
int
rdpup_end_update(void)
{
- LLOGLN(10, ("rdpup_end_update"));
- if (g_connected && g_begin)
- {
- if (g_do_dirty_ons)
- {
- rdpup_send_pending();
- }
- else
+ LLOGLN(10, ("rdpup_end_update"));
+
+ if (g_connected && g_begin)
{
- rdpScheduleDeferredUpdate();
+ if (g_do_dirty_ons)
+ {
+ rdpup_send_pending();
+ }
+ else
+ {
+ rdpScheduleDeferredUpdate();
+ }
}
- }
- return 0;
+
+ 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)))
- {
- 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;
+ if (!g_begin)
+ {
+ rdpup_begin_update();
+ }
+
+ if ((g_out_s->p - g_out_s->data) > (g_out_s->size - (in_size + 20)))
+ {
+ 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)
- {
- LLOGLN(10, (" rdpup_fill_rect"));
- rdpup_pre_check(12);
- out_uint16_le(g_out_s, 3); /* fill rect */
- out_uint16_le(g_out_s, 12); /* size */
- 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;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_fill_rect"));
+ rdpup_pre_check(12);
+ out_uint16_le(g_out_s, 3); /* fill rect */
+ out_uint16_le(g_out_s, 12); /* size */
+ 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)
- {
- LLOGLN(10, (" rdpup_screen_blt"));
- rdpup_pre_check(16);
- out_uint16_le(g_out_s, 4); /* screen blt */
- out_uint16_le(g_out_s, 16); /* size */
- 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;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_screen_blt"));
+ rdpup_pre_check(16);
+ out_uint16_le(g_out_s, 4); /* screen blt */
+ out_uint16_le(g_out_s, 16); /* size */
+ 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)
- {
- LLOGLN(10, (" rdpup_set_clip"));
- rdpup_pre_check(12);
- out_uint16_le(g_out_s, 10); /* set clip */
- out_uint16_le(g_out_s, 12); /* size */
- 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;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_set_clip"));
+ rdpup_pre_check(12);
+ out_uint16_le(g_out_s, 10); /* set clip */
+ out_uint16_le(g_out_s, 12); /* size */
+ 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)
- {
- LLOGLN(10, (" rdpup_reset_clip"));
- rdpup_pre_check(4);
- out_uint16_le(g_out_s, 11); /* reset clip */
- out_uint16_le(g_out_s, 4); /* size */
- g_count++;
- }
- return 0;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_reset_clip"));
+ rdpup_pre_check(4);
+ out_uint16_le(g_out_s, 11); /* reset clip */
+ out_uint16_le(g_out_s, 4); /* size */
+ g_count++;
+ }
+
+ return 0;
}
#define COLOR8(r, g, b) \
- ((((r) >> 5) << 0) | (((g) >> 5) << 3) | (((b) >> 6) << 6))
+ ((((r) >> 5) << 0) | (((g) >> 5) << 3) | (((b) >> 6) << 6))
#define COLOR15(r, g, b) \
- ((((r) >> 3) << 10) | (((g) >> 3) << 5) | (((b) >> 3) << 0))
+ ((((r) >> 3) << 10) | (((g) >> 3) << 5) | (((b) >> 3) << 0))
#define COLOR16(r, g, b) \
- ((((r) >> 3) << 11) | (((g) >> 2) << 5) | (((b) >> 3) << 0))
+ ((((r) >> 3) << 11) | (((g) >> 2) << 5) | (((b) >> 3) << 0))
#define COLOR24(r, g, b) \
- ((((r) >> 0) << 0) | (((g) >> 0) << 8) | (((b) >> 0) << 16))
+ ((((r) >> 0) << 0) | (((g) >> 0) << 8) | (((b) >> 0) << 16))
#define SPLITCOLOR32(r, g, b, c) \
-{ \
- r = ((c) >> 16) & 0xff; \
- g = ((c) >> 8) & 0xff; \
- b = (c) & 0xff; \
-}
+ { \
+ r = ((c) >> 16) & 0xff; \
+ g = ((c) >> 8) & 0xff; \
+ b = (c) & 0xff; \
+ }
int
convert_pixel(int in_pixel)
{
- int red;
- int green;
- int blue;
- int rv;
+ int red;
+ int green;
+ int blue;
+ int rv;
- rv = 0;
- if (g_rdpScreen.depth == 24)
- {
- if (g_rdpScreen.rdp_bpp == 24)
+ rv = 0;
+
+ if (g_rdpScreen.depth == 24)
{
- rv = in_pixel;
- SPLITCOLOR32(red, green, blue, rv);
- rv = COLOR24(red, green, blue);
+ if (g_rdpScreen.rdp_bpp == 24)
+ {
+ rv = in_pixel;
+ SPLITCOLOR32(red, green, blue, rv);
+ rv = COLOR24(red, green, blue);
+ }
+ else if (g_rdpScreen.rdp_bpp == 16)
+ {
+ rv = in_pixel;
+ SPLITCOLOR32(red, green, blue, rv);
+ rv = COLOR16(red, green, blue);
+ }
+ else if (g_rdpScreen.rdp_bpp == 15)
+ {
+ rv = in_pixel;
+ SPLITCOLOR32(red, green, blue, rv);
+ rv = COLOR15(red, green, blue);
+ }
+ else if (g_rdpScreen.rdp_bpp == 8)
+ {
+ rv = in_pixel;
+ SPLITCOLOR32(red, green, blue, rv);
+ rv = COLOR8(red, green, blue);
+ }
}
- else if (g_rdpScreen.rdp_bpp == 16)
+ else if (g_rdpScreen.depth == g_rdpScreen.rdp_bpp)
{
- rv = in_pixel;
- SPLITCOLOR32(red, green, blue, rv);
- rv = COLOR16(red, green, blue);
+ return in_pixel;
}
- else if (g_rdpScreen.rdp_bpp == 15)
+
+ return rv;
+}
+
+int
+convert_pixels(void *src, void *dst, int num_pixels)
+{
+ unsigned int pixel;
+ unsigned int red;
+ unsigned int green;
+ unsigned int blue;
+ unsigned int *src32;
+ unsigned int *dst32;
+ unsigned short *dst16;
+ unsigned char *dst8;
+ int index;
+
+ if (g_rdpScreen.depth == g_rdpScreen.rdp_bpp)
{
- rv = in_pixel;
- SPLITCOLOR32(red, green, blue, rv);
- rv = COLOR15(red, green, blue);
+ memcpy(dst, src, num_pixels * g_Bpp);
+ return 0;
}
- else if (g_rdpScreen.rdp_bpp == 8)
+
+ if (g_rdpScreen.depth == 24)
{
- rv = in_pixel;
- SPLITCOLOR32(red, green, blue, rv);
- rv = COLOR8(red, green, blue);
+ src32 = (unsigned int *)src;
+
+ if (g_rdpScreen.rdp_bpp == 24)
+ {
+ dst32 = (unsigned int *)dst;
+
+ for (index = 0; index < num_pixels; index++)
+ {
+ pixel = *src32;
+ *dst32 = pixel;
+ dst32++;
+ src32++;
+ }
+ }
+ else if (g_rdpScreen.rdp_bpp == 16)
+ {
+ dst16 = (unsigned short *)dst;
+
+ for (index = 0; index < num_pixels; index++)
+ {
+ pixel = *src32;
+ SPLITCOLOR32(red, green, blue, pixel);
+ pixel = COLOR16(red, green, blue);
+ *dst16 = pixel;
+ dst16++;
+ src32++;
+ }
+ }
+ else if (g_rdpScreen.rdp_bpp == 15)
+ {
+ dst16 = (unsigned short *)dst;
+
+ for (index = 0; index < num_pixels; index++)
+ {
+ pixel = *src32;
+ SPLITCOLOR32(red, green, blue, pixel);
+ pixel = COLOR15(red, green, blue);
+ *dst16 = pixel;
+ dst16++;
+ src32++;
+ }
+ }
+ else if (g_rdpScreen.rdp_bpp == 8)
+ {
+ dst8 = (unsigned char *)dst;
+
+ for (index = 0; index < num_pixels; index++)
+ {
+ pixel = *src32;
+ SPLITCOLOR32(red, green, blue, pixel);
+ pixel = COLOR8(red, green, blue);
+ *dst8 = pixel;
+ dst8++;
+ src32++;
+ }
+ }
}
- }
- else if (g_rdpScreen.depth == g_rdpScreen.rdp_bpp)
- {
- return in_pixel;
- }
- return rv;
-}
-int
-convert_pixels(void* src, void* dst, int num_pixels)
-{
- unsigned int pixel;
- unsigned int red;
- unsigned int green;
- unsigned int blue;
- unsigned int* src32;
- unsigned int* dst32;
- unsigned short* dst16;
- unsigned char* dst8;
- int index;
-
- if (g_rdpScreen.depth == g_rdpScreen.rdp_bpp)
- {
- memcpy(dst, src, num_pixels * g_Bpp);
return 0;
- }
- if (g_rdpScreen.depth == 24)
- {
- src32 = (unsigned int*)src;
- if (g_rdpScreen.rdp_bpp == 24)
- {
- dst32 = (unsigned int*)dst;
- for (index = 0; index < num_pixels; index++)
- {
- pixel = *src32;
- *dst32 = pixel;
- dst32++;
- src32++;
- }
- }
- else if (g_rdpScreen.rdp_bpp == 16)
- {
- dst16 = (unsigned short*)dst;
- for (index = 0; index < num_pixels; index++)
- {
- pixel = *src32;
- SPLITCOLOR32(red, green, blue, pixel);
- pixel = COLOR16(red, green, blue);
- *dst16 = pixel;
- dst16++;
- src32++;
- }
- }
- else if (g_rdpScreen.rdp_bpp == 15)
- {
- dst16 = (unsigned short*)dst;
- for (index = 0; index < num_pixels; index++)
- {
- pixel = *src32;
- SPLITCOLOR32(red, green, blue, pixel);
- pixel = COLOR15(red, green, blue);
- *dst16 = pixel;
- dst16++;
- src32++;
- }
- }
- else if (g_rdpScreen.rdp_bpp == 8)
- {
- dst8 = (unsigned char*)dst;
- for (index = 0; index < num_pixels; index++)
- {
- pixel = *src32;
- SPLITCOLOR32(red, green, blue, pixel);
- pixel = COLOR8(red, green, blue);
- *dst8 = pixel;
- dst8++;
- src32++;
- }
- }
- }
- return 0;
}
/******************************************************************************/
int
rdpup_set_fgcolor(int fgcolor)
{
- if (g_connected)
- {
- LLOGLN(10, (" rdpup_set_fgcolor"));
- rdpup_pre_check(8);
- out_uint16_le(g_out_s, 12); /* set fgcolor */
- out_uint16_le(g_out_s, 8); /* size */
- g_count++;
- fgcolor = fgcolor & g_Bpp_mask;
- fgcolor = convert_pixel(fgcolor) & g_rdpScreen.rdp_Bpp_mask;
- out_uint32_le(g_out_s, fgcolor);
- }
- return 0;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_set_fgcolor"));
+ rdpup_pre_check(8);
+ out_uint16_le(g_out_s, 12); /* set fgcolor */
+ out_uint16_le(g_out_s, 8); /* size */
+ g_count++;
+ fgcolor = fgcolor & g_Bpp_mask;
+ fgcolor = convert_pixel(fgcolor) & g_rdpScreen.rdp_Bpp_mask;
+ out_uint32_le(g_out_s, fgcolor);
+ }
+
+ return 0;
}
/******************************************************************************/
int
rdpup_set_bgcolor(int bgcolor)
{
- if (g_connected)
- {
- LLOGLN(10, (" rdpup_set_bgcolor"));
- rdpup_pre_check(8);
- out_uint16_le(g_out_s, 13); /* set bg color */
- out_uint16_le(g_out_s, 8); /* size */
- g_count++;
- bgcolor = bgcolor & g_Bpp_mask;
- bgcolor = convert_pixel(bgcolor) & g_rdpScreen.rdp_Bpp_mask;
- out_uint32_le(g_out_s, bgcolor);
- }
- return 0;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_set_bgcolor"));
+ rdpup_pre_check(8);
+ out_uint16_le(g_out_s, 13); /* set bg color */
+ out_uint16_le(g_out_s, 8); /* size */
+ g_count++;
+ bgcolor = bgcolor & g_Bpp_mask;
+ bgcolor = convert_pixel(bgcolor) & g_rdpScreen.rdp_Bpp_mask;
+ out_uint32_le(g_out_s, bgcolor);
+ }
+
+ return 0;
}
/******************************************************************************/
int
rdpup_set_opcode(int opcode)
{
- if (g_connected)
- {
- LLOGLN(10, (" rdpup_set_opcode"));
- rdpup_pre_check(6);
- out_uint16_le(g_out_s, 14); /* set opcode */
- out_uint16_le(g_out_s, 6); /* size */
- g_count++;
- out_uint16_le(g_out_s, g_rdp_opcodes[opcode & 0xf]);
- }
- return 0;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_set_opcode"));
+ rdpup_pre_check(6);
+ out_uint16_le(g_out_s, 14); /* set opcode */
+ out_uint16_le(g_out_s, 6); /* size */
+ g_count++;
+ out_uint16_le(g_out_s, g_rdp_opcodes[opcode & 0xf]);
+ }
+
+ return 0;
}
/******************************************************************************/
int
rdpup_set_pen(int style, int width)
{
- if (g_connected)
- {
- LLOGLN(10, (" rdpup_set_pen"));
- rdpup_pre_check(8);
- out_uint16_le(g_out_s, 17); /* set pen */
- out_uint16_le(g_out_s, 8); /* size */
- g_count++;
- out_uint16_le(g_out_s, style);
- out_uint16_le(g_out_s, width);
- }
- return 0;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_set_pen"));
+ rdpup_pre_check(8);
+ out_uint16_le(g_out_s, 17); /* set pen */
+ out_uint16_le(g_out_s, 8); /* size */
+ 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)
- {
- LLOGLN(10, (" rdpup_draw_line"));
- rdpup_pre_check(12);
- out_uint16_le(g_out_s, 18); /* draw line */
- out_uint16_le(g_out_s, 12); /* size */
- 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;
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_draw_line"));
+ rdpup_pre_check(12);
+ out_uint16_le(g_out_s, 18); /* draw line */
+ out_uint16_le(g_out_s, 12); /* size */
+ 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)
+rdpup_set_cursor(short x, short y, char *cur_data, char *cur_mask)
{
- int size;
-
- if (g_connected)
- {
- LLOGLN(10, (" rdpup_set_cursor"));
- size = 8 + 32 * (32 * 3) + 32 * (32 / 8);
- rdpup_pre_check(size);
- out_uint16_le(g_out_s, 19); /* set cursor */
- out_uint16_le(g_out_s, size); /* size */
- g_count++;
- x = MAX(0, x);
- x = MIN(31, x);
- y = MAX(0, y);
- y = MIN(31, y);
- 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;
+ int size;
+
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_set_cursor"));
+ size = 8 + 32 * (32 * 3) + 32 * (32 / 8);
+ rdpup_pre_check(size);
+ out_uint16_le(g_out_s, 19); /* set cursor */
+ out_uint16_le(g_out_s, size); /* size */
+ g_count++;
+ x = MAX(0, x);
+ x = MIN(31, x);
+ y = MAX(0, y);
+ y = MIN(31, y);
+ 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;
}
/******************************************************************************/
int
rdpup_create_os_surface(int rdpindex, int width, int height)
{
- LLOGLN(10, ("rdpup_create_os_surface:"));
- if (g_connected)
- {
- LLOGLN(10, (" rdpup_create_os_surface width %d height %d", width, height));
- rdpup_pre_check(12);
- out_uint16_le(g_out_s, 20);
- out_uint16_le(g_out_s, 12);
- g_count++;
- out_uint32_le(g_out_s, rdpindex);
- out_uint16_le(g_out_s, width);
- out_uint16_le(g_out_s, height);
- }
- return 0;
+ LLOGLN(10, ("rdpup_create_os_surface:"));
+
+ if (g_connected)
+ {
+ LLOGLN(10, (" rdpup_create_os_surface width %d height %d", width, height));
+ rdpup_pre_check(12);
+ out_uint16_le(g_out_s, 20);
+ out_uint16_le(g_out_s, 12);
+ g_count++;
+ out_uint32_le(g_out_s, rdpindex);
+ out_uint16_le(g_out_s, width);
+ out_uint16_le(g_out_s, height);
+ }
+
+ return 0;
}
/******************************************************************************/
int
rdpup_switch_os_surface(int rdpindex)
{
- LLOGLN(10, ("rdpup_switch_os_surface:"));
- if (g_connected)
- {
- if (g_rdpindex == rdpindex)
- {
- return 0;
- }
- g_rdpindex = rdpindex;
- LLOGLN(10, ("rdpup_switch_os_surface: rdpindex %d", rdpindex));
- /* switch surface */
- rdpup_pre_check(8);
- out_uint16_le(g_out_s, 21);
- out_uint16_le(g_out_s, 8);
- out_uint32_le(g_out_s, rdpindex);
- g_count++;
- }
- return 0;
+ LLOGLN(10, ("rdpup_switch_os_surface:"));
+
+ if (g_connected)
+ {
+ if (g_rdpindex == rdpindex)
+ {
+ return 0;
+ }
+
+ g_rdpindex = rdpindex;
+ LLOGLN(10, ("rdpup_switch_os_surface: rdpindex %d", rdpindex));
+ /* switch surface */
+ rdpup_pre_check(8);
+ out_uint16_le(g_out_s, 21);
+ out_uint16_le(g_out_s, 8);
+ out_uint32_le(g_out_s, rdpindex);
+ g_count++;
+ }
+
+ return 0;
}
/******************************************************************************/
int
rdpup_delete_os_surface(int rdpindex)
{
- LLOGLN(10, ("rdpup_delete_os_surface: rdpindex %d", rdpindex));
- if (g_connected)
- {
LLOGLN(10, ("rdpup_delete_os_surface: rdpindex %d", rdpindex));
- rdpup_pre_check(8);
- out_uint16_le(g_out_s, 22);
- out_uint16_le(g_out_s, 8);
- g_count++;
- out_uint32_le(g_out_s, rdpindex);
- }
- return 0;
+
+ if (g_connected)
+ {
+ LLOGLN(10, ("rdpup_delete_os_surface: rdpindex %d", rdpindex));
+ rdpup_pre_check(8);
+ out_uint16_le(g_out_s, 22);
+ out_uint16_le(g_out_s, 8);
+ g_count++;
+ out_uint32_le(g_out_s, rdpindex);
+ }
+
+ return 0;
}
/******************************************************************************/
static int
-get_single_color(struct image_data* id, int x, int y, int w, int h)
+get_single_color(struct image_data *id, int x, int y, int w, int h)
{
- int rv;
- int i;
- int j;
- int p;
- unsigned char* i8;
- unsigned short* i16;
- unsigned int* i32;
-
- p = 0;
- rv = -1;
- if (g_Bpp == 1)
- {
- for (i = 0; i < h; i++)
- {
- i8 = (unsigned char*)(id->pixels +
- ((y + i) * id->lineBytes) + (x * g_Bpp));
- if (i == 0)
- {
- p = *i8;
- }
- for (j = 0; j < w; j++)
- {
- if (i8[j] != p)
+ int rv;
+ int i;
+ int j;
+ int p;
+ unsigned char *i8;
+ unsigned short *i16;
+ unsigned int *i32;
+
+ p = 0;
+ rv = -1;
+
+ if (g_Bpp == 1)
+ {
+ for (i = 0; i < h; i++)
{
- return -1;
+ i8 = (unsigned char *)(id->pixels +
+ ((y + i) * id->lineBytes) + (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*)(id->pixels +
- ((y + i) * id->lineBytes) + (x * g_Bpp));
- if (i == 0)
- {
- p = *i16;
- }
- for (j = 0; j < w; j++)
- {
- if (i16[j] != p)
+
+ rv = p;
+ }
+ else if (g_Bpp == 2)
+ {
+ for (i = 0; i < h; i++)
{
- return -1;
+ i16 = (unsigned short *)(id->pixels +
+ ((y + i) * id->lineBytes) + (x * g_Bpp));
+
+ if (i == 0)
+ {
+ p = *i16;
+ }
+
+ for (j = 0; j < w; j++)
+ {
+ if (i16[j] != p)
+ {
+ return -1;
+ }
+ }
}
- }
- }
- rv = p;
- }
- else if (g_Bpp == 4)
- {
- for (i = 0; i < h; i++)
- {
- i32 = (unsigned int*)(id->pixels +
- ((y + i) * id->lineBytes) + (x * g_Bpp));
- if (i == 0)
- {
- p = *i32;
- }
- for (j = 0; j < w; j++)
- {
- if (i32[j] != p)
+
+ rv = p;
+ }
+ else if (g_Bpp == 4)
+ {
+ for (i = 0; i < h; i++)
{
- return -1;
+ i32 = (unsigned int *)(id->pixels +
+ ((y + i) * id->lineBytes) + (x * g_Bpp));
+
+ if (i == 0)
+ {
+ p = *i32;
+ }
+
+ for (j = 0; j < w; j++)
+ {
+ if (i32[j] != p)
+ {
+ return -1;
+ }
+ }
}
- }
+
+ rv = p;
}
- rv = p;
- }
- return rv;
+
+ return rv;
}
/******************************************************************************/
/* split the bitmap up into 64 x 64 pixel areas */
void
-rdpup_send_area(struct image_data* id, int x, int y, int w, int h)
+rdpup_send_area(struct image_data *id, int x, int y, int w, int h)
{
- char* s;
- int i;
- int single_color;
- int lx;
- int ly;
- int lh;
- int lw;
- int size;
- struct image_data lid;
-
- LLOGLN(10, ("rdpup_send_area: id %p x %d y %d w %d h %d", id, x, y, w, h));
- if (id == 0)
- {
- rdpup_get_screen_image_rect(&lid);
- id = &lid;
- }
-
- if (x >= id->width)
- {
- return;
- }
- if (y >= id->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 > id->width)
- {
- w = id->width - x;
- }
- if (y + h > id->height)
- {
- h = id->height - y;
- }
- LLOGLN(10, ("%d", w * h));
- if (g_connected && g_begin)
- {
- LLOGLN(10, (" rdpup_send_area"));
- 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(id, lx, ly, lw, lh);
- if (single_color != -1)
- {
- LLOGLN(10, ("%d sending single color", g_count));
- rdpup_set_fgcolor(single_color);
- rdpup_fill_rect(lx, ly, lw, lh);
- }
- else
+ char *s;
+ int i;
+ int single_color;
+ int lx;
+ int ly;
+ int lh;
+ int lw;
+ int size;
+ struct image_data lid;
+
+ LLOGLN(10, ("rdpup_send_area: id %p x %d y %d w %d h %d", id, x, y, w, h));
+
+ if (id == 0)
+ {
+ rdpup_get_screen_image_rect(&lid);
+ id = &lid;
+ }
+
+ if (x >= id->width)
+ {
+ return;
+ }
+
+ if (y >= id->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 > id->width)
+ {
+ w = id->width - x;
+ }
+
+ if (y + h > id->height)
+ {
+ h = id->height - y;
+ }
+
+ LLOGLN(10, ("%d", w * h));
+
+ if (g_connected && g_begin)
+ {
+ LLOGLN(10, (" rdpup_send_area"));
+ ly = y;
+
+ while (ly < y + h)
{
- size = lw * lh * id->Bpp + 24;
- rdpup_pre_check(size);
- out_uint16_le(g_out_s, 5);
- out_uint16_le(g_out_s, size);
- 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 * id->Bpp);
- for (i = 0; i < lh; i++)
- {
- s = (id->pixels +
- ((ly + i) * id->lineBytes) + (lx * g_Bpp));
- convert_pixels(s, g_out_s->p, lw);
- g_out_s->p += lw * id->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 = x;
+
+ while (lx < x + w)
+ {
+ lw = MIN(64, (x + w) - lx);
+ lh = MIN(64, (y + h) - ly);
+ single_color = get_single_color(id, lx, ly, lw, lh);
+
+ if (single_color != -1)
+ {
+ LLOGLN(10, ("%d sending single color", g_count));
+ rdpup_set_fgcolor(single_color);
+ rdpup_fill_rect(lx, ly, lw, lh);
+ }
+ else
+ {
+ size = lw * lh * id->Bpp + 24;
+ rdpup_pre_check(size);
+ out_uint16_le(g_out_s, 5);
+ out_uint16_le(g_out_s, size);
+ 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 * id->Bpp);
+
+ for (i = 0; i < lh; i++)
+ {
+ s = (id->pixels +
+ ((ly + i) * id->lineBytes) + (lx * g_Bpp));
+ convert_pixels(s, g_out_s->p, lw);
+ g_out_s->p += lw * id->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;
}
- lx += 64;
- }
- ly += 64;
}
- }
}
/******************************************************************************/
@@ -1496,66 +1635,58 @@ void
rdpup_paint_rect_os(int x, int y, int cx, int cy,
int rdpindex, int srcx, int srcy)
{
- if (g_connected)
- {
- rdpup_pre_check(20);
- out_uint16_le(g_out_s, 23);
- out_uint16_le(g_out_s, 20);
- 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_uint32_le(g_out_s, rdpindex);
- out_uint16_le(g_out_s, srcx);
- out_uint16_le(g_out_s, srcy);
- }
+ if (g_connected)
+ {
+ rdpup_pre_check(20);
+ out_uint16_le(g_out_s, 23);
+ out_uint16_le(g_out_s, 20);
+ 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_uint32_le(g_out_s, rdpindex);
+ out_uint16_le(g_out_s, srcx);
+ out_uint16_le(g_out_s, srcy);
+ }
}
/******************************************************************************/
void
rdpup_set_hints(int hints, int mask)
{
- if (g_connected)
- {
- rdpup_pre_check(12);
- out_uint16_le(g_out_s, 24);
- out_uint16_le(g_out_s, 12);
- g_count++;
- out_uint32_le(g_out_s, hints);
- out_uint32_le(g_out_s, mask);
- }
+ if (g_connected)
+ {
+ rdpup_pre_check(12);
+ out_uint16_le(g_out_s, 24);
+ out_uint16_le(g_out_s, 12);
+ g_count++;
+ out_uint32_le(g_out_s, hints);
+ out_uint32_le(g_out_s, mask);
+ }
}
/******************************************************************************/
void
-rdpup_create_window(WindowPtr pWindow, rdpWindowRec* priv)
+rdpup_create_window(WindowPtr pWindow, rdpWindowRec *priv)
{
- int bytes;
- int index;
- int flags;
- int num_window_rects;
- int num_visibility_rects;
- int title_bytes;
- int style;
- int ext_style;
- int root_id;
- char title[256];
-
- LLOGLN(10, ("rdpup_create_window: id 0x%8.8x", pWindow->drawable.id));
- if (g_connected)
- {
- root_id = pWindow->drawable.pScreen->root->drawable.id;
-
- if (pWindow->overrideRedirect)
- {
- style = XR_STYLE_TOOLTIP;
- ext_style = XR_EXT_STYLE_TOOLTIP;
- }
- else
+ int bytes;
+ int index;
+ int flags;
+ int num_window_rects;
+ int num_visibility_rects;
+ int title_bytes;
+ int style;
+ int ext_style;
+ int root_id;
+ char title[256];
+
+ LLOGLN(10, ("rdpup_create_window: id 0x%8.8x", pWindow->drawable.id));
+
+ if (g_connected)
{
- style = XR_STYLE_NORMAL;
- ext_style = XR_EXT_STYLE_NORMAL;
+ style = XR_STYLE_NORMAL;
+ ext_style = XR_EXT_STYLE_NORMAL;
}
flags = WINDOW_ORDER_TYPE_WINDOW | WINDOW_ORDER_STATE_NEW;
@@ -1604,266 +1735,305 @@ rdpup_create_window(WindowPtr pWindow, rdpWindowRec* priv)
out_uint32_le(g_out_s, pWindow->drawable.height); /* window_height */
flags |= WINDOW_ORDER_FIELD_WND_SIZE;
out_uint16_le(g_out_s, num_window_rects); /* num_window_rects */
+
for (index = 0; index < num_window_rects; index++)
{
- out_uint16_le(g_out_s, 0); /* left */
- out_uint16_le(g_out_s, 0); /* top */
- out_uint16_le(g_out_s, pWindow->drawable.width); /* right */
- out_uint16_le(g_out_s, pWindow->drawable.height); /* bottom */
+ out_uint16_le(g_out_s, 0); /* left */
+ out_uint16_le(g_out_s, 0); /* top */
+ out_uint16_le(g_out_s, pWindow->drawable.width); /* right */
+ out_uint16_le(g_out_s, pWindow->drawable.height); /* bottom */
}
+
flags |= WINDOW_ORDER_FIELD_WND_RECTS;
out_uint32_le(g_out_s, pWindow->drawable.x); /* visible_offset_x */
out_uint32_le(g_out_s, pWindow->drawable.y); /* visible_offset_y */
flags |= WINDOW_ORDER_FIELD_VIS_OFFSET;
out_uint16_le(g_out_s, num_visibility_rects); /* num_visibility_rects */
+
for (index = 0; index < num_visibility_rects; index++)
{
- out_uint16_le(g_out_s, 0); /* left */
- out_uint16_le(g_out_s, 0); /* top */
- out_uint16_le(g_out_s, pWindow->drawable.width); /* right */
- out_uint16_le(g_out_s, pWindow->drawable.height); /* bottom */
+ out_uint16_le(g_out_s, 0); /* left */
+ out_uint16_le(g_out_s, 0); /* top */
+ out_uint16_le(g_out_s, pWindow->drawable.width); /* right */
+ out_uint16_le(g_out_s, pWindow->drawable.height); /* bottom */
}
+
flags |= WINDOW_ORDER_FIELD_VISIBILITY;
out_uint32_le(g_out_s, flags); /* flags */
- }
+}
}
/******************************************************************************/
void
-rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv)
+rdpup_delete_window(WindowPtr pWindow, rdpWindowRec *priv)
{
- LLOGLN(10, ("rdpup_delete_window: id 0x%8.8x", pWindow->drawable.id));
- if (g_connected)
- {
- rdpup_pre_check(8);
- out_uint16_le(g_out_s, 26);
- out_uint16_le(g_out_s, 8);
- g_count++;
- out_uint32_le(g_out_s, pWindow->drawable.id); /* window_id */
- }
+ LLOGLN(10, ("rdpup_delete_window: id 0x%8.8x", pWindow->drawable.id));
+
+ if (g_connected)
+ {
+ rdpup_pre_check(8);
+ out_uint16_le(g_out_s, 26);
+ out_uint16_le(g_out_s, 8);
+ g_count++;
+ out_uint32_le(g_out_s, pWindow->drawable.id); /* window_id */
+ }
}
/******************************************************************************/
int
-rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv)
+rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec *pDirtyPriv)
{
- int index;
- int clip_index;
- int count;
- int num_clips;
- BoxRec box;
- xSegment* seg;
- struct image_data id;
- struct rdp_draw_item* di;
-
- if (pDirtyPriv == 0)
- {
- return 0;
- }
- if (pDirtyPriv->is_dirty == 0)
- {
- return 0;
- }
-
- /* update use time / count */
- g_os_bitmaps[pDirtyPriv->rdpindex].stamp = g_os_bitmap_stamp;
- g_os_bitmap_stamp++;
-
- LLOGLN(10, ("-----------------got dirty"));
- rdpup_switch_os_surface(pDirtyPriv->rdpindex);
- rdpup_get_pixmap_image_rect(pDirtyPixmap, &id);
- rdpup_begin_update();
- draw_item_pack(pDirtyPriv);
- di = pDirtyPriv->draw_item_head;
- while (di != 0)
- {
- LLOGLN(10, ("rdpup_check_dirty: type %d", di->type));
- switch (di->type)
- {
- case RDI_FILL:
- rdpup_set_fgcolor(di->u.fill.fg_color);
- rdpup_set_opcode(di->u.fill.opcode);
- count = REGION_NUM_RECTS(di->reg);
- for (index = 0; index < count; index++)
- {
- box = REGION_RECTS(di->reg)[index];
- LLOGLN(10, (" RDI_FILL %d %d %d %d", box.x1, box.y1,
- box.x2, box.y2));
- rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- }
- rdpup_set_opcode(GXcopy);
- break;
- case RDI_IMGLL:
- rdpup_set_hints(1, 1);
- rdpup_set_opcode(di->u.img.opcode);
- count = REGION_NUM_RECTS(di->reg);
- for (index = 0; index < count; index++)
- {
- box = REGION_RECTS(di->reg)[index];
- LLOGLN(10, (" RDI_IMGLL %d %d %d %d", box.x1, box.y1,
- box.x2, box.y2));
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
- rdpup_set_opcode(GXcopy);
- rdpup_set_hints(0, 1);
- break;
- case RDI_IMGLY:
- rdpup_set_opcode(di->u.img.opcode);
- count = REGION_NUM_RECTS(di->reg);
- for (index = 0; index < count; index++)
- {
- box = REGION_RECTS(di->reg)[index];
- LLOGLN(10, (" RDI_IMGLY %d %d %d %d", box.x1, box.y1,
- box.x2, box.y2));
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
- rdpup_set_opcode(GXcopy);
- break;
- case RDI_LINE:
- LLOGLN(10, (" RDI_LINE"));
- num_clips = REGION_NUM_RECTS(di->reg);
- if (num_clips > 0)
+ int index;
+ int clip_index;
+ int count;
+ int num_clips;
+ BoxRec box;
+ xSegment *seg;
+ struct image_data id;
+ struct rdp_draw_item *di;
+
+ if (pDirtyPriv == 0)
+ {
+ return 0;
+ }
+
+ if (pDirtyPriv->is_dirty == 0)
+ {
+ return 0;
+ }
+
+ /* update use time / count */
+ g_os_bitmaps[pDirtyPriv->rdpindex].stamp = g_os_bitmap_stamp;
+ g_os_bitmap_stamp++;
+
+ LLOGLN(10, ("-----------------got dirty"));
+ rdpup_switch_os_surface(pDirtyPriv->rdpindex);
+ rdpup_get_pixmap_image_rect(pDirtyPixmap, &id);
+ rdpup_begin_update();
+ draw_item_pack(pDirtyPriv);
+ di = pDirtyPriv->draw_item_head;
+
+ while (di != 0)
+ {
+ LLOGLN(10, ("rdpup_check_dirty: type %d", di->type));
+
+ switch (di->type)
{
- rdpup_set_fgcolor(di->u.line.fg_color);
- rdpup_set_opcode(di->u.line.opcode);
- rdpup_set_pen(0, di->u.line.width);
- for (clip_index = num_clips - 1; clip_index >= 0; clip_index--)
- {
- box = REGION_RECTS(di->reg)[clip_index];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- for (index = 0; index < di->u.line.nseg; index++)
- {
- seg = di->u.line.segs + index;
- LLOGLN(10, (" RDI_LINE %d %d %d %d", seg->x1, seg->y1,
- seg->x2, seg->y2));
- rdpup_draw_line(seg->x1, seg->y1, seg->x2, seg->y2);
- }
- }
+ case RDI_FILL:
+ rdpup_set_fgcolor(di->u.fill.fg_color);
+ rdpup_set_opcode(di->u.fill.opcode);
+ count = REGION_NUM_RECTS(di->reg);
+
+ for (index = 0; index < count; index++)
+ {
+ box = REGION_RECTS(di->reg)[index];
+ LLOGLN(10, (" RDI_FILL %d %d %d %d", box.x1, box.y1,
+ box.x2, box.y2));
+ rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ break;
+ case RDI_IMGLL:
+ rdpup_set_hints(1, 1);
+ rdpup_set_opcode(di->u.img.opcode);
+ count = REGION_NUM_RECTS(di->reg);
+
+ for (index = 0; index < count; index++)
+ {
+ box = REGION_RECTS(di->reg)[index];
+ LLOGLN(10, (" RDI_IMGLL %d %d %d %d", box.x1, box.y1,
+ box.x2, box.y2));
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ rdpup_set_hints(0, 1);
+ break;
+ case RDI_IMGLY:
+ rdpup_set_opcode(di->u.img.opcode);
+ count = REGION_NUM_RECTS(di->reg);
+
+ for (index = 0; index < count; index++)
+ {
+ box = REGION_RECTS(di->reg)[index];
+ LLOGLN(10, (" RDI_IMGLY %d %d %d %d", box.x1, box.y1,
+ box.x2, box.y2));
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ break;
+ case RDI_LINE:
+ LLOGLN(10, (" RDI_LINE"));
+ num_clips = REGION_NUM_RECTS(di->reg);
+
+ if (num_clips > 0)
+ {
+ rdpup_set_fgcolor(di->u.line.fg_color);
+ rdpup_set_opcode(di->u.line.opcode);
+ rdpup_set_pen(0, di->u.line.width);
+
+ for (clip_index = num_clips - 1; clip_index >= 0; clip_index--)
+ {
+ box = REGION_RECTS(di->reg)[clip_index];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+
+ for (index = 0; index < di->u.line.nseg; index++)
+ {
+ seg = di->u.line.segs + index;
+ LLOGLN(10, (" RDI_LINE %d %d %d %d", seg->x1, seg->y1,
+ seg->x2, seg->y2));
+ rdpup_draw_line(seg->x1, seg->y1, seg->x2, seg->y2);
+ }
+ }
+ }
+
+ rdpup_reset_clip();
+ rdpup_set_opcode(GXcopy);
+ break;
}
+
rdpup_reset_clip();
rdpup_set_opcode(GXcopy);
break;
- case RDI_SCRBLT:
+ case RDI_SCRBLT:
LLOGLN(10, (" RDI_SCRBLT"));
break;
}
+
di = di->next;
- }
- draw_item_remove_all(pDirtyPriv);
- rdpup_end_update();
- pDirtyPriv->is_dirty = 0;
- rdpup_switch_os_surface(-1);
- return 0;
+}
+draw_item_remove_all(pDirtyPriv);
+rdpup_end_update();
+pDirtyPriv->is_dirty = 0;
+ rdpup_switch_os_surface(-1);
+ return 0;
}
-/******************************************************************************/
-int
-rdpup_check_dirty_screen(rdpPixmapRec* pDirtyPriv)
+ /******************************************************************************/
+ int
+ rdpup_check_dirty_screen(rdpPixmapRec *pDirtyPriv)
{
- int index;
- int clip_index;
- int count;
- int num_clips;
- BoxRec box;
- xSegment* seg;
- struct image_data id;
- struct rdp_draw_item* di;
-
- if (pDirtyPriv == 0)
- {
- return 0;
- }
- if (pDirtyPriv->is_dirty == 0)
- {
- return 0;
- }
-
- LLOGLN(10, ("-----------------got dirty"));
- rdpup_get_screen_image_rect(&id);
- rdpup_begin_update();
- draw_item_pack(pDirtyPriv);
- di = pDirtyPriv->draw_item_head;
- while (di != 0)
- {
- LLOGLN(10, ("rdpup_check_dirty_screen: type %d", di->type));
- switch (di->type)
- {
- case RDI_FILL:
- rdpup_set_fgcolor(di->u.fill.fg_color);
- rdpup_set_opcode(di->u.fill.opcode);
- count = REGION_NUM_RECTS(di->reg);
- for (index = 0; index < count; index++)
- {
- box = REGION_RECTS(di->reg)[index];
- LLOGLN(10, (" RDI_FILL %d %d %d %d", box.x1, box.y1,
- box.x2, box.y2));
- rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- }
- rdpup_set_opcode(GXcopy);
- break;
- case RDI_IMGLL:
- rdpup_set_hints(1, 1);
- rdpup_set_opcode(di->u.img.opcode);
- count = REGION_NUM_RECTS(di->reg);
- for (index = 0; index < count; index++)
- {
- box = REGION_RECTS(di->reg)[index];
- LLOGLN(10, (" RDI_IMGLL %d %d %d %d", box.x1, box.y1,
- box.x2, box.y2));
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
- rdpup_set_opcode(GXcopy);
- rdpup_set_hints(0, 1);
- break;
- case RDI_IMGLY:
- rdpup_set_opcode(di->u.img.opcode);
- count = REGION_NUM_RECTS(di->reg);
- for (index = 0; index < count; index++)
- {
- box = REGION_RECTS(di->reg)[index];
- LLOGLN(10, (" RDI_IMGLY %d %d %d %d", box.x1, box.y1,
- box.x2, box.y2));
- rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
- box.y2 - box.y1);
- }
- rdpup_set_opcode(GXcopy);
- break;
- case RDI_LINE:
- LLOGLN(10, (" RDI_LINE"));
- num_clips = REGION_NUM_RECTS(di->reg);
- if (num_clips > 0)
+ int index;
+ int clip_index;
+ int count;
+ int num_clips;
+ BoxRec box;
+ xSegment *seg;
+ struct image_data id;
+ struct rdp_draw_item *di;
+
+ if (pDirtyPriv == 0)
+ {
+ return 0;
+ }
+
+ if (pDirtyPriv->is_dirty == 0)
+ {
+ return 0;
+ }
+
+ LLOGLN(10, ("-----------------got dirty"));
+ rdpup_get_screen_image_rect(&id);
+ rdpup_begin_update();
+ draw_item_pack(pDirtyPriv);
+ di = pDirtyPriv->draw_item_head;
+
+ while (di != 0)
+ {
+ LLOGLN(10, ("rdpup_check_dirty_screen: type %d", di->type));
+
+ switch (di->type)
{
- rdpup_set_fgcolor(di->u.line.fg_color);
- rdpup_set_opcode(di->u.line.opcode);
- rdpup_set_pen(0, di->u.line.width);
- for (clip_index = num_clips - 1; clip_index >= 0; clip_index--)
- {
- box = REGION_RECTS(di->reg)[clip_index];
- rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
- for (index = 0; index < di->u.line.nseg; index++)
- {
- seg = di->u.line.segs + index;
- LLOGLN(10, (" RDI_LINE %d %d %d %d", seg->x1, seg->y1,
- seg->x2, seg->y2));
- rdpup_draw_line(seg->x1, seg->y1, seg->x2, seg->y2);
- }
- }
+ case RDI_FILL:
+ rdpup_set_fgcolor(di->u.fill.fg_color);
+ rdpup_set_opcode(di->u.fill.opcode);
+ count = REGION_NUM_RECTS(di->reg);
+
+ for (index = 0; index < count; index++)
+ {
+ box = REGION_RECTS(di->reg)[index];
+ LLOGLN(10, (" RDI_FILL %d %d %d %d", box.x1, box.y1,
+ box.x2, box.y2));
+ rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ break;
+ case RDI_IMGLL:
+ rdpup_set_hints(1, 1);
+ rdpup_set_opcode(di->u.img.opcode);
+ count = REGION_NUM_RECTS(di->reg);
+
+ for (index = 0; index < count; index++)
+ {
+ box = REGION_RECTS(di->reg)[index];
+ LLOGLN(10, (" RDI_IMGLL %d %d %d %d", box.x1, box.y1,
+ box.x2, box.y2));
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ rdpup_set_hints(0, 1);
+ break;
+ case RDI_IMGLY:
+ rdpup_set_opcode(di->u.img.opcode);
+ count = REGION_NUM_RECTS(di->reg);
+
+ for (index = 0; index < count; index++)
+ {
+ box = REGION_RECTS(di->reg)[index];
+ LLOGLN(10, (" RDI_IMGLY %d %d %d %d", box.x1, box.y1,
+ box.x2, box.y2));
+ rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
+ box.y2 - box.y1);
+ }
+
+ rdpup_set_opcode(GXcopy);
+ break;
+ case RDI_LINE:
+ LLOGLN(10, (" RDI_LINE"));
+ num_clips = REGION_NUM_RECTS(di->reg);
+
+ if (num_clips > 0)
+ {
+ rdpup_set_fgcolor(di->u.line.fg_color);
+ rdpup_set_opcode(di->u.line.opcode);
+ rdpup_set_pen(0, di->u.line.width);
+
+ for (clip_index = num_clips - 1; clip_index >= 0; clip_index--)
+ {
+ box = REGION_RECTS(di->reg)[clip_index];
+ rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
+
+ for (index = 0; index < di->u.line.nseg; index++)
+ {
+ seg = di->u.line.segs + index;
+ LLOGLN(10, (" RDI_LINE %d %d %d %d", seg->x1, seg->y1,
+ seg->x2, seg->y2));
+ rdpup_draw_line(seg->x1, seg->y1, seg->x2, seg->y2);
+ }
+ }
+ }
+
+ rdpup_reset_clip();
+ rdpup_set_opcode(GXcopy);
+ break;
+ case RDI_SCRBLT:
+ LLOGLN(10, (" RDI_SCRBLT"));
+ break;
}
- rdpup_reset_clip();
- rdpup_set_opcode(GXcopy);
- break;
- case RDI_SCRBLT:
- LLOGLN(10, (" RDI_SCRBLT"));
- break;
+
+ di = di->next;
}
- di = di->next;
- }
- draw_item_remove_all(pDirtyPriv);
- rdpup_end_update();
- pDirtyPriv->is_dirty = 0;
- return 0;
+
+ draw_item_remove_all(pDirtyPriv);
+ rdpup_end_update();
+ pDirtyPriv->is_dirty = 0;
+ return 0;
}