aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-03-11 11:45:33 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-12-21 10:50:21 +0400
commita4ddc31417199eab96211b254097a0a0869d5bea (patch)
tree8789895c3beaa87e7442b27e415adc5542762de1 /ui
parentac32b2fff127843355b4f7e7ac9f93dd4a395adf (diff)
downloadqemu-a4ddc31417199eab96211b254097a0a0869d5bea.zip
qemu-a4ddc31417199eab96211b254097a0a0869d5bea.tar.gz
qemu-a4ddc31417199eab96211b254097a0a0869d5bea.tar.bz2
ui: make gl_block use a counter
Track multiple callers blocking requests. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/console.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/ui/console.c b/ui/console.c
index 87f897e..39f7b66 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -79,7 +79,7 @@ struct QemuConsole {
DisplaySurface *surface;
int dcls;
DisplayChangeListener *gl;
- bool gl_block;
+ int gl_block;
int window_id;
/* Graphic console state. */
@@ -237,10 +237,19 @@ void graphic_hw_gl_block(QemuConsole *con, bool block)
{
assert(con != NULL);
- con->gl_block = block;
- if (con->hw_ops->gl_block) {
- con->hw_ops->gl_block(con->hw, block);
+ if (block) {
+ con->gl_block++;
+ } else {
+ con->gl_block--;
+ }
+ assert(con->gl_block >= 0);
+ if (!con->hw_ops->gl_block) {
+ return;
+ }
+ if ((block && con->gl_block != 1) || (!block && con->gl_block != 0)) {
+ return;
}
+ con->hw_ops->gl_block(con->hw, block);
}
void graphic_hw_gl_flushed(QemuConsole *con)