1
0
Fork 0
forked from wry/wry

autocommit 2022-04-13 12:58:04 CEST

This commit is contained in:
Julian Orth 2022-04-13 12:58:04 +02:00
parent 8924936079
commit 661a28e5b0
23 changed files with 165 additions and 143 deletions

View file

@ -1,10 +1,6 @@
use {
crate::{
ifs::wl_seat::WlSeatGlobal,
tree::{Node, OutputNode},
utils::clonecell::CloneCell,
},
std::{ops::Deref, rc::Rc},
crate::{ifs::wl_seat::WlSeatGlobal, tree::Node, utils::clonecell::CloneCell},
std::rc::Rc,
};
pub struct KbOwnerHolder {
@ -33,10 +29,6 @@ impl KbOwnerHolder {
pub fn set_kb_node(&self, seat: &Rc<WlSeatGlobal>, node: Rc<dyn Node>) {
self.owner.get().set_kb_node(seat, node);
}
pub fn workspace_changed(&self, seat: &Rc<WlSeatGlobal>, output: &Rc<OutputNode>) {
self.owner.get().workspace_changed(seat, output);
}
}
struct DefaultKbOwner;
@ -47,7 +39,6 @@ trait KbOwner {
fn grab(&self, seat: &Rc<WlSeatGlobal>, node: Rc<dyn Node>) -> bool;
fn ungrab(&self, seat: &Rc<WlSeatGlobal>);
fn set_kb_node(&self, seat: &Rc<WlSeatGlobal>, node: Rc<dyn Node>);
fn workspace_changed(&self, seat: &Rc<WlSeatGlobal>, output: &Rc<OutputNode>);
}
impl KbOwner for DefaultKbOwner {
@ -77,31 +68,6 @@ impl KbOwner for DefaultKbOwner {
node.clone().node_focus(seat);
seat.keyboard_node.set(node.clone());
}
fn workspace_changed(&self, seat: &Rc<WlSeatGlobal>, output: &Rc<OutputNode>) {
let new_ws = match output.workspace.get() {
Some(ws) => ws,
_ => return,
};
let node = seat.keyboard_node.get();
let ws = match node.node_get_workspace() {
None => return,
Some(ws) => ws,
};
let ws_output = ws.output.get();
if ws_output.id != output.id {
return;
}
for tl in seat.toplevel_focus_history.rev_iter() {
if let Some(tl_ws) = tl.as_node().node_get_workspace() {
if tl_ws.id == new_ws.id {
self.set_kb_node(seat, tl.deref().clone().into_node());
return;
}
}
}
self.set_kb_node(seat, seat.state.root.clone());
}
}
impl KbOwner for GrabKbOwner {
@ -116,8 +82,4 @@ impl KbOwner for GrabKbOwner {
fn set_kb_node(&self, _seat: &Rc<WlSeatGlobal>, _node: Rc<dyn Node>) {
// nothing
}
fn workspace_changed(&self, _seat: &Rc<WlSeatGlobal>, _output: &Rc<OutputNode>) {
// nothing
}
}

View file

@ -46,7 +46,6 @@ impl WlKeyboard {
}
pub fn send_enter(self: &Rc<Self>, serial: u32, surface: WlSurfaceId, keys: &[u32]) {
log::info!("enter with {:?}", keys);
self.seat.client.event(Enter {
self_id: self.id,
serial,