mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
a few changes here...
- foot no longer resizes by col,row because we've set every client to tiling - stop using a seperate enum for tagging in SceneNodeData - use enabling instead of positioning views out of the visible area
This commit is contained in:
parent
ff196693cd
commit
9173cab6b9
4 changed files with 53 additions and 14 deletions
|
|
@ -59,6 +59,7 @@ local master = function()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mez.view.set_enabled(ctx.tags[tag_id].master, true)
|
||||||
if #ctx.tags[tag_id].stack == 0 then
|
if #ctx.tags[tag_id].stack == 0 then
|
||||||
mez.view.set_size(ctx.tags[tag_id].master, res.width, res.height)
|
mez.view.set_size(ctx.tags[tag_id].master, res.width, res.height)
|
||||||
mez.view.set_position(ctx.tags[tag_id].master, 0, 0)
|
mez.view.set_position(ctx.tags[tag_id].master, 0, 0)
|
||||||
|
|
@ -67,6 +68,7 @@ local master = function()
|
||||||
mez.view.set_position(ctx.tags[tag_id].master, 0, 0)
|
mez.view.set_position(ctx.tags[tag_id].master, 0, 0)
|
||||||
|
|
||||||
for i, stack_id in ipairs(ctx.tags[tag_id].stack) do
|
for i, stack_id in ipairs(ctx.tags[tag_id].stack) do
|
||||||
|
mez.view.set_enabled(stack_id, true)
|
||||||
mez.view.set_size(stack_id, res.width * (1 - ctx.master_ratio), res.height / #ctx.tags[tag_id].stack)
|
mez.view.set_size(stack_id, res.width * (1 - ctx.master_ratio), res.height / #ctx.tags[tag_id].stack)
|
||||||
mez.view.set_position(stack_id, res.width * ctx.master_ratio, (res.height / #ctx.tags[tag_id].stack * (i - 1)))
|
mez.view.set_position(stack_id, res.width * ctx.master_ratio, (res.height / #ctx.tags[tag_id].stack * (i - 1)))
|
||||||
end
|
end
|
||||||
|
|
@ -78,12 +80,9 @@ local master = function()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
mez.view.set_position(ctx.tags[tag_id].master, 0, -res.height)
|
mez.view.set_enabled(ctx.tags[tag_id].master, false)
|
||||||
mez.view.set_size(ctx.tags[tag_id].master, res.width, res.height)
|
|
||||||
|
|
||||||
for _, view in ipairs(ctx.tags[tag_id].stack) do
|
for _, view in ipairs(ctx.tags[tag_id].stack) do
|
||||||
mez.view.set_position(view, 0, -res.height)
|
mez.view.set_enabled(view, false)
|
||||||
mez.view.set_size(view, res.width, res.height)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,7 @@ const LayerSurface = @import("LayerSurface.zig");
|
||||||
const Output = @import("Output.zig");
|
const Output = @import("Output.zig");
|
||||||
const Root = @import("Root.zig");
|
const Root = @import("Root.zig");
|
||||||
|
|
||||||
const SceneNodeType = enum {
|
pub const SceneNodeData = union(enum) {
|
||||||
view,
|
|
||||||
layer_surface,
|
|
||||||
output,
|
|
||||||
output_layer,
|
|
||||||
root
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const SceneNodeData = union(SceneNodeType) {
|
|
||||||
view: *View,
|
view: *View,
|
||||||
layer_surface: *LayerSurface,
|
layer_surface: *LayerSurface,
|
||||||
output: *Output,
|
output: *Output,
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,15 @@ fn handleMap(listener: *wl.Listener(void)) void {
|
||||||
|
|
||||||
server.events.exec("ViewMapPre", .{view.id});
|
server.events.exec("ViewMapPre", .{view.id});
|
||||||
|
|
||||||
|
// we're gonna tell the client that it's tiled so it doesn't try anything
|
||||||
|
// stupid
|
||||||
|
_ = view.xdg_toplevel.setTiled(.{
|
||||||
|
.top = true,
|
||||||
|
.bottom = true,
|
||||||
|
.left = true,
|
||||||
|
.right = true,
|
||||||
|
});
|
||||||
|
|
||||||
view.xdg_toplevel.events.request_fullscreen.add(&view.request_fullscreen);
|
view.xdg_toplevel.events.request_fullscreen.add(&view.request_fullscreen);
|
||||||
view.xdg_toplevel.events.request_move.add(&view.request_move);
|
view.xdg_toplevel.events.request_move.add(&view.request_move);
|
||||||
view.xdg_toplevel.events.request_resize.add(&view.request_resize);
|
view.xdg_toplevel.events.request_resize.add(&view.request_resize);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const zlua = @import("zlua");
|
const zlua = @import("zlua");
|
||||||
const wlr = @import("wlroots");
|
const wlr = @import("wlroots");
|
||||||
|
const wl = @import("wayland").server.wl;
|
||||||
|
|
||||||
const Output = @import("../Output.zig");
|
const Output = @import("../Output.zig");
|
||||||
const View = @import("../View.zig");
|
const View = @import("../View.zig");
|
||||||
|
|
@ -26,6 +27,10 @@ pub fn get_all_ids(L: *zlua.Lua) i32 {
|
||||||
while(output_it.next()) |o| {
|
while(output_it.next()) |o| {
|
||||||
if(o.output.data == null) continue;
|
if(o.output.data == null) continue;
|
||||||
const output: *Output = @ptrCast(@alignCast(o.output.data.?));
|
const output: *Output = @ptrCast(@alignCast(o.output.data.?));
|
||||||
|
if (!output.state.enabled) {
|
||||||
|
std.log.debug("ts not enabled", .{});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const layers = [_]*wlr.SceneTree{
|
const layers = [_]*wlr.SceneTree{
|
||||||
output.layers.content,
|
output.layers.content,
|
||||||
|
|
@ -245,3 +250,37 @@ pub fn get_app_id(L: *zlua.Lua) i32 {
|
||||||
L.pushNil();
|
L.pushNil();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---Get the app_id of the view
|
||||||
|
// ---@param view_id view_id 0 maps to focused view
|
||||||
|
// ---@param enable boolean
|
||||||
|
pub fn set_enabled(L: *zlua.Lua) i32 {
|
||||||
|
const view_id = LuaUtils.coerceInteger(u64, L.checkInteger(1)) catch view_id_err(L);
|
||||||
|
if (!L.isBoolean(2)) {
|
||||||
|
L.raiseErrorStr("argument 2 must be a boolean", .{});
|
||||||
|
}
|
||||||
|
const activate = L.toBoolean(2);
|
||||||
|
|
||||||
|
if (LuaUtils.viewById(view_id)) |v| {
|
||||||
|
_ = v.xdg_toplevel.setActivated(activate);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
L.pushNil();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---Get the app_id of the view
|
||||||
|
// ---@param view_id view_id 0 maps to focused view
|
||||||
|
// ---@return boolean?
|
||||||
|
pub fn get_enabled(L: *zlua.Lua) i32 {
|
||||||
|
const view_id = LuaUtils.coerceInteger(u64, L.checkInteger(1)) catch view_id_err(L);
|
||||||
|
|
||||||
|
if(LuaUtils.viewById(view_id)) |v| {
|
||||||
|
_ = L.pushBoolean(v.xdg_toplevel.current.activated);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
L.pushNil();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue