[mutter] display: Move composite version checks here



commit e935b52e51d4c200554a6ac046e1a6643c1de1bc
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Aug 13 19:32:39 2014 -0400

    display: Move composite version checks here

 src/compositor/compositor.c |   16 ----------------
 src/core/display.c          |   19 +++++++------------
 src/meta/display.h          |    3 ---
 3 files changed, 7 insertions(+), 31 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 494f581..887be9e 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -91,18 +91,6 @@ is_modal (MetaDisplay *display)
   return display->grab_op == META_GRAB_OP_COMPOSITOR;
 }
 
-static inline gboolean
-composite_at_least_version (MetaDisplay *display, int maj, int min)
-{
-  static int major = -1;
-  static int minor = -1;
-
-  if (major == -1)
-    meta_display_get_compositor_version (display, &major, &minor);
-
-  return (major > maj || (major == maj && minor >= min));
-}
-
 static void sync_actor_stacking (MetaCompositor *compositor);
 
 static void
@@ -1197,11 +1185,7 @@ meta_compositor_new (MetaDisplay *display)
 {
   MetaCompositor        *compositor;
 
-  if (!composite_at_least_version (display, 0, 3))
-    return NULL;
-
   compositor = g_new0 (MetaCompositor, 1);
-
   compositor->display = display;
 
   if (g_getenv("META_DISABLE_MIPMAPS"))
diff --git a/src/core/display.c b/src/core/display.c
index 58ac047..b6bfad2 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -415,11 +415,15 @@ enable_compositor (MetaDisplay *display)
       return;
     }
 
-  if (!display->compositor)
-      display->compositor = meta_compositor_new (display);
+  int version = (display->composite_major_version * 10) + display->composite_minor_version;
+  if (version < 3)
+    {
+      meta_warning ("Your version of COMPOSITE is too old.");
+      return;
+    }
 
   if (!display->compositor)
-    return;
+      display->compositor = meta_compositor_new (display);
 
   meta_compositor_manage (display->compositor);
 }
@@ -3095,15 +3099,6 @@ meta_display_modifiers_accelerator_activate (MetaDisplay *display)
   return freeze;
 }
 
-void
-meta_display_get_compositor_version (MetaDisplay *display,
-                                     int         *major,
-                                     int         *minor)
-{
-  *major = display->composite_major_version;
-  *minor = display->composite_minor_version;
-}
-
 /**
  * meta_display_get_xinput_opcode: (skip)
  * @display: a #MetaDisplay
diff --git a/src/meta/display.h b/src/meta/display.h
index 8b12899..3845170 100644
--- a/src/meta/display.h
+++ b/src/meta/display.h
@@ -66,9 +66,6 @@ GType meta_display_get_type (void) G_GNUC_CONST;
 
 #define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
 
-void meta_display_get_compositor_version (MetaDisplay *display,
-                                          int         *major,
-                                          int         *minor);
 int meta_display_get_xinput_opcode (MetaDisplay *display);
 gboolean meta_display_supports_extended_barriers (MetaDisplay *display);
 Display *meta_display_get_xdisplay (MetaDisplay *display);


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