[mutter] wayland: Have a consistent _init pattern for subcomponents
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Have a consistent _init pattern for subcomponents
- Date: Tue, 22 Apr 2014 22:28:11 +0000 (UTC)
commit 88040d6b8a748e0d9b90a0b934f610c532bd7bf6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Apr 22 18:05:44 2014 -0400
wayland: Have a consistent _init pattern for subcomponents
src/wayland/meta-wayland-data-device.c | 22 ++++++++++------------
src/wayland/meta-wayland-data-device.h | 8 ++++----
src/wayland/meta-wayland-seat.c | 9 ++++++++-
src/wayland/meta-wayland-seat.h | 4 ++--
src/wayland/meta-wayland-surface.c | 2 +-
src/wayland/meta-wayland-surface.h | 2 +-
src/wayland/meta-wayland.c | 10 ++++------
7 files changed, 30 insertions(+), 27 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index ccd6162..88caa9d 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -508,6 +508,16 @@ bind_manager (struct wl_client *client,
}
void
+meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor)
+{
+ if (wl_global_create (compositor->wayland_display,
+ &wl_data_device_manager_interface,
+ META_WL_DATA_DEVICE_MANAGER_VERSION,
+ NULL, bind_manager) == NULL)
+ g_error ("Could not create data_device");
+}
+
+void
meta_wayland_data_device_set_keyboard_focus (MetaWaylandSeat *seat)
{
struct wl_client *focus_client;
@@ -529,15 +539,3 @@ meta_wayland_data_device_set_keyboard_focus (MetaWaylandSeat *seat)
wl_data_device_send_selection (data_device, offer);
}
}
-
-int
-meta_wayland_data_device_manager_init (struct wl_display *display)
-{
- if (wl_global_create (display,
- &wl_data_device_manager_interface,
- META_WL_DATA_DEVICE_MANAGER_VERSION,
- NULL, bind_manager) == NULL)
- return -1;
-
- return 0;
-}
diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h
index 87f9774..d00ea66 100644
--- a/src/wayland/meta-wayland-data-device.h
+++ b/src/wayland/meta-wayland-data-device.h
@@ -25,12 +25,12 @@
#include <wayland-server.h>
-#include "meta-wayland-seat.h"
+#include "meta-wayland-private.h"
void
-meta_wayland_data_device_set_keyboard_focus (MetaWaylandSeat *seat);
+meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor);
-int
-meta_wayland_data_device_manager_init (struct wl_display *display);
+void
+meta_wayland_data_device_set_keyboard_focus (MetaWaylandSeat *seat);
#endif /* __META_WAYLAND_DATA_DEVICE_H__ */
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 58fe74f..baae0f2 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -23,6 +23,7 @@
#include "meta-wayland-seat.h"
+#include "meta-wayland-private.h"
#include "meta-wayland-versions.h"
static void
@@ -89,7 +90,7 @@ bind_seat (struct wl_client *client,
wl_seat_send_name (resource, "seat0");
}
-MetaWaylandSeat *
+static MetaWaylandSeat *
meta_wayland_seat_new (struct wl_display *display)
{
MetaWaylandSeat *seat = g_new0 (MetaWaylandSeat, 1);
@@ -109,6 +110,12 @@ meta_wayland_seat_new (struct wl_display *display)
}
void
+meta_wayland_seat_init (MetaWaylandCompositor *compositor)
+{
+ compositor->seat = meta_wayland_seat_new (compositor->wayland_display);
+}
+
+void
meta_wayland_seat_free (MetaWaylandSeat *seat)
{
meta_wayland_pointer_release (&seat->pointer);
diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h
index d7907ba..94ba76c 100644
--- a/src/wayland/meta-wayland-seat.h
+++ b/src/wayland/meta-wayland-seat.h
@@ -57,8 +57,8 @@ struct _MetaWaylandSeat
struct wl_display *display;
};
-MetaWaylandSeat *
-meta_wayland_seat_new (struct wl_display *display);
+void
+meta_wayland_seat_init (MetaWaylandCompositor *compositor);
void
meta_wayland_seat_free (MetaWaylandSeat *seat);
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 59c2a4b..0742736 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1643,7 +1643,7 @@ bind_subcompositor (struct wl_client *client,
}
void
-meta_wayland_init_shell (MetaWaylandCompositor *compositor)
+meta_wayland_shell_init (MetaWaylandCompositor *compositor)
{
if (wl_global_create (compositor->wayland_display,
&xdg_shell_interface, 1,
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index 24f1e7b..537f4f2 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -112,7 +112,7 @@ struct _MetaWaylandSurface
MetaWaylandPendingState pending;
};
-void meta_wayland_init_shell (MetaWaylandCompositor *compositor);
+void meta_wayland_shell_init (MetaWaylandCompositor *compositor);
MetaWaylandSurface *meta_wayland_surface_create (MetaWaylandCompositor *compositor,
struct wl_client *client,
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 8e90281..6ccb323 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -430,12 +430,10 @@ meta_wayland_init (void)
meta_clutter_init ();
- meta_wayland_init_outputs (compositor);
- meta_wayland_data_device_manager_init (compositor->wayland_display);
-
- compositor->seat = meta_wayland_seat_new (compositor->wayland_display);
-
- meta_wayland_init_shell (compositor);
+ meta_wayland_outputs_init (compositor);
+ meta_wayland_data_device_manager_init (compositor);
+ meta_wayland_shell_init (compositor);
+ meta_wayland_seat_init (compositor);
/* FIXME: find the first free name instead */
compositor->display_name = g_strdup ("wayland-0");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]