diff --git a/graf2d/cocoa/inc/TGCocoa.h b/graf2d/cocoa/inc/TGCocoa.h index c7fa85593dd60e04dc8743b580dc8f3f689f5640..26c0f3daf1b21784962b5bd133c568656f02b6f0 100644 --- a/graf2d/cocoa/inc/TGCocoa.h +++ b/graf2d/cocoa/inc/TGCocoa.h @@ -451,7 +451,8 @@ private: Atom_t fClipboardAtom; Atom_t fTargetString; - + Window_t fSelectionOwner; + public: static Atom_t fgDeleteWindowAtom; diff --git a/graf2d/cocoa/src/QuartzWindow.mm b/graf2d/cocoa/src/QuartzWindow.mm index 2bd726b85eb08caaf25fedbd798249edcbe9309b..17248dc004bada5449ecba45fb8c293f49a5fd9c 100644 --- a/graf2d/cocoa/src/QuartzWindow.mm +++ b/graf2d/cocoa/src/QuartzWindow.mm @@ -2571,7 +2571,7 @@ void print_mask_info(ULong_t mask) [propData getBytes : buff length : dataSize]; *format = property.fFormat; - *format = dataSize; + *nElements = dataSize; if (*format == 16) *nElements= dataSize / 2; diff --git a/graf2d/cocoa/src/TGCocoa.mm b/graf2d/cocoa/src/TGCocoa.mm index 13ccdc19f23fef0a0b581643500cc8cf8aa1958b..cc0c12df0b456106d88c9a3b18d841519a33cda4 100644 --- a/graf2d/cocoa/src/TGCocoa.mm +++ b/graf2d/cocoa/src/TGCocoa.mm @@ -247,7 +247,8 @@ TGCocoa::TGCocoa() fDirectDraw(false), fForegroundProcess(false), fCurrentMessageID(1), - fTargetString(31)//Gdk has hardcoded GDK_TARGET_STRING, which is 31. + fTargetString(31),//Gdk has hardcoded GDK_TARGET_STRING, which is 31. + fSelectionOwner(kNone) { fPimpl.reset(new Details::CocoaPrivate); @@ -257,6 +258,9 @@ TGCocoa::TGCocoa() fAtomToName[3] = "XA_ATOM"; fNameToAtom["XA_ATOM"] = 4; + fAtomToName[30] = "XA_STRING"; + fNameToAtom["XA_STRING"] = 31; + fAtomToName[32] = "XA_WINDOW"; fNameToAtom["XA_WINDOW"] = 33; // @@ -274,7 +278,8 @@ TGCocoa::TGCocoa(const char *name, const char *title) fDirectDraw(false), fForegroundProcess(false), fCurrentMessageID(1), - fTargetString(31)//Gdk has hardcoded GDK_TARGET_STRING, which is 31. + fTargetString(31),//Gdk has hardcoded GDK_TARGET_STRING, which is 31. + fSelectionOwner(kNone) { fPimpl.reset(new Details::CocoaPrivate); @@ -283,7 +288,10 @@ TGCocoa::TGCocoa(const char *name, const char *title) fAtomToName[3] = "XA_ATOM"; fNameToAtom["XA_ATOM"] = 4; - + + fAtomToName[30] = "XA_STRING"; + fNameToAtom["XA_STRING"] = 31; + fAtomToName[32] = "XA_WINDOW"; fNameToAtom["XA_WINDOW"] = 33; // @@ -3633,6 +3641,9 @@ void TGCocoa::SetPrimarySelectionOwner(Window_t windowID) //X11 - SelectionRequest and SelectionClear can be sent. //GDK on Windows sends only SelectionRequest, so do I //(actually, we do not care about "other clients" - we do not have them). + + fSelectionOwner = windowID; + Event_t selectionRequestEvent = {}; selectionRequestEvent.fType = kSelectionRequest; selectionRequestEvent.fWindow = windowID; @@ -3652,7 +3663,7 @@ Window_t TGCocoa::GetPrimarySelectionOwner() // That is the window in which, for example some text is selected. //End of comment. - return kNone; + return fSelectionOwner; } //______________________________________________________________________________ @@ -3675,7 +3686,7 @@ void TGCocoa::ConvertPrimarySelection(Window_t windowID, Atom_t clipboard, Time_ assert(!fPimpl->IsRootWindow(windowID) && "ConvertPrimarySelection, windowID parameter is a 'root' window"); assert(!IsImageOrPixmap(fPimpl->GetDrawable(windowID)) && "ConvertPrimarySelection, windowID parameter is not a valid window"); - const Util::AutoreleasePool pool; + const Util::AutoreleasePool pool; (void)clipboard; } @@ -3700,7 +3711,10 @@ Int_t TGCocoa::GetProperty(Window_t windowID, Atom_t propertyID, Long_t, Long_t, //End of comment. //TODO: actually, property can be set for a 'root' window. I have to save this data somehow. - assert(!fPimpl->IsRootWindow(windowID) && "GetProperty, windowID parameter is a 'root' window"); + if (fPimpl->IsRootWindow(windowID)) + return 0; + +// assert(!fPimpl->IsRootWindow(windowID) && "GetProperty, windowID parameter is a 'root' window"); assert(!IsImageOrPixmap(fPimpl->GetDrawable(windowID)) && "GetProperty, windowID is not a valid window id"); assert(propertyID > 0 && propertyID <= fAtomToName.size() && "GetProperty, propertyID parameter is not a valid atom"); assert(actualType != 0 && "GetProperty, actualType parameter is null"); @@ -3740,29 +3754,20 @@ void TGCocoa::ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t) } //______________________________________________________________________________ -void TGCocoa::ConvertSelection(Window_t windowID, Atom_t &selection, Atom_t &target, Atom_t &/*property*/, Time_t &/*timeStamp*/) +void TGCocoa::ConvertSelection(Window_t windowID, Atom_t &selection, Atom_t &target, Atom_t &property, Time_t &/*timeStamp*/) { // Requests that the specified selection be converted to the specified // target type. - (void) windowID; - (void) selection; - (void) target; - - /* Event_t newEvent = {}; - newEvent.fType = kSelectionNotify; - newEvent.fWindow = winID; - newEvent.fUser[0] = winID; + newEvent.fType = kSelectionRequest; + newEvent.fWindow = windowID; + newEvent.fUser[0] = windowID; newEvent.fUser[1] = selection; newEvent.fUser[2] = target; - newEvent.fUser[3] = fSelectionNotifyProperty; - - NSLog(@"target for selection notify message %lu", fSelectionNotifyProperty); - - SendEvent(winID, &newEvent);*/ - + newEvent.fUser[3] = property;// fSelectionNotifyProperty; + SendEvent(windowID, &newEvent); } //______________________________________________________________________________ @@ -3772,12 +3777,9 @@ Bool_t TGCocoa::SetSelectionOwner(Window_t windowID, Atom_t &selection) // Changes the owner and last-change time for the specified selection. //End of comment. - //I do not have owners, so just clear general pasterboard (like it's done in TGWin32). -#if 0 - NSPasteboard * const pasterboard = [NSPasteboard generalPasteboard]; - [pasterboard clearContents]; - //Send SelectionRequest message. + fSelectionOwner = windowID; + Event_t selectionRequestEvent = {}; selectionRequestEvent.fType = kSelectionRequest; selectionRequestEvent.fWindow = windowID; @@ -3789,12 +3791,6 @@ Bool_t TGCocoa::SetSelectionOwner(Window_t windowID, Atom_t &selection) SendEvent(windowID, &selectionRequestEvent); return kTRUE; -#else - (void)windowID; - (void)selection; - - return kFALSE; -#endif } //______________________________________________________________________________ @@ -3812,6 +3808,8 @@ void TGCocoa::ChangeProperties(Window_t windowID, Atom_t propertyID, Atom_t type assert(!IsImageOrPixmap(fPimpl->GetDrawable(windowID)) && "ChangeProperties, windowID parameter is not a valid window id"); assert(propertyID && propertyID <= fAtomToName.size() && "ChangeProperties, propertyID parameter is not a valid atom"); + + if (!windowID)//From TGWin32. return; @@ -3821,6 +3819,7 @@ void TGCocoa::ChangeProperties(Window_t windowID, Atom_t propertyID, Atom_t type const Util::AutoreleasePool pool; const std::string &atomName = fAtomToName[propertyID - 1]; + NSObject<X11Window> * const window = fPimpl->GetWindow(windowID); [window setProperty : atomName.c_str() data : data size : len forType : type format : format]; @@ -3860,6 +3859,7 @@ void TGCocoa::ChangeProperty(Window_t windowID, Atom_t propertyID, Atom_t type, const Util::AutoreleasePool pool; const std::string &atomString = fAtomToName[propertyID - 1]; + NSObject<X11Window> * const window = fPimpl->GetWindow(windowID); [window setProperty : atomString.c_str() data : data size : len forType : type format : 8]; diff --git a/gui/gui/src/TRootCanvas.cxx b/gui/gui/src/TRootCanvas.cxx index 69b02309d5028530b1c2e60ba32ec3abd7e069cf..b4c21444ab4f787f65b2b44199fc0440c3c2ce81 100644 --- a/gui/gui/src/TRootCanvas.cxx +++ b/gui/gui/src/TRootCanvas.cxx @@ -1811,8 +1811,6 @@ Bool_t TRootCanvas::HandleDNDDrop(TDNDData *data) // Handle drop events. static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE); static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE); - - std::cout<<"TRootCanvas::HandleDNDDrop\n"; if (data->fDataType == rootObj) { TBufferFile buf(TBuffer::kRead, data->fDataLength, (void *)data->fData);