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)
23042304
23052305 Window GetActiveWindow ( Window win )
23062306 {
2307- Gtk . Window [ ] wins = Gtk . Window . ListToplevels ( ) ;
2308-
2309- bool hasFocus = false ;
23102307 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 ( ) ;
23112319 Gtk . Window newFocused = null ;
23122320 foreach ( Gtk . Window w in wins ) {
23132321 if ( w . Visible ) {
@@ -2324,27 +2332,17 @@ Window GetActiveWindow (Window win)
23242332 }
23252333 }
23262334
2335+ lastFocused = newFocused ;
23272336#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 ;
23362337 }
2337- #else
2338- lastFocused = newFocused ;
23392338#endif
23402339
23412340 UpdateAppFocusStatus ( hasFocus , lastFocusedExists ) ;
23422341
23432342 if ( win != null && win . IsRealized ) {
23442343 RegisterTopWindow ( win ) ;
23452344 return win ;
2346- }
2347- else
2345+ } else
23482346 return null ;
23492347 }
23502348
You can’t perform that action at this time.
0 commit comments