From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S26u5-0003Yk-2Z for qemu-devel@nongnu.org; Mon, 27 Feb 2012 15:10:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S26u0-00014X-Mh for qemu-devel@nongnu.org; Mon, 27 Feb 2012 15:10:36 -0500 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:53912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S26u0-00014P-Dj for qemu-devel@nongnu.org; Mon, 27 Feb 2012 15:10:32 -0500 Message-ID: <4F4BE334.7050504@weilnetz.de> Date: Mon, 27 Feb 2012 21:10:28 +0100 From: Stefan Weil MIME-Version: 1.0 References: <1330299995-8688-1-git-send-email-aliguori@us.ibm.com> <1330299995-8688-7-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1330299995-8688-7-git-send-email-aliguori@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 6/8] gtk: add support for screen scaling and full screen (v2) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Paolo Bonzini , qemu-devel@nongnu.org Am 27.02.2012 00:46, schrieb Anthony Liguori: > Basic menu items to enter full screen mode and zoom in/out. Unlike SDL, we > don't allow arbitrary scaling based on window resizing. The current > behavior > with SDL causes a lot of problems for me. > > Sometimes I accidentally resize the window a tiny bit while trying to > move it > (Ubuntu's 1-pixel window decorations don't help here). After that, > scaling is > now active and if the screen changes size again, badness ensues since the > aspect ratio is skewed. > > Allowing zooming by 25% in and out should cover most use cases. We can > add a > more flexible scaling later but for now, I think this is a more friendly > behavior. > > Signed-off-by: Anthony Liguori > --- > v1 -> v2 > - fix scaling (Paolo) > - use ctrl-alt-+ instead of ctrl-alt-= for zoom > --- > ui/gtk.c | 92 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- > 1 files changed, 88 insertions(+), 4 deletions(-) > > diff --git a/ui/gtk.c b/ui/gtk.c > index 0dac807..578cb94 100644 > --- a/ui/gtk.c > +++ b/ui/gtk.c [...] > > + s->full_screen_item = gtk_check_menu_item_new_with_mnemonic("_Full > Screen"); I suggest using the GTK standard widget GTK_STOCK_FULLSCREEN here. That's not a check menu item, so some more changes will be needed. Full screen mode does not need a check menu item, because you only see the menu item when it is not in full screen mode. > + gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item), > + "/View/Full Screen"); > + gtk_accel_map_add_entry("/View/Full Screen", GDK_KEY_f, > GDK_CONTROL_MASK | GDK_MOD1_MASK); > + gtk_menu_append(GTK_MENU(s->view_menu), s->full_screen_item); > + > + separator = gtk_separator_menu_item_new(); > + gtk_menu_append(GTK_MENU(s->view_menu), separator); > + > + s->zoom_in_item = > gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_IN, NULL); > + gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_in_item), > + "/View/Zoom In"); > + gtk_accel_map_add_entry("/View/Zoom In", GDK_KEY_plus, > GDK_CONTROL_MASK | GDK_MOD1_MASK); > + gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_in_item); > + > + s->zoom_out_item = > gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL); > + gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_out_item), > + "/View/Zoom Out"); > + gtk_accel_map_add_entry("/View/Zoom Out", GDK_KEY_minus, > GDK_CONTROL_MASK | GDK_MOD1_MASK); > + gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_out_item); > + > separator = gtk_separator_menu_item_new(); > gtk_menu_append(GTK_MENU(s->view_menu), separator); > As was already said, GTK_STOCK_ZOOM_100 with accelerator GDK_KEY_0 would complete the zooming menu entries. In your previous patch, you scaled s->scale_x *= 1.25 (which was correct) and s->scale_x *= 0.75 (which should have been s->scale_x *= 0.8). Why do you now use s->scale_x += .25, s->scale_x -= .25? Linear scaling is uncommon and not what I'd expect when I read 25 % zooming in / out. I know that SDL also uses linear scaling, but GTK wants to be better than SDL. Regards, Stefan Weil