|
24 | 24 | std::map<std::string, format> g_name_to_format;
|
25 | 25 | std::map<format, std::string> g_format_to_name;
|
26 | 26 |
|
| 27 | +} |
| 28 | + |
| 29 | +namespace osx { |
| 30 | + |
27 | 31 | #if CLIP_ENABLE_IMAGE
|
28 | 32 |
|
29 |
| - bool get_image_from_clipboard(image* output_img, |
| 33 | + bool get_image_from_clipboard(NSPasteboard* pasteboard, |
| 34 | + image* output_img, |
30 | 35 | image_spec* output_spec)
|
31 | 36 | {
|
32 |
| - NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; |
33 | 37 | NSString* result = [pasteboard availableTypeFromArray:
|
34 | 38 | [NSArray arrayWithObjects:NSPasteboardTypeTIFF,NSPasteboardTypePNG,nil]];
|
35 | 39 |
|
@@ -137,7 +141,7 @@ bool get_image_from_clipboard(image* output_img,
|
137 | 141 |
|
138 | 142 | #endif // CLIP_ENABLE_IMAGE
|
139 | 143 |
|
140 |
| -} |
| 144 | +} // namespace osx |
141 | 145 |
|
142 | 146 | lock::impl::impl(void*) : m_locked(true) {
|
143 | 147 | }
|
@@ -347,11 +351,13 @@ bool get_image_from_clipboard(image* output_img,
|
347 | 351 | }
|
348 | 352 |
|
349 | 353 | bool lock::impl::get_image(image& img) const {
|
350 |
| - return get_image_from_clipboard(&img, nullptr); |
| 354 | + NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; |
| 355 | + return osx::get_image_from_clipboard(pasteboard, &img, nullptr); |
351 | 356 | }
|
352 | 357 |
|
353 | 358 | bool lock::impl::get_image_spec(image_spec& spec) const {
|
354 |
| - return get_image_from_clipboard(nullptr, &spec); |
| 359 | + NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; |
| 360 | + return osx::get_image_from_clipboard(pasteboard, nullptr, &spec); |
355 | 361 | }
|
356 | 362 |
|
357 | 363 | #endif // CLIP_ENABLE_IMAGE
|
|
0 commit comments