/[emacs]/emacs/src/w32select.c
ViewVC logotype

Diff of /emacs/src/w32select.c

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

revision 1.23.4.1 by miles, Fri Apr 4 06:21:04 2003 UTC revision 1.23.4.2 by miles, Tue Oct 14 23:22:48 2003 UTC
# Line 41  static Lisp_Object Vselection_coding_sys Line 41  static Lisp_Object Vselection_coding_sys
41  /* Coding system for the next communicating with other Windows programs.  */  /* Coding system for the next communicating with other Windows programs.  */
42  static Lisp_Object Vnext_selection_coding_system;  static Lisp_Object Vnext_selection_coding_system;
43    
44  /* The last text we put into the clipboard.  This is used to prevent  /* Sequence number, used where possible to detect when we are pasting
45     passing back our own text from the clipboard, instead of using the     our own text.  */
46     kill ring.  The former is undesirable because the clipboard data  static DWORD last_clipboard_sequence_number;
47    extern ClipboardSequence_Proc clipboard_sequence_fn;
48    
49    /* The last text we put into the clipboard.  This is used when the OS
50       does not support sequence numbers (NT4, 95). It is undesirable to
51       use data put on the clipboard by Emacs because the clipboard data
52     could be MULEtilated by inappropriately chosen     could be MULEtilated by inappropriately chosen
53     (next-)selection-coding-system.  For this reason, we must store the     (next-)selection-coding-system.  For this reason, we must store the
54     text *after* it was encoded/Unix-to-DOS-converted.  */     text *after* it was encoded/Unix-to-DOS-converted.  */
# Line 217  DEFUN ("w32-set-clipboard-data", Fw32_se Line 222  DEFUN ("w32-set-clipboard-data", Fw32_se
222          encode_coding (&coding, src, dst, nbytes, bufsize);          encode_coding (&coding, src, dst, nbytes, bufsize);
223          Vlast_coding_system_used = coding.symbol;          Vlast_coding_system_used = coding.symbol;
224    
225          /* Stash away the data we are about to put into the clipboard, so we          /* If clipboard sequence numbers are not supported, keep a copy for
226             could later check inside Fw32_get_clipboard_data whether             later comparison.  */
227             the clipboard still holds our data.  */          if (!clipboard_sequence_fn)
228          if (clipboard_storage_size < coding.produced)            {
229            {              /* Stash away the data we are about to put into the
230              clipboard_storage_size = coding.produced + 100;                 clipboard, so we could later check inside
231              last_clipboard_text = (char *) xrealloc (last_clipboard_text,                 Fw32_get_clipboard_data whether the clipboard still
232                                                       clipboard_storage_size);                 holds our data.  */
233            }              if (clipboard_storage_size < coding.produced)
234          if (last_clipboard_text)                {
235            memcpy (last_clipboard_text, dst, coding.produced);                  clipboard_storage_size = coding.produced + 100;
236                    last_clipboard_text = (char *) xrealloc (last_clipboard_text,
237                                                             clipboard_storage_size);
238                  }
239                if (last_clipboard_text)
240                  memcpy (last_clipboard_text, dst, coding.produced);
241              }
242    
243          GlobalUnlock (htext);          GlobalUnlock (htext);
244    
# Line 243  DEFUN ("w32-set-clipboard-data", Fw32_se Line 254  DEFUN ("w32-set-clipboard-data", Fw32_se
254    
255    ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext);    ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext);
256    
257      if (clipboard_sequence_fn)
258        last_clipboard_sequence_number = clipboard_sequence_fn ();
259    
260    CloseClipboard ();    CloseClipboard ();
261    
262    if (ok) goto done;    if (ok) goto done;
# Line 254  DEFUN ("w32-set-clipboard-data", Fw32_se Line 268  DEFUN ("w32-set-clipboard-data", Fw32_se
268    if (last_clipboard_text)    if (last_clipboard_text)
269      *last_clipboard_text = '\0';      *last_clipboard_text = '\0';
270    
271      last_clipboard_sequence_number = 0;
272    
273   done:   done:
274    UNBLOCK_INPUT;    UNBLOCK_INPUT;
275    
# Line 297  DEFUN ("w32-get-clipboard-data", Fw32_ge Line 313  DEFUN ("w32-get-clipboard-data", Fw32_ge
313         data in the clipboard.  This is so we don't pass our own text         data in the clipboard.  This is so we don't pass our own text
314         from the clipboard (which might be troublesome if the killed         from the clipboard (which might be troublesome if the killed
315         text includes null characters).  */         text includes null characters).  */
316      if (last_clipboard_text      if ((clipboard_sequence_fn
317          && clipboard_storage_size >= nbytes           && clipboard_sequence_fn () == last_clipboard_sequence_number)
318          && memcmp(last_clipboard_text, src, nbytes) == 0)          || (last_clipboard_text
319                && clipboard_storage_size >= nbytes
320                && memcmp(last_clipboard_text, src, nbytes) == 0))
321        goto closeclip;        goto closeclip;
322    
323      {      {
# Line 471  set to nil.  */); Line 489  set to nil.  */);
489    
490    QCLIPBOARD = intern ("CLIPBOARD");    staticpro (&QCLIPBOARD);    QCLIPBOARD = intern ("CLIPBOARD");    staticpro (&QCLIPBOARD);
491  }  }
492    
493    /* arch-tag: c96e9724-5eb1-4dad-be07-289f092fd2af
494       (do not change this comment) */

Legend:
Removed from v.1.23.4.1  
changed lines
  Added in v.1.23.4.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26