@@ -204,7 +204,6 @@ - (void)close;
204
204
@interface View : NSView <NSWindowDelegate >
205
205
{ PyObject* canvas;
206
206
NSRect rubberband;
207
- BOOL inside;
208
207
NSTrackingRectTag tracking;
209
208
@public double device_scale;
210
209
}
@@ -338,7 +337,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
338
337
NSRect rect = NSMakeRect (0.0 , 0.0 , width, height);
339
338
self->view = [self ->view initWithFrame: rect];
340
339
self->view .autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
341
- int opts = (NSTrackingMouseEnteredAndExited |
340
+ int opts = (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |
342
341
NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect);
343
342
[self ->view addTrackingArea: [
344
343
[NSTrackingArea alloc ] initWithRect: rect
@@ -712,7 +711,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
712
711
[window setTitle: [NSString stringWithCString: title
713
712
encoding: NSASCIIStringEncoding]];
714
713
715
- [window setAcceptsMouseMovedEvents: YES ];
716
714
[window setDelegate: view];
717
715
[window makeFirstResponder: view];
718
716
[[window contentView ] addSubview: view];
@@ -1572,7 +1570,6 @@ - (View*)initWithFrame:(NSRect)rect
1572
1570
{
1573
1571
self = [super initWithFrame: rect];
1574
1572
rubberband = NSZeroRect ;
1575
- inside = false ;
1576
1573
device_scale = 1 ;
1577
1574
return self;
1578
1575
}
@@ -1759,8 +1756,6 @@ - (void)mouseEntered:(NSEvent *)event
1759
1756
{
1760
1757
PyGILState_STATE gstate;
1761
1758
PyObject* result;
1762
- NSWindow * window = [self window ];
1763
- if ([window isKeyWindow ]==false ) return ;
1764
1759
1765
1760
int x, y;
1766
1761
NSPoint location = [event locationInWindow ];
@@ -1777,29 +1772,20 @@ - (void)mouseEntered:(NSEvent *)event
1777
1772
else
1778
1773
PyErr_Print ();
1779
1774
PyGILState_Release (gstate);
1780
-
1781
- [window setAcceptsMouseMovedEvents: YES ];
1782
- inside = true ;
1783
1775
}
1784
1776
1785
1777
- (void )mouseExited : (NSEvent *)event
1786
1778
{
1787
1779
PyGILState_STATE gstate;
1788
1780
PyObject* result;
1789
- NSWindow * window = [self window ];
1790
- if ([window isKeyWindow ]==false ) return ;
1791
1781
1792
- if (inside==false ) return ;
1793
1782
gstate = PyGILState_Ensure ();
1794
1783
result = PyObject_CallMethod (canvas, " leave_notify_event" , " " );
1795
1784
if (result)
1796
1785
Py_DECREF (result);
1797
1786
else
1798
1787
PyErr_Print ();
1799
1788
PyGILState_Release (gstate);
1800
-
1801
- [[self window ] setAcceptsMouseMovedEvents: NO ];
1802
- inside = false ;
1803
1789
}
1804
1790
1805
1791
- (void )mouseDown : (NSEvent *)event
0 commit comments