1
0
Fork 0
forked from wry/wry

tree: implement Node::node_accepts_focus for more nodes

This commit is contained in:
Julian Orth 2025-07-19 22:00:32 +02:00
parent 5a004c3d31
commit c034ea7604
3 changed files with 19 additions and 5 deletions

View file

@ -19,8 +19,8 @@ use {
rect::Rect, rect::Rect,
renderer::Renderer, renderer::Renderer,
tree::{ tree::{
FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeLayerLink, NodeLocation, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeLayerLink,
NodeVisitor, OutputNode, StackedNode, NodeLocation, NodeVisitor, OutputNode, StackedNode,
}, },
utils::clonecell::CloneCell, utils::clonecell::CloneCell,
wire::{XdgPopupId, xdg_popup::*}, wire::{XdgPopupId, xdg_popup::*},
@ -329,6 +329,10 @@ impl Node for XdgPopup {
XdgSurfaceExt::node_layer(self) XdgSurfaceExt::node_layer(self)
} }
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
seat.focus_node(self.xdg.surface.clone());
}
fn node_find_tree_at( fn node_find_tree_at(
&self, &self,
x: i32, x: i32,

View file

@ -3,7 +3,7 @@ use {
client::{Client, ClientError}, client::{Client, ClientError},
ifs::{ ifs::{
wl_output::OutputGlobalOpt, wl_output::OutputGlobalOpt,
wl_seat::NodeSeatState, wl_seat::{NodeSeatState, WlSeatGlobal},
wl_surface::{ wl_surface::{
PendingState, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError, PendingState, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
xdg_surface::xdg_popup::{XdgPopup, XdgPopupParent}, xdg_surface::xdg_popup::{XdgPopup, XdgPopupParent},
@ -15,8 +15,8 @@ use {
rect::Rect, rect::Rect,
renderer::Renderer, renderer::Renderer,
tree::{ tree::{
FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeLayerLink, NodeLocation, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeLayerLink,
NodeVisitor, OutputNode, StackedNode, NodeLocation, NodeVisitor, OutputNode, StackedNode,
}, },
utils::{ utils::{
bitflags::BitflagsExt, bitflags::BitflagsExt,
@ -683,6 +683,10 @@ impl Node for ZwlrLayerSurfaceV1 {
self.keyboard_interactivity.get() != KI_NONE self.keyboard_interactivity.get() != KI_NONE
} }
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
seat.focus_node(self.surface.clone())
}
fn node_find_tree_at( fn node_find_tree_at(
&self, &self,
x: i32, x: i32,

View file

@ -727,6 +727,12 @@ impl Node for FloatNode {
false false
} }
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
if let Some(c) = self.child.get() {
c.node_do_focus(seat, direction);
}
}
fn node_find_tree_at( fn node_find_tree_at(
&self, &self,
x: i32, x: i32,