Skip to content

Commit

Permalink
#376 don't forward mouse-up event to the target application if we con…
Browse files Browse the repository at this point in the history
…sumed the mouse-down event
  • Loading branch information
koekeishiya committed Feb 8, 2020
1 parent 68a4ac1 commit 9ec1b05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Config file is no longer required for yabai to start [#393](https://github.com/koekeishiya/yabai/issues/393)
- Clear umask before trying to install scripting addition [#400](https://github.com/koekeishiya/yabai/issues/400)
- Update scripting addition to work with macos Catalina 10.15.4 Beta [#404](https://github.com/koekeishiya/yabai/issues/404)
- Don't forward MOUSE_UP event to the target application if we consumed the corresponding MOUSE_DOWN event [#376](https://github.com/koekeishiya/yabai/issues/376)

## [2.2.2] - 2020-01-20
### Changed
Expand Down
6 changes: 5 additions & 1 deletion src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,9 +1112,13 @@ end:;
}

out:
g_mouse_state.current_action = MOUSE_MODE_NONE;
g_mouse_state.window = NULL;

if (g_mouse_state.current_action != MOUSE_MODE_NONE) {
g_mouse_state.current_action = MOUSE_MODE_NONE;
return EVENT_MOUSE_IGNORE;
}

return EVENT_SUCCESS;
}

Expand Down
8 changes: 8 additions & 0 deletions src/event_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ static EVENT_TAP_CALLBACK(mouse_handler)
} break;
case kCGEventLeftMouseUp:
case kCGEventRightMouseUp: {
volatile int status = EVENT_QUEUED;
volatile int result = EVENT_SUCCESS;

struct event *event;
event_create(event, MOUSE_UP, (void *) CFRetain(cgevent));
event->status = &status;
event->result = &result;
event_loop_post(&g_event_loop, event);
while (status == EVENT_QUEUED);

if (result == EVENT_MOUSE_IGNORE) return NULL;
} break;
case kCGEventLeftMouseDragged:
case kCGEventRightMouseDragged: {
Expand Down

0 comments on commit 9ec1b05

Please sign in to comment.