autocommit 2022-04-18 14:14:25 CEST
This commit is contained in:
parent
085ca95835
commit
54cf01f745
20 changed files with 155 additions and 109 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use {
|
||||
crate::{
|
||||
client::{Client, ClientError},
|
||||
ifs::wl_surface::zwp_idle_inhibitor_v1::ZwpIdleInhibitorV1,
|
||||
leaks::Tracker,
|
||||
object::Object,
|
||||
utils::buffd::{MsgParser, MsgParserError},
|
||||
|
|
@ -9,7 +10,6 @@ use {
|
|||
std::{rc::Rc, time::Duration},
|
||||
thiserror::Error,
|
||||
};
|
||||
use crate::ifs::wl_surface::zwp_idle_inhibitor_v1::ZwpIdleInhibitorV1;
|
||||
|
||||
pub struct JayIdle {
|
||||
pub id: JayIdleId,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ use {
|
|||
state::State,
|
||||
tree::{
|
||||
generic_node_visitor, ContainerSplit, FloatNode, FoundNode, Node, OutputNode,
|
||||
ToplevelNode,
|
||||
},
|
||||
utils::{
|
||||
asyncevent::AsyncEvent,
|
||||
|
|
@ -42,7 +41,7 @@ use {
|
|||
clonecell::CloneCell,
|
||||
copyhashmap::CopyHashMap,
|
||||
errorfmt::ErrorFmt,
|
||||
linkedlist::{LinkedList, LinkedNode},
|
||||
linkedlist::{LinkedNode},
|
||||
rc_eq::rc_eq,
|
||||
},
|
||||
wire::{
|
||||
|
|
@ -111,7 +110,6 @@ pub struct WlSeatGlobal {
|
|||
pos: Cell<(Fixed, Fixed)>,
|
||||
pointer_stack: RefCell<Vec<Rc<dyn Node>>>,
|
||||
found_tree: RefCell<Vec<FoundNode>>,
|
||||
toplevel_focus_history: LinkedList<Rc<dyn ToplevelNode>>,
|
||||
keyboard_node: CloneCell<Rc<dyn Node>>,
|
||||
pressed_keys: RefCell<AHashSet<u32>>,
|
||||
bindings: RefCell<AHashMap<ClientId, AHashMap<WlSeatId, Rc<WlSeat>>>>,
|
||||
|
|
@ -154,7 +152,6 @@ impl WlSeatGlobal {
|
|||
pos: Cell::new((Fixed(0), Fixed(0))),
|
||||
pointer_stack: RefCell::new(vec![]),
|
||||
found_tree: RefCell::new(vec![]),
|
||||
toplevel_focus_history: Default::default(),
|
||||
keyboard_node: CloneCell::new(state.root.clone()),
|
||||
pressed_keys: RefCell::new(Default::default()),
|
||||
bindings: Default::default(),
|
||||
|
|
|
|||
|
|
@ -21,14 +21,17 @@ use {
|
|||
wl_surface::{xdg_surface::xdg_popup::XdgPopup, WlSurface},
|
||||
},
|
||||
object::ObjectId,
|
||||
tree::{FloatNode, Node, ToplevelNode},
|
||||
tree::{FloatNode, Node, SizedNode, ToplevelNode},
|
||||
utils::{clonecell::CloneCell, smallmap::SmallMap},
|
||||
wire::WlDataOfferId,
|
||||
xkbcommon::{ModifierState, XKB_KEY_DOWN, XKB_KEY_UP},
|
||||
},
|
||||
jay_config::keyboard::{mods::Modifiers, syms::KeySym, ModifiedKeySym},
|
||||
jay_config::{
|
||||
keyboard::{mods::Modifiers, syms::KeySym, ModifiedKeySym},
|
||||
Direction,
|
||||
},
|
||||
smallvec::SmallVec,
|
||||
std::{ops::Deref, rc::Rc},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -94,9 +97,7 @@ impl NodeSeatState {
|
|||
seat.keyboard_node.set(seat.state.root.clone());
|
||||
// log::info!("keyboard_node = root");
|
||||
if focus_last {
|
||||
if let Some(tl) = seat.toplevel_focus_history.last() {
|
||||
seat.focus_node(tl.focus_surface(seat.id));
|
||||
}
|
||||
seat.output.get().do_focus(&seat, Direction::Unspecified);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -269,30 +270,6 @@ impl WlSeatGlobal {
|
|||
self.pointer_stack.borrow().last().cloned()
|
||||
}
|
||||
|
||||
pub fn last_tiled_keyboard_toplevel(&self, new: &dyn Node) -> Option<Rc<dyn ToplevelNode>> {
|
||||
let workspace = match self.output.get().workspace.get() {
|
||||
Some(ws) => ws,
|
||||
_ => return None,
|
||||
};
|
||||
let is_container = new.node_is_container();
|
||||
for tl in self.toplevel_focus_history.rev_iter() {
|
||||
match tl.as_node().node_get_workspace() {
|
||||
Some(ws) if ws.id == workspace.id => {}
|
||||
_ => continue,
|
||||
};
|
||||
let parent_is_float = match tl.parent() {
|
||||
Some(pn) => pn.node_is_float(),
|
||||
_ => false,
|
||||
};
|
||||
if !parent_is_float
|
||||
&& (!is_container || !tl.as_node().node_is_contained_in(new.node_id()))
|
||||
{
|
||||
return Some(tl.deref().clone());
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn move_(&self, node: &Rc<FloatNode>) {
|
||||
self.move_.set(true);
|
||||
self.move_start_pos.set(self.pos.get());
|
||||
|
|
@ -301,8 +278,6 @@ impl WlSeatGlobal {
|
|||
}
|
||||
|
||||
pub fn focus_toplevel(self: &Rc<Self>, n: Rc<dyn ToplevelNode>) {
|
||||
let node = self.toplevel_focus_history.add_last(n.clone());
|
||||
n.data().toplevel_history.insert(self.id, node);
|
||||
self.focus_node(n.focus_surface(self.id));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,12 @@ use {
|
|||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
clonecell::CloneCell,
|
||||
copyhashmap::CopyHashMap,
|
||||
linkedlist::LinkedList,
|
||||
numcell::NumCell,
|
||||
smallmap::SmallMap,
|
||||
},
|
||||
wire::{wl_surface::*, WlOutputId, WlSurfaceId},
|
||||
wire::{wl_surface::*, WlOutputId, WlSurfaceId, ZwpIdleInhibitorV1Id},
|
||||
xkbcommon::ModifierState,
|
||||
},
|
||||
ahash::AHashMap,
|
||||
|
|
@ -49,8 +50,6 @@ use {
|
|||
thiserror::Error,
|
||||
zwp_idle_inhibitor_v1::ZwpIdleInhibitorV1,
|
||||
};
|
||||
use crate::utils::copyhashmap::CopyHashMap;
|
||||
use crate::wire::ZwpIdleInhibitorV1Id;
|
||||
|
||||
#[allow(dead_code)]
|
||||
const INVALID_SCALE: u32 = 0;
|
||||
|
|
@ -691,6 +690,10 @@ impl SizedNode for WlSurface {
|
|||
self.visible.get()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
self.toplevel.get().map(|tl| tl.into_node())
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.visible.set(visible);
|
||||
for inhibitor in self.idle_inhibitors.lock().values() {
|
||||
|
|
|
|||
|
|
@ -292,6 +292,10 @@ impl SizedNode for XdgPopup {
|
|||
self.xdg.surface.visible.get()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
self.parent.get().and_then(|x| x.workspace.get().map(|w| w as Rc<dyn Node>))
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
log::info!("set visible = {}", visible);
|
||||
self.xdg.set_visible(visible);
|
||||
|
|
|
|||
|
|
@ -403,6 +403,10 @@ impl SizedNode for XdgToplevel {
|
|||
self.xdg.surface.visible.get()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
self.parent_node.get()
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.xdg.set_visible(visible);
|
||||
self.xdg.seat_state.set_visible(self, visible);
|
||||
|
|
@ -481,10 +485,6 @@ impl ToplevelNode for XdgToplevel {
|
|||
&self.toplevel_data
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
self.parent_node.get()
|
||||
}
|
||||
|
||||
fn as_node(&self) -> &dyn Node {
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,6 +366,10 @@ impl SizedNode for Xwindow {
|
|||
self.surface.visible.get()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
self.parent_node.get()
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.surface.node_set_visible(visible);
|
||||
self.seat_state.set_visible(self, visible);
|
||||
|
|
@ -463,10 +467,6 @@ impl ToplevelNode for Xwindow {
|
|||
&self.toplevel_data
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
self.parent_node.get()
|
||||
}
|
||||
|
||||
fn as_node(&self) -> &dyn Node {
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,6 +381,10 @@ impl SizedNode for ZwlrLayerSurfaceV1 {
|
|||
true
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
Some(self.output.clone())
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
self.pos.get()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue