mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-27 05:40:17 +00:00
draw popup only on active display
This commit is contained in:
parent
086fd93939
commit
77367e4e10
1 changed files with 11 additions and 10 deletions
21
src/bar.c
21
src/bar.c
|
@ -26,17 +26,18 @@ bool bar_draws_item(struct bar* bar, struct bar_item* bar_item) {
|
|||
}
|
||||
|
||||
void bar_calculate_popup_anchor_for_bar_item(struct bar* bar, struct bar_item* bar_item) {
|
||||
bar_item->popup.cell_size = bar->frame.size.height;
|
||||
popup_calculate_bounds(&bar_item->popup);
|
||||
CGPoint anchor = bar->origin;
|
||||
anchor.x += bar_item->icon.bounds.origin.x - bar_item->background.padding_left;
|
||||
anchor.y += (g_bar_manager.position == POSITION_BOTTOM ? (-bar->frame.size.height - bar_item->popup.background.bounds.size.height) : bar->frame.size.height);
|
||||
if (anchor.x + bar_item->popup.background.bounds.size.width > bar->frame.size.width) {
|
||||
anchor.x = bar->frame.size.width - bar_item->popup.background.bounds.size.width;
|
||||
popup_calculate_bounds(&bar_item->popup);
|
||||
}
|
||||
popup_set_anchor(&bar_item->popup, anchor, bar->adid);
|
||||
if (bar->adid != display_arrangement(display_active_display_id())) return;
|
||||
bar_item->popup.cell_size = bar->frame.size.height;
|
||||
popup_calculate_bounds(&bar_item->popup);
|
||||
CGPoint anchor = bar->origin;
|
||||
anchor.x += bar_item->icon.bounds.origin.x - bar_item->background.padding_left;
|
||||
anchor.y += (g_bar_manager.position == POSITION_BOTTOM ? (-bar->frame.size.height - bar_item->popup.background.bounds.size.height) : bar->frame.size.height);
|
||||
if (anchor.x + bar_item->popup.background.bounds.size.width > bar->frame.size.width) {
|
||||
anchor.x = bar->frame.size.width - bar_item->popup.background.bounds.size.width;
|
||||
popup_calculate_bounds(&bar_item->popup);
|
||||
}
|
||||
popup_set_anchor(&bar_item->popup, anchor, bar->adid);
|
||||
popup_calculate_bounds(&bar_item->popup);
|
||||
}
|
||||
|
||||
void bar_draw_bar_items(struct bar* bar) {
|
||||
|
|
Loading…
Reference in a new issue