From 9772f084bff9d61f3a08b4731f72a95e982da716 Mon Sep 17 00:00:00 2001 From: Pascal Nowack Date: Mon, 16 Dec 2019 18:00:19 +0000 Subject: [PATCH] screen-cast: Fix window recording on HiDPI Using the same scale for the window as the logical monitor only works correctly when having the experimental 'scale-monitor-framebuffer' feature enabled. Without this experimental feature, the stream will contain a black screen, where the actual window only takes a small part of it. Therefore, use a scale of 1 for the non- experimental case. Patch is based on commit 3fa6a92cc5dda6ab3939c3e982185f6caf453360. https://gitlab.gnome.org/GNOME/mutter/merge_requests/976 (cherry picked from commit e89cea8e5a9c944919cc0632b88bd68432778806) --- src/backends/meta-screen-cast-window-stream.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backends/meta-screen-cast-window-stream.c b/src/backends/meta-screen-cast-window-stream.c index 50d1806cd..b9a732cba 100644 --- a/src/backends/meta-screen-cast-window-stream.c +++ b/src/backends/meta-screen-cast-window-stream.c @@ -226,11 +226,15 @@ meta_screen_cast_window_stream_initable_init (GInitable *initable, G_CALLBACK (on_window_unmanaged), window_stream); + if (meta_is_stage_views_scaled ()) + scale = (int) ceilf (meta_logical_monitor_get_scale (logical_monitor)); + else + scale = 1; + /* We cannot set the stream size to the exact size of the window, because * windows can be resized, whereas streams cannot. * So we set a size equals to the size of the logical monitor for the window. */ - scale = (int) ceil (meta_logical_monitor_get_scale (logical_monitor)); window_stream->logical_width = logical_monitor->rect.width; window_stream->logical_height = logical_monitor->rect.height; window_stream->stream_width = logical_monitor->rect.width * scale;