gcc 4.2 warning fix

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61699 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-08-18 15:32:04 +00:00
parent f66ecdc4fb
commit eb1d8888a1

View File

@@ -391,119 +391,121 @@ pascal OSErr wxMacWindowDragTrackingHandler(
break; break;
GetDragMouse( theDrag, &mouse, 0L ); GetDragMouse( theDrag, &mouse, 0L );
int x = mouse.h ; {
int y = mouse.v ; int x = mouse.h ;
toplevel->GetNonOwnedPeer()->ScreenToWindow( &x, &y ); int y = mouse.v ;
localMouse.h = x; toplevel->GetNonOwnedPeer()->ScreenToWindow( &x, &y );
localMouse.v = y; localMouse.h = x;
localMouse.v = y;
{ {
wxWindow *win = NULL; wxWindow *win = NULL;
ControlPartCode controlPart; ControlPartCode controlPart;
ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart ); ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart );
if ( control ) if ( control )
win = wxFindWindowFromWXWidget( (WXWidget) control ); win = wxFindWindowFromWXWidget( (WXWidget) control );
else else
win = toplevel; win = toplevel;
int localx, localy; int localx, localy;
localx = localMouse.h; localx = localMouse.h;
localy = localMouse.v; localy = localMouse.v;
if ( win ) if ( win )
win->MacRootWindowToWindow( &localx, &localy ); win->MacRootWindowToWindow( &localx, &localy );
if ( win != trackingGlobals->m_currentTargetWindow ) if ( win != trackingGlobals->m_currentTargetWindow )
{ {
if ( trackingGlobals->m_currentTargetWindow ) if ( trackingGlobals->m_currentTargetWindow )
{ {
// this window is left // this window is left
if ( trackingGlobals->m_currentTarget ) if ( trackingGlobals->m_currentTarget )
{ {
#ifndef __LP64__ #ifndef __LP64__
HideDragHilite( theDrag ); HideDragHilite( theDrag );
#endif #endif
trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard ); trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard );
trackingGlobals->m_currentTarget->OnLeave(); trackingGlobals->m_currentTarget->OnLeave();
trackingGlobals->m_currentTarget = NULL; trackingGlobals->m_currentTarget = NULL;
trackingGlobals->m_currentTargetWindow = NULL; trackingGlobals->m_currentTargetWindow = NULL;
} }
} }
if ( win ) if ( win )
{ {
// this window is entered // this window is entered
trackingGlobals->m_currentTargetWindow = win; trackingGlobals->m_currentTargetWindow = win;
trackingGlobals->m_currentTarget = win->GetDropTarget(); trackingGlobals->m_currentTarget = win->GetDropTarget();
{ {
if ( trackingGlobals->m_currentTarget ) if ( trackingGlobals->m_currentTarget )
{ {
trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard ); trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard );
result = trackingGlobals->m_currentTarget->OnEnter( localx, localy, result ); result = trackingGlobals->m_currentTarget->OnEnter( localx, localy, result );
} }
if ( result != wxDragNone ) if ( result != wxDragNone )
{ {
int x, y; int x, y;
x = y = 0; x = y = 0;
win->MacWindowToRootWindow( &x, &y ); win->MacWindowToRootWindow( &x, &y );
RgnHandle hiliteRgn = NewRgn(); RgnHandle hiliteRgn = NewRgn();
Rect r = { y, x, y + win->GetSize().y, x + win->GetSize().x }; Rect r = { y, x, y + win->GetSize().y, x + win->GetSize().x };
RectRgn( hiliteRgn, &r ); RectRgn( hiliteRgn, &r );
#ifndef __LP64__ #ifndef __LP64__
ShowDragHilite( theDrag, hiliteRgn, true ); ShowDragHilite( theDrag, hiliteRgn, true );
#endif #endif
DisposeRgn( hiliteRgn ); DisposeRgn( hiliteRgn );
} }
} }
} }
} }
else else
{ {
if ( trackingGlobals->m_currentTarget ) if ( trackingGlobals->m_currentTarget )
{ {
trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard ); trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard );
result = trackingGlobals->m_currentTarget->OnDragOver( localx, localy, result ); result = trackingGlobals->m_currentTarget->OnDragOver( localx, localy, result );
} }
} }
// set cursor for OnEnter and OnDragOver // set cursor for OnEnter and OnDragOver
if ( trackingGlobals->m_currentSource && !trackingGlobals->m_currentSource->GiveFeedback( result ) ) if ( trackingGlobals->m_currentSource && !trackingGlobals->m_currentSource->GiveFeedback( result ) )
{ {
if ( !trackingGlobals->m_currentSource->MacInstallDefaultCursor( result ) ) if ( !trackingGlobals->m_currentSource->MacInstallDefaultCursor( result ) )
{ {
wxStockCursor cursorID = wxCURSOR_NONE; wxStockCursor cursorID = wxCURSOR_NONE;
switch (result) switch (result)
{ {
case wxDragCopy: case wxDragCopy:
cursorID = wxCURSOR_COPY_ARROW; cursorID = wxCURSOR_COPY_ARROW;
break; break;
case wxDragMove: case wxDragMove:
cursorID = wxCURSOR_ARROW; cursorID = wxCURSOR_ARROW;
break; break;
case wxDragNone: case wxDragNone:
cursorID = wxCURSOR_NO_ENTRY; cursorID = wxCURSOR_NO_ENTRY;
break; break;
case wxDragError: case wxDragError:
case wxDragLink: case wxDragLink:
case wxDragCancel: case wxDragCancel:
default: default:
// put these here to make gcc happy // put these here to make gcc happy
; ;
} }
if (cursorID != wxCURSOR_NONE) if (cursorID != wxCURSOR_NONE)
{ {
wxCursor cursor( cursorID ); wxCursor cursor( cursorID );
cursor.MacInstall(); cursor.MacInstall();
} }
} }
} }
} }
}
break; break;
case kDragTrackingLeaveWindow: case kDragTrackingLeaveWindow: