[gnome-chess] Disallow 3D mode when running outside of X11



commit e71e650adb2b47bf64eddf5caae736adc77282af
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Feb 16 23:17:38 2014 -0600

    Disallow 3D mode when running outside of X11
    
    3D mode is currently X-specific. Making it work in Wayland and Mir will
    be future work.

 src/gnome-chess.vala |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index e1232cb..b852f35 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -368,7 +368,8 @@ public class Application : Gtk.Application
                 view_container.remove (view);
                 view.destroy ();
             }
-            if (settings.get_boolean ("show-3d"))
+            // TODO make 3D mode work in Wayland and Mir
+            if (settings.get_boolean ("show-3d") && is_running_in_x11 ())
                 view = new ChessView3D ();
             else
                 view = new ChessView2D ();
@@ -1583,6 +1584,14 @@ public class Application : Gtk.Application
             difficulty_combo.sensitive = false;
         }
 
+        if (!is_running_in_x11 ())
+        {
+            // FIXME leaves ugly blank space
+            // TODO make 3D mode work in Wayland and Mir
+            show_3d_check.hide ();
+            show_3d_smooth_check.hide ();
+        }
+
         preferences_dialog.present ();
     }
 
@@ -2127,6 +2136,14 @@ public class Application : Gtk.Application
         start_game ();
     }
 
+    private bool is_running_in_x11 ()
+    {
+        // FIXME surely there's a better way to test this
+        // TODO make 3D mode work in Wayland and Mir
+        var temp_view = new ChessView2D ();
+        return (temp_view.get_window () as Gdk.X11.Window) != null;
+    }
+
     private void enable_window_action (string name)
     {
         ((SimpleAction) window.lookup_action (name)).set_enabled (true);


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