code: create voidCast() util function

This commit is contained in:
Isaac Freund
2020-06-16 20:54:05 +02:00
parent ce18f24129
commit fb8d855ec9
18 changed files with 80 additions and 79 deletions

View File

@ -20,6 +20,7 @@ const Self = @This();
const std = @import("std");
const c = @import("c.zig");
const util = @import("util.zig");
const Box = @import("Box.zig");
const Output = @import("Output.zig");
@ -73,7 +74,7 @@ fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
/// Called when a new xdg popup is requested by the client
fn handleNewPopup(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
const self = @fieldParentPtr(Self, "listen_new_popup", listener.?);
const wlr_xdg_popup = @ptrCast(*c.wlr_xdg_popup, @alignCast(@alignOf(*c.wlr_xdg_popup), data));
const wlr_xdg_popup = util.voidCast(c.wlr_xdg_popup, data.?);
const allocator = self.output.root.server.allocator;
// This will free itself on destroy