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.
This commit is contained in:
Alexander Preisinger 2014-01-02 20:30:21 +01:00
parent ba101abfbe
commit 52fa38079d
2 changed files with 22 additions and 22 deletions

View File

@ -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,

View File

@ -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;