Change:
A fresh install of Code - stable, insiders and code-oss - will spawn a floating window relative to the top of the screen, not to the work area. Code stores the window position, so moving the window makes it spawn in the new location next time. ! Issue Type: <bBug</bSteps to reproduce: Taskbar at top of screen Display resolution: 1366x768 Install fresh copy of Code. Run Code (with or without extensions disabled) VS Code version: Code 1.23.1+ OS version: Windows_NT x64 10.0. <!-- generated by issue reporter --
via

Discussion:
import * as nls from 'vs/nls'; import { URI } from 'vs/base/common/uri'; import { IStateService } from 'vs/platform/state/common/state'; <del> import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage } from 'electron'; </del> <ins> import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display } from 'electron'; </ins> import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment'; import { ILogService } from 'vs/platform/log/common/log'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';

// Single Monitor: be strict about x/y positioning if (displays.length === 1) { <del> const displayBounds = displays[0].bounds; // Careful with maximized: in that mode x/y can well be negative! if (state.mode !== WindowMode.Maximized && displayBounds.width > 0 && displayBounds.height > 0 /* Linux X11 sessions sometimes report wrong display bounds */) { if (state.x < displayBounds.x) { state.x = displayBounds.x; // prevent window from falling out of the screen to the left </del> <ins> const displayWorkingArea = this.getWorkingArea(displays[0]); if (state.mode !== WindowMode.Maximized && displayWorkingArea) { if (state.x < displayWorkingArea.x) { state.x = displayWorkingArea.x; // prevent window from falling out of the screen to the left </ins> } <del> if (state.y < displayBounds.y) { state.y = displayBounds.y; // prevent window from falling out of the screen to the top </del> <ins> if (state.y < displayWorkingArea.y) { state.y = displayWorkingArea.y; // prevent window from falling out of the screen to the top </ins> } <del> if (state.x > (displayBounds.x + displayBounds.width)) { state.x = displayBounds.x; // prevent window from falling out of the screen to the right </del> <ins> if (state.x > (displayWorkingArea.x + displayWorkingArea.width)) { state.x = displayWorkingArea.x; // prevent window from falling out of the screen to the right </ins> } <del> if (state.y > (displayBounds.y + displayBounds.height)) { state.y = displayBounds.y; // prevent window from falling out of the screen to the bottom </del> <ins> if (state.y > (displayWorkingArea.y + displayWorkingArea.height)) { state.y = displayWorkingArea.y; // prevent window from falling out of the screen to the bottom </ins> } <del> if (state.width > displayBounds.width) { state.width = displayBounds.width; // prevent window from exceeding display bounds width </del> <ins> if (state.width > displayWorkingArea.width) { state.width = displayWorkingArea.width; // prevent window from exceeding display bounds width </ins> } <del> if (state.height > displayBounds.height) { state.height = displayBounds.height; // prevent window from exceeding display bounds height </del> <ins> if (state.height > displayWorkingArea.height) { state.height = displayWorkingArea.height; // prevent window from exceeding display bounds height </ins> } }

// Multi Monitor (non-fullscreen): be less strict because metrics can be crazy const bounds = { x: state.x, y: state.y, width: state.width, height: state.height }; const display = screen.getDisplayMatching(bounds); <ins> const displayWorkingArea = this.getWorkingArea(display); </ins> if ( <del> display &&												// we have a display matching the desired bounds bounds.x < display.bounds.x + display.bounds.width &&	// prevent window from falling out of the screen to the right bounds.y < display.bounds.y + display.bounds.height &&	// prevent window from falling out of the screen to the bottom bounds.x + bounds.width > display.bounds.x &&			// prevent window from falling out of the screen to the left bounds.y + bounds.height > display.bounds.y				// prevent window from falling out of the scree nto the top </del> <ins> display &&														// we have a display matching the desired bounds displayWorkingArea &&											// we have valid working area bounds bounds.x < displayWorkingArea.x + displayWorkingArea.width &&	// prevent window from falling out of the screen to the right bounds.y < displayWorkingArea.y + displayWorkingArea.height &&	// prevent window from falling out of the screen to the bottom bounds.x + bounds.width > displayWorkingArea.x &&				// prevent window from falling out of the screen to the left bounds.y + bounds.height > displayWorkingArea.y					// prevent window from falling out of the scree nto the top </ins> ) { if (state.mode === WindowMode.Maximized) { const defaults = defaultWindowState(WindowMode.Maximized); // when maximized, make sure we have good values when the user restores the window

return null; } <ins> private getWorkingArea(display: Display): Rectangle | undefined { // Prefer the working area of the display to account for taskbars on the // desktop being positioned somewhere (https://github.com/Microsoft/vscode/issues/50830). // // Linux X11 sessions sometimes report wrong display bounds, so we validate // the reported sizes are positive. if (display.workArea.width > 0 && display.workArea.height > 0) { return display.workArea; } if (display.bounds.width > 0 && display.bounds.height > 0) { return display.bounds; } return undefined; } </ins> getBounds(): Electron.Rectangle { const pos = this._win.getPosition(); const dimension = this._win.getSize();