mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-03 09:01:42 -05:00
server: use the event sending wrappers
This exposes some type mismatches that are fixed in the next commit. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
86a5d17afe
commit
5ee70146c6
3 changed files with 32 additions and 48 deletions
|
|
@ -38,8 +38,8 @@ data_offer_accept(struct wl_client *client, struct wl_resource *resource,
|
||||||
* this be a wl_data_device request? */
|
* this be a wl_data_device request? */
|
||||||
|
|
||||||
if (offer->source)
|
if (offer->source)
|
||||||
wl_resource_post_event(&offer->source->resource,
|
wl_data_source_send_target(&offer->source->resource,
|
||||||
WL_DATA_SOURCE_TARGET, mime_type);
|
mime_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -49,8 +49,8 @@ data_offer_receive(struct wl_client *client, struct wl_resource *resource,
|
||||||
struct wl_data_offer *offer = resource->data;
|
struct wl_data_offer *offer = resource->data;
|
||||||
|
|
||||||
if (offer->source)
|
if (offer->source)
|
||||||
wl_resource_post_event(&offer->source->resource,
|
wl_data_source_send_send(&offer->source->resource,
|
||||||
WL_DATA_SOURCE_SEND, mime_type, fd);
|
mime_type, fd);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ destroy_offer_data_source(struct wl_listener *listener,
|
||||||
static void
|
static void
|
||||||
data_source_cancel(struct wl_data_source *source)
|
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 *
|
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_client_add_resource(target->client, &offer->resource);
|
||||||
|
|
||||||
wl_resource_post_event(target,
|
wl_data_device_send_data_offer(target, &offer->resource);
|
||||||
WL_DATA_DEVICE_DATA_OFFER, &offer->resource);
|
|
||||||
|
|
||||||
end = source->mime_types.data + source->mime_types.size;
|
end = source->mime_types.data + source->mime_types.size;
|
||||||
for (p = source->mime_types.data; p < end; p++)
|
for (p = source->mime_types.data; p < end; p++)
|
||||||
wl_resource_post_event(&offer->resource,
|
wl_data_offer_send_offer(&offer->resource, *p);
|
||||||
WL_DATA_OFFER_OFFER, *p);
|
|
||||||
|
|
||||||
return &offer->resource;
|
return &offer->resource;
|
||||||
}
|
}
|
||||||
|
|
@ -190,8 +188,7 @@ drag_grab_focus(struct wl_pointer_grab *grab, uint32_t time,
|
||||||
struct wl_resource *resource, *offer;
|
struct wl_resource *resource, *offer;
|
||||||
|
|
||||||
if (device->drag_focus_resource) {
|
if (device->drag_focus_resource) {
|
||||||
wl_resource_post_event(device->drag_focus_resource,
|
wl_data_device_send_leave(device->drag_focus_resource);
|
||||||
WL_DATA_DEVICE_LEAVE);
|
|
||||||
wl_list_remove(&device->drag_focus_listener.link);
|
wl_list_remove(&device->drag_focus_listener.link);
|
||||||
device->drag_focus_resource = NULL;
|
device->drag_focus_resource = NULL;
|
||||||
device->drag_focus = 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,
|
offer = wl_data_source_send_offer(device->drag_data_source,
|
||||||
resource);
|
resource);
|
||||||
|
|
||||||
wl_resource_post_event(resource,
|
wl_data_device_send_enter(resource, time, surface,
|
||||||
WL_DATA_DEVICE_ENTER,
|
x, y, offer);
|
||||||
time, surface, x, y, offer);
|
|
||||||
|
|
||||||
device->drag_focus = surface;
|
device->drag_focus = surface;
|
||||||
device->drag_focus_listener.func = destroy_drag_focus;
|
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);
|
container_of(grab, struct wl_input_device, drag_grab);
|
||||||
|
|
||||||
if (device->drag_focus_resource)
|
if (device->drag_focus_resource)
|
||||||
wl_resource_post_event(device->drag_focus_resource,
|
wl_data_device_send_motion(device->drag_focus_resource,
|
||||||
WL_DATA_DEVICE_MOTION, time, x, y);
|
time, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -238,8 +234,7 @@ drag_grab_button(struct wl_pointer_grab *grab,
|
||||||
|
|
||||||
if (device->drag_focus_resource &&
|
if (device->drag_focus_resource &&
|
||||||
device->grab_button == button && state == 0)
|
device->grab_button == button && state == 0)
|
||||||
wl_resource_post_event(device->drag_focus_resource,
|
wl_data_device_send_drop(device->drag_focus_resource);
|
||||||
WL_DATA_DEVICE_DROP);
|
|
||||||
|
|
||||||
if (device->button_count == 0 && state == 0) {
|
if (device->button_count == 0 && state == 0) {
|
||||||
wl_input_device_end_pointer_grab(device, time);
|
wl_input_device_end_pointer_grab(device, time);
|
||||||
|
|
@ -320,8 +315,7 @@ destroy_selection_data_source(struct wl_listener *listener,
|
||||||
if (focus) {
|
if (focus) {
|
||||||
data_device = find_resource(&device->drag_resource_list,
|
data_device = find_resource(&device->drag_resource_list,
|
||||||
focus->client);
|
focus->client);
|
||||||
wl_resource_post_event(data_device,
|
wl_data_device_send_selection(data_device, NULL);
|
||||||
WL_DATA_DEVICE_SELECTION, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,9 +341,7 @@ wl_input_device_set_selection(struct wl_input_device *device,
|
||||||
if (data_device) {
|
if (data_device) {
|
||||||
offer = wl_data_source_send_offer(device->selection_data_source,
|
offer = wl_data_source_send_offer(device->selection_data_source,
|
||||||
data_device);
|
data_device);
|
||||||
wl_resource_post_event(data_device,
|
wl_data_device_send_selection(data_device, offer);
|
||||||
WL_DATA_DEVICE_SELECTION,
|
|
||||||
offer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -476,8 +468,7 @@ wl_data_device_set_keyboard_focus(struct wl_input_device *device)
|
||||||
source = device->selection_data_source;
|
source = device->selection_data_source;
|
||||||
if (source) {
|
if (source) {
|
||||||
offer = wl_data_source_send_offer(source, data_device);
|
offer = wl_data_source_send_offer(source, data_device);
|
||||||
wl_resource_post_event(data_device,
|
wl_data_device_send_selection(data_device, offer);
|
||||||
WL_DATA_DEVICE_SELECTION, offer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -467,8 +467,7 @@ default_grab_motion(struct wl_pointer_grab *grab,
|
||||||
|
|
||||||
resource = grab->input_device->pointer_focus_resource;
|
resource = grab->input_device->pointer_focus_resource;
|
||||||
if (resource)
|
if (resource)
|
||||||
wl_resource_post_event(resource, WL_INPUT_DEVICE_MOTION,
|
wl_input_device_send_motion(resource, time, x, y);
|
||||||
time, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -480,8 +479,7 @@ default_grab_button(struct wl_pointer_grab *grab,
|
||||||
|
|
||||||
resource = device->pointer_focus_resource;
|
resource = device->pointer_focus_resource;
|
||||||
if (resource)
|
if (resource)
|
||||||
wl_resource_post_event(resource, WL_INPUT_DEVICE_BUTTON,
|
wl_input_device_send_button(resource, time, button, state);
|
||||||
time, button, state);
|
|
||||||
|
|
||||||
if (device->button_count == 0 && state == 0)
|
if (device->button_count == 0 && state == 0)
|
||||||
wl_input_device_set_pointer_focus(device,
|
wl_input_device_set_pointer_focus(device,
|
||||||
|
|
@ -506,8 +504,7 @@ default_grab_key(struct wl_keyboard_grab *grab,
|
||||||
|
|
||||||
resource = device->keyboard_focus_resource;
|
resource = device->keyboard_focus_resource;
|
||||||
if (resource)
|
if (resource)
|
||||||
wl_resource_post_event(resource, WL_INPUT_DEVICE_KEY,
|
wl_input_device_send_key(resource, time, key, state);
|
||||||
time, key, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_keyboard_grab_interface
|
static const struct wl_keyboard_grab_interface
|
||||||
|
|
@ -582,17 +579,16 @@ wl_input_device_set_pointer_focus(struct wl_input_device *device,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (device->pointer_focus_resource) {
|
if (device->pointer_focus_resource) {
|
||||||
wl_resource_post_event(device->pointer_focus_resource,
|
wl_input_device_send_pointer_leave(
|
||||||
WL_INPUT_DEVICE_POINTER_LEAVE,
|
device->pointer_focus_resource,
|
||||||
time, device->pointer_focus);
|
time, device->pointer_focus);
|
||||||
wl_list_remove(&device->pointer_focus_listener.link);
|
wl_list_remove(&device->pointer_focus_listener.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
resource = find_resource_for_surface(&device->resource_list, surface);
|
resource = find_resource_for_surface(&device->resource_list, surface);
|
||||||
if (resource) {
|
if (resource) {
|
||||||
wl_resource_post_event(resource,
|
wl_input_device_send_pointer_enter(resource, time,
|
||||||
WL_INPUT_DEVICE_POINTER_ENTER,
|
surface, sx, sy);
|
||||||
time, surface, sx, sy);
|
|
||||||
wl_list_insert(resource->destroy_listener_list.prev,
|
wl_list_insert(resource->destroy_listener_list.prev,
|
||||||
&device->pointer_focus_listener.link);
|
&device->pointer_focus_listener.link);
|
||||||
}
|
}
|
||||||
|
|
@ -614,17 +610,16 @@ wl_input_device_set_keyboard_focus(struct wl_input_device *device,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (device->keyboard_focus_resource) {
|
if (device->keyboard_focus_resource) {
|
||||||
wl_resource_post_event(device->keyboard_focus_resource,
|
wl_input_device_send_keyboard_leave(
|
||||||
WL_INPUT_DEVICE_KEYBOARD_LEAVE,
|
device->keyboard_focus_resource,
|
||||||
time, device->keyboard_focus);
|
time, device->keyboard_focus);
|
||||||
wl_list_remove(&device->keyboard_focus_listener.link);
|
wl_list_remove(&device->keyboard_focus_listener.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
resource = find_resource_for_surface(&device->resource_list, surface);
|
resource = find_resource_for_surface(&device->resource_list, surface);
|
||||||
if (resource) {
|
if (resource) {
|
||||||
wl_resource_post_event(resource,
|
wl_input_device_send_keyboard_enter(resource, time,
|
||||||
WL_INPUT_DEVICE_KEYBOARD_ENTER,
|
surface, &device->keys);
|
||||||
time, surface, &device->keys);
|
|
||||||
wl_list_insert(resource->destroy_listener_list.prev,
|
wl_list_insert(resource->destroy_listener_list.prev,
|
||||||
&device->keyboard_focus_listener.link);
|
&device->keyboard_focus_listener.link);
|
||||||
}
|
}
|
||||||
|
|
@ -703,7 +698,7 @@ display_sync(struct wl_client *client,
|
||||||
|
|
||||||
callback = wl_client_add_object(client,
|
callback = wl_client_add_object(client,
|
||||||
&wl_callback_interface, NULL, id, NULL);
|
&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);
|
wl_resource_destroy(callback, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,10 +178,8 @@ bind_shm(struct wl_client *client,
|
||||||
resource = wl_client_add_object(client, &wl_shm_interface,
|
resource = wl_client_add_object(client, &wl_shm_interface,
|
||||||
&shm_interface, id, data);
|
&shm_interface, id, data);
|
||||||
|
|
||||||
wl_resource_post_event(resource, WL_SHM_FORMAT,
|
wl_shm_send_format(resource, WL_SHM_FORMAT_ARGB8888);
|
||||||
WL_SHM_FORMAT_ARGB8888);
|
wl_shm_send_format(resource, WL_SHM_FORMAT_XRGB8888);
|
||||||
wl_resource_post_event(resource, WL_SHM_FORMAT,
|
|
||||||
WL_SHM_FORMAT_XRGB8888);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT struct wl_shm *
|
WL_EXPORT struct wl_shm *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue