mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-24 13:50:11 +00:00
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>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user