screen-cast-window-stream: Set the size property to the logical size

As the stream size is the logical monitor size multiplied with the ceil
of the logical monitor scale, the corresponding logical size, which is
what should be passed via the size property on the D-Bus object, should
be the logical monitor size.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
This commit is contained in:
Jonas Ådahl 2019-01-21 19:17:57 +01:00
parent c22edeff1f
commit 870f38542d

View File

@ -44,6 +44,8 @@ struct _MetaScreenCastWindowStream
int stream_width; int stream_width;
int stream_height; int stream_height;
int logical_width;
int logical_height;
unsigned long window_unmanaged_handler_id; unsigned long window_unmanaged_handler_id;
}; };
@ -128,8 +130,8 @@ meta_screen_cast_window_stream_set_parameters (MetaScreenCastStream *stream,
g_variant_builder_add (parameters_builder, "{sv}", g_variant_builder_add (parameters_builder, "{sv}",
"size", "size",
g_variant_new ("(ii)", g_variant_new ("(ii)",
bounds.width, window_stream->logical_width,
bounds.height)); window_stream->logical_height));
} }
static void static void
@ -237,6 +239,8 @@ meta_screen_cast_window_stream_initable_init (GInitable *initable,
* So we set a size equals to the size of the logical monitor for the window. * 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)); 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; window_stream->stream_width = logical_monitor->rect.width * scale;
window_stream->stream_height = logical_monitor->rect.height * scale; window_stream->stream_height = logical_monitor->rect.height * scale;