summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-10-25 10:22:40 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-10-25 10:30:11 +0200
commitbef2135a44ee07b68fe255c8ae4491b2e45e0895 (patch)
tree8cc816bd97dfa34d7ac6d8ea9138b1ce3864a48e /video
parent96432241bde0bf61a193bbc0503a6a6955179f69 (diff)
downloadmpv-bef2135a44ee07b68fe255c8ae4491b2e45e0895.tar.bz2
mpv-bef2135a44ee07b68fe255c8ae4491b2e45e0895.tar.xz
wayland: fix fullscreen transparent border regions
The default behavior of weston changed some time ago to not fill the surface black for fullscreen windows. Now let mpv draw the whole screen in fullscreen mode.
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c50
-rw-r--r--video/out/wayland_common.h2
2 files changed, 30 insertions, 22 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index fedb0fc561..239e57519b 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -547,32 +547,34 @@ static void shedule_resize(struct vo_wayland_state *wl,
if (height < minimum_size)
height = minimum_size;
- /* 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)
+ // 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:
width = wl->window.aspect * height;
- else
+ 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;
+ break;
+ default:
+ if (wl->window.aspect < temp_aspect)
+ width = wl->window.aspect * height;
+ else
+ height = (1 / wl->window.aspect) * width;
+ break;
+ }
}
- wl->vo->dwidth = width;
- wl->vo->dheight = height;
-
if (edges & WL_SHELL_SURFACE_RESIZE_LEFT)
x = wl->window.width - width;
else
@@ -588,6 +590,8 @@ static void shedule_resize(struct vo_wayland_state *wl,
wl->window.sh_x = x;
wl->window.sh_y = y;
wl->window.events |= VO_EVENT_RESIZE;
+ wl->vo->dwidth = width;
+ wl->vo->dheight = height;
}
@@ -774,6 +778,7 @@ static void vo_wayland_fullscreen (struct vo *vo)
if (vo->opts->fullscreen) {
MP_DBG(wl, "going fullscreen\n");
+ wl->window.is_fullscreen = true;
wl->window.p_width = wl->window.width;
wl->window.p_height = wl->window.height;
wl_shell_surface_set_fullscreen(wl->window.shell_surface,
@@ -783,6 +788,7 @@ static void vo_wayland_fullscreen (struct vo *vo)
else {
MP_DBG(wl, "leaving fullscreen\n");
+ wl->window.is_fullscreen = false;
wl_shell_surface_set_toplevel(wl->window.shell_surface);
shedule_resize(wl, 0, wl->window.p_width, wl->window.p_height);
}
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 483c0ef1dd..956069707a 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -70,6 +70,8 @@ struct vo_wayland_state {
int32_t sh_y;
float aspect;
+ bool is_fullscreen; // don't keep aspect ratio in fullscreen mode
+
struct wl_surface *surface;
int32_t surf_x;
int32_t surf_y;