Re: [PATCH virt-viewer 1/2] virt-viewer-window: Make sure that minimum zoom level is lower than NORMAL_ZOOM_LEVEL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Tue, 2015-04-21 at 20:48 +0200, Pavel Grunt wrote:
> > The minimum size of the desktop is 100x100 if the minimum window
> > size
> > is greater than this, the zoom level is greater than
> > NORMAL_ZOOM_LEVEL
> > 
> > related: rhbz#1206460
> > ---
> >  src/virt-viewer-window.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> > index 18ae1bc..3820159 100644
> > --- a/src/virt-viewer-window.c
> > +++ b/src/virt-viewer-window.c
> > @@ -1536,7 +1536,8 @@
> > virt_viewer_window_get_minimal_zoom_level(VirtViewerWindow *self)
> >      height_ratio = (double) min_height / height;
> >      zoom = ceil(10 * MAX(width_ratio, height_ratio));
> >  
> > -    return MAX(MIN_ZOOM_LEVEL, zoom * ZOOM_STEP);
> > +    /* make sure that the returned zoom level is in the range from
> > MIN_ZOOM_LEVEL to NORMAL_ZOOM_LEVEL */
> > +    return MIN(MAX(MIN_ZOOM_LEVEL, zoom * ZOOM_STEP),
> > NORMAL_ZOOM_LEVEL);
> >  }
> >  
> >  /*
> 
> 
> ACK to both. You could use the glib CLAMP() macro instead of
> MIN(MAX()),
> if you'd like.
> 
> 
Yes, that is more readable than MIN(MAX(MIN_..... I will change it to CLAMP() before pushing.

Thanks,
Pavel

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux