Changeset 3395
- Timestamp:
- 08/12/04 22:47:02 (4 years ago)
- Files:
-
- branches/2.1/src/ChangeLog.Meadow (modified) (1 diff)
- branches/2.1/src/mw32clpbd.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.1/src/ChangeLog.Meadow
r3390 r3395 1 2004-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 1 12 2004-08-11 MIYOSHI Masanori <miyoshi@meadowy.org> 2 13 branches/2.1/src/mw32clpbd.c
r3298 r3395 47 47 Lisp_Object Vw32_clipboard_coding_system; 48 48 int 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. */ 56 static unsigned char *last_clipboard_text = NULL; 57 static size_t clipboard_storage_size = 0; 49 58 50 59 /* From w32select.c(GNU Emacs) */ … … 102 111 lptext[size] = '\0'; 103 112 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 104 126 GlobalUnlock (htext); 105 127 … … 121 143 if (htext) 122 144 GlobalFree (htext); 145 if (last_clipboard_text) 146 *last_clipboard_text = '\0'; 123 147 124 148 done: … … 166 190 goto closeclip; 167 191 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 168 204 if (NILP (code)) 169 205 code = Vw32_clipboard_coding_system; 170 206 setup_coding_system (Fcheck_coding_system (code), &coding); 171 207 172 nbytes = strlen (lptext);173 208 bufsize = encoding_buffer_size (&coding, nbytes); 174 209 buf = (unsigned char*) xmalloc (bufsize);
