From: Dongwon Kim <dongwon.kim@intel.com>
To: qemu-devel@nongnu.org, dongwon.kim@intel.com, philmd@redhat.com,
kraxel@redhat.com, pbonzini@redhat.com
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Subject: [PATCH 3/3] ui/gtk: specify detached window's size and location
Date: Thu, 28 Apr 2022 16:13:04 -0700 [thread overview]
Message-ID: <20220428231304.19472-4-dongwon.kim@intel.com> (raw)
In-Reply-To: <20220428231304.19472-1-dongwon.kim@intel.com>
Specify location and size of detached window based on top level
window's location and size info when detachment happens.
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
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);
--
2.30.2
next prev parent reply other threads:[~2022-04-28 23:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 23:13 [PATCH 0/3] ui/gtk: new options, monitor and detach-all Dongwon Kim
2022-04-28 23:13 ` [PATCH 1/3] ui/gtk: new param monitor to specify target monitor for launching QEMU Dongwon Kim
2022-05-03 9:15 ` Daniel P. Berrangé
2022-05-03 23:14 ` Dongwon Kim
2022-05-09 21:31 ` Dongwon Kim
2022-05-10 10:58 ` Gerd Hoffmann
2022-05-17 7:46 ` Markus Armbruster
2022-04-28 23:13 ` [PATCH 2/3] ui/gtk: detach_all option for making all VCs detached upon starting Dongwon Kim
2022-05-03 9:12 ` Daniel P. Berrangé
2022-05-03 23:21 ` Dongwon Kim
2022-05-04 8:28 ` Daniel P. Berrangé
2022-04-28 23:13 ` Dongwon Kim [this message]
2022-05-03 9:17 ` [PATCH 3/3] ui/gtk: specify detached window's size and location Daniel P. Berrangé
2022-05-03 23:33 ` Dongwon Kim
2022-05-06 16:34 ` Daniel P. Berrangé
2022-05-06 17:05 ` Dongwon Kim
2022-05-31 20:33 ` [PATCH 0/3] ui/gtk: new options, monitor and detach-all Dongwon Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220428231304.19472-4-dongwon.kim@intel.com \
--to=dongwon.kim@intel.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vivek.kasireddy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).