CVS: rdesktop xwin.c,1.232,1.233

Matt Chapman <[email protected]> Fri, 04 Apr 2008 22:56:28 -0700
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6737

Modified Files:
	xwin.c 
Log Message:
Fix bug #1886199 (tracked down by [email protected]).


Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.232
retrieving revision 1.233
diff -C2 -d -r1.232 -r1.233
*** xwin.c	28 Mar 2008 11:36:15 -0000	1.232
--- xwin.c	5 Apr 2008 05:56:26 -0000	1.233
***************
*** 2,6 ****
     rdesktop: A Remote Desktop Protocol client.
     User interface services - X Window System
!    Copyright (C) Matthew Chapman 1999-2007
     Copyright 2007 Pierre Ossman <[email protected]> for Cendio AB
  
--- 2,6 ----
     rdesktop: A Remote Desktop Protocol client.
     User interface services - X Window System
!    Copyright (C) Matthew Chapman 1999-2008
     Copyright 2007 Pierre Ossman <[email protected]> for Cendio AB
  
***************
*** 111,115 ****
  /* 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;
--- 111,115 ----
  /* Maps logical (xmodmap -pp) pointing device buttons (0-based) back
     to physical (1-based) indices. */
! static unsigned char g_pointer_log_to_phys_map[32];
  static Cursor g_current_cursor;
  static RD_HCURSOR g_null_cursor = NULL;
***************
*** 1526,1534 ****
  
  	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;
  	}
--- 1526,1540 ----
  
  	pointer_buttons = XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map));
! 	if (pointer_buttons > sizeof(phys_to_log_map))
! 		pointer_buttons = sizeof(phys_to_log_map);
! 
! 	/* if multiple physical buttons map to the same logical button, then
! 	 * use the lower numbered physical one */
! 	for (i = pointer_buttons-1; i >= 0; i--)
  	{
! 		/* a user could specify arbitrary values for the logical button
! 		 * number, ignore any that are abnormally large */
! 		if (phys_to_log_map[i] > sizeof(g_pointer_log_to_phys_map))
! 			continue;
  		g_pointer_log_to_phys_map[phys_to_log_map[i] - 1] = i + 1;
  	}


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone