Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility: Zoom #1173

Merged
merged 29 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e15bdfd
render: Scale contents according to zoom_level
Drakulix Jan 23, 2025
0c0c802
shell: Allow triggering zoom
Drakulix Jan 23, 2025
b49916a
config: Add zoom configuration
Drakulix Jan 24, 2025
1de153b
utils: Move `NextDown`
Drakulix Jan 24, 2025
ae2e6a7
zoom: Handle multiple outputs
Drakulix Jan 24, 2025
e5c88d7
chore: Update cosmic-settings-config
Drakulix Jan 24, 2025
28e6ee1
shell: don't accidentally reset zoom when using multiple seats (theor…
Drakulix Feb 4, 2025
b898c34
shell: Reset focal point if cursor outside OnEdge area
Drakulix Feb 4, 2025
2729fe4
shell: Cleanup zoom state
Drakulix Feb 4, 2025
5c8f3cd
config: Read/store zoom state
Drakulix Feb 4, 2025
57b7ab5
input: Zoom on Super+Scroll
Drakulix Feb 5, 2025
da00430
input: Refactor common logic into `update_zoom`
Drakulix Feb 13, 2025
0c1adbc
grab: Refactor `MenuGrab` to be useful for zoom ui
Drakulix Feb 13, 2025
14a68ec
iced: Track last seat/serial for grabs
Drakulix Feb 13, 2025
45b18c7
config: Handle zoom updates in `Common::update_config`
Drakulix Feb 13, 2025
b6d25fc
shell: Add zoom UI
Drakulix Feb 13, 2025
f3ac373
iced: Allow rendering at a higher native scale than it's output
Drakulix Feb 14, 2025
80757d2
zoom: Don't render at 100% scale while animating
Drakulix Feb 14, 2025
4525d4b
shell: Rescale zoom UI with zoom factor
Drakulix Feb 14, 2025
e401634
zoom: Localize zoom ui
Drakulix Feb 14, 2025
0e5c723
zoom: Fix config/state changes
Drakulix Feb 14, 2025
4d403df
config: Update zoom config defaults
Drakulix Feb 14, 2025
1ab0e3f
zoom: Reload config after writing
Drakulix Feb 17, 2025
9f0bf59
zoom: Seperate animating/current focal_point
Drakulix Feb 17, 2025
9a87dc6
zoom: Be a little more lenient with OnEdge movement and fractional cu…
Drakulix Feb 17, 2025
aba006f
zoom: Add separator to popup
Drakulix Feb 17, 2025
9e58354
chore: Cleanup some warnings
Drakulix Feb 17, 2025
0ef0c85
wayland: Implement cosmic-a11y-v1
Drakulix Feb 17, 2025
1b3a069
zoom: bugfixes
Drakulix Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bytemuck = "1.12"
calloop = {version = "0.14.1", features = ["executor"]}
cosmic-comp-config = {path = "cosmic-comp-config"}
cosmic-config = {git = "https://github.com/pop-os/libcosmic/", features = ["calloop", "macro"]}
cosmic-protocols = {git = "https://github.com/pop-os/cosmic-protocols", rev = "178eb0b", default-features = false, features = ["server"]}
cosmic-protocols = {git = "https://github.com/pop-os/cosmic-protocols", rev = "ed2a481", default-features = false, features = ["server"]}
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon" }
libdisplay-info = "0.2.0"
egui = {version = "0.30.0", optional = true}
Expand Down Expand Up @@ -115,4 +115,8 @@ inherits = "release"
lto = "fat"

[patch.crates-io]
smithay = { git = "https://github.com/smithay/smithay.git", rev = "f93476c" }
smithay = { git = "https://github.com/smithay/smithay.git", rev = "f93476c" }

[patch."https://github.com/pop-os/cosmic-protocols"]
cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", rev = "ed2a481" }
cosmic-client-toolkit = { git = "https://github.com/pop-os//cosmic-protocols", rev = "ed2a481" }
26 changes: 26 additions & 0 deletions cosmic-comp-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct CosmicCompConfig {
pub descale_xwayland: bool,
/// The threshold before windows snap themselves to output edges
pub edge_snap_threshold: u32,
pub accessibility_zoom: ZoomConfig,
}

impl Default for CosmicCompConfig {
Expand Down Expand Up @@ -79,6 +80,7 @@ impl Default for CosmicCompConfig {
focus_follows_cursor_delay: 250,
descale_xwayland: false,
edge_snap_threshold: 0,
accessibility_zoom: ZoomConfig::default(),
}
}
}
Expand Down Expand Up @@ -124,3 +126,27 @@ fn default_repeat_rate() -> u32 {
fn default_repeat_delay() -> u32 {
600
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
pub struct ZoomConfig {
pub start_on_login: bool,
pub increment: u32,
pub view_moves: ZoomMovement,
}

impl Default for ZoomConfig {
fn default() -> Self {
ZoomConfig {
start_on_login: false,
increment: 50,
view_moves: ZoomMovement::Continuously,
}
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
pub enum ZoomMovement {
OnEdge,
Centered,
Continuously,
}
3 changes: 3 additions & 0 deletions data/keybindings.ron
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
(modifiers: [Super], key: "r"): Resizing(Outwards),
(modifiers: [Super, Shift], key: "r"): Resizing(Inwards),

(modifiers: [Super], key: "equal"): ZoomIn,
(modifiers: [Super], key: "minus"): ZoomOut,

(modifiers: [Super], key: "b"): System(WebBrowser),
(modifiers: [Super], key: "f"): System(HomeFolder),
(modifiers: [Super], key: "t"): System(Terminal),
Expand Down
24 changes: 23 additions & 1 deletion resources/i18n/de/cosmic_comp.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
a11y-zoom-move-continuously = Ansicht bewegt kontinuierlich sich mit dem Cursor
a11y-zoom-move-onedge = Ansicht bewegt sich an den Rändern
a11y-zoom-move-centered = Ansicht hält Cursor zentriert
a11y-zoom-settings = Bildschirmlupe-Einstellungen...
grow-window = Vergrößern
shrink-window = Verkleinern
swap-windows = Fenster tauschen
stack-windows = Fenster stapeln
unknown-keybinding = <nicht zugewiesen>
unknown-keybinding = <nicht zugewiesen>
window-menu-minimize = Minimieren
window-menu-maximize = Maximieren
window-menu-tiled = Schwebendes Fenster
window-menu-screenshot = Bildschirmfoto aufnehmen
window-menu-move = Bewegen
window-menu-resize = Größe anpassen
window-menu-move-prev-workspace = Zur vorherigen Arbeitsfläche verschieben
window-menu-move-next-workspace = Zur nächsten Arbeitsfläche verschieben
window-menu-stack = Fensterstapel erstellen
window-menu-unstack-all = Fensterstapel auflösen
window-menu-unstack = Fenster aus Stapel lösen
window-menu-sticky = Klebendes Fenster
window-menu-close = Schließen
window-menu-close-all = Schließe alle Fenster
window-menu-resize-edge-top = Oben
window-menu-resize-edge-left = Links
window-menu-resize-edge-right = Rechts
window-menu-resize-edge-bottom = Unten
4 changes: 4 additions & 0 deletions resources/i18n/en/cosmic_comp.ftl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
a11y-zoom-move-continuously = View moves continuously with pointer
a11y-zoom-move-onedge = View moves when pointer reaches edge
a11y-zoom-move-centered = View moves to keep pointer centered
a11y-zoom-settings = Magnifier settings...
grow-window = Grow
shrink-window = Shrink
swap-windows = Swap Windows
Expand Down
14 changes: 11 additions & 3 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
use crate::state::State;
use anyhow::{anyhow, Context, Result};
use cosmic_comp_config::NumlockState;
use smithay::backend::input::{self as smithay_input};
use smithay::reexports::{calloop::EventLoop, wayland_server::DisplayHandle};
use smithay::utils::SERIAL_COUNTER;
use tracing::{info, warn};

pub mod render;
Expand Down Expand Up @@ -72,7 +70,17 @@ pub fn init_backend_auto(
.write()
.unwrap()
.seats
.add_seat(initial_seat);
.add_seat(initial_seat.clone());

if state
.common
.config
.cosmic_conf
.accessibility_zoom
.start_on_login
{
state.update_zoom(&initial_seat, 1.0, true);
}

let desired_numlock = state
.common
Expand Down
3 changes: 2 additions & 1 deletion src/backend/render/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ pub fn draw_cursor<R>(
seat: &Seat<State>,
location: Point<f64, Logical>,
scale: Scale<f64>,
buffer_scale: f64,
time: Time<Monotonic>,
draw_default: bool,
) -> Vec<(CursorRenderElement<R>, Point<i32, BufferCoords>)>
Expand Down Expand Up @@ -292,7 +293,7 @@ where
return Vec::new();
}

let integer_scale = scale.x.max(scale.y).ceil() as u32;
let integer_scale = (scale.x.max(scale.y) * buffer_scale).ceil() as u32;
let frame = state
.get_named_cursor(current_cursor)
.get_image(integer_scale, time.as_millis());
Expand Down
Loading
Loading