Commit 13224a87fb27a5d029388aa61a1347aa89dd3788
1 parent
7ba1260a
added mouse event generation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2056 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
25 additions
and
1 deletions
monitor.c
| ... | ... | @@ -821,6 +821,26 @@ static void do_send_key(const char *string) |
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | +static int mouse_button_state; | |
| 825 | + | |
| 826 | +static void do_mouse_move(const char *dx_str, const char *dy_str, | |
| 827 | + const char *dz_str) | |
| 828 | +{ | |
| 829 | + int dx, dy, dz; | |
| 830 | + dx = strtol(dx_str, NULL, 0); | |
| 831 | + dy = strtol(dy_str, NULL, 0); | |
| 832 | + dz = 0; | |
| 833 | + if (dz_str) | |
| 834 | + dz = strtol(dz_str, NULL, 0); | |
| 835 | + kbd_mouse_event(dx, dy, dz, mouse_button_state); | |
| 836 | +} | |
| 837 | + | |
| 838 | +static void do_mouse_button(int button_state) | |
| 839 | +{ | |
| 840 | + mouse_button_state = button_state; | |
| 841 | + kbd_mouse_event(0, 0, 0, mouse_button_state); | |
| 842 | +} | |
| 843 | + | |
| 824 | 844 | static void do_ioport_read(int count, int format, int size, int addr, int has_index, int index) |
| 825 | 845 | { |
| 826 | 846 | uint32_t val; |
| ... | ... | @@ -1109,6 +1129,10 @@ static term_cmd_t term_cmds[] = { |
| 1109 | 1129 | "device", "remove USB device 'bus.addr'" }, |
| 1110 | 1130 | { "cpu", "i", do_cpu_set, |
| 1111 | 1131 | "index", "set the default CPU" }, |
| 1132 | + { "mouse_move", "sss?", do_mouse_move, | |
| 1133 | + "dx dy [dz]", "send mouse move events" }, | |
| 1134 | + { "mouse_button", "i", do_mouse_button, | |
| 1135 | + "state", "change mouse button state (1=L, 2=M, 4=R)" }, | |
| 1112 | 1136 | { NULL, NULL, }, |
| 1113 | 1137 | }; |
| 1114 | 1138 | |
| ... | ... | @@ -1949,7 +1973,6 @@ static void monitor_handle_command(const char *cmdline) |
| 1949 | 1973 | while (isspace(*p)) |
| 1950 | 1974 | p++; |
| 1951 | 1975 | if (*typestr == '?' || *typestr == '.') { |
| 1952 | - typestr++; | |
| 1953 | 1976 | if (*typestr == '?') { |
| 1954 | 1977 | if (*p == '\0') |
| 1955 | 1978 | has_arg = 0; |
| ... | ... | @@ -1965,6 +1988,7 @@ static void monitor_handle_command(const char *cmdline) |
| 1965 | 1988 | has_arg = 0; |
| 1966 | 1989 | } |
| 1967 | 1990 | } |
| 1991 | + typestr++; | |
| 1968 | 1992 | if (nb_args >= MAX_ARGS) |
| 1969 | 1993 | goto error_args; |
| 1970 | 1994 | args[nb_args++] = (void *)has_arg; | ... | ... |