some wlbg fixes

This commit is contained in:
LordMZTE 2023-10-28 23:06:24 +02:00
parent 8a2e617f39
commit f367b341a5
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
3 changed files with 7 additions and 8 deletions

View file

@ -39,3 +39,7 @@ pub fn damage(self: *DrawTimerHandler, idx: usize) void {
self.maybeWake();
}
pub fn damageAll(self: *DrawTimerHandler) void {
@memset(self.should_redraw, true);
self.maybeWake();
}

View file

@ -15,7 +15,6 @@ main_shader_program: c_uint,
bg_bufs: std.MultiArrayList(BgBuf),
time: i64,
cursor_positions: [][2]c_int,
should_redraw: []bool,
const Gfx = @This();
@ -70,10 +69,6 @@ pub fn init(egl_dpy: c.EGLDisplay, output_info: []const OutputInfo) !Gfx {
errdefer std.heap.c_allocator.free(cursor_positions);
@memset(cursor_positions, .{ 0, 0 });
const should_redraw = try std.heap.c_allocator.alloc(bool, output_info.len);
errdefer std.heap.c_allocator.free(should_redraw);
@memset(should_redraw, true);
var bg_bufs = std.MultiArrayList(BgBuf){};
errdefer bg_bufs.deinit(std.heap.c_allocator);
@ -139,7 +134,6 @@ pub fn init(egl_dpy: c.EGLDisplay, output_info: []const OutputInfo) !Gfx {
.bg_bufs = bg_bufs,
.time = 0,
.cursor_positions = cursor_positions,
.should_redraw = should_redraw,
};
}
@ -154,7 +148,6 @@ pub fn deinit(self: *Gfx) void {
c.glDeleteProgram(self.main_shader_program);
std.heap.c_allocator.free(self.cursor_positions);
std.heap.c_allocator.free(self.should_redraw);
self.* = undefined;
}

View file

@ -141,6 +141,7 @@ pub fn main() !void {
.loop = &loop,
};
defer std.heap.c_allocator.free(dth.should_redraw);
@memset(dth.should_redraw, true);
var pointer_state = PointerState{
.surface = null,
@ -328,9 +329,10 @@ fn renderBackgroundCb(
loop.stop();
return .disarm;
};
@memset(data.?.gfx.should_redraw, true);
}
data.?.dth.damageAll();
return .rearm;
}