From 28cfa6a11fe8fbcb553376fed114fdf2d6faa1ac Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Mon, 21 Apr 2025 16:20:39 +0200 Subject: [PATCH] video: send feedback when brightness changes --- src/config/handler.rs | 2 +- src/ifs/jay_randr.rs | 4 ++-- src/ifs/wl_output.rs | 6 ------ src/tree/output.rs | 9 +++++++++ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/config/handler.rs b/src/config/handler.rs index 03123f02..c0053d37 100644 --- a/src/config/handler.rs +++ b/src/config/handler.rs @@ -1132,7 +1132,7 @@ impl ConfigProxyHandler { brightness: Option, ) -> Result<(), CphError> { let connector = self.get_output_node(connector)?; - connector.global.set_brightness(brightness); + connector.set_brightness(brightness); Ok(()) } diff --git a/src/ifs/jay_randr.rs b/src/ifs/jay_randr.rs index 45dc0531..d57a3f6d 100644 --- a/src/ifs/jay_randr.rs +++ b/src/ifs/jay_randr.rs @@ -486,7 +486,7 @@ impl JayRandrRequestHandler for JayRandr { let Some(c) = self.get_output_node(req.output) else { return Ok(()); }; - c.global.set_brightness(Some(req.lux)); + c.set_brightness(Some(req.lux)); Ok(()) } @@ -498,7 +498,7 @@ impl JayRandrRequestHandler for JayRandr { let Some(c) = self.get_output_node(req.output) else { return Ok(()); }; - c.global.set_brightness(None); + c.set_brightness(None); Ok(()) } } diff --git a/src/ifs/wl_output.rs b/src/ifs/wl_output.rs index 09b8190d..1147aea4 100644 --- a/src/ifs/wl_output.rs +++ b/src/ifs/wl_output.rs @@ -381,12 +381,6 @@ impl WlOutputGlobal { self.linear_color_description.set(cd_linear.clone()); self.color_description.set(cd.clone()).id != cd.id } - - pub fn set_brightness(&self, brightness: Option) { - self.persistent.brightness.set(brightness); - self.update_color_description(); - self.state.damage(self.pos.get()); - } } global_base!(WlOutputGlobal, WlOutput, WlOutputError); diff --git a/src/tree/output.rs b/src/tree/output.rs index 11277e08..0f3e2ae8 100644 --- a/src/tree/output.rs +++ b/src/tree/output.rs @@ -844,6 +844,10 @@ impl OutputNode { if (old_btf, old_bcs) == (btf, bcs) { return; } + self.update_color_description(); + } + + fn update_color_description(&self) { if self.global.update_color_description() { self.state.damage(self.global.position()); if let Some(hc) = self.hardware_cursor.get() { @@ -857,6 +861,11 @@ impl OutputNode { } } + pub fn set_brightness(&self, brightness: Option) { + self.global.persistent.brightness.set(brightness); + self.update_color_description(); + } + fn find_stacked_at( &self, stack: &LinkedList>,