@@ -31,8 +31,7 @@ import product from 'vs/platform/node/product';
3131import { OpenContext } from 'vs/code/common/windows' ;
3232import { ITelemetryService , ITelemetryData } from 'vs/platform/telemetry/common/telemetry' ;
3333import { isParent , isEqual , isEqualOrParent } from 'vs/platform/files/common/files' ;
34- import * as nativeKeymap from 'native-keymap' ;
35- import { IDisposable } from 'vs/base/common/lifecycle' ;
34+ import { KeyboardLayoutMonitor } from "vs/code/node/keyboard" ;
3635
3736enum WindowError {
3837 UNRESPONSIVE ,
@@ -107,7 +106,6 @@ export interface IWindowsMainService {
107106 openFileFolderPicker ( forceNewWindow ?: boolean , data ?: ITelemetryData ) : void ;
108107 openFilePicker ( forceNewWindow ?: boolean , path ?: string , window ?: VSCodeWindow , data ?: ITelemetryData ) : void ;
109108 openFolderPicker ( forceNewWindow ?: boolean , window ?: VSCodeWindow , data ?: ITelemetryData ) : void ;
110- openAccessibilityOptions ( ) : void ;
111109 focusLastActive ( cli : ParsedArgs , context : OpenContext ) : VSCodeWindow ;
112110 getLastActiveWindow ( ) : VSCodeWindow ;
113111 findWindow ( workspacePath : string , filePath ?: string , extensionDevelopmentPath ?: string ) : VSCodeWindow ;
@@ -343,6 +341,7 @@ export class WindowsManager implements IWindowsMainService {
343341 }
344342
345343 private onBroadcast ( event : string , payload : any ) : void {
344+
346345 // Theme changes
347346 if ( event === 'vscode:changeColorTheme' && typeof payload === 'string' ) {
348347
@@ -737,8 +736,6 @@ export class WindowsManager implements IWindowsMainService {
737736 configuration . filesToCreate = filesToCreate ;
738737 configuration . filesToDiff = filesToDiff ;
739738 configuration . nodeCachedDataDir = this . environmentService . nodeCachedDataDir ;
740- configuration . isISOKeyboard = KeyboardLayoutMonitor . INSTANCE . isISOKeyboard ( ) ;
741- configuration . accessibilitySupportEnabled = app . isAccessibilitySupportEnabled ( ) ;
742739
743740 return configuration ;
744741 }
@@ -1028,22 +1025,6 @@ export class WindowsManager implements IWindowsMainService {
10281025 this . doPickAndOpen ( { pickFolders : true , forceNewWindow, window } , 'openFolder' , data ) ;
10291026 }
10301027
1031- public openAccessibilityOptions ( ) : void {
1032- let win = new BrowserWindow ( {
1033- alwaysOnTop : true ,
1034- skipTaskbar : true ,
1035- resizable : false ,
1036- width : 450 ,
1037- height : 300 ,
1038- show : true ,
1039- title : nls . localize ( 'accessibilityOptionsWindowTitle' , "Accessibility Options" )
1040- } ) ;
1041-
1042- win . setMenuBarVisibility ( false ) ;
1043-
1044- win . loadURL ( 'chrome://accessibility' ) ;
1045- }
1046-
10471028 private doPickAndOpen ( options : INativeOpenDialogOptions , eventName : string , data ?: ITelemetryData ) : void {
10481029 this . getFileOrFolderPaths ( options , ( paths : string [ ] ) => {
10491030 const nOfPaths = paths ? paths . length : 0 ;
@@ -1338,63 +1319,4 @@ export class WindowsManager implements IWindowsMainService {
13381319 } , 10 /* delay to unwind callback stack (IPC) */ ) ;
13391320 }
13401321 }
1341- }
1342-
1343- class KeyboardLayoutMonitor {
1344-
1345- public static INSTANCE = new KeyboardLayoutMonitor ( ) ;
1346-
1347- private _emitter : Emitter < boolean > ;
1348- private _registered : boolean ;
1349- private _isISOKeyboard : boolean ;
1350-
1351- private constructor ( ) {
1352- this . _emitter = new Emitter < boolean > ( ) ;
1353- this . _registered = false ;
1354- this . _isISOKeyboard = this . _readIsISOKeyboard ( ) ;
1355- }
1356-
1357- public onDidChangeKeyboardLayout ( callback : ( isISOKeyboard : boolean ) => void ) : IDisposable {
1358- if ( ! this . _registered ) {
1359- this . _registered = true ;
1360-
1361- nativeKeymap . onDidChangeKeyboardLayout ( ( ) => {
1362- this . _emitter . fire ( this . _isISOKeyboard ) ;
1363- } ) ;
1364-
1365- if ( platform . isMacintosh ) {
1366- // See https://github.com/Microsoft/vscode/issues/24153
1367- // On OSX, on ISO keyboards, Chromium swaps the scan codes
1368- // of IntlBackslash and Backquote.
1369- //
1370- // The C++ methods can give the current keyboard type (ISO or not)
1371- // only after a NSEvent was handled.
1372- //
1373- // We therefore poll.
1374- setInterval ( ( ) => {
1375- let newValue = this . _readIsISOKeyboard ( ) ;
1376- if ( this . _isISOKeyboard === newValue ) {
1377- // no change
1378- return ;
1379- }
1380-
1381- this . _isISOKeyboard = newValue ;
1382- this . _emitter . fire ( this . _isISOKeyboard ) ;
1383-
1384- } , 3000 ) ;
1385- }
1386- }
1387- return this . _emitter . event ( callback ) ;
1388- }
1389-
1390- private _readIsISOKeyboard ( ) : boolean {
1391- if ( platform . isMacintosh ) {
1392- return nativeKeymap . isISOKeyboard ( ) ;
1393- }
1394- return false ;
1395- }
1396-
1397- public isISOKeyboard ( ) : boolean {
1398- return this . _isISOKeyboard ;
1399- }
1400- }
1322+ }
0 commit comments