CVS: rdesktop xwin.c,1.223,1.224
Peter Ã
strand <[email protected]> Mon, 14 May 2007 05:11:18 -0700
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29095
Modified Files:
xwin.c
Log Message:
Send physical mouse buttons over RDP rather than logical ones. Fixes bug 1693905. Patch from Ilya Konstantinov (slightly modified)
Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.223
retrieving revision 1.224
diff -C2 -d -r1.223 -r1.224
*** xwin.c 12 Apr 2007 16:04:25 -0000 1.223
--- xwin.c 14 May 2007 12:11:15 -0000 1.224
***************
*** 103,106 ****
--- 103,109 ----
static XIC g_IC;
static XModifierKeymap *g_mod_map;
+ /* Maps logical (xmodmap -pp) pointing device buttons (0-based) back
+ to physical (1-based) indices. */
+ static unsigned char g_pointer_log_to_phys_map[16];
static Cursor g_current_cursor;
static RD_HCURSOR g_null_cursor = NULL;
***************
*** 1261,1264 ****
--- 1264,1283 ----
}
+ static void
+ xwin_refresh_pointer_map(void)
+ {
+ unsigned char phys_to_log_map[sizeof(g_pointer_log_to_phys_map)];
+ int i, pointer_buttons;
+
+ pointer_buttons = XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map));
+ for (i = 0; i < pointer_buttons; ++i)
+ {
+ /* This might produce multiple logical buttons mapping
+ to a single physical one, but hey, that's
+ life... */
+ g_pointer_log_to_phys_map[phys_to_log_map[i] - 1] = i + 1;
+ }
+ }
+
RD_BOOL
get_key_state(unsigned int state, uint32 keysym)
***************
*** 1615,1618 ****
--- 1634,1638 ----
g_mod_map = XGetModifierMapping(g_display);
+ xwin_refresh_pointer_map();
xkeymap_init();
***************
*** 1878,1881 ****
--- 1898,1907 ----
uint16 button, flags = 0;
g_last_gesturetime = xevent.xbutton.time;
+ /* Reverse the pointer button mapping, e.g. in the case of
+ "left-handed mouse mode"; the RDP session expects to
+ receive physical buttons (true in mstsc as well) and
+ logical button behavior depends on the remote desktop's own
+ mouse settings */
+ xevent.xbutton.button = g_pointer_log_to_phys_map[xevent.xbutton.button - 1];
button = xkeymap_translate_button(xevent.xbutton.button);
if (button == 0)
***************
*** 2165,2168 ****
--- 2191,2200 ----
g_mod_map = XGetModifierMapping(g_display);
}
+
+ if (xevent.xmapping.request == MappingPointer)
+ {
+ xwin_refresh_pointer_map();
+ }
+
break;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/