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:
parent
d57e797147
commit
5fde2cf91a
|
@ -19,12 +19,15 @@ int main()
|
||||||
attributes.alpha_channel = false;
|
attributes.alpha_channel = false;
|
||||||
attributes.rounded_corners = false;
|
attributes.rounded_corners = false;
|
||||||
window->set_attributes(attributes);
|
window->set_attributes(attributes);
|
||||||
|
window->set_close_window_event_callback([]() {});
|
||||||
|
|
||||||
window->set_position(0, 0);
|
window->set_position(0, 0);
|
||||||
|
|
||||||
window->fill(bg_color);
|
window->fill(bg_color);
|
||||||
window->invalidate();
|
window->invalidate();
|
||||||
|
|
||||||
|
bool is_running = true;
|
||||||
|
|
||||||
time_t last_update;
|
time_t last_update;
|
||||||
const auto update_time_string =
|
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->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->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();
|
update_time_string();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue