clipboard: add seat destroy signal handler

Rafal Mielniczuk 13 years ago committed by Kristian Høgsberg
parent 28f59b027a
commit 96ddcb25ab
  1. 14
      src/clipboard.c

@ -243,6 +243,17 @@ clipboard_set_selection(struct wl_listener *listener, void *data)
return; return;
} }
static void
clipboard_destroy(struct wl_listener *listener, void *data)
{
struct clipboard *clipboard =
container_of(listener, struct clipboard, destroy_listener);
wl_list_remove(&clipboard->selection_listener.link);
free(clipboard);
}
struct clipboard * struct clipboard *
clipboard_create(struct weston_seat *seat) clipboard_create(struct weston_seat *seat)
{ {
@ -255,9 +266,12 @@ clipboard_create(struct weston_seat *seat)
clipboard->seat = seat; clipboard->seat = seat;
clipboard->selection_listener.notify = clipboard_set_selection; clipboard->selection_listener.notify = clipboard_set_selection;
clipboard->destroy_listener.notify = clipboard_destroy;
wl_signal_add(&seat->seat.selection_signal, wl_signal_add(&seat->seat.selection_signal,
&clipboard->selection_listener); &clipboard->selection_listener);
wl_signal_add(&seat->seat.destroy_signal,
&clipboard->destroy_listener);
return clipboard; return clipboard;
} }

Loading…
Cancel
Save