diff options
| author | Karoly Lorentey | 2006-04-19 16:23:46 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-04-19 16:23:46 +0000 |
| commit | 447b0165acd09060977e05c843f81c0bee4aa4df (patch) | |
| tree | 70cf2d254760a2cf68a10b67f8a3570c05fff9a5 /src/macselect.c | |
| parent | 4c57cca724993ab1334cc5c0b35c22b06daee0c3 (diff) | |
| parent | 0fea1d10293b4c6d35c1e55b68cd26e91445213c (diff) | |
| download | emacs-447b0165acd09060977e05c843f81c0bee4aa4df.tar.gz emacs-447b0165acd09060977e05c843f81c0bee4aa4df.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-216
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-217
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-218
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-219
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-220
Improve tq.el.
* emacs@sv.gnu.org/emacs--devo--0--patch-221
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-222
Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6.
* emacs@sv.gnu.org/emacs--devo--0--patch-223
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-224
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-225
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-226
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-227
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-228
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-229
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-230
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-231
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-232
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-233
Update from CVS: lisp/progmodes/python.el (python-mode): Fix typo.
* emacs@sv.gnu.org/gnus--rel--5.10--patch-84
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-85
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-86
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-550
Diffstat (limited to 'src/macselect.c')
| -rw-r--r-- | src/macselect.c | 121 |
1 files changed, 50 insertions, 71 deletions
diff --git a/src/macselect.c b/src/macselect.c index 066892adce0..fe4a7c8eccc 100644 --- a/src/macselect.c +++ b/src/macselect.c | |||
| @@ -153,7 +153,6 @@ static ScrapFlavorType | |||
| 153 | get_flavor_type_from_symbol (sym) | 153 | get_flavor_type_from_symbol (sym) |
| 154 | Lisp_Object sym; | 154 | Lisp_Object sym; |
| 155 | { | 155 | { |
| 156 | ScrapFlavorType val; | ||
| 157 | Lisp_Object str = Fget (sym, Qmac_ostype); | 156 | Lisp_Object str = Fget (sym, Qmac_ostype); |
| 158 | 157 | ||
| 159 | if (STRINGP (str) && SBYTES (str) == 4) | 158 | if (STRINGP (str) && SBYTES (str) == 4) |
| @@ -322,17 +321,19 @@ get_scrap_private_timestamp (scrap, timestamp) | |||
| 322 | 321 | ||
| 323 | err = GetScrapFlavorFlags (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &flags); | 322 | err = GetScrapFlavorFlags (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &flags); |
| 324 | if (err == noErr) | 323 | if (err == noErr) |
| 325 | if (!(flags & kScrapFlavorMaskSenderOnly)) | 324 | { |
| 326 | err = noTypeErr; | 325 | if (!(flags & kScrapFlavorMaskSenderOnly)) |
| 327 | else | 326 | err = noTypeErr; |
| 328 | { | 327 | else |
| 329 | Size size = sizeof (*timestamp); | 328 | { |
| 329 | Size size = sizeof (*timestamp); | ||
| 330 | 330 | ||
| 331 | err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, | 331 | err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, |
| 332 | &size, timestamp); | 332 | &size, timestamp); |
| 333 | if (err == noErr && size != sizeof (*timestamp)) | 333 | if (err == noErr && size != sizeof (*timestamp)) |
| 334 | err = noTypeErr; | 334 | err = noTypeErr; |
| 335 | } | 335 | } |
| 336 | } | ||
| 336 | #else /* !TARGET_API_MAC_CARBON */ | 337 | #else /* !TARGET_API_MAC_CARBON */ |
| 337 | Handle handle; | 338 | Handle handle; |
| 338 | SInt32 size, offset; | 339 | SInt32 size, offset; |
| @@ -372,14 +373,11 @@ get_scrap_target_type_list (scrap) | |||
| 372 | err = GetScrapFlavorCount (scrap, &count); | 373 | err = GetScrapFlavorCount (scrap, &count); |
| 373 | if (err == noErr) | 374 | if (err == noErr) |
| 374 | flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count); | 375 | flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count); |
| 375 | if (flavor_info) | 376 | err = GetScrapFlavorInfoList (scrap, &count, flavor_info); |
| 377 | if (err != noErr) | ||
| 376 | { | 378 | { |
| 377 | err = GetScrapFlavorInfoList (scrap, &count, flavor_info); | 379 | xfree (flavor_info); |
| 378 | if (err != noErr) | 380 | flavor_info = NULL; |
| 379 | { | ||
| 380 | xfree (flavor_info); | ||
| 381 | flavor_info = NULL; | ||
| 382 | } | ||
| 383 | } | 381 | } |
| 384 | if (flavor_info == NULL) | 382 | if (flavor_info == NULL) |
| 385 | count = 0; | 383 | count = 0; |
| @@ -683,18 +681,20 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 683 | 681 | ||
| 684 | err = get_scrap_from_symbol (selection_symbol, 0, &scrap); | 682 | err = get_scrap_from_symbol (selection_symbol, 0, &scrap); |
| 685 | if (err == noErr && scrap) | 683 | if (err == noErr && scrap) |
| 686 | if (EQ (target_type, QTARGETS)) | 684 | { |
| 687 | { | 685 | if (EQ (target_type, QTARGETS)) |
| 688 | result = get_scrap_target_type_list (scrap); | 686 | { |
| 689 | result = Fvconcat (1, &result); | 687 | result = get_scrap_target_type_list (scrap); |
| 690 | } | 688 | result = Fvconcat (1, &result); |
| 691 | else | 689 | } |
| 692 | { | 690 | else |
| 693 | result = get_scrap_string (scrap, target_type); | 691 | { |
| 694 | if (STRINGP (result)) | 692 | result = get_scrap_string (scrap, target_type); |
| 695 | Fput_text_property (make_number (0), make_number (SBYTES (result)), | 693 | if (STRINGP (result)) |
| 696 | Qforeign_selection, target_type, result); | 694 | Fput_text_property (make_number (0), make_number (SBYTES (result)), |
| 697 | } | 695 | Qforeign_selection, target_type, result); |
| 696 | } | ||
| 697 | } | ||
| 698 | 698 | ||
| 699 | UNBLOCK_INPUT; | 699 | UNBLOCK_INPUT; |
| 700 | 700 | ||
| @@ -1009,7 +1009,7 @@ defer_apple_events (apple_event, reply) | |||
| 1009 | /* Mac OS 10.3 Xcode manual says AESuspendTheCurrentEvent makes | 1009 | /* Mac OS 10.3 Xcode manual says AESuspendTheCurrentEvent makes |
| 1010 | copies of the Apple event and the reply, but Mac OS 10.4 Xcode | 1010 | copies of the Apple event and the reply, but Mac OS 10.4 Xcode |
| 1011 | manual says it doesn't. Anyway we create copies of them and save | 1011 | manual says it doesn't. Anyway we create copies of them and save |
| 1012 | it in `deferred_apple_events'. */ | 1012 | them in `deferred_apple_events'. */ |
| 1013 | if (err == noErr) | 1013 | if (err == noErr) |
| 1014 | { | 1014 | { |
| 1015 | if (deferred_apple_events.buf == NULL) | 1015 | if (deferred_apple_events.buf == NULL) |
| @@ -1018,20 +1018,13 @@ defer_apple_events (apple_event, reply) | |||
| 1018 | deferred_apple_events.count = 0; | 1018 | deferred_apple_events.count = 0; |
| 1019 | deferred_apple_events.buf = | 1019 | deferred_apple_events.buf = |
| 1020 | xmalloc (sizeof (AppleEvent) * deferred_apple_events.size); | 1020 | xmalloc (sizeof (AppleEvent) * deferred_apple_events.size); |
| 1021 | if (deferred_apple_events.buf == NULL) | ||
| 1022 | err = memFullErr; | ||
| 1023 | } | 1021 | } |
| 1024 | else if (deferred_apple_events.count == deferred_apple_events.size) | 1022 | else if (deferred_apple_events.count == deferred_apple_events.size) |
| 1025 | { | 1023 | { |
| 1026 | AppleEvent *newbuf; | ||
| 1027 | |||
| 1028 | deferred_apple_events.size *= 2; | 1024 | deferred_apple_events.size *= 2; |
| 1029 | newbuf = xrealloc (deferred_apple_events.buf, | 1025 | deferred_apple_events.buf |
| 1030 | sizeof (AppleEvent) * deferred_apple_events.size); | 1026 | = xrealloc (deferred_apple_events.buf, |
| 1031 | if (newbuf) | 1027 | sizeof (AppleEvent) * deferred_apple_events.size); |
| 1032 | deferred_apple_events.buf = newbuf; | ||
| 1033 | else | ||
| 1034 | err = memFullErr; | ||
| 1035 | } | 1028 | } |
| 1036 | } | 1029 | } |
| 1037 | 1030 | ||
| @@ -1123,11 +1116,8 @@ DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events, | |||
| 1123 | doc: /* Process Apple events that are deferred at the startup time. */) | 1116 | doc: /* Process Apple events that are deferred at the startup time. */) |
| 1124 | () | 1117 | () |
| 1125 | { | 1118 | { |
| 1126 | OSErr err; | ||
| 1127 | Lisp_Object result = Qnil; | 1119 | Lisp_Object result = Qnil; |
| 1128 | long i, count; | 1120 | long i; |
| 1129 | AppleEvent apple_event, reply; | ||
| 1130 | AEKeyword keyword; | ||
| 1131 | 1121 | ||
| 1132 | if (mac_ready_for_apple_events) | 1122 | if (mac_ready_for_apple_events) |
| 1133 | return Qnil; | 1123 | return Qnil; |
| @@ -1192,29 +1182,21 @@ copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type) | |||
| 1192 | buf = NULL; | 1182 | buf = NULL; |
| 1193 | } | 1183 | } |
| 1194 | else if (size_allocated < size) | 1184 | else if (size_allocated < size) |
| 1195 | { | 1185 | buf = xrealloc (buf, size); |
| 1196 | char *newbuf = xrealloc (buf, size); | ||
| 1197 | |||
| 1198 | if (newbuf) | ||
| 1199 | buf = newbuf; | ||
| 1200 | else | ||
| 1201 | { | ||
| 1202 | xfree (buf); | ||
| 1203 | buf = NULL; | ||
| 1204 | } | ||
| 1205 | } | ||
| 1206 | else | 1186 | else |
| 1207 | break; | 1187 | break; |
| 1208 | } | 1188 | } |
| 1209 | if (err == noErr) | 1189 | if (err == noErr) |
| 1210 | if (buf == NULL) | 1190 | { |
| 1211 | err = memFullErr; | 1191 | if (buf == NULL) |
| 1212 | else | 1192 | err = memFullErr; |
| 1213 | { | 1193 | else |
| 1214 | err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone, | 1194 | { |
| 1215 | size, buf); | 1195 | err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone, |
| 1216 | xfree (buf); | 1196 | size, buf); |
| 1217 | } | 1197 | xfree (buf); |
| 1198 | } | ||
| 1199 | } | ||
| 1218 | 1200 | ||
| 1219 | return err; | 1201 | return err; |
| 1220 | } | 1202 | } |
| @@ -1300,14 +1282,11 @@ mac_handle_service_event (call_ref, event, data) | |||
| 1300 | err = GetScrapFlavorCount (cur_scrap, &count); | 1282 | err = GetScrapFlavorCount (cur_scrap, &count); |
| 1301 | if (err == noErr) | 1283 | if (err == noErr) |
| 1302 | flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count); | 1284 | flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count); |
| 1303 | if (flavor_info) | 1285 | err = GetScrapFlavorInfoList (cur_scrap, &count, flavor_info); |
| 1286 | if (err != noErr) | ||
| 1304 | { | 1287 | { |
| 1305 | err = GetScrapFlavorInfoList (cur_scrap, &count, flavor_info); | 1288 | xfree (flavor_info); |
| 1306 | if (err != noErr) | 1289 | flavor_info = NULL; |
| 1307 | { | ||
| 1308 | xfree (flavor_info); | ||
| 1309 | flavor_info = NULL; | ||
| 1310 | } | ||
| 1311 | } | 1290 | } |
| 1312 | if (flavor_info == NULL) | 1291 | if (flavor_info == NULL) |
| 1313 | break; | 1292 | break; |