From 438b334352f880d525fe518dc4a879d0603623f0 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 20 Jan 2023 14:02:52 -0800 Subject: [PATCH] Handle output update events --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index fda4798..7995fd2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -239,6 +239,18 @@ impl Application for App { } } } + OutputEvent::Created(None) => {} // XXX? + OutputEvent::InfoUpdate(info) => { + if let Some(output) = self.outputs.iter_mut().find(|x| &x.handle == &output) + { + if let Some((width, height)) = info.logical_size { + output.width = width; + output.height = height; + } + output.name = info.name; + // XXX re-create surface? + } + } OutputEvent::Removed => { if let Some(idx) = self.outputs.iter().position(|x| &x.handle == &output) { self.outputs.remove(idx); @@ -247,8 +259,6 @@ impl Application for App { return self.destroy_surface(&output); } } - // TODO handle update/remove - _ => {} }, _ => {} },