From e26286dfdbf2624412a3d338acd2aea6b104823b Mon Sep 17 00:00:00 2001 From: Alexander Preisinger Date: Thu, 2 Jan 2014 20:30:21 +0100 Subject: wayland/opengl: fix garbage borders It seems mpv draws garbage in those regions. Now we calculate the aspect and let weston draw the black borders. --- video/out/gl_wayland.c | 1 - video/out/wayland_common.c | 43 ++++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/video/out/gl_wayland.c b/video/out/gl_wayland.c index bf06e513be..9fea33b28f 100644 --- a/video/out/gl_wayland.c +++ b/video/out/gl_wayland.c @@ -167,7 +167,6 @@ static void egl_create_window(struct vo_wayland_state *wl, egl_ctx->egl.ctx); wl_display_dispatch_pending(wl->display.display); - } static bool config_window_wayland(struct MPGLContext *ctx, diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index f73dc0c2ca..1a4414da3d 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -587,29 +587,27 @@ static void shedule_resize(struct vo_wayland_state *wl, // don't keep the aspect ration in fullscreen mode, because the compositor // shows the desktop in the border regions if the video has not the same // aspect ration as the screen - if (!wl->window.is_fullscreen) { - /* if only the height is changed we have to calculate the width - * in any other case we calculate the height */ - switch (edges) { - case WL_SHELL_SURFACE_RESIZE_TOP: - case WL_SHELL_SURFACE_RESIZE_BOTTOM: + /* if only the height is changed we have to calculate the width + * in any other case we calculate the height */ + switch (edges) { + case WL_SHELL_SURFACE_RESIZE_TOP: + case WL_SHELL_SURFACE_RESIZE_BOTTOM: + width = wl->window.aspect * height; + break; + case WL_SHELL_SURFACE_RESIZE_LEFT: + case WL_SHELL_SURFACE_RESIZE_RIGHT: + case WL_SHELL_SURFACE_RESIZE_TOP_LEFT: // just a preference + case WL_SHELL_SURFACE_RESIZE_TOP_RIGHT: + case WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT: + case WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT: + height = (1 / wl->window.aspect) * width; + break; + default: + if (wl->window.aspect < temp_aspect) width = wl->window.aspect * height; - break; - case WL_SHELL_SURFACE_RESIZE_LEFT: - case WL_SHELL_SURFACE_RESIZE_RIGHT: - case WL_SHELL_SURFACE_RESIZE_TOP_LEFT: // just a preference - case WL_SHELL_SURFACE_RESIZE_TOP_RIGHT: - case WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT: - case WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT: + else height = (1 / wl->window.aspect) * width; - break; - default: - if (wl->window.aspect < temp_aspect) - width = wl->window.aspect * height; - else - height = (1 / wl->window.aspect) * width; - break; - } + break; } if (edges & WL_SHELL_SURFACE_RESIZE_LEFT) @@ -986,6 +984,9 @@ bool vo_wayland_config (struct vo *vo, uint32_t d_width, wl->window.p_height = d_height; wl->window.aspect = wl->window.width / (float) MPMAX(wl->window.height, 1); + vo_wayland_ontop(vo); // workaround for the weston fullscreen bug + // I can't set fullscreen twice so I need to change back and forth to get + // the right configure event from weston. vo_wayland_fullscreen(vo); return true; -- cgit v1.2.3