From 625a44a81edfff588d3ba299d1065ad966ab7ec1 Mon Sep 17 00:00:00 2001 From: Felix Kratz Date: Tue, 4 Jan 2022 19:24:02 +0100 Subject: [PATCH] no redraw when space is fullscreen --- src/bar.c | 3 ++- src/bar.h | 2 ++ src/bar_manager.c | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bar.c b/src/bar.c index 69634bca..e43d5d12 100644 --- a/src/bar.c +++ b/src/bar.c @@ -20,7 +20,7 @@ void bar_draw_graph(struct bar* bar, struct bar_item* bar_item, uint32_t x, bool } bool bar_draws_item(struct bar* bar, struct bar_item* bar_item) { - if (!bar_item->drawing) return false; + if (!bar_item->drawing || !bar->shown) return false; if (bar_item->associated_display > 0 && !(bar_item->associated_display & (1 << bar->adid))) return false; if (bar_item->associated_space > 0 && !(bar_item->associated_space & (1 << bar->sid)) && (bar_item->type != BAR_COMPONENT_SPACE)) return false; if (bar_item->position == POSITION_POPUP) return false; @@ -223,6 +223,7 @@ struct bar *bar_create(uint32_t did) { bar->did = did; bar->sid = mission_control_index(display_space_id(did)); bar->notch_width = CGDisplayIsBuiltin(did) ? g_bar_manager.notch_width : 0; + bar->shown = true; bar_create_window(bar); return bar; } diff --git a/src/bar.h b/src/bar.h index 541b94ee..c5445025 100644 --- a/src/bar.h +++ b/src/bar.h @@ -24,6 +24,7 @@ extern CGError SLSClearActivationRegion(uint32_t cid, uint32_t wid); extern CGError SLSRemoveAllTrackingAreas(uint32_t cid, uint32_t wid); extern CGError SLSMoveWindow(int cid, uint32_t wid, CGPoint *point); extern CGError SLSWindowSetShadowProperties(uint32_t wid, CFDictionaryRef properties); +extern int SLSSpaceGetType(int cid, uint64_t sid); #define kCGSDisableShadowTagBit (1ULL << 3) #define kCGSHighQualityResamplingTagBit (1ULL << 4) @@ -39,6 +40,7 @@ extern CGError SLSWindowSetShadowProperties(uint32_t wid, CFDictionaryRef proper struct bar { bool hidden; + bool shown; uint32_t id; uint32_t did; uint32_t sid; diff --git a/src/bar_manager.c b/src/bar_manager.c index c99b3c32..e51d3b98 100644 --- a/src/bar_manager.c +++ b/src/bar_manager.c @@ -397,7 +397,11 @@ void bar_manager_handle_front_app_switch(struct bar_manager* bar_manager) { } void bar_manager_handle_space_change(struct bar_manager* bar_manager) { - for (int i = 0; i < bar_manager->bar_count; i++) bar_manager->bars[i]->sid = mission_control_index(display_space_id(bar_manager->bars[i]->did)); + for (int i = 0; i < bar_manager->bar_count; i++) { + bar_manager->bars[i]->sid = mission_control_index(display_space_id(bar_manager->bars[i]->did)); + bar_manager->bars[i]->shown = SLSSpaceGetType(g_connection, bar_manager->bars[i]->sid) != 4; + + } bar_manager_update_space_components(bar_manager, false); bar_manager_custom_events_trigger(bar_manager, COMMAND_SUBSCRIBE_SPACE_CHANGE, NULL); bar_manager_refresh(bar_manager, true);