forge
Explore
Log in

Don't you dare go Hollow

Advance animations in process_input_event

Browse files at this commit

adbd53327cc597d176da6f7cc23dec72047db90dIvan MolodetskikhParent: 99ab96d
src/input.rsmodified+7 -0
@@ -9,6 +9,7 @@ use smithay::input::pointer::{AxisFrame, ButtonEvent, MotionEvent, RelativeMotio
9 use smithay::utils::SERIAL_COUNTER;9 use smithay::utils::SERIAL_COUNTER;
10 10
11 use crate::niri::Niri;11 use crate::niri::Niri;
12+use crate::utils::get_monotonic_time;
12 13
13 enum Action {14 enum Action {
14 None,15 None,
@@ -101,6 +102,12 @@ impl Niri {
101 let _span = tracy_client::span!("process_input_event");102 let _span = tracy_client::span!("process_input_event");
102 trace!("process_input_event");103 trace!("process_input_event");
103 104
105+ // A bit of a hack, but animation end runs some logic (i.e. workspace clean-up) and it
106+ // doesn't always trigger due to damage, etc. So run it here right before it might prove
107+ // important. Besides, animations affect the input, so it's best to have up-to-date values
108+ // here.
109+ self.monitor_set.advance_animations(get_monotonic_time());
110+
104 match event {111 match event {
105 InputEvent::Keyboard { event, .. } => {112 InputEvent::Keyboard { event, .. } => {
106 let serial = SERIAL_COUNTER.next_serial();113 let serial = SERIAL_COUNTER.next_serial();
src/layout.rsmodified+15 -0
@@ -726,6 +726,21 @@ impl<W: LayoutElement> MonitorSet<W> {
726 }726 }
727 }727 }
728 }728 }
729+
730+ pub fn advance_animations(&mut self, current_time: Duration) {
731+ match self {
732+ MonitorSet::Normal { monitors, .. } => {
733+ for mon in monitors {
734+ mon.advance_animations(current_time);
735+ }
736+ }
737+ MonitorSet::NoOutputs(workspaces) => {
738+ for ws in workspaces {
739+ ws.advance_animations(current_time);
740+ }
741+ }
742+ }
743+ }
729 }744 }
730 745
731 impl MonitorSet<Window> {746 impl MonitorSet<Window> {