CVS: rdesktop xclip.c,1.19,1.20 proto.h,1.84,1.85 cliprdr.c,1.23,1.24

Erik Forsberg <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6886

Modified Files:
	xclip.c proto.h cliprdr.c 
Log Message:
Applied patch 1349027 by Ilya Konstantinov. 

Generalizes code for sending clipboard format announces to RDP side,
and uses new code in appropriate places.


Index: xclip.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xclip.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** xclip.c	2 Aug 2005 09:27:46 -0000	1.19
--- xclip.c	7 Nov 2005 13:15:19 -0000	1.20
***************
*** 221,225 ****
  
  	if (!rdesktop_is_selection_owner)
! 		cliprdr_send_text_format_announce();
  	return;
  
--- 221,225 ----
  
  	if (!rdesktop_is_selection_owner)
! 		cliprdr_send_simple_native_format_announce(CF_TEXT);
  	return;
  
***************
*** 277,281 ****
  	have_primary = 0;
  	XDeleteProperty(g_display, DefaultRootWindow(g_display), rdesktop_clipboard_formats_atom);
! 	cliprdr_send_text_format_announce();
  }
  
--- 277,281 ----
  	have_primary = 0;
  	XDeleteProperty(g_display, DefaultRootWindow(g_display), rdesktop_clipboard_formats_atom);
! 	cliprdr_send_simple_native_format_announce(CF_TEXT);
  }
  
***************
*** 312,316 ****
  
  				if (!rdesktop_is_selection_owner)
! 					cliprdr_send_text_format_announce();
  
  				xfree(g_clip_buffer);
--- 312,316 ----
  
  				if (!rdesktop_is_selection_owner)
! 					cliprdr_send_simple_native_format_announce(CF_TEXT);
  
  				xfree(g_clip_buffer);
***************
*** 365,369 ****
  
  	/* PropertyDelete, or XGetWindowProperty failed */
! 	cliprdr_send_text_format_announce();
  	rdesktop_is_selection_owner = 0;
  }
--- 365,369 ----
  
  	/* PropertyDelete, or XGetWindowProperty failed */
! 	cliprdr_send_simple_native_format_announce(CF_TEXT);
  	rdesktop_is_selection_owner = 0;
  }
***************
*** 454,458 ****
  ui_clip_sync(void)
  {
! 	cliprdr_send_text_format_announce();
  }
  
--- 454,458 ----
  ui_clip_sync(void)
  {
! 	cliprdr_send_simple_native_format_announce(CF_TEXT);
  }
  

Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -C2 -d -r1.84 -r1.85
*** proto.h	31 Aug 2005 13:00:57 -0000	1.84
--- proto.h	7 Nov 2005 13:15:19 -0000	1.85
***************
*** 51,57 ****
  void channel_process(STREAM s, uint16 mcs_channel);
  /* cliprdr.c */
! void cliprdr_send_text_format_announce(void);
! void cliprdr_send_blah_format_announce(void);
! void cliprdr_send_native_format_announce(uint8 * data, uint32 length);
  void cliprdr_send_data_request(uint32 format);
  void cliprdr_send_data(uint8 * data, uint32 length);
--- 51,56 ----
  void channel_process(STREAM s, uint16 mcs_channel);
  /* cliprdr.c */
! void cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length);
! void cliprdr_send_simple_native_format_announce(uint32 format);
  void cliprdr_send_data_request(uint32 format);
  void cliprdr_send_data(uint8 * data, uint32 length);

Index: cliprdr.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/cliprdr.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** cliprdr.c	14 Apr 2005 16:46:13 -0000	1.23
--- cliprdr.c	7 Nov 2005 13:15:19 -0000	1.24
***************
*** 51,78 ****
  }
  
  void
! cliprdr_send_text_format_announce(void)
! {
! 	uint8 buffer[36];
! 
! 	buf_out_uint32(buffer, CF_TEXT);
! 	memset(buffer + 4, 0, sizeof(buffer) - 4);	/* description */
! 	cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, buffer, sizeof(buffer));
! }
! 
! void
! cliprdr_send_blah_format_announce(void)
  {
  	uint8 buffer[36];
  
! 	buf_out_uint32(buffer, CF_OEMTEXT);
  	memset(buffer + 4, 0, sizeof(buffer) - 4);	/* description */
! 	cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, buffer, sizeof(buffer));
  }
  
  void
! cliprdr_send_native_format_announce(uint8 * data, uint32 length)
  {
! 	cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, data, length);
  }
  
--- 51,77 ----
  }
  
+ /* Helper which announces our readiness to supply clipboard data
+    in a single format (such as CF_TEXT) to the RDP side.
+    To announce more than one format at a time, use
+    cliprdr_send_native_format_announce.
+  */
  void
! cliprdr_send_simple_native_format_announce(uint32 format)
  {
  	uint8 buffer[36];
  
! 	buf_out_uint32(buffer, format);
  	memset(buffer + 4, 0, sizeof(buffer) - 4);	/* description */
! 	cliprdr_send_native_format_announce(buffer, sizeof(buffer));
  }
  
+ /* Announces our readiness to supply clipboard data in multiple
+    formats, each denoted by a 36-byte format descriptor of
+    [ uint32 format + 32-byte description ].
+  */
  void
! cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length)
  {
! 	cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data, formats_data_length);
  }
  
***************
*** 112,116 ****
  			/* FIXME: We seem to get this when we send an announce while the server is
  			   still processing a paste. Try sending another announce. */
! 			cliprdr_send_text_format_announce();
  			return;
  		}
--- 111,115 ----
  			/* FIXME: We seem to get this when we send an announce while the server is
  			   still processing a paste. Try sending another announce. */
! 			cliprdr_send_simple_native_format_announce(CF_TEXT);
  			return;
  		}



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
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.