diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 97e5efbdd..b9b1ce251 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -849,7 +849,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, /*printf("WAYLAND INTERFACE: %s\n", interface);*/ if (SDL_strcmp(interface, "wl_compositor") == 0) { - d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, SDL_min(3, version)); + d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, SDL_min(4, version)); } else if (SDL_strcmp(interface, "wl_output") == 0) { Wayland_add_display(d, id); } else if (SDL_strcmp(interface, "wl_seat") == 0) { diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 2abb2d54e..a4e9f591e 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -522,9 +522,17 @@ surface_damage_frame_done(void *data, struct wl_callback *cb, uint32_t time) { SDL_WindowData *wind = (SDL_WindowData *)data; - /* Set the damage region. */ - wl_surface_damage(wind->surface, 0, 0, - wind->window_width, wind->window_height); + /* + * wl_surface.damage_buffer is the preferred method of setting the damage region + * on compositor version 4 and above. + */ + if (wl_compositor_get_version(wind->waylandData->compositor) >= 4) { + wl_surface_damage_buffer(wind->surface, 0, 0, + wind->drawable_width, wind->drawable_height); + } else { + wl_surface_damage(wind->surface, 0, 0, + wind->window_width, wind->window_height); + } wl_callback_destroy(cb); wind->surface_damage_frame_callback = wl_surface_frame(wind->surface);