From nobody Wed Nov 5 13:00:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535090722884890.8062821151492; Thu, 23 Aug 2018 23:05:22 -0700 (PDT) Received: from localhost ([::1]:40009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ft5Dl-0000E9-Qx for importer@patchew.org; Fri, 24 Aug 2018 02:05:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ft5C0-0007bM-3q for qemu-devel@nongnu.org; Fri, 24 Aug 2018 02:03:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ft50G-0002aY-0q for qemu-devel@nongnu.org; Fri, 24 Aug 2018 01:51:27 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35120 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ft50F-0002ZW-Su for qemu-devel@nongnu.org; Fri, 24 Aug 2018 01:51:23 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2552F40216EA for ; Fri, 24 Aug 2018 05:51:23 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 283682026D6D; Fri, 24 Aug 2018 05:51:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6A46016E29; Fri, 24 Aug 2018 07:51:20 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 24 Aug 2018 07:51:20 +0200 Message-Id: <20180824055120.9443-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 24 Aug 2018 05:51:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 24 Aug 2018 05:51:23 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH] gtk: add zoom-to-fit to gtk options. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This allows to set the option on the command line, i.e. "-display gtk,zoom-to-fit=3D{on,off}", overriding the default choosen by qemu. Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 8 ++++++++ qapi/ui.json | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index 5cce6ed42d..3ddb5fe162 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2136,6 +2136,8 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, QemuConsole *con, int idx, GSList *group, GtkWidget *view_menu) { + bool zoom_to_fit; + vc->label =3D qemu_console_get_label(con); vc->s =3D s; vc->gfx.scale_x =3D 1.0; @@ -2199,6 +2201,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vi= rtualConsole *vc, group =3D gd_vc_menu_init(s, vc, idx, group, view_menu); =20 if (dpy_ui_info_supported(vc->gfx.dcl.con)) { + zoom_to_fit =3D true; + } + if (s->opts->u.gtk.has_zoom_to_fit) { + zoom_to_fit =3D s->opts->u.gtk.zoom_to_fit; + } + if (zoom_to_fit) { gtk_menu_item_activate(GTK_MENU_ITEM(s->zoom_fit_item)); s->free_scale =3D true; } diff --git a/qapi/ui.json b/qapi/ui.json index 4ca91bb45a..bf2d0fa60e 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1027,7 +1027,8 @@ # ## { 'struct' : 'DisplayGTK', - 'data' : { '*grab-on-hover' : 'bool' } } + 'data' : { '*grab-on-hover' : 'bool', + '*zoom-to-fit' : 'bool' } } =20 ## # @DisplayGLMode: --=20 2.9.3