CVS: rdesktop cliprdr.c,1.27,1.28 proto.h,1.88,1.89 rdesktop.c,1.145,1.146 xclip.c,1.30,1.31

Pierre Ossman <[email protected]> Mon, 27 Mar 2006 01:20:27 -0800
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31630

Modified Files:
	cliprdr.c proto.h rdesktop.c xclip.c 
Log Message:
Control clipboard behaviour (and even disable it) using command line options.


Index: cliprdr.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/cliprdr.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** cliprdr.c	27 Mar 2006 08:30:15 -0000	1.27
--- cliprdr.c	27 Mar 2006 09:20:23 -0000	1.28
***************
*** 164,167 ****
--- 164,173 ----
  }
  
+ void
+ cliprdr_set_mode(const char *optarg)
+ {
+ 	ui_clip_set_mode(optarg);
+ }
+ 
  BOOL
  cliprdr_init(void)

Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -d -r1.88 -r1.89
*** proto.h	27 Mar 2006 08:17:33 -0000	1.88
--- proto.h	27 Mar 2006 09:20:24 -0000	1.89
***************
*** 55,58 ****
--- 55,59 ----
  void cliprdr_send_data_request(uint32 format);
  void cliprdr_send_data(uint8 * data, uint32 length);
+ void cliprdr_set_mode(const char *optarg);
  BOOL cliprdr_init(void);
  /* disk.c */
***************
*** 206,209 ****
--- 207,211 ----
  void ui_clip_request_data(uint32 format);
  void ui_clip_sync(void);
+ void ui_clip_set_mode(const char *optarg);
  void xclip_init(void);
  /* xkeymap.c */

Index: rdesktop.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdesktop.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -C2 -d -r1.145 -r1.146
*** rdesktop.c	27 Mar 2006 08:17:33 -0000	1.145
--- rdesktop.c	27 Mar 2006 09:20:24 -0000	1.146
***************
*** 85,88 ****
--- 85,89 ----
  BOOL g_hide_decorations = False;
  BOOL g_use_rdp5 = True;
+ BOOL g_rdpclip = True;
  BOOL g_console_session = False;
  BOOL g_numlock_sync = False;
***************
*** 181,184 ****
--- 182,192 ----
  	fprintf(stderr, "         '-r sound:[local|off|remote]': enable sound redirection\n");
  	fprintf(stderr, "                     remote would leave sound on server\n");
+ 	fprintf(stderr,
+ 		"         '-r clipboard:[on|off|auto|PRIMARYCLIPBOARD|CLIPBOARD]': enable clip-\n");
+ 	fprintf(stderr, "                      board redirection.\n");
+ 	fprintf(stderr,
+ 		"                      'on|auto|PRIMARYCLIPBOARD' looks at both PRIMARY and\n");
+ 	fprintf(stderr, "                      CLIPBOARD when sending data to server.\n");
+ 	fprintf(stderr, "                      'CLIPBOARD' looks at only CLIPBOARD.\n");
  	fprintf(stderr, "   -0: attach to console\n");
  	fprintf(stderr, "   -4: use RDP version 4\n");
***************
*** 706,712 ****
  					strcpy(g_rdpdr_clientname, optarg + 11);
  				}
  				else
  				{
! 					warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound\n");
  				}
  				break;
--- 714,736 ----
  					strcpy(g_rdpdr_clientname, optarg + 11);
  				}
+ 				else if (str_startswith(optarg, "clipboard"))
+ 				{
+ 					optarg += 9;
+ 
+ 					if (*optarg == ':')
+ 					{
+ 						optarg++;
+ 
+ 						if (str_startswith(optarg, "off"))
+ 							g_rdpclip = False;
+ 						else
+ 							cliprdr_set_mode(optarg);
+ 					}
+ 					else
+ 						g_rdpclip = True;
+ 				}
  				else
  				{
! 					warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound, clipboard\n");
  				}
  				break;

Index: xclip.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xclip.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** xclip.c	27 Mar 2006 08:49:38 -0000	1.30
--- xclip.c	27 Mar 2006 09:20:24 -0000	1.31
***************
*** 54,58 ****
--- 54,63 ----
  extern Window g_wnd;
  extern Time g_last_gesturetime;
+ extern BOOL g_rdpclip;
  
+ /* Mode of operation.
+    - Auto: Look at both PRIMARY and CLIPBOARD and use the most recent.
+    - Non-auto: Look at just CLIPBOARD. */
+ static BOOL auto_mode = True;
  /* Atoms of the two X selections we're dealing with: CLIPBOARD (explicit-copy) and PRIMARY (selection-copy) */
  static Atom clipboard_atom, primary_atom;
***************
*** 903,907 ****
  	}
  
! 	primary_owner = XGetSelectionOwner(g_display, primary_atom);
  	clipboard_owner = XGetSelectionOwner(g_display, clipboard_atom);
  
--- 908,916 ----
  	}
  
! 	if (auto_mode)
! 		primary_owner = XGetSelectionOwner(g_display, primary_atom);
! 	else
! 		primary_owner = None;
! 
  	clipboard_owner = XGetSelectionOwner(g_display, clipboard_atom);
  
***************
*** 944,951 ****
--- 953,979 ----
  }
  
+ void
+ ui_clip_set_mode(const char *optarg)
+ {
+ 	g_rdpclip = True;
+ 
+ 	if (str_startswith(optarg, "auto") || str_startswith(optarg, "on")
+ 	    || str_startswith(optarg, "PRIMARYCLIPBOARD"))
+ 		auto_mode = True;
+ 	else if (str_startswith(optarg, "CLIPBOARD"))
+ 		auto_mode = False;
+ 	else
+ 	{
+ 		warning("Invalid clipboard mode '%s'.\n", optarg);
+ 		g_rdpclip = False;
+ 	}
+ }
  
  void
  xclip_init(void)
  {
+ 	if (!g_rdpclip)
+ 		return;
+ 
  	if (!cliprdr_init())
  		return;



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642