Skip to content

Commit 112fc7f

Browse files
author
dcz
committed
shell/grabs: Adjust reactive popups when window is moved
Reactive XDG popups should be reconstrained if the window is moved: > When set reactive, the surface is reconstrained if the conditions used for constraining changed, e.g. the parent window moved.
1 parent d1f4e7b commit 112fc7f

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/shell/grabs/moving.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
},
1212
focus::target::{KeyboardFocusTarget, PointerFocusTarget},
1313
layout::floating::TiledCorners,
14-
CosmicMapped, CosmicSurface, Direction, ManagedLayer,
14+
CosmicMapped, CosmicSurface, Direction, ManagedLayer, WindowSurface,
1515
},
1616
utils::prelude::*,
1717
wayland::protocols::toplevel_info::{toplevel_enter_output, toplevel_enter_workspace},
@@ -490,7 +490,32 @@ impl PointerGrab<State> for MoveGrab {
490490
event: &MotionEvent,
491491
) {
492492
self.update_location(state, event.location);
493-
493+
{
494+
let mut borrow = self
495+
.seat
496+
.user_data()
497+
.get::<SeatMoveGrabState>()
498+
.map(|s| s.lock().unwrap());
499+
if let Some(grab_state) = borrow.as_mut().and_then(|s| s.as_mut()) {
500+
// is this workspace location or output location?
501+
let location =
502+
grab_state.window_offset.as_global().to_f64() + grab_state.location.as_global();
503+
for (window, offset) in self.window.windows() {
504+
match window.0.underlying_surface() {
505+
WindowSurface::Wayland(toplevel) => {
506+
update_reactive_popups(
507+
toplevel,
508+
// TODO: give some thought to round vs floor
509+
(location + offset.as_global().to_f64()).to_i32_round(),
510+
self.window_outputs.iter(),
511+
);
512+
}
513+
// Not sure what to do wth X11 surfaces. Perhaps their popups don't need adjustments.
514+
_ => {}
515+
}
516+
}
517+
}
518+
}
494519
// While the grab is active, no client has pointer focus
495520
handle.motion(state, None, event);
496521
if !self.window.alive() {

0 commit comments

Comments
 (0)