From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 1/5] console: delayed ui_info guest notification
Date: Fri, 8 May 2015 13:48:47 +0200 [thread overview]
Message-ID: <1431085731-6362-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1431085731-6362-1-git-send-email-kraxel@redhat.com>
So we don't flood the guest with display change notifications
while the user resizes the window.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/console.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index f5295c4..248dd60 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -126,6 +126,7 @@ struct QemuConsole {
Object *device;
uint32_t head;
QemuUIInfo ui_info;
+ QEMUTimer *ui_timer;
const GraphicHwOps *hw_ops;
void *hw;
@@ -1383,14 +1384,28 @@ void unregister_displaychangelistener(DisplayChangeListener *dcl)
gui_setup_refresh(ds);
}
+static void dpy_set_ui_info_timer(void *opaque)
+{
+ QemuConsole *con = opaque;
+
+ con->hw_ops->ui_info(con->hw, con->head, &con->ui_info);
+}
+
int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info)
{
assert(con != NULL);
con->ui_info = *info;
- if (con->hw_ops->ui_info) {
- return con->hw_ops->ui_info(con->hw, con->head, info);
+ if (!con->hw_ops->ui_info) {
+ return -1;
}
- return -1;
+
+ /*
+ * Typically we get a flood of these as the user resizes the window.
+ * Wait until the dust has settled (one second without updates), then
+ * go notify the guest.
+ */
+ timer_mod(con->ui_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 1000);
+ return 0;
}
void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h)
@@ -1724,6 +1739,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
ds = get_alloc_displaystate();
trace_console_gfx_new();
s = new_console(ds, GRAPHIC_CONSOLE, head);
+ s->ui_timer = timer_new_ms(QEMU_CLOCK_REALTIME, dpy_set_ui_info_timer, s);
graphic_console_set_hwops(s, hw_ops, opaque);
if (dev) {
object_property_set_link(OBJECT(s), OBJECT(dev), "device",
--
1.8.3.1
next prev parent reply other threads:[~2015-05-08 11:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 11:48 [Qemu-devel] [PULL 0/5] gtk patch queue Gerd Hoffmann
2015-05-08 11:48 ` Gerd Hoffmann [this message]
2015-05-08 11:48 ` [Qemu-devel] [PULL 2/5] console: add dpy_ui_info_supported Gerd Hoffmann
2015-05-08 11:48 ` [Qemu-devel] [PULL 3/5] gtk: add ui_info support Gerd Hoffmann
2015-05-08 11:48 ` [Qemu-devel] [PULL 4/5] gtk: create gtk.h Gerd Hoffmann
2015-05-08 11:48 ` [Qemu-devel] [PULL 5/5] gtk: update mouse position in mouse_set() Gerd Hoffmann
2015-05-11 11:00 ` [Qemu-devel] [PULL 0/5] gtk patch queue Peter Maydell
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=1431085731-6362-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).