Skip to content

Commit

Permalink
Simplify boolean condition using XOR
Browse files Browse the repository at this point in the history
(A && !B) || (!A && B) <==> A ^ B

PR Genymobile#5076 <Genymobile#5076>
  • Loading branch information
rom1v authored and FreedomBen committed Aug 2, 2024
1 parent ebb54f6 commit fe955c7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/src/input_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,7 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im,
bool ctrl_pressed = keymod & KMOD_CTRL;
bool shift_pressed = keymod & KMOD_SHIFT;
if (event->button == SDL_BUTTON_LEFT &&
((down && !im->vfinger_down &&
((ctrl_pressed && !shift_pressed) ||
(!ctrl_pressed && shift_pressed))) ||
((down && !im->vfinger_down && (ctrl_pressed ^ shift_pressed)) ||
(!down && im->vfinger_down))) {
struct sc_point mouse =
sc_screen_convert_window_to_frame_coords(im->screen, event->x,
Expand Down

0 comments on commit fe955c7

Please sign in to comment.