X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb7f8ac54599191ad2b2e034faaa6ebdd69c1765..09155be84e2240da3977cf3629c42d412177a570:/src/mac/carbon/dnd.cpp?ds=sidebyside diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index f82e12418f..5744c01f3d 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -206,7 +206,7 @@ bool wxDropTarget::GetData() if( theType == 'TEXT' ) { theData[dataSize]=0 ; - wxString convert = wxMacMakeStringFromCString( theData ) ; + wxString convert( theData , wxConvLocal ) ; m_dataObject->SetData( format, convert.Length() * sizeof(wxChar), (const wxChar*) convert ); } else if ( theType == kDragFlavorTypeHFS ) @@ -302,7 +302,7 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) dataSize-- ; dataPtr[ dataSize ] = 0 ; wxString st( (wxChar*) dataPtr ) ; - wxCharBuffer buf = wxMacStringToCString( st ) ; + wxCharBuffer buf = st.mb_str( wxConvLocal) ; AddDragItemFlavor(theDrag, theItem, type , buf.data(), strlen(buf), 0); } else if (type == kDragFlavorTypeHFS ) @@ -379,7 +379,7 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) gTrackingGlobals.m_currentSource = NULL ; KeyMap keymap; - GetKeys((BigEndianLong*)&keymap); + GetKeys(keymap); bool optionDown = keymap[1] & 4; wxDragResult dndresult = optionDown ? wxDragCopy : wxDragMove; return dndresult; @@ -435,7 +435,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind wxTopLevelWindowMac* toplevel = wxFindWinFromMacWindow( theWindow ) ; KeyMap keymap; - GetKeys((BigEndianLong*)&keymap); + GetKeys(keymap); bool optionDown = keymap[1] & 4; wxDragResult result = optionDown ? wxDragCopy : wxDragMove; @@ -463,7 +463,12 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind { wxPoint point(localMouse.h , localMouse.v) ; wxWindow *win = NULL ; - toplevel->MacGetWindowFromPointSub( point , &win ) ; + ControlPartCode controlPart ; + ControlRef control = wxMacFindControlUnderMouse( localMouse , + theWindow , &controlPart ) ; + if ( control ) + win = wxFindControlFromMacControl( control ) ; + // TODO toplevel->MacGetWindowFromPointSub( point , &win ) ; int localx , localy ; localx = localMouse.h ; localy = localMouse.v ; @@ -505,7 +510,8 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind x = y = 0 ; win->MacWindowToRootWindow( &x , &y ) ; RgnHandle hiliteRgn = NewRgn() ; - SetRectRgn( hiliteRgn , x , y , x+win->GetSize().x ,y+win->GetSize().y) ; + Rect r = { y , x , y+win->GetSize().y , x+win->GetSize().x } ; + RectRgn( hiliteRgn , &r ) ; ShowDragHilite(theDrag, hiliteRgn, true); DisposeRgn( hiliteRgn ) ; } @@ -596,7 +602,7 @@ pascal OSErr wxMacWindowDragReceiveHandler(WindowPtr theWindow, if ( trackingGlobals->m_currentTarget->OnDrop( localx , localy ) ) { KeyMap keymap; - GetKeys((BigEndianLong*)&keymap); + GetKeys(keymap); bool optionDown = keymap[1] & 4; wxDragResult result = optionDown ? wxDragCopy : wxDragMove; trackingGlobals->m_currentTarget->OnData( localx , localy , result ) ;