removed unnecessary mouse flags

This commit is contained in:
FelixKratz 2021-08-20 23:56:05 +02:00
parent b5e1d01802
commit cf1a2b93db
3 changed files with 6 additions and 23 deletions

View file

@ -6,6 +6,7 @@ extern struct display_manager g_display_manager;
extern struct bar_manager g_bar_manager;
extern struct application_manager g_application_manager;
extern struct mouse_state g_mouse_state;
extern struct window_manager g_window_manager;
extern int g_connection;
enum event_type event_type_from_string(const char *str)
@ -253,9 +254,9 @@ static EVENT_CALLBACK(EVENT_HANDLER_MOUSE_DOWN) {
return EVENT_SUCCESS;
}
static EVENT_CALLBACK(EVENT_HANDLER_MOUSE_UP)
{
static EVENT_CALLBACK(EVENT_HANDLER_MOUSE_UP) {
CGPoint point = CGEventGetLocation(context);
uint32_t sid = mission_control_index(display_space_id(display_manager_active_display_id()));
debug("EVENT_HANDLER_MOUSE_UP: S#%d (x: %.0f, y: %.0f) -> ", sid, point.x, point.y);
struct bar_item* bar_item = bar_manager_get_item_by_point(&g_bar_manager, point, sid);

View file

@ -14,25 +14,11 @@ static EVENT_TAP_CALLBACK(mouse_handler)
struct event_tap *event_tap = (struct event_tap *) reference;
CGEventTapEnable(event_tap->handle, 1);
} break;
case kCGEventLeftMouseDown:
case kCGEventRightMouseDown: {
struct event *event = event_create(&g_event_loop, MOUSE_DOWN , (void *) CFRetain(cgevent));
event_loop_post(&g_event_loop, event);
} break;
case kCGEventLeftMouseUp:
case kCGEventRightMouseUp: {
struct event *event = event_create(&g_event_loop, MOUSE_UP, (void *) CFRetain(cgevent));
event_loop_post(&g_event_loop, event);
} break;
case kCGEventLeftMouseDragged:
case kCGEventRightMouseDragged: {
struct event *event = event_create(&g_event_loop, MOUSE_DRAGGED, (void *) CFRetain(cgevent));
event_loop_post(&g_event_loop, event);
} break;
case kCGEventMouseMoved: {
struct event *event = event_create(&g_event_loop, MOUSE_MOVED, (void *) CFRetain(cgevent));
event_loop_post(&g_event_loop, event);
} break;
}
return cgevent;

View file

@ -1,13 +1,8 @@
#ifndef EVENT_TAP_H
#define EVENT_TAP_H
#define EVENT_MASK_MOUSE (1 << kCGEventMouseMoved) | \
(1 << kCGEventLeftMouseDown) | \
(1 << kCGEventLeftMouseUp) | \
(1 << kCGEventLeftMouseDragged) | \
(1 << kCGEventRightMouseDown) | \
(1 << kCGEventRightMouseUp) | \
(1 << kCGEventRightMouseDragged)
#define EVENT_MASK_MOUSE (1 << kCGEventLeftMouseUp) | \
(1 << kCGEventRightMouseUp)
#define EVENT_MASK_ALT kCGEventFlagMaskAlternate
#define EVENT_MASK_SHIFT kCGEventFlagMaskShift
@ -29,6 +24,7 @@ struct event_tap
void *reference)
typedef EVENT_TAP_CALLBACK(event_tap_callback);
static EVENT_TAP_CALLBACK(mouse_handler);
bool event_tap_enabled(struct event_tap *event_tap);
bool event_tap_begin(struct event_tap *event_tap, uint32_t mask, event_tap_callback *callback);
void event_tap_end(struct event_tap *event_tap);