[Linux] Fixed GameWindow.ClientSize values.
authorthefiddler <stapostol@gmail.com>
Wed, 16 Jul 2014 09:34:01 +0000 (11:34 +0200)
committerthefiddler <stapostol@gmail.com>
Wed, 16 Jul 2014 12:28:28 +0000 (14:28 +0200)
Source/OpenTK/Platform/Linux/LinuxNativeWindow.cs

index eba4214..d0e32f7 100644 (file)
@@ -55,11 +55,23 @@ namespace OpenTK.Platform.Linux
             Debug.Print("[KMS] Creating window on display {0:x}", display);
 
             Title = title;
-            bounds = new Rectangle(0, 0, width, height);
-            client_size = bounds.Size;
+
+            display_device = display_device ?? DisplayDevice.Default;
+            if (display_device == null)
+            {
+                throw new NotSupportedException("[KMS] Driver does not currently support headless systems");
+            }
 
             window = new LinuxWindowInfo(display, fd, display_device.Id as LinuxDisplay);
 
+            // Note: we only support fullscreen windows on KMS.
+            // We implicitly override the requested width and height
+            // by the width and height of the DisplayDevice, if any.
+            width = display_device.Width;
+            height = display_device.Height;
+            bounds = new Rectangle(0, 0, width, height);
+            client_size = bounds.Size;
+
             if (!mode.Index.HasValue)
             {
                 mode = new EglGraphicsMode().SelectGraphicsMode(window, mode, 0);
@@ -74,15 +86,6 @@ namespace OpenTK.Platform.Linux
                 format = SurfaceFormat.XRGB8888;
             }
 
-            // Note: we only support fullscreen windows on KMS.
-            // We implicitly override the requested width and height
-            // by the width and height of the DisplayDevice, if any.
-            if (display_device != null)
-            {
-                width = display_device.Width;
-                height = display_device.Height;
-            }
-
             Debug.Print("[KMS] Creating GBM surface on {0:x} with {1}x{2} {3} [{4}]",
                 gbm, width, height, format, usage);
             IntPtr gbm_surface =  Gbm.CreateSurface(gbm,