stevee

My wayland statusbar
git clone git://gtms.dev/stevee
Log | Files | Refs | Submodules | README | LICENSE

commit f05bc63288d5d15c3f055e573314a78f02fdb096
parent cd7c193a78e94b769162bd7fc3f5a550a57edfbe
Author: Andrea Feletto <andrea@andreafeletto.com>
Date:   Sun, 30 Jan 2022 02:16:34 +0100

fix clock not updating

Diffstat:
Msrc/event.zig | 41++++++++++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/event.zig b/src/event.zig @@ -116,7 +116,16 @@ pub const Loop = struct { if (self.fds[2].revents & os.POLL.IN != 0) { var expirations = mem.zeroes([8]u8); _ = try os.read(tfd, &expirations); - self.renderAllSurfaces(render.renderClock); + + for (self.state.wayland.outputs.items) |output| { + if (output.surface) |surface| { + if (surface.configured) { + render.renderClock(surface) catch continue; + surface.clockSurface.commit(); + surface.backgroundSurface.commit(); + } + } + } } // inotify @@ -124,24 +133,30 @@ pub const Loop = struct { const ifd = self.fds[3].fd; var event = mem.zeroes(os.linux.inotify_event); _ = try os.read(ifd, mem.asBytes(&event)); - self.renderAllSurfaces(render.renderModules); + + for (self.state.wayland.outputs.items) |output| { + if (output.surface) |surface| { + if (surface.configured) { + render.renderModules(surface) catch continue; + surface.modulesSurface.commit(); + surface.backgroundSurface.commit(); + } + } + } } // udev if (self.fds[4].revents & os.POLL.IN != 0) { _ = try self.monitor.receiveDevice(); - self.renderAllSurfaces(render.renderModules); - } - } - } - fn renderAllSurfaces(self: *Loop, renderFn: render.RenderFn) void { - for (self.state.wayland.outputs.items) |output| { - if (output.surface) |surface| { - if (surface.configured) { - renderFn(surface) catch continue; - surface.modulesSurface.commit(); - surface.backgroundSurface.commit(); + for (self.state.wayland.outputs.items) |output| { + if (output.surface) |surface| { + if (surface.configured) { + render.renderModules(surface) catch continue; + surface.modulesSurface.commit(); + surface.backgroundSurface.commit(); + } + } } } }