autocommit 2022-04-13 12:58:04 CEST
This commit is contained in:
parent
8924936079
commit
661a28e5b0
23 changed files with 165 additions and 143 deletions
|
|
@ -8,7 +8,7 @@ use {
|
|||
render::RenderError,
|
||||
utils::buffd::{MsgParser, MsgParserError},
|
||||
video::{
|
||||
dma::{DmaBuf, DmaBufPlane},
|
||||
dmabuf::{DmaBuf, DmaBufPlane},
|
||||
INVALID_MODIFIER,
|
||||
},
|
||||
wire::{wl_drm::*, WlDrmId},
|
||||
|
|
|
|||
|
|
@ -32,7 +32,10 @@ use {
|
|||
leaks::Tracker,
|
||||
object::{Object, ObjectId},
|
||||
state::State,
|
||||
tree::{ContainerSplit, FloatNode, FoundNode, Node, OutputNode, ToplevelNode},
|
||||
tree::{
|
||||
generic_node_visitor, ContainerSplit, FloatNode, FoundNode, Node, OutputNode,
|
||||
ToplevelNode,
|
||||
},
|
||||
utils::{
|
||||
asyncevent::AsyncEvent,
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
|
|
@ -51,6 +54,7 @@ use {
|
|||
},
|
||||
ahash::{AHashMap, AHashSet},
|
||||
jay_config::{keyboard::mods::Modifiers, Direction},
|
||||
smallvec::SmallVec,
|
||||
std::{
|
||||
cell::{Cell, RefCell},
|
||||
collections::hash_map::Entry,
|
||||
|
|
@ -422,10 +426,6 @@ impl WlSeatGlobal {
|
|||
self.id
|
||||
}
|
||||
|
||||
pub fn workspace_changed(self: &Rc<Self>, output: &Rc<OutputNode>) {
|
||||
self.kb_owner.workspace_changed(self, output);
|
||||
}
|
||||
|
||||
fn bind_(
|
||||
self: Rc<Self>,
|
||||
id: WlSeatId,
|
||||
|
|
@ -708,3 +708,15 @@ pub enum ReleaseError {
|
|||
}
|
||||
efrom!(ReleaseError, ClientError, ClientError);
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
|
||||
pub fn collect_kb_foci2(node: Rc<dyn Node>, seats: &mut SmallVec<[Rc<WlSeatGlobal>; 3]>) {
|
||||
node.node_visit(&mut generic_node_visitor(|node| {
|
||||
node.node_seat_state().for_each_kb_focus(|s| seats.push(s));
|
||||
}));
|
||||
}
|
||||
|
||||
pub fn collect_kb_foci(node: Rc<dyn Node>) -> SmallVec<[Rc<WlSeatGlobal>; 3]> {
|
||||
let mut res = SmallVec::new();
|
||||
collect_kb_foci2(node, &mut res);
|
||||
res
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -309,9 +309,11 @@ impl XdgToplevel {
|
|||
_ => return,
|
||||
};
|
||||
let extents = self.xdg.extents.get();
|
||||
parent
|
||||
.clone()
|
||||
.node_child_active_changed(self, self.toplevel_data.active_surfaces.get() > 0);
|
||||
parent.clone().node_child_active_changed(
|
||||
self,
|
||||
self.toplevel_data.active_surfaces.get() > 0,
|
||||
1,
|
||||
);
|
||||
parent.node_child_size_changed(self, extents.width(), extents.height());
|
||||
parent.node_child_title_changed(self, self.title.borrow_mut().deref());
|
||||
}
|
||||
|
|
@ -501,7 +503,7 @@ impl ToplevelNode for XdgToplevel {
|
|||
|
||||
fn set_active(&self, active: bool) {
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
parent.node_child_active_changed(self, active);
|
||||
parent.node_child_active_changed(self, active, 1);
|
||||
}
|
||||
let changed = {
|
||||
let mut states = self.states.borrow_mut();
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ impl ToplevelNode for Xwindow {
|
|||
|
||||
fn set_active(&self, active: bool) {
|
||||
if let Some(pn) = self.parent_node.get() {
|
||||
pn.node_child_active_changed(self, active);
|
||||
pn.node_child_active_changed(self, active, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ impl SizedNode for ZwlrLayerSurfaceV1 {
|
|||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
self.surface.clone().node_visit(visitor);
|
||||
self.surface.visit(visitor);
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use {
|
|||
errorfmt::ErrorFmt,
|
||||
},
|
||||
video::{
|
||||
dma::{DmaBuf, DmaBufPlane},
|
||||
dmabuf::{DmaBuf, DmaBufPlane},
|
||||
INVALID_MODIFIER,
|
||||
},
|
||||
wire::{zwp_linux_buffer_params_v1::*, WlBufferId, ZwpLinuxBufferParamsV1Id},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue