mirror of
https://github.com/mpv-player/mpv
synced 2025-01-29 03:02:53 +00:00
wayland: set an opaque region
Apparently a part of the wayland spec. A compositor may use a surface that has set part of itself as opaque for various optimizations. For mpv, we simply set the entire surface as opaque as long as the user has not set alpha=yes (note: alpha is technically broken in the wayland EGL backend at the time of this commit but oh well). wlshm is always opaque. Fixes #8125.
This commit is contained in:
parent
dcec6d9556
commit
34b8adc456
@ -122,6 +122,13 @@ static void resize(struct ra_ctx *ctx)
|
||||
const int32_t width = wl->scaling*mp_rect_w(wl->geometry);
|
||||
const int32_t height = wl->scaling*mp_rect_h(wl->geometry);
|
||||
|
||||
if (!ctx->opts.want_alpha) {
|
||||
struct wl_region *region = wl_compositor_create_region(wl->compositor);
|
||||
wl_region_add(region, 0, 0, width, height);
|
||||
wl_surface_set_opaque_region(wl->surface, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
wl_surface_set_buffer_scale(wl->surface, wl->scaling);
|
||||
|
||||
if (p->egl_window)
|
||||
|
@ -201,6 +201,11 @@ static int resize(struct vo *vo)
|
||||
const int32_t height = wl->scaling * mp_rect_h(wl->geometry);
|
||||
struct buffer *buf;
|
||||
|
||||
struct wl_region *region = wl_compositor_create_region(wl->compositor);
|
||||
wl_region_add(region, 0, 0, width, height);
|
||||
wl_surface_set_opaque_region(wl->surface, region);
|
||||
wl_region_destroy(region);
|
||||
|
||||
vo->want_redraw = true;
|
||||
vo->dwidth = width;
|
||||
vo->dheight = height;
|
||||
|
@ -208,6 +208,13 @@ static bool resize(struct ra_ctx *ctx)
|
||||
const int32_t width = wl->scaling*mp_rect_w(wl->geometry);
|
||||
const int32_t height = wl->scaling*mp_rect_h(wl->geometry);
|
||||
|
||||
if (!ctx->opts.want_alpha) {
|
||||
struct wl_region *region = wl_compositor_create_region(wl->compositor);
|
||||
wl_region_add(region, 0, 0, width, height);
|
||||
wl_surface_set_opaque_region(wl->surface, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
wl_surface_set_buffer_scale(wl->surface, wl->scaling);
|
||||
bool ok = ra_vk_ctx_resize(ctx, width, height);
|
||||
if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized)
|
||||
|
Loading…
Reference in New Issue
Block a user