qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes
@ 2014-04-11 10:40 Gerd Hoffmann
  2014-04-11 10:40 ` [Qemu-devel] [PULL 1/2] input: sdl2: Fix guest_cursor logic Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-04-11 10:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Two sdl2 fixes for relative mouse mode, by Cole Robinson.

please pull,
  Gerd

The following changes since commit f516a5cc051db6e999e9e60dc968dcb5aeffe11f:

  Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2014-04-10 23:07:56 +0100)

are available in the git repository at:


  git://git.kraxel.org/qemu tags/pull-sdl-1

for you to fetch changes up to 2d968ffbae6b7899064f9f86f8508d9c19021e39:

  input: sdl2: Fix relative mode to match SDL1 behavior (2014-04-11 12:19:16 +0200)

----------------------------------------------------------------
sdl2 relative mouse mode fixes.

----------------------------------------------------------------
Cole Robinson (2):
      input: sdl2: Fix guest_cursor logic
      input: sdl2: Fix relative mode to match SDL1 behavior

 ui/sdl2.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 1/2] input: sdl2: Fix guest_cursor logic
  2014-04-11 10:40 [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes Gerd Hoffmann
@ 2014-04-11 10:40 ` Gerd Hoffmann
  2014-04-11 10:40 ` [Qemu-devel] [PULL 2/2] input: sdl2: Fix relative mode to match SDL1 behavior Gerd Hoffmann
  2014-04-11 13:09 ` [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-04-11 10:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori, Cole Robinson

From: Cole Robinson <crobinso@redhat.com>

Unbreaks relative mouse mode with sdl2, just like was done with sdl.c
in c3aa84b6.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index f1532e9..e4cb9fb 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -403,13 +403,17 @@ static void sdl_send_mouse_event(struct sdl2_state *scon, int dx, int dy,
         }
         qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_X, off_x + x, max_w);
         qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_Y, off_y + y, max_h);
-    } else if (guest_cursor) {
-        x -= guest_x;
-        y -= guest_y;
-        guest_x += x;
-        guest_y += y;
-        qemu_input_queue_rel(scon->dcl.con, INPUT_AXIS_X, x);
-        qemu_input_queue_rel(scon->dcl.con, INPUT_AXIS_Y, y);
+    } else {
+        if (guest_cursor) {
+            x -= guest_x;
+            y -= guest_y;
+            guest_x += x;
+            guest_y += y;
+            dx = x;
+            dy = y;
+        }
+        qemu_input_queue_rel(scon->dcl.con, INPUT_AXIS_X, dx);
+        qemu_input_queue_rel(scon->dcl.con, INPUT_AXIS_Y, dy);
     }
     qemu_input_event_sync();
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 2/2] input: sdl2: Fix relative mode to match SDL1 behavior
  2014-04-11 10:40 [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes Gerd Hoffmann
  2014-04-11 10:40 ` [Qemu-devel] [PULL 1/2] input: sdl2: Fix guest_cursor logic Gerd Hoffmann
@ 2014-04-11 10:40 ` Gerd Hoffmann
  2014-04-11 13:09 ` [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-04-11 10:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori, Cole Robinson

From: Cole Robinson <crobinso@redhat.com>

Right now relative mode accelerates too fast, and has the 'invisible wall'
problem. SDL2 added an explicit API to handle this use case, so let's use
it.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index e4cb9fb..7506e2e 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -278,7 +278,7 @@ static void sdl_hide_cursor(void)
         SDL_ShowCursor(1);
         SDL_SetCursor(sdl_cursor_hidden);
     } else {
-        SDL_ShowCursor(0);
+        SDL_SetRelativeMouseMode(SDL_TRUE);
     }
 }
 
@@ -289,6 +289,7 @@ 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)) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes
  2014-04-11 10:40 [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes Gerd Hoffmann
  2014-04-11 10:40 ` [Qemu-devel] [PULL 1/2] input: sdl2: Fix guest_cursor logic Gerd Hoffmann
  2014-04-11 10:40 ` [Qemu-devel] [PULL 2/2] input: sdl2: Fix relative mode to match SDL1 behavior Gerd Hoffmann
@ 2014-04-11 13:09 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2014-04-11 13:09 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 11 April 2014 11:40, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> Two sdl2 fixes for relative mouse mode, by Cole Robinson.
>
> please pull,
>   Gerd

Applied, thanks.
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-11 13:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-11 10:40 [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes Gerd Hoffmann
2014-04-11 10:40 ` [Qemu-devel] [PULL 1/2] input: sdl2: Fix guest_cursor logic Gerd Hoffmann
2014-04-11 10:40 ` [Qemu-devel] [PULL 2/2] input: sdl2: Fix relative mode to match SDL1 behavior Gerd Hoffmann
2014-04-11 13:09 ` [Qemu-devel] [PULL for-2.0 0/2] sdl2: relative mouse mode fixes Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).