mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05: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
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
local env_conf = os.getenv("XDG_CONFIG_HOME")
|
local env_conf = os.getenv("XDG_CONFIG_HOME")
|
||||||
|
|
||||||
if not env_conf then
|
if not env_conf then
|
||||||
env_conf = os.getenv("HOME")
|
env_conf = os.getenv("HOME")
|
||||||
if not env_conf then
|
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);
|
server.root.scene_output_layout.addOutput(layout_output, self.scene_output);
|
||||||
self.setFocused();
|
self.setFocused();
|
||||||
|
|
||||||
wlr_output.data = self;
|
wlr_output.data = &self.scene_node_data;
|
||||||
|
|
||||||
server.events.exec("OutputInitPost", .{self.id});
|
server.events.exec("OutputInitPost", .{self.id});
|
||||||
|
|
||||||
|
|
@ -187,18 +187,39 @@ pub fn surfaceAt(self: *Output, lx: f64, ly: f64) ?SurfaceAtResult {
|
||||||
};
|
};
|
||||||
|
|
||||||
for(layers) |layer| {
|
for(layers) |layer| {
|
||||||
if(layer.node.at(lx, ly, &sx, &sy)) |node| {
|
const node = layer.node.at(lx, ly, &sx, &sy);
|
||||||
const scene_buffer = wlr.SceneBuffer.fromNode(node);
|
if(node == null) continue;
|
||||||
const scene_surface = wlr.SceneSurface.tryFromBuffer(scene_buffer) orelse continue;
|
|
||||||
|
|
||||||
if (node.data == null) continue;
|
const surface: ?*wlr.Surface = blk: {
|
||||||
const scene_node_data: *SceneNodeData = @ptrCast(@alignCast(node.data.?));
|
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.*) {
|
switch (scene_node_data.*) {
|
||||||
.layer_surface, .view => {
|
.layer_surface, .view => {
|
||||||
return SurfaceAtResult{
|
return SurfaceAtResult{
|
||||||
.scene_node_data = scene_node_data,
|
.scene_node_data = scene_node_data,
|
||||||
.surface = scene_surface.surface,
|
.surface = surface.?,
|
||||||
.sx = sx,
|
.sx = sx,
|
||||||
.sy = sy,
|
.sy = sy,
|
||||||
};
|
};
|
||||||
|
|
@ -206,7 +227,6 @@ pub fn surfaceAt(self: *Output, lx: f64, ly: f64) ?SurfaceAtResult {
|
||||||
else => continue
|
else => continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
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| {
|
while(output_it.next()) |o| {
|
||||||
if(o.output.data == null) continue;
|
if(o.output.data == null) continue;
|
||||||
|
|
||||||
const scene_node_data: *SceneNodeData = @ptrCast(@alignCast(o.output.data.?));
|
const output_snd: *SceneNodeData = @ptrCast(@alignCast(o.output.data.?));
|
||||||
const output: *Output = switch (scene_node_data.*) {
|
const output: *Output = switch (output_snd.*) {
|
||||||
.output => |output_ptr| output_ptr,
|
.output => |output_ptr| output_ptr,
|
||||||
else => {
|
else => {
|
||||||
std.log.err("Incorrect scene node type found", .{});
|
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| {
|
while(node_it.next()) |node| {
|
||||||
if(node.data == null) continue;
|
if(node.data == null) continue;
|
||||||
|
|
||||||
const view: *View = @as(*View, @ptrCast(@alignCast(node.data.?)));
|
const view_snd: *SceneNodeData = @ptrCast(@alignCast(node.data.?));
|
||||||
if(view.id == id) return view;
|
|
||||||
|
// 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));
|
self.root.scene.setGammaControlManagerV1(try wlr.GammaControlManagerV1.create(self.wl_server));
|
||||||
|
|
||||||
// Add event listeners to events
|
// Add event listeners to events
|
||||||
// Backedn events
|
// Backend events
|
||||||
self.backend.events.new_input.add(&self.new_input);
|
self.backend.events.new_input.add(&self.new_input);
|
||||||
self.backend.events.new_output.add(&self.new_output);
|
self.backend.events.new_output.add(&self.new_output);
|
||||||
|
|
||||||
|
|
@ -211,12 +211,13 @@ fn handleNewXdgToplevelDecoration(
|
||||||
decoration: *wlr.XdgToplevelDecorationV1
|
decoration: *wlr.XdgToplevelDecorationV1
|
||||||
) void {
|
) void {
|
||||||
if(server.root.viewById(@intFromPtr(decoration.toplevel))) |view| {
|
if(server.root.viewById(@intFromPtr(decoration.toplevel))) |view| {
|
||||||
|
std.log.debug("found view\n", .{});
|
||||||
view.xdg_toplevel_decoration = decoration;
|
view.xdg_toplevel_decoration = decoration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleNewXdgPopup(_: *wl.Listener(*wlr.XdgPopup), xdg_popup: *wlr.XdgPopup) void {
|
fn handleNewXdgPopup(_: *wl.Listener(*wlr.XdgPopup), _: *wlr.XdgPopup) void {
|
||||||
_ = xdg_popup;
|
std.log.debug("Unimplemented Server.handleNewXdgPopup\n", .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleNewLayerSurface(
|
fn handleNewLayerSurface(
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@ fn handleMap(listener: *wl.Listener(void)) void {
|
||||||
&server.seat.keyboard_group.keyboard.modifiers
|
&server.seat.keyboard_group.keyboard.modifiers
|
||||||
);
|
);
|
||||||
|
|
||||||
|
std.log.debug("setting view decoration mode to server side\n", .{});
|
||||||
if(view.xdg_toplevel_decoration) |decoration| {
|
if(view.xdg_toplevel_decoration) |decoration| {
|
||||||
_ = decoration.setMode(wlr.XdgToplevelDecorationV1.Mode.server_side);
|
_ = decoration.setMode(wlr.XdgToplevelDecorationV1.Mode.server_side);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue