This repository was archived by the owner on Oct 4, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-15
lines changed
main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -2304,10 +2304,18 @@ internal object NextMulticastTarget (CommandTargetRoute targetRoute)
2304
2304
2305
2305
Window GetActiveWindow ( Window win )
2306
2306
{
2307
- Gtk . Window [ ] wins = Gtk . Window . ListToplevels ( ) ;
2308
-
2309
- bool hasFocus = false ;
2310
2307
bool lastFocusedExists = lastFocused == null ;
2308
+ bool hasFocus = false ;
2309
+ #if MAC
2310
+ var nsWindow = AppKit . NSApplication . SharedApplication . KeyWindow ;
2311
+ hasFocus = nsWindow != null ;
2312
+ if ( hasFocus ) {
2313
+ lastFocusedExists |= lastFocused ? . nativeWidget == nsWindow ;
2314
+ lastFocused = win = nsWindow ;
2315
+ } else {
2316
+ #endif
2317
+
2318
+ Gtk . Window [ ] wins = Gtk . Window . ListToplevels ( ) ;
2311
2319
Gtk . Window newFocused = null ;
2312
2320
foreach ( Gtk . Window w in wins ) {
2313
2321
if ( w . Visible ) {
@@ -2324,27 +2332,17 @@ Window GetActiveWindow (Window win)
2324
2332
}
2325
2333
}
2326
2334
2335
+ lastFocused = newFocused ;
2327
2336
#if MAC
2328
- if ( ! hasFocus ) {
2329
- var nsWindow = AppKit . NSApplication . SharedApplication . KeyWindow ;
2330
- hasFocus = nsWindow != null ;
2331
- if ( hasFocus ) {
2332
- lastFocused = win = nsWindow ;
2333
- }
2334
- } else {
2335
- lastFocused = newFocused ;
2336
2337
}
2337
- #else
2338
- lastFocused = newFocused ;
2339
2338
#endif
2340
2339
2341
2340
UpdateAppFocusStatus ( hasFocus , lastFocusedExists ) ;
2342
2341
2343
2342
if ( win != null && win . IsRealized ) {
2344
2343
RegisterTopWindow ( win ) ;
2345
2344
return win ;
2346
- }
2347
- else
2345
+ } else
2348
2346
return null ;
2349
2347
}
2350
2348
You can’t perform that action at this time.
0 commit comments