minor patch to improve -m flag behaviour

Stefan Siegl <[email protected]>
Newsgroups gmane.network.rdesktop.devel
Message-ID <[email protected]>
Hello,

first of all, thanks for that useful program :-)

Anyways, since the mouse motions are kinda jerky if I connect to a
Windows Vista Business box (via subscriber line), I've tried using the
-m option, i.e. don't send motion events mode.  However with that one
the local pointer disappears and the remote mouse pointer is only
updated on press/release events, which makes it rather unusable.

I've patched rdesktop to not touch the local pointer's bitmap, i.e.
always leave that arrow visible.  Besides I've made it send motion
events if any of the first three mouse buttons is held down while moving
the mouse.  That way drag & drop just works as expected (though a bit
jerky) and otherwise the remote cursor is updated on clicks only.
I wonder whether it'd be better to add yet another command line flag for
that, but that way it's at least enough for me :)

See attached patch, if you're interested.

cheers,
  stesie

-- 
Stefan Siegl <[email protected]>
Das Ausdrucken dieser E-Mail ist nicht gestattet und wird bei 
Zuwiderhandlung urheberrechtlich verfolgt.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
rdesktop-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdesktop-devel
rdesktop-improve-mflag.patch (text/x-diff, 3.2 KB)
#
# Patch against rdesktop 1.6.0 improving behaviour of the
# `do not send motion events' command line option.
#
# a) Don't touch the local cursor if '-m' is set, i.e. don't make it
#    disappear or the like.
#
# b) Send motion-events if one of the first three mouse buttons is
#    pressed no matter what.  This allows to conveniently drag'n'drop
#    even with -m option being set.
#
Index: rdesktop-1.6.0/rdp5.c
===================================================================
--- rdesktop-1.6.0.orig/rdp5.c	2009-08-13 20:09:45.521923603 +0200
+++ rdesktop-1.6.0/rdp5.c	2009-08-13 20:32:54.390530954 +0200
@@ -24,6 +24,7 @@
 extern uint8 *g_next_packet;
 
 extern RDPCOMP g_mppc_dict;
+extern RD_BOOL g_sendmotion;
 
 void
 rdp5_process(STREAM s)
@@ -95,7 +96,8 @@
 			case 3:	/* update synchronize */
 				break;
 			case 5:	/* null pointer */
-				ui_set_null_cursor();
+				if (g_sendmotion)
+					ui_set_null_cursor();
 				break;
 			case 6:	/* default pointer */
 				break;
Index: rdesktop-1.6.0/rdp.c
===================================================================
--- rdesktop-1.6.0.orig/rdp.c	2009-08-13 20:27:56.017920433 +0200
+++ rdesktop-1.6.0/rdp.c	2009-08-13 20:32:16.742236987 +0200
@@ -52,6 +52,7 @@
 extern RD_BOOL g_bitmap_cache;
 extern RD_BOOL g_bitmap_cache_persist_enable;
 extern RD_BOOL g_numlock_sync;
+extern RD_BOOL g_sendmotion;
 
 uint8 *g_next_packet;
 uint32 g_rdp_shareid;
@@ -1029,7 +1030,12 @@
 	in_uint8p(s, data, datalen);
 	in_uint8p(s, mask, masklen);
 	cursor = ui_create_cursor(x, y, width, height, mask, data);
-	ui_set_cursor(cursor);
+
+	/* Don't really set the cursor if sending of motions is suppressed,
+	   just keep the arrow forever. */
+	if (g_sendmotion)
+		ui_set_cursor(cursor);
+
 	cache_put_cursor(cache_idx, cursor);
 }
 
@@ -1040,7 +1046,11 @@
 	uint16 cache_idx;
 
 	in_uint16_le(s, cache_idx);
-	ui_set_cursor(cache_get_cursor(cache_idx));
+
+	/* Don't really set the cursor if sending of motions is suppressed,
+	   just keep the arrow forever. */
+	if (g_sendmotion)
+		ui_set_cursor(cache_get_cursor(cache_idx));
 }
 
 /* Process a system pointer PDU */
@@ -1053,7 +1063,8 @@
 	switch (system_pointer_type)
 	{
 		case RDP_NULL_POINTER:
-			ui_set_null_cursor();
+			if (g_sendmotion)
+				ui_set_null_cursor();
 			break;
 
 		default:
Index: rdesktop-1.6.0/xwin.c
===================================================================
--- rdesktop-1.6.0.orig/xwin.c	2009-08-13 20:43:39.937924920 +0200
+++ rdesktop-1.6.0/xwin.c	2009-08-13 20:46:14.473917780 +0200
@@ -1976,10 +1976,9 @@
 get_input_mask(long *input_mask)
 {
 	*input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
-		VisibilityChangeMask | FocusChangeMask | StructureNotifyMask;
+		VisibilityChangeMask | FocusChangeMask | StructureNotifyMask | 
+		PointerMotionMask;
 
-	if (g_sendmotion)
-		*input_mask |= PointerMotionMask;
 	if (g_ownbackstore)
 		*input_mask |= ExposureMask;
 	if (g_fullscreen || g_grab_keyboard)
@@ -2374,6 +2373,12 @@
 				break;
 
 			case MotionNotify:
+				if (!g_sendmotion && (xevent.xmotion.state 
+						      & (Button1Mask 
+						         | Button2Mask
+						         | Button3Mask)) == 0)
+					break;
+
 				if (g_moving_wnd)
 				{
 					XMoveWindow(g_display, g_wnd,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.