Allow to start Ryujinx in wayland environment (#3516)

PrimaryMonitor is only available on X11

At some point it will be deprecated, this change support wayland
This commit is contained in:
Alberto Fanjul 2022-11-17 13:02:43 +01:00 committed by GitHub
parent 5d73a9f5fc
commit 55043c8afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,10 +148,10 @@ namespace Ryujinx.Ui
// Apply custom theme if needed.
ThemeHelper.ApplyTheme();
Gdk.Monitor monitor = Display.GetMonitor(0);
// Sets overridden fields.
int monitorWidth = Display.PrimaryMonitor.Geometry.Width * Display.PrimaryMonitor.ScaleFactor;
int monitorHeight = Display.PrimaryMonitor.Geometry.Height * Display.PrimaryMonitor.ScaleFactor;
int monitorWidth = monitor.Geometry.Width * monitor.ScaleFactor;
int monitorHeight = monitor.Geometry.Height * monitor.ScaleFactor;
DefaultWidth = monitorWidth < 1280 ? monitorWidth : 1280;
DefaultHeight = monitorHeight < 760 ? monitorHeight : 760;