From 88d30bb30a02459a97e49fbb0817748422d6f65a Mon Sep 17 00:00:00 2001 From: Mike Bommarito Date: Wed, 20 May 2026 22:50:03 -0400 Subject: [PATCH] gtk: wire occlusionCallback to GLArea map/unmap Calls core_surface.occlusionCallback(visible) from the existing glareaMap/glareaUnmap handlers (added in #12698) so the renderer thread learns when a surface is off-screen. Co-Authored-By: Claude Opus 4.7 --- src/apprt/gtk/class/surface.zig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/apprt/gtk/class/surface.zig b/src/apprt/gtk/class/surface.zig index 2e05d7b12..3c9293a82 100644 --- a/src/apprt/gtk/class/surface.zig +++ b/src/apprt/gtk/class/surface.zig @@ -3283,6 +3283,7 @@ pub const Surface = extern struct { self: *Self, ) callconv(.c) void { self.updateMapped(true); + self.updateOcclusion(true); } fn glareaUnmap( @@ -3290,6 +3291,7 @@ pub const Surface = extern struct { self: *Self, ) callconv(.c) void { self.updateMapped(false); + self.updateOcclusion(false); } fn updateMapped(self: *Self, mapped: bool) void { @@ -3298,6 +3300,13 @@ pub const Surface = extern struct { self.as(gobject.Object).notifyByPspec(properties.mapped.impl.param_spec); } + fn updateOcclusion(self: *Self, visible: bool) void { + const surface = self.core() orelse return; + surface.occlusionCallback(visible) catch |err| { + log.warn("error in occlusion callback err={}", .{err}); + }; + } + fn glareaRender( _: *gtk.GLArea, _: *gdk.GLContext,