mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
Store output name in CastTarget
Will be useful in the next commit to avoid fetching it every time.
This commit is contained in:
+22
-3
@@ -571,8 +571,27 @@ pub enum CenterCoords {
|
||||
pub enum CastTarget {
|
||||
// Dynamic cast before selecting anything.
|
||||
Nothing,
|
||||
Output(WeakOutput),
|
||||
Window { id: u64 },
|
||||
Output {
|
||||
output: WeakOutput,
|
||||
/// Cached name of the output.
|
||||
name: String,
|
||||
},
|
||||
Window {
|
||||
id: u64,
|
||||
},
|
||||
}
|
||||
|
||||
impl CastTarget {
|
||||
pub fn output(output: &Output) -> Self {
|
||||
Self::Output {
|
||||
output: output.downgrade(),
|
||||
name: output.name(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn matches_output(&self, weak: &WeakOutput) -> bool {
|
||||
matches!(self, CastTarget::Output { output, .. } if output == weak)
|
||||
}
|
||||
}
|
||||
|
||||
/// Pending update to a window's focus timestamp.
|
||||
@@ -2797,7 +2816,7 @@ impl Niri {
|
||||
RedrawState::WaitingForEstimatedVBlankAndQueued(token) => self.event_loop.remove(token),
|
||||
}
|
||||
|
||||
self.stop_casts_for_target(CastTarget::Output(output.downgrade()));
|
||||
self.stop_casts_for_target(CastTarget::output(output));
|
||||
|
||||
self.remove_screencopy_output(output);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user