[virt-tools-list] [PATCH] VirtViewerDisplaySpice: rename AUTO_RESIZE_FULLSCREEN

Marc-André Lureau marcandre.lureau at gmail.com
Fri Sep 20 12:25:34 UTC 2013


Actually, looking more into this part of the code today, I see that it
uses a different path, specific to fullscreen in resize().

AUTO_RESIZE_FULLSCREEN does tweak resize code in 2 ways when going fullscreen:
- use monitor geometry instead of window geometry
- disable further auto resize

Hence, I think we should keep AUTO_RESIZE_FULLSCREEN.

Perhaps make AUTO_RESIZE flags, and so it would use FULLSCREEN | ONCE?
I think that makes things more complicated, you'll need more flags for
NEVER, and it's easy to get in inconsistant state, but feel free to
propose a better solution.

On Thu, Sep 19, 2013 at 8:06 PM, Jonathon Jongsma <jjongsma at redhat.com> wrote:
> Thanks, would you be willing to push it for me?  I don't yet have commit access.
>
> Jonathon
>
>
>
> ----- Original Message -----
>> From: "Marc-André Lureau" <mlureau at redhat.com>
>> To: "Jonathon Jongsma" <jjongsma at redhat.com>
>> Cc: virt-tools-list at redhat.com
>> Sent: Thursday, September 19, 2013 12:31:03 PM
>> Subject: Re: [virt-tools-list] [PATCH] VirtViewerDisplaySpice: rename AUTO_RESIZE_FULLSCREEN
>>
>>
>>
>> ----- Original Message -----
>> > I find the AUTO_RESIZE_FULLSCREEN enum name to be slightly confusing. To
>> > me,
>> > it
>> > implies that we should always auto-resize when the window is fullscreen.
>> > But
>> > what it actually means is that we should only auto-resize *once* when the
>> > window
>> > first becomes fullscreen.
>> >
>> > Rename it to AUTO_RESIZE_ONCE to make that behavior more clear and to match
>> > the
>> > other values (ALWAYS, NEVER) a bit more closely.
>>
>> Makes a lot of sense, ack
>>
>> thanks
>>
>> > ---
>> >  src/virt-viewer-display-spice.c | 19 ++++++++++---------
>> >  1 file changed, 10 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/src/virt-viewer-display-spice.c
>> > b/src/virt-viewer-display-spice.c
>> > index 48f07e3..5a54463 100644
>> > --- a/src/virt-viewer-display-spice.c
>> > +++ b/src/virt-viewer-display-spice.c
>> > @@ -35,17 +35,18 @@
>> >
>> >  G_DEFINE_TYPE (VirtViewerDisplaySpice, virt_viewer_display_spice,
>> >  VIRT_VIEWER_TYPE_DISPLAY)
>> >
>> > +typedef enum {
>> > +    AUTO_RESIZE_ALWAYS,
>> > +    AUTO_RESIZE_ONCE,
>> > +    AUTO_RESIZE_NEVER,
>> > +} AutoResizeMode;
>> > +
>> >  struct _VirtViewerDisplaySpicePrivate {
>> >      SpiceChannel *channel; /* weak reference */
>> >      SpiceDisplay *display;
>> > -    int auto_resize;
>> > +    AutoResizeMode auto_resize;
>> >  };
>> >
>> > -enum {
>> > -    AUTO_RESIZE_ALWAYS,
>> > -    AUTO_RESIZE_FULLSCREEN,
>> > -    AUTO_RESIZE_NEVER,
>> > -};
>> >
>> >  #define VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(o)
>> >  (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_SPICE,
>> >  VirtViewerDisplaySpicePrivate))
>> >
>> > @@ -197,7 +198,7 @@ virt_viewer_display_spice_resize(VirtViewerDisplaySpice
>> > *self,
>> >      if (virt_viewer_display_get_show_hint(VIRT_VIEWER_DISPLAY(self)) &
>> >      VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED)
>> >          return;
>> >
>> > -    if (self->priv->auto_resize == AUTO_RESIZE_FULLSCREEN) {
>> > +    if (self->priv->auto_resize == AUTO_RESIZE_ONCE) {
>> >          GdkRectangle monitor;
>> >          GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(self));
>> >          int n =
>> >          virt_viewer_display_get_monitor(VIRT_VIEWER_DISPLAY(self));
>> > @@ -246,7 +247,7 @@
>> > virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
>> >      virt_viewer_display_spice_resize(self, allocation,
>> >                                       self->priv->auto_resize !=
>> >                                       AUTO_RESIZE_NEVER);
>> >
>> > -    if (self->priv->auto_resize == AUTO_RESIZE_FULLSCREEN)
>> > +    if (self->priv->auto_resize == AUTO_RESIZE_ONCE)
>> >          self->priv->auto_resize = AUTO_RESIZE_NEVER;
>> >  }
>> >
>> > @@ -291,7 +292,7 @@ fullscreen_changed(VirtViewerDisplaySpice *self,
>> >          if (auto_conf)
>> >              self->priv->auto_resize = AUTO_RESIZE_NEVER;
>> >          else
>> > -            self->priv->auto_resize = AUTO_RESIZE_FULLSCREEN;
>> > +            self->priv->auto_resize = AUTO_RESIZE_ONCE;
>> >      } else
>> >          self->priv->auto_resize = AUTO_RESIZE_ALWAYS;
>> >  }
>> > --
>> > 1.8.3.1
>> >
>> > _______________________________________________
>> > virt-tools-list mailing list
>> > virt-tools-list at redhat.com
>> > https://www.redhat.com/mailman/listinfo/virt-tools-list
>> >
>>
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list



-- 
Marc-André Lureau




More information about the virt-tools-list mailing list