From 92b17fc228932b52864a14c5e7220d4a55dfe0b2 Mon Sep 17 00:00:00 2001
From: Xpl0itR <xpl0itr@outlook.com>
Date: Mon, 30 Mar 2020 23:10:13 +0100
Subject: [PATCH] Set default width and height based on monitor resolution
 (#1046)

---
 Ryujinx/Ui/MainWindow.cs    | 6 ++++++
 Ryujinx/Ui/MainWindow.glade | 3 ---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs
index 094f6ff5c9..2415280b69 100644
--- a/Ryujinx/Ui/MainWindow.cs
+++ b/Ryujinx/Ui/MainWindow.cs
@@ -91,6 +91,12 @@ namespace Ryujinx.Ui
         {
             builder.Autoconnect(this);
 
+            int monitorWidth  = Display.PrimaryMonitor.Geometry.Width  * Display.PrimaryMonitor.ScaleFactor;
+            int monitorHeight = Display.PrimaryMonitor.Geometry.Height * Display.PrimaryMonitor.ScaleFactor;
+
+            this.DefaultWidth  = monitorWidth < 1280 ? monitorWidth : 1280;
+            this.DefaultHeight = monitorHeight < 760 ? monitorHeight : 760;
+
             this.DeleteEvent      += Window_Close;
             _fullScreen.Activated += FullScreen_Toggled;
 
diff --git a/Ryujinx/Ui/MainWindow.glade b/Ryujinx/Ui/MainWindow.glade
index 931cd2a59f..95beefb24f 100644
--- a/Ryujinx/Ui/MainWindow.glade
+++ b/Ryujinx/Ui/MainWindow.glade
@@ -6,8 +6,6 @@
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Ryujinx</property>
     <property name="window_position">center</property>
-    <property name="default_width">1280</property>
-    <property name="default_height">760</property>
     <child type="titlebar">
       <placeholder/>
     </child>
@@ -399,7 +397,6 @@
             </child>
             <child>
               <object class="GtkBox" id="_footerBox">
-                <property name="width_request">1280</property>
                 <property name="height_request">19</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>