Changeset 3395

Show
Ignore:
Timestamp:
08/12/04 22:47:02 (4 years ago)
Author:
miyoshi
Message:

(last_clipboard_text): New variable form Emacs CVS
HEAD.
(clipboard_storage_size): Ditto.
(Fw32_set_clipboard_data): Stash away the data we are about to put
into the clipboard. These codes are imported from Emacs CVS HEAD.
(Fw32_get_clipboard_data): If the text in clipboard is identical
to what we put there last time, pretend there's no data in the
clipboard. These codes are imported from Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.1/src/ChangeLog.Meadow

    r3390 r3395  
     12004-08-12  MIYOSHI Masanori  <miyoshi@meadowy.org> 
     2 
     3        * mw32clpbd.c (last_clipboard_text): New variable form Emacs CVS 
     4        HEAD. 
     5        (clipboard_storage_size): Ditto. 
     6        (Fw32_set_clipboard_data): Stash away the data we are about to put 
     7        into the clipboard. These codes are imported from Emacs CVS HEAD. 
     8        (Fw32_get_clipboard_data): If the text in clipboard is identical 
     9        to what we put there last time, pretend there's no data in the 
     10        clipboard. These codes are imported from Emacs CVS HEAD. 
     11 
    1122004-08-11  MIYOSHI Masanori  <miyoshi@meadowy.org> 
    213 
  • branches/2.1/src/mw32clpbd.c

    r3298 r3395  
    4747Lisp_Object Vw32_clipboard_coding_system; 
    4848int mw32_mule_clipboard_format; 
     49 
     50/* The last text we put into the clipboard.  This is used when the OS 
     51   does not support sequence numbers (NT4, 95). It is undesirable to 
     52   use data put on the clipboard by Emacs because the clipboard data 
     53   could be MULEtilated by inappropriately chosen 
     54   (next-)selection-coding-system.  For this reason, we must store the 
     55   text *after* it was encoded/Unix-to-DOS-converted.  */ 
     56static unsigned char *last_clipboard_text = NULL; 
     57static size_t clipboard_storage_size = 0; 
    4958 
    5059/* From w32select.c(GNU Emacs) */ 
     
    102111  lptext[size] = '\0'; 
    103112 
     113  /* Stash away the data we are about to put into the 
     114     clipboard, so we could later check inside 
     115     Fw32_get_clipboard_data whether the clipboard still 
     116     holds our data.  */ 
     117  if (clipboard_storage_size < size) 
     118    { 
     119      clipboard_storage_size = size + 100; 
     120      last_clipboard_text = (char *) xrealloc (last_clipboard_text, 
     121                                               clipboard_storage_size); 
     122    } 
     123  if (last_clipboard_text) 
     124    memcpy (last_clipboard_text, lptext, size); 
     125 
    104126  GlobalUnlock (htext); 
    105127 
     
    121143  if (htext) 
    122144    GlobalFree (htext); 
     145  if (last_clipboard_text) 
     146    *last_clipboard_text = '\0'; 
    123147 
    124148 done: 
     
    166190    goto closeclip; 
    167191             
     192  nbytes = strlen (lptext); 
     193 
     194  /* If the text in clipboard is identical to what we put there 
     195     last time w32_set_clipboard_data was called, pretend there's no 
     196     data in the clipboard.  This is so we don't pass our own text 
     197     from the clipboard (which might be troublesome if the killed 
     198     text includes null characters).  */ 
     199  if (last_clipboard_text 
     200      && clipboard_storage_size >= nbytes 
     201      && memcmp (last_clipboard_text, lptext, nbytes) == 0) 
     202    goto closeclip; 
     203 
    168204  if (NILP (code)) 
    169205    code = Vw32_clipboard_coding_system; 
    170206  setup_coding_system (Fcheck_coding_system (code), &coding); 
    171207 
    172   nbytes = strlen (lptext); 
    173208  bufsize = encoding_buffer_size (&coding, nbytes); 
    174209  buf = (unsigned char*) xmalloc (bufsize);