2 * Copyright © 2011 Kristian Høgsberg
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
31 #include "compositor.h"
34 struct wl_client *client;
35 struct weston_data_source *data_source;
36 struct wl_listener data_source_listener;
37 struct weston_view *focus;
38 struct wl_resource *focus_resource;
39 struct wl_listener focus_listener;
40 struct weston_view *icon;
41 struct wl_listener icon_destroy_listener;
45 struct weston_pointer_drag {
46 struct weston_drag base;
47 struct weston_pointer_grab grab;
50 struct weston_touch_drag {
51 struct weston_drag base;
52 struct weston_touch_grab grab;
56 data_offer_accept(struct wl_client *client, struct wl_resource *resource,
57 uint32_t serial, const char *mime_type)
59 struct weston_data_offer *offer = wl_resource_get_user_data(resource);
61 /* FIXME: Check that client is currently focused by the input
62 * device that is currently dragging this data source. Should
63 * this be a wl_data_device request? */
66 offer->source->accept(offer->source, serial, mime_type);
70 data_offer_receive(struct wl_client *client, struct wl_resource *resource,
71 const char *mime_type, int32_t fd)
73 struct weston_data_offer *offer = wl_resource_get_user_data(resource);
76 offer->source->send(offer->source, mime_type, fd);
82 data_offer_destroy(struct wl_client *client, struct wl_resource *resource)
84 wl_resource_destroy(resource);
87 static const struct wl_data_offer_interface data_offer_interface = {
94 destroy_data_offer(struct wl_resource *resource)
96 struct weston_data_offer *offer = wl_resource_get_user_data(resource);
99 wl_list_remove(&offer->source_destroy_listener.link);
104 destroy_offer_data_source(struct wl_listener *listener, void *data)
106 struct weston_data_offer *offer;
108 offer = container_of(listener, struct weston_data_offer,
109 source_destroy_listener);
111 offer->source = NULL;
114 static struct wl_resource *
115 weston_data_source_send_offer(struct weston_data_source *source,
116 struct wl_resource *target)
118 struct weston_data_offer *offer;
121 offer = malloc(sizeof *offer);
126 wl_resource_create(wl_resource_get_client(target),
127 &wl_data_offer_interface, 1, 0);
128 if (offer->resource == NULL) {
133 wl_resource_set_implementation(offer->resource, &data_offer_interface,
134 offer, destroy_data_offer);
136 offer->source = source;
137 offer->source_destroy_listener.notify = destroy_offer_data_source;
138 wl_signal_add(&source->destroy_signal,
139 &offer->source_destroy_listener);
141 wl_data_device_send_data_offer(target, offer->resource);
143 wl_array_for_each(p, &source->mime_types)
144 wl_data_offer_send_offer(offer->resource, *p);
146 return offer->resource;
150 data_source_offer(struct wl_client *client,
151 struct wl_resource *resource,
154 struct weston_data_source *source =
155 wl_resource_get_user_data(resource);
158 p = wl_array_add(&source->mime_types, sizeof *p);
162 wl_resource_post_no_memory(resource);
166 data_source_destroy(struct wl_client *client, struct wl_resource *resource)
168 wl_resource_destroy(resource);
171 static struct wl_data_source_interface data_source_interface = {
177 drag_surface_configure(struct weston_drag *drag,
178 struct weston_pointer *pointer,
179 struct weston_touch *touch,
180 struct weston_surface *es,
181 int32_t sx, int32_t sy)
183 struct weston_layer_entry *list;
186 assert((pointer != NULL && touch == NULL) ||
187 (pointer == NULL && touch != NULL));
189 if (!weston_surface_is_mapped(es) && es->buffer_ref.buffer) {
190 if (pointer && pointer->sprite &&
191 weston_view_is_mapped(pointer->sprite))
192 list = &pointer->sprite->layer_link;
194 list = &es->compositor->cursor_layer.view_list;
196 weston_layer_entry_remove(&drag->icon->layer_link);
197 weston_layer_entry_insert(list, &drag->icon->layer_link);
198 weston_view_update_transform(drag->icon);
199 pixman_region32_clear(&es->pending.input);
205 /* init to 0 for avoiding a compile warning */
208 fx = wl_fixed_to_double(pointer->x) + drag->dx;
209 fy = wl_fixed_to_double(pointer->y) + drag->dy;
211 fx = wl_fixed_to_double(touch->grab_x) + drag->dx;
212 fy = wl_fixed_to_double(touch->grab_y) + drag->dy;
214 weston_view_set_position(drag->icon, fx, fy);
218 pointer_drag_surface_get_label(struct weston_surface *surface,
219 char *buf, size_t len)
221 return snprintf(buf, len, "pointer drag icon");
225 pointer_drag_surface_configure(struct weston_surface *es,
226 int32_t sx, int32_t sy)
228 struct weston_pointer_drag *drag = es->configure_private;
229 struct weston_pointer *pointer = drag->grab.pointer;
231 assert(es->configure == pointer_drag_surface_configure);
233 drag_surface_configure(&drag->base, pointer, NULL, es, sx, sy);
237 touch_drag_surface_get_label(struct weston_surface *surface,
238 char *buf, size_t len)
240 return snprintf(buf, len, "touch drag icon");
244 touch_drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
246 struct weston_touch_drag *drag = es->configure_private;
247 struct weston_touch *touch = drag->grab.touch;
249 assert(es->configure == touch_drag_surface_configure);
251 drag_surface_configure(&drag->base, NULL, touch, es, sx, sy);
255 destroy_drag_focus(struct wl_listener *listener, void *data)
257 struct weston_drag *drag =
258 container_of(listener, struct weston_drag, focus_listener);
260 drag->focus_resource = NULL;
264 weston_drag_set_focus(struct weston_drag *drag,
265 struct weston_seat *seat,
266 struct weston_view *view,
267 wl_fixed_t sx, wl_fixed_t sy)
269 struct wl_resource *resource, *offer = NULL;
270 struct wl_display *display = seat->compositor->wl_display;
273 if (drag->focus && view && drag->focus->surface == view->surface) {
278 if (drag->focus_resource) {
279 wl_data_device_send_leave(drag->focus_resource);
280 wl_list_remove(&drag->focus_listener.link);
281 drag->focus_resource = NULL;
285 if (!view || !view->surface->resource)
288 if (!drag->data_source &&
289 wl_resource_get_client(view->surface->resource) != drag->client)
292 resource = wl_resource_find_for_client(&seat->drag_resource_list,
293 wl_resource_get_client(view->surface->resource));
297 serial = wl_display_next_serial(display);
299 if (drag->data_source) {
300 offer = weston_data_source_send_offer(drag->data_source,
306 wl_data_device_send_enter(resource, serial, view->surface->resource,
310 drag->focus_listener.notify = destroy_drag_focus;
311 wl_resource_add_destroy_listener(resource, &drag->focus_listener);
312 drag->focus_resource = resource;
316 drag_grab_focus(struct weston_pointer_grab *grab)
318 struct weston_pointer_drag *drag =
319 container_of(grab, struct weston_pointer_drag, grab);
320 struct weston_pointer *pointer = grab->pointer;
321 struct weston_view *view;
324 view = weston_compositor_pick_view(pointer->seat->compositor,
325 pointer->x, pointer->y,
327 if (drag->base.focus != view)
328 weston_drag_set_focus(&drag->base, pointer->seat, view, sx, sy);
332 drag_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
333 wl_fixed_t x, wl_fixed_t y)
335 struct weston_pointer_drag *drag =
336 container_of(grab, struct weston_pointer_drag, grab);
337 struct weston_pointer *pointer = drag->grab.pointer;
341 weston_pointer_move(pointer, x, y);
343 if (drag->base.icon) {
344 fx = wl_fixed_to_double(pointer->x) + drag->base.dx;
345 fy = wl_fixed_to_double(pointer->y) + drag->base.dy;
346 weston_view_set_position(drag->base.icon, fx, fy);
347 weston_view_schedule_repaint(drag->base.icon);
350 if (drag->base.focus_resource) {
351 weston_view_from_global_fixed(drag->base.focus,
352 pointer->x, pointer->y,
355 wl_data_device_send_motion(drag->base.focus_resource, time, sx, sy);
360 data_device_end_drag_grab(struct weston_drag *drag,
361 struct weston_seat *seat)
364 if (weston_view_is_mapped(drag->icon))
365 weston_view_unmap(drag->icon);
367 drag->icon->surface->configure = NULL;
368 weston_surface_set_label_func(drag->icon->surface, NULL);
369 pixman_region32_clear(&drag->icon->surface->pending.input);
370 wl_list_remove(&drag->icon_destroy_listener.link);
371 weston_view_destroy(drag->icon);
374 weston_drag_set_focus(drag, seat, NULL, 0, 0);
378 data_device_end_pointer_drag_grab(struct weston_pointer_drag *drag)
380 struct weston_pointer *pointer = drag->grab.pointer;
382 data_device_end_drag_grab(&drag->base, pointer->seat);
383 weston_pointer_end_grab(pointer);
388 drag_grab_button(struct weston_pointer_grab *grab,
389 uint32_t time, uint32_t button, uint32_t state_w)
391 struct weston_pointer_drag *drag =
392 container_of(grab, struct weston_pointer_drag, grab);
393 struct weston_pointer *pointer = drag->grab.pointer;
394 enum wl_pointer_button_state state = state_w;
396 if (drag->base.focus_resource &&
397 pointer->grab_button == button &&
398 state == WL_POINTER_BUTTON_STATE_RELEASED)
399 wl_data_device_send_drop(drag->base.focus_resource);
401 if (pointer->button_count == 0 &&
402 state == WL_POINTER_BUTTON_STATE_RELEASED) {
403 if (drag->base.data_source)
404 wl_list_remove(&drag->base.data_source_listener.link);
405 data_device_end_pointer_drag_grab(drag);
410 drag_grab_cancel(struct weston_pointer_grab *grab)
412 struct weston_pointer_drag *drag =
413 container_of(grab, struct weston_pointer_drag, grab);
415 if (drag->base.data_source)
416 wl_list_remove(&drag->base.data_source_listener.link);
418 data_device_end_pointer_drag_grab(drag);
421 static const struct weston_pointer_grab_interface pointer_drag_grab_interface = {
429 drag_grab_touch_down(struct weston_touch_grab *grab, uint32_t time,
430 int touch_id, wl_fixed_t sx, wl_fixed_t sy)
435 data_device_end_touch_drag_grab(struct weston_touch_drag *drag)
437 struct weston_touch *touch = drag->grab.touch;
439 data_device_end_drag_grab(&drag->base, touch->seat);
440 weston_touch_end_grab(touch);
445 drag_grab_touch_up(struct weston_touch_grab *grab,
446 uint32_t time, int touch_id)
448 struct weston_touch_drag *touch_drag =
449 container_of(grab, struct weston_touch_drag, grab);
450 struct weston_touch *touch = grab->touch;
452 if (touch_id != touch->grab_touch_id)
455 if (touch_drag->base.focus_resource)
456 wl_data_device_send_drop(touch_drag->base.focus_resource);
457 if (touch_drag->base.data_source)
458 wl_list_remove(&touch_drag->base.data_source_listener.link);
459 data_device_end_touch_drag_grab(touch_drag);
463 drag_grab_touch_focus(struct weston_touch_drag *drag)
465 struct weston_touch *touch = drag->grab.touch;
466 struct weston_view *view;
467 wl_fixed_t view_x, view_y;
469 view = weston_compositor_pick_view(touch->seat->compositor,
470 touch->grab_x, touch->grab_y,
472 if (drag->base.focus != view)
473 weston_drag_set_focus(&drag->base, touch->seat,
474 view, view_x, view_y);
478 drag_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time,
479 int touch_id, wl_fixed_t sx, wl_fixed_t sy)
481 struct weston_touch_drag *touch_drag =
482 container_of(grab, struct weston_touch_drag, grab);
483 struct weston_touch *touch = grab->touch;
484 wl_fixed_t view_x, view_y;
487 if (touch_id != touch->grab_touch_id)
490 drag_grab_touch_focus(touch_drag);
491 if (touch_drag->base.icon) {
492 fx = wl_fixed_to_double(touch->grab_x) + touch_drag->base.dx;
493 fy = wl_fixed_to_double(touch->grab_y) + touch_drag->base.dy;
494 weston_view_set_position(touch_drag->base.icon, fx, fy);
495 weston_view_schedule_repaint(touch_drag->base.icon);
498 if (touch_drag->base.focus_resource) {
499 weston_view_from_global_fixed(touch_drag->base.focus,
500 touch->grab_x, touch->grab_y,
502 wl_data_device_send_motion(touch_drag->base.focus_resource, time,
508 drag_grab_touch_frame(struct weston_touch_grab *grab)
513 drag_grab_touch_cancel(struct weston_touch_grab *grab)
515 struct weston_touch_drag *touch_drag =
516 container_of(grab, struct weston_touch_drag, grab);
518 if (touch_drag->base.data_source)
519 wl_list_remove(&touch_drag->base.data_source_listener.link);
520 data_device_end_touch_drag_grab(touch_drag);
523 static const struct weston_touch_grab_interface touch_drag_grab_interface = {
524 drag_grab_touch_down,
526 drag_grab_touch_motion,
527 drag_grab_touch_frame,
528 drag_grab_touch_cancel
532 destroy_pointer_data_device_source(struct wl_listener *listener, void *data)
534 struct weston_pointer_drag *drag = container_of(listener,
535 struct weston_pointer_drag, base.data_source_listener);
537 data_device_end_pointer_drag_grab(drag);
541 handle_drag_icon_destroy(struct wl_listener *listener, void *data)
543 struct weston_drag *drag = container_of(listener, struct weston_drag,
544 icon_destroy_listener);
550 weston_pointer_start_drag(struct weston_pointer *pointer,
551 struct weston_data_source *source,
552 struct weston_surface *icon,
553 struct wl_client *client)
555 struct weston_pointer_drag *drag;
557 drag = zalloc(sizeof *drag);
561 drag->grab.interface = &pointer_drag_grab_interface;
562 drag->base.client = client;
563 drag->base.data_source = source;
566 drag->base.icon = weston_view_create(icon);
567 if (drag->base.icon == NULL) {
572 drag->base.icon_destroy_listener.notify = handle_drag_icon_destroy;
573 wl_signal_add(&icon->destroy_signal,
574 &drag->base.icon_destroy_listener);
576 icon->configure = pointer_drag_surface_configure;
577 icon->configure_private = drag;
578 weston_surface_set_label_func(icon,
579 pointer_drag_surface_get_label);
581 drag->base.icon = NULL;
585 drag->base.data_source_listener.notify = destroy_pointer_data_device_source;
586 wl_signal_add(&source->destroy_signal,
587 &drag->base.data_source_listener);
590 weston_pointer_set_focus(pointer, NULL,
591 wl_fixed_from_int(0), wl_fixed_from_int(0));
592 weston_pointer_start_grab(pointer, &drag->grab);
598 destroy_touch_data_device_source(struct wl_listener *listener, void *data)
600 struct weston_touch_drag *drag = container_of(listener,
601 struct weston_touch_drag, base.data_source_listener);
603 data_device_end_touch_drag_grab(drag);
607 weston_touch_start_drag(struct weston_touch *touch,
608 struct weston_data_source *source,
609 struct weston_surface *icon,
610 struct wl_client *client)
612 struct weston_touch_drag *drag;
614 drag = zalloc(sizeof *drag);
618 drag->grab.interface = &touch_drag_grab_interface;
619 drag->base.client = client;
620 drag->base.data_source = source;
623 drag->base.icon = weston_view_create(icon);
624 if (drag->base.icon == NULL) {
629 drag->base.icon_destroy_listener.notify = handle_drag_icon_destroy;
630 wl_signal_add(&icon->destroy_signal,
631 &drag->base.icon_destroy_listener);
633 icon->configure = touch_drag_surface_configure;
634 icon->configure_private = drag;
635 weston_surface_set_label_func(icon,
636 touch_drag_surface_get_label);
638 drag->base.icon = NULL;
642 drag->base.data_source_listener.notify = destroy_touch_data_device_source;
643 wl_signal_add(&source->destroy_signal,
644 &drag->base.data_source_listener);
647 weston_touch_start_grab(touch, &drag->grab);
649 drag_grab_touch_focus(drag);
655 data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
656 struct wl_resource *source_resource,
657 struct wl_resource *origin_resource,
658 struct wl_resource *icon_resource, uint32_t serial)
660 struct weston_seat *seat = wl_resource_get_user_data(resource);
661 struct weston_surface *origin = wl_resource_get_user_data(origin_resource);
662 struct weston_data_source *source = NULL;
663 struct weston_surface *icon = NULL;
664 int is_pointer_grab, is_touch_grab;
667 is_pointer_grab = seat->pointer &&
668 seat->pointer->button_count == 1 &&
669 seat->pointer->grab_serial == serial &&
670 seat->pointer->focus &&
671 seat->pointer->focus->surface == origin;
673 is_touch_grab = seat->touch &&
674 seat->touch->num_tp == 1 &&
675 seat->touch->grab_serial == serial &&
676 seat->touch->focus &&
677 seat->touch->focus->surface == origin;
679 if (!is_pointer_grab && !is_touch_grab)
682 /* FIXME: Check that the data source type array isn't empty. */
685 source = wl_resource_get_user_data(source_resource);
687 icon = wl_resource_get_user_data(icon_resource);
690 if (weston_surface_set_role(icon, "wl_data_device-icon",
692 WL_DATA_DEVICE_ERROR_ROLE) < 0)
697 ret = weston_pointer_start_drag(seat->pointer, source, icon, client);
698 else if (is_touch_grab)
699 ret = weston_touch_start_drag(seat->touch, source, icon, client);
702 wl_resource_post_no_memory(resource);
706 destroy_selection_data_source(struct wl_listener *listener, void *data)
708 struct weston_seat *seat = container_of(listener, struct weston_seat,
709 selection_data_source_listener);
710 struct wl_resource *data_device;
711 struct weston_surface *focus = NULL;
713 seat->selection_data_source = NULL;
716 focus = seat->keyboard->focus;
717 if (focus && focus->resource) {
718 data_device = wl_resource_find_for_client(&seat->drag_resource_list,
719 wl_resource_get_client(focus->resource));
721 wl_data_device_send_selection(data_device, NULL);
724 wl_signal_emit(&seat->selection_signal, seat);
727 /** \brief Send the selection to the specified client
729 * This function creates a new wl_data_offer if there is a wl_data_source
730 * currently set as the selection and sends it to the specified client,
731 * followed by the wl_data_device.selection() event.
732 * If there is no current selection the wl_data_device.selection() event
733 * will carry a NULL wl_data_offer.
735 * If the client does not have a wl_data_device for the specified seat
736 * nothing will be done.
738 * \param seat The seat owning the wl_data_device used to send the events.
739 * \param client The client to which to send the selection.
742 weston_seat_send_selection(struct weston_seat *seat, struct wl_client *client)
744 struct wl_resource *data_device, *offer;
746 data_device = wl_resource_find_for_client(&seat->drag_resource_list,
748 if (data_device && seat->selection_data_source) {
749 offer = weston_data_source_send_offer(seat->selection_data_source,
751 wl_data_device_send_selection(data_device, offer);
752 } else if (data_device) {
753 wl_data_device_send_selection(data_device, NULL);
758 weston_seat_set_selection(struct weston_seat *seat,
759 struct weston_data_source *source, uint32_t serial)
761 struct weston_surface *focus = NULL;
763 if (seat->selection_data_source &&
764 seat->selection_serial - serial < UINT32_MAX / 2)
767 if (seat->selection_data_source) {
768 seat->selection_data_source->cancel(seat->selection_data_source);
769 wl_list_remove(&seat->selection_data_source_listener.link);
770 seat->selection_data_source = NULL;
773 seat->selection_data_source = source;
774 seat->selection_serial = serial;
777 focus = seat->keyboard->focus;
778 if (focus && focus->resource) {
779 weston_seat_send_selection(seat, wl_resource_get_client(focus->resource));
782 wl_signal_emit(&seat->selection_signal, seat);
785 seat->selection_data_source_listener.notify =
786 destroy_selection_data_source;
787 wl_signal_add(&source->destroy_signal,
788 &seat->selection_data_source_listener);
793 data_device_set_selection(struct wl_client *client,
794 struct wl_resource *resource,
795 struct wl_resource *source_resource, uint32_t serial)
797 if (!source_resource)
800 /* FIXME: Store serial and check against incoming serial here. */
801 weston_seat_set_selection(wl_resource_get_user_data(resource),
802 wl_resource_get_user_data(source_resource),
806 data_device_release(struct wl_client *client, struct wl_resource *resource)
808 wl_resource_destroy(resource);
811 static const struct wl_data_device_interface data_device_interface = {
812 data_device_start_drag,
813 data_device_set_selection,
818 destroy_data_source(struct wl_resource *resource)
820 struct weston_data_source *source =
821 wl_resource_get_user_data(resource);
824 wl_signal_emit(&source->destroy_signal, source);
826 wl_array_for_each(p, &source->mime_types)
829 wl_array_release(&source->mime_types);
835 client_source_accept(struct weston_data_source *source,
836 uint32_t time, const char *mime_type)
838 wl_data_source_send_target(source->resource, mime_type);
842 client_source_send(struct weston_data_source *source,
843 const char *mime_type, int32_t fd)
845 wl_data_source_send_send(source->resource, mime_type, fd);
850 client_source_cancel(struct weston_data_source *source)
852 wl_data_source_send_cancelled(source->resource);
856 create_data_source(struct wl_client *client,
857 struct wl_resource *resource, uint32_t id)
859 struct weston_data_source *source;
861 source = malloc(sizeof *source);
862 if (source == NULL) {
863 wl_resource_post_no_memory(resource);
867 wl_signal_init(&source->destroy_signal);
868 source->accept = client_source_accept;
869 source->send = client_source_send;
870 source->cancel = client_source_cancel;
872 wl_array_init(&source->mime_types);
875 wl_resource_create(client, &wl_data_source_interface, 1, id);
876 wl_resource_set_implementation(source->resource, &data_source_interface,
877 source, destroy_data_source);
880 static void unbind_data_device(struct wl_resource *resource)
882 wl_list_remove(wl_resource_get_link(resource));
886 get_data_device(struct wl_client *client,
887 struct wl_resource *manager_resource,
888 uint32_t id, struct wl_resource *seat_resource)
890 struct weston_seat *seat = wl_resource_get_user_data(seat_resource);
891 struct wl_resource *resource;
893 resource = wl_resource_create(client,
894 &wl_data_device_interface,
895 wl_resource_get_version(manager_resource),
897 if (resource == NULL) {
898 wl_resource_post_no_memory(manager_resource);
902 wl_list_insert(&seat->drag_resource_list,
903 wl_resource_get_link(resource));
904 wl_resource_set_implementation(resource, &data_device_interface,
905 seat, unbind_data_device);
908 static const struct wl_data_device_manager_interface manager_interface = {
914 bind_manager(struct wl_client *client,
915 void *data, uint32_t version, uint32_t id)
917 struct wl_resource *resource;
919 resource = wl_resource_create(client,
920 &wl_data_device_manager_interface,
922 if (resource == NULL) {
923 wl_client_post_no_memory(client);
927 wl_resource_set_implementation(resource, &manager_interface,
932 wl_data_device_set_keyboard_focus(struct weston_seat *seat)
934 struct weston_surface *focus;
939 focus = seat->keyboard->focus;
940 if (!focus || !focus->resource)
943 weston_seat_send_selection(seat, wl_resource_get_client(focus->resource));
947 wl_data_device_manager_init(struct wl_display *display)
949 if (wl_global_create(display,
950 &wl_data_device_manager_interface, 2,
951 NULL, bind_manager) == NULL)