MCPcopy Create free account
hub / github.com/StrataWM/strata / window_under

Method window_under

src/workspaces.rs:239–253  ·  view source on GitHub ↗
(
		&self,
		point: P,
	)

Source from the content-addressed store, hash-verified

237 }
238
239 pub fn window_under<P: Into<Point<f64, Logical>>>(
240 &self,
241 point: P,
242 ) -> Option<(Ref<'_, Window>, Point<i32, Logical>)> {
243 let point = point.into();
244 self.windows.iter().filter(|e| e.borrow().bbox().to_f64().contains(point)).find_map(|e| {
245 // we need to offset the point to the location where the surface is actually drawn
246 let render_location = e.borrow().render_location();
247 if e.borrow().smithay_window.is_in_input_region(&(point - render_location.to_f64())) {
248 Some((Ref::map(e.borrow(), |hw| &hw.smithay_window), render_location))
249 } else {
250 None
251 }
252 })
253 }
254
255 pub fn contains_window(&self, window: &Window) -> bool {
256 self.windows.iter().any(|w| &w.borrow().smithay_window == window)

Callers 3

surface_underMethod · 0.80
close_windowMethod · 0.80

Calls 3

iterMethod · 0.80
bboxMethod · 0.80
render_locationMethod · 0.80

Tested by

no test coverage detected