diff --git a/doc/rdesktop.1 b/doc/rdesktop.1 index 3708105..64abf11 100644 --- a/doc/rdesktop.1 +++ b/doc/rdesktop.1 @@ -128,6 +128,11 @@ but everything after this is unencrypted (including interactive logins). Do not send mouse motion events. This saves bandwidth, although some Windows applications may rely on receiving mouse motion. .TP +.BR "-M" +Use local X cursor inherited from window manager instead of server cursor. This +is mostly useful with -m, but is also useful if the server is sending bogus +mouse cursors. +.TP .BR "-C" Use private colourmap. This will improve colour accuracy on an 8-bit display, but rdesktop will appear in false colour when not focused. diff --git a/rdesktop.c b/rdesktop.c index 26411f7..6d5bf4f 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -96,6 +96,7 @@ RD_BOOL g_desktop_save = True; /* desktop save order */ RD_BOOL g_polygon_ellipse_orders = True; /* polygon / ellipse orders */ RD_BOOL g_fullscreen = False; RD_BOOL g_grab_keyboard = True; +RD_BOOL g_local_cursor = False; RD_BOOL g_hide_decorations = False; RDP_VERSION g_rdp_version = RDP_V5; /* Default to version 5 */ RD_BOOL g_rdpclip = True; @@ -182,6 +183,7 @@ usage(char *program) fprintf(stderr, " -e: disable encryption (French TS)\n"); fprintf(stderr, " -E: disable encryption from client to server\n"); fprintf(stderr, " -m: do not send motion events\n"); + fprintf(stderr, " -M: use local mouse cursor\n"); fprintf(stderr, " -C: use private colour map\n"); fprintf(stderr, " -D: hide window manager decorations\n"); fprintf(stderr, " -K: keep window manager key bindings\n"); @@ -638,7 +640,7 @@ main(int argc, char *argv[]) g_num_devices = 0; while ((c = getopt(argc, argv, - "A:u:L:d:s:c:p:n:k:g:o:fbBeEitmzCDKS:T:NX:a:x:Pr:045vh?")) != -1) + "A:u:L:d:s:c:p:n:k:g:o:fbBeEitmMzCDKS:T:NX:a:x:Pr:045vh?")) != -1) { switch (c) { @@ -787,6 +789,9 @@ main(int argc, char *argv[]) case 'm': g_sendmotion = False; break; + case 'M': + g_local_cursor = True; + break; case 'C': g_owncolmap = True; @@ -1040,6 +1045,12 @@ main(int argc, char *argv[]) usage(argv[0]); return EX_USAGE; } + if (g_local_cursor) + { + /* there is no point wasting bandwidth on cursor shadows + * that we're just going to throw out anyway */ + g_rdp5_performanceflags |= PERF_DISABLE_CURSOR_SHADOW; + } STRNCPY(server, argv[optind], sizeof(server)); parse_server_and_port(server); diff --git a/rdp.c b/rdp.c index cf1091c..03c868e 100644 --- a/rdp.c +++ b/rdp.c @@ -1171,6 +1171,7 @@ process_demand_active(STREAM s) static void process_colour_pointer_common(STREAM s, int bpp) { + extern RD_BOOL g_local_cursor; uint16 width, height, cache_idx, masklen, datalen; uint16 x, y; uint8 *mask; @@ -1194,6 +1195,7 @@ process_colour_pointer_common(STREAM s, int bpp) /* keep hotspot within cursor bounding box */ x = MIN(x, width - 1); y = MIN(y, height - 1); + if (g_local_cursor) return ; /* don't bother creating a cursor we won't use */ cursor = ui_create_cursor(x, y, width, height, mask, data, bpp); ui_set_cursor(cursor); cache_put_cursor(cache_idx, cursor); diff --git a/xwin.c b/xwin.c index 6282e98..071c722 100644 --- a/xwin.c +++ b/xwin.c @@ -3088,6 +3088,8 @@ ui_create_cursor(unsigned int xhot, unsigned int yhot, uint32 width, void ui_set_cursor(RD_HCURSOR cursor) { + extern RD_BOOL g_local_cursor; + if (g_local_cursor) return ; logger(GUI, Debug, "ui_set_cursor(): g_current_cursor = %p, new = %p", g_current_cursor, cursor);