[longomatch] Fix initial resize of the main window in multi monitor configuration



commit 30ac1af11fb92eeccec7c7d40cb768469f0fc9d2
Author: Julien Moutte <julien fluendo com>
Date:   Thu Sep 11 09:32:11 2014 -0700

    Fix initial resize of the main window in multi monitor configuration

 LongoMatch.GUI/Gui/MainWindow.cs |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/MainWindow.cs b/LongoMatch.GUI/Gui/MainWindow.cs
index bcb8bd3..f28bfdb 100644
--- a/LongoMatch.GUI/Gui/MainWindow.cs
+++ b/LongoMatch.GUI/Gui/MainWindow.cs
@@ -56,8 +56,6 @@ namespace LongoMatch.Gui
                public MainWindow(IGUIToolkit guiToolkit) :
                base(Constants.SOFTWARE_NAME)
                {
-                       Screen screen;
-                       
                        this.Build();
                        this.guiToolKit = guiToolkit;
                        
@@ -67,9 +65,15 @@ namespace LongoMatch.Gui
                        
                        ConnectSignals();
                        ConnectMenuSignals();
-                       
-                       screen = Display.Default.DefaultScreen;
-                       this.Resize(screen.Width * 80 / 100, screen.Height * 80 / 100);
+
+                       // Default screen
+                       Screen screen = Display.Default.DefaultScreen;
+                       // Which monitor is our window on
+                       int monitor = screen.GetMonitorAtWindow (this.GdkWindow);
+                       // Monitor size
+                       Rectangle monitor_geometry = screen.GetMonitorGeometry (monitor);
+                       // Resize to a convenient size
+                       this.Resize(monitor_geometry.Width * 80 / 100, monitor_geometry.Height * 80 / 100);
                }
 
                #endregion


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]