/[rdesktop]/sourceforge.net/trunk/rdesktop/cliprdr.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/cliprdr.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 396 by forsberg, Fri Jun 6 09:32:56 2003 UTC revision 422 by forsberg, Mon Jun 16 09:03:55 2003 UTC
# Line 20  Line 20 
20    
21  #include <X11/Xlib.h>  #include <X11/Xlib.h>
22  #include <X11/Xatom.h>  #include <X11/Xatom.h>
23    #include <sys/time.h>
24    #include <sys/types.h>
25    #include <unistd.h>
26  #include "rdesktop.h"  #include "rdesktop.h"
27    
28  extern BOOL encryption;  extern BOOL encryption;
# Line 80  static void Line 83  static void
83  cliprdr_send_format_announce(void)  cliprdr_send_format_announce(void)
84  {  {
85          STREAM s;          STREAM s;
   
         DEBUG_CLIPBOARD(("Sending (empty) format announce\n"));  
86          int number_of_formats = 1;          int number_of_formats = 1;
87            DEBUG_CLIPBOARD(("Sending (empty) format announce\n"));
88          s = sec_init(encryption ? SEC_ENCRYPT : 0, number_of_formats * 36 + 12 + 4 + 4);          s = sec_init(encryption ? SEC_ENCRYPT : 0, number_of_formats * 36 + 12 + 4 + 4);
89          out_uint32_le(s, number_of_formats * 36 + 12);          out_uint32_le(s, number_of_formats * 36 + 12);
90          out_uint32_le(s, 0x13);          out_uint32_le(s, 0x13);
# Line 157  cliprdr_handle_SelectionNotify(XSelectio Line 159  cliprdr_handle_SelectionNotify(XSelectio
159    
160          int format;          int format;
161          Atom type_return;          Atom type_return;
162          Atom best_target;          Atom best_target, text_target;
163          Atom *supported_targets;          Atom *supported_targets;
164    
165          STREAM out;          STREAM out;
# Line 200  cliprdr_handle_SelectionNotify(XSelectio Line 202  cliprdr_handle_SelectionNotify(XSelectio
202                          /* FIXME: We should choose format here based                          /* FIXME: We should choose format here based
203                             on what the server wanted */                             on what the server wanted */
204                          supported_targets = (Atom *) data;                          supported_targets = (Atom *) data;
205                            best_target = XInternAtom(display, "STRING", False);
206                            text_target = XInternAtom(display, "TEXT", False);
207                          for (i = 0; i < nitems; i++)                          for (i = 0; i < nitems; i++)
208                          {                          {
209                                  DEBUG_CLIPBOARD(("Target %d: %s\n",                                  DEBUG_CLIPBOARD(("Target %d: %s\n",
210                                                   i, XGetAtomName(display, supported_targets[i])));                                                   i, XGetAtomName(display, supported_targets[i])));
211                                    if (text_target == supported_targets[i])
212                                    {
213                                            DEBUG_CLIPBOARD(("Other party supports TEXT, choosing that as best_target\n"));
214                                            best_target = supported_targets[i];
215                                    }
216                          }                          }
217                          best_target = XInternAtom(display, "TEXT", False);  
218    
219    
220                  }                  }
# Line 311  cliprdr_handle_SelectionNotify(XSelectio Line 320  cliprdr_handle_SelectionNotify(XSelectio
320    
321    
322                  XFree(data);                  XFree(data);
323                  if (!rdesktop_clipboard_target_atom)                  if (!rdesktop_is_selection_owner)
324                          cliprdr_send_format_announce();                          cliprdr_send_format_announce();
325    
326          }          }
# Line 634  cliprdr_handle_server_data_request(STREA Line 643  cliprdr_handle_server_data_request(STREA
643          }          }
644          else          else
645          {          {
                 DEBUG_CLIPBOARD(("There were no owner for PRIMARY, sending empty string\n"));   // FIXME: Should we always send an empty string?  
646    
647                  cliprdr_send_empty_datapacket();                  selectionowner = XGetSelectionOwner(display, clipboard_atom);
648                    if (None != selectionowner)
649                    {
650                            XConvertSelection(display, clipboard_atom,
651                                              targets_atom,
652                                              rdesktop_clipboard_target_atom, wnd, CurrentTime);
653    
654                            /* The rest of the transfer is handled in
655                               cliprdr_handle_SelectionNotify */
656    
657                    }
658                    else
659                    {
660    
661                            DEBUG_CLIPBOARD(("There were no owner for PRIMARY nor CLIPBOARD, sending empty string\n"));     // FIXME: Should we always send an empty string?
662    
663                            cliprdr_send_empty_datapacket();
664                    }
665          }          }
666    
667    

Legend:
Removed from v.396  
changed lines
  Added in v.422

  ViewVC Help
Powered by ViewVC 1.1.26