From: "Jindřich Makovička" <makovick@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/7] sdl2: Do not hide the cursor on auxilliary windows
Date: Tue, 24 Oct 2017 19:39:13 +0200 [thread overview]
Message-ID: <20171024193913.2aca85bf@holly> (raw)
In-Reply-To: <e8fd3ada-8f06-eb10-c5f3-cee3d9ef0c17@amsat.org>
[-- Attachment #1: Type: text/plain, Size: 3636 bytes --]
On Mon, 23 Oct 2017 23:38:16 -0300
Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Hi Jindrich,
>
> This looks like 2 different patches, can you split?
Hi,
here is the split version.
>
> On 10/23/2017 06:07 PM, Jindrich Makovicka wrote:
> > ---
> > ui/sdl2.c | 41 ++++++++++++++++++++++++++++++-----------
> > 1 file changed, 30 insertions(+), 11 deletions(-)
> >
> > diff --git a/ui/sdl2.c b/ui/sdl2.c
> > index aa37b39547..685e4fabec 100644
> > --- a/ui/sdl2.c
> > +++ b/ui/sdl2.c
> > @@ -169,10 +169,10 @@ static void sdl_hide_cursor(void)
> > return;
> > }
> >
> > - if (qemu_input_is_absolute()) {
> > - SDL_ShowCursor(1);
> > - SDL_SetCursor(sdl_cursor_hidden);
> > - } else {
> > + SDL_ShowCursor(SDL_DISABLE);
> > + SDL_SetCursor(sdl_cursor_hidden);
> > +
> > + if (!qemu_input_is_absolute()) {
> > SDL_SetRelativeMouseMode(SDL_TRUE);
> > }
> > }
> > @@ -185,14 +185,16 @@ static void sdl_show_cursor(void)
> >
> > if (!qemu_input_is_absolute()) {
> > SDL_SetRelativeMouseMode(SDL_FALSE);
> > - SDL_ShowCursor(1);
> > - if (guest_cursor &&
> > - (gui_grab || qemu_input_is_absolute() ||
> > absolute_enabled)) {
> > - SDL_SetCursor(guest_sprite);
> > - } else {
> > - SDL_SetCursor(sdl_cursor_normal);
> > - }
> > }
> > +
> > + if (guest_cursor &&
> > + (gui_grab || qemu_input_is_absolute() ||
> > absolute_enabled)) {
> > + SDL_SetCursor(guest_sprite);
> > + } else {
> > + SDL_SetCursor(sdl_cursor_normal);
> > + }
> > +
> > + SDL_ShowCursor(SDL_ENABLE);
> > }
>
> first patch:
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> ---
>
> second patch:
>
> >
> > static void sdl_grab_start(struct sdl2_console *scon)
> > @@ -463,6 +465,10 @@ static void handle_mousemotion(SDL_Event *ev)
> > int max_x, max_y;
> > struct sdl2_console *scon =
> > get_scon_from_window(ev->key.windowID);
> > + if (!qemu_console_is_graphic(scon->dcl.con)) {
> > + return;
> > + }
> > +
> > if (qemu_input_is_absolute() || absolute_enabled) {
> > int scr_w, scr_h;
> > SDL_GetWindowSize(scon->real_window, &scr_w, &scr_h);
> > @@ -490,6 +496,10 @@ static void handle_mousebutton(SDL_Event *ev)
> > SDL_MouseButtonEvent *bev;
> > struct sdl2_console *scon =
> > get_scon_from_window(ev->key.windowID);
> > + if (!qemu_console_is_graphic(scon->dcl.con)) {
> > + return;
> > + }
> > +
> > bev = &ev->button;
> > if (!gui_grab && !qemu_input_is_absolute()) {
> > if (ev->type == SDL_MOUSEBUTTONUP && bev->button ==
> > SDL_BUTTON_LEFT) { @@ -512,6 +522,10 @@ static void
> > handle_mousewheel(SDL_Event *ev) SDL_MouseWheelEvent *wev =
> > &ev->wheel; InputButton btn;
> >
> > + if (!qemu_console_is_graphic(scon->dcl.con)) {
> > + return;
> > + }
> > +
> > if (wev->y > 0) {
> > btn = INPUT_BUTTON_WHEEL_UP;
> > } else if (wev->y < 0) {
> > @@ -651,6 +665,11 @@ static void
> > sdl_mouse_warp(DisplayChangeListener *dcl, int x, int y, int on)
> > {
> > struct sdl2_console *scon = container_of(dcl, struct
> > sdl2_console, dcl); +
> > + if (!qemu_console_is_graphic(scon->dcl.con)) {
> > + return;
> > + }
> > +
> > if (on) {
> > if (!guest_cursor) {
> > sdl_show_cursor();
> >
>
> Regards,
>
> Phil.
--
Jindrich Makovicka
[-- Attachment #2: 0003-sdl2-Use-the-same-pointer-show-hide-logic-for-absolu.patch --]
[-- Type: text/x-patch, Size: 1587 bytes --]
>From 746858b932706f49f320c34a4e1259fd005625a3 Mon Sep 17 00:00:00 2001
From: Jindrich Makovicka <makovick@gmail.com>
Date: Tue, 24 Oct 2017 19:30:58 +0200
Subject: [PATCH 3/8] sdl2: Use the same pointer show/hide logic for absolute
and relative mode
Also use a proper enum parameter for SDL_ShowCursor
---
ui/sdl2.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index aa37b39547..2d0470189f 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -169,10 +169,10 @@ static void sdl_hide_cursor(void)
return;
}
- if (qemu_input_is_absolute()) {
- SDL_ShowCursor(1);
- SDL_SetCursor(sdl_cursor_hidden);
- } else {
+ SDL_ShowCursor(SDL_DISABLE);
+ SDL_SetCursor(sdl_cursor_hidden);
+
+ if (!qemu_input_is_absolute()) {
SDL_SetRelativeMouseMode(SDL_TRUE);
}
}
@@ -185,14 +185,16 @@ static void sdl_show_cursor(void)
if (!qemu_input_is_absolute()) {
SDL_SetRelativeMouseMode(SDL_FALSE);
- SDL_ShowCursor(1);
- if (guest_cursor &&
- (gui_grab || qemu_input_is_absolute() || absolute_enabled)) {
- SDL_SetCursor(guest_sprite);
- } else {
- SDL_SetCursor(sdl_cursor_normal);
- }
}
+
+ if (guest_cursor &&
+ (gui_grab || qemu_input_is_absolute() || absolute_enabled)) {
+ SDL_SetCursor(guest_sprite);
+ } else {
+ SDL_SetCursor(sdl_cursor_normal);
+ }
+
+ SDL_ShowCursor(SDL_ENABLE);
}
static void sdl_grab_start(struct sdl2_console *scon)
--
2.15.0.rc2
[-- Attachment #3: 0004-sdl2-Do-not-hide-the-cursor-on-auxilliary-windows.patch --]
[-- Type: text/x-patch, Size: 1901 bytes --]
>From 30174a668c17d230f8e55909f1406c9897baf395 Mon Sep 17 00:00:00 2001
From: Jindrich Makovicka <makovick@gmail.com>
Date: Sat, 14 Oct 2017 16:27:23 +0200
Subject: [PATCH 4/8] sdl2: Do not hide the cursor on auxilliary windows
---
ui/sdl2.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 2d0470189f..685e4fabec 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -465,6 +465,10 @@ static void handle_mousemotion(SDL_Event *ev)
int max_x, max_y;
struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
+ if (!qemu_console_is_graphic(scon->dcl.con)) {
+ return;
+ }
+
if (qemu_input_is_absolute() || absolute_enabled) {
int scr_w, scr_h;
SDL_GetWindowSize(scon->real_window, &scr_w, &scr_h);
@@ -492,6 +496,10 @@ static void handle_mousebutton(SDL_Event *ev)
SDL_MouseButtonEvent *bev;
struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
+ if (!qemu_console_is_graphic(scon->dcl.con)) {
+ return;
+ }
+
bev = &ev->button;
if (!gui_grab && !qemu_input_is_absolute()) {
if (ev->type == SDL_MOUSEBUTTONUP && bev->button == SDL_BUTTON_LEFT) {
@@ -514,6 +522,10 @@ static void handle_mousewheel(SDL_Event *ev)
SDL_MouseWheelEvent *wev = &ev->wheel;
InputButton btn;
+ if (!qemu_console_is_graphic(scon->dcl.con)) {
+ return;
+ }
+
if (wev->y > 0) {
btn = INPUT_BUTTON_WHEEL_UP;
} else if (wev->y < 0) {
@@ -653,6 +665,11 @@ static void sdl_mouse_warp(DisplayChangeListener *dcl,
int x, int y, int on)
{
struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
+
+ if (!qemu_console_is_graphic(scon->dcl.con)) {
+ return;
+ }
+
if (on) {
if (!guest_cursor) {
sdl_show_cursor();
--
2.15.0.rc2
next prev parent reply other threads:[~2017-10-24 17:39 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-23 21:07 [Qemu-devel] SDL2 various fixes Jindrich Makovicka
2017-10-23 21:07 ` [Qemu-devel] [PATCH 1/7] sdl2: Fix broken display updating after the window is hidden Jindrich Makovicka
2017-11-01 10:37 ` Gerd Hoffmann
2017-10-23 21:07 ` [Qemu-devel] [PATCH 2/7] sdl2: Do not quit the emulator when an auxilliary window is closed Jindrich Makovicka
2017-11-01 10:39 ` Gerd Hoffmann
2017-10-23 21:07 ` [Qemu-devel] [PATCH 3/7] sdl2: Do not hide the cursor on auxilliary windows Jindrich Makovicka
2017-10-24 2:38 ` Philippe Mathieu-Daudé
2017-10-24 17:39 ` Jindřich Makovička [this message]
2017-10-23 21:08 ` [Qemu-devel] [PATCH 4/7] sdl2: Only accept the hotkeys on the main window Jindrich Makovicka
2017-11-01 10:40 ` Gerd Hoffmann
2017-11-02 17:12 ` Jindřich Makovička
2017-11-03 9:26 ` Gerd Hoffmann
2017-11-03 9:37 ` Peter Maydell
2017-11-03 10:35 ` Gerd Hoffmann
2017-11-03 10:41 ` Peter Maydell
2017-11-03 10:45 ` Daniel P. Berrange
2017-11-03 11:01 ` Gerd Hoffmann
2017-11-03 11:10 ` Peter Maydell
2017-11-03 12:07 ` Gerd Hoffmann
2017-11-03 12:10 ` Peter Maydell
2017-11-03 12:34 ` Gerd Hoffmann
2017-11-05 14:10 ` Cole Robinson
2017-11-08 10:10 ` Gerd Hoffmann
2017-11-08 19:15 ` Jindřich Makovička
2017-10-23 21:08 ` [Qemu-devel] [PATCH 5/7] sdl2 uses surface relative coordinates Jindrich Makovicka
2017-11-01 10:43 ` Gerd Hoffmann
2017-11-02 17:07 ` Jindřich Makovička
2017-11-03 9:53 ` Gerd Hoffmann
2017-10-23 21:08 ` [Qemu-devel] [PATCH 6/7] sdl2: Fix dead keyboard after fullsceen Jindrich Makovicka
2017-10-23 21:08 ` [Qemu-devel] [PATCH 7/7] sdl2: Do not leave grab when fullscreen Jindrich Makovicka
2017-10-24 2:40 ` [Qemu-devel] SDL2 various fixes Philippe Mathieu-Daudé
2017-11-12 10:42 ` [Qemu-devel] [PATCH] " Jindrich Makovicka
2017-11-12 10:42 ` [Qemu-devel] [PATCH 1/8] sdl2: Fix broken display updating after the window is hidden Jindrich Makovicka
2017-11-12 10:42 ` [Qemu-devel] [PATCH 2/8] sdl2: Do not quit the emulator when an auxilliary window is closed Jindrich Makovicka
2017-11-12 10:42 ` [Qemu-devel] [PATCH 3/8] sdl2: Use the same pointer show/hide logic for absolute and relative mode Jindrich Makovicka
2017-11-12 10:42 ` [Qemu-devel] [PATCH 4/8] sdl2: Do not hide the cursor on auxilliary windows Jindrich Makovicka
2017-11-12 10:42 ` [Qemu-devel] [PATCH 5/8] sdl2 uses surface relative coordinates Jindrich Makovicka
2017-11-12 10:42 ` [Qemu-devel] [PATCH 6/8] sdl2: Fix dead keyboard after fullsceen Jindrich Makovicka
2017-11-12 10:42 ` [Qemu-devel] [PATCH 7/8] sdl2: Do not leave grab when fullscreen Jindrich Makovicka
2017-11-12 10:42 ` [Qemu-devel] [PATCH 8/8] sdl2: Ignore UI hotkeys after a focus change when GUI modifier is held Jindrich Makovicka
2017-11-12 17:17 ` [Qemu-devel] [PATCH] SDL2 various fixes Philippe Mathieu-Daudé
2017-11-12 19:30 ` [Qemu-devel] [PATCH v3] " Jindrich Makovicka
2017-11-12 19:30 ` [Qemu-devel] [PATCH 1/8] sdl2: Fix broken display updating after the window is hidden Jindrich Makovicka
2017-11-13 12:39 ` Gerd Hoffmann
2017-11-13 12:59 ` Gerd Hoffmann
2017-11-13 13:17 ` Jindřich Makovička
2017-11-13 13:38 ` Gerd Hoffmann
2017-11-13 16:35 ` Max Reitz
2017-11-14 9:53 ` Gerd Hoffmann
2017-11-14 14:48 ` Max Reitz
2017-11-14 15:12 ` Gerd Hoffmann
2017-11-12 19:30 ` [Qemu-devel] [PATCH 2/8] sdl2: Do not quit the emulator when an auxilliary window is closed Jindrich Makovicka
2017-11-12 19:30 ` [Qemu-devel] [PATCH 3/8] sdl2: Use the same pointer show/hide logic for absolute and relative mode Jindrich Makovicka
2017-11-12 19:30 ` [Qemu-devel] [PATCH 4/8] sdl2: Do not hide the cursor on auxilliary windows Jindrich Makovicka
2017-11-13 13:21 ` Gerd Hoffmann
2017-11-12 19:30 ` [Qemu-devel] [PATCH 5/8] sdl2 uses surface relative coordinates Jindrich Makovicka
2017-11-13 13:22 ` Gerd Hoffmann
2017-11-12 19:30 ` [Qemu-devel] [PATCH 6/8] sdl2: Fix dead keyboard after fullsceen Jindrich Makovicka
2017-11-12 19:30 ` [Qemu-devel] [PATCH 7/8] sdl2: Do not leave grab when fullscreen Jindrich Makovicka
2017-11-12 19:30 ` [Qemu-devel] [PATCH 8/8] sdl2: Ignore UI hotkeys after a focus change when GUI modifier is held Jindrich Makovicka
2017-11-13 13:29 ` Gerd Hoffmann
2017-11-13 13:34 ` [Qemu-devel] [PATCH v3] SDL2 various fixes Gerd Hoffmann
2017-11-13 15:46 ` Eric Blake
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=20171024193913.2aca85bf@holly \
--to=makovick@gmail.com \
--cc=f4bug@amsat.org \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.