flush window content region after redraw

This commit is contained in:
Felix Kratz 2024-05-22 12:14:49 +02:00
parent dd8b7cd124
commit 4aa602ac71
5 changed files with 13 additions and 1 deletions

View file

@ -215,10 +215,14 @@ void bar_draw(struct bar* bar, bool forced, bool threaded) {
CGContextClearRect(window->context, window->frame);
bar_item_draw(bar_item, window->context);
CGContextFlush(window->context);
window_flush(window);
}
}
if (g_bar_manager.bar_needs_update) CGContextFlush(bar->window.context);
if (g_bar_manager.bar_needs_update) {
CGContextFlush(bar->window.context);
window_flush(&bar->window);
}
}
static void bar_calculate_bounds_top_bottom(struct bar* bar) {

View file

@ -711,6 +711,7 @@ void* draw_item_proc(void* context) {
CGContextClearRect(info->window->context, info->window->frame);
bar_item_draw(&info->bar_item, info->window->context);
CGContextFlush(info->window->context);
window_flush(info->window);
free(context);
return NULL;
}

View file

@ -345,6 +345,7 @@ void popup_draw(struct popup* popup) {
popup->background.shadow.enabled = shadow;
CGContextFlush(popup->window.context);
window_flush(&popup->window);
if (popup->needs_ordering) {
popup_order_windows(popup);

View file

@ -93,6 +93,10 @@ void window_clear(struct window* window) {
window->needs_resize = false;
}
void window_flush(struct window* window) {
SLSFlushWindowContentRegion(g_connection, window->id, NULL);
}
void windows_freeze() {
if (g_transaction) return;

View file

@ -1,6 +1,7 @@
#pragma once
#include "misc/helpers.h"
extern CGError SLSFlushWindowContentRegion(int cid, uint32_t wid, void* dirty);
extern CFTypeRef SLSTransactionCreate(int cid);
extern CGError SLSTransactionOrderWindow(CFTypeRef transaction, uint32_t wid, int mode, uint32_t relativeToWID);
extern CGError SLSTransactionSetWindowLevel(CFTypeRef transaction, uint32_t wid, int level);
@ -85,6 +86,7 @@ void window_init(struct window* window);
void window_create(struct window* window, CGRect frame);
void window_close(struct window* window);
void window_clear(struct window* window);
void window_flush(struct window* window);
void window_move(struct window* window, CGPoint point);
void window_set_frame(struct window* window, CGRect frame);