From 0bd9a70e69248c77db5755a765227185e7ab56a2 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Fri, 8 Apr 2022 00:04:55 +0200 Subject: [PATCH] autocommit 2022-04-08 00:04:55 CEST --- src/compositor.rs | 1 + src/ifs/wl_seat/event_handling.rs | 3 +-- src/ifs/wl_surface.rs | 2 +- src/ifs/wl_surface/xwindow.rs | 3 ++- src/keymap.xkb | 2 ++ src/render/renderer/renderer.rs | 24 +++++++++++++++++------- src/state.rs | 1 + src/tree/output.rs | 9 ++++++++- src/tree/workspace.rs | 1 + src/xwayland/xwm.rs | 1 + 10 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/compositor.rs b/src/compositor.rs index feada570..d62f25a0 100644 --- a/src/compositor.rs +++ b/src/compositor.rs @@ -160,6 +160,7 @@ fn main_(forker: Rc, logger: Arc, _args: &RunArgs) -> Resul seat_state: Default::default(), name: "dummy".to_string(), output_link: Default::default(), + visible: Cell::new(false), }); dummy_workspace.output_link.set(Some( dummy_output.workspaces.add_last(dummy_workspace.clone()), diff --git a/src/ifs/wl_seat/event_handling.rs b/src/ifs/wl_seat/event_handling.rs index 1bf69a98..35615ccd 100644 --- a/src/ifs/wl_seat/event_handling.rs +++ b/src/ifs/wl_seat/event_handling.rs @@ -452,9 +452,8 @@ impl WlSeatGlobal { impl WlSeatGlobal { pub fn enter_toplevel(self: &Rc, n: Rc) { if n.accepts_keyboard_focus() { - log::info!("does not accept input focus"); + self.focus_toplevel(n); } - self.focus_toplevel(n); } pub fn enter_popup(self: &Rc, _n: &Rc) { diff --git a/src/ifs/wl_surface.rs b/src/ifs/wl_surface.rs index a20fb867..9c2e0671 100644 --- a/src/ifs/wl_surface.rs +++ b/src/ifs/wl_surface.rs @@ -253,7 +253,7 @@ impl WlSurface { pub fn accepts_kb_focus(&self) -> bool { match self.toplevel.get() { - Some(tl) => true, + Some(tl) => tl.accepts_keyboard_focus(), _ => self.ext.get().accepts_kb_focus(), } } diff --git a/src/ifs/wl_surface/xwindow.rs b/src/ifs/wl_surface/xwindow.rs index 6049fc3a..31419a77 100644 --- a/src/ifs/wl_surface/xwindow.rs +++ b/src/ifs/wl_surface/xwindow.rs @@ -1,3 +1,4 @@ +use std::ops::Not; use { crate::{ client::Client, @@ -448,7 +449,7 @@ impl ToplevelNode for Xwindow { } fn accepts_keyboard_focus(&self) -> bool { - self.data.info.input_model.get() != XInputModel::None + self.data.info.never_focus.get().not() && self.data.info.input_model.get() != XInputModel::None } fn default_surface(&self) -> Rc { diff --git a/src/keymap.xkb b/src/keymap.xkb index eb016915..f8d76f77 100644 --- a/src/keymap.xkb +++ b/src/keymap.xkb @@ -322,6 +322,8 @@ xkb_keymap { key <94> { [ equal , asterisk ] }; key <124> { [ at , asciicircum ] }; key <92> { [ numbersign , grave ] }; + + modifier_map Mod1 { Alt_L, Alt_R }; }; }; diff --git a/src/render/renderer/renderer.rs b/src/render/renderer/renderer.rs index d3c51a3f..0a0b71a9 100644 --- a/src/render/renderer/renderer.rs +++ b/src/render/renderer/renderer.rs @@ -69,22 +69,32 @@ impl Renderer<'_> { if let Some(ws) = output.workspace.get() { self.render_workspace(&ws, x, y + th); } - render_layer!(output.layers[2]); - render_layer!(output.layers[3]); + for stacked in self.state.root.stacked.iter() { + if let Some(ws) = stacked.get_workspace() { + if ws.visible.get() { + let pos = stacked.absolute_position(); + if pos.intersects(&opos) { + let (x, y) = opos.translate(pos.x1(), pos.y1()); + stacked.render(self, x, y); + } + } + } + } for stacked in self.state.root.xstacked.iter() { let pos = stacked.absolute_position(); - stacked.render(self, x + pos.x1(), y + pos.y1()); + if pos.intersects(&opos) { + let (x, y) = opos.translate(pos.x1(), pos.y1()); + stacked.render(self, x, y); + } } + render_layer!(output.layers[2]); + render_layer!(output.layers[3]); } pub fn render_workspace(&mut self, workspace: &WorkspaceNode, x: i32, y: i32) { if let Some(node) = workspace.container.get() { self.render_container(&node, x, y) } - for stacked in workspace.stacked.iter() { - let pos = stacked.absolute_position(); - stacked.render(self, pos.x1(), pos.y1()); - } } fn x_to_f(&self, x: i32) -> f32 { diff --git a/src/state.rs b/src/state.rs index 423683d2..996a3870 100644 --- a/src/state.rs +++ b/src/state.rs @@ -248,6 +248,7 @@ impl State { seat_state: Default::default(), name: name.to_string(), output_link: Cell::new(None), + visible: Cell::new(false), }); workspace .output_link diff --git a/src/tree/output.rs b/src/tree/output.rs index 27c20c2a..a55b6b46 100644 --- a/src/tree/output.rs +++ b/src/tree/output.rs @@ -1,3 +1,4 @@ +use std::cell::Cell; use { crate::{ backend::Mode, @@ -106,6 +107,7 @@ impl OutputNode { seat_state: Default::default(), name: name.clone(), output_link: Default::default(), + visible: Cell::new(false), }); self.state.workspaces.set(name, workspace.clone()); workspace @@ -117,7 +119,12 @@ impl OutputNode { } pub fn show_workspace(&self, ws: &Rc) { - self.workspace.set(Some(ws.clone())); + ws.visible.set(true); + if let Some(old) = self.workspace.set(Some(ws.clone())) { + if old.id != ws.id { + old.visible.set(false); + } + } ws.clone().change_extents(&self.workspace_rect()); } diff --git a/src/tree/workspace.rs b/src/tree/workspace.rs index 7b8f0983..7ba0d2c8 100644 --- a/src/tree/workspace.rs +++ b/src/tree/workspace.rs @@ -27,6 +27,7 @@ pub struct WorkspaceNode { pub seat_state: NodeSeatState, pub name: String, pub output_link: Cell>>>, + pub visible: Cell, } impl WorkspaceNode { diff --git a/src/xwayland/xwm.rs b/src/xwayland/xwm.rs index 72da70af..cb18daf6 100644 --- a/src/xwayland/xwm.rs +++ b/src/xwayland/xwm.rs @@ -677,6 +677,7 @@ impl Wm { log::error!("Could not retrieve WM_HINTS property: {}", ErrorFmt(e)); } data.info.icccm_hints.input.set(true); + self.compute_input_model(data); return; } let mut values = [0; 9];