Fix wxClipboard.
Fix enter and leave events. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1676,7 +1676,6 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
||||||
¤tMouseWindow ) ;
|
¤tMouseWindow ) ;
|
||||||
|
|
||||||
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent event ;
|
wxMouseEvent event ;
|
||||||
@@ -1698,14 +1697,18 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
if ( wxWindow::s_lastMouseWindow )
|
if ( wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent eventleave(event ) ;
|
wxMouseEvent eventleave(event);
|
||||||
eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
|
eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
|
||||||
|
wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
|
||||||
|
|
||||||
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
|
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
|
||||||
}
|
}
|
||||||
if ( currentMouseWindow )
|
if ( currentMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent evententer(event ) ;
|
wxMouseEvent evententer(event);
|
||||||
evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
|
evententer.SetEventType( wxEVT_ENTER_WINDOW );
|
||||||
|
currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
|
||||||
|
|
||||||
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
|
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
|
||||||
}
|
}
|
||||||
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
||||||
|
@@ -1676,7 +1676,6 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
||||||
¤tMouseWindow ) ;
|
¤tMouseWindow ) ;
|
||||||
|
|
||||||
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent event ;
|
wxMouseEvent event ;
|
||||||
@@ -1698,14 +1697,18 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
if ( wxWindow::s_lastMouseWindow )
|
if ( wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent eventleave(event ) ;
|
wxMouseEvent eventleave(event);
|
||||||
eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
|
eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
|
||||||
|
wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
|
||||||
|
|
||||||
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
|
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
|
||||||
}
|
}
|
||||||
if ( currentMouseWindow )
|
if ( currentMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent evententer(event ) ;
|
wxMouseEvent evententer(event);
|
||||||
evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
|
evententer.SetEventType( wxEVT_ENTER_WINDOW );
|
||||||
|
currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
|
||||||
|
|
||||||
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
|
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
|
||||||
}
|
}
|
||||||
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
||||||
|
@@ -252,6 +252,7 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
case wxDF_METAFILE:
|
case wxDF_METAFILE:
|
||||||
@@ -273,6 +274,7 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
#endif
|
#endif
|
||||||
HUnlock( (Handle) pict ) ;
|
HUnlock( (Handle) pict ) ;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case wxDF_BITMAP:
|
case wxDF_BITMAP:
|
||||||
case wxDF_DIB:
|
case wxDF_DIB:
|
||||||
|
@@ -420,13 +420,6 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
event.m_x += m_x;
|
event.m_x += m_x;
|
||||||
event.m_y += m_y;
|
event.m_y += m_y;
|
||||||
|
|
||||||
/*
|
|
||||||
wxPoint origin = GetClientAreaOrigin() ;
|
|
||||||
|
|
||||||
event.m_x += origin.x ;
|
|
||||||
event.m_y += origin.y ;
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
if ( wxTheApp->s_captureWindow )
|
if ( wxTheApp->s_captureWindow )
|
||||||
@@ -437,6 +430,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
event.m_x = x ;
|
event.m_x = x ;
|
||||||
event.m_y = y ;
|
event.m_y = y ;
|
||||||
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
|
||||||
if ( ev->what == mouseUp )
|
if ( ev->what == mouseUp )
|
||||||
{
|
{
|
||||||
wxTheApp->s_captureWindow = NULL ;
|
wxTheApp->s_captureWindow = NULL ;
|
||||||
|
@@ -1350,15 +1350,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
|
|||||||
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
|
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
|
||||||
{
|
{
|
||||||
WindowRef window ;
|
WindowRef window ;
|
||||||
|
|
||||||
Point pt = { screenpoint.y , screenpoint.x } ;
|
Point pt = { screenpoint.y , screenpoint.x } ;
|
||||||
if ( ::FindWindow( pt , &window ) == 3 )
|
if ( ::FindWindow( pt , &window ) == 3 )
|
||||||
{
|
{
|
||||||
wxPoint point( screenpoint ) ;
|
|
||||||
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
point = win->ScreenToClient( point ) ;
|
// No, this yields the CLIENT are, we need the whole frame. RR.
|
||||||
point += win->GetClientAreaOrigin() ;
|
// point = win->ScreenToClient( point ) ;
|
||||||
|
|
||||||
|
GrafPtr port;
|
||||||
|
::GetPort( &port ) ;
|
||||||
|
::SetPort( UMAGetWindowPort( window ) ) ;
|
||||||
|
::GlobalToLocal( &pt ) ;
|
||||||
|
::SetPort( port ) ;
|
||||||
|
|
||||||
|
wxPoint point( pt.h, pt.v ) ;
|
||||||
|
|
||||||
return win->MacGetWindowFromPointSub( point , outWin ) ;
|
return win->MacGetWindowFromPointSub( point , outWin ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1416,7 +1426,9 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
|
|||||||
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
||||||
wxToolTip::RelayEvent( this , event);
|
wxToolTip::RelayEvent( this , event);
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent( event ) ;
|
GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -252,6 +252,7 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
case wxDF_METAFILE:
|
case wxDF_METAFILE:
|
||||||
@@ -273,6 +274,7 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
#endif
|
#endif
|
||||||
HUnlock( (Handle) pict ) ;
|
HUnlock( (Handle) pict ) ;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case wxDF_BITMAP:
|
case wxDF_BITMAP:
|
||||||
case wxDF_DIB:
|
case wxDF_DIB:
|
||||||
|
@@ -420,13 +420,6 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
event.m_x += m_x;
|
event.m_x += m_x;
|
||||||
event.m_y += m_y;
|
event.m_y += m_y;
|
||||||
|
|
||||||
/*
|
|
||||||
wxPoint origin = GetClientAreaOrigin() ;
|
|
||||||
|
|
||||||
event.m_x += origin.x ;
|
|
||||||
event.m_y += origin.y ;
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
if ( wxTheApp->s_captureWindow )
|
if ( wxTheApp->s_captureWindow )
|
||||||
@@ -437,6 +430,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
event.m_x = x ;
|
event.m_x = x ;
|
||||||
event.m_y = y ;
|
event.m_y = y ;
|
||||||
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
|
||||||
if ( ev->what == mouseUp )
|
if ( ev->what == mouseUp )
|
||||||
{
|
{
|
||||||
wxTheApp->s_captureWindow = NULL ;
|
wxTheApp->s_captureWindow = NULL ;
|
||||||
|
@@ -1350,15 +1350,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
|
|||||||
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
|
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
|
||||||
{
|
{
|
||||||
WindowRef window ;
|
WindowRef window ;
|
||||||
|
|
||||||
Point pt = { screenpoint.y , screenpoint.x } ;
|
Point pt = { screenpoint.y , screenpoint.x } ;
|
||||||
if ( ::FindWindow( pt , &window ) == 3 )
|
if ( ::FindWindow( pt , &window ) == 3 )
|
||||||
{
|
{
|
||||||
wxPoint point( screenpoint ) ;
|
|
||||||
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
point = win->ScreenToClient( point ) ;
|
// No, this yields the CLIENT are, we need the whole frame. RR.
|
||||||
point += win->GetClientAreaOrigin() ;
|
// point = win->ScreenToClient( point ) ;
|
||||||
|
|
||||||
|
GrafPtr port;
|
||||||
|
::GetPort( &port ) ;
|
||||||
|
::SetPort( UMAGetWindowPort( window ) ) ;
|
||||||
|
::GlobalToLocal( &pt ) ;
|
||||||
|
::SetPort( port ) ;
|
||||||
|
|
||||||
|
wxPoint point( pt.h, pt.v ) ;
|
||||||
|
|
||||||
return win->MacGetWindowFromPointSub( point , outWin ) ;
|
return win->MacGetWindowFromPointSub( point , outWin ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1416,7 +1426,9 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
|
|||||||
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
||||||
wxToolTip::RelayEvent( this , event);
|
wxToolTip::RelayEvent( this , event);
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent( event ) ;
|
GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user