Improve the tracing of the tracking rect manager and mouse movement synthesizer.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48150 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2007-08-18 05:39:32 +00:00
parent 1f361be22f
commit 18b32eb5b5

View File

@@ -711,7 +711,7 @@ bool wxWindowCocoa::Cocoa_mouseEntered(WX_NSEvent theEvent)
wxMouseEvent event(wxEVT_ENTER_WINDOW); wxMouseEvent event(wxEVT_ENTER_WINDOW);
InitMouseEvent(event,theEvent); InitMouseEvent(event,theEvent);
wxLogTrace(wxTRACE_COCOA,wxT("wxwin=%p Mouse Entered @%d,%d"),this,event.m_x,event.m_y); wxLogTrace(wxTRACE_COCOA_TrackingRect,wxT("wxwin=%p Mouse Entered TR#%d @%d,%d"),this,[theEvent trackingNumber], event.m_x,event.m_y);
return GetEventHandler()->ProcessEvent(event); return GetEventHandler()->ProcessEvent(event);
} }
else else
@@ -726,7 +726,7 @@ bool wxWindowCocoa::Cocoa_mouseExited(WX_NSEvent theEvent)
wxMouseEvent event(wxEVT_LEAVE_WINDOW); wxMouseEvent event(wxEVT_LEAVE_WINDOW);
InitMouseEvent(event,theEvent); InitMouseEvent(event,theEvent);
wxLogTrace(wxTRACE_COCOA,wxT("wxwin=%p Mouse Exited @%d,%d"),this,event.m_x,event.m_y); wxLogTrace(wxTRACE_COCOA_TrackingRect,wxT("wxwin=%p Mouse Exited TR#%d @%d,%d"),this,[theEvent trackingNumber],event.m_x,event.m_y);
return GetEventHandler()->ProcessEvent(event); return GetEventHandler()->ProcessEvent(event);
} }
else else
@@ -1412,11 +1412,12 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt)
return NULL; return NULL;
} }
// ======================================================================== // ========================================================================
// wxCocoaMouseMovedEventSynthesizer // wxCocoaMouseMovedEventSynthesizer
// ======================================================================== // ========================================================================
#define wxTRACE_COCOA_MouseMovedSynthesizer wxT("COCOA_MouseMovedSynthesizer")
/* This class registers one run loop observer to cover all windows registered with it. /* This class registers one run loop observer to cover all windows registered with it.
* It will register the observer when the first view is registerd and unregister the * It will register the observer when the first view is registerd and unregister the
* observer when the last view is unregistered. * observer when the last view is unregistered.
@@ -1447,7 +1448,7 @@ protected:
void wxCocoaMouseMovedEventSynthesizer::RegisterWxCocoaView(wxCocoaNSView *aView) void wxCocoaMouseMovedEventSynthesizer::RegisterWxCocoaView(wxCocoaNSView *aView)
{ {
m_registeredViews.push_back(aView); m_registeredViews.push_back(aView);
wxLogTrace(wxTRACE_COCOA_TrackingRect, wxT("Registered wxCocoaNSView=%p"), aView); wxLogTrace(wxTRACE_COCOA_MouseMovedSynthesizer, wxT("Registered wxCocoaNSView=%p"), aView);
if(!m_registeredViews.empty() && m_runLoopObserver == NULL) if(!m_registeredViews.empty() && m_runLoopObserver == NULL)
{ {
@@ -1458,7 +1459,7 @@ void wxCocoaMouseMovedEventSynthesizer::RegisterWxCocoaView(wxCocoaNSView *aView
void wxCocoaMouseMovedEventSynthesizer::UnregisterWxCocoaView(wxCocoaNSView *aView) void wxCocoaMouseMovedEventSynthesizer::UnregisterWxCocoaView(wxCocoaNSView *aView)
{ {
m_registeredViews.remove(aView); m_registeredViews.remove(aView);
wxLogTrace(wxTRACE_COCOA_TrackingRect, wxT("Unregistered wxCocoaNSView=%p"), aView); wxLogTrace(wxTRACE_COCOA_MouseMovedSynthesizer, wxT("Unregistered wxCocoaNSView=%p"), aView);
if(m_registeredViews.empty() && m_runLoopObserver != NULL) if(m_registeredViews.empty() && m_runLoopObserver != NULL)
{ {
RemoveRunLoopObserver(); RemoveRunLoopObserver();
@@ -1568,6 +1569,7 @@ void wxCocoaTrackingRectManager::ClearTrackingRect()
{ {
[m_window->GetNSView() removeTrackingRect:m_trackingRectTag]; [m_window->GetNSView() removeTrackingRect:m_trackingRectTag];
m_isTrackingRectActive = false; m_isTrackingRectActive = false;
wxLogTrace(wxTRACE_COCOA_TrackingRect, wxT("%s@%p: Removed tracking rect #%d"), m_window->GetClassInfo()->GetClassName(), m_window, m_trackingRectTag);
} }
// If we were doing periodic events we need to clear those too // If we were doing periodic events we need to clear those too
StopSynthesizingEvents(); StopSynthesizingEvents();
@@ -1584,10 +1586,14 @@ void wxCocoaTrackingRectManager::BuildTrackingRect()
wxAutoNSAutoreleasePool pool; wxAutoNSAutoreleasePool pool;
wxASSERT_MSG(!m_isTrackingRectActive, wxT("Tracking rect was not cleared")); wxASSERT_MSG(!m_isTrackingRectActive, wxT("Tracking rect was not cleared"));
if([m_window->GetNSView() window] != nil)
NSView *theView = m_window->GetNSView();
if([theView window] != nil)
{ {
m_trackingRectTag = [m_window->GetNSView() addTrackingRect:[m_window->GetNSView() visibleRect] owner:m_window->GetNSView() userData:NULL assumeInside:NO]; m_trackingRectTag = [theView addTrackingRect:[theView visibleRect] owner:theView userData:NULL assumeInside:NO];
m_isTrackingRectActive = true; m_isTrackingRectActive = true;
wxLogTrace(wxTRACE_COCOA_TrackingRect, wxT("%s@%p: Added tracking rect #%d"), m_window->GetClassInfo()->GetClassName(), m_window, m_trackingRectTag);
} }
} }