diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-21 13:48:32 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-21 13:48:50 +0400 |
| commit | 109668fa30bf65e56a2723ff29bcadc3e9a6e4ca (patch) | |
| tree | d95fbf3bdb3c2c14683a34d8bb7203b7dae4820d /src/backend/winit.rs | |
| parent | cfa73c153cc6ae2f1c21dcbbc8e755b265babbd2 (diff) | |
| download | niri-109668fa30bf65e56a2723ff29bcadc3e9a6e4ca.tar.gz niri-109668fa30bf65e56a2723ff29bcadc3e9a6e4ca.tar.bz2 niri-109668fa30bf65e56a2723ff29bcadc3e9a6e4ca.zip | |
Add output configuration & integer scaling support
Diffstat (limited to 'src/backend/winit.rs')
| -rw-r--r-- | src/backend/winit.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/winit.rs b/src/backend/winit.rs index 9f591e71..99cfe7db 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -8,7 +8,7 @@ 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, WinitGraphicsBackend}; -use smithay::output::{Mode, Output, PhysicalProperties, Subpixel}; +use smithay::output::{Mode, Output, PhysicalProperties, Scale, Subpixel}; use smithay::reexports::calloop::timer::{TimeoutAction, Timer}; use smithay::reexports::calloop::LoopHandle; use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_presentation_feedback; @@ -38,6 +38,16 @@ impl Winit { .with_title("niri"); let (backend, mut winit_event_loop) = winit::init_from_builder(builder).unwrap(); + let output_config = config + .borrow() + .outputs + .iter() + .find(|o| o.name == "winit") + .cloned() + .unwrap_or_default(); + let scale = output_config.scale.clamp(0.1, 10.); + let scale = scale.max(1.).round() as i32; + let mode = Mode { size: backend.window_size().physical_size, refresh: 60_000, @@ -55,8 +65,8 @@ impl Winit { output.change_current_state( Some(mode), Some(Transform::Flipped180), + Some(Scale::Integer(scale)), None, - Some((0, 0).into()), ); output.set_preferred(mode); |
