Skip to content

Commit 54ed9f5

Browse files
authored
Original window regrabs focus when using QuickOpen to switch to other window (fix microsoft#203111) (microsoft#203676) (microsoft#203695)
Aux window: window flickers briefly when changing window focus (fix microsoft#200615)
1 parent 73fe65f commit 54ed9f5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/vs/platform/auxiliaryWindow/electron-main/auxiliaryWindow.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { BrowserWindow, WebContents } from 'electron';
7+
import { isLinux, isWindows } from 'vs/base/common/platform';
78
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
89
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
910
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
1011
import { ILogService } from 'vs/platform/log/common/log';
1112
import { IStateService } from 'vs/platform/state/node/state';
13+
import { hasNativeTitlebar } from 'vs/platform/window/common/window';
1214
import { IBaseWindow } from 'vs/platform/window/electron-main/window';
1315
import { BaseWindow } from 'vs/platform/windows/electron-main/windowImpl';
1416

@@ -61,6 +63,9 @@ export class AuxiliaryWindow extends BaseWindow implements IAuxiliaryWindow {
6163

6264
// Disable Menu
6365
window.setMenu(null);
66+
if ((isWindows || isLinux) && hasNativeTitlebar(this.configurationService)) {
67+
window.setAutoHideMenuBar(true); // Fix for https://github.com/microsoft/vscode/issues/200615
68+
}
6469

6570
// Lifecycle
6671
this.lifecycleMainService.registerAuxWindow(this);

src/vs/platform/menubar/electron-main/menubar.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,13 @@ export class Menubar {
379379
// Setting the application menu sets it to all opened windows,
380380
// but we currently do not support a menu in auxiliary windows,
381381
// so we need to unset it there.
382+
//
383+
// This is a bit ugly but `setApplicationMenu()` has some nice
384+
// behaviour we want:
385+
// - on macOS it is required because menus are application set
386+
// - we use `getApplicationMenu()` to access the current state
387+
// - new windows immediately get the same menu when opening
388+
// reducing overall flicker for these
382389

383390
Menu.setApplicationMenu(menu);
384391

0 commit comments

Comments
 (0)