draw popup only on active display

This commit is contained in:
Felix Kratz 2021-12-19 21:06:37 +01:00
parent 086fd93939
commit 77367e4e10

View file

@ -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) {