Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions shell/browser/native_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,22 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
}

if (int x, y; options.Get(options::kX, &x) && options.Get(options::kY, &y)) {
SetPosition(gfx::Point{x, y});
// BrightSign: Use SetBounds with the full rect (including width/height
// from options) instead of just SetPosition. CenterWindow in the
// NativeWindowViews constructor clamps the window size to the primary
// display's work area, which breaks windows spanning multiple displays
// (e.g. dual HDMI at 3840x1080). SetPosition only restores the origin
// and preserves the clamped size, so we must restore the full bounds.
const int w = options.ValueOrDefault(options::kWidth, GetSize().width());
const int h = options.ValueOrDefault(options::kHeight, GetSize().height());
SetBounds(gfx::Rect(x, y, w, h), false);

#if BUILDFLAG(IS_WIN)
// FIXME(felixrieseberg): Dirty, dirty workaround for
// https://github.com/electron/electron/issues/10862
// Somehow, we need to call `SetBounds` twice to get
// usable results. The root cause is still unknown.
SetPosition(gfx::Point{x, y});
SetBounds(gfx::Rect(x, y, w, h), false);
#endif
} else if (bool center; options.Get(options::kCenter, &center) && center) {
Center();
Expand Down
Loading