1
0
Fork 0
forked from wry/wry

autocommit 2022-02-20 15:31:54 CET

This commit is contained in:
Julian Orth 2022-02-20 15:31:54 +01:00
parent 0f2fbcc5e7
commit 26fab1e3e2
10 changed files with 198 additions and 19 deletions

View file

@ -227,6 +227,11 @@ impl WlSeatGlobal {
kb_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);
}
fn set_selection_<T: ipc::Vtable>(
self: &Rc<Self>,
field: &CloneCell<Option<Rc<T::Source>>>,

View file

@ -637,6 +637,14 @@ impl Node for WlSurface {
xdg.move_focus(seat, direction);
}
fn move_self(self: Rc<Self>, direction: Direction) {
let xdg = match self.xdg.get() {
Some(x) => x,
_ => return,
};
xdg.move_self(direction);
}
fn absolute_position(&self) -> Rect {
self.buffer_abs_pos.get()
}

View file

@ -96,6 +96,10 @@ pub trait XdgSurfaceExt: Debug {
let _ = direction;
}
fn move_self(self: Rc<Self>, direction: Direction) {
let _ = direction;
}
fn initial_configure(self: Rc<Self>) -> Result<(), XdgSurfaceError> {
Ok(())
}
@ -171,11 +175,15 @@ impl XdgSurface {
}
pub fn move_focus(&self, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let ext = match self.ext.get() {
None => return,
Some(e) => e,
};
ext.move_focus(seat, direction);
if let Some(ext)= self.ext.get() {
ext.move_focus(seat, direction);
}
}
pub fn move_self(&self, direction: Direction) {
if let Some(ext)= self.ext.get() {
ext.move_self(direction);
}
}
pub fn role(&self) -> XdgSurfaceRole {

View file

@ -510,6 +510,11 @@ impl Node for XdgToplevel {
self.xdg.set_workspace(ws);
}
fn set_parent(self: Rc<Self>, parent: Rc<dyn Node>) {
self.parent_node.set(Some(parent));
self.notify_parent();
}
fn client(&self) -> Option<Rc<Client>> {
Some(self.xdg.surface.client.clone())
}
@ -546,15 +551,18 @@ impl XdgSurfaceExt for XdgToplevel {
));
self.parent_node.set(Some(cn.clone()));
pn.replace_child(&*self, cn);
self.notify_parent();
}
fn move_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let pn = match self.parent_node.get() {
Some(pn) => pn,
_ => return,
};
pn.move_focus_from_child(seat, &*self, direction);
if let Some(pn) = self.parent_node.get() {
pn.move_focus_from_child(seat, &*self, direction);
}
}
fn move_self(self: Rc<Self>, direction: Direction) {
if let Some(pn) = self.parent_node.get() {
pn.move_child(self, direction);
}
}
fn initial_configure(self: Rc<Self>) -> Result<(), XdgSurfaceError> {