summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authoradam <adam@pkgsrc.org>2010-08-29 08:53:12 +0000
committeradam <adam@pkgsrc.org>2010-08-29 08:53:12 +0000
commitb8f76ff38461f2c9cc21249710e9993c9cfd670e (patch)
tree91ad1fcdc7e2adae1c575a81a491c38db64fe985 /games
parent639a2b3c5c00df62311c1495cd159f1ce7e78dde (diff)
downloadpkgsrc-b8f76ff38461f2c9cc21249710e9993c9cfd670e.tar.gz
Fix buildling on MacOSX
Diffstat (limited to 'games')
-rw-r--r--games/wesnoth/distinfo4
-rw-r--r--games/wesnoth/patches/patch-ag95
2 files changed, 96 insertions, 3 deletions
diff --git a/games/wesnoth/distinfo b/games/wesnoth/distinfo
index 8d3ecca8a49..2bfb41799bd 100644
--- a/games/wesnoth/distinfo
+++ b/games/wesnoth/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.38 2010/08/28 20:08:40 adam Exp $
+$NetBSD: distinfo,v 1.39 2010/08/29 08:53:12 adam Exp $
SHA1 (wesnoth-1.8.4.tar.bz2) = 30b82e06523f9a82b770a6fc4e2d4251bd358eca
RMD160 (wesnoth-1.8.4.tar.bz2) = 86b6f6ca39cf87134d89e989ed20840836aeac28
@@ -6,5 +6,5 @@ Size (wesnoth-1.8.4.tar.bz2) = 300557790 bytes
SHA1 (patch-aa) = 363dead4e4a6974db5a2d71a460e60404cc1246a
SHA1 (patch-ae) = 9e0ee531c33da80565791d81f716b313fa85af18
SHA1 (patch-af) = d3554b1c164ff95ee2b86c17990ed236f0e00c32
-SHA1 (patch-ag) = f87094daa3a03b2a56ab4d729c92b98f13ff8a38
+SHA1 (patch-ag) = 653521d3ac87c1a6a9a74563a5934e3ee9c40d99
SHA1 (patch-ah) = ca06ab21724812290c4f4785cfbd42d3406202fb
diff --git a/games/wesnoth/patches/patch-ag b/games/wesnoth/patches/patch-ag
index b02bfa6efc8..3d8a48ea1bd 100644
--- a/games/wesnoth/patches/patch-ag
+++ b/games/wesnoth/patches/patch-ag
@@ -1,4 +1,6 @@
-$NetBSD: patch-ag,v 1.4 2010/08/28 20:08:40 adam Exp $
+$NetBSD: patch-ag,v 1.5 2010/08/29 08:53:12 adam Exp $
+
+On MacOSX use Pasteboard Manager instead of depreciated Scrap Manager.
--- src/clipboard.cpp.orig 2010-02-06 10:50:29.000000000 +0000
+++ src/clipboard.cpp
@@ -11,3 +13,94 @@ $NetBSD: patch-ag,v 1.4 2010/08/28 20:08:40 adam Exp $
/**
The following are two classes which wrap the SDL's interface to X,
including locking/unlocking, and which manage the atom internment.
+@@ -483,7 +485,7 @@ void copy_to_clipboard(const std::string
+ {
+ std::string new_str;
+ new_str.reserve(text.size());
+- for (int i = 0; i < text.size(); ++i)
++ for (unsigned int i = 0; i < text.size(); ++i)
+ {
+ if (text[i] == '\n')
+ {
+@@ -493,33 +495,64 @@ void copy_to_clipboard(const std::string
+ }
+ }
+ OSStatus err = noErr;
+- ScrapRef scrap = kScrapRefNone;
+- err = ClearCurrentScrap();
++ PasteboardRef clipboard;
++ PasteboardSyncFlags syncFlags;
++ CFDataRef textData = NULL;
++ err = PasteboardCreate(kPasteboardClipboard, &clipboard);
+ if (err != noErr) return;
+- err = GetCurrentScrap(&scrap);
++ err = PasteboardClear(clipboard);
+ if (err != noErr) return;
+- PutScrapFlavor(scrap, kScrapFlavorTypeText, kScrapFlavorMaskNone, text.size(), new_str.c_str());
++ syncFlags = PasteboardSynchronize(clipboard);
++ if (!(syncFlags&kPasteboardModified) || (syncFlags&kPasteboardClientIsOwner)) return;
++ textData = CFDataCreate(kCFAllocatorDefault, (const UInt8 *)new_str.c_str(), text.size());
++ PasteboardPutItemFlavor(clipboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), textData, 0);
+ }
+
+ std::string copy_from_clipboard(const bool)
+ {
+- ScrapRef curscrap = kScrapRefNone;
+- Size scrapsize = 0;
+ OSStatus err = noErr;
+- err = GetCurrentScrap(&curscrap);
+- if (err != noErr) return "";
+- err = GetScrapFlavorSize(curscrap, kScrapFlavorTypeText, &scrapsize);
++ PasteboardRef clipboard;
++ PasteboardSyncFlags syncFlags;
++ ItemCount count;
++ err = PasteboardCreate(kPasteboardClipboard, &clipboard);
+ if (err != noErr) return "";
+- std::string str;
+- str.reserve(scrapsize);
+- str.resize(scrapsize);
+- err = GetScrapFlavorData(curscrap, kScrapFlavorTypeText, &scrapsize, const_cast<char*>(str.data()));
++ syncFlags = PasteboardSynchronize(clipboard);
++ if (syncFlags&kPasteboardModified) return "";
++ err = PasteboardGetItemCount(clipboard, &count);
+ if (err != noErr) return "";
+- for (int i = 0; i < str.size(); ++i)
+- {
+- if (str[i] == '\r') str[i] = '\n';
++ for (UInt32 k = 1; k <= count; k++) {
++ PasteboardItemID itemID;
++ CFArrayRef flavorTypeArray;
++ CFIndex flavorCount;
++ err = PasteboardGetItemIdentifier(clipboard, k, &itemID);
++ if (err != noErr) return "";
++ err = PasteboardCopyItemFlavors(clipboard, itemID, &flavorTypeArray);
++ if (err != noErr) return "";
++ flavorCount = CFArrayGetCount(flavorTypeArray);
++ for (CFIndex j = 0; j < flavorCount; j++) {
++ CFStringRef flavorType;
++ CFDataRef flavorData;
++ CFIndex flavorDataSize;
++ flavorType = (CFStringRef)CFArrayGetValueAtIndex(flavorTypeArray, j);
++ if (UTTypeConformsTo(flavorType, CFSTR("public.utf8-plain-text"))) {
++ err = PasteboardCopyItemFlavorData(clipboard, itemID, flavorType, &flavorData);
++ if (err != noErr) {
++ CFRelease(flavorTypeArray);
++ return "";
++ }
++ flavorDataSize = CFDataGetLength(flavorData);
++ std::string str;
++ str.reserve(flavorDataSize);
++ str.resize(flavorDataSize);
++ CFDataGetBytes(flavorData, CFRangeMake(0, flavorDataSize), (UInt8 *)str.data());
++ for (unsigned int i = 0; i < str.size(); ++i) {
++ if (str[i] == '\r') str[i] = '\n';
++ }
++ return str;
++ }
++ }
+ }
+- return str;
++ return "";
+ }
+
+ void handle_system_event(const SDL_Event& event)