TaskBar: Ignore window close events and exit on connection close

This prevents user from killing the task bar with keyboard shortcuts
This commit is contained in:
Bananymous 2024-10-18 17:19:05 +03:00
parent d57e797147
commit 5fde2cf91a
1 changed files with 6 additions and 2 deletions

View File

@ -19,12 +19,15 @@ int main()
attributes.alpha_channel = false;
attributes.rounded_corners = false;
window->set_attributes(attributes);
window->set_close_window_event_callback([]() {});
window->set_position(0, 0);
window->fill(bg_color);
window->invalidate();
bool is_running = true;
time_t last_update;
const auto update_time_string =
[&]()
@ -40,10 +43,11 @@ int main()
window->fill_rect(text_x, text_y, text_w, text_h, bg_color);
window->draw_text(time_sv, font, text_x, text_y, fg_color);
window->invalidate(text_x, text_y, text_w, text_h);
if (!window->invalidate(text_x, text_y, text_w, text_h))
is_running = false;
};
for (;;)
while (is_running)
{
update_time_string();