shell: Send frame callbacks to grabbed windows
This commit is contained in:
parent
4a9dfcead0
commit
f93258bd98
2 changed files with 27 additions and 2 deletions
|
|
@ -23,9 +23,11 @@ use smithay::{
|
|||
Seat,
|
||||
},
|
||||
output::Output,
|
||||
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
||||
utils::{IsAlive, Logical, Point, Rectangle, Serial},
|
||||
wayland::compositor::SurfaceData,
|
||||
};
|
||||
use std::cell::RefCell;
|
||||
use std::{cell::RefCell, time::Duration};
|
||||
|
||||
pub type SeatMoveGrabState = RefCell<Option<MoveGrabState>>;
|
||||
|
||||
|
|
@ -62,6 +64,18 @@ impl MoveGrabState {
|
|||
scale,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn send_frames(
|
||||
&self,
|
||||
output: &Output,
|
||||
time: impl Into<Duration>,
|
||||
throttle: Option<Duration>,
|
||||
primary_scan_out_output: impl FnMut(&WlSurface, &SurfaceData) -> Option<Output> + Copy,
|
||||
) {
|
||||
self.window
|
||||
.active_window()
|
||||
.send_frame(output, time, throttle, primary_scan_out_output)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MoveSurfaceGrab {
|
||||
|
|
|
|||
13
src/state.rs
13
src/state.rs
|
|
@ -3,7 +3,7 @@
|
|||
use crate::{
|
||||
backend::{kms::KmsState, winit::WinitState, x11::X11State},
|
||||
config::{Config, OutputConfig},
|
||||
shell::Shell,
|
||||
shell::{layout::floating::SeatMoveGrabState, Shell},
|
||||
utils::prelude::*,
|
||||
wayland::protocols::{
|
||||
drm::WlDrmState,
|
||||
|
|
@ -386,6 +386,17 @@ impl Common {
|
|||
|_, _| None,
|
||||
)
|
||||
}
|
||||
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||
if let Some(grab_state) = move_grab.borrow().as_ref() {
|
||||
grab_state.send_frames(
|
||||
output,
|
||||
time,
|
||||
throttle,
|
||||
surface_primary_scanout_output,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue