From nobody Fri Apr 26 05:41:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1581524361199872.1209866387424; Wed, 12 Feb 2020 08:19:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-Q__iGqD1MHazFZt69k1hwQ-1; Wed, 12 Feb 2020 11:19:17 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 84D14DBB9; Wed, 12 Feb 2020 16:19:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59EEA5DA85; Wed, 12 Feb 2020 16:19:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1B6508B2AE; Wed, 12 Feb 2020 16:19:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01CGIjhn030151 for ; Wed, 12 Feb 2020 11:18:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 734F15C541; Wed, 12 Feb 2020 16:18:45 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-39.ams2.redhat.com [10.36.117.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55B3F5C1C3; Wed, 12 Feb 2020 16:18:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F41DD31E30; Wed, 12 Feb 2020 17:18:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581524359; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=44B7xvdFL9drjnEYHmM0Jft6hxwGiV7s0cphZbAJGac=; b=YVaXU9AGiHP2/9rKmrW79Y3deRMxJS0A/eZTM2DnnvejxeO5nn1NzRCDXszvfJUuA23UvA 95uK8YoLXjCJg71wCpYk7rDJf1YaTFLgVmnHDvhpaRv7WqiJX0D/8gNdYUyvwHFYhFJ9X0 DjIAFI03Id72AoT2ZqNtI+WG7nARLEk= From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 05/10] ui/sdl: switch to new show-cursor option Date: Wed, 12 Feb 2020 17:18:30 +0100 Message-Id: <20200212161835.28576-6-kraxel@redhat.com> In-Reply-To: <20200212161835.28576-1-kraxel@redhat.com> References: <20200212161835.28576-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Maydell , libvir-list@redhat.com, Gerd Hoffmann , Paolo Bonzini X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: Q__iGqD1MHazFZt69k1hwQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use DisplayOpts settings instead of cursor_hide global variable. Also make "-display sdl,show-cursor=3Don" work. Signed-off-by: Gerd Hoffmann Reviewed-by: J=C3=A1n Tomko --- ui/sdl2.c | 16 ++++++++-------- vl.c | 10 ++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ui/sdl2.c b/ui/sdl2.c index 9030f1c42efb..3c9424eb42c3 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -161,9 +161,9 @@ static void sdl_update_caption(struct sdl2_console *sco= n) } } =20 -static void sdl_hide_cursor(void) +static void sdl_hide_cursor(struct sdl2_console *scon) { - if (!cursor_hide) { + if (scon->opts->has_show_cursor && scon->opts->show_cursor) { return; } =20 @@ -175,9 +175,9 @@ static void sdl_hide_cursor(void) } } =20 -static void sdl_show_cursor(void) +static void sdl_show_cursor(struct sdl2_console *scon) { - if (!cursor_hide) { + if (scon->opts->has_show_cursor && scon->opts->show_cursor) { return; } =20 @@ -216,7 +216,7 @@ static void sdl_grab_start(struct sdl2_console *scon) SDL_WarpMouseInWindow(scon->real_window, guest_x, guest_y); } } else { - sdl_hide_cursor(); + sdl_hide_cursor(scon); } SDL_SetWindowGrab(scon->real_window, SDL_TRUE); gui_grab =3D 1; @@ -227,7 +227,7 @@ static void sdl_grab_end(struct sdl2_console *scon) { SDL_SetWindowGrab(scon->real_window, SDL_FALSE); gui_grab =3D 0; - sdl_show_cursor(); + sdl_show_cursor(scon); sdl_update_caption(scon); } =20 @@ -658,7 +658,7 @@ static void sdl_mouse_warp(DisplayChangeListener *dcl, =20 if (on) { if (!guest_cursor) { - sdl_show_cursor(); + sdl_show_cursor(scon); } if (gui_grab || qemu_input_is_absolute() || absolute_enabled) { SDL_SetCursor(guest_sprite); @@ -667,7 +667,7 @@ static void sdl_mouse_warp(DisplayChangeListener *dcl, } } } else if (gui_grab) { - sdl_hide_cursor(); + sdl_hide_cursor(scon); } guest_cursor =3D on; guest_x =3D x, guest_y =3D y; diff --git a/vl.c b/vl.c index 5419b3d68200..0a13cf2b1724 100644 --- a/vl.c +++ b/vl.c @@ -1931,6 +1931,16 @@ static void parse_display(const char *p) } else { goto invalid_sdl_args; } + } else if (strstart(opts, ",show-cursor=3D", &nextopt)) { + opts =3D nextopt; + dpy.has_show_cursor =3D true; + if (strstart(opts, "on", &nextopt)) { + dpy.show_cursor =3D true; + } else if (strstart(opts, "off", &nextopt)) { + dpy.show_cursor =3D false; + } else { + goto invalid_sdl_args; + } } else if (strstart(opts, ",gl=3D", &nextopt)) { opts =3D nextopt; dpy.has_gl =3D true; --=20 2.18.2