From patchwork Thu Apr 28 23:13:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kim, Dongwon" X-Patchwork-Id: 12831326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C56ECC433EF for ; Thu, 28 Apr 2022 23:17:52 +0000 (UTC) Received: from localhost ([::1]:47934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkDOR-0006C2-KE for qemu-devel@archiver.kernel.org; Thu, 28 Apr 2022 19:17:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkDNU-0004TV-JL for qemu-devel@nongnu.org; Thu, 28 Apr 2022 19:16:52 -0400 Received: from mga05.intel.com ([192.55.52.43]:57367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkDNR-0007hA-Ka for qemu-devel@nongnu.org; Thu, 28 Apr 2022 19:16:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651187809; x=1682723809; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bvgntPgi5PNZ9KMn1hCz7dObNdZfyMNO/RM6gVV+Fa4=; b=f3t2H7BNaaQMxuK5O0H/MrVPChuFHH5BzLhM70AfFy3anlB2kJLInOVB Th9Apd3CagZgtsqkUIIk+8kmtDPDWr3fpNbmGGzOIiEuRmdsjrdXFmiTw +nUo11+oIVrigXTaJbtI6omZiQQRSIZsg1ixVoWVvBNZiuARLEDDeeaHk fvR2m6WoE5R5z/ESJxF0chzZGOrHAlEynpzERjn34zE4rNC6a7asu5Lqj oz5B4I1Mpm6ianK6AY6h5UuITMkk50X+/URES9OnqMXhA6tivuy1VRXc7 A5OnjY3lmTPD+rhyeUhRsvKwqr/V1u5JWEfcJ2prWe7AvYVf1/+8TYHxj A==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="352887474" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="352887474" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 16:16:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="731758635" Received: from dongwonk-z390-aorus-ultra-intel-gfx.fm.intel.com ([10.105.129.122]) by orsmga005.jf.intel.com with ESMTP; 28 Apr 2022 16:16:42 -0700 From: Dongwon Kim To: qemu-devel@nongnu.org, dongwon.kim@intel.com, philmd@redhat.com, kraxel@redhat.com, pbonzini@redhat.com Subject: [PATCH 1/3] ui/gtk: new param monitor to specify target monitor for launching QEMU Date: Thu, 28 Apr 2022 16:13:02 -0700 Message-Id: <20220428231304.19472-2-dongwon.kim@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220428231304.19472-1-dongwon.kim@intel.com> References: <20220428231304.19472-1-dongwon.kim@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.43; envelope-from=dongwon.kim@intel.com; helo=mga05.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: Vivek Kasireddy Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Introducing a new integer parameter to specify the monitor where the Qemu window is placed upon launching. Monitor can be any number between 0 and (total number of monitors - 1). It can be used together with full-screen=on, which will make the QEMU window full-screened on the targeted monitor. v2: fixed typos and updated commit subject and msg (Philippe Mathieu-Daudé) changed param name to monitor, removed unnecessary condition check on the parameter (Paolo Bonzini) v3: updated Since version to 7.1 for monitor parameter Cc: Philippe Mathieu-Daudé Cc: Paolo Bonzini Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- qapi/ui.json | 6 +++++- qemu-options.hx | 2 +- ui/gtk.c | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index 059302a5ef..ddcea7349b 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1204,13 +1204,17 @@ # assuming the guest will resize the display to match # the window size then. Otherwise it defaults to "off". # Since 3.1 +# @monitor: Indicate monitor where QEMU window is lauched. monitor +# could be any number from 0 to (total num of monitors - 1). +# since 7.1 # # Since: 2.12 # ## { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool', - '*zoom-to-fit' : 'bool' } } + '*zoom-to-fit' : 'bool', + '*monitor' : 'uint32' } } ## # @DisplayEGLHeadless: diff --git a/qemu-options.hx b/qemu-options.hx index 5f69b94b8e..dbf9b223dd 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1908,7 +1908,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, #endif #if defined(CONFIG_GTK) "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n" - " [,show-cursor=on|off][,window-close=on|off]\n" + " [,monitor=][,show-cursor=on|off][,window-close=on|off]\n" #endif #if defined(CONFIG_VNC) "-display vnc=[,]\n" diff --git a/ui/gtk.c b/ui/gtk.c index c57c36749e..d9971d65ac 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2375,6 +2375,14 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) vc && vc->type == GD_VC_VTE); #endif + if (opts->u.gtk.has_monitor && + opts->u.gtk.monitor < gdk_display_get_n_monitors(window_display)) { + GdkRectangle mon_dest; + gdk_monitor_get_geometry( + gdk_display_get_monitor(window_display, opts->u.gtk.monitor), + &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)); From patchwork Thu Apr 28 23:13:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kim, Dongwon" X-Patchwork-Id: 12831328 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF9C2C433F5 for ; Thu, 28 Apr 2022 23:23:02 +0000 (UTC) Received: from localhost ([::1]:60510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkDTR-0006Jb-Q1 for qemu-devel@archiver.kernel.org; Thu, 28 Apr 2022 19:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkDNW-0004Tn-Ky for qemu-devel@nongnu.org; Thu, 28 Apr 2022 19:16:54 -0400 Received: from mga05.intel.com ([192.55.52.43]:57365) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkDNU-0007gu-Fm for qemu-devel@nongnu.org; Thu, 28 Apr 2022 19:16:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651187812; x=1682723812; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6gIEvtZ3DZc5Fy391n3vPfgueX5FKYs9eaL9PsfJz80=; b=a4FNdynYEv3EV+lbUyQDvX78E6PwjxXUpukhQFVmxs/ghYCV2kZthCU3 c0hYGFbfAdWkkMvglHL57MshZ+y617FrNjZ6x4i6161MOPhKUHgRQKlMC 5nixP/XwuB5KQ6rcjPFuWZ8WjYDuiXirpBdC+79XGMN+ULBY8SwQSh/nM 9chl21/Aed6fqkYfO0x0WcIyGGLaqifH/hzfku7txUPIG26alxKPNOxBG VHb9E2h4h7CaLE8mlem1KhWpsgM7nr+SLdESYO50MRFRPB6hSDwV1VRlT fay/7tTPSMOYayy5mWmo2HsKZHO3JvokHgoZTsGo746nzXwsWFk8KhhOH g==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="352887476" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="352887476" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 16:16:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="731758641" Received: from dongwonk-z390-aorus-ultra-intel-gfx.fm.intel.com ([10.105.129.122]) by orsmga005.jf.intel.com with ESMTP; 28 Apr 2022 16:16:43 -0700 From: Dongwon Kim To: qemu-devel@nongnu.org, dongwon.kim@intel.com, philmd@redhat.com, kraxel@redhat.com, pbonzini@redhat.com Subject: [PATCH 2/3] ui/gtk: detach_all option for making all VCs detached upon starting Date: Thu, 28 Apr 2022 16:13:03 -0700 Message-Id: <20220428231304.19472-3-dongwon.kim@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220428231304.19472-1-dongwon.kim@intel.com> References: <20220428231304.19472-1-dongwon.kim@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.43; envelope-from=dongwon.kim@intel.com; helo=mga05.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: Vivek Kasireddy Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" With "detach-all=on" for display, QEMU starts with all VC windows detached automatically. If used with "full-screen=on", it places individual windows (from top window) starting from monitor 0 or monitor n in case monitor=n. In case # mon < # VCs, only same number of VCs as # mon will be sent to the monitors for full-screen while others are remaining in windowed-mode. Target monitor number for individual VC is rotated in case monitor=n (n != 0) (e.g. if monitor=1 and # VCs = 2, the top window will be full-screened on monitor 1 and top second window will be full-screened on monitor 0.) v2: update Since version to 7.1 Cc: Philippe Mathieu-Daudé Cc: Paolo Bonzini Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- qapi/ui.json | 5 ++++- ui/gtk.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index ddcea7349b..a5b1550937 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1378,6 +1378,8 @@ # @show-cursor: Force showing the mouse cursor (default: off). # (since: 5.0) # @gl: Enable OpenGL support (default: off). +# @detach-all: Start QEMU with all VC windows detached (default: off) +# (since: 7.1) # # Since: 2.12 # @@ -1387,7 +1389,8 @@ '*full-screen' : 'bool', '*window-close' : 'bool', '*show-cursor' : 'bool', - '*gl' : 'DisplayGLMode' }, + '*gl' : 'DisplayGLMode', + '*detach-all' : 'bool' }, 'discriminator' : 'type', 'data' : { 'gtk': { 'type': 'DisplayGTK', 'if': 'CONFIG_GTK' }, diff --git a/ui/gtk.c b/ui/gtk.c index d9971d65ac..f1ca6a7275 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2305,6 +2305,8 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) GdkDisplay *window_display; GtkIconTheme *theme; char *dir; + int num_mon; + int i; if (!gtkinit) { fprintf(stderr, "gtk initialization failed\n"); @@ -2374,18 +2376,57 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) gtk_widget_set_sensitive(s->copy_item, vc && vc->type == GD_VC_VTE); #endif - if (opts->u.gtk.has_monitor && - opts->u.gtk.monitor < gdk_display_get_n_monitors(window_display)) { + opts->u.gtk.monitor < + (num_mon = gdk_display_get_n_monitors(window_display))) { GdkRectangle mon_dest; gdk_monitor_get_geometry( gdk_display_get_monitor(window_display, opts->u.gtk.monitor), &mon_dest); gtk_window_move(GTK_WINDOW(s->window), mon_dest.x, mon_dest.y); } + if (opts->has_detach_all && + opts->detach_all) { + for (i = 0; i < s->nb_vcs - 1; i++) { + gtk_menu_item_activate(GTK_MENU_ITEM(s->untabify_item)); + } + } if (opts->has_full_screen && opts->full_screen) { - gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); + bool no_mon_left = 0; + int next_mon = 0; + if (!opts->u.gtk.has_monitor || + (opts->u.gtk.has_monitor && opts->u.gtk.monitor < num_mon)) { + next_mon = (opts->u.gtk.has_monitor) ? opts->u.gtk.monitor : 0; + for (i = 0; i < s->nb_vcs - 1; i++) { + if (!s->vc[i].window) { + continue; + } + + gtk_window_fullscreen_on_monitor( + GTK_WINDOW(s->vc[i].window), + gdk_display_get_default_screen(window_display), + next_mon++); + + if (next_mon == opts->u.gtk.monitor) { + no_mon_left = true; + break; + } + + if (next_mon == num_mon) { + next_mon = 0; + } + } + } + + if (!no_mon_left) { + GdkRectangle mon_dest; + gdk_monitor_get_geometry( + gdk_display_get_monitor(window_display, next_mon), + &mon_dest); + gtk_window_move(GTK_WINDOW(s->window), mon_dest.x, mon_dest.y); + gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); + } } if (opts->u.gtk.has_grab_on_hover && opts->u.gtk.grab_on_hover) { From patchwork Thu Apr 28 23:13:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kim, Dongwon" X-Patchwork-Id: 12831327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D97DC433F5 for ; Thu, 28 Apr 2022 23:21:06 +0000 (UTC) Received: from localhost ([::1]:56082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkDRZ-0003Ho-AM for qemu-devel@archiver.kernel.org; Thu, 28 Apr 2022 19:21:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkDNW-0004Tm-12 for qemu-devel@nongnu.org; Thu, 28 Apr 2022 19:16:54 -0400 Received: from mga05.intel.com ([192.55.52.43]:57367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkDNU-0007hA-HI for qemu-devel@nongnu.org; Thu, 28 Apr 2022 19:16:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651187812; x=1682723812; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AGPs5gn/PiJcZ5VVKJ5gogx7bdL4KUv1SJaow18szTQ=; b=Pl1BXHdDQcCAjlreYUsz64kC40RY3l3GIZZka3TItNfgSNlHYxd9GeDA 91y1EDEkE8brTSFnbko4UdBKmJ/Iao1Vc7OeCwTvOKNZq/V8Oi3DYDc6I rUaV84/mMp5/bbMFiv8da71LX0e/8iMZ1BEt7PIfDxZZXMO6NfooRJKzL ENY+I3U9meVQJt1Cqp9h5F3VjxgXUd5LbzsXYK3vHj1ChPMNeFc0KNcRl y6GI1wIPprvSPlM8msVw0XbWCN/NNlFwvpmMoYlzMKLO9ZE3PAd6NNSHJ 5+PLwfbzP7w5KAmMYV1OdT6ZiCoPsU+vVhMBFiYv2Sx+cC3NSMEh9zgLN Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="352887479" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="352887479" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 16:16:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="731758649" Received: from dongwonk-z390-aorus-ultra-intel-gfx.fm.intel.com ([10.105.129.122]) by orsmga005.jf.intel.com with ESMTP; 28 Apr 2022 16:16:43 -0700 From: Dongwon Kim To: qemu-devel@nongnu.org, dongwon.kim@intel.com, philmd@redhat.com, kraxel@redhat.com, pbonzini@redhat.com Subject: [PATCH 3/3] ui/gtk: specify detached window's size and location Date: Thu, 28 Apr 2022 16:13:04 -0700 Message-Id: <20220428231304.19472-4-dongwon.kim@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220428231304.19472-1-dongwon.kim@intel.com> References: <20220428231304.19472-1-dongwon.kim@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.43; envelope-from=dongwon.kim@intel.com; helo=mga05.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: Vivek Kasireddy Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Specify location and size of detached window based on top level window's location and size info when detachment happens. Cc: Philippe Mathieu-Daudé Cc: Paolo Bonzini Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- ui/gtk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index f1ca6a7275..7dadf3b588 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1338,6 +1338,8 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque) FALSE); } if (!vc->window) { + gint x, y, w, h; + int i; gtk_widget_set_sensitive(vc->menu_item, false); vc->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); #if defined(CONFIG_OPENGL) @@ -1351,7 +1353,18 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque) } #endif gd_widget_reparent(s->notebook, vc->window, vc->tab_item); + gtk_window_get_position(GTK_WINDOW(s->window), &x, &y); + gtk_window_get_size(GTK_WINDOW(s->window), &w, &h); + + for (i = 0; i < s->nb_vcs; i++) { + if (vc == &s->vc[i]) { + break; + } + } + gtk_window_move(GTK_WINDOW(vc->window), + x + w * (i % (s->nb_vcs/2) + 1), y + h * (i / (s->nb_vcs/2))); + gtk_window_resize(GTK_WINDOW(vc->window), w, h); g_signal_connect(vc->window, "delete-event", G_CALLBACK(gd_tab_window_close), vc); gtk_widget_show_all(vc->window);