Allow mouse plugin to fail gracefully

This commit is contained in:
2007-04-29 12:25:24 +00:00
parent 23a84186ff
commit 6e77894ac7

View File

@@ -52,16 +52,20 @@ int mouse_x, mouse_y, mouse_z;
int mouse_init(void)
{
mouse_fd = open(MOUSEDEVICE, O_RDONLY);
if (mouse_fd < 0)
err(1, "can't open mouse device");
vm_register_signal_fd(mouse_fd, VM_MOUSEQ);
mouse_initialised = 1;
mouse_x = 0;
mouse_y = 0;
mouse_z = 0;
mouse_fd = open(MOUSEDEVICE, O_RDONLY);
if (mouse_fd < 0) {
warn("can't open mouse device");
mouse_initialised = 0;
return 0;
}
vm_register_signal_fd(mouse_fd, VM_MOUSEQ);
mouse_initialised = 1;
return 1;
}