mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-29 11:52:34 +08:00
Fallback to getPrimaryDisplay() if getDisplayMatching() returns null
This commit is contained in:
parent
7159b127e2
commit
d0a91bea80
1 changed files with 3 additions and 3 deletions
|
@ -587,9 +587,9 @@ export default class AppEnvConstructor {
|
|||
center() {
|
||||
if (process.platform === 'linux') {
|
||||
let dimensions = this.getWindowDimensions();
|
||||
let bounds = remote.screen.getDisplayMatching(dimensions).bounds;
|
||||
let x = bounds.x + ((bounds.width - dimensions.width) / 2);
|
||||
let y = bounds.y + ((bounds.height - dimensions.height) / 2);
|
||||
let display = remote.screen.getDisplayMatching(dimensions) || remote.screen.getPrimaryDisplay();
|
||||
let x = display.bounds.x + ((display.bounds.width - dimensions.width) / 2);
|
||||
let y = display.bounds.y + ((display.bounds.height - dimensions.height) / 2);
|
||||
|
||||
return this.setPosition(x, y);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue