Message ID | 20171023210803.20998-4-makovick@gmail.com |
---|---|
State | New |
Headers | show |
Series | [1/7] sdl2: Fix broken display updating after the window is hidden | expand |
Hi Jindrich, This looks like 2 different patches, can you split? 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.
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.
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); } 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();