From f93258bd98a4d56bca16bdc1ed2bf00b73c3b75e Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Mon, 13 Feb 2023 17:56:13 +0100 Subject: [PATCH] shell: Send frame callbacks to grabbed windows --- src/shell/layout/floating/grabs/moving.rs | 16 +++++++++++++++- src/state.rs | 13 ++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/shell/layout/floating/grabs/moving.rs b/src/shell/layout/floating/grabs/moving.rs index aa846250..6fd9bcc8 100644 --- a/src/shell/layout/floating/grabs/moving.rs +++ b/src/shell/layout/floating/grabs/moving.rs @@ -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>; @@ -62,6 +64,18 @@ impl MoveGrabState { scale, ) } + + 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 struct MoveSurfaceGrab { diff --git a/src/state.rs b/src/state.rs index e79fc9f2..00143eef 100644 --- a/src/state.rs +++ b/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::() { + if let Some(grab_state) = move_grab.borrow().as_ref() { + grab_state.send_frames( + output, + time, + throttle, + surface_primary_scanout_output, + ); + } + } } }