mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 16:58:55 -05:00
workaround win10 focus issue
This commit is contained in:
2
src/typings/atom-browser.d.ts
vendored
2
src/typings/atom-browser.d.ts
vendored
@@ -182,6 +182,8 @@ declare class BrowserWindow extends EventEmitter {
|
||||
setFullScreen(fullscreen: boolean): void;
|
||||
isFullScreen(): boolean;
|
||||
isMaximized(): boolean;
|
||||
minimize(): void;
|
||||
isFocused(): boolean;
|
||||
isMinimized(): boolean;
|
||||
isVisible(): boolean;
|
||||
restore(): boolean;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import path = require('path');
|
||||
import os = require('os');
|
||||
|
||||
import Shell = require('shell');
|
||||
import screen = require('screen');
|
||||
@@ -218,18 +219,23 @@ export class VSCodeWindow {
|
||||
return this._win;
|
||||
}
|
||||
|
||||
public restore(): void {
|
||||
public focus(): void {
|
||||
if (!this._win) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._win.isMinimized()) {
|
||||
this._win.restore();
|
||||
// Windows 10: https://github.com/Microsoft/vscode/issues/929
|
||||
if (platform.isWindows && os.release() && os.release().indexOf('10.') === 0 && !this._win.isFocused()) {
|
||||
this._win.minimize();
|
||||
this._win.focus();
|
||||
}
|
||||
|
||||
if (platform.isWindows || platform.isLinux) {
|
||||
this._win.show(); // Windows & Linux sometimes cannot bring the window to the front when it is in the background
|
||||
} else {
|
||||
// Mac / Linux / Windows 7 & 8
|
||||
else {
|
||||
if (this._win.isMinimized()) {
|
||||
this._win.restore();
|
||||
}
|
||||
|
||||
this._win.focus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ export class WindowsManager {
|
||||
// Open Files in last instance if any and flag tells us so
|
||||
let lastActiveWindow = this.getLastActiveWindow();
|
||||
if (!openFilesInNewWindow && lastActiveWindow) {
|
||||
lastActiveWindow.restore();
|
||||
lastActiveWindow.focus();
|
||||
lastActiveWindow.ready().then((readyWindow) => {
|
||||
readyWindow.send('vscode:openFiles', {
|
||||
filesToOpen: filesToOpen,
|
||||
@@ -449,7 +449,7 @@ export class WindowsManager {
|
||||
// Check for existing instances
|
||||
let windowsOnWorkspacePath = arrays.coalesce(foldersToOpen.map((iPath) => this.findWindow(iPath.workspacePath)));
|
||||
if (windowsOnWorkspacePath.length > 0) {
|
||||
windowsOnWorkspacePath[0].restore(); // just focus one of them
|
||||
windowsOnWorkspacePath[0].focus(); // just focus one of them
|
||||
windowsOnWorkspacePath[0].ready().then((readyWindow) => {
|
||||
readyWindow.send('vscode:openFiles', {
|
||||
filesToOpen: filesToOpen,
|
||||
@@ -518,7 +518,7 @@ export class WindowsManager {
|
||||
let res = WindowsManager.WINDOWS.filter((w) => w.config && this.isPathEqual(w.config.pluginDevelopmentPath, openConfig.cli.pluginDevelopmentPath));
|
||||
if (res && res.length === 1) {
|
||||
this.reload(res[0], openConfig.cli);
|
||||
res[0].restore(); // make sure it gets focus and is restored
|
||||
res[0].focus(); // make sure it gets focus and is restored
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ export class WindowsManager {
|
||||
vscodeWindow = windowToUse || this.getLastActiveWindow();
|
||||
|
||||
if (vscodeWindow) {
|
||||
vscodeWindow.restore();
|
||||
vscodeWindow.focus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ export class WindowsManager {
|
||||
public focusLastActive(cli: env.ICommandLineArguments): void {
|
||||
let lastActive = this.getLastActiveWindow();
|
||||
if (lastActive) {
|
||||
lastActive.restore();
|
||||
lastActive.focus();
|
||||
}
|
||||
|
||||
// No window - open new one
|
||||
|
||||
Reference in New Issue
Block a user