mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
im j trynna checkout, hope this code isn't broken
This commit is contained in:
parent
acb95648e6
commit
02b48c9952
3 changed files with 28 additions and 17 deletions
15
build.zig
15
build.zig
|
|
@ -36,6 +36,7 @@ pub fn build(b: *std.Build) void {
|
|||
scanner.generate("zxdg_decoration_manager_v1", 1);
|
||||
scanner.generate("xdg_wm_base", 2);
|
||||
scanner.generate("zwp_tablet_manager_v2", 1);
|
||||
scanner.generate("zwlr_layer_shell_v1", 4);
|
||||
|
||||
const wayland = b.createModule(.{ .root_source_file = scanner.result });
|
||||
const xkbcommon = b.dependency("xkbcommon", .{}).module("xkbcommon");
|
||||
|
|
@ -77,19 +78,7 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
b.installArtifact(mez);
|
||||
|
||||
const exe_check = b.addExecutable(.{
|
||||
.name = "mez",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
})
|
||||
});
|
||||
|
||||
const check = b.step("check", "check if mez compiles");
|
||||
check.dependOn(&exe_check.step);
|
||||
|
||||
const run_step = b.step("run", "Run the app");
|
||||
const run_step = b.step("run", "Run the compositor");
|
||||
const run_cmd = b.addRunArtifact(mez);
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
run_cmd.step.dependOn(b.getInstallStep());
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ pub fn close(L: *zlua.Lua) i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ---Position the view by it's top left corner
|
||||
// ---position the view by it's top left corner
|
||||
// ---@param view_id view_id 0 maps to focused view
|
||||
// ---@param x number x position for view
|
||||
// ---@param y number y position for view
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ session: ?*wlr.Session,
|
|||
|
||||
shm: *wlr.Shm,
|
||||
xdg_shell: *wlr.XdgShell,
|
||||
layer_shell: *wlr.LayerShellV1,
|
||||
xdg_toplevel_decoration_manager: *wlr.XdgDecorationManagerV1,
|
||||
|
||||
// Input
|
||||
|
|
@ -51,10 +52,9 @@ new_output: wl.Listener(*wlr.Output) = .init(handleNewOutput),
|
|||
new_xdg_toplevel: wl.Listener(*wlr.XdgToplevel) = .init(handleNewXdgToplevel),
|
||||
new_xdg_popup: wl.Listener(*wlr.XdgPopup) = .init(handleNewXdgPopup),
|
||||
new_xdg_toplevel_decoration: wl.Listener(*wlr.XdgToplevelDecorationV1) = .init(handleNewXdgToplevelDecoration),
|
||||
// new_xdg_popup
|
||||
// new_xdg_toplevel
|
||||
|
||||
// Seat listeners
|
||||
// LayerShell Listeners
|
||||
new_layer_surface: wl.Listener(*wlr.LayerSurfaceV1) = .init(handleNewLayerSurface),
|
||||
|
||||
pub fn init(self: *Server) void {
|
||||
errdefer Utils.oomPanic();
|
||||
|
|
@ -86,6 +86,7 @@ pub fn init(self: *Server) void {
|
|||
std.process.exit(5);
|
||||
},
|
||||
.xdg_shell = try wlr.XdgShell.create(wl_server, 2),
|
||||
.layer_sell = try wlr.LayerShellV1.create(wl_server, 4),
|
||||
.xdg_toplevel_decoration_manager = try wlr.XdgDecorationManagerV1.create(self.wl_server),
|
||||
.event_loop = event_loop,
|
||||
.session = session,
|
||||
|
|
@ -123,6 +124,9 @@ pub fn init(self: *Server) void {
|
|||
|
||||
// XdgDecorationManagerV1 events
|
||||
self.xdg_toplevel_decoration_manager.events.new_toplevel_decoration.add(&self.new_xdg_toplevel_decoration);
|
||||
|
||||
// LayerShell events
|
||||
self.layer_shell.events.new_surface.add(&self.new_layer_surface);
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Server) noreturn {
|
||||
|
|
@ -131,6 +135,7 @@ pub fn deinit(self: *Server) noreturn {
|
|||
self.new_xdg_toplevel.link.remove();
|
||||
self.new_xdg_popup.link.remove();
|
||||
self.new_xdg_toplevel_decoration.link.remove();
|
||||
self.new_layer_surface.link.remove();
|
||||
|
||||
self.seat.deinit();
|
||||
self.root.deinit();
|
||||
|
|
@ -197,3 +202,20 @@ fn handleNewXdgPopup(
|
|||
) void {
|
||||
std.log.err("Unimplemented handle new xdg popup", .{});
|
||||
}
|
||||
|
||||
fn handleNewLayerSurface(
|
||||
_: *wl.Listener(*wlr.LayerSurfaceV1),
|
||||
layer_surface: *wlr.LayerSurfaceV1
|
||||
) void {
|
||||
if (layer_surface.output == null) {
|
||||
if (server.seat.focused_output == null) {
|
||||
std.log.err("No output available for new layer surface", .{});
|
||||
layer_surface.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
layer_surface.output = server.seat.focused_output.?.wlr_output;
|
||||
}
|
||||
|
||||
_ = LayerSurface.init(layer_surface);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue