mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 04:57:32 -04:00
view focus issue
This commit is contained in:
parent
b3b83fd287
commit
3eea990e3f
2 changed files with 18 additions and 20 deletions
20
src/root.zig
20
src/root.zig
|
|
@ -107,23 +107,3 @@ pub fn viewAt(self: *Root, lx: f64, ly: f64) ?ViewAtResult {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn focusView(_: *Root, view: *View) void {
|
|
||||||
if (server.seat.wlr_seat.keyboard_state.focused_surface) |previous_surface| {
|
|
||||||
if (previous_surface == view.xdg_toplevel.base.surface) return;
|
|
||||||
if (wlr.XdgSurface.tryFromWlrSurface(previous_surface)) |xdg_surface| {
|
|
||||||
_ = xdg_surface.role_data.toplevel.?.setActivated(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
view.scene_tree.node.raiseToTop();
|
|
||||||
|
|
||||||
_ = view.xdg_toplevel.setActivated(true);
|
|
||||||
|
|
||||||
const wlr_keyboard = server.seat.wlr_seat.getKeyboard() orelse return;
|
|
||||||
server.seat.wlr_seat.keyboardNotifyEnter(
|
|
||||||
view.xdg_toplevel.base.surface,
|
|
||||||
wlr_keyboard.keycodes[0..wlr_keyboard.num_keycodes],
|
|
||||||
&wlr_keyboard.modifiers,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
18
src/view.zig
18
src/view.zig
|
|
@ -88,6 +88,24 @@ pub fn deinit(self: *View) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setFocused(self: *View) void {
|
pub fn setFocused(self: *View) void {
|
||||||
|
if (server.seat.wlr_seat.keyboard_state.focused_surface) |previous_surface| {
|
||||||
|
if (previous_surface == self.xdg_toplevel.base.surface) return;
|
||||||
|
if (wlr.XdgSurface.tryFromWlrSurface(previous_surface)) |xdg_surface| {
|
||||||
|
_ = xdg_surface.role_data.toplevel.?.setActivated(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.raiseToTop();
|
||||||
|
|
||||||
|
_ = self.xdg_toplevel.setActivated(true);
|
||||||
|
|
||||||
|
const wlr_keyboard = server.seat.wlr_seat.getKeyboard() orelse return;
|
||||||
|
server.seat.wlr_seat.keyboardNotifyEnter(
|
||||||
|
self.xdg_toplevel.base.surface,
|
||||||
|
wlr_keyboard.keycodes[0..wlr_keyboard.num_keycodes],
|
||||||
|
&wlr_keyboard.modifiers,
|
||||||
|
);
|
||||||
|
|
||||||
if(server.seat.focused_view) |prev_view| {
|
if(server.seat.focused_view) |prev_view| {
|
||||||
prev_view.focused = false;
|
prev_view.focused = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue