wayland: Have a consistent _init pattern for subcomponents
This commit is contained in:
parent
eaf85ddec9
commit
88040d6b8a
@ -507,6 +507,16 @@ bind_manager (struct wl_client *client,
|
||||
wl_resource_set_implementation (resource, &manager_interface, NULL, NULL);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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;
|
||||
}
|
||||
|
@ -25,12 +25,12 @@
|
||||
|
||||
#include <wayland-server.h>
|
||||
|
||||
#include "meta-wayland-seat.h"
|
||||
#include "meta-wayland-private.h"
|
||||
|
||||
void
|
||||
meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor);
|
||||
|
||||
void
|
||||
meta_wayland_data_device_set_keyboard_focus (MetaWaylandSeat *seat);
|
||||
|
||||
int
|
||||
meta_wayland_data_device_manager_init (struct wl_display *display);
|
||||
|
||||
#endif /* __META_WAYLAND_DATA_DEVICE_H__ */
|
||||
|
@ -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);
|
||||
@ -108,6 +109,12 @@ meta_wayland_seat_new (struct wl_display *display)
|
||||
return seat;
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_seat_init (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
compositor->seat = meta_wayland_seat_new (compositor->wayland_display);
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_seat_free (MetaWaylandSeat *seat)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user