Skip to content

Commit 3c89ec3

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 3c89ec3

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/shell/grabs/moving.rs

Lines changed: 26 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,31 @@ 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 = dbg!(grab_state.window_offset.as_global().to_f64() + grab_state.location.as_global());
502+
for (window, offset) in self.window.windows() {
503+
match window.0.underlying_surface() {
504+
WindowSurface::Wayland(toplevel) => {
505+
update_reactive_popups(
506+
toplevel,
507+
// TODO: give some thought to round vs floor
508+
(location + dbg!(offset.as_global().to_f64)).to_i32_round(),
509+
self.window_outputs.iter(),
510+
);
511+
}
512+
// Not sure what to do wth X11 surfaces. Perhaps their popups don't need adjustments.
513+
_ => {}
514+
}
515+
}
516+
}
517+
}
494518
// While the grab is active, no client has pointer focus
495519
handle.motion(state, None, event);
496520
if !self.window.alive() {

0 commit comments

Comments
 (0)