From 96518a9f292eda2d00aa9007e7142c99d9b69b4f Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Wed, 14 Feb 2024 14:53:05 +0100 Subject: [PATCH] state: Fixup grabbed window frame callbacks --- src/shell/grabs/moving.rs | 28 ++++------------------------ src/state.rs | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/shell/grabs/moving.rs b/src/shell/grabs/moving.rs index e8545b68..35742f6a 100644 --- a/src/shell/grabs/moving.rs +++ b/src/shell/grabs/moving.rs @@ -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, - throttle: Option, - primary_scan_out_output: impl FnMut(&WlSurface, &SurfaceData) -> Option + 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 diff --git a/src/state.rs b/src/state.rs index e2b19710..1d507403 100644 --- a/src/state.rs +++ b/src/state.rs @@ -596,13 +596,24 @@ impl Common { if let Some(move_grab) = seat.user_data().get::() { 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| {