server: use the event sending wrappers
authorPekka Paalanen <ppaalanen@gmail.com>
Fri, 2 Mar 2012 15:08:59 +0000 (17:08 +0200)
committerPekka Paalanen <ppaalanen@gmail.com>
Fri, 2 Mar 2012 16:06:19 +0000 (18:06 +0200)
This exposes some type mismatches that are fixed in the next commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
src/data-device.c
src/wayland-server.c
src/wayland-shm.c

index f0f6baa..fc34a18 100644 (file)
@@ -38,8 +38,8 @@ data_offer_accept(struct wl_client *client, struct wl_resource *resource,
         * this be a wl_data_device request? */
 
        if (offer->source)
-               wl_resource_post_event(&offer->source->resource,
-                                      WL_DATA_SOURCE_TARGET, mime_type);
+               wl_data_source_send_target(&offer->source->resource,
+                                          mime_type);
 }
 
 static void
@@ -49,8 +49,8 @@ data_offer_receive(struct wl_client *client, struct wl_resource *resource,
        struct wl_data_offer *offer = resource->data;
 
        if (offer->source)
-               wl_resource_post_event(&offer->source->resource,
-                                      WL_DATA_SOURCE_SEND, mime_type, fd);
+               wl_data_source_send_send(&offer->source->resource,
+                                        mime_type, fd);
 
        close(fd);
 }
@@ -91,7 +91,7 @@ destroy_offer_data_source(struct wl_listener *listener,
 static void
 data_source_cancel(struct wl_data_source *source)
 {
-       wl_resource_post_event(&source->resource, WL_DATA_SOURCE_CANCELLED);
+       wl_data_source_send_cancelled(&source->resource);
 }
 
 static struct wl_resource *
@@ -120,13 +120,11 @@ wl_data_source_send_offer(struct wl_data_source *source,
 
        wl_client_add_resource(target->client, &offer->resource);
 
-       wl_resource_post_event(target,
-                              WL_DATA_DEVICE_DATA_OFFER, &offer->resource);
+       wl_data_device_send_data_offer(target, &offer->resource);
 
        end = source->mime_types.data + source->mime_types.size;
        for (p = source->mime_types.data; p < end; p++)
-               wl_resource_post_event(&offer->resource,
-                                      WL_DATA_OFFER_OFFER, *p);
+               wl_data_offer_send_offer(&offer->resource, *p);
 
        return &offer->resource;
 }
@@ -190,8 +188,7 @@ drag_grab_focus(struct wl_pointer_grab *grab, uint32_t time,
        struct wl_resource *resource, *offer;
 
        if (device->drag_focus_resource) {
-               wl_resource_post_event(device->drag_focus_resource,
-                                      WL_DATA_DEVICE_LEAVE);
+               wl_data_device_send_leave(device->drag_focus_resource);
                wl_list_remove(&device->drag_focus_listener.link);
                device->drag_focus_resource = NULL;
                device->drag_focus = NULL;
@@ -204,9 +201,8 @@ drag_grab_focus(struct wl_pointer_grab *grab, uint32_t time,
                offer = wl_data_source_send_offer(device->drag_data_source,
                                                  resource);
 
-               wl_resource_post_event(resource,
-                                      WL_DATA_DEVICE_ENTER,
-                                      time, surface, x, y, offer);
+               wl_data_device_send_enter(resource, time, surface,
+                                         x, y, offer);
 
                device->drag_focus = surface;
                device->drag_focus_listener.func = destroy_drag_focus;
@@ -225,8 +221,8 @@ drag_grab_motion(struct wl_pointer_grab *grab,
                container_of(grab, struct wl_input_device, drag_grab);
 
        if (device->drag_focus_resource)
-               wl_resource_post_event(device->drag_focus_resource,
-                                      WL_DATA_DEVICE_MOTION, time, x, y);
+               wl_data_device_send_motion(device->drag_focus_resource,
+                                          time, x, y);
 }
 
 static void
@@ -238,8 +234,7 @@ drag_grab_button(struct wl_pointer_grab *grab,
 
        if (device->drag_focus_resource &&
            device->grab_button == button && state == 0)
-               wl_resource_post_event(device->drag_focus_resource,
-                                      WL_DATA_DEVICE_DROP);
+               wl_data_device_send_drop(device->drag_focus_resource);
 
        if (device->button_count == 0 && state == 0) {
                wl_input_device_end_pointer_grab(device, time);
@@ -320,8 +315,7 @@ destroy_selection_data_source(struct wl_listener *listener,
        if (focus) {
                data_device = find_resource(&device->drag_resource_list,
                                            focus->client);
-               wl_resource_post_event(data_device,
-                                      WL_DATA_DEVICE_SELECTION, NULL);
+               wl_data_device_send_selection(data_device, NULL);
        }
 }
 
@@ -347,9 +341,7 @@ wl_input_device_set_selection(struct wl_input_device *device,
                if (data_device) {
                        offer = wl_data_source_send_offer(device->selection_data_source,
                                                          data_device);
-                       wl_resource_post_event(data_device,
-                                              WL_DATA_DEVICE_SELECTION,
-                                              offer);
+                       wl_data_device_send_selection(data_device, offer);
                }
        }
 
@@ -476,8 +468,7 @@ wl_data_device_set_keyboard_focus(struct wl_input_device *device)
        source = device->selection_data_source;
        if (source) {
                offer = wl_data_source_send_offer(source, data_device);
-               wl_resource_post_event(data_device,
-                                      WL_DATA_DEVICE_SELECTION, offer);
+               wl_data_device_send_selection(data_device, offer);
        }
 }
 
index 6a8cbcb..4c3d2c0 100644 (file)
@@ -467,8 +467,7 @@ default_grab_motion(struct wl_pointer_grab *grab,
 
        resource = grab->input_device->pointer_focus_resource;
        if (resource)
-               wl_resource_post_event(resource, WL_INPUT_DEVICE_MOTION,
-                                      time, x, y);
+               wl_input_device_send_motion(resource, time, x, y);
 }
 
 static void
@@ -480,8 +479,7 @@ default_grab_button(struct wl_pointer_grab *grab,
 
        resource = device->pointer_focus_resource;
        if (resource)
-               wl_resource_post_event(resource, WL_INPUT_DEVICE_BUTTON,
-                                      time, button, state);
+               wl_input_device_send_button(resource, time, button, state);
 
        if (device->button_count == 0 && state == 0)
                wl_input_device_set_pointer_focus(device,
@@ -506,8 +504,7 @@ default_grab_key(struct wl_keyboard_grab *grab,
 
        resource = device->keyboard_focus_resource;
        if (resource)
-               wl_resource_post_event(resource, WL_INPUT_DEVICE_KEY,
-                                      time, key, state);
+               wl_input_device_send_key(resource, time, key, state);
 }
 
 static const struct wl_keyboard_grab_interface
@@ -582,17 +579,16 @@ wl_input_device_set_pointer_focus(struct wl_input_device *device,
                return;
 
        if (device->pointer_focus_resource) {
-               wl_resource_post_event(device->pointer_focus_resource,
-                                      WL_INPUT_DEVICE_POINTER_LEAVE,
-                                      time, device->pointer_focus);
+               wl_input_device_send_pointer_leave(
+                       device->pointer_focus_resource,
+                       time, device->pointer_focus);
                wl_list_remove(&device->pointer_focus_listener.link);
        }
 
        resource = find_resource_for_surface(&device->resource_list, surface);
        if (resource) {
-               wl_resource_post_event(resource,
-                                      WL_INPUT_DEVICE_POINTER_ENTER,
-                                      time, surface, sx, sy);
+               wl_input_device_send_pointer_enter(resource, time,
+                                                  surface, sx, sy);
                wl_list_insert(resource->destroy_listener_list.prev,
                               &device->pointer_focus_listener.link);
        }
@@ -614,17 +610,16 @@ wl_input_device_set_keyboard_focus(struct wl_input_device *device,
                return;
 
        if (device->keyboard_focus_resource) {
-               wl_resource_post_event(device->keyboard_focus_resource,
-                                      WL_INPUT_DEVICE_KEYBOARD_LEAVE,
-                                      time, device->keyboard_focus);
+               wl_input_device_send_keyboard_leave(
+                       device->keyboard_focus_resource,
+                       time, device->keyboard_focus);
                wl_list_remove(&device->keyboard_focus_listener.link);
        }
 
        resource = find_resource_for_surface(&device->resource_list, surface);
        if (resource) {
-               wl_resource_post_event(resource,
-                                      WL_INPUT_DEVICE_KEYBOARD_ENTER,
-                                      time, surface, &device->keys);
+               wl_input_device_send_keyboard_enter(resource, time,
+                                                   surface, &device->keys);
                wl_list_insert(resource->destroy_listener_list.prev,
                               &device->keyboard_focus_listener.link);
        }
@@ -703,7 +698,7 @@ display_sync(struct wl_client *client,
 
        callback = wl_client_add_object(client,
                                        &wl_callback_interface, NULL, id, NULL);
-       wl_resource_post_event(callback, WL_CALLBACK_DONE, 0);
+       wl_callback_send_done(callback, 0);
        wl_resource_destroy(callback, 0);
 }
 
index 2998c3d..b0af0e1 100644 (file)
@@ -178,10 +178,8 @@ bind_shm(struct wl_client *client,
        resource = wl_client_add_object(client, &wl_shm_interface,
                                        &shm_interface, id, data);
 
-       wl_resource_post_event(resource, WL_SHM_FORMAT,
-                              WL_SHM_FORMAT_ARGB8888);
-       wl_resource_post_event(resource, WL_SHM_FORMAT,
-                              WL_SHM_FORMAT_XRGB8888);
+       wl_shm_send_format(resource, WL_SHM_FORMAT_ARGB8888);
+       wl_shm_send_format(resource, WL_SHM_FORMAT_XRGB8888);
 }
 
 WL_EXPORT struct wl_shm *