autocommit 2022-04-12 17:26:33 CEST
This commit is contained in:
parent
d9d1addbf5
commit
8924936079
26 changed files with 896 additions and 543 deletions
|
|
@ -240,31 +240,31 @@ impl WlSeatGlobal {
|
|||
}
|
||||
|
||||
pub fn get_mono(&self) -> Option<bool> {
|
||||
self.keyboard_node.get().get_parent_mono()
|
||||
self.keyboard_node.get().node_get_parent_mono()
|
||||
}
|
||||
|
||||
pub fn get_split(&self) -> Option<ContainerSplit> {
|
||||
self.keyboard_node.get().get_parent_split()
|
||||
self.keyboard_node.get().node_get_parent_split()
|
||||
}
|
||||
|
||||
pub fn set_mono(&self, mono: bool) {
|
||||
self.keyboard_node.get().set_parent_mono(mono)
|
||||
self.keyboard_node.get().node_set_parent_mono(mono)
|
||||
}
|
||||
|
||||
pub fn set_split(&self, axis: ContainerSplit) {
|
||||
self.keyboard_node.get().set_parent_split(axis)
|
||||
self.keyboard_node.get().node_set_parent_split(axis)
|
||||
}
|
||||
|
||||
pub fn create_split(&self, axis: ContainerSplit) {
|
||||
self.keyboard_node.get().create_split(axis)
|
||||
self.keyboard_node.get().node_create_split(axis)
|
||||
}
|
||||
|
||||
pub fn focus_parent(self: &Rc<Self>) {
|
||||
self.keyboard_node.get().focus_parent(self);
|
||||
self.keyboard_node.get().node_focus_parent(self);
|
||||
}
|
||||
|
||||
pub fn toggle_floating(self: &Rc<Self>) {
|
||||
self.keyboard_node.get().toggle_floating(self);
|
||||
self.keyboard_node.get().node_toggle_floating(self);
|
||||
}
|
||||
|
||||
pub fn get_rate(&self) -> (i32, i32) {
|
||||
|
|
@ -288,17 +288,17 @@ impl WlSeatGlobal {
|
|||
|
||||
pub fn close(self: &Rc<Self>) {
|
||||
let kb_node = self.keyboard_node.get();
|
||||
kb_node.close();
|
||||
kb_node.node_close();
|
||||
}
|
||||
|
||||
pub fn move_focus(self: &Rc<Self>, direction: Direction) {
|
||||
let kb_node = self.keyboard_node.get();
|
||||
kb_node.move_focus(self, direction);
|
||||
kb_node.node_move_focus(self, direction);
|
||||
}
|
||||
|
||||
pub fn move_focused(self: &Rc<Self>, direction: Direction) {
|
||||
let kb_node = self.keyboard_node.get();
|
||||
kb_node.move_self(direction);
|
||||
kb_node.node_move_self(direction);
|
||||
}
|
||||
|
||||
fn set_selection_<T: ipc::Vtable>(
|
||||
|
|
@ -312,7 +312,7 @@ impl WlSeatGlobal {
|
|||
if let Some(old) = field.set(src.clone()) {
|
||||
ipc::detach_seat::<T>(&old);
|
||||
}
|
||||
if let Some(client) = self.keyboard_node.get().client() {
|
||||
if let Some(client) = self.keyboard_node.get().node_client() {
|
||||
match src {
|
||||
Some(src) => ipc::offer_source_to::<T>(&src, &client),
|
||||
_ => T::for_each_device(self, client.id, |device| {
|
||||
|
|
|
|||
|
|
@ -118,18 +118,18 @@ impl NodeSeatState {
|
|||
while let Some((_, seat)) = self.grabs.pop() {
|
||||
seat.pointer_owner.revert_to_default(&seat);
|
||||
}
|
||||
let node_id = node.id();
|
||||
let node_id = node.node_id();
|
||||
while let Some((_, seat)) = self.dnd_targets.pop() {
|
||||
seat.pointer_owner.dnd_target_removed(&seat);
|
||||
}
|
||||
while let Some((_, seat)) = self.pointer_foci.pop() {
|
||||
let mut ps = seat.pointer_stack.borrow_mut();
|
||||
while let Some(last) = ps.pop() {
|
||||
if last.id() == node_id {
|
||||
if last.node_id() == node_id {
|
||||
break;
|
||||
}
|
||||
last.seat_state().leave(&seat);
|
||||
last.leave(&seat);
|
||||
last.node_seat_state().leave(&seat);
|
||||
last.node_leave(&seat);
|
||||
}
|
||||
seat.state.tree_changed();
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ impl NodeSeatState {
|
|||
pub fn set_visible(&self, node: &dyn Node, visible: bool) {
|
||||
if !visible {
|
||||
if !self.kb_foci.is_empty() {
|
||||
node.active_changed(false);
|
||||
node.node_active_changed(false);
|
||||
}
|
||||
self.destroy_node2(node, false);
|
||||
}
|
||||
|
|
@ -251,14 +251,14 @@ impl WlSeatGlobal {
|
|||
}
|
||||
let node = self.keyboard_node.get();
|
||||
if shortcuts.is_empty() {
|
||||
node.key(self, key, state);
|
||||
node.node_key(self, key, state);
|
||||
} else if let Some(config) = self.state.config.get() {
|
||||
for shortcut in shortcuts {
|
||||
config.invoke_shortcut(self.id(), &shortcut);
|
||||
}
|
||||
}
|
||||
if let Some(mods) = new_mods {
|
||||
node.mods(self, mods);
|
||||
node.node_mods(self, mods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -273,17 +273,19 @@ impl WlSeatGlobal {
|
|||
Some(ws) => ws,
|
||||
_ => return None,
|
||||
};
|
||||
let is_container = new.is_container();
|
||||
let is_container = new.node_is_container();
|
||||
for tl in self.toplevel_focus_history.rev_iter() {
|
||||
match tl.as_node().get_workspace() {
|
||||
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.is_float(),
|
||||
Some(pn) => pn.node_is_float(),
|
||||
_ => false,
|
||||
};
|
||||
if !parent_is_float && (!is_container || !tl.as_node().is_contained_in(new.id())) {
|
||||
if !parent_is_float
|
||||
&& (!is_container || !tl.as_node().node_is_contained_in(new.node_id()))
|
||||
{
|
||||
return Some(tl.deref().clone());
|
||||
}
|
||||
}
|
||||
|
|
@ -561,7 +563,7 @@ impl WlSeatGlobal {
|
|||
k.send_modifiers(serial, mods_depressed, mods_latched, mods_locked, group)
|
||||
});
|
||||
|
||||
if self.keyboard_node.get().client_id() != Some(surface.client.id) {
|
||||
if self.keyboard_node.get().node_client_id() != Some(surface.client.id) {
|
||||
self.offer_selection::<WlDataDevice>(&self.selection, &surface.client);
|
||||
self.offer_selection::<ZwpPrimarySelectionDeviceV1>(
|
||||
&self.primary_selection,
|
||||
|
|
|
|||
|
|
@ -63,18 +63,18 @@ impl KbOwner for DefaultKbOwner {
|
|||
|
||||
fn set_kb_node(&self, seat: &Rc<WlSeatGlobal>, node: Rc<dyn Node>) {
|
||||
let old = seat.keyboard_node.get();
|
||||
if old.id() == node.id() {
|
||||
if old.node_id() == node.node_id() {
|
||||
return;
|
||||
}
|
||||
old.unfocus(seat);
|
||||
if old.seat_state().unfocus(seat) {
|
||||
old.active_changed(false);
|
||||
old.node_unfocus(seat);
|
||||
if old.node_seat_state().unfocus(seat) {
|
||||
old.node_active_changed(false);
|
||||
}
|
||||
|
||||
if node.seat_state().focus(seat) {
|
||||
node.active_changed(true);
|
||||
if node.node_seat_state().focus(seat) {
|
||||
node.node_active_changed(true);
|
||||
}
|
||||
node.clone().focus(seat);
|
||||
node.clone().node_focus(seat);
|
||||
seat.keyboard_node.set(node.clone());
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ impl KbOwner for DefaultKbOwner {
|
|||
_ => return,
|
||||
};
|
||||
let node = seat.keyboard_node.get();
|
||||
let ws = match node.get_workspace() {
|
||||
let ws = match node.node_get_workspace() {
|
||||
None => return,
|
||||
Some(ws) => ws,
|
||||
};
|
||||
|
|
@ -93,7 +93,7 @@ impl KbOwner for DefaultKbOwner {
|
|||
return;
|
||||
}
|
||||
for tl in seat.toplevel_focus_history.rev_iter() {
|
||||
if let Some(tl_ws) = tl.as_node().get_workspace() {
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use {
|
|||
wl_seat::{wl_pointer::PendingScroll, Dnd, DroppedDnd, WlSeatError, WlSeatGlobal},
|
||||
wl_surface::WlSurface,
|
||||
},
|
||||
tree::{FoundNode, Node},
|
||||
tree::{FoundNode, Node, SizedNode},
|
||||
utils::{clonecell::CloneCell, smallmap::SmallMap},
|
||||
},
|
||||
std::{cell::Cell, rc::Rc},
|
||||
|
|
@ -54,7 +54,7 @@ impl PointerOwnerHolder {
|
|||
pub fn frame(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
let pending = self.pending_scroll.take();
|
||||
if let Some(node) = self.owner.get().axis_node(seat) {
|
||||
node.axis_event(seat, &pending);
|
||||
node.node_axis_event(seat, &pending);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,8 +140,8 @@ impl PointerOwner for DefaultPointerOwner {
|
|||
buttons: SmallMap::new_with(button, ()),
|
||||
node: pn.clone(),
|
||||
}));
|
||||
pn.seat_state().add_pointer_grab(seat);
|
||||
pn.button(seat, button, state);
|
||||
pn.node_seat_state().add_pointer_grab(seat);
|
||||
pn.node_button(seat, button, state);
|
||||
}
|
||||
|
||||
fn axis_node(&self, seat: &Rc<WlSeatGlobal>) -> Option<Rc<dyn Node>> {
|
||||
|
|
@ -159,17 +159,19 @@ impl PointerOwner for DefaultPointerOwner {
|
|||
x: x_int,
|
||||
y: y_int,
|
||||
});
|
||||
seat.state.root.find_tree_at(x_int, y_int, &mut found_tree);
|
||||
seat.state
|
||||
.root
|
||||
.node_find_tree_at(x_int, y_int, &mut found_tree);
|
||||
let mut divergence = found_tree.len().min(stack.len());
|
||||
for (i, (found, stack)) in found_tree.iter().zip(stack.iter()).enumerate() {
|
||||
if found.node.id() != stack.id() {
|
||||
if found.node.node_id() != stack.node_id() {
|
||||
divergence = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (stack.len(), found_tree.len()) == (divergence, divergence) {
|
||||
if let Some(node) = found_tree.last() {
|
||||
node.node.clone().pointer_motion(
|
||||
node.node.clone().node_pointer_motion(
|
||||
seat,
|
||||
x.apply_fract(node.x),
|
||||
y.apply_fract(node.y),
|
||||
|
|
@ -177,15 +179,15 @@ impl PointerOwner for DefaultPointerOwner {
|
|||
}
|
||||
} else {
|
||||
if let Some(last) = stack.last() {
|
||||
last.pointer_unfocus(seat);
|
||||
last.node_pointer_unfocus(seat);
|
||||
}
|
||||
for old in stack.drain(divergence..).rev() {
|
||||
old.leave(seat);
|
||||
old.seat_state().leave(seat);
|
||||
old.node_leave(seat);
|
||||
old.node_seat_state().leave(seat);
|
||||
}
|
||||
if found_tree.len() == divergence {
|
||||
if let Some(node) = found_tree.last() {
|
||||
node.node.clone().pointer_motion(
|
||||
node.node.clone().node_pointer_motion(
|
||||
seat,
|
||||
x.apply_fract(node.x),
|
||||
y.apply_fract(node.y),
|
||||
|
|
@ -193,8 +195,8 @@ impl PointerOwner for DefaultPointerOwner {
|
|||
}
|
||||
} else {
|
||||
for new in found_tree.drain(divergence..) {
|
||||
new.node.seat_state().enter(seat);
|
||||
new.node.clone().pointer_enter(
|
||||
new.node.node_seat_state().enter(seat);
|
||||
new.node.clone().node_pointer_enter(
|
||||
seat,
|
||||
x.apply_fract(new.x),
|
||||
y.apply_fract(new.y),
|
||||
|
|
@ -203,7 +205,7 @@ impl PointerOwner for DefaultPointerOwner {
|
|||
}
|
||||
}
|
||||
if let Some(node) = stack.last() {
|
||||
node.pointer_focus(seat);
|
||||
node.node_pointer_focus(seat);
|
||||
}
|
||||
}
|
||||
found_tree.clear();
|
||||
|
|
@ -249,7 +251,7 @@ impl PointerOwner for GrabPointerOwner {
|
|||
KeyState::Released => {
|
||||
self.buttons.remove(&button);
|
||||
if self.buttons.is_empty() {
|
||||
self.node.seat_state().remove_pointer_grab(seat);
|
||||
self.node.node_seat_state().remove_pointer_grab(seat);
|
||||
seat.tree_changed.trigger();
|
||||
seat.pointer_owner
|
||||
.owner
|
||||
|
|
@ -260,7 +262,7 @@ impl PointerOwner for GrabPointerOwner {
|
|||
self.buttons.insert(button, ());
|
||||
}
|
||||
}
|
||||
self.node.clone().button(seat, button, state);
|
||||
self.node.clone().node_button(seat, button, state);
|
||||
}
|
||||
|
||||
fn axis_node(&self, _seat: &Rc<WlSeatGlobal>) -> Option<Rc<dyn Node>> {
|
||||
|
|
@ -269,11 +271,11 @@ impl PointerOwner for GrabPointerOwner {
|
|||
|
||||
fn handle_pointer_position(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
let (x, y) = seat.pos.get();
|
||||
let pos = self.node.absolute_position();
|
||||
let pos = self.node.node_absolute_position();
|
||||
let (x_int, y_int) = pos.translate(x.round_down(), y.round_down());
|
||||
self.node
|
||||
.clone()
|
||||
.pointer_motion(seat, x.apply_fract(x_int), y.apply_fract(y_int));
|
||||
.node_pointer_motion(seat, x.apply_fract(x_int), y.apply_fract(y_int));
|
||||
}
|
||||
|
||||
fn start_drag(
|
||||
|
|
@ -290,7 +292,7 @@ impl PointerOwner for GrabPointerOwner {
|
|||
if self.buttons.len() != 1 {
|
||||
return Ok(());
|
||||
}
|
||||
if self.node.id() != origin.node_id {
|
||||
if self.node.node_id() != origin.node_id {
|
||||
return Ok(());
|
||||
}
|
||||
if let Some(icon) = &icon {
|
||||
|
|
@ -315,11 +317,11 @@ impl PointerOwner for GrabPointerOwner {
|
|||
{
|
||||
let mut stack = seat.pointer_stack.borrow_mut();
|
||||
for node in stack.drain(1..).rev() {
|
||||
node.leave(seat);
|
||||
node.seat_state().leave(seat);
|
||||
node.node_leave(seat);
|
||||
node.node_seat_state().leave(seat);
|
||||
}
|
||||
}
|
||||
self.node.seat_state().remove_pointer_grab(seat);
|
||||
self.node.node_seat_state().remove_pointer_grab(seat);
|
||||
// {
|
||||
// let old = seat.keyboard_node.set(seat.state.root.clone());
|
||||
// old.seat_state().unfocus(seat);
|
||||
|
|
@ -335,7 +337,7 @@ impl PointerOwner for GrabPointerOwner {
|
|||
}
|
||||
|
||||
fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
self.node.seat_state().remove_pointer_grab(seat);
|
||||
self.node.node_seat_state().remove_pointer_grab(seat);
|
||||
seat.pointer_owner
|
||||
.owner
|
||||
.set(seat.pointer_owner.default.clone());
|
||||
|
|
@ -365,13 +367,13 @@ impl PointerOwner for DndPointerOwner {
|
|||
};
|
||||
let target = self.target.get();
|
||||
if should_drop {
|
||||
self.target.get().dnd_drop(&self.dnd);
|
||||
self.target.get().node_dnd_drop(&self.dnd);
|
||||
*seat.dropped_dnd.borrow_mut() = Some(DroppedDnd {
|
||||
dnd: self.dnd.clone(),
|
||||
});
|
||||
}
|
||||
target.dnd_leave(&self.dnd);
|
||||
target.seat_state().remove_dnd_target(seat);
|
||||
target.node_dnd_leave(&self.dnd);
|
||||
target.node_seat_state().remove_dnd_target(seat);
|
||||
if !should_drop {
|
||||
if let Some(src) = &self.dnd.src {
|
||||
ipc::detach_seat::<WlDataDevice>(src);
|
||||
|
|
@ -407,15 +409,15 @@ impl PointerOwner for DndPointerOwner {
|
|||
};
|
||||
let (x, y) = (x.apply_fract(x_int), y.apply_fract(y_int));
|
||||
let mut target = self.target.get();
|
||||
if node.id() != target.id() {
|
||||
target.dnd_leave(&self.dnd);
|
||||
target.seat_state().remove_dnd_target(seat);
|
||||
if node.node_id() != target.node_id() {
|
||||
target.node_dnd_leave(&self.dnd);
|
||||
target.node_seat_state().remove_dnd_target(seat);
|
||||
target = node;
|
||||
target.dnd_enter(&self.dnd, x, y);
|
||||
target.seat_state().add_dnd_target(seat);
|
||||
target.node_dnd_enter(&self.dnd, x, y);
|
||||
target.node_seat_state().add_dnd_target(seat);
|
||||
self.target.set(target);
|
||||
} else if (self.pos_x.get(), self.pos_y.get()) != (x, y) {
|
||||
node.dnd_motion(&self.dnd, x, y);
|
||||
node.node_dnd_motion(&self.dnd, x, y);
|
||||
}
|
||||
self.pos_x.set(x);
|
||||
self.pos_y.set(y);
|
||||
|
|
@ -436,8 +438,8 @@ impl PointerOwner for DndPointerOwner {
|
|||
|
||||
fn cancel_dnd(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
let target = self.target.get();
|
||||
target.dnd_leave(&self.dnd);
|
||||
target.seat_state().remove_dnd_target(seat);
|
||||
target.node_dnd_leave(&self.dnd);
|
||||
target.node_seat_state().remove_dnd_target(seat);
|
||||
if let Some(src) = &self.dnd.src {
|
||||
ipc::detach_seat::<WlDataDevice>(src);
|
||||
}
|
||||
|
|
@ -455,7 +457,7 @@ impl PointerOwner for DndPointerOwner {
|
|||
}
|
||||
|
||||
fn dnd_target_removed(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
self.target.get().dnd_leave(&self.dnd);
|
||||
self.target.get().node_dnd_leave(&self.dnd);
|
||||
self.target.set(seat.state.root.clone());
|
||||
seat.state.tree_changed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ impl WlPointer {
|
|||
return Ok(());
|
||||
}
|
||||
};
|
||||
if pointer_node.client_id() != Some(self.seat.client.id) {
|
||||
if pointer_node.node_client_id() != Some(self.seat.client.id) {
|
||||
return Ok(());
|
||||
}
|
||||
self.seat.global.set_app_cursor(cursor_opt);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use {
|
|||
render::Renderer,
|
||||
tree::{
|
||||
ContainerNode, ContainerSplit, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor,
|
||||
ToplevelNode, WorkspaceNode,
|
||||
SizedNode, ToplevelNode, WorkspaceNode,
|
||||
},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
|
|
@ -367,7 +367,7 @@ impl WlSurface {
|
|||
self.unset_dnd_icons();
|
||||
self.unset_cursors();
|
||||
self.ext.get().on_surface_destroy()?;
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
{
|
||||
let mut children = self.children.borrow_mut();
|
||||
if let Some(children) = &mut *children {
|
||||
|
|
@ -616,7 +616,7 @@ impl Object for WlSurface {
|
|||
fn break_loops(&self) {
|
||||
self.unset_dnd_icons();
|
||||
self.unset_cursors();
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
*self.children.borrow_mut() = None;
|
||||
self.unset_ext();
|
||||
mem::take(self.frame_requests.borrow_mut().deref_mut());
|
||||
|
|
@ -628,35 +628,11 @@ impl Object for WlSurface {
|
|||
dedicated_add_obj!(WlSurface, WlSurfaceId, surfaces);
|
||||
|
||||
tree_id!(SurfaceNodeId);
|
||||
impl Node for WlSurface {
|
||||
impl SizedNode for WlSurface {
|
||||
fn id(&self) -> NodeId {
|
||||
self.node_id.into()
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
tl.close();
|
||||
}
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
self.visible.get()
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.visible.set(visible);
|
||||
let children = self.children.borrow_mut();
|
||||
if let Some(children) = children.deref() {
|
||||
for child in children.subsurfaces.values() {
|
||||
child.surface.set_visible(visible);
|
||||
}
|
||||
}
|
||||
if !visible {
|
||||
self.send_seat_release_events();
|
||||
}
|
||||
self.seat_state.set_visible(self, visible);
|
||||
}
|
||||
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.seat_state
|
||||
}
|
||||
|
|
@ -665,7 +641,7 @@ impl Node for WlSurface {
|
|||
let children = self.children.borrow();
|
||||
if let Some(ch) = children.deref() {
|
||||
for ss in ch.subsurfaces.values() {
|
||||
ss.surface.destroy_node(false);
|
||||
ss.surface.node_destroy(false);
|
||||
}
|
||||
}
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
|
|
@ -687,8 +663,8 @@ impl Node for WlSurface {
|
|||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_surface(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_surface(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
|
|
@ -700,9 +676,27 @@ impl Node for WlSurface {
|
|||
}
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
self.visible.get()
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.visible.set(visible);
|
||||
let children = self.children.borrow_mut();
|
||||
if let Some(children) = children.deref() {
|
||||
for child in children.subsurfaces.values() {
|
||||
child.surface.node_set_visible(visible);
|
||||
}
|
||||
}
|
||||
if !visible {
|
||||
self.send_seat_release_events();
|
||||
}
|
||||
self.seat_state.set_visible(self, visible);
|
||||
}
|
||||
|
||||
fn get_workspace(&self) -> Option<Rc<WorkspaceNode>> {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
return tl.as_node().get_workspace();
|
||||
return tl.as_node().node_get_workspace();
|
||||
}
|
||||
None
|
||||
}
|
||||
|
|
@ -711,21 +705,21 @@ impl Node for WlSurface {
|
|||
self.toplevel
|
||||
.get()
|
||||
.and_then(|t| t.parent())
|
||||
.and_then(|p| p.get_mono())
|
||||
.and_then(|p| p.node_get_mono())
|
||||
}
|
||||
|
||||
fn get_parent_split(&self) -> Option<ContainerSplit> {
|
||||
self.toplevel
|
||||
.get()
|
||||
.and_then(|t| t.parent())
|
||||
.and_then(|p| p.get_split())
|
||||
.and_then(|p| p.node_get_split())
|
||||
}
|
||||
|
||||
fn set_parent_mono(&self, mono: bool) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
if let Some(pn) = tl.parent() {
|
||||
let node = if mono { Some(tl.as_node()) } else { None };
|
||||
pn.set_mono(node)
|
||||
pn.node_set_mono(node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -733,17 +727,17 @@ impl Node for WlSurface {
|
|||
fn set_parent_split(&self, split: ContainerSplit) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
if let Some(pn) = tl.parent() {
|
||||
pn.set_split(split);
|
||||
pn.node_set_split(split);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn create_split(self: Rc<Self>, split: ContainerSplit) {
|
||||
fn create_split(self: &Rc<Self>, split: ContainerSplit) {
|
||||
let tl = match self.toplevel.get() {
|
||||
Some(tl) => tl,
|
||||
_ => return,
|
||||
};
|
||||
let ws = match tl.as_node().get_workspace() {
|
||||
let ws = match tl.as_node().node_get_workspace() {
|
||||
Some(ws) => ws,
|
||||
_ => return,
|
||||
};
|
||||
|
|
@ -758,21 +752,27 @@ impl Node for WlSurface {
|
|||
tl.clone().into_node(),
|
||||
split,
|
||||
);
|
||||
pn.replace_child(tl.as_node(), cn);
|
||||
pn.node_replace_child(tl.as_node(), cn);
|
||||
}
|
||||
|
||||
fn move_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
|
||||
fn close(&self) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
tl.close();
|
||||
}
|
||||
}
|
||||
|
||||
fn move_focus(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
if let Some(pn) = tl.parent() {
|
||||
pn.move_focus_from_child(seat, tl.as_node(), direction);
|
||||
pn.node_move_focus_from_child(seat, tl.as_node(), direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn move_self(self: Rc<Self>, direction: Direction) {
|
||||
fn move_self(self: &Rc<Self>, direction: Direction) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
if let Some(pn) = tl.parent() {
|
||||
pn.move_child(tl.into_node(), direction);
|
||||
pn.node_move_child(tl.into_node(), direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -795,15 +795,15 @@ impl Node for WlSurface {
|
|||
seat.mods_surface(self, mods);
|
||||
}
|
||||
|
||||
fn button(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, button: u32, state: KeyState) {
|
||||
fn button(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, button: u32, state: KeyState) {
|
||||
seat.button_surface(&self, button, state);
|
||||
}
|
||||
|
||||
fn axis_event(self: Rc<Self>, seat: &WlSeatGlobal, event: &PendingScroll) {
|
||||
fn axis_event(self: &Rc<Self>, seat: &WlSeatGlobal, event: &PendingScroll) {
|
||||
seat.scroll_surface(&*self, event);
|
||||
}
|
||||
|
||||
fn focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>) {
|
||||
fn focus(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
tl.data().focus_surface.insert(seat.id(), self.clone());
|
||||
tl.activate();
|
||||
|
|
@ -813,11 +813,11 @@ impl Node for WlSurface {
|
|||
|
||||
fn focus_parent(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
tl.parent().map(|p| p.focus_self(seat));
|
||||
tl.parent().map(|p| p.node_focus_self(seat));
|
||||
}
|
||||
}
|
||||
|
||||
fn toggle_floating(self: Rc<Self>, _seat: &Rc<WlSeatGlobal>) {
|
||||
fn toggle_floating(self: &Rc<Self>, _seat: &Rc<WlSeatGlobal>) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
tl.toggle_floating();
|
||||
}
|
||||
|
|
@ -831,11 +831,11 @@ impl Node for WlSurface {
|
|||
seat.leave_surface(self);
|
||||
}
|
||||
|
||||
fn pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
|
||||
fn pointer_enter(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
|
||||
seat.enter_surface(&self, x, y)
|
||||
}
|
||||
|
||||
fn pointer_motion(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
|
||||
fn pointer_motion(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
|
||||
seat.motion_surface(&*self, x, y)
|
||||
}
|
||||
|
||||
|
|
@ -847,8 +847,8 @@ impl Node for WlSurface {
|
|||
Some(self.client.clone())
|
||||
}
|
||||
|
||||
fn into_surface(self: Rc<Self>) -> Option<Rc<WlSurface>> {
|
||||
Some(self)
|
||||
fn into_surface(self: &Rc<Self>) -> Option<Rc<WlSurface>> {
|
||||
Some(self.clone())
|
||||
}
|
||||
|
||||
fn dnd_drop(&self, dnd: &Dnd) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use {
|
|||
leaks::Tracker,
|
||||
object::Object,
|
||||
rect::Rect,
|
||||
tree::{FindTreeResult, FoundNode, Node, WorkspaceNode},
|
||||
tree::{FindTreeResult, FoundNode, Node, SizedNode, WorkspaceNode},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
clonecell::CloneCell,
|
||||
|
|
@ -301,9 +301,9 @@ impl XdgSurface {
|
|||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.surface.set_visible(visible);
|
||||
self.surface.node_set_visible(visible);
|
||||
for popup in self.popups.lock().values() {
|
||||
popup.set_visible(visible);
|
||||
popup.node_set_visible(visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use {
|
|||
object::Object,
|
||||
rect::Rect,
|
||||
render::Renderer,
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, WorkspaceNode},
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, SizedNode, WorkspaceNode},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
clonecell::CloneCell,
|
||||
|
|
@ -201,7 +201,7 @@ impl XdgPopup {
|
|||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.xdg.surface.client.parse(self, parser)?;
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
{
|
||||
if let Some(parent) = self.parent.take() {
|
||||
parent.popups.remove(&self.id);
|
||||
|
|
@ -255,7 +255,7 @@ impl Object for XdgPopup {
|
|||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.parent.set(None);
|
||||
*self.display_link.borrow_mut() = None;
|
||||
*self.workspace_link.borrow_mut() = None;
|
||||
|
|
@ -264,7 +264,7 @@ impl Object for XdgPopup {
|
|||
|
||||
simple_add_obj!(XdgPopup);
|
||||
|
||||
impl Node for XdgPopup {
|
||||
impl SizedNode for XdgPopup {
|
||||
fn id(&self) -> NodeId {
|
||||
self.node_id.into()
|
||||
}
|
||||
|
|
@ -280,8 +280,8 @@ impl Node for XdgPopup {
|
|||
self.xdg.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_popup(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_popup(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
|
|
@ -314,7 +314,7 @@ impl Node for XdgPopup {
|
|||
self.xdg.find_tree_at(x, y, tree)
|
||||
}
|
||||
|
||||
fn pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
fn pointer_enter(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_popup(&self);
|
||||
}
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ impl Node for XdgPopup {
|
|||
renderer.render_xdg_surface(&self.xdg, x, y)
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
fn set_workspace(self: &Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
self.xdg.set_workspace(ws);
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +363,7 @@ impl XdgSurfaceExt for XdgPopup {
|
|||
*wl = Some(ws.stacked.add_last(self.clone()));
|
||||
*dl = Some(state.root.stacked.add_last(self.clone()));
|
||||
state.tree_changed();
|
||||
self.set_visible(
|
||||
self.node_set_visible(
|
||||
self.parent
|
||||
.get()
|
||||
.map(|p| p.surface.visible.get())
|
||||
|
|
@ -374,8 +374,8 @@ impl XdgSurfaceExt for XdgPopup {
|
|||
if wl.take().is_some() {
|
||||
drop(wl);
|
||||
drop(dl);
|
||||
self.set_visible(false);
|
||||
self.destroy_node(true);
|
||||
self.node_set_visible(false);
|
||||
self.node_destroy(true);
|
||||
self.send_popup_done();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ use {
|
|||
rect::Rect,
|
||||
render::Renderer,
|
||||
tree::{
|
||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
|
||||
ToplevelNodeId, WorkspaceNode,
|
||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, SizedNode, ToplevelData,
|
||||
ToplevelNode, ToplevelNodeId, WorkspaceNode,
|
||||
},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
|
|
@ -160,7 +160,7 @@ impl XdgToplevel {
|
|||
|
||||
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?;
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.xdg.ext.set(None);
|
||||
{
|
||||
let mut children = self.children.borrow_mut();
|
||||
|
|
@ -202,7 +202,7 @@ impl XdgToplevel {
|
|||
title.clear();
|
||||
title.push_str(req.title);
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
parent.child_title_changed(self, &title);
|
||||
parent.node_child_title_changed(self, &title);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -222,7 +222,7 @@ impl XdgToplevel {
|
|||
let req: Move = self.xdg.surface.client.parse(self, parser)?;
|
||||
let seat = self.xdg.surface.client.lookup(req.seat)?;
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
if let Some(float) = parent.into_float() {
|
||||
if let Some(float) = parent.node_into_float() {
|
||||
seat.move_(&float);
|
||||
}
|
||||
}
|
||||
|
|
@ -311,9 +311,9 @@ impl XdgToplevel {
|
|||
let extents = self.xdg.extents.get();
|
||||
parent
|
||||
.clone()
|
||||
.child_active_changed(self, self.toplevel_data.active_surfaces.get() > 0);
|
||||
parent.child_size_changed(self, extents.width(), extents.height());
|
||||
parent.child_title_changed(self, self.title.borrow_mut().deref());
|
||||
.node_child_active_changed(self, self.toplevel_data.active_surfaces.get() > 0);
|
||||
parent.node_child_size_changed(self, extents.width(), extents.height());
|
||||
parent.node_child_title_changed(self, self.title.borrow_mut().deref());
|
||||
}
|
||||
|
||||
fn map_floating(self: &Rc<Self>, workspace: &Rc<WorkspaceNode>) {
|
||||
|
|
@ -360,7 +360,7 @@ impl Object for XdgToplevel {
|
|||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.parent.set(None);
|
||||
let _children = mem::take(&mut *self.children.borrow_mut());
|
||||
}
|
||||
|
|
@ -368,15 +368,11 @@ impl Object for XdgToplevel {
|
|||
|
||||
dedicated_add_obj!(XdgToplevel, XdgToplevelId, xdg_toplevel);
|
||||
|
||||
impl Node for XdgToplevel {
|
||||
impl SizedNode for XdgToplevel {
|
||||
fn id(&self) -> NodeId {
|
||||
self.node_id.into()
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.send_close();
|
||||
}
|
||||
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.xdg.seat_state
|
||||
}
|
||||
|
|
@ -384,7 +380,7 @@ impl Node for XdgToplevel {
|
|||
fn destroy_node(&self, detach: bool) {
|
||||
if let Some(parent) = self.parent_node.take() {
|
||||
if detach {
|
||||
parent.remove_child(self);
|
||||
parent.node_remove_child(self);
|
||||
self.xdg.surface.client.state.tree_changed();
|
||||
}
|
||||
}
|
||||
|
|
@ -393,8 +389,8 @@ impl Node for XdgToplevel {
|
|||
self.xdg.seat_state.destroy_node(self)
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_toplevel(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_toplevel(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
|
|
@ -416,16 +412,20 @@ impl Node for XdgToplevel {
|
|||
|
||||
fn is_contained_in(&self, other: NodeId) -> bool {
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
if parent.id() == other {
|
||||
if parent.node_id() == other {
|
||||
return true;
|
||||
}
|
||||
return parent.is_contained_in(other);
|
||||
return parent.node_is_contained_in(other);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self);
|
||||
fn do_focus(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self.clone());
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.send_close();
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
|
|
@ -436,8 +436,8 @@ impl Node for XdgToplevel {
|
|||
self.xdg.find_tree_at(x, y, tree)
|
||||
}
|
||||
|
||||
fn pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_toplevel(self);
|
||||
fn pointer_enter(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_toplevel(self.clone());
|
||||
}
|
||||
|
||||
fn pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
@ -448,7 +448,7 @@ impl Node for XdgToplevel {
|
|||
renderer.render_xdg_surface(&self.xdg, x, y)
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
fn change_extents(self: &Rc<Self>, rect: &Rect) {
|
||||
let nw = rect.width();
|
||||
let nh = rect.height();
|
||||
let de = self.xdg.absolute_desired_extents.get();
|
||||
|
|
@ -460,11 +460,11 @@ impl Node for XdgToplevel {
|
|||
self.xdg.set_absolute_desired_extents(rect);
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
fn set_workspace(self: &Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
self.xdg.set_workspace(ws);
|
||||
}
|
||||
|
||||
fn set_parent(self: Rc<Self>, parent: Rc<dyn Node>) {
|
||||
fn set_parent(self: &Rc<Self>, parent: Rc<dyn Node>) {
|
||||
self.parent_node.set(Some(parent));
|
||||
self.notify_parent();
|
||||
}
|
||||
|
|
@ -501,7 +501,7 @@ impl ToplevelNode for XdgToplevel {
|
|||
|
||||
fn set_active(&self, active: bool) {
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
parent.child_active_changed(self, active);
|
||||
parent.node_child_active_changed(self, active);
|
||||
}
|
||||
let changed = {
|
||||
let mut states = self.states.borrow_mut();
|
||||
|
|
@ -526,11 +526,11 @@ impl ToplevelNode for XdgToplevel {
|
|||
Some(p) => p,
|
||||
_ => return,
|
||||
};
|
||||
if parent.is_float() {
|
||||
parent.remove_child(&*self);
|
||||
if parent.node_is_float() {
|
||||
parent.node_remove_child(&*self);
|
||||
self.map_tiled();
|
||||
} else if let Some(ws) = self.xdg.workspace.get() {
|
||||
parent.remove_child(&*self);
|
||||
parent.node_remove_child(&*self);
|
||||
self.map_floating(&ws);
|
||||
}
|
||||
}
|
||||
|
|
@ -550,7 +550,7 @@ impl XdgSurfaceExt for XdgToplevel {
|
|||
let surface = &self.xdg.surface;
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
if surface.buffer.get().is_none() {
|
||||
parent.remove_child(&*self);
|
||||
parent.node_remove_child(&*self);
|
||||
{
|
||||
let new_parent = self.parent.get();
|
||||
let mut children = self.children.borrow_mut();
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ use {
|
|||
render::Renderer,
|
||||
state::State,
|
||||
tree::{
|
||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
|
||||
WorkspaceNode,
|
||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, SizedNode, ToplevelData,
|
||||
ToplevelNode, WorkspaceNode,
|
||||
},
|
||||
utils::{
|
||||
clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode,
|
||||
|
|
@ -189,7 +189,7 @@ impl XwindowData {
|
|||
let title = self.info.title.borrow_mut();
|
||||
if let Some(w) = self.window.get() {
|
||||
if let Some(p) = w.parent_node.get() {
|
||||
p.child_title_changed(w.deref(), title.as_deref().unwrap_or(""));
|
||||
p.node_child_title_changed(w.deref(), title.as_deref().unwrap_or(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -227,7 +227,7 @@ impl Xwindow {
|
|||
}
|
||||
|
||||
pub fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.surface.set_toplevel(None);
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ impl Xwindow {
|
|||
let extents = self.surface.extents.get();
|
||||
// let extents = self.xdg.extents.get();
|
||||
// parent.child_active_changed(self, self.active_surfaces.get() > 0);
|
||||
parent.child_size_changed(self, extents.width(), extents.height());
|
||||
parent.node_child_size_changed(self, extents.width(), extents.height());
|
||||
// parent.child_title_changed(self, self.title.borrow_mut().deref());
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ impl Xwindow {
|
|||
let map_change = self.map_change();
|
||||
match map_change {
|
||||
Change::None => return,
|
||||
Change::Unmap => self.destroy_node(true),
|
||||
Change::Unmap => self.node_destroy(true),
|
||||
Change::Map if self.data.info.override_redirect.get() => {
|
||||
*self.display_link.borrow_mut() =
|
||||
Some(self.data.state.root.stacked.add_last(self.clone()));
|
||||
|
|
@ -293,8 +293,8 @@ impl Xwindow {
|
|||
}
|
||||
}
|
||||
match map_change {
|
||||
Change::Unmap => self.set_visible(false),
|
||||
Change::Map => self.set_visible(true),
|
||||
Change::Unmap => self.node_set_visible(false),
|
||||
Change::Map => self.node_set_visible(true),
|
||||
Change::None => {}
|
||||
}
|
||||
self.data.state.tree_changed();
|
||||
|
|
@ -307,7 +307,7 @@ impl SurfaceExt for Xwindow {
|
|||
}
|
||||
|
||||
fn on_surface_destroy(&self) -> Result<(), WlSurfaceError> {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.surface.unset_ext();
|
||||
self.data.window.set(None);
|
||||
self.data.surface_id.set(None);
|
||||
|
|
@ -321,24 +321,11 @@ impl SurfaceExt for Xwindow {
|
|||
}
|
||||
}
|
||||
|
||||
impl Node for Xwindow {
|
||||
impl SizedNode for Xwindow {
|
||||
fn id(&self) -> NodeId {
|
||||
self.id.into()
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.events.push(XWaylandEvent::Close(self.data.clone()));
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
self.surface.visible.get()
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.surface.set_visible(visible);
|
||||
self.seat_state.set_visible(self, visible);
|
||||
}
|
||||
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.seat_state
|
||||
}
|
||||
|
|
@ -349,36 +336,49 @@ impl Node for Xwindow {
|
|||
self.workspace.take();
|
||||
self.focus_history.clear();
|
||||
if let Some(parent) = self.parent_node.take() {
|
||||
parent.remove_child(self);
|
||||
parent.node_remove_child(self);
|
||||
}
|
||||
self.surface.destroy_node(false);
|
||||
self.surface.node_destroy(false);
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_xwindow(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_xwindow(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_surface(&self.surface);
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
self.surface.visible.get()
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.surface.node_set_visible(visible);
|
||||
self.seat_state.set_visible(self, visible);
|
||||
}
|
||||
|
||||
fn get_workspace(&self) -> Option<Rc<WorkspaceNode>> {
|
||||
self.workspace.get()
|
||||
}
|
||||
|
||||
fn is_contained_in(&self, other: NodeId) -> bool {
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
if parent.id() == other {
|
||||
if parent.node_id() == other {
|
||||
return true;
|
||||
}
|
||||
return parent.is_contained_in(other);
|
||||
return parent.node_is_contained_in(other);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self);
|
||||
fn do_focus(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self.clone());
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.events.push(XWaylandEvent::Close(self.data.clone()));
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
|
|
@ -399,8 +399,8 @@ impl Node for Xwindow {
|
|||
FindTreeResult::Other
|
||||
}
|
||||
|
||||
fn pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_toplevel(self);
|
||||
fn pointer_enter(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_toplevel(self.clone());
|
||||
}
|
||||
|
||||
fn pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
@ -411,7 +411,7 @@ impl Node for Xwindow {
|
|||
renderer.render_surface(&self.surface, x, y)
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
fn change_extents(self: &Rc<Self>, rect: &Rect) {
|
||||
let old = self.data.info.extents.replace(*rect);
|
||||
if old != *rect {
|
||||
self.events.push(XWaylandEvent::Configure(self.clone()));
|
||||
|
|
@ -421,11 +421,11 @@ impl Node for Xwindow {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
fn set_workspace(self: &Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
self.workspace.set(Some(ws.clone()));
|
||||
}
|
||||
|
||||
fn set_parent(self: Rc<Self>, parent: Rc<dyn Node>) {
|
||||
fn set_parent(self: &Rc<Self>, parent: Rc<dyn Node>) {
|
||||
self.parent_node.set(Some(parent));
|
||||
self.notify_parent();
|
||||
}
|
||||
|
|
@ -463,7 +463,7 @@ impl ToplevelNode for Xwindow {
|
|||
|
||||
fn set_active(&self, active: bool) {
|
||||
if let Some(pn) = self.parent_node.get() {
|
||||
pn.child_active_changed(self, active);
|
||||
pn.node_child_active_changed(self, active);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -476,11 +476,11 @@ impl ToplevelNode for Xwindow {
|
|||
Some(p) => p,
|
||||
_ => return,
|
||||
};
|
||||
if parent.is_float() {
|
||||
parent.remove_child(&*self);
|
||||
if parent.node_is_float() {
|
||||
parent.node_remove_child(&*self);
|
||||
self.data.state.map_tiled(self.clone());
|
||||
} else if let Some(ws) = self.workspace.get() {
|
||||
parent.remove_child(&*self);
|
||||
parent.node_remove_child(&*self);
|
||||
let extents = self.data.info.extents.get();
|
||||
self.data
|
||||
.state
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use {
|
|||
object::Object,
|
||||
rect::Rect,
|
||||
render::Renderer,
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, OutputNode},
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, OutputNode, SizedNode},
|
||||
utils::{
|
||||
bitflags::BitflagsExt,
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
|
|
@ -45,6 +45,7 @@ pub struct ZwlrLayerSurfaceV1 {
|
|||
pub output: Rc<OutputNode>,
|
||||
pub namespace: String,
|
||||
pub tracker: Tracker<Self>,
|
||||
output_pos: Cell<Rect>,
|
||||
pos: Cell<Rect>,
|
||||
mapped: Cell<bool>,
|
||||
layer: Cell<u32>,
|
||||
|
|
@ -89,7 +90,8 @@ impl ZwlrLayerSurfaceV1 {
|
|||
output: output.clone(),
|
||||
namespace: namespace.to_string(),
|
||||
tracker: Default::default(),
|
||||
pos: Cell::new(Default::default()),
|
||||
output_pos: Default::default(),
|
||||
pos: Default::default(),
|
||||
mapped: Cell::new(false),
|
||||
layer: Cell::new(layer),
|
||||
pending: Default::default(),
|
||||
|
|
@ -196,7 +198,7 @@ impl ZwlrLayerSurfaceV1 {
|
|||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.client.remove_obj(self)?;
|
||||
self.surface.unset_ext();
|
||||
Ok(())
|
||||
|
|
@ -262,6 +264,10 @@ impl ZwlrLayerSurfaceV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn output_position(&self) -> Rect {
|
||||
self.output_pos.get()
|
||||
}
|
||||
|
||||
pub fn position(&self) -> Rect {
|
||||
self.pos.get()
|
||||
}
|
||||
|
|
@ -273,8 +279,8 @@ impl ZwlrLayerSurfaceV1 {
|
|||
anchor = LEFT | RIGHT | TOP | BOTTOM;
|
||||
}
|
||||
let opos = self.output.global.pos.get();
|
||||
let mut x1 = opos.x1();
|
||||
let mut y1 = opos.y1();
|
||||
let mut x1 = 0;
|
||||
let mut y1 = 0;
|
||||
if anchor.contains(LEFT) {
|
||||
if anchor.contains(RIGHT) {
|
||||
x1 += (opos.width() - width) / 2;
|
||||
|
|
@ -289,8 +295,9 @@ impl ZwlrLayerSurfaceV1 {
|
|||
} else if anchor.contains(BOTTOM) {
|
||||
y1 += opos.height() - height;
|
||||
}
|
||||
self.pos
|
||||
.set(Rect::new_sized(x1, y1, width, height).unwrap());
|
||||
let rect = Rect::new_sized(x1, y1, width, height).unwrap();
|
||||
self.output_pos.set(rect);
|
||||
self.pos.set(rect.move_(opos.x1(), opos.y1()));
|
||||
self.surface.set_absolute_position(x1, y1);
|
||||
self.client.state.tree_changed();
|
||||
}
|
||||
|
|
@ -306,7 +313,7 @@ impl SurfaceExt for ZwlrLayerSurfaceV1 {
|
|||
let buffer = self.surface.buffer.get();
|
||||
if self.mapped.get() {
|
||||
if buffer.is_none() {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
} else {
|
||||
let pos = self.pos.get();
|
||||
let (width, height) = self.size.get();
|
||||
|
|
@ -326,7 +333,7 @@ impl SurfaceExt for ZwlrLayerSurfaceV1 {
|
|||
let was_active = self.surface.seat_state.is_active();
|
||||
self.surface.seat_state.release_kb_focus();
|
||||
if was_active {
|
||||
self.surface.active_changed(false);
|
||||
self.surface.node_active_changed(false);
|
||||
}
|
||||
}
|
||||
KI_ON_DEMAND => self.surface.seat_state.release_kb_grab(),
|
||||
|
|
@ -346,7 +353,7 @@ impl SurfaceExt for ZwlrLayerSurfaceV1 {
|
|||
}
|
||||
}
|
||||
|
||||
impl Node for ZwlrLayerSurfaceV1 {
|
||||
impl SizedNode for ZwlrLayerSurfaceV1 {
|
||||
fn id(&self) -> NodeId {
|
||||
self.node_id.into()
|
||||
}
|
||||
|
|
@ -358,16 +365,16 @@ impl Node for ZwlrLayerSurfaceV1 {
|
|||
fn destroy_node(&self, _detach: bool) {
|
||||
self.link.set(None);
|
||||
self.mapped.set(false);
|
||||
self.surface.destroy_node(false);
|
||||
self.surface.node_destroy(false);
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_layer_surface(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_layer_surface(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
self.surface.clone().visit(visitor);
|
||||
self.surface.clone().node_visit(visitor);
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
|
|
@ -386,7 +393,7 @@ impl Node for ZwlrLayerSurfaceV1 {
|
|||
renderer.render_layer_surface(self, x, y);
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, _rect: &Rect) {
|
||||
fn change_extents(self: &Rc<Self>, _rect: &Rect) {
|
||||
self.compute_position();
|
||||
}
|
||||
}
|
||||
|
|
@ -415,7 +422,7 @@ impl Object for ZwlrLayerSurfaceV1 {
|
|||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.link.set(None);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue