apprt/gtk: handle zero value notification pointers

This commit is contained in:
Mitchell Hashimoto
2024-09-26 14:40:24 -07:00
parent 4cc4eb5ed0
commit 3b419a2ba2

View File

@ -1098,8 +1098,12 @@ fn gtkActionPresentSurface(
return; return;
} }
// Convert that u64 to pointer to a core surface. // Convert that u64 to pointer to a core surface. A value of zero
const surface: *CoreSurface = @ptrFromInt(c.g_variant_get_uint64(parameter)); // means that there was no target surface for the notification so
// we dont' focus any surface.
const ptr_int: u64 = c.g_variant_get_uint64(parameter);
if (ptr_int == 0) return;
const surface: *CoreSurface = @ptrFromInt(ptr_int);
// Send a message through the core app mailbox rather than presenting the // Send a message through the core app mailbox rather than presenting the
// surface directly so that it can validate that the surface pointer is // surface directly so that it can validate that the surface pointer is