mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
data-device: fix missing listener removal
This commit is contained in:
parent
703a160078
commit
c20d413f8a
1 changed files with 10 additions and 12 deletions
|
@ -145,16 +145,14 @@ static void seat_handle_selection_source_destroy(
|
||||||
struct wl_listener *listener, void *data) {
|
struct wl_listener *listener, void *data) {
|
||||||
struct wlr_seat *seat =
|
struct wlr_seat *seat =
|
||||||
wl_container_of(listener, seat, selection_source_destroy);
|
wl_container_of(listener, seat, selection_source_destroy);
|
||||||
struct wlr_seat_client *seat_client = seat->keyboard_state.focused_client;
|
|
||||||
|
|
||||||
wl_list_remove(&seat->selection_source_destroy.link);
|
wl_list_remove(&seat->selection_source_destroy.link);
|
||||||
seat->selection_source = NULL;
|
seat->selection_source = NULL;
|
||||||
|
|
||||||
if (seat_client && seat->keyboard_state.focused_surface) {
|
struct wlr_seat_client *focused_client =
|
||||||
struct wl_resource *resource;
|
seat->keyboard_state.focused_client;
|
||||||
wl_resource_for_each(resource, &seat_client->data_devices) {
|
if (focused_client != NULL) {
|
||||||
wl_data_device_send_selection(resource, NULL);
|
seat_client_send_selection(focused_client);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_signal_emit_safe(&seat->events.set_selection, seat);
|
wlr_signal_emit_safe(&seat->events.set_selection, seat);
|
||||||
|
@ -171,12 +169,6 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
|
||||||
seat->selection_source = source;
|
seat->selection_source = source;
|
||||||
seat->selection_serial = serial;
|
seat->selection_serial = serial;
|
||||||
|
|
||||||
struct wlr_seat_client *focused_client =
|
|
||||||
seat->keyboard_state.focused_client;
|
|
||||||
if (focused_client) {
|
|
||||||
seat_client_send_selection(focused_client);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
seat->selection_source_destroy.notify =
|
seat->selection_source_destroy.notify =
|
||||||
seat_handle_selection_source_destroy;
|
seat_handle_selection_source_destroy;
|
||||||
|
@ -184,6 +176,12 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
|
||||||
&seat->selection_source_destroy);
|
&seat->selection_source_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_seat_client *focused_client =
|
||||||
|
seat->keyboard_state.focused_client;
|
||||||
|
if (focused_client) {
|
||||||
|
seat_client_send_selection(focused_client);
|
||||||
|
}
|
||||||
|
|
||||||
wlr_signal_emit_safe(&seat->events.set_selection, seat);
|
wlr_signal_emit_safe(&seat->events.set_selection, seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue