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/tty.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/tty.rs')
| -rw-r--r-- | src/backend/tty.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 9f126507..bce16ff0 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -21,7 +21,7 @@ use smithay::backend::session::libseat::LibSeatSession; use smithay::backend::session::{Event as SessionEvent, Session}; use smithay::backend::udev::{self, UdevBackend, UdevEvent}; use smithay::desktop::utils::OutputPresentationFeedback; -use smithay::output::{Mode, Output, OutputModeSource, PhysicalProperties, Subpixel}; +use smithay::output::{Mode, Output, OutputModeSource, PhysicalProperties, Subpixel, Scale}; use smithay::reexports::calloop::{Dispatcher, LoopHandle, RegistrationToken}; use smithay::reexports::drm::control::{ connector, crtc, Mode as DrmMode, ModeFlags, ModeTypeFlags, @@ -500,6 +500,15 @@ impl Tty { ); debug!("connecting connector: {output_name}"); + let config = self + .config + .borrow() + .outputs + .iter() + .find(|o| o.name == output_name) + .cloned() + .unwrap_or_default(); + let device = self.output_device.as_mut().unwrap(); let mut mode = connector.modes().get(0); @@ -534,6 +543,9 @@ impl Tty { .map(|info| (info.manufacturer, info.model)) .unwrap_or_else(|| ("Unknown".into(), "Unknown".into())); + let scale = config.scale.clamp(0.1, 10.); + let scale = scale.max(1.).round() as i32; + let output = Output::new( output_name.clone(), PhysicalProperties { @@ -544,7 +556,7 @@ impl Tty { }, ); let wl_mode = Mode::from(*mode); - output.change_current_state(Some(wl_mode), None, None, Some((0, 0).into())); + output.change_current_state(Some(wl_mode), None, Some(Scale::Integer(scale)), None); output.set_preferred(wl_mode); output.user_data().insert_if_missing(|| TtyOutputState { |
