[mutter/wayland] meta-weston-launch: Don't use a GObject here
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] meta-weston-launch: Don't use a GObject here
- Date: Wed, 1 Jan 2014 01:06:49 +0000 (UTC)
commit 1d3dbea20ce363d7b3e4bf4671c35268d948ff51
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Dec 31 18:03:31 2013 -0500
meta-weston-launch: Don't use a GObject here
We don't need a complicated API anymore.
src/wayland/meta-wayland.c | 2 +-
src/wayland/meta-weston-launch.c | 86 +++++++------------------------------
src/wayland/meta-weston-launch.h | 13 +-----
3 files changed, 20 insertions(+), 81 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 20d0dcd..74e709a 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -751,7 +751,7 @@ meta_wayland_finalize (void)
compositor = meta_wayland_compositor_get_default ();
meta_xwayland_stop (compositor);
- g_clear_object (&compositor->launcher);
+ meta_launcher_free (compositor->launcher);
}
gboolean
diff --git a/src/wayland/meta-weston-launch.c b/src/wayland/meta-weston-launch.c
index 184a48d..c86185a 100644
--- a/src/wayland/meta-weston-launch.c
+++ b/src/wayland/meta-weston-launch.c
@@ -43,18 +43,8 @@
#include "meta-weston-launch.h"
-struct _MetaLauncherClass
-{
- GObjectClass parent_class;
-
- void (*enter) (MetaLauncher *);
- void (*leave) (MetaLauncher *);
-};
-
struct _MetaLauncher
{
- GObject parent;
-
GSocket *weston_launch;
gboolean vt_switched;
@@ -66,16 +56,6 @@ struct _MetaLauncher
GSource *outer_source;
};
-enum {
- SIGNAL_ENTER,
- SIGNAL_LEAVE,
- SIGNAL_LAST
-};
-
-static int signals[SIGNAL_LAST];
-
-G_DEFINE_TYPE (MetaLauncher, meta_launcher, G_TYPE_OBJECT);
-
static void handle_request_vt_switch (MetaLauncher *self);
static gboolean
@@ -240,22 +220,6 @@ meta_launcher_open_input_device (MetaLauncher *self,
}
static void
-meta_launcher_finalize (GObject *object)
-{
- MetaLauncher *launcher = META_LAUNCHER (object);
-
- g_source_destroy (launcher->outer_source);
- g_source_destroy (launcher->inner_source);
-
- g_main_loop_unref (launcher->nested_loop);
- g_main_context_unref (launcher->nested_context);
-
- g_object_unref (launcher->weston_launch);
-
- G_OBJECT_CLASS (meta_launcher_parent_class)->finalize (object);
-}
-
-static void
meta_launcher_enter (MetaLauncher *launcher)
{
ClutterBackend *backend;
@@ -302,7 +266,7 @@ handle_request_vt_switch (MetaLauncher *launcher)
GError *error;
gboolean ok;
- g_signal_emit (launcher, signals[SIGNAL_LEAVE], 0);
+ meta_launcher_leave (launcher);
message.opcode = WESTON_LAUNCHER_CONFIRM_VT_SWITCH;
@@ -326,7 +290,7 @@ handle_request_vt_switch (MetaLauncher *launcher)
g_assert (launcher->vt_switched);
launcher->vt_switched = FALSE;
- g_signal_emit (launcher, signals[SIGNAL_ENTER], 0);
+ meta_launcher_enter (launcher);
}
static gboolean
@@ -378,9 +342,10 @@ env_get_fd (const char *env)
return g_ascii_strtoll (value, NULL, 10);
}
-static void
-meta_launcher_init (MetaLauncher *self)
+MetaLauncher *
+meta_launcher_new (void)
{
+ MetaLauncher *self = g_slice_new0 (MetaLauncher);
int launch_fd;
launch_fd = env_get_fd ("WESTON_LAUNCHER_SOCK");
@@ -403,37 +368,20 @@ meta_launcher_init (MetaLauncher *self)
g_source_set_callback (self->inner_source, (GSourceFunc)on_socket_readable, self, NULL);
g_source_attach (self->inner_source, self->nested_context);
g_source_unref (self->inner_source);
-}
-static void
-meta_launcher_class_init (MetaLauncherClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = meta_launcher_finalize;
-
- klass->enter = meta_launcher_enter;
- klass->leave = meta_launcher_leave;
-
- signals[SIGNAL_ENTER] = g_signal_new ("enter",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (MetaLauncherClass, enter),
- NULL, NULL, /* accumulator */
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- signals[SIGNAL_LEAVE] = g_signal_new ("leave",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (MetaLauncherClass, leave),
- NULL, NULL, /* accumulator */
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ return self;
}
-MetaLauncher *
-meta_launcher_new (void)
+void
+meta_launcher_free (MetaLauncher *launcher)
{
- return g_object_new (META_TYPE_LAUNCHER, NULL);
+ g_source_destroy (launcher->outer_source);
+ g_source_destroy (launcher->inner_source);
+
+ g_main_loop_unref (launcher->nested_loop);
+ g_main_context_unref (launcher->nested_context);
+
+ g_object_unref (launcher->weston_launch);
+
+ g_slice_free (MetaLauncher, launcher);
}
diff --git a/src/wayland/meta-weston-launch.h b/src/wayland/meta-weston-launch.h
index ea45308..498edbb 100644
--- a/src/wayland/meta-weston-launch.h
+++ b/src/wayland/meta-weston-launch.h
@@ -23,19 +23,10 @@
#include <glib-object.h>
#include "weston-launch.h"
-#define META_TYPE_LAUNCHER (meta_launcher_get_type())
-#define META_LAUNCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_LAUNCHER,
MetaLauncher))
-#define META_LAUNCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_LAUNCHER,
MetaLauncherClass))
-#define META_IS_LAUNCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_LAUNCHER))
-#define META_IS_LAUNCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_LAUNCHER))
-#define META_LAUNCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_LAUNCHER, MetaLauncherClass))
-
-typedef struct _MetaLauncher MetaLauncher;
-typedef struct _MetaLauncherClass MetaLauncherClass;
-
-GType meta_launcher_get_type (void) G_GNUC_CONST;
+typedef struct _MetaLauncher MetaLauncher;
MetaLauncher *meta_launcher_new (void);
+void meta_launcher_free (MetaLauncher *self);
gboolean meta_launcher_set_drm_fd (MetaLauncher *self,
int drm_fd,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]