Skip to content

Commit

Permalink
Merge pull request #62648 from Microsoft/isidorn/smoothScrollingWorka…
Browse files Browse the repository at this point in the history
…round

revert debt - remove now obsolete smoothScrollingWorkaround setting
  • Loading branch information
isidorn authored Nov 6, 2018
2 parents 0ad93be + 3a01fcc commit 1d0e429
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
28 changes: 28 additions & 0 deletions src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,34 @@ export class CodeWindow implements ICodeWindow {

// Handle Workspace events
this.toDispose.push(this.workspacesMainService.onUntitledWorkspaceDeleted(e => this.onUntitledWorkspaceDeleted(e)));

// TODO@Ben workaround for https://github.com/Microsoft/vscode/issues/13612
// It looks like smooth scrolling disappears as soon as the window is minimized
// and maximized again. Touching some window properties "fixes" it, like toggling
// the visibility of the menu.
if (isWindows) {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
if (windowConfig && windowConfig.smoothScrollingWorkaround === true) {
let minimized = false;

const restoreSmoothScrolling = () => {
if (minimized) {
const visibility = this.getMenuBarVisibility();
const temporaryVisibility: MenuBarVisibility = (visibility === 'hidden' || visibility === 'toggle') ? 'default' : 'hidden';
setTimeout(() => {
this.doSetMenuBarVisibility(temporaryVisibility);
this.doSetMenuBarVisibility(visibility);
}, 0);
}

minimized = false;
};

this._win.on('minimize', () => minimized = true);
this._win.on('restore', () => restoreSmoothScrolling());
this._win.on('maximize', () => restoreSmoothScrolling());
}
}
}

private onUntitledWorkspaceDeleted(workspace: IWorkspaceIdentifier): void {
Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/windows/common/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export interface IWindowSettings {
nativeFullScreen: boolean;
enableMenuBarMnemonics: boolean;
closeWhenEmpty: boolean;
smoothScrollingWorkaround: boolean;
clickThroughInactive: boolean;
}

Expand Down
7 changes: 7 additions & 0 deletions src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,13 @@ configurationRegistry.registerConfiguration({
'description': nls.localize('window.nativeFullScreen', "Controls if native full-screen should be used on macOS. Disable this option to prevent macOS from creating a new space when going full-screen."),
'included': isMacintosh
},
'window.smoothScrollingWorkaround': {
'type': 'boolean',
'default': false,
'scope': ConfigurationScope.APPLICATION,
'markdownDescription': nls.localize('window.smoothScrollingWorkaround', "Enable this workaround if scrolling is no longer smooth after restoring a minimized VS Code window. This is a workaround for an issue (https://github.com/Microsoft/vscode/issues/13612) where scrolling starts to lag on devices with precision trackpads like the Surface devices from Microsoft. Enabling this workaround can result in a little bit of layout flickering after restoring the window from minimized state but is otherwise harmless. Note: in order for this workaround to function, make sure to also set `#window.titleBarStyle#` to `native`."),
'included': isWindows
},
'window.clickThroughInactive': {
'type': 'boolean',
'default': true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
import { RunOnceScheduler } from 'vs/base/common/async';
import { URI } from 'vs/base/common/uri';
import { isEqual } from 'vs/base/common/resources';
import { isLinux, isMacintosh } from 'vs/base/common/platform';
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { equals } from 'vs/base/common/objects';
Expand All @@ -38,6 +38,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
private enableCrashReporter: boolean;
private touchbarEnabled: boolean;
private treeHorizontalScrolling: boolean;
private windowsSmoothScrollingWorkaround: boolean;
private experimentalFileWatcher: boolean;
private fileWatcherExclude: object;
private legacyStorage: boolean;
Expand Down Expand Up @@ -143,6 +144,11 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
this.legacyStorage = config.workbench.enableLegacyStorage;
changed = true;
}
// Windows: smooth scrolling workaround
if (isWindows && config.window && typeof config.window.smoothScrollingWorkaround === 'boolean' && config.window.smoothScrollingWorkaround !== this.windowsSmoothScrollingWorkaround) {
this.windowsSmoothScrollingWorkaround = config.window.smoothScrollingWorkaround;
changed = true;
}

// Notify only when changed and we are the focused window (avoids notification spam across windows)
if (notify && changed) {
Expand Down

0 comments on commit 1d0e429

Please sign in to comment.