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 <noreply@anthropic.com>
pull/12760/head
Mike Bommarito 2026-05-20 22:50:03 -04:00
parent 46d54ed673
commit 88d30bb30a
1 changed files with 9 additions and 0 deletions

View File

@ -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,