Browse Source
Merge pull request #3059 from AvaloniaUI/fix-3049
Fix on linux clients without a `Screen`.
pull/3060/head
Nikita Tsukanov
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
4 deletions
-
src/Avalonia.X11/X11Window.cs
|
|
|
@ -100,14 +100,17 @@ namespace Avalonia.X11 |
|
|
|
|
|
|
|
int defaultWidth = 300, defaultHeight = 200; |
|
|
|
|
|
|
|
if (!_popup) |
|
|
|
if (!_popup && Screen != null) |
|
|
|
{ |
|
|
|
var monitor = Screen.AllScreens.OrderBy(x => x.PixelDensity) |
|
|
|
.FirstOrDefault(m => m.Bounds.Contains(Position)); |
|
|
|
|
|
|
|
// Emulate Window 7+'s default window size behavior.
|
|
|
|
defaultWidth = (int)(monitor.WorkingArea.Width * 0.75d); |
|
|
|
defaultHeight = (int)(monitor.WorkingArea.Height * 0.7d); |
|
|
|
if (monitor != null) |
|
|
|
{ |
|
|
|
// Emulate Window 7+'s default window size behavior.
|
|
|
|
defaultWidth = (int)(monitor.WorkingArea.Width * 0.75d); |
|
|
|
defaultHeight = (int)(monitor.WorkingArea.Height * 0.7d); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
_handle = XCreateWindow(_x11.Display, _x11.RootWindow, 10, 10, defaultWidth, defaultHeight, 0, |
|
|
|
|