mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-23 10:53:27 +08:00
wayland: Send a display removed event when a display is disconnected
An event would be dispatched if a display was dynamically added after initialization, but not if one was removed.
This commit is contained in:
parent
73e0e8cf5b
commit
458f616c53
@ -1130,7 +1130,7 @@ static bool Wayland_add_display(SDL_VideoData *d, uint32_t id, uint32_t version)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void Wayland_free_display(SDL_VideoDisplay *display)
|
||||
static void Wayland_free_display(SDL_VideoDisplay *display, bool send_event)
|
||||
{
|
||||
if (display) {
|
||||
SDL_DisplayData *display_data = display->internal;
|
||||
@ -1154,7 +1154,7 @@ static void Wayland_free_display(SDL_VideoDisplay *display)
|
||||
wl_output_destroy(display_data->output);
|
||||
}
|
||||
|
||||
SDL_DelVideoDisplay(display->id, false);
|
||||
SDL_DelVideoDisplay(display->id, send_event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1282,7 +1282,7 @@ static void display_remove_global(void *data, struct wl_registry *registry, uint
|
||||
for (int i = 0; i < d->output_count; ++i) {
|
||||
SDL_DisplayData *disp = d->output_list[i];
|
||||
if (disp->registry_id == id) {
|
||||
Wayland_free_display(SDL_GetVideoDisplay(disp->display));
|
||||
Wayland_free_display(SDL_GetVideoDisplay(disp->display), true);
|
||||
|
||||
if (i < d->output_count) {
|
||||
SDL_memmove(&d->output_list[i], &d->output_list[i + 1], sizeof(SDL_DisplayData *) * (d->output_count - i - 1));
|
||||
@ -1429,7 +1429,7 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
|
||||
|
||||
for (i = _this->num_displays - 1; i >= 0; --i) {
|
||||
SDL_VideoDisplay *display = _this->displays[i];
|
||||
Wayland_free_display(display);
|
||||
Wayland_free_display(display, false);
|
||||
}
|
||||
SDL_free(data->output_list);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user