diff options
author | Jean-Luc Peurière <jlp@nerim.net> | 2008-05-02 14:38:50 +0400 |
---|---|---|
committer | Jean-Luc Peurière <jlp@nerim.net> | 2008-05-02 14:38:50 +0400 |
commit | 273829de619cf778c78a0182abed3713fa1dfd70 (patch) | |
tree | bfb8853ca0013c8419717898696c58aa88e11185 /intern/ghost | |
parent | da509d33c72a5c23327feafa035b1e9ec349f297 (diff) |
fix for #10080 copy/paste operations were
broken after first on os X
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 568f7ecf9b8..844dbc04233 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -34,10 +34,9 @@ * @date May 7, 2001 */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include <Carbon/Carbon.h> +#include <ApplicationServices/ApplicationServices.h> #include "GHOST_SystemCarbon.h" #include "GHOST_DisplayManagerCarbon.h" @@ -52,6 +51,7 @@ #include "GHOST_WindowManager.h" #include "GHOST_WindowCarbon.h" #include "GHOST_NDOFManager.h" +#include "AssertMacros.h" #define GHOST_KEY_SWITCH(mac, ghost) { case (mac): ghostKey = (ghost); break; } @@ -1121,12 +1121,15 @@ GHOST_TUns8* GHOST_SystemCarbon::getClipboard(int flag) const OSStatus err = noErr; GHOST_TUns8 * temp_buff; CFRange range; + OSStatus syncFlags; err = PasteboardCreate(kPasteboardClipboard, &inPasteboard); if(err != noErr) { return NULL;} - err = PasteboardSynchronize( inPasteboard ); - if(err != noErr) { return NULL;} + syncFlags = PasteboardSynchronize( inPasteboard ); + /* as we always get in a new string, we can safely ignore sync flags if not an error*/ + if(syncFlags <0) { return NULL;} + err = PasteboardGetItemIdentifier( inPasteboard, 1, &itemID ); if(err != noErr) { return NULL;} @@ -1152,15 +1155,19 @@ GHOST_TUns8* GHOST_SystemCarbon::getClipboard(int flag) const void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, int flag) const { if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11 + printf("flag %i string is %s \n",flag,buffer); + PasteboardRef inPasteboard; CFDataRef textData = NULL; OSStatus err = noErr; /*For error checking*/ + OSStatus syncFlags; err = PasteboardCreate(kPasteboardClipboard, &inPasteboard); if(err != noErr) { return;} - err = PasteboardSynchronize( inPasteboard ); - if(err != noErr) { return;} + syncFlags = PasteboardSynchronize( inPasteboard ); + /* as we always put in a new string, we can safely ignore sync flags */ + if(syncFlags <0) { return;} err = PasteboardClear( inPasteboard ); if(err != noErr) { return;} |