From nobody Mon Feb 9 17:59:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.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=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1663374532; cv=none; d=zohomail.com; s=zohoarc; b=Fic8rsRnF4m4b3EiIAmNCsn0tOPABXEbTBvtwZ1rOI0mqd1QtBsC7jalrRqwbKEtVlXtGv7odHLyDkjWNspvq5f5mHfcW1ghIqjspAqg9yDBRHjysgh18AYNNKf/qeIB7PrmUlkkx/CePv5d21P4o1NUGXoW44aO9kRsJKnBk+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663374532; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YXPrEZPMb9rsWIeDAmLDmo1Hfo9r6LPKDROaDaRE6WI=; b=LI+f3+aFyZ0wyjQRsg8FtAHpoG12/Y53DqYs2zBrwgAPIM47eg9amIjuU1RgLHP+OaQNpiC4WOkxw/fWgmGmYw+/Q05OFqrhoY7wLpd4ANNgoInN7jUneH4A4ihUzPV9bQB5PySrDDduNLeJT7lbv9L6PDnHeYTPbixqxFj75Hw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663374532375347.1505825406002; Fri, 16 Sep 2022 17:28:52 -0700 (PDT) Received: from localhost ([::1]:52368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZLhS-000765-Fr for importer@patchew.org; Fri, 16 Sep 2022 20:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZLgB-0005ky-0T for qemu-devel@nongnu.org; Fri, 16 Sep 2022 20:27:31 -0400 Received: from mga17.intel.com ([192.55.52.151]:23527) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZLg8-0000iY-Ag for qemu-devel@nongnu.org; Fri, 16 Sep 2022 20:27:30 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2022 17:27:20 -0700 Received: from vkasired-desk2.fm.intel.com ([10.105.128.127]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2022 17:27:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663374448; x=1694910448; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9JsnKgMaT+NWlAlZc/hCPg1J/P2cW1jC9qrb4G6jxbU=; b=eOVQT4gFx5oODrhyzYgvO4Sh5Lpg6DZbneJjpQgOlU7GfIFJu/gwwLy2 udBb2jdJRulzAC043nYg2zarTR8BlMy3Qp7va8decROXJJtA6D9QWPSdj xOTVd7U/K/rEQAEjkoaJvy77kizFFDLOomP5CYe1NoMD+GkpvKrMkSp8l /2M5AwtED87XDgzmjGa2i8Cr3DnIwfgi2dKQQ0LzIY2kwU6UwaamhyEMD ZD6L8g/7FYiQ36Hko74KBQVg1NsCFPQWtDTeN6/qcosT1iF/4KhXDFf06 cmnPQ5Zc/kJbYFqansVeRSVyLAGJiWH+Og3/Knp+WhZgs75vnn11TF08j g==; X-IronPort-AV: E=McAfee;i="6500,9779,10472"; a="279489395" X-IronPort-AV: E=Sophos;i="5.93,321,1654585200"; d="scan'208";a="279489395" X-IronPort-AV: E=Sophos;i="5.93,321,1654585200"; d="scan'208";a="760235124" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , Dongwon Kim Subject: [PATCH v1 2/3] ui/gtk: Factor out tab window creation into a separate function Date: Fri, 16 Sep 2022 17:07:30 -0700 Message-Id: <20220917000731.465003-3-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220917000731.465003-1-vivek.kasireddy@intel.com> References: <20220917000731.465003-1-vivek.kasireddy@intel.com> 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=192.55.52.151; envelope-from=vivek.kasireddy@intel.com; helo=mga17.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1663374533577100001 Content-Type: text/plain; charset="utf-8" Pull the code that creates a new window associated with a notebook tab into a separate function. This new function can be useful not just when user wants to detach a tab but also in the future when a new window creation is needed in other scenarios. Cc: Gerd Hoffmann Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- ui/gtk.c | 65 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 0ff31cb852..945c550909 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1335,6 +1335,41 @@ static gboolean gd_win_grab(void *opaque) return TRUE; } =20 +static void gd_tab_window_create(VirtualConsole *vc) +{ + GtkDisplayState *s =3D vc->s; + + gtk_widget_set_sensitive(vc->menu_item, false); + vc->window =3D gtk_window_new(GTK_WINDOW_TOPLEVEL); +#if defined(CONFIG_OPENGL) + if (vc->gfx.esurface) { + eglDestroySurface(qemu_egl_display, vc->gfx.esurface); + vc->gfx.esurface =3D NULL; + } + if (vc->gfx.esurface) { + eglDestroyContext(qemu_egl_display, vc->gfx.ectx); + vc->gfx.ectx =3D NULL; + } +#endif + gd_widget_reparent(s->notebook, vc->window, vc->tab_item); + + g_signal_connect(vc->window, "delete-event", + G_CALLBACK(gd_tab_window_close), vc); + gtk_widget_show_all(vc->window); + + if (qemu_console_is_graphic(vc->gfx.dcl.con)) { + GtkAccelGroup *ag =3D gtk_accel_group_new(); + gtk_window_add_accel_group(GTK_WINDOW(vc->window), ag); + + GClosure *cb =3D g_cclosure_new_swap(G_CALLBACK(gd_win_grab), + vc, NULL); + gtk_accel_group_connect(ag, GDK_KEY_g, HOTKEY_MODIFIERS, 0, cb); + } + + gd_update_geometry_hints(vc); + gd_update_caption(s); +} + static void gd_menu_untabify(GtkMenuItem *item, void *opaque) { GtkDisplayState *s =3D opaque; @@ -1346,35 +1381,7 @@ static void gd_menu_untabify(GtkMenuItem *item, void= *opaque) FALSE); } if (!vc->window) { - gtk_widget_set_sensitive(vc->menu_item, false); - vc->window =3D gtk_window_new(GTK_WINDOW_TOPLEVEL); -#if defined(CONFIG_OPENGL) - if (vc->gfx.esurface) { - eglDestroySurface(qemu_egl_display, vc->gfx.esurface); - vc->gfx.esurface =3D NULL; - } - if (vc->gfx.esurface) { - eglDestroyContext(qemu_egl_display, vc->gfx.ectx); - vc->gfx.ectx =3D NULL; - } -#endif - gd_widget_reparent(s->notebook, vc->window, vc->tab_item); - - g_signal_connect(vc->window, "delete-event", - G_CALLBACK(gd_tab_window_close), vc); - gtk_widget_show_all(vc->window); - - if (qemu_console_is_graphic(vc->gfx.dcl.con)) { - GtkAccelGroup *ag =3D gtk_accel_group_new(); - gtk_window_add_accel_group(GTK_WINDOW(vc->window), ag); - - GClosure *cb =3D g_cclosure_new_swap(G_CALLBACK(gd_win_grab), - vc, NULL); - gtk_accel_group_connect(ag, GDK_KEY_g, HOTKEY_MODIFIERS, 0, cb= ); - } - - gd_update_geometry_hints(vc); - gd_update_caption(s); + gd_tab_window_create(vc); } } =20 --=20 2.37.2