mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
added view unfocusing
This commit is contained in:
parent
689b48acd7
commit
acb95648e6
2 changed files with 17 additions and 3 deletions
|
|
@ -102,6 +102,13 @@ local master = function()
|
||||||
mez.input.add_keymap("alt", "" .. i, {
|
mez.input.add_keymap("alt", "" .. i, {
|
||||||
press = function ()
|
press = function ()
|
||||||
ctx.tag_id = i
|
ctx.tag_id = i
|
||||||
|
|
||||||
|
if ctx.tags[i].master then
|
||||||
|
mez.view.set_focused(ctx.tags[i].master)
|
||||||
|
else
|
||||||
|
mez.view.set_focused(nil)
|
||||||
|
end
|
||||||
|
|
||||||
tile_all()
|
tile_all()
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,18 @@ pub fn set_size(L: *zlua.Lua) i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---Remove focus from current view, and set to given id
|
// ---Remove focus from current view, and set to given id
|
||||||
// ---@param view_id view_id
|
// ---@param view_id view_id Id of the view to be focused, or nil to remove focus
|
||||||
pub fn set_focused(L: *zlua.Lua) i32 {
|
pub fn set_focused(L: *zlua.Lua) i32 {
|
||||||
const view_id: u64 = @intCast(L.checkInteger(1));
|
const view_id: ?c_longlong = L.optInteger(1);
|
||||||
|
|
||||||
if(server.root.viewById(view_id)) |view| {
|
if(view_id == null and server.seat.focused_view != null) {
|
||||||
|
server.seat.focused_view.?.focused = false;
|
||||||
|
server.seat.focused_view = null;
|
||||||
|
L.pushNil();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(server.root.viewById(@intCast(view_id.?))) |view| {
|
||||||
view.setFocused();
|
view.setFocused();
|
||||||
L.pushNil();
|
L.pushNil();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue