Skip to content

Commit 4aa602a

Browse files
committed
flush window content region after redraw
1 parent dd8b7cd commit 4aa602a

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

src/bar.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,14 @@ void bar_draw(struct bar* bar, bool forced, bool threaded) {
215215
CGContextClearRect(window->context, window->frame);
216216
bar_item_draw(bar_item, window->context);
217217
CGContextFlush(window->context);
218+
window_flush(window);
218219
}
219220
}
220221

221-
if (g_bar_manager.bar_needs_update) CGContextFlush(bar->window.context);
222+
if (g_bar_manager.bar_needs_update) {
223+
CGContextFlush(bar->window.context);
224+
window_flush(&bar->window);
225+
}
222226
}
223227

224228
static void bar_calculate_bounds_top_bottom(struct bar* bar) {

src/bar_item.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ void* draw_item_proc(void* context) {
711711
CGContextClearRect(info->window->context, info->window->frame);
712712
bar_item_draw(&info->bar_item, info->window->context);
713713
CGContextFlush(info->window->context);
714+
window_flush(info->window);
714715
free(context);
715716
return NULL;
716717
}

src/popup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ void popup_draw(struct popup* popup) {
345345
popup->background.shadow.enabled = shadow;
346346

347347
CGContextFlush(popup->window.context);
348+
window_flush(&popup->window);
348349

349350
if (popup->needs_ordering) {
350351
popup_order_windows(popup);

src/window.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ void window_clear(struct window* window) {
9393
window->needs_resize = false;
9494
}
9595

96+
void window_flush(struct window* window) {
97+
SLSFlushWindowContentRegion(g_connection, window->id, NULL);
98+
}
99+
96100
void windows_freeze() {
97101
if (g_transaction) return;
98102

src/window.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include "misc/helpers.h"
33

4+
extern CGError SLSFlushWindowContentRegion(int cid, uint32_t wid, void* dirty);
45
extern CFTypeRef SLSTransactionCreate(int cid);
56
extern CGError SLSTransactionOrderWindow(CFTypeRef transaction, uint32_t wid, int mode, uint32_t relativeToWID);
67
extern CGError SLSTransactionSetWindowLevel(CFTypeRef transaction, uint32_t wid, int level);
@@ -85,6 +86,7 @@ void window_init(struct window* window);
8586
void window_create(struct window* window, CGRect frame);
8687
void window_close(struct window* window);
8788
void window_clear(struct window* window);
89+
void window_flush(struct window* window);
8890

8991
void window_move(struct window* window, CGPoint point);
9092
void window_set_frame(struct window* window, CGRect frame);

0 commit comments

Comments
 (0)