macOS: Add a setting to enable acceptsFirstMouse for window (fixes #24634)
This commit is contained in:
parent
d41edee835
commit
df381b6d1e
|
@ -151,8 +151,16 @@ export class CodeWindow implements ICodeWindow {
|
|||
|
||||
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
|
||||
|
||||
if (isMacintosh) {
|
||||
options.acceptFirstMouse = true; // enabled by default
|
||||
|
||||
if (windowConfig && windowConfig.clickThroughInactive === false) {
|
||||
options.acceptFirstMouse = false;
|
||||
}
|
||||
}
|
||||
|
||||
let useNativeTabs = false;
|
||||
if (windowConfig && windowConfig.nativeTabs) {
|
||||
if (isMacintosh && windowConfig && windowConfig.nativeTabs === true) {
|
||||
options.tabbingIdentifier = product.nameShort; // this opts in to sierra tabs
|
||||
useNativeTabs = true;
|
||||
}
|
||||
|
|
|
@ -226,6 +226,7 @@ export interface IWindowSettings {
|
|||
enableMenuBarMnemonics: boolean;
|
||||
closeWhenEmpty: boolean;
|
||||
smoothScrollingWorkaround: boolean;
|
||||
clickThroughInactive: boolean;
|
||||
}
|
||||
|
||||
export enum OpenContext {
|
||||
|
|
|
@ -412,6 +412,12 @@ configurationRegistry.registerConfiguration({
|
|||
'default': false,
|
||||
'description': 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."),
|
||||
'included': isWindows
|
||||
},
|
||||
'window.clickThroughInactive': {
|
||||
'type': 'boolean',
|
||||
'default': true,
|
||||
'description': nls.localize('window.clickThroughInactive', "If enabled, clicking on an inactive window will both activate the window and execute the element under the mouse. If disabled, clicking anywhere on an inactive window will activate it only, without executing the element under the mouse."),
|
||||
'included': isMacintosh
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -424,6 +424,7 @@ export class Workbench implements IPartService {
|
|||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleDevToolsAction, ToggleDevToolsAction.ID, ToggleDevToolsAction.LABEL, isDeveloping ? { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_I } } : void 0), 'Developer: Toggle Developer Tools', localize('developer', "Developer"));
|
||||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenRecentAction, OpenRecentAction.ID, OpenRecentAction.LABEL, { primary: isDeveloping ? null : KeyMod.CtrlCmd | KeyCode.KEY_R, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_R } }), 'File: Open Recent...', localize('file', "File"));
|
||||
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ReloadWindowWithExtensionsDisabledAction, ReloadWindowWithExtensionsDisabledAction.ID, ReloadWindowWithExtensionsDisabledAction.LABEL), 'Reload Window Without Extensions');
|
||||
|
||||
// Actions for macOS native tabs management (only when enabled)
|
||||
const windowConfig = this.configurationService.getValue<IWindowConfiguration>();
|
||||
if (windowConfig && windowConfig.window && windowConfig.window.nativeTabs) {
|
||||
|
|
|
@ -17,7 +17,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 } 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';
|
||||
|
||||
|
@ -34,6 +34,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
|
|||
|
||||
private titleBarStyle: 'native' | 'custom';
|
||||
private nativeTabs: boolean;
|
||||
private clickThroughInactive: boolean;
|
||||
private updateChannel: string;
|
||||
private enableCrashReporter: boolean;
|
||||
private touchbarEnabled: boolean;
|
||||
|
@ -72,18 +73,24 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
|
|||
private onConfigurationChange(config: IConfiguration, notify: boolean): void {
|
||||
let changed = false;
|
||||
|
||||
// Titlebar style
|
||||
if (config.window && config.window.titleBarStyle !== this.titleBarStyle && (config.window.titleBarStyle === 'native' || config.window.titleBarStyle === 'custom')) {
|
||||
// macOS: Titlebar style
|
||||
if (isMacintosh && config.window && config.window.titleBarStyle !== this.titleBarStyle && (config.window.titleBarStyle === 'native' || config.window.titleBarStyle === 'custom')) {
|
||||
this.titleBarStyle = config.window.titleBarStyle;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Native tabs
|
||||
if (config.window && typeof config.window.nativeTabs === 'boolean' && config.window.nativeTabs !== this.nativeTabs) {
|
||||
// macOS: Native tabs
|
||||
if (isMacintosh && config.window && typeof config.window.nativeTabs === 'boolean' && config.window.nativeTabs !== this.nativeTabs) {
|
||||
this.nativeTabs = config.window.nativeTabs;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// macOS: Click through (accept first mouse)
|
||||
if (isMacintosh && config.window && typeof config.window.clickThroughInactive === 'boolean' && config.window.clickThroughInactive !== this.clickThroughInactive) {
|
||||
this.clickThroughInactive = config.window.clickThroughInactive;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Update channel
|
||||
if (config.update && typeof config.update.channel === 'string' && config.update.channel !== this.updateChannel) {
|
||||
this.updateChannel = config.update.channel;
|
||||
|
@ -96,8 +103,8 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
|
|||
changed = true;
|
||||
}
|
||||
|
||||
// Touchbar config
|
||||
if (config.keyboard && config.keyboard.touchbar && typeof config.keyboard.touchbar.enabled === 'boolean' && config.keyboard.touchbar.enabled !== this.touchbarEnabled) {
|
||||
// macOS: Touchbar config
|
||||
if (isMacintosh && config.keyboard && config.keyboard.touchbar && typeof config.keyboard.touchbar.enabled === 'boolean' && config.keyboard.touchbar.enabled !== this.touchbarEnabled) {
|
||||
this.touchbarEnabled = config.keyboard.touchbar.enabled;
|
||||
changed = true;
|
||||
}
|
||||
|
@ -109,7 +116,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
|
|||
}
|
||||
|
||||
// Windows: smooth scrolling workaround
|
||||
if (config.window && typeof config.window.smoothScrollingWorkaround === 'boolean' && config.window.smoothScrollingWorkaround !== this.windowsSmoothScrollingWorkaround) {
|
||||
if (isWindows && config.window && typeof config.window.smoothScrollingWorkaround === 'boolean' && config.window.smoothScrollingWorkaround !== this.windowsSmoothScrollingWorkaround) {
|
||||
this.windowsSmoothScrollingWorkaround = config.window.smoothScrollingWorkaround;
|
||||
changed = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue