Fix debug tint desync for new outputs
Browse files at this commitb8aa0a86e7a0cb3c96b11ed90940ae04e2653542Parent: 82fffde1 changed file +13 -2
- src/backend/tty.rs +13 -2
src/backend/tty.rsmodified+13 -2
| @@ -75,6 +75,8 @@ pub struct Tty { | ||
| 75 | 75 | dmabuf_global: Option<DmabufGlobal>, |
| 76 | 76 | // The output config had changed, but the session is paused, so we need to update it on resume. |
| 77 | 77 | update_output_config_on_resume: bool, |
| 78 | + // Whether the debug tinting is enabled. | |
| 79 | + debug_tint: bool, | |
| 78 | 80 | ipc_outputs: Rc<RefCell<HashMap<String, niri_ipc::Output>>>, |
| 79 | 81 | enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, |
| 80 | 82 | } |
| @@ -272,6 +274,7 @@ impl Tty { | ||
| 272 | 274 | devices: HashMap::new(), |
| 273 | 275 | dmabuf_global: None, |
| 274 | 276 | update_output_config_on_resume: false, |
| 277 | + debug_tint: false, | |
| 275 | 278 | ipc_outputs: Rc::new(RefCell::new(HashMap::new())), |
| 276 | 279 | enabled_outputs: Arc::new(Mutex::new(HashMap::new())), |
| 277 | 280 | }) |
| @@ -747,7 +750,7 @@ impl Tty { | ||
| 747 | 750 | let render_formats = egl_context.dmabuf_render_formats(); |
| 748 | 751 | |
| 749 | 752 | // Create the compositor. |
| 750 | - let compositor = DrmCompositor::new( | |
| 753 | + let mut compositor = DrmCompositor::new( | |
| 751 | 754 | OutputModeSource::Auto(output.clone()), |
| 752 | 755 | surface, |
| 753 | 756 | Some(planes), |
| @@ -760,6 +763,9 @@ impl Tty { | ||
| 760 | 763 | device.drm.cursor_size(), |
| 761 | 764 | cursor_plane_gbm, |
| 762 | 765 | )?; |
| 766 | + if self.debug_tint { | |
| 767 | + compositor.set_debug_flags(DebugFlags::TINT); | |
| 768 | + } | |
| 763 | 769 | |
| 764 | 770 | let mut dmabuf_feedback = None; |
| 765 | 771 | if let Ok(primary_renderer) = self.gpu_manager.single_renderer(&self.primary_render_node) { |
| @@ -1171,10 +1177,15 @@ impl Tty { | ||
| 1171 | 1177 | } |
| 1172 | 1178 | |
| 1173 | 1179 | pub fn toggle_debug_tint(&mut self) { |
| 1180 | + self.debug_tint = !self.debug_tint; | |
| 1181 | + | |
| 1174 | 1182 | for device in self.devices.values_mut() { |
| 1175 | 1183 | for surface in device.surfaces.values_mut() { |
| 1176 | 1184 | let compositor = &mut surface.compositor; |
| 1177 | - compositor.set_debug_flags(compositor.debug_flags() ^ DebugFlags::TINT); | |
| 1185 | + | |
| 1186 | + let mut flags = compositor.debug_flags(); | |
| 1187 | + flags.set(DebugFlags::TINT, self.debug_tint); | |
| 1188 | + compositor.set_debug_flags(flags); | |
| 1178 | 1189 | } |
| 1179 | 1190 | } |
| 1180 | 1191 | } |