From nobody Sat May 18 22:31:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1637277436511516.1668613646351; Thu, 18 Nov 2021 15:17:16 -0800 (PST) Received: from localhost ([::1]:54362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnqeY-0004Qd-LZ for importer@patchew.org; Thu, 18 Nov 2021 18:17:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnqco-0002oe-Fk for qemu-devel@nongnu.org; Thu, 18 Nov 2021 18:15:26 -0500 Received: from mga18.intel.com ([134.134.136.126]:15303) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnqcl-0002bj-Jo for qemu-devel@nongnu.org; Thu, 18 Nov 2021 18:15:26 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2021 15:15:17 -0800 Received: from dongwonk-z390-aorus-ultra-intel-gfx.fm.intel.com ([10.105.129.122]) by fmsmga002.fm.intel.com with ESMTP; 18 Nov 2021 15:15:17 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10172"; a="221191269" X-IronPort-AV: E=Sophos;i="5.87,246,1631602800"; d="scan'208";a="221191269" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,246,1631602800"; d="scan'208";a="593973590" From: Dongwon Kim To: qemu-devel@nongnu.org Subject: [PATCH] ui/gtk: mon_num parameter to specify target monitor for launching Qemu Date: Thu, 18 Nov 2021 14:51:27 -0800 Message-Id: <20211118225127.26147-1-dongwon.kim@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=134.134.136.126; envelope-from=dongwon.kim@intel.com; helo=mga18.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sweeaun , Khairul Anuar Romli , Vivek Kasireddy , Dongwon Kim , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1637277437259100001 Content-Type: text/plain; charset="utf-8" Introducing a new integer parameter to specify the monitor where the Qemu window is placed upon launching. Monitor index can start from 0 to (total number of monitors - 1). Default value for the parameter is -1, which doesn't affect anything. It can be used together with full-screen=3Don, which will make the Qemu window full-screened on the targetted monitor. Cc: Gerd Hoffmann Cc: Vivek Kasireddy Cc: sweeaun Cc: Khairul Anuar Romli Signed-off-by: Dongwon Kim --- qapi/ui.json | 7 ++++++- qemu-options.hx | 2 +- ui/gtk.c | 10 ++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index d7567ac866..7552b503b2 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1099,13 +1099,18 @@ # assuming the guest will resize the display to match # the window size then. Otherwise it defaults to "off". # Since 3.1 +# @mon-num: Indicate monitor where Qemu window is lauched. mon-num +# could be any number from -1 to (total num of monitors - 1). +# (default: -1: use default monitor) +# since 6.2 # # Since: 2.12 # ## { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool', - '*zoom-to-fit' : 'bool' } } + '*zoom-to-fit' : 'bool', + '*mon-num' : 'int' } } =20 ## # @DisplayEGLHeadless: diff --git a/qemu-options.hx b/qemu-options.hx index 7749f59300..7a888b16b1 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1852,7 +1852,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, #endif #if defined(CONFIG_GTK) "-display gtk[,full-screen=3Don|off][,gl=3Don|off][,grab-on-hover=3Don= |off]\n" - " [,show-cursor=3Don|off][,window-close=3Don|off]\n" + " [,mon-num=3D][,show-cursor=3Don|off][,window-close= =3Don|off]\n" #endif #if defined(CONFIG_VNC) "-display vnc=3D[,]\n" diff --git a/ui/gtk.c b/ui/gtk.c index d2892ea6b4..8d8aa55822 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2314,6 +2314,16 @@ static void gtk_display_init(DisplayState *ds, Displ= ayOptions *opts) vc && vc->type =3D=3D GD_VC_VTE); #endif =20 + if (opts->u.gtk.has_mon_num && opts->u.gtk.mon_num && + opts->u.gtk.mon_num >=3D 0) { + GdkRectangle mon_dest; + if (opts->u.gtk.mon_num < gdk_display_get_n_monitors(window_displa= y)) { + gdk_monitor_get_geometry( + gdk_display_get_monitor(window_display, opts->u.gtk.mon_nu= m), + &mon_dest); + gtk_window_move(GTK_WINDOW(s->window), mon_dest.x, mon_dest.y); + } + } if (opts->has_full_screen && opts->full_screen) { gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); --=20 2.30.2