layer shells do not appear

This commit is contained in:
Harrison DiAmbrosio 2025-12-14 10:25:02 -05:00
parent 49a6ced28e
commit 44f694f916
4 changed files with 10 additions and 9 deletions

View file

@ -27,6 +27,7 @@ pub fn init(wlr_layer_surface: *wlr.LayerSurfaceV1) *LayerSurface {
const self = try gpa.create(LayerSurface);
self.* = .{
.output = blk: {
// These block things are dangerous
@ -61,7 +62,6 @@ pub fn init(wlr_layer_surface: *wlr.LayerSurfaceV1) *LayerSurface {
};
}
self.wlr_layer_surface.events.destroy.add(&self.destroy);
self.wlr_layer_surface.surface.events.map.add(&self.map);
self.wlr_layer_surface.surface.events.unmap.add(&self.unmap);
@ -104,8 +104,10 @@ fn handleDestroy(
fn handleMap(
listener: *wl.Listener(void)
) void {
const layer: *LayerSurface = @fieldParentPtr("map", listener);
layer.allowKeyboard();
const layer_suraface: *LayerSurface = @fieldParentPtr("map", listener);
std.log.debug("layer surface mapped", .{});
layer_suraface.output.arrangeLayers();
layer_suraface.allowKeyboard();
}
fn handleUnmap(listener: *wl.Listener(void)) void {
@ -113,6 +115,8 @@ fn handleUnmap(listener: *wl.Listener(void)) void {
// FIXME: this crashes mez when killing mez
layer_surface.output.arrangeLayers();
// TODO: Idk if this should be deiniting the layer surface entirely
layer_surface.deinit();
}
@ -122,6 +126,8 @@ fn handleCommit(
) void {
const layer_surface: *LayerSurface = @fieldParentPtr("commit", listener);
std.log.debug("layer surface commited", .{});
if (!layer_surface.wlr_layer_surface.initial_commit) return;
layer_surface.output.arrangeLayers();
}

View file

@ -211,7 +211,6 @@ fn handleNewXdgToplevelDecoration(
decoration: *wlr.XdgToplevelDecorationV1
) void {
if(server.root.viewById(@intFromPtr(decoration.toplevel))) |view| {
std.log.debug("found view\n", .{});
view.xdg_toplevel_decoration = decoration;
}
}
@ -224,6 +223,7 @@ fn handleNewLayerSurface(
_: *wl.Listener(*wlr.LayerSurfaceV1),
layer_surface: *wlr.LayerSurfaceV1
) void {
std.log.debug("requested layer shell\n", .{});
if (layer_surface.output == null) {
if (server.seat.focused_output == null) {
std.log.err("No output available for new layer surface", .{});

View file

@ -164,7 +164,6 @@ fn handleMap(listener: *wl.Listener(void)) void {
&server.seat.keyboard_group.keyboard.modifiers
);
std.log.debug("setting view decoration mode to server side\n", .{});
if(view.xdg_toplevel_decoration) |decoration| {
_ = decoration.setMode(wlr.XdgToplevelDecorationV1.Mode.server_side);
}

View file

@ -64,14 +64,10 @@ pub fn close(L: *zlua.Lua) i32 {
// ---@param x number x position for view
// ---@param y number y position for view
pub fn set_position(L: *zlua.Lua) i32 {
std.log.debug("repositioning", .{});
const view_id: u64 = @intCast(L.checkInteger(1));
const x: i32 = @intFromFloat(@round(L.checkNumber(2)));
const y: i32 = @intFromFloat(@round(L.checkNumber(3)));
std.log.debug("position to set: ({d}, {d})", .{x, y});
const view: ?*View = if (view_id == 0) server.seat.focused_view else server.root.viewById(view_id);
if(view) |v| {
v.setPosition(x, y);