mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Simplify popup position computation
This commit is contained in:
+6
-10
@@ -224,26 +224,22 @@ impl MappedLayer {
|
||||
location: Point<f64, Logical>,
|
||||
push: &mut dyn FnMut(LayerSurfaceRenderElement<R>),
|
||||
) {
|
||||
let scale = Scale::from(self.scale);
|
||||
let alpha = self.rules.opacity.unwrap_or(1.).clamp(0., 1.);
|
||||
let location = location + self.bob_offset();
|
||||
|
||||
if ctx.target.should_block_out(self.rules.block_out_from) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Layer surfaces don't have extra geometry like windows.
|
||||
let buf_pos = location;
|
||||
let scale = Scale::from(self.scale);
|
||||
let alpha = self.rules.opacity.unwrap_or(1.).clamp(0., 1.);
|
||||
let location = location + self.bob_offset();
|
||||
|
||||
let surface = self.surface.wl_surface();
|
||||
for (popup, popup_offset) in PopupManager::popups_for_surface(surface) {
|
||||
// Layer surfaces don't have extra geometry like windows.
|
||||
let offset = popup_offset - popup.geometry().loc;
|
||||
for (popup, offset) in PopupManager::popups_for_surface(surface) {
|
||||
let surface_loc = location + (offset - popup.geometry().loc).to_f64();
|
||||
|
||||
push_elements_from_surface_tree(
|
||||
ctx.renderer,
|
||||
popup.wl_surface(),
|
||||
(buf_pos + offset.to_f64()).to_physical_precise_round(scale),
|
||||
surface_loc.to_physical_precise_round(scale),
|
||||
scale,
|
||||
alpha,
|
||||
Kind::ScanoutCandidate,
|
||||
|
||||
@@ -655,20 +655,18 @@ impl LayoutElement for Mapped {
|
||||
return;
|
||||
}
|
||||
|
||||
let buf_pos = location - self.window.geometry().loc.to_f64();
|
||||
let surface = self.toplevel().wl_surface();
|
||||
let mut push = |elem: WaylandSurfaceRenderElement<R>| push(elem.into());
|
||||
for (popup, popup_offset) in PopupManager::popups_for_surface(surface) {
|
||||
let offset = self.window.geometry().loc + popup_offset - popup.geometry().loc;
|
||||
for (popup, offset) in PopupManager::popups_for_surface(surface) {
|
||||
let surface_loc = location + (offset - popup.geometry().loc).to_f64();
|
||||
|
||||
push_elements_from_surface_tree(
|
||||
ctx.renderer,
|
||||
popup.wl_surface(),
|
||||
(buf_pos + offset.to_f64()).to_physical_precise_round(scale),
|
||||
surface_loc.to_physical_precise_round(scale),
|
||||
scale,
|
||||
alpha,
|
||||
Kind::ScanoutCandidate,
|
||||
&mut push,
|
||||
&mut |elem| push(elem.into()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user