refactor(workspaces): cleaner handle resume

pull/1/head
Alexis 2018-08-09 01:14:06 +02:00
parent c1e2735314
commit 81b5c37d86
1 changed files with 4 additions and 1 deletions

View File

@ -5,13 +5,16 @@ static void handle_idle(void *data, struct org_kde_kwin_idle_timeout *timer) {
auto o = reinterpret_cast<waybar::modules::WorkspaceSelector *>(data); auto o = reinterpret_cast<waybar::modules::WorkspaceSelector *>(data);
if (o->thread) { if (o->thread) {
delete o->thread; delete o->thread;
o->thread = nullptr;
} }
} }
static void handle_resume(void *data, struct org_kde_kwin_idle_timeout *timer) { static void handle_resume(void *data, struct org_kde_kwin_idle_timeout *timer) {
auto o = reinterpret_cast<waybar::modules::WorkspaceSelector *>(data); auto o = reinterpret_cast<waybar::modules::WorkspaceSelector *>(data);
if (!o->thread) {
o->updateThread(); o->updateThread();
} }
}
static const struct org_kde_kwin_idle_timeout_listener idle_timer_listener = { static const struct org_kde_kwin_idle_timeout_listener idle_timer_listener = {
.idle = handle_idle, .idle = handle_idle,