mirror of https://github.com/nirenjan/libx52.git
fix: Handle shortcut execution in x52d_mouse_report_event
Prior to this change, there is a potential bug where if the left and right mouse buttons and/or wheel are reported in the same HID report, the first one to have a change would block any subsequent items. This is due to the shortcut execution of the `||` operator. By switching the order in which we evaluate the operands, we can ensure that the report_* functions are always called.profile-support
parent
6ec133488b
commit
991a307191
|
|
@ -215,9 +215,9 @@ void x52d_mouse_report_event(libx52io_report *report)
|
|||
}
|
||||
|
||||
state_changed = false;
|
||||
state_changed = state_changed || (0 == report_button_change(VKM_MOUSE_BTN_LEFT, LIBX52IO_BTN_MOUSE_PRIMARY));
|
||||
state_changed = state_changed || (0 == report_button_change(VKM_MOUSE_BTN_RIGHT, LIBX52IO_BTN_MOUSE_SECONDARY));
|
||||
state_changed = state_changed || (0 == report_wheel());
|
||||
state_changed = (0 == report_button_change(VKM_MOUSE_BTN_LEFT, LIBX52IO_BTN_MOUSE_PRIMARY)) || state_changed;
|
||||
state_changed = (0 == report_button_change(VKM_MOUSE_BTN_RIGHT, LIBX52IO_BTN_MOUSE_SECONDARY)) || state_changed;
|
||||
state_changed = (0 == report_wheel()) || state_changed;
|
||||
|
||||
if (state_changed) {
|
||||
report_sync();
|
||||
|
|
|
|||
Loading…
Reference in New Issue