Patchwork [2/5] Add hwheel to monitor mouse_move

login
register
mail settings
Submitter Brad Jorsch
Date May 4, 2010, 4:56 p.m.
Message ID <1272992201-26911-3-git-send-email-anomie@users.sourceforge.net>
Download mbox | patch
Permalink /patch/51652/
State New
Headers show

Comments

Brad Jorsch - May 4, 2010, 4:56 p.m.
Adds a parameter to the monitor's mouse_move command to specify the
hwheel delta.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
---
 monitor.c       |    8 ++++++--
 qemu-monitor.hx |    4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 520d48d..baff2cf 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1832,16 +1832,20 @@  static int mouse_button_state;
 
 static void do_mouse_move(Monitor *mon, const QDict *qdict)
 {
-    int dx, dy, dz;
+    int dx, dy, dz, dw;
     const char *dx_str = qdict_get_str(qdict, "dx_str");
     const char *dy_str = qdict_get_str(qdict, "dy_str");
     const char *dz_str = qdict_get_try_str(qdict, "dz_str");
+    const char *dw_str = qdict_get_try_str(qdict, "dw_str");
     dx = strtol(dx_str, NULL, 0);
     dy = strtol(dy_str, NULL, 0);
     dz = 0;
+    dw = 0;
     if (dz_str)
         dz = strtol(dz_str, NULL, 0);
-    kbd_mouse_event(dx, dy, dz, 0, mouse_button_state);
+    if (dw_str)
+        dw = strtol(dw_str, NULL, 0);
+    kbd_mouse_event(dx, dy, dz, dw, mouse_button_state);
 }
 
 static void do_mouse_button(Monitor *mon, const QDict *qdict)
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 5ea5748..00067ba 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -616,8 +616,8 @@  ETEXI
 
     {
         .name       = "mouse_move",
-        .args_type  = "dx_str:s,dy_str:s,dz_str:s?",
-        .params     = "dx dy [dz]",
+        .args_type  = "dx_str:s,dy_str:s,dz_str:s?,dw_str:s?",
+        .params     = "dx dy [dz [dw]]",
         .help       = "send mouse move events",
         .mhandler.cmd = do_mouse_move,
     },