[Spice-devel] [PATCH spice-gtk] Send monitor config if at least one monitor has dimensions
Pavel Grunt
pgrunt at redhat.com
Mon Jul 13 04:20:58 PDT 2015
On Fri, 2015-07-10 at 14:58 +0200, Fabiano FidĂȘncio wrote:
> Hey,
>
> On Fri, Jul 10, 2015 at 1:13 PM, Pavel Grunt <pgrunt at redhat.com> wrote:
> > If a client (virt-manager, spicy) is not setting display dimensions
> > and the "resize-guest" property is disabled, spice-gtk sends a wrong
> > monitor config message where all the monitors have width = heigh = 0
> > when the agent connects. This message can confuse the guest, in that
> > case the guest will change the resolution of its monitor.
>
> I would mention that it is a regression introduced by
> 28312b8d1e287a320851e8828825f2ca138d8b0b, as you already pointed me
> out in a private discussion.
>
ok
>
> >
> > Resolves:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1240721
> > ---
> > src/channel-main.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > diff --git a/src/channel-main.c b/src/channel-main.c
> > index 84161cd..3bd5a02 100644
> > --- a/src/channel-main.c
> > +++ b/src/channel-main.c
> > @@ -1415,6 +1415,22 @@ static void agent_clipboard_release(SpiceMainChannel
> > *channel, guint selection)
> > agent_msg_queue(channel, VD_AGENT_CLIPBOARD_RELEASE, msgsize, msg);
> > }
> >
> > +static gboolean any_display_has_dimensions(SpiceMainChannel *channel)
> > +{
> > + SpiceMainChannelPrivate *c;
> > + guint i;
> > +
> > + g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
> > + c = channel->priv;
> > +
> > + for (i = 0; i < MAX_DISPLAY; i++) {
> > + if (c->display[i].width > 0 && c->display[i].height > 0)
> > + return TRUE;
> > + }
> > +
> > + return FALSE;
> > +}
> > +
> > /* main context*/
> > static gboolean timer_set_display(gpointer data)
> > {
> > @@ -1427,6 +1443,11 @@ static gboolean timer_set_display(gpointer data)
> > if (!c->agent_connected)
> > return FALSE;
> >
> > + if (!any_display_has_dimensions(channel)) {
> > + SPICE_DEBUG("Not sending monitors config, at least one monitor must
> > have dimensions");
> > + return FALSE;
> > + }
> > +
> > session = spice_channel_get_session(SPICE_CHANNEL(channel));
> >
> > if (!spice_main_agent_test_capability(channel,
> > VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) {
> > --
> > 2.4.5
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
> Looks good, ACK!
>
Pushed, thanks
Pavel
More information about the Spice-devel
mailing list