mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 04:57:32 -04:00
tiling is working again, and surface at is mostly in
This commit is contained in:
parent
1039e3a800
commit
49a6ced28e
7 changed files with 54 additions and 26 deletions
|
|
@ -282,4 +282,3 @@ function print_table(tbl, indent, seen)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
local env_conf = os.getenv("XDG_CONFIG_HOME")
|
||||
|
||||
if not env_conf then
|
||||
env_conf = os.getenv("HOME")
|
||||
if not env_conf then
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ pub fn init(wlr_output: *wlr.Output) ?*Output {
|
|||
server.root.scene_output_layout.addOutput(layout_output, self.scene_output);
|
||||
self.setFocused();
|
||||
|
||||
wlr_output.data = self;
|
||||
wlr_output.data = &self.scene_node_data;
|
||||
|
||||
server.events.exec("OutputInitPost", .{self.id});
|
||||
|
||||
|
|
@ -187,18 +187,39 @@ pub fn surfaceAt(self: *Output, lx: f64, ly: f64) ?SurfaceAtResult {
|
|||
};
|
||||
|
||||
for(layers) |layer| {
|
||||
if(layer.node.at(lx, ly, &sx, &sy)) |node| {
|
||||
const scene_buffer = wlr.SceneBuffer.fromNode(node);
|
||||
const scene_surface = wlr.SceneSurface.tryFromBuffer(scene_buffer) orelse continue;
|
||||
const node = layer.node.at(lx, ly, &sx, &sy);
|
||||
if(node == null) continue;
|
||||
|
||||
if (node.data == null) continue;
|
||||
const scene_node_data: *SceneNodeData = @ptrCast(@alignCast(node.data.?));
|
||||
const surface: ?*wlr.Surface = blk: {
|
||||
if (node.?.type == .buffer) {
|
||||
const scene_buffer = wlr.SceneBuffer.fromNode(node.?);
|
||||
if (wlr.SceneSurface.tryFromBuffer(scene_buffer)) |scene_surface| {
|
||||
break :blk scene_surface.surface;
|
||||
}
|
||||
}
|
||||
break :blk null;
|
||||
};
|
||||
if(surface == null) continue;
|
||||
|
||||
const scene_node_data: *SceneNodeData = blk: {
|
||||
var n = node.?;
|
||||
while (true) {
|
||||
if (@as(?*SceneNodeData, @ptrCast(@alignCast(n.data)))) |snd| {
|
||||
break :blk snd;
|
||||
}
|
||||
if (n.parent) |parent_tree| {
|
||||
n = &parent_tree.node;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
switch (scene_node_data.*) {
|
||||
.layer_surface, .view => {
|
||||
return SurfaceAtResult{
|
||||
.scene_node_data = scene_node_data,
|
||||
.surface = scene_surface.surface,
|
||||
.surface = surface.?,
|
||||
.sx = sx,
|
||||
.sy = sy,
|
||||
};
|
||||
|
|
@ -206,7 +227,6 @@ pub fn surfaceAt(self: *Output, lx: f64, ly: f64) ?SurfaceAtResult {
|
|||
else => continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
14
src/Root.zig
14
src/Root.zig
|
|
@ -74,8 +74,8 @@ pub fn viewById(self: *Root, id: u64) ?*View {
|
|||
while(output_it.next()) |o| {
|
||||
if(o.output.data == null) continue;
|
||||
|
||||
const scene_node_data: *SceneNodeData = @ptrCast(@alignCast(o.output.data.?));
|
||||
const output: *Output = switch (scene_node_data.*) {
|
||||
const output_snd: *SceneNodeData = @ptrCast(@alignCast(o.output.data.?));
|
||||
const output: *Output = switch (output_snd.*) {
|
||||
.output => |output_ptr| output_ptr,
|
||||
else => {
|
||||
std.log.err("Incorrect scene node type found", .{});
|
||||
|
|
@ -88,8 +88,14 @@ pub fn viewById(self: *Root, id: u64) ?*View {
|
|||
while(node_it.next()) |node| {
|
||||
if(node.data == null) continue;
|
||||
|
||||
const view: *View = @as(*View, @ptrCast(@alignCast(node.data.?)));
|
||||
if(view.id == id) return view;
|
||||
const view_snd: *SceneNodeData = @ptrCast(@alignCast(node.data.?));
|
||||
|
||||
// TODO: Should we assert that we want only views to be here
|
||||
// -- Basically should we use switch statements for snd interactions
|
||||
// -- Or if statements, for simplicity
|
||||
if(view_snd.* == .view and view_snd.view.id == id) {
|
||||
return view_snd.view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ pub fn init(self: *Server) void {
|
|||
self.root.scene.setGammaControlManagerV1(try wlr.GammaControlManagerV1.create(self.wl_server));
|
||||
|
||||
// Add event listeners to events
|
||||
// Backedn events
|
||||
// Backend events
|
||||
self.backend.events.new_input.add(&self.new_input);
|
||||
self.backend.events.new_output.add(&self.new_output);
|
||||
|
||||
|
|
@ -211,12 +211,13 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
fn handleNewXdgPopup(_: *wl.Listener(*wlr.XdgPopup), xdg_popup: *wlr.XdgPopup) void {
|
||||
_ = xdg_popup;
|
||||
fn handleNewXdgPopup(_: *wl.Listener(*wlr.XdgPopup), _: *wlr.XdgPopup) void {
|
||||
std.log.debug("Unimplemented Server.handleNewXdgPopup\n", .{});
|
||||
}
|
||||
|
||||
fn handleNewLayerSurface(
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue