mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-18 06:47:31 -04:00
Merge branch 'output-destroy-surface-leave' into 'master'
wlr_compositor: Send leave event when output is destroyed Closes #3559 See merge request wlroots/wlroots!3960
This commit is contained in:
commit
519202b0b1
2 changed files with 17 additions and 10 deletions
|
|
@ -451,12 +451,13 @@ void wlr_output_destroy(struct wlr_output *output) {
|
|||
}
|
||||
|
||||
wl_list_remove(&output->display_destroy.link);
|
||||
wlr_output_destroy_global(output);
|
||||
output_clear_back_buffer(output);
|
||||
|
||||
wl_signal_emit_mutable(&output->events.destroy, output);
|
||||
wlr_addon_set_finish(&output->addons);
|
||||
|
||||
wlr_output_destroy_global(output);
|
||||
|
||||
// The backend is responsible for free-ing the list of modes
|
||||
|
||||
struct wlr_output_cursor *cursor, *tmp_cursor;
|
||||
|
|
|
|||
|
|
@ -954,11 +954,24 @@ static void surface_handle_output_bind(struct wl_listener *listener,
|
|||
}
|
||||
}
|
||||
|
||||
static void surface_send_leave(struct wlr_surface_output *surface_output) {
|
||||
struct wl_client *client = wl_resource_get_client(surface_output->surface->resource);
|
||||
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &surface_output->output->resources) {
|
||||
if (client == wl_resource_get_client(resource)) {
|
||||
wl_surface_send_leave(surface_output->surface->resource, resource);
|
||||
}
|
||||
}
|
||||
|
||||
surface_output_destroy(surface_output);
|
||||
}
|
||||
|
||||
static void surface_handle_output_destroy(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct wlr_surface_output *surface_output =
|
||||
wl_container_of(listener, surface_output, destroy);
|
||||
surface_output_destroy(surface_output);
|
||||
surface_send_leave(surface_output);
|
||||
}
|
||||
|
||||
void wlr_surface_send_enter(struct wlr_surface *surface,
|
||||
|
|
@ -996,19 +1009,12 @@ void wlr_surface_send_enter(struct wlr_surface *surface,
|
|||
|
||||
void wlr_surface_send_leave(struct wlr_surface *surface,
|
||||
struct wlr_output *output) {
|
||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
||||
struct wlr_surface_output *surface_output, *tmp;
|
||||
struct wl_resource *resource;
|
||||
|
||||
wl_list_for_each_safe(surface_output, tmp,
|
||||
&surface->current_outputs, link) {
|
||||
if (surface_output->output == output) {
|
||||
surface_output_destroy(surface_output);
|
||||
wl_resource_for_each(resource, &output->resources) {
|
||||
if (client == wl_resource_get_client(resource)) {
|
||||
wl_surface_send_leave(surface->resource, resource);
|
||||
}
|
||||
}
|
||||
surface_send_leave(surface_output);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue