diff options
-rw-r--r-- | xorg/X11R7.6/rdp/Makefile | 1 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdp.h | 24 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpdraw.c | 95 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpmain.c | 7 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdprandr.c | 3 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpup.c | 204 |
6 files changed, 262 insertions, 72 deletions
diff --git a/xorg/X11R7.6/rdp/Makefile b/xorg/X11R7.6/rdp/Makefile index a4d405c1..7373f51a 100644 --- a/xorg/X11R7.6/rdp/Makefile +++ b/xorg/X11R7.6/rdp/Makefile @@ -57,6 +57,7 @@ CFLAGS = -O2 -Wall -fno-strength-reduce \ -I../../render \ -I../xfree86/common \ -I../xfree86/os-support \ + -I../../../common \ -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_REENTRANT \ -DGLX_USE_MESA -DXRECORD -D_GNU_SOURCE -DXAPPGROUP \ -DTOGCUP -DSINGLEDEPTH -DXFree86Server \ diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 0da7d967..7bec6726 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -70,7 +70,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "exevents.h" #include "xserver-properties.h" #include "xkbsrv.h" -#include "../../../common/xrdp_client_info.h" +/* in xrdp/common */ +#include "xrdp_client_info.h" +#include "xrdp_constants.h" //#include "colormapst.h" @@ -175,6 +177,22 @@ typedef rdpWindowRec* rdpWindowPtr; #define GETWINPRIV(_pWindow) \ (rdpWindowPtr)dixGetPrivateAddr(&(_pWindow->devPrivates), &g_rdpWindowIndex) +#define XR_IS_ROOT(_pWindow) ((_pWindow)->drawable.pScreen->root == (_pWindow)) + +/* for tooltips */ +#define XR_STYLE_TOOLTIP (0x80000000) +#define XR_EXT_STYLE_TOOLTIP (0x00000080 | 0x00000008) + +/* for normal desktop windows */ +/* WS_TILEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | + WS_MINIMIZEBOX | WS_MAXIMIZEBOX) */ +#define XR_STYLE_NORMAL (0x00C00000 | 0x00080000 | 0x00040000 | 0x00010000 | 0x00020000) +#define XR_EXT_STYLE_NORMAL (0x00040000) + +/* for dialogs */ +#define XR_STYLE_DIALOG (0x80000000) +#define XR_EXT_STYLE_DIALOG (0x00040000) + struct _rdpPixmapRec { int status; @@ -404,6 +422,10 @@ rdpup_paint_rect_os(int x, int y, int cx, int cy, int rdpindex, int srcx, int srcy); void rdpup_set_hints(int hints, int mask); +void +rdpup_create_window(WindowPtr pWindow, rdpWindowRec* priv); +void +rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv); #if defined(X_BYTE_ORDER) # if X_BYTE_ORDER == X_LITTLE_ENDIAN diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c index daa33c1d..2ba24fb0 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -46,14 +46,6 @@ Xserver drawing ops and funcs #include "rdpPolyGlyphBlt.h" #include "rdpPushPixels.h" -#if 1 -#define DEBUG_OUT_FUNCS(arg) -#define DEBUG_OUT_OPS(arg) -#else -#define DEBUG_OUT_FUNCS(arg) ErrorF arg -#define DEBUG_OUT_OPS(arg) ErrorF arg -#endif - #define LOG_LEVEL 1 #define LLOG(_level, _args) \ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0) @@ -67,6 +59,8 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern WindowPtr g_invalidate_window; /* in rdpmain.c */ +extern int g_use_rail; /* in rdpmain.c */ ColormapPtr g_rdpInstalledColormap; @@ -287,7 +281,7 @@ rdpChangeGC(GCPtr pGC, unsigned long mask) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpChangeGC\n")); + LLOGLN(10, ("in rdpChangeGC")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->ChangeGC(pGC, mask); GC_FUNC_EPILOGUE(pGC); @@ -299,7 +293,7 @@ rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpCopyGC\n")); + LLOGLN(10, ("in rdpCopyGC")); GC_FUNC_PROLOGUE(dst); dst->funcs->CopyGC(src, mask, dst); GC_FUNC_EPILOGUE(dst); @@ -311,7 +305,7 @@ rdpDestroyGC(GCPtr pGC) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpDestroyGC\n")); + LLOGLN(10, ("in rdpDestroyGC")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->DestroyGC(pGC); GC_FUNC_EPILOGUE(pGC); @@ -323,7 +317,7 @@ rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpChangeClip\n")); + LLOGLN(0, ("in rdpChangeClip")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->ChangeClip(pGC, type, pValue, nrects); GC_FUNC_EPILOGUE(pGC); @@ -335,7 +329,7 @@ rdpDestroyClip(GCPtr pGC) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpDestroyClip\n")); + LLOGLN(10, ("in rdpDestroyClip")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->DestroyClip(pGC); GC_FUNC_EPILOGUE(pGC); @@ -347,7 +341,7 @@ rdpCopyClip(GCPtr dst, GCPtr src) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpCopyClip\n")); + LLOGLN(0, ("in rdpCopyClip")); GC_FUNC_PROLOGUE(dst); dst->funcs->CopyClip(dst, src); GC_FUNC_EPILOGUE(dst); @@ -374,7 +368,7 @@ rdpCopyClip(GCPtr dst, GCPtr src) Bool rdpCloseScreen(int i, ScreenPtr pScreen) { - DEBUG_OUT_OPS(("in rdpCloseScreen\n")); + LLOGLN(10, ("in rdpCloseScreen")); pScreen->CloseScreen = g_rdpScreen.CloseScreen; pScreen->CreateGC = g_rdpScreen.CreateGC; //pScreen->PaintWindowBackground = g_rdpScreen.PaintWindowBackground; @@ -452,13 +446,16 @@ rdpCreateWindow(WindowPtr pWindow) rdpWindowRec* priv; Bool rv; - ErrorF("rdpCreateWindow:\n"); + LLOGLN(10, ("rdpCreateWindow:")); priv = GETWINPRIV(pWindow); - //ErrorF(" %p status %d\n", priv, priv->status); + 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; } @@ -470,12 +467,15 @@ rdpDestroyWindow(WindowPtr pWindow) rdpWindowRec* priv; Bool rv; - ErrorF("rdpDestroyWindow:\n"); + 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; } @@ -487,12 +487,20 @@ rdpPositionWindow(WindowPtr pWindow, int x, int y) rdpWindowRec* priv; Bool rv; - ErrorF("rdpPositionWindow:\n"); + 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) + { + LLOGLN(10, ("rdpPositionWindow:")); + LLOGLN(10, (" x %d y %d", x, y)); + } + } return rv; } @@ -504,12 +512,30 @@ rdpRealizeWindow(WindowPtr pWindow) rdpWindowRec* priv; Bool rv; - ErrorF("rdpRealizeWindow:\n"); + LLOGLN(0, ("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)) + { + 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; } @@ -521,12 +547,21 @@ rdpUnrealizeWindow(WindowPtr pWindow) rdpWindowRec* priv; Bool rv; - ErrorF("rdpUnrealizeWindow:\n"); + LLOGLN(0, ("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) + { + LLOGLN(10, ("rdpUnrealizeWindow:")); + priv->status = 0; + rdpup_delete_window(pWindow, priv); + } + } return rv; } @@ -538,12 +573,15 @@ rdpChangeWindowAttributes(WindowPtr pWindow, unsigned long mask) rdpWindowRec* priv; Bool rv; - ErrorF("rdpChangeWindowAttributes:\n"); + 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; } @@ -554,11 +592,14 @@ rdpWindowExposures(WindowPtr pWindow, RegionPtr pRegion, RegionPtr pBSRegion) ScreenPtr pScreen; rdpWindowRec* priv; - ErrorF("rdpWindowExposures:\n"); + 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; } @@ -569,7 +610,7 @@ rdpCreateGC(GCPtr pGC) rdpGCRec* priv; Bool rv; - DEBUG_OUT_OPS(("in rdpCreateGC\n")); + LLOGLN(10, ("in rdpCreateGC\n")); priv = GETGCPRIV(pGC); g_pScreen->CreateGC = g_rdpScreen.CreateGC; rv = g_pScreen->CreateGC(pGC); @@ -602,7 +643,7 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) BoxRec box1; BoxRec box2; - DEBUG_OUT_OPS(("in rdpCopyWindow\n")); + LLOGLN(10, ("in rdpCopyWindow")); RegionInit(®, NullBox, 0); RegionCopy(®, pOldRegion); g_pScreen->CopyWindow = g_rdpScreen.CopyWindow; @@ -661,7 +702,7 @@ rdpClearToBackground(WindowPtr pWin, int x, int y, int w, int h, BoxRec box; RegionRec reg; - DEBUG_OUT_OPS(("in rdpClearToBackground\n")); + LLOGLN(10, ("in rdpClearToBackground")); g_pScreen->ClearToBackground = g_rdpScreen.ClearToBackground; g_pScreen->ClearToBackground(pWin, x, y, w, h, generateExposures); if (!generateExposures) @@ -703,7 +744,7 @@ rdpRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed) int j; BoxRec box; - DEBUG_OUT_OPS(("in rdpRestoreAreas\n")); + LLOGLN(10, ("in rdpRestoreAreas")); RegionInit(®, NullBox, 0); RegionCopy(®, prgnExposed); g_pScreen->RestoreAreas = g_rdpScreen.RestoreAreas; diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c index c453cb05..2bf36771 100644 --- a/xorg/X11R7.6/rdp/rdpmain.c +++ b/xorg/X11R7.6/rdp/rdpmain.c @@ -42,9 +42,14 @@ DevPrivateKeyRec g_rdpPixmapIndex; DeviceIntPtr g_pointer = 0; DeviceIntPtr g_keyboard = 0; -Bool g_wrapWindow = 0; +Bool g_wrapWindow = 1; Bool g_wrapPixmap = 1; +/* if true, running in RemoteApp / RAIL mode */ +int g_use_rail = 0; + +WindowPtr g_invalidate_window = 0; + /* if true, use a unix domain socket instead of a tcp socket */ int g_use_uds = 0; char g_uds_data[256] = ""; /* data */ diff --git a/xorg/X11R7.6/rdp/rdprandr.c b/xorg/X11R7.6/rdp/rdprandr.c index 978e48aa..ec011e8f 100644 --- a/xorg/X11R7.6/rdp/rdprandr.c +++ b/xorg/X11R7.6/rdp/rdprandr.c @@ -34,6 +34,7 @@ extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */ extern DeviceIntPtr g_pointer; /* in rdpmain.c */ extern DeviceIntPtr g_keyboard; /* in rdpmain.c */ extern ScreenPtr g_pScreen; /* in rdpmain.c */ +extern WindowPtr g_invalidate_window; /* in rdpmain.c */ static XID g_wid = 0; @@ -108,8 +109,10 @@ rdpInvalidateArea(ScreenPtr pScreen, int x, int y, int cx, int cy) wVisual(pScreen->root), &result); if (result == 0) { + g_invalidate_window = pWin; MapWindow(pWin, serverClient); DeleteWindow(pWin, None); + g_invalidate_window = pWin; } return 0; } diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index abf23f8c..8b45dacc 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -20,12 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "rdp.h" - -#if 1 -#define DEBUG_OUT_UP(arg) -#else -#define DEBUG_OUT_UP(arg) ErrorF arg -#endif +#include "xrdp_rail.h" #define LOG_LEVEL 1 #define LLOG(_level, _args) \ @@ -59,6 +54,7 @@ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp_mask; /* from rdpmain.c */ extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */ +extern int g_use_rail; /* from rdpmain.c */ /* true is to use unix domain socket */ extern int g_use_uds; /* in rdpmain.c */ @@ -147,6 +143,7 @@ rdpup_disconnect(void) g_max_os_bitmaps = 0; g_free(g_os_bitmaps); g_os_bitmaps = 0; + g_use_rail = 0; return 0; } @@ -245,7 +242,7 @@ rdpup_send(char* data, int len) { int sent; - DEBUG_OUT_UP(("rdpup_send - sending %d bytes\n", len)); + LLOGLN(10, ("rdpup_send - sending %d bytes", len)); if (g_sck_closed) { return 1; @@ -313,7 +310,7 @@ rdpup_send_pending(void) { if (g_connected && g_begin) { - DEBUG_OUT_UP(("end %d\n", g_count)); + LLOGLN(10, ("end %d", g_count)); out_uint16_le(g_out_s, 2); out_uint16_le(g_out_s, 4); g_count++; @@ -428,8 +425,8 @@ process_screen_size_msg(int width, int height, int bpp) int mmheight; Bool ok; - ErrorF("process_screen_size_msg: set width %d height %d bpp %d\n", - width, height, bpp); + 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; @@ -460,9 +457,9 @@ process_screen_size_msg(int width, int height, int bpp) RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize); if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height)) { - ErrorF(" calling RRScreenSizeSet\n"); + LLOGLN(0, (" calling RRScreenSizeSet")); ok = RRScreenSizeSet(g_pScreen, width, height, mmwidth, mmheight); - ErrorF(" RRScreenSizeSet ok=[%d]\n", ok); + LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok)); } return 0; } @@ -521,7 +518,7 @@ rdpup_send_caps(void) rv = rdpup_send(ls->data, len); if (rv != 0) { - ErrorF("rdpup_send_caps: rdpup_send failed\n"); + LLOGLN(0, ("rdpup_send_caps: rdpup_send failed")); } free_stream(ls); return rv; @@ -531,8 +528,8 @@ rdpup_send_caps(void) static int process_version_msg(int param1, int param2, int param3, int param4) { - ErrorF("process_version_msg: version %d %d %d %d\n", param1, param2, - param3, 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(); @@ -551,6 +548,7 @@ rdpup_process_msg(struct stream* s) int param3; int param4; int bytes; + int i1; in_uint16_le(s, msg_type); if (msg_type == 103) @@ -560,8 +558,8 @@ rdpup_process_msg(struct stream* s) in_uint32_le(s, param2); in_uint32_le(s, param3); in_uint32_le(s, param4); - DEBUG_OUT_UP(("rdpup_process_msg - msg %d param1 %d param2 %d param3 %d \ -param4 %d\n", msg, param1, param2, param3, param4)); + 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 */ @@ -641,15 +639,14 @@ param4 %d\n", msg, param1, param2, param3, param4)); } memcpy(&(g_rdpScreen.client_info), s->p - 4, bytes); g_rdpScreen.client_info.size = bytes; - ErrorF("rdpup_process_msg: got client info bytes %d\n", bytes); - ErrorF(" jpeg support %d\n", - g_rdpScreen.client_info.jpeg); - ErrorF(" offscreen support %d\n", - g_rdpScreen.client_info.offscreen_support_level); - ErrorF(" offscreen size %d\n", - g_rdpScreen.client_info.offscreen_cache_size); - ErrorF(" offscreen entries %d\n", - g_rdpScreen.client_info.offscreen_cache_entries); + 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) @@ -660,6 +657,10 @@ param4 %d\n", msg, param1, param2, param3, param4)); 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; + } } else { @@ -703,7 +704,7 @@ rdpup_init(void) { if (!g_create_dir("/tmp/.xrdp")) { - ErrorF("rdpup_init: g_create_dir failed\n"); + LLOGLN(0, ("rdpup_init: g_create_dir failed")); return 0; } g_chmod_hex("/tmp/.xrdp", 0x1777); @@ -731,7 +732,7 @@ rdpup_init(void) g_listen_sck = g_tcp_local_socket_stream(); if (g_tcp_local_bind(g_listen_sck, g_uds_data) != 0) { - ErrorF("rdpup_init: g_tcp_local_bind failed\n"); + LLOGLN(0, ("rdpup_init: g_tcp_local_bind failed")); return 0; } g_tcp_listen(g_listen_sck); @@ -837,7 +838,7 @@ rdpup_begin_update(void) 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 */ - DEBUG_OUT_UP(("begin %d\n", g_count)); + LLOGLN(10, ("begin %d", g_count)); g_begin = 1; g_count = 1; } @@ -880,7 +881,7 @@ rdpup_fill_rect(short x, short y, int cx, int cy) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_fill_rect\n")); + 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 */ @@ -899,7 +900,7 @@ rdpup_screen_blt(short x, short y, int cx, int cy, short srcx, short srcy) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_screen_blt\n")); + 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 */ @@ -920,7 +921,7 @@ rdpup_set_clip(short x, short y, int cx, int cy) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_clip\n")); + 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 */ @@ -939,7 +940,7 @@ rdpup_reset_clip(void) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_reset_clip\n")); + 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 */ @@ -1087,7 +1088,7 @@ rdpup_set_fgcolor(int fgcolor) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_fgcolor\n")); + 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 */ @@ -1105,7 +1106,7 @@ rdpup_set_bgcolor(int bgcolor) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_bgcolor\n")); + 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 */ @@ -1123,7 +1124,7 @@ rdpup_set_opcode(int opcode) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_opcode\n")); + 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 */ @@ -1139,7 +1140,7 @@ rdpup_set_pen(int style, int width) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_pen\n")); + 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 */ @@ -1156,7 +1157,7 @@ rdpup_draw_line(short x1, short y1, short x2, short y2) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_draw_line\n")); + 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 */ @@ -1177,7 +1178,7 @@ rdpup_set_cursor(short x, short y, char* cur_data, char* cur_mask) if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_cursor\n")); + 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 */ @@ -1202,7 +1203,7 @@ rdpup_create_os_surface(int rdpindex, int width, int height) LLOGLN(10, ("rdpup_create_os_surface:")); if (g_connected) { - DEBUG_OUT_UP((" rdpup_create_os_surface\n")); + LLOGLN(10, (" rdpup_create_os_surface")); rdpup_pre_check(12); out_uint16_le(g_out_s, 20); out_uint16_le(g_out_s, 12); @@ -1387,10 +1388,10 @@ rdpup_send_area(struct image_data* id, int x, int y, int w, int h) { h = id->height - y; } - DEBUG_OUT_UP(("%d\n", w * h)); + LLOGLN(10, ("%d", w * h)); if (g_connected && g_begin) { - DEBUG_OUT_UP((" rdpup_send_area\n")); + LLOGLN(10, (" rdpup_send_area")); ly = y; while (ly < y + h) { @@ -1402,7 +1403,7 @@ rdpup_send_area(struct image_data* id, int x, int y, int w, int h) single_color = get_single_color(id, lx, ly, lw, lh); if (single_color != -1) { - DEBUG_OUT_UP(("%d sending single color\n", g_count)); + LLOGLN(10, ("%d sending single color", g_count)); rdpup_set_fgcolor(single_color); rdpup_fill_rect(lx, ly, lw, lh); } @@ -1472,3 +1473,120 @@ rdpup_set_hints(int hints, int mask) out_uint32_le(g_out_s, mask); } } + +/******************************************************************************/ +void +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(0, ("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 + { + style = XR_STYLE_NORMAL; + ext_style = XR_EXT_STYLE_NORMAL; + } + + flags = WINDOW_ORDER_TYPE_WINDOW | WINDOW_ORDER_STATE_NEW; + strcpy(title, "title"); + title_bytes = strlen(title); + + num_window_rects = 1; + num_visibility_rects = 1; + + /* calculate bytes */ + bytes = (2 + 2) + (5 * 4) + (2 + title_bytes) + (12 * 4) + + (2 + num_window_rects * 8) + (4 + 4) + + (2 + num_visibility_rects * 8) + 4; + + rdpup_pre_check(bytes); + out_uint16_le(g_out_s, 25); + out_uint16_le(g_out_s, bytes); + g_count++; + out_uint32_le(g_out_s, pWindow->drawable.id); /* window_id */ + out_uint32_le(g_out_s, pWindow->parent->drawable.id); /* owner_window_id */ + flags |= WINDOW_ORDER_FIELD_OWNER; + out_uint32_le(g_out_s, style); /* style */ + out_uint32_le(g_out_s, ext_style); /* extended_style */ + flags |= WINDOW_ORDER_FIELD_STYLE; + out_uint32_le(g_out_s, 0); /* show_state */ + flags |= WINDOW_ORDER_FIELD_SHOW; + out_uint16_le(g_out_s, title_bytes); /* title_info */ + out_uint8a(g_out_s, title, title_bytes); + flags |= WINDOW_ORDER_FIELD_TITLE; + out_uint32_le(g_out_s, 0); /* client_offset_x */ + out_uint32_le(g_out_s, 0); /* client_offset_y */ + flags |= WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET; + out_uint32_le(g_out_s, pWindow->drawable.width); /* client_area_width */ + out_uint32_le(g_out_s, pWindow->drawable.height); /* client_area_height */ + flags |= WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE; + out_uint32_le(g_out_s, 0); /* rp_content */ + out_uint32_le(g_out_s, root_id); /* root_parent_handle */ + flags |= WINDOW_ORDER_FIELD_ROOT_PARENT; + out_uint32_le(g_out_s, pWindow->drawable.x); /* window_offset_x */ + out_uint32_le(g_out_s, pWindow->drawable.y); /* window_offset_y */ + flags |= WINDOW_ORDER_FIELD_WND_OFFSET; + out_uint32_le(g_out_s, 0); /* window_client_delta_x */ + out_uint32_le(g_out_s, 0); /* window_client_delta_y */ + flags |= WINDOW_ORDER_FIELD_WND_CLIENT_DELTA; + out_uint32_le(g_out_s, pWindow->drawable.width); /* window_width */ + 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 */ + } + flags |= WINDOW_ORDER_FIELD_WND_RECTS; + out_uint32_le(g_out_s, 0); /* visible_offset_x */ + out_uint32_le(g_out_s, 0); /* 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 */ + } + flags |= WINDOW_ORDER_FIELD_VISIBILITY; + + out_uint32_le(g_out_s, flags); /* flags */ + } +} + +/******************************************************************************/ +void +rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv) +{ + LLOGLN(0, ("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 */ + } +} |