removing NSWindow based mouse tracking in favour of 10.5+ trackingArea implementation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2012-03-10 12:37:58 +00:00
parent b23ea17884
commit 94734b4e51
2 changed files with 5 additions and 48 deletions

View File

@@ -131,22 +131,6 @@ bool shouldHandleSelector(SEL selector)
((wxWidgetCocoaImpl*)cw->GetPeer())->DoHandleMouseEvent( event);
handled = true;
}
else if ( [event type] == NSMouseMoved )
{
NSPoint nsPoint = [event locationInWindow];
if ( [event window] != nil )
nsPoint = [[event window] convertBaseToScreen:nsPoint];
wxPoint pt = wxFromNSPoint(NULL, nsPoint);
wxWindow* mw = ::wxFindWindowAtPoint(pt);
if ( mw )
{
if (wxTheApp)
wxTheApp->MacSetCurrentEvent(event, NULL);
((wxWidgetCocoaImpl*)mw->GetPeer())->DoHandleMouseEvent( event);
handled = true;
}
}
if ( handled )
{
if (wxTheApp)
@@ -654,8 +638,6 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
[m_macWindow setDelegate:controller];
[m_macWindow setAcceptsMouseMovedEvents: YES];
if ( ( style & wxFRAME_SHAPED) )
{
[m_macWindow setOpaque:NO];

View File

@@ -92,11 +92,8 @@ NSRect wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const
id _lastToolTipOwner;
void* _lastUserData;
NSTrackingArea* _trackingArea;
}
- (void) updateTrackingArea;
- (NSTrackingArea*) trackingArea;
@end // wxNSView
@interface NSView(PossibleMethods)
@@ -684,27 +681,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve
}
}
- (void) updateTrackingArea
{
if (_trackingArea)
{
[self removeTrackingArea: _trackingArea];
[_trackingArea release];
}
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited|NSTrackingMouseMoved|NSTrackingActiveAlways;
NSTrackingArea* area = [[NSTrackingArea alloc] initWithRect: [self bounds] options: options owner: self userInfo: nil];
[self addTrackingArea: area];
_trackingArea = area;
}
- (NSTrackingArea*) trackingArea
{
return _trackingArea;
}
/* idea taken from webkit sources: overwrite the methods that (private) NSToolTipManager will use to attach its tracking rectangle
* then when changing the tooltip send fake view-exit and view-enter methods which will lead to a tooltip refresh
*/
@@ -2010,11 +1986,6 @@ void wxWidgetCocoaImpl::Move(int x, int y, int width, int height)
NSRect r = wxToNSRect( [m_osxView superview], wxRect(x,y,width, height) );
[m_osxView setFrame:r];
[[m_osxView superview] setNeedsDisplayInRect:r];
wxNSView* wxview = (wxNSView*)m_osxView;
if ([wxview respondsToSelector:@selector(updateTrackingArea)] )
[wxview updateTrackingArea];
}
void wxWidgetCocoaImpl::GetPosition( int &x, int &y ) const
@@ -2402,7 +2373,11 @@ void wxWidgetCocoaImpl::InstallEventHandler( WXWidget control )
}
}
}
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited|NSTrackingMouseMoved|NSTrackingActiveAlways|NSTrackingInVisibleRect;
NSTrackingArea* area = [[NSTrackingArea alloc] initWithRect: NSZeroRect options: options owner: m_osxView userInfo: nil];
[m_osxView addTrackingArea: area];
[area release];
}
bool wxWidgetCocoaImpl::DoHandleCharEvent(NSEvent *event, NSString *text)
{