[v2,2/6] ui/gtk: implement show-cursor option
diff mbox series

Message ID 20200206112908.5002-3-kraxel@redhat.com
State New
Headers show
Series
  • ui: rework -show-cursor option
Related show

Commit Message

Gerd Hoffmann Feb. 6, 2020, 11:29 a.m. UTC
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 ui/gtk.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/ui/gtk.c b/ui/gtk.c
index d18892d1de61..78b197ade4c1 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -247,6 +247,7 @@  static void gd_update_cursor(VirtualConsole *vc)
 {
     GtkDisplayState *s = vc->s;
     GdkWindow *window;
+    bool allow_hide_cursor = true;
 
     if (vc->type != GD_VC_GFX ||
         !qemu_console_is_graphic(vc->gfx.dcl.con)) {
@@ -257,8 +258,13 @@  static void gd_update_cursor(VirtualConsole *vc)
         return;
     }
 
+    if (s->opts->has_show_cursor && s->opts->show_cursor) {
+        allow_hide_cursor = false;
+    }
+
     window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area));
-    if (s->full_screen || qemu_input_is_absolute() || s->ptr_owner == vc) {
+    if (allow_hide_cursor &&
+        (s->full_screen || qemu_input_is_absolute() || s->ptr_owner == vc)) {
         gdk_window_set_cursor(window, s->null_cursor);
     } else {
         gdk_window_set_cursor(window, NULL);