diff --git a/src/alias.c b/src/alias.c index def3c28c..69156b1e 100644 --- a/src/alias.c +++ b/src/alias.c @@ -161,7 +161,6 @@ static bool alias_update_image(struct alias* alias, bool forced) { CGImageRef image_ref = window_capture(&alias->window); if (!image_ref) { - window_init(&alias->window); return false; } diff --git a/src/sketchybar.m b/src/sketchybar.m index 2bc6b968..856475e2 100644 --- a/src/sketchybar.m +++ b/src/sketchybar.m @@ -24,8 +24,9 @@ #define MAJOR 2 #define MINOR 14 -#define PATCH 2 +#define PATCH 3 +extern CGError SLSRegisterNotifyProc(void* callback, uint32_t event, void* context); extern int SLSMainConnectionID(void); extern int RunApplicationEventLoop(void); @@ -209,11 +210,11 @@ void system_events(uint32_t event, void* data, size_t data_length, void* context } } -extern CGError SLSRegisterNotifyProc(void* callback, uint32_t event, void* context); int main(int argc, char **argv) { if (argc > 1) parse_arguments(argc, argv); - if (is_root()) error("sketchybar: running as root is not allowed! abort..\n"); + if (is_root()) + error("sketchybar: running as root is not allowed! abort..\n"); init_misc_settings(); acquire_lockfile(); diff --git a/src/window.c b/src/window.c index 30f86718..9b59ad8c 100644 --- a/src/window.c +++ b/src/window.c @@ -2,6 +2,7 @@ #include "bar_manager.h" extern struct bar_manager g_bar_manager; +extern int64_t g_disable_capture; void window_init(struct window* window) { window->context = NULL; @@ -241,19 +242,18 @@ void window_disable_shadow(struct window* window) { CFRelease(shadow_props_cf); } -extern int64_t g_disable_capture; CGImageRef window_capture(struct window* window) { if (g_disable_capture) { int64_t time = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW_APPROX); if (g_disable_capture < 0) { return NULL; - } - else if (time - g_disable_capture > (int64_t)2e9) { + } else if (time - g_disable_capture > (1ULL << 30)) { g_disable_capture = 0; } else { return NULL; } } + CGImageRef image_ref = NULL; uint64_t wid = window->id;