1
0
Fork 0
forked from wry/wry

tree: never focus wl-subsurface surfaces

This commit is contained in:
Julian Orth 2022-05-05 14:04:15 +02:00
parent 5afde58086
commit 4584dee160
15 changed files with 150 additions and 35 deletions

View file

@ -296,10 +296,6 @@ impl SurfaceExt for WlSubsurface {
fn into_subsurface(self: Rc<Self>) -> Option<Rc<WlSubsurface>> {
Some(self)
}
fn accepts_kb_focus(&self) -> bool {
self.parent.accepts_kb_focus()
}
}
#[derive(Debug, Error)]

View file

@ -360,10 +360,6 @@ impl SurfaceExt for XdgSurface {
fn extents_changed(&self) {
self.update_extents();
}
fn accepts_kb_focus(&self) -> bool {
self.role.get() == XdgSurfaceRole::XdgToplevel
}
}
#[derive(Debug, Error)]

View file

@ -6,7 +6,7 @@ use {
cursor::KnownCursor,
fixed::Fixed,
ifs::{
wl_seat::{NodeSeatState, WlSeatGlobal},
wl_seat::{NodeSeatState, SeatId, WlSeatGlobal},
wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt},
},
leaks::Tracker,
@ -437,10 +437,6 @@ impl ToplevelNode for XdgToplevel {
&self.toplevel_data
}
fn tl_default_focus_child(&self) -> Option<Rc<dyn Node>> {
Some(self.xdg.surface.clone())
}
fn tl_set_active(&self, active: bool) {
let changed = {
let mut states = self.states.borrow_mut();
@ -456,6 +452,10 @@ impl ToplevelNode for XdgToplevel {
}
}
fn tl_focus_child(&self, _seat: SeatId) -> Option<Rc<dyn Node>> {
Some(self.xdg.surface.clone())
}
fn tl_set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
self.toplevel_data.workspace.set(Some(ws.clone()));
self.xdg.set_workspace(ws);

View file

@ -4,7 +4,7 @@ use {
cursor::KnownCursor,
fixed::Fixed,
ifs::{
wl_seat::{NodeSeatState, WlSeatGlobal},
wl_seat::{NodeSeatState, SeatId, WlSeatGlobal},
wl_surface::{SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError},
},
rect::Rect,
@ -383,10 +383,6 @@ impl ToplevelNode for Xwindow {
&self.toplevel_data
}
fn tl_default_focus_child(&self) -> Option<Rc<dyn Node>> {
Some(self.surface.clone())
}
fn tl_accepts_keyboard_focus(&self) -> bool {
self.data.info.never_focus.get().not()
&& self.data.info.input_model.get() != XInputModel::None
@ -400,6 +396,10 @@ impl ToplevelNode for Xwindow {
.push(XWaylandEvent::Activate(self.data.clone()));
}
fn tl_focus_child(&self, _seat: SeatId) -> Option<Rc<dyn Node>> {
Some(self.surface.clone())
}
fn tl_change_extents(self: Rc<Self>, rect: &Rect) {
// log::info!("xwin {} change_extents {:?}", self.data.window_id, rect);
let old = self.data.info.extents.replace(*rect);

View file

@ -356,8 +356,12 @@ impl SurfaceExt for ZwlrLayerSurfaceV1 {
}
}
fn accepts_kb_focus(&self) -> bool {
self.keyboard_interactivity.get() != KI_NONE
fn focus_node(&self) -> Option<Rc<dyn Node>> {
if self.keyboard_interactivity.get() != KI_NONE {
Some(self.surface.clone())
} else {
None
}
}
}