From cbab0a62ad7eb162bc5f195f5e199fc6279d6751 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 12 Oct 2012 18:54:25 +0100 Subject: [PATCH] wayland: Port to new protocol --- clutter/wayland/clutter-backend-wayland.c | 31 ++++++++++++------- clutter/wayland/clutter-backend-wayland.h | 1 + .../wayland/clutter-device-manager-wayland.c | 4 +-- clutter/wayland/clutter-event-wayland.c | 15 ++------- .../wayland/clutter-input-device-wayland.c | 2 ++ 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/clutter/wayland/clutter-backend-wayland.c b/clutter/wayland/clutter-backend-wayland.c index 56b5b5734..1630b537a 100644 --- a/clutter/wayland/clutter-backend-wayland.c +++ b/clutter/wayland/clutter-backend-wayland.c @@ -126,17 +126,17 @@ static const struct wl_output_listener wayland_output_listener = { static void -display_handle_global (struct wl_display *display, - uint32_t id, - const char *interface, - uint32_t version, - void *data) +registry_handle_global (void *data, + struct wl_registry *registry, + uint32_t id, + const char *interface, + uint32_t version) { ClutterBackendWayland *backend_wayland = data; if (strcmp (interface, "wl_compositor") == 0) backend_wayland->wayland_compositor = - wl_display_bind (display, id, &wl_compositor_interface); + wl_registry_bind (registry, id, &wl_compositor_interface, 1); else if (strcmp (interface, "wl_seat") == 0) { ClutterDeviceManager *device_manager = backend_wayland->device_manager; @@ -145,24 +145,28 @@ display_handle_global (struct wl_display *display, else if (strcmp (interface, "wl_shell") == 0) { backend_wayland->wayland_shell = - wl_display_bind (display, id, &wl_shell_interface); + wl_registry_bind (registry, id, &wl_shell_interface, 1); } else if (strcmp (interface, "wl_shm") == 0) { backend_wayland->wayland_shm = - wl_display_bind (display, id, &wl_shm_interface); + wl_registry_bind (registry, id, &wl_shm_interface, 1); } else if (strcmp (interface, "wl_output") == 0) { /* FIXME: Support multiple outputs */ backend_wayland->wayland_output = - wl_display_bind (display, id, &wl_output_interface); + wl_registry_bind (registry, id, &wl_output_interface, 1); wl_output_add_listener (backend_wayland->wayland_output, &wayland_output_listener, backend_wayland); } } +static const struct wl_registry_listener wayland_registry_listener = { + registry_handle_global, +}; + static gboolean clutter_backend_wayland_post_parse (ClutterBackend *backend, GError **error) @@ -179,6 +183,9 @@ clutter_backend_wayland_post_parse (ClutterBackend *backend, return FALSE; } + backend_wayland->wayland_registry = + wl_display_get_registry (backend_wayland->wayland_display); + backend_wayland->wayland_source = _clutter_event_source_wayland_new (backend_wayland->wayland_display); g_source_attach (backend_wayland->wayland_source, NULL); @@ -200,9 +207,9 @@ clutter_backend_wayland_post_parse (ClutterBackend *backend, _clutter_device_manager_wayland_new (backend); /* Set up listener so we'll catch all events. */ - wl_display_add_global_listener (backend_wayland->wayland_display, - display_handle_global, - backend_wayland); + wl_registry_add_listener (backend_wayland->wayland_registry, + &wayland_registry_listener, + backend_wayland); /* Wait until we have been notified about the compositor and shell objects */ while (!(backend_wayland->wayland_compositor && diff --git a/clutter/wayland/clutter-backend-wayland.h b/clutter/wayland/clutter-backend-wayland.h index 5cbaa3bc8..3f141326f 100644 --- a/clutter/wayland/clutter-backend-wayland.h +++ b/clutter/wayland/clutter-backend-wayland.h @@ -56,6 +56,7 @@ struct _ClutterBackendWayland ClutterDeviceManager *device_manager; struct wl_display *wayland_display; + struct wl_registry *wayland_registry; struct wl_compositor *wayland_compositor; struct wl_shell *wayland_shell; struct wl_shm *wayland_shm; diff --git a/clutter/wayland/clutter-device-manager-wayland.c b/clutter/wayland/clutter-device-manager-wayland.c index 738a9ee5f..17d61cd33 100644 --- a/clutter/wayland/clutter-device-manager-wayland.c +++ b/clutter/wayland/clutter-device-manager-wayland.c @@ -162,8 +162,8 @@ _clutter_device_manager_wayland_add_input_group (ClutterDeviceManager *manager, NULL); device->input_device = - wl_display_bind (backend_wayland->wayland_display, id, - &wl_seat_interface); + wl_registry_bind (backend_wayland->wayland_registry, id, + &wl_seat_interface, 1); wl_seat_add_listener (device->input_device, &_clutter_seat_wayland_listener, device); diff --git a/clutter/wayland/clutter-event-wayland.c b/clutter/wayland/clutter-event-wayland.c index 08adcca2a..8ba2f3cb4 100644 --- a/clutter/wayland/clutter-event-wayland.c +++ b/clutter/wayland/clutter-event-wayland.c @@ -42,7 +42,6 @@ typedef struct _ClutterEventSourceWayland { GSource source; GPollFD pfd; - uint32_t mask; struct wl_display *display; } ClutterEventSourceWayland; @@ -95,7 +94,7 @@ clutter_event_source_wayland_dispatch (GSource *base, if (source->pfd.revents) { - wl_display_iterate (source->display, WL_DISPLAY_READABLE); + wl_display_dispatch (source->display); source->pfd.revents = 0; } @@ -120,15 +119,6 @@ static GSourceFuncs clutter_event_source_wayland_funcs = { NULL }; -static int -clutter_event_source_wayland_update (uint32_t mask, void *data) -{ - ClutterEventSourceWayland *source = data; - - source->mask = mask; - - return 0; -} GSource * _clutter_event_source_wayland_new (struct wl_display *display) @@ -140,8 +130,7 @@ _clutter_event_source_wayland_new (struct wl_display *display) sizeof (ClutterEventSourceWayland)); source->display = display; source->pfd.fd = - wl_display_get_fd (display, - clutter_event_source_wayland_update, source); + wl_display_get_fd (display); source->pfd.events = G_IO_IN | G_IO_ERR; g_source_add_poll (&source->source, &source->pfd); diff --git a/clutter/wayland/clutter-input-device-wayland.c b/clutter/wayland/clutter-input-device-wayland.c index 4ef040714..fe534f70f 100644 --- a/clutter/wayland/clutter-input-device-wayland.c +++ b/clutter/wayland/clutter-input-device-wayland.c @@ -365,6 +365,8 @@ clutter_wayland_handle_pointer_enter (void *data, 0, 32, /* XXX: FFS */ 32); + + wl_surface_commit (backend_wayland->cursor_surface); } static void