Add tags to override-redirect windows

This commit is contained in:
Ottatop 2023-09-09 23:43:29 -05:00
parent 0f42e403ae
commit f811771fbe
3 changed files with 27 additions and 8 deletions

View file

@ -153,11 +153,30 @@ impl XwmHandler for CalloopData {
// }
fn mapped_override_redirect_window(&mut self, _xwm: XwmId, window: X11Surface) {
tracing::debug!("MAPPED OVERRIDE REDIRECT WINDOW");
tracing::debug!("mapped override redirect window");
let win_type = window.window_type();
tracing::debug!("window type is {win_type:?}");
let loc = window.geometry().loc;
let window = WindowElement::X11(window);
window.with_state(|state| {
state.tags = match (
&self.state.focus_state.focused_output,
self.state.space.outputs().next(),
) {
(Some(output), _) | (None, Some(output)) => output.with_state(|state| {
let output_tags = state.focused_tags().cloned().collect::<Vec<_>>();
if !output_tags.is_empty() {
output_tags
} else if let Some(first_tag) = state.tags.first() {
vec![first_tag.clone()]
} else {
vec![]
}
}),
(None, None) => vec![],
};
});
self.state.focus_state.set_focus(window.clone());
// tracing::debug!("mapped_override_redirect_window to loc {loc:?}");
self.state.space.map_element(window.clone(), loc, true);
}

View file

@ -63,13 +63,11 @@ where
// let window_bbox = self.bbox();
match self {
WindowElement::Wayland(window) => {
AsRenderElements::<R>::render_elements::<WaylandSurfaceRenderElement<R>>(
window, renderer, location, scale, alpha,
)
window.render_elements(renderer, location, scale, alpha)
}
WindowElement::X11(surface) => {
surface.render_elements(renderer, location, scale, alpha)
}
WindowElement::X11(surface) => AsRenderElements::<R>::render_elements::<
WaylandSurfaceRenderElement<R>,
>(surface, renderer, location, scale, alpha),
}
.into_iter()
.map(C::from)

View file

@ -63,7 +63,7 @@ use smithay::{
socket::ListeningSocketSource,
viewporter::ViewporterState,
},
xwayland::{X11Wm, XWayland, XWaylandEvent},
xwayland::{X11Surface, X11Wm, XWayland, XWaylandEvent},
};
use crate::input::InputState;
@ -138,6 +138,7 @@ pub struct State {
pub xwayland: XWayland,
pub xwm: Option<X11Wm>,
pub xdisplay: Option<u32>,
pub override_redirect_windows: Vec<X11Surface>,
}
impl State {
@ -357,6 +358,7 @@ impl State {
xwayland,
xwm: None,
xdisplay: None,
override_redirect_windows: vec![],
})
}