diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-07-14 22:03:35 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-07-14 22:03:35 +0000 |
commit | 13224a87fb27a5d029388aa61a1347aa89dd3788 (patch) | |
tree | f1cb7e1a8e455ecdaff0584b2bacfcbe5f0fddf5 | |
parent | 7ba1260ac1637f5d9e3af619e74de3cb39f10ba6 (diff) |
added mouse event generation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2056 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | monitor.c | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -821,6 +821,26 @@ static void do_send_key(const char *string) } } +static int mouse_button_state; + +static void do_mouse_move(const char *dx_str, const char *dy_str, + const char *dz_str) +{ + int dx, dy, dz; + dx = strtol(dx_str, NULL, 0); + dy = strtol(dy_str, NULL, 0); + dz = 0; + if (dz_str) + dz = strtol(dz_str, NULL, 0); + kbd_mouse_event(dx, dy, dz, mouse_button_state); +} + +static void do_mouse_button(int button_state) +{ + mouse_button_state = button_state; + kbd_mouse_event(0, 0, 0, mouse_button_state); +} + static void do_ioport_read(int count, int format, int size, int addr, int has_index, int index) { uint32_t val; @@ -1109,6 +1129,10 @@ static term_cmd_t term_cmds[] = { "device", "remove USB device 'bus.addr'" }, { "cpu", "i", do_cpu_set, "index", "set the default CPU" }, + { "mouse_move", "sss?", do_mouse_move, + "dx dy [dz]", "send mouse move events" }, + { "mouse_button", "i", do_mouse_button, + "state", "change mouse button state (1=L, 2=M, 4=R)" }, { NULL, NULL, }, }; @@ -1949,7 +1973,6 @@ static void monitor_handle_command(const char *cmdline) while (isspace(*p)) p++; if (*typestr == '?' || *typestr == '.') { - typestr++; if (*typestr == '?') { if (*p == '\0') has_arg = 0; @@ -1965,6 +1988,7 @@ static void monitor_handle_command(const char *cmdline) has_arg = 0; } } + typestr++; if (nb_args >= MAX_ARGS) goto error_args; args[nb_args++] = (void *)has_arg; |