display: Add options for DPI scales up to 300%
Scale factors above 200% may be useful on things like 4k 13 inch laptops. So we should provide higher options, even if we don't default to anything above 200%. The way the dropdown is formatted with scrolling on smaller window sizes could probably be improved. But that will presumably be a libcosmic change, not anything here.
This commit is contained in:
parent
83a4296b9f
commit
d61193dc4e
1 changed files with 12 additions and 20 deletions
|
|
@ -15,10 +15,15 @@ use cosmic::widget::{
|
||||||
use cosmic::{command, Apply, Command, Element};
|
use cosmic::{command, Apply, Command, Element};
|
||||||
use cosmic_randr_shell::{List, Output, OutputKey, Transform};
|
use cosmic_randr_shell::{List, Output, OutputKey, Transform};
|
||||||
use cosmic_settings_page::{self as page, section, Section};
|
use cosmic_settings_page::{self as page, section, Section};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use slotmap::{Key, SecondaryMap, SlotMap};
|
use slotmap::{Key, SecondaryMap, SlotMap};
|
||||||
use std::{collections::BTreeMap, process::ExitStatus, sync::Arc};
|
use std::{collections::BTreeMap, process::ExitStatus, sync::Arc};
|
||||||
|
|
||||||
|
static DPI_SCALES: &[u32] = &[50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300];
|
||||||
|
static DPI_SCALE_LABELS: Lazy<Vec<String>> =
|
||||||
|
Lazy::new(|| DPI_SCALES.iter().map(|scale| format!("{scale}%")).collect());
|
||||||
|
|
||||||
/// Display color depth options
|
/// Display color depth options
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct ColorDepth(usize);
|
pub struct ColorDepth(usize);
|
||||||
|
|
@ -585,21 +590,12 @@ impl Page {
|
||||||
self.cache.resolution_selected = None;
|
self.cache.resolution_selected = None;
|
||||||
self.cache.refresh_rate_selected = None;
|
self.cache.refresh_rate_selected = None;
|
||||||
|
|
||||||
self.cache.scale_selected = Some(if self.config.scale < 75 {
|
self.cache.scale_selected = Some(
|
||||||
0
|
DPI_SCALES
|
||||||
} else if self.config.scale < 100 {
|
.iter()
|
||||||
1
|
.position(|scale| self.config.scale <= *scale)
|
||||||
} else if self.config.scale < 125 {
|
.unwrap_or(DPI_SCALES.len() - 1),
|
||||||
2
|
);
|
||||||
} else if self.config.scale < 150 {
|
|
||||||
3
|
|
||||||
} else if self.config.scale < 175 {
|
|
||||||
4
|
|
||||||
} else if self.config.scale < 200 {
|
|
||||||
5
|
|
||||||
} else {
|
|
||||||
6
|
|
||||||
});
|
|
||||||
|
|
||||||
if let Some(current_mode_id) = output.current {
|
if let Some(current_mode_id) = output.current {
|
||||||
for (mode_id, mode) in output
|
for (mode_id, mode) in output
|
||||||
|
|
@ -1041,11 +1037,7 @@ pub fn display_configuration() -> Section<crate::pages::Message> {
|
||||||
))
|
))
|
||||||
.add(widget::settings::item(
|
.add(widget::settings::item(
|
||||||
&descriptions[scale],
|
&descriptions[scale],
|
||||||
dropdown(
|
dropdown(&DPI_SCALE_LABELS, page.cache.scale_selected, Message::Scale),
|
||||||
&["50%", "75%", "100%", "125%", "150%", "175%", "200%"],
|
|
||||||
page.cache.scale_selected,
|
|
||||||
Message::Scale,
|
|
||||||
),
|
|
||||||
))
|
))
|
||||||
.add(widget::settings::item(
|
.add(widget::settings::item(
|
||||||
&descriptions[orientation],
|
&descriptions[orientation],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue