tree: ensure that node is marked active after un-fullscreening
This commit is contained in:
parent
23f1aa5a31
commit
8c3106f631
5 changed files with 58 additions and 14 deletions
|
|
@ -181,6 +181,13 @@ impl TestConfig {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn set_fullscreen(&self, seat: SeatId, fs: bool) -> TestResult {
|
||||
self.send(ClientMessage::SetFullscreen {
|
||||
seat: Seat(seat.raw() as _),
|
||||
fullscreen: fs,
|
||||
})
|
||||
}
|
||||
|
||||
fn clear(&self) {
|
||||
unsafe {
|
||||
if let Some(srv) = self.srv.take() {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ mod t0006_region;
|
|||
mod t0007_subsurface;
|
||||
mod t0008_map_focus;
|
||||
mod t0009_tab_focus;
|
||||
mod t0010_fullscreen_focus;
|
||||
|
||||
pub trait TestCase: Sync {
|
||||
fn name(&self) -> &'static str;
|
||||
|
|
@ -62,5 +63,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
|
|||
t0007_subsurface,
|
||||
t0008_map_focus,
|
||||
t0009_tab_focus,
|
||||
t0010_fullscreen_focus,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
42
src/it/tests/t0010_fullscreen_focus.rs
Normal file
42
src/it/tests/t0010_fullscreen_focus.rs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{test_error::TestError, testrun::TestRun},
|
||||
tree::ToplevelNode,
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
testcase!();
|
||||
|
||||
/// Test that container focus is set after un-fullscreening
|
||||
async fn test(run: Rc<TestRun>) -> Result<(), TestError> {
|
||||
let ds = run.create_default_setup().await?;
|
||||
ds.mouse.rel(1.0, 1.0);
|
||||
|
||||
let client = run.create_client().await?;
|
||||
|
||||
let window = client.create_window().await?;
|
||||
window.map().await?;
|
||||
|
||||
tassert!(!window.tl.server.tl_data().is_fullscreen.get());
|
||||
|
||||
run.cfg.set_fullscreen(ds.seat.id(), true)?;
|
||||
|
||||
tassert!(window.tl.server.tl_data().is_fullscreen.get());
|
||||
|
||||
run.cfg.set_fullscreen(ds.seat.id(), false)?;
|
||||
|
||||
tassert!(!window.tl.server.tl_data().is_fullscreen.get());
|
||||
|
||||
let container = match window.tl.server.tl_data().parent.get() {
|
||||
Some(p) => match p.node_into_container() {
|
||||
Some(p) => p,
|
||||
_ => bail!("Containing node is not a container"),
|
||||
},
|
||||
_ => bail!("Toplevel doesn't have a parent"),
|
||||
};
|
||||
|
||||
tassert!(container.children.iter().next().unwrap().active.get());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -40,14 +40,14 @@ pub trait ToplevelNode: Node {
|
|||
fn tl_surface_active_changed(&self, active: bool) {
|
||||
let data = self.tl_data();
|
||||
if active {
|
||||
if data.active_children.fetch_add(1) == 0 {
|
||||
if data.active_surfaces.fetch_add(1) == 0 {
|
||||
self.tl_set_active(true);
|
||||
if let Some(parent) = data.parent.get() {
|
||||
parent.node_child_active_changed(self.tl_as_node(), true, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if data.active_children.fetch_sub(1) == 1 {
|
||||
if data.active_surfaces.fetch_sub(1) == 1 {
|
||||
self.tl_set_active(false);
|
||||
if let Some(parent) = data.parent.get() {
|
||||
parent.node_child_active_changed(self.tl_as_node(), false, 1);
|
||||
|
|
@ -107,15 +107,8 @@ pub trait ToplevelNode: Node {
|
|||
_ => return,
|
||||
};
|
||||
let node = self.tl_as_node();
|
||||
let depth = if data.active.get() {
|
||||
1
|
||||
} else if data.active_children.get() > 0 {
|
||||
2
|
||||
} else {
|
||||
0
|
||||
};
|
||||
if depth > 0 {
|
||||
parent.clone().node_child_active_changed(node, true, depth);
|
||||
if data.active.get() || data.active_surfaces.get() > 0 {
|
||||
parent.clone().node_child_active_changed(node, true, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +154,7 @@ pub struct ToplevelData {
|
|||
pub active: Cell<bool>,
|
||||
pub client: Option<Rc<Client>>,
|
||||
pub state: Rc<State>,
|
||||
pub active_children: NumCell<u32>,
|
||||
pub active_surfaces: NumCell<u32>,
|
||||
pub focus_node: SmallMap<SeatId, Rc<dyn Node>, 1>,
|
||||
pub visible: Cell<bool>,
|
||||
pub is_floating: Cell<bool>,
|
||||
|
|
@ -182,7 +175,7 @@ impl ToplevelData {
|
|||
active: Cell::new(false),
|
||||
client,
|
||||
state: state.clone(),
|
||||
active_children: Default::default(),
|
||||
active_surfaces: Default::default(),
|
||||
focus_node: Default::default(),
|
||||
visible: Cell::new(false),
|
||||
is_floating: Default::default(),
|
||||
|
|
|
|||
|
|
@ -1452,7 +1452,7 @@ impl Wm {
|
|||
|
||||
async fn handle_minimize_requested(&self, data: &Rc<XwindowData>) -> bool {
|
||||
if let Some(w) = data.window.get() {
|
||||
if w.toplevel_data.active_children.get() > 0 {
|
||||
if w.toplevel_data.active_surfaces.get() > 0 {
|
||||
self.set_wm_state(data, ICCCM_WM_STATE_NORMAL).await;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue