correct bounding rects for aliases -> now clickable, etc

This commit is contained in:
Felix Kratz 2021-11-02 11:28:04 +01:00
parent 513fcbc37d
commit 58a53551ee
3 changed files with 10 additions and 1 deletions

View file

@ -66,6 +66,11 @@ uint32_t alias_get_length(struct alias* alias) {
return 0;
}
uint32_t alias_get_height(struct alias* alias) {
if (alias->image_ref) return alias->bounds.size.height;
return 0;
}
void alias_find_window(struct alias* alias) {
CFArrayRef window_list = CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID);
int window_count = CFArrayGetCount(window_list);

View file

@ -20,5 +20,6 @@ void alias_init(struct alias* alias, char* owner, char* name);
bool alias_update_image(struct alias* alias);
void alias_find_window(struct alias* alias);
uint32_t alias_get_length(struct alias* alias);
uint32_t alias_get_height(struct alias* alias);
#endif

View file

@ -273,7 +273,10 @@ uint32_t bar_item_get_length(struct bar_item* bar_item) {
uint32_t bar_item_get_height(struct bar_item* bar_item) {
uint32_t label_height = text_get_height(&bar_item->label);
uint32_t icon_height = text_get_height(&bar_item->icon);
return label_height > icon_height ? label_height : icon_height;
uint32_t alias_height = alias_get_height(&bar_item->alias);
uint32_t text_height = label_height > icon_height ? label_height : icon_height;
return text_height > alias_height ? text_height : alias_height;
}
void bar_item_remove_bounding_rect_for_display(struct bar_item* bar_item, uint32_t adid) {