mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 20:57:32 -04:00
removed all windows decorations properly, added window closing and compositor exiting as well as view focusing
This commit is contained in:
parent
f636efdfe9
commit
976900ffa6
11 changed files with 289 additions and 117 deletions
23
src/seat.zig
23
src/seat.zig
|
|
@ -5,10 +5,14 @@ const wlr = @import("wlroots");
|
|||
const wl = @import("wayland").server.wl;
|
||||
|
||||
const Utils = @import("utils.zig");
|
||||
const View = @import("view.zig");
|
||||
const Output = @import("output.zig");
|
||||
|
||||
const server = &@import("main.zig").server;
|
||||
|
||||
wlr_seat: *wlr.Seat,
|
||||
focused_view: ?*View,
|
||||
focused_output: ?*Output,
|
||||
|
||||
request_set_cursor: wl.Listener(*wlr.Seat.event.RequestSetCursor) = .init(handleRequestSetCursor),
|
||||
request_set_selection: wl.Listener(*wlr.Seat.event.RequestSetSelection) = .init(handleRequestSetSelection),
|
||||
|
|
@ -20,6 +24,8 @@ pub fn init(self: *Seat) void {
|
|||
|
||||
self.* = .{
|
||||
.wlr_seat = try wlr.Seat.create(server.wl_server, "default"),
|
||||
.focused_view = null,
|
||||
.focused_output = null,
|
||||
};
|
||||
|
||||
self.wlr_seat.events.request_set_cursor.add(&self.request_set_cursor);
|
||||
|
|
@ -33,6 +39,23 @@ pub fn deinit(self: *Seat) void {
|
|||
self.wlr_seat.destroy();
|
||||
}
|
||||
|
||||
pub fn focusOutput(self: *Seat, output: *Output) void {
|
||||
if(self.focused_output) |prev_output| {
|
||||
prev_output.focused = false;
|
||||
}
|
||||
|
||||
self.focused_output = output;
|
||||
}
|
||||
|
||||
// TODO: Should focusing a view, automaticall focus the output containing it
|
||||
pub fn focusView(self: *Seat, view: *View) void {
|
||||
if(self.focused_view) |prev_view| {
|
||||
prev_view.setFocus(false);
|
||||
}
|
||||
|
||||
self.focused_view = view;
|
||||
}
|
||||
|
||||
fn handleRequestSetCursor(
|
||||
_: *wl.Listener(*wlr.Seat.event.RequestSetCursor),
|
||||
event: *wlr.Seat.event.RequestSetCursor,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue