1 |
|
/* |
2 |
|
* clip_macosx.cpp - Clipboard handling, MacOS X (Carbon) implementation |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2005 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2008 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
19 |
|
*/ |
20 |
|
|
21 |
|
#include "sysdeps.h" |
22 |
+ |
#define _UINT64 |
23 |
|
#include <Carbon/Carbon.h> |
24 |
|
|
25 |
|
#include "clip.h" |
98 |
|
|
99 |
|
void GetScrap(void **handle, uint32 type, int32 offset) |
100 |
|
{ |
101 |
+ |
#if defined(__LP64__) |
102 |
+ |
D(bug("GetScrap handle %p, type %08x, offset %d\n", handle, type, offset)); |
103 |
+ |
#warning Carbon scrapbook function are not implemented in 64-bit mode |
104 |
+ |
#else |
105 |
|
D(bug("GetScrap handle %p, type %08x, offset %d\n", handle, type, offset)); |
106 |
|
ScrapRef theScrap; |
107 |
|
|
133 |
|
0x2f, 0x3c, 0, 0, 0, 0, // move.l #outbuf,-(sp) |
134 |
|
0xa9, 0xfe, // PutScrap() |
135 |
|
0x58, 0x8f, // addq.l #4,sp |
136 |
< |
M68K_RTS >> 8, M68K_RTS |
136 |
> |
M68K_RTS >> 8, M68K_RTS & 0xff |
137 |
|
}; |
138 |
|
r.d[0] = sizeof(proc); |
139 |
|
Execute68kTrap(0xa71e, &r); // NewPtrSysClear() |
156 |
|
Execute68kTrap(0xa01f, &r); // DisposePtr |
157 |
|
} |
158 |
|
} |
159 |
+ |
#endif |
160 |
|
} |
161 |
|
|
162 |
|
|
166 |
|
|
167 |
|
void PutScrap(uint32 type, void *scrap, int32 length) |
168 |
|
{ |
169 |
< |
D(bug("PutScrap type %08lx, data %08lx, length %ld\n", type, scrap, length)); |
169 |
> |
#if defined(__LP64__) |
170 |
> |
#warning Carbon scrapbook function are not implemented in 64-bit mode |
171 |
> |
D(bug("PutScrap type %4.4s, data %08lx, length %ld\n", &type, scrap, length)); |
172 |
> |
#else |
173 |
> |
static bool clear = true; |
174 |
> |
D(bug("PutScrap type %4.4s, data %08lx, length %ld\n", &type, scrap, length)); |
175 |
|
ScrapRef theScrap; |
176 |
|
|
177 |
|
if (we_put_this_data) { |
178 |
|
we_put_this_data = false; |
179 |
+ |
clear = true; |
180 |
|
return; |
181 |
|
} |
182 |
|
if (length <= 0) |
183 |
|
return; |
184 |
|
|
185 |
< |
ClearCurrentScrap(); |
185 |
> |
if (clear) { |
186 |
> |
D(bug(" calling ClearCurrentScrap\n")); |
187 |
> |
ClearCurrentScrap(); |
188 |
> |
} |
189 |
|
if (GetCurrentScrap(&theScrap) != noErr) { |
190 |
|
D(bug(" could not open scrap\n")); |
191 |
|
return; |
194 |
|
SwapScrapData(type, scrap, length, TRUE); |
195 |
|
if (PutScrapFlavor(theScrap, type, kScrapFlavorMaskNone, length, scrap) != noErr) { |
196 |
|
D(bug(" could not put to scrap\n")); |
197 |
< |
return; |
197 |
> |
//return; |
198 |
|
} |
199 |
+ |
SwapScrapData(type, scrap, length, FALSE); // swap it back |
200 |
+ |
#endif |
201 |
|
} |