Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix popup rendering when first adding an item in and removing all items #631

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/popup.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ static void popup_create_window(struct popup* popup) {
}

static void popup_close_window(struct popup* popup) {
popup->drawing = false;
if (popup == &g_bar_manager.default_item.popup) return;
window_close(&popup->window);
}
Expand All @@ -276,6 +275,9 @@ void popup_add_item(struct popup* popup, struct bar_item* bar_item) {
popup->items[popup->num_items - 1] = bar_item;
bar_item->parent = popup->host;
popup->needs_ordering = true;
if (popup->num_items == 1){
popup_draw(popup);
}
}

void popup_remove_item(struct popup* popup, struct bar_item* bar_item) {
Expand All @@ -285,6 +287,7 @@ void popup_remove_item(struct popup* popup, struct bar_item* bar_item) {
free(popup->items);
popup->items = NULL;
popup->num_items = 0;
popup_close_window(popup);
return;
}

Expand Down