[Spice-devel] [PATCH spice-gtk 3/3] main: Do not request to resize when have desired size
Marc-André Lureau
marcandre.lureau at gmail.com
Wed Jul 27 09:16:18 UTC 2016
Hi
On Tue, Jul 26, 2016 at 7:55 PM, Pavel Grunt <pgrunt at redhat.com> wrote:
> Check for current size of monitors stored in display channels and avoid
> sending request to resize if it matches new requested size.
>
For the same reason as previous patch, I don't think that assumption
work as there might be pending configuration changes. It is best to
tell the server the config you want, in all cases, and it should do
his best to match it. However, if it doesn't match, the client
shouldn't go wild and request it again (the client should not send
back a different config as a result of display channel config change,
only on UI display resize or user request).
> Related: https://bugs.freedesktop.org/show_bug.cgi?id=94950
> ---
> src/channel-main.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/src/channel-main.c b/src/channel-main.c
> index cf43649..ede3d87 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -1074,7 +1074,28 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
>
> if (spice_main_agent_test_capability(channel,
> VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) {
> + gboolean config_changed = FALSE;
> + const SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(channel));
> monitors = SPICE_N_ELEMENTS(c->display);
> + for (i = 0; i < monitors; i++) { /* check whether the configuration has changed */
> + SpiceDisplayConfig config;
> + if (spice_session_get_display_config(session, i, &config)) {
> + if (memcmp(&config, &c->display[i], sizeof(SpiceDisplayConfig)) != 0) {
> + config_changed = TRUE;
> + break;
> + }
> + } else {
> + if (c->display[i].display_state == DISPLAY_ENABLED) {
> + /* request to enable display i */
> + config_changed = TRUE;
> + break;
> + }
> + }
> + }
> + if (!config_changed) {
> + SPICE_DEBUG("monitor configuration has not changed");
> + return TRUE;
> + }
> } else {
> monitors = 0;
> for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) {
> --
> 2.9.2
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
--
Marc-André Lureau
More information about the Spice-devel
mailing list