[metacity] compositor: don't check common extensions in base class



commit 0ef46da1b9e9bea5c80b29a1819b04a64886e6ed
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Aug 22 15:59:56 2019 +0300

    compositor: don't check common extensions in base class

 src/compositor/meta-compositor-private.h | 17 ++++---
 src/compositor/meta-compositor-vulkan.c  |  3 ++
 src/compositor/meta-compositor-xrender.c |  3 ++
 src/compositor/meta-compositor.c         | 76 +++++++++++++++-----------------
 4 files changed, 51 insertions(+), 48 deletions(-)
---
diff --git a/src/compositor/meta-compositor-private.h b/src/compositor/meta-compositor-private.h
index 62e4cb89..c6dea493 100644
--- a/src/compositor/meta-compositor-private.h
+++ b/src/compositor/meta-compositor-private.h
@@ -81,17 +81,20 @@ struct _MetaCompositorClass
   void              (* redraw)                       (MetaCompositor     *compositor);
 };
 
-gboolean     meta_compositor_set_selection      (MetaCompositor  *compositor,
-                                                 GError         **error);
+gboolean     meta_compositor_check_common_extensions (MetaCompositor  *compositor,
+                                                      GError         **error);
 
-Window       meta_compositor_get_overlay_window (MetaCompositor  *compositor);
+gboolean     meta_compositor_set_selection           (MetaCompositor  *compositor,
+                                                      GError         **error);
 
-gboolean     meta_compositor_redirect_windows   (MetaCompositor  *compositor,
-                                                 GError         **error);
+Window       meta_compositor_get_overlay_window      (MetaCompositor  *compositor);
 
-MetaDisplay *meta_compositor_get_display        (MetaCompositor  *compositor);
+gboolean     meta_compositor_redirect_windows        (MetaCompositor  *compositor,
+                                                      GError         **error);
 
-void         meta_compositor_queue_redraw       (MetaCompositor  *compositor);
+MetaDisplay *meta_compositor_get_display             (MetaCompositor  *compositor);
+
+void         meta_compositor_queue_redraw            (MetaCompositor  *compositor);
 
 G_END_DECLS
 
diff --git a/src/compositor/meta-compositor-vulkan.c b/src/compositor/meta-compositor-vulkan.c
index 9a507f0d..62fd840c 100644
--- a/src/compositor/meta-compositor-vulkan.c
+++ b/src/compositor/meta-compositor-vulkan.c
@@ -1216,6 +1216,9 @@ meta_compositor_vulkan_manage (MetaCompositor  *compositor,
 
   vulkan = META_COMPOSITOR_VULKAN (compositor);
 
+  if (!meta_compositor_check_common_extensions (compositor, error))
+    return FALSE;
+
   enumerate_instance_layers (vulkan);
   enumerate_instance_extensions (vulkan);
 
diff --git a/src/compositor/meta-compositor-xrender.c b/src/compositor/meta-compositor-xrender.c
index 85ecf8de..542d5d52 100644
--- a/src/compositor/meta-compositor-xrender.c
+++ b/src/compositor/meta-compositor-xrender.c
@@ -2367,6 +2367,9 @@ meta_compositor_xrender_manage (MetaCompositor  *compositor,
   XRenderPictFormat *visual_format;
   int screen_number = meta_screen_get_screen_number (screen);
 
+  if (!meta_compositor_check_common_extensions (compositor, error))
+    return FALSE;
+
   if (!display->have_render)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
diff --git a/src/compositor/meta-compositor.c b/src/compositor/meta-compositor.c
index 7a2f23fd..a83c3ae7 100644
--- a/src/compositor/meta-compositor.c
+++ b/src/compositor/meta-compositor.c
@@ -82,41 +82,6 @@ redraw_idle_cb (gpointer user_data)
   return G_SOURCE_REMOVE;
 }
 
-static gboolean
-check_common_extensions (MetaCompositor  *compositor,
-                         GError         **error)
-{
-  MetaCompositorPrivate *priv;
-
-  priv = meta_compositor_get_instance_private (compositor);
-
-  if (!priv->display->have_composite)
-    {
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   "Missing composite extension required for compositing");
-
-      return FALSE;
-    }
-
-  if (!priv->display->have_damage)
-    {
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   "Missing damage extension required for compositing");
-
-      return FALSE;
-    }
-
-  if (!priv->display->have_xfixes)
-    {
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   "Missing xfixes extension required for compositing");
-
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
 static gboolean
 meta_compositor_initable_init (GInitable     *initable,
                                GCancellable  *cancellable,
@@ -128,12 +93,6 @@ meta_compositor_initable_init (GInitable     *initable,
   compositor = META_COMPOSITOR (initable);
   compositor_class = META_COMPOSITOR_GET_CLASS (compositor);
 
-  if (!META_IS_COMPOSITOR_NONE (compositor))
-    {
-      if (!check_common_extensions (compositor, error))
-        return FALSE;
-    }
-
   return compositor_class->manage (compositor, error);
 }
 
@@ -507,6 +466,41 @@ meta_compositor_is_composited (MetaCompositor *compositor)
   return !META_IS_COMPOSITOR_NONE (compositor);
 }
 
+gboolean
+meta_compositor_check_common_extensions (MetaCompositor  *compositor,
+                                         GError         **error)
+{
+  MetaCompositorPrivate *priv;
+
+  priv = meta_compositor_get_instance_private (compositor);
+
+  if (!priv->display->have_composite)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Missing composite extension required for compositing");
+
+      return FALSE;
+    }
+
+  if (!priv->display->have_damage)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Missing damage extension required for compositing");
+
+      return FALSE;
+    }
+
+  if (!priv->display->have_xfixes)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Missing xfixes extension required for compositing");
+
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
 gboolean
 meta_compositor_set_selection (MetaCompositor  *compositor,
                                GError         **error)


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