[Spice-devel] [spice-gtk] Spice-widget: Allow smaller widget with scaling enabled

Pavel Grunt pgrunt at redhat.com
Fri Apr 22 08:18:04 UTC 2016


On Fri, 2016-04-22 at 09:57 +0200, Javier Celaya wrote:
> Hi
> 
> El 22/04/16 a las 09:19, Pavel Grunt escribió:
> > Hi Javier,
> > 
> > sorry, I must have missed the patch. Can you please explain the problem? How
> > to
> > reproduce it? Is it about spicy?
>  Sorry, the commit message may be a bit short. I'll send a second version with
> a longer explanation, along with the the declaration of update_size_request().
> I found the problem with spicy, but I suppose it affects other clients too.
> You can reproduce it checking the "scale display" option and unchecking the
> "resize guest to match window size" option. Then, the spice widget takes a
> minimum size of the current guest resolution. The window can be made bigger,
> but never smaller.

I see, so steps to reproduce are:
1) connect with spicy to a guest
2) resize the guest to be bigger than minimal spicy resolution 640x480
3) uncheck "resize guest", check "scale display"
4) Try to scale down

Thanks,
Pavel

> > About the patch - you should declare the update_size_request() function
> > instead
> > of moving scaling_updated() down - it would be more clear what has changed.
> > 
> > Thanks,
> > Pavel 
> > 
> > On Fri, 2016-04-22 at 08:06 +0200, Javier Celaya wrote:
> > > Can someone review this patch, please?
> > > Thank you
> > > 
> > > El 13/04/16 a las 13:42, Javier Celaya escribió:
> > > > With scaling enabled, the size request of the widget must be 640x480
> > > > (the same as with resize_guest_enable) so that the widget can be
> > > > actually scalled down.
> > > > ---
> > > >  src/spice-widget.c | 25 +++++++++++++------------
> > > >  1 file changed, 13 insertions(+), 12 deletions(-)
> > > > 
> > > > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > > > index 6f638fb..f445f3f 100644
> > > > --- a/src/spice-widget.c
> > > > +++ b/src/spice-widget.c
> > > > @@ -169,23 +169,12 @@ static void
> > > > spice_display_get_property(GObject    *object,
> > > >      }
> > > >  }
> > > >  
> > > > -static void scaling_updated(SpiceDisplay *display)
> > > > -{
> > > > -    SpiceDisplayPrivate *d = display->priv;
> > > > -    GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
> > > > -
> > > > -    recalc_geometry(GTK_WIDGET(display));
> > > > -    if (d->ximage && window) { /* if not yet shown */
> > > > -        gtk_widget_queue_draw(GTK_WIDGET(display));
> > > > -    }
> > > > -}
> > > > -
> > > >  static void update_size_request(SpiceDisplay *display)
> > > >  {
> > > >      SpiceDisplayPrivate *d = display->priv;
> > > >      gint reqwidth, reqheight;
> > > >  
> > > > -    if (d->resize_guest_enable) {
> > > > +    if (d->resize_guest_enable || d->allow_scaling) {
> > > >          reqwidth = 640;
> > > >          reqheight = 480;
> > > >      } else {
> > > > @@ -197,6 +186,18 @@ static void update_size_request(SpiceDisplay
> > > > *display)
> > > >      recalc_geometry(GTK_WIDGET(display));
> > > >  }
> > > >  
> > > > +static void scaling_updated(SpiceDisplay *display)
> > > > +{
> > > > +    SpiceDisplayPrivate *d = display->priv;
> > > > +    GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
> > > > +
> > > > +    recalc_geometry(GTK_WIDGET(display));
> > > > +    if (d->ximage && window) { /* if not yet shown */
> > > > +        gtk_widget_queue_draw(GTK_WIDGET(display));
> > > > +    }
> > > > +    update_size_request(display);
> > > > +}
> > > > +
> > > >  static void update_keyboard_focus(SpiceDisplay *display, gboolean
> > > > state)
> > > >  {
> > > >      SpiceDisplayPrivate *d = display->priv;
> > >  
> > > -- 
> > > 
> > > 
> > >   Javier Celaya Software Engineer 	 javier.celaya at flexvdi.com      
> > >     
> > >       +34 876 60 00 73 @j_celaya 
> > > _______________________________________________
> > > Spice-devel mailing list
> > > Spice-devel at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/spice-devel
>  
> -- 
> 
> 
>   Javier Celaya Software Engineer 	 javier.celaya at flexvdi.com          
>       +34 876 60 00 73 @j_celaya 


More information about the Spice-devel mailing list