mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-10 05:44:16 +00:00
fix aliases not updating properly when the parent application is restarted (#377)
This commit is contained in:
parent
14c6381aa8
commit
4058ffef0b
3 changed files with 11 additions and 3 deletions
|
@ -158,9 +158,14 @@ static bool alias_update_image(struct alias* alias, bool forced) {
|
||||||
if (alias->window.id == 0) alias_find_window(alias);
|
if (alias->window.id == 0) alias_find_window(alias);
|
||||||
if (alias->window.id == 0) return false;
|
if (alias->window.id == 0) return false;
|
||||||
|
|
||||||
CGImageRef image_ref = window_capture(&alias->window);
|
bool disabled = false;
|
||||||
|
CGImageRef image_ref = window_capture(&alias->window, &disabled);
|
||||||
|
|
||||||
if (!image_ref) {
|
if (!image_ref) {
|
||||||
|
if (!disabled) {
|
||||||
|
alias->window.id = 0;
|
||||||
|
image_destroy(&alias->image);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,18 +241,21 @@ void window_disable_shadow(struct window* window) {
|
||||||
CFRelease(shadow_props_cf);
|
CFRelease(shadow_props_cf);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGImageRef window_capture(struct window* window) {
|
CGImageRef window_capture(struct window* window, bool* disabled) {
|
||||||
if (g_disable_capture) {
|
if (g_disable_capture) {
|
||||||
int64_t time = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW_APPROX);
|
int64_t time = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW_APPROX);
|
||||||
if (g_disable_capture < 0) {
|
if (g_disable_capture < 0) {
|
||||||
|
*disabled = true;
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (time - g_disable_capture > (1ULL << 30)) {
|
} else if (time - g_disable_capture > (1ULL << 30)) {
|
||||||
g_disable_capture = 0;
|
g_disable_capture = 0;
|
||||||
} else {
|
} else {
|
||||||
|
*disabled = true;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*disabled = false;
|
||||||
CGImageRef image_ref = NULL;
|
CGImageRef image_ref = NULL;
|
||||||
|
|
||||||
uint64_t wid = window->id;
|
uint64_t wid = window->id;
|
||||||
|
|
|
@ -95,7 +95,7 @@ void window_set_level(struct window* window, uint32_t level);
|
||||||
void window_order(struct window* window, struct window* parent, int mode);
|
void window_order(struct window* window, struct window* parent, int mode);
|
||||||
void window_assign_mouse_tracking_area(struct window* window, CGRect rect);
|
void window_assign_mouse_tracking_area(struct window* window, CGRect rect);
|
||||||
|
|
||||||
CGImageRef window_capture(struct window* window);
|
CGImageRef window_capture(struct window* window, bool* disabled);
|
||||||
|
|
||||||
void context_set_font_smoothing(CGContextRef context, bool smoothing);
|
void context_set_font_smoothing(CGContextRef context, bool smoothing);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue