tree: never focus wl-subsurface surfaces
This commit is contained in:
parent
5afde58086
commit
4584dee160
15 changed files with 150 additions and 35 deletions
|
|
@ -503,8 +503,10 @@ impl WlSeatGlobal {
|
|||
};
|
||||
self.surface_pointer_event(0, surface, |p| p.send_button(serial, 0, button, state));
|
||||
self.surface_pointer_frame(surface);
|
||||
if pressed && surface.accepts_kb_focus() {
|
||||
self.focus_node(surface.clone());
|
||||
if pressed {
|
||||
if let Some(node) = surface.get_focus_node(self.id) {
|
||||
self.focus_node(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ trait SurfaceExt {
|
|||
None
|
||||
}
|
||||
|
||||
fn accepts_kb_focus(&self) -> bool {
|
||||
true
|
||||
fn focus_node(&self) -> Option<Rc<dyn Node>> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -266,10 +266,11 @@ impl WlSurface {
|
|||
Ok(cursor)
|
||||
}
|
||||
|
||||
pub fn accepts_kb_focus(&self) -> bool {
|
||||
pub fn get_focus_node(&self, seat: SeatId) -> Option<Rc<dyn Node>> {
|
||||
match self.toplevel.get() {
|
||||
Some(tl) => tl.tl_accepts_keyboard_focus(),
|
||||
_ => self.ext.get().accepts_kb_focus(),
|
||||
Some(tl) if tl.tl_accepts_keyboard_focus() => tl.tl_focus_child(seat),
|
||||
Some(_) => None,
|
||||
_ => self.ext.get().focus_node(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue