Avoid continuous redrawing during horizontal gesture
Browse files at this commit568fbe26fe58be7de34e46ddb980a26d12e85ac6Parent: f8412ec2 changed files +16 -1
- src/layout/monitor.rs +4 -1
- src/layout/workspace.rs +12 -0
src/layout/monitor.rsmodified+4 -1
| @@ -544,7 +544,10 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 544 | 544 | ||
| 545 | pub fn are_transitions_ongoing(&self) -> bool { | 545 | pub fn are_transitions_ongoing(&self) -> bool { |
| 546 | self.workspace_switch.is_some() | 546 | self.workspace_switch.is_some() |
| 547 | - || self.workspaces.iter().any(|ws| ws.are_animations_ongoing()) | 547 | + || self |
| 548 | + .workspaces | ||
| 549 | + .iter() | ||
| 550 | + .any(|ws| ws.are_transitions_ongoing()) | ||
| 548 | } | 551 | } |
| 549 | 552 | ||
| 550 | pub fn update_config(&mut self, options: Rc<Options>) { | 553 | pub fn update_config(&mut self, options: Rc<Options>) { |
src/layout/workspace.rsmodified+12 -0
| @@ -213,6 +213,10 @@ impl OutputId { | |||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | impl ViewOffsetAdjustment { | 215 | impl ViewOffsetAdjustment { |
| 216 | + pub fn is_animation(&self) -> bool { | ||
| 217 | + matches!(self, Self::Animation(_)) | ||
| 218 | + } | ||
| 219 | + | ||
| 216 | pub fn target_view_offset(&self) -> f64 { | 220 | pub fn target_view_offset(&self) -> f64 { |
| 217 | match self { | 221 | match self { |
| 218 | ViewOffsetAdjustment::Animation(anim) => anim.to(), | 222 | ViewOffsetAdjustment::Animation(anim) => anim.to(), |
| @@ -307,6 +311,14 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 307 | } | 311 | } |
| 308 | 312 | ||
| 309 | pub fn are_animations_ongoing(&self) -> bool { | 313 | pub fn are_animations_ongoing(&self) -> bool { |
| 314 | + self.view_offset_adj | ||
| 315 | + .as_ref() | ||
| 316 | + .is_some_and(|s| s.is_animation()) | ||
| 317 | + || self.columns.iter().any(Column::are_animations_ongoing) | ||
| 318 | + || !self.closing_windows.is_empty() | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + pub fn are_transitions_ongoing(&self) -> bool { | ||
| 310 | self.view_offset_adj.is_some() | 322 | self.view_offset_adj.is_some() |
| 311 | || self.columns.iter().any(Column::are_animations_ongoing) | 323 | || self.columns.iter().any(Column::are_animations_ongoing) |
| 312 | || !self.closing_windows.is_empty() | 324 | || !self.closing_windows.is_empty() |