[metacity] compositor: merge initable_init and manage vfuncs
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] compositor: merge initable_init and manage vfuncs
- Date: Sat, 4 Mar 2017 16:48:45 +0000 (UTC)
commit 230b364759da86638cc2c377313001d5050e4da3
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Mar 4 00:32:56 2017 +0200
compositor: merge initable_init and manage vfuncs
src/compositor/meta-compositor-none.c | 10 +------
src/compositor/meta-compositor-private.h | 4 +--
src/compositor/meta-compositor-xrender.c | 41 ++++++++++++++++--------------
src/compositor/meta-compositor.c | 4 +--
4 files changed, 26 insertions(+), 33 deletions(-)
---
diff --git a/src/compositor/meta-compositor-none.c b/src/compositor/meta-compositor-none.c
index f633790..7fecf46 100644
--- a/src/compositor/meta-compositor-none.c
+++ b/src/compositor/meta-compositor-none.c
@@ -27,18 +27,13 @@ struct _MetaCompositorNone
G_DEFINE_TYPE (MetaCompositorNone, meta_compositor_none, META_TYPE_COMPOSITOR)
static gboolean
-meta_compositor_none_initable_init (MetaCompositor *compositor,
- GError **error)
+meta_compositor_none_manage (MetaCompositor *compositor,
+ GError **error)
{
return TRUE;
}
static void
-meta_compositor_none_manage (MetaCompositor *compositor)
-{
-}
-
-static void
meta_compositor_none_unmanage (MetaCompositor *compositor)
{
}
@@ -146,7 +141,6 @@ meta_compositor_none_class_init (MetaCompositorNoneClass *none_class)
compositor_class = META_COMPOSITOR_CLASS (none_class);
- compositor_class->initable_init = meta_compositor_none_initable_init;
compositor_class->manage = meta_compositor_none_manage;
compositor_class->unmanage = meta_compositor_none_unmanage;
compositor_class->add_window = meta_compositor_none_add_window;
diff --git a/src/compositor/meta-compositor-private.h b/src/compositor/meta-compositor-private.h
index bfaeb10..76aa9fe 100644
--- a/src/compositor/meta-compositor-private.h
+++ b/src/compositor/meta-compositor-private.h
@@ -27,11 +27,9 @@ struct _MetaCompositorClass
{
GObjectClass parent_class;
- gboolean (* initable_init) (MetaCompositor *compositor,
+ gboolean (* manage) (MetaCompositor *compositor,
GError **error);
- void (* manage) (MetaCompositor *compositor);
-
void (* unmanage) (MetaCompositor *compositor);
void (* add_window) (MetaCompositor *compositor,
diff --git a/src/compositor/meta-compositor-xrender.c b/src/compositor/meta-compositor-xrender.c
index 82f8fad..f4dcf07 100644
--- a/src/compositor/meta-compositor-xrender.c
+++ b/src/compositor/meta-compositor-xrender.c
@@ -3007,16 +3007,8 @@ get_output_window (MetaScreen *screen)
}
static gboolean
-meta_compositor_xrender_initable_init (MetaCompositor *compositor,
- GError **error)
-{
- g_timeout_add (2000, (GSourceFunc) timeout_debug, compositor);
-
- return TRUE;
-}
-
-static void
-meta_compositor_xrender_manage (MetaCompositor *compositor)
+meta_compositor_xrender_manage (MetaCompositor *compositor,
+ GError **error)
{
MetaCompScreen *info;
MetaCompositorXRender *xrender = META_COMPOSITOR_XRENDER (compositor);
@@ -3030,7 +3022,7 @@ meta_compositor_xrender_manage (MetaCompositor *compositor)
/* Check if the screen is already managed */
if (xrender->info != NULL)
- return;
+ return TRUE;
gdk_error_trap_push ();
XCompositeRedirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
@@ -3038,9 +3030,11 @@ meta_compositor_xrender_manage (MetaCompositor *compositor)
if (gdk_error_trap_pop ())
{
- g_warning ("Another compositing manager is running on screen %i",
- screen_number);
- return;
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Another compositing manager is running on screen %i",
+ screen_number);
+
+ return FALSE;
}
info = g_new0 (MetaCompScreen, 1);
@@ -3052,8 +3046,11 @@ meta_compositor_xrender_manage (MetaCompositor *compositor)
screen_number));
if (!visual_format)
{
- g_warning ("Cannot find visual format on screen %i", screen_number);
- return;
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Cannot find visual format on screen %i",
+ screen_number);
+
+ return FALSE;
}
info->output = get_output_window (screen);
@@ -3064,8 +3061,11 @@ meta_compositor_xrender_manage (MetaCompositor *compositor)
CPSubwindowMode, &pa);
if (info->root_picture == None)
{
- g_warning ("Cannot create root picture on screen %i", screen_number);
- return;
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Cannot create root picture on screen %i",
+ screen_number);
+
+ return FALSE;
}
info->root_buffer = None;
@@ -3098,6 +3098,10 @@ meta_compositor_xrender_manage (MetaCompositor *compositor)
show_overlay_window (xrender, screen, info->output);
meta_prefs_add_listener (update_shadows, xrender);
+
+ g_timeout_add (2000, (GSourceFunc) timeout_debug, compositor);
+
+ return TRUE;
}
static void
@@ -3643,7 +3647,6 @@ meta_compositor_xrender_class_init (MetaCompositorXRenderClass *xrender_class)
compositor_class = META_COMPOSITOR_CLASS (xrender_class);
- compositor_class->initable_init = meta_compositor_xrender_initable_init;
compositor_class->manage = meta_compositor_xrender_manage;
compositor_class->unmanage = meta_compositor_xrender_unmanage;
compositor_class->add_window = meta_compositor_xrender_add_window;
diff --git a/src/compositor/meta-compositor.c b/src/compositor/meta-compositor.c
index 532026e..88c1caf 100644
--- a/src/compositor/meta-compositor.c
+++ b/src/compositor/meta-compositor.c
@@ -55,7 +55,7 @@ meta_compositor_initable_init (GInitable *initable,
compositor = META_COMPOSITOR (initable);
compositor_class = META_COMPOSITOR_GET_CLASS (compositor);
- return compositor_class->initable_init (compositor, error);
+ return compositor_class->manage (compositor, error);
}
static void
@@ -192,8 +192,6 @@ meta_compositor_new (MetaCompositorType type,
g_assert (compositor != NULL);
- META_COMPOSITOR_GET_CLASS (compositor)->manage (compositor);
-
return compositor;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]