toggle-relative-mouse: add query option 'get'
This commit is contained in:
parent
7e57d22c2a
commit
aca47b862b
@ -17,7 +17,7 @@
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "%s: argument (relative or absolute) expected\n", argv[0]);
|
||||
fprintf(stderr, "%s: argument (relative, absolute, get) expected\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -38,11 +38,25 @@ int main(int argc, char * argv[]) {
|
||||
if (!strcmp(argv[1],"absolute")) {
|
||||
flag = 2;
|
||||
}
|
||||
if (!strcmp(argv[1],"get")) {
|
||||
flag = 3;
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
fprintf(stderr, "%s: invalid argument\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ioctl(fd, flag, NULL);
|
||||
int result = ioctl(fd, flag, NULL);
|
||||
|
||||
if (flag == 3) {
|
||||
if (result == 0) {
|
||||
fprintf(stdout, "relative\n");
|
||||
} else {
|
||||
fprintf(stdout, "absolute\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -216,6 +216,9 @@ static int ioctl_mouse(fs_node_t * node, int request, void * argp) {
|
||||
mouse_on_off(VBOX_MOUSE_ON);
|
||||
return 0;
|
||||
}
|
||||
if (request == 3) {
|
||||
return mouse_state == (VBOX_MOUSE_ON);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -472,6 +472,8 @@ static int ioctl_mouse(fs_node_t * node, int request, void * argp) {
|
||||
ps2_mouse_alternate = vmware_mouse;
|
||||
mouse_absolute();
|
||||
return 0;
|
||||
case 3:
|
||||
return ps2_mouse_alternate == vmware_mouse;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user