[metacity] prefs: return FALSE if compositing_manager is not available



commit c2653fbc4899e126a5259329e82ebcb9a9fed6ba
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Jun 4 00:58:26 2015 +0300

    prefs: return FALSE if compositing_manager is not available
    
    Move warning message about missing extensions required for
    compositing from display.c to prefs. and display ths warning every
    time user tries to enable compositing manager.
    
    If required extension/extensions are missing return FALSE even
    compositing-manager is enabled in preferences.

 src/core/display.c |   12 ------------
 src/core/prefs.c   |   26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 4db019e..fdda919 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -251,18 +251,6 @@ enable_compositor (MetaDisplay *display,
 {
   GSList *list;
 
-  if (!META_DISPLAY_HAS_COMPOSITE (display) ||
-      !META_DISPLAY_HAS_DAMAGE (display) ||
-      !META_DISPLAY_HAS_XFIXES (display) ||
-      !META_DISPLAY_HAS_RENDER (display))
-    {
-      meta_warning (_("Missing %s extension required for compositing"),
-                    !META_DISPLAY_HAS_COMPOSITE (display) ? "composite" :
-                    !META_DISPLAY_HAS_DAMAGE (display) ? "damage" :
-                    !META_DISPLAY_HAS_XFIXES (display) ? "xfixes" : "render");
-      return;
-    }
-
   if (!display->compositor)
       display->compositor = meta_compositor_new (display);
 
diff --git a/src/core/prefs.c b/src/core/prefs.c
index bad0418..6278fdd 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -1839,6 +1839,32 @@ meta_prefs_get_window_binding (const char          *name,
 gboolean
 meta_prefs_get_compositing_manager (void)
 {
+  MetaDisplay *display;
+  static gboolean warned = FALSE;
+
+  display = meta_get_display ();
+
+  if (!compositing_manager)
+    warned = FALSE;
+
+  if (compositing_manager &&
+      (!META_DISPLAY_HAS_COMPOSITE (display) ||
+       !META_DISPLAY_HAS_DAMAGE (display) ||
+       !META_DISPLAY_HAS_XFIXES (display) ||
+       !META_DISPLAY_HAS_RENDER (display)))
+    {
+      if (!warned)
+        {
+          meta_warning (_("Missing %s extension required for compositing\n"),
+                        !META_DISPLAY_HAS_COMPOSITE (display) ? "composite" :
+                        !META_DISPLAY_HAS_DAMAGE (display) ? "damage" :
+                        !META_DISPLAY_HAS_XFIXES (display) ? "xfixes" : "render");
+          warned = TRUE;
+        }
+
+      return FALSE;
+    }
+
   return compositing_manager;
 }
 


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