diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-03 11:34:38 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-03 11:34:38 +0400 |
| commit | 3bd5a012cbf15bd294e1a6290914a6e687cbcf2d (patch) | |
| tree | bf3bf88eb23f9a56fd91ce1af5f1f3b4d32fa27f /src | |
| parent | 2187661ff82fdf377a767ee6a10f93b00fdbc286 (diff) | |
| download | niri-3bd5a012cbf15bd294e1a6290914a6e687cbcf2d.tar.gz niri-3bd5a012cbf15bd294e1a6290914a6e687cbcf2d.tar.bz2 niri-3bd5a012cbf15bd294e1a6290914a6e687cbcf2d.zip | |
Add Mod+Ctrl+Shift+T to toggle debug tint
Diffstat (limited to 'src')
| -rw-r--r-- | src/input.rs | 6 | ||||
| -rw-r--r-- | src/tty.rs | 10 | ||||
| -rw-r--r-- | src/winit.rs | 4 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/input.rs b/src/input.rs index 7dc34b31..f392ddf4 100644 --- a/src/input.rs +++ b/src/input.rs @@ -25,6 +25,7 @@ enum Action { Quit, ChangeVt(i32), Suspend, + ToggleDebugTint, Spawn(String), Screenshot, CloseWindow, @@ -60,6 +61,7 @@ pub enum BackendAction { ChangeVt(i32), Suspend, Screenshot, + ToggleDebugTint, } pub enum CompositorMod { @@ -110,6 +112,7 @@ fn action(comp_mod: CompositorMod, keysym: KeysymHandle, mods: ModifiersState) - KEY_n => Action::Spawn("nautilus".to_owned()), // Alt + PrtSc = SysRq KEY_Sys_Req | KEY_Print => Action::Screenshot, + KEY_T if mods.shift && mods.ctrl => Action::ToggleDebugTint, KEY_q => Action::CloseWindow, KEY_F => Action::ToggleFullscreen, KEY_comma => Action::ConsumeIntoColumn, @@ -193,6 +196,9 @@ impl Niri { Action::Suspend => { return BackendAction::Suspend; } + Action::ToggleDebugTint => { + return BackendAction::ToggleDebugTint; + } Action::Spawn(command) => { if let Err(err) = Command::new(command).spawn() { warn!("error spawning alacritty: {err}"); @@ -12,7 +12,7 @@ use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventTime}; use smithay::backend::egl::{EGLContext, EGLDisplay}; use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface}; use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture}; -use smithay::backend::renderer::{Bind, ImportEgl}; +use smithay::backend::renderer::{Bind, DebugFlags, ImportEgl}; use smithay::backend::session::libseat::LibSeatSession; use smithay::backend::session::{Event as SessionEvent, Session}; use smithay::backend::udev::{self, UdevBackend, UdevEvent}; @@ -192,6 +192,14 @@ impl Tty { } } } + BackendAction::ToggleDebugTint => { + if let Some(device) = tty.output_device.as_mut() { + for (_, compositor) in &mut device.surfaces { + compositor + .set_debug_flags(compositor.debug_flags() ^ DebugFlags::TINT); + } + } + } }; }) .unwrap(); diff --git a/src/winit.rs b/src/winit.rs index 7148f961..d1253199 100644 --- a/src/winit.rs +++ b/src/winit.rs @@ -2,6 +2,7 @@ use std::time::Duration; use smithay::backend::renderer::damage::OutputDamageTracker; use smithay::backend::renderer::gles::GlesRenderer; +use smithay::backend::renderer::{DebugFlags, Renderer}; use smithay::backend::winit::{self, WinitError, WinitEvent, WinitEventLoop, WinitGraphicsBackend}; use smithay::output::{Mode, Output, PhysicalProperties, Subpixel}; use smithay::reexports::calloop::timer::{TimeoutAction, Timer}; @@ -158,6 +159,9 @@ impl Winit { } } } + BackendAction::ToggleDebugTint => { + renderer.set_debug_flags(renderer.debug_flags() ^ DebugFlags::TINT); + } } } WinitEvent::Focus(_) => (), |
