state: Fixup grabbed window frame callbacks

This commit is contained in:
Victoria Brekenfeld 2024-02-14 14:53:05 +01:00 committed by Victoria Brekenfeld
parent db38cf434a
commit 96518a9f29
2 changed files with 21 additions and 30 deletions

View file

@ -39,16 +39,9 @@ use smithay::{
Seat,
},
output::Output,
reexports::wayland_server::protocol::wl_surface::WlSurface,
utils::{IsAlive, Logical, Point, Rectangle, Scale, SERIAL_COUNTER},
wayland::compositor::SurfaceData,
};
use std::{
cell::RefCell,
collections::HashSet,
sync::atomic::Ordering,
time::{Duration, Instant},
};
use std::{cell::RefCell, collections::HashSet, sync::atomic::Ordering, time::Instant};
use super::ReleaseMode;
@ -199,18 +192,6 @@ impl MoveGrabState {
.collect()
}
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 fn window(&self) -> CosmicSurface {
self.window.active_window()
}
@ -558,10 +539,9 @@ impl Drop for MoveGrab {
Some((window, location.to_global(&output)))
}
ManagedLayer::Tiling if state
.common
.shell
.active_space(&output).tiling_enabled => {
ManagedLayer::Tiling
if state.common.shell.active_space(&output).tiling_enabled =>
{
let (window, location) = state
.common
.shell

View file

@ -596,13 +596,24 @@ impl Common {
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,
);
let window = grab_state.window();
window.with_surfaces(|surface, states| {
let primary_scanout_output = update_surface_primary_scanout_output(
surface,
output,
states,
render_element_states,
default_primary_scanout_output_compare,
);
if let Some(output) = primary_scanout_output {
with_fractional_scale(states, |fraction_scale| {
fraction_scale.set_preferred_scale(
output.current_scale().fractional_scale(),
);
});
}
});
window.send_frame(output, time, throttle, surface_primary_scanout_output);
if let Some(feedback) = window
.wl_surface()
.and_then(|wl_surface| {