mirror of
https://github.com/FelixKratz/SketchyBar
synced 2025-02-16 12:38:26 +00:00
mouse button code in INFO environment varaible (#356)
This commit is contained in:
parent
e442ac8515
commit
2cd868a8ee
3 changed files with 12 additions and 3 deletions
|
@ -177,9 +177,17 @@ void bar_item_on_drag(struct bar_item* bar_item, CGPoint point) {
|
|||
}
|
||||
}
|
||||
|
||||
void bar_item_on_click(struct bar_item* bar_item, uint32_t type, uint32_t modifier, CGPoint point) {
|
||||
void bar_item_on_click(struct bar_item* bar_item, uint32_t type, uint32_t mouse_button_code, uint32_t modifier, CGPoint point) {
|
||||
if (!bar_item) return;
|
||||
|
||||
char button_code_str[32];
|
||||
|
||||
snprintf(button_code_str, 32, "%u", mouse_button_code);
|
||||
|
||||
env_vars_set(&bar_item->signal_args.env_vars,
|
||||
string_copy("INFO"),
|
||||
string_copy(button_code_str));
|
||||
|
||||
env_vars_set(&bar_item->signal_args.env_vars,
|
||||
string_copy("BUTTON"),
|
||||
string_copy(get_type_description(type)));
|
||||
|
|
|
@ -105,7 +105,7 @@ bool bar_item_is_shown(struct bar_item* bar_item);
|
|||
void bar_item_needs_update(struct bar_item* bar_item);
|
||||
bool bar_item_update(struct bar_item* bar_item, char* sender, bool forced, struct env_vars* env_vars);
|
||||
|
||||
void bar_item_on_click(struct bar_item* bar_item, uint32_t type, uint32_t modifier, CGPoint point);
|
||||
void bar_item_on_click(struct bar_item* bar_item, uint32_t type, uint32_t mouse_button_code, uint32_t modifier, CGPoint point);
|
||||
void bar_item_on_drag(struct bar_item* bar_item, CGPoint point);
|
||||
void bar_item_mouse_entered(struct bar_item* bar_item);
|
||||
void bar_item_mouse_exited(struct bar_item* bar_item);
|
||||
|
|
|
@ -102,6 +102,7 @@ EVENT_CALLBACK(EVENT_HANDLER_MOUSE_UP) {
|
|||
CGPoint point = CGEventGetLocation(context);
|
||||
uint32_t wid = get_window_id_from_cg_event(context);
|
||||
CGEventType type = CGEventGetType(context);
|
||||
uint32_t mouse_button_code = CGEventGetIntegerValueField(context, kCGMouseEventButtonNumber);
|
||||
uint32_t modifier_keys = CGEventGetFlags(context);
|
||||
uint32_t adid = display_arrangement(display_active_display_id());
|
||||
|
||||
|
@ -123,7 +124,7 @@ EVENT_CALLBACK(EVENT_HANDLER_MOUSE_UP) {
|
|||
}
|
||||
}
|
||||
|
||||
bar_item_on_click(bar_item, type, modifier_keys, point_in_window_coords);
|
||||
bar_item_on_click(bar_item, type, mouse_button_code, modifier_keys, point_in_window_coords);
|
||||
|
||||
if (bar_item && bar_item->needs_update)
|
||||
bar_manager_refresh(&g_bar_manager, false);
|
||||
|
|
Loading…
Add table
Reference in a new issue