File tree 3 files changed +20
-9
lines changed
3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,6 @@ public override void DrawRect(CGRect dirtyRect)
37
37
38
38
public override bool AcceptsFirstResponder ( ) => CanFocus ;
39
39
40
- public override bool AcceptsFirstMouse ( NSEvent theEvent ) => CanFocus || base . AcceptsFirstMouse ( theEvent ) ;
41
-
42
40
public override NSView HitTest ( CGPoint aPoint )
43
41
{
44
42
var view = base . HitTest ( aPoint ) ;
@@ -130,5 +128,12 @@ public void Update(Rectangle rect)
130
128
{
131
129
Control . DisplayRect ( rect . ToNS ( ) ) ;
132
130
}
131
+
132
+ protected override bool OnAcceptsFirstMouse ( NSEvent theEvent )
133
+ {
134
+ if ( CanFocus )
135
+ return true ;
136
+ return base . OnAcceptsFirstMouse ( theEvent ) ;
137
+ }
133
138
}
134
139
}
Original file line number Diff line number Diff line change @@ -343,6 +343,11 @@ public override void Layout()
343
343
if ( ! MacView . NewLayout )
344
344
base . Layout ( ) ;
345
345
}
346
+
347
+ public override bool AcceptsFirstMouse ( NSEvent theEvent )
348
+ {
349
+ return Handler != null ? Handler . OnAcceptsFirstMouse ( theEvent ) : base . AcceptsFirstMouse ( theEvent ) ;
350
+ }
346
351
}
347
352
348
353
bool changeStarted ;
Original file line number Diff line number Diff line change @@ -1419,21 +1419,22 @@ public event EventHandler<MouseEventArgs> AcceptsFirstMouse
1419
1419
remove => Widget . Properties . RemoveEvent ( MacView . AcceptsFirstMouse_Key , value ) ;
1420
1420
}
1421
1421
1422
- protected virtual void OnAcceptsFirstMouse ( MouseEventArgs e )
1423
- {
1424
- Widget ? . Properties . TriggerEvent ( MacView . AcceptsFirstMouse_Key , this , e ) ;
1425
- }
1426
-
1427
- bool IMacViewHandler . OnAcceptsFirstMouse ( NSEvent theEvent )
1422
+ protected virtual bool OnAcceptsFirstMouse ( NSEvent theEvent )
1428
1423
{
1429
1424
if ( ! Widget . Properties . ContainsKey ( MacView . AcceptsFirstMouse_Key ) )
1425
+ {
1426
+ if ( ContainerControl . Window is NSPanel )
1427
+ return Application . Instance . IsActive ;
1430
1428
return false ;
1429
+ }
1431
1430
1432
1431
var args = MacConversions . GetMouseEvent ( this , theEvent , false ) ;
1433
- OnAcceptsFirstMouse ( args ) ;
1432
+ Widget . Properties . TriggerEvent ( MacView . AcceptsFirstMouse_Key , this , args ) ;
1434
1433
return args . Handled ;
1435
1434
}
1436
1435
1436
+ bool IMacViewHandler . OnAcceptsFirstMouse ( NSEvent theEvent ) => OnAcceptsFirstMouse ( theEvent ) ;
1437
+
1437
1438
public virtual MouseEventArgs TriggerMouseDown ( NSObject obj , IntPtr sel , NSEvent theEvent )
1438
1439
{
1439
1440
// Flag that we are going to use a mouse tracking loop
You can’t perform that action at this time.
0 commit comments