diff options
| author | nyamatongwe <unknown> | 2010-08-05 10:03:34 +1000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2010-08-05 10:03:34 +1000 | 
| commit | 5fcee1eaf6f8bd2f4867e4dab718f99e34002c88 (patch) | |
| tree | 6b285f1706647b0560e25c881ea087c392b8d5eb | |
| parent | c4298141328fd8f81f9021b780e54c9dc3b9a02c (diff) | |
| download | scintilla-mirror-5fcee1eaf6f8bd2f4867e4dab718f99e34002c88.tar.gz | |
Bug #3039732 drag/drop on OSX overwrites clipboard.
Patch from Eric Promislow.
| -rw-r--r-- | macosx/ScintillaMacOSX.cxx | 10 | ||||
| -rw-r--r-- | macosx/ScintillaMacOSX.h | 3 | 
2 files changed, 8 insertions, 5 deletions
| diff --git a/macosx/ScintillaMacOSX.cxx b/macosx/ScintillaMacOSX.cxx index e25c501a8..ea541890b 100644 --- a/macosx/ScintillaMacOSX.cxx +++ b/macosx/ScintillaMacOSX.cxx @@ -434,7 +434,7 @@ void ScintillaMacOSX::StartDrag() {      SelectionText selectedText;      CopySelectionRange(&selectedText);      PasteboardRef theClipboard; -    SetPasteboardData(theClipboard, selectedText); +    SetPasteboardData(theClipboard, selectedText, true);      NewDragWithPasteboard( theClipboard, &inDrag);      CFRelease( theClipboard ); @@ -639,7 +639,7 @@ bool ScintillaMacOSX::GetDragData(DragRef inDrag, PasteboardRef &pasteBoard,      return GetPasteboardData(pasteBoard, selectedText, isFileURL);  } -void ScintillaMacOSX::SetPasteboardData(PasteboardRef &theClipboard, const SelectionText &selectedText) +void ScintillaMacOSX::SetPasteboardData(PasteboardRef &theClipboard, const SelectionText &selectedText, bool inDragDropSession)  {      if (selectedText.len == 0)          return; @@ -649,7 +649,9 @@ void ScintillaMacOSX::SetPasteboardData(PasteboardRef &theClipboard, const Selec      // Create a CFString from the ASCII/UTF8 data, convert it to UTF16      CFStringRef string = CFStringCreateWithBytes( NULL, reinterpret_cast<UInt8*>( selectedText.s ), selectedText.len - 1, encoding, false ); -    PasteboardCreate( kPasteboardClipboard, &theClipboard ); +    PasteboardCreate((inDragDropSession +                      ? kPasteboardUniqueName +                      : kPasteboardClipboard), &theClipboard );      PasteboardClear( theClipboard );      CFDataRef data = NULL; @@ -1477,7 +1479,7 @@ bool ScintillaMacOSX::AlwaysTrue()  void ScintillaMacOSX::CopyToClipboard(const SelectionText &selectedText) {      PasteboardRef theClipboard; -    SetPasteboardData(theClipboard, selectedText); +    SetPasteboardData(theClipboard, selectedText, false); // not in drag/drop      // Done with the CFString      CFRelease( theClipboard );  } diff --git a/macosx/ScintillaMacOSX.h b/macosx/ScintillaMacOSX.h index d9da7e295..78dffe87f 100644 --- a/macosx/ScintillaMacOSX.h +++ b/macosx/ScintillaMacOSX.h @@ -118,7 +118,8 @@ private:      bool GetPasteboardData(PasteboardRef &pasteBoard,                             SelectionText *selectedText, bool *isFileURL);      void SetPasteboardData(PasteboardRef &pasteBoard, -                           const SelectionText &selectedText); +                           const SelectionText &selectedText, +                           bool inDragDropSession);      char *GetStringFromCFString(CFStringRef &textString, int *textLen);      // Drag and drop | 
