|
|
@@ -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,
|