Skip to content

feat(gui,core): span the DPI slider over 200-8000 and offer default presets - #2065

Draft
TheKas wants to merge 6 commits into
AprilNEA:masterfrom
TheKas:feat/dpi-slider-stops
Draft

TheKas wants to merge 6 commits into
AprilNEA:masterfrom
TheKas:feat/dpi-slider-stops

Conversation

@TheKas

@TheKas TheKas commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Split out of #1724 as requested there. Builds on #1059 (the numeric DPI field): the slider here stops at 8000, and values above it stay reachable only through that field. Review only the commits after the first. The first commit is #1059 at 0d0929da, ported onto master's SliderRow layout (the field sits beside the slider in the row's control slot), with its authors kept. Once #1059 is merged, that commit drops out. Draft until then.

  1. Sorted presets (496ff2ee). Preset chips are listed smallest first. Only the display is sorted, so the DPI-button cycle order stays as the user built it, and removing a chip still addresses it by its stored position.
  2. Slider stops (fdfafb7a). A gaming sensor such as the PRO X3 SUPERSTRIKE reports 977 values from 100 to 48000, in steps down to 1. The slider then moves tens of DPI per pixel and squeezes the usual range into its left end. It now stops at the supported values on the 50-DPI grid between 200 and 8000, which is the list an office mouse like the MX Master 4 reports and keeps as is. A list with fewer than two values on that grid is offered whole.
  3. Default presets (806a50e4). A mouse that never saved a preset list offers 800 and 1000, so its DPI button cycles from the start.
  4. Range label (e2f04f9f). The label under the slider shows the slider's range ("200–8000 · step 50") instead of the device's whole list, which read as if the slider still covered 100–48000.
  5. Stock levels stay the default (81e7b774). Since feat: add G502 LIGHTSPEED support (by @RisenID) #1729 the agent cycles a gaming layout's stock DPI levels while a mouse has no presets; the GUI showed none, and the 800/1000 defaults would have replaced them. Config::dpi_presets now makes that call for both: the user's list, else the layout's stock levels, else 800/1000.

Changes

  • openlogi-core:
    • DpiCapabilities::slider_stops(): the supported values on the 50-DPI grid from 200 to 8000, or the whole list when fewer than two fall on it.
    • DeviceConfig::dpi_presets becomes Option<Vec<Dpi>>. None (never set) offers the gaming layout's stock levels, else DEFAULT_DPI_PRESETS (800, 1000), through Config::dpi_presets(device_key, model_key), the one place the GUI and the agent's DPI cycle read. The defaults are never written. An emptied list is saved as dpi_presets = [] and stays empty. The identity fold keeps the canonical side's list, an emptied one included.
  • openlogi-desktop:
    • The slider is built over slider_stops(). A drag snaps to the nearest stop before the device's list resolves it, so it never lands on a value the slider doesn't offer. feat(gui): pair the DPI slider with an editable numeric field #1059's field still uses the device's whole list.
    • The range label follows the stops.
    • Presets are displayed sorted, with their stored index kept for removal.
    • AppState::dpi_presets reads the device's config key, the same key the agent's cycle uses, so both see the defaults alike.

Rebase onto 9ca7ef0

Rebased onto 9ca7ef0. The tray menu (new on master) now passes the model key to dpi_presets, the same way the agent's DPI cycle does, so the menu offers a gaming mouse's stock levels. The tray test for a mouse without presets now covers an emptied list, because an unconfigured mouse gets 800/1000 now.

Testing

Rebased onto master 9ca7ef0c, on the final tip 4944141b (Linux, Rust 1.99): cargo xtask ci with fmt, clippy --workspace --all-targets -D warnings, cargo test --workspace, rustdoc, MSRV, wasm. CI's clippy on Rust 1.100 also fails on unchanged master code (map_unwrap_or); that is fixed separately upstream. Locally, clippy 1.100 reports nothing in lines this PR touches; the last hit, in AppState::dpi_presets, now uses map_or_default.

Not run locally: typos, ast-grep, cargo deny, macOS/Windows tests and macOS clippy. The clippy (windows) proxy fails on this host before linting: openlogi-flow (quinn/rustls) now pulls ring into openlogi-agent-core, and ring needs a mingw C toolchain. The same happens on master. Windows clippy on the ring-free crates (core, hidpp, hid, hook, inject, camera) is clean; openlogi-agent and openlogi-agent-core are left to CI.

New tests:

  • Slider stops: a gaming list (100–48000, widening steps) yields 200–8000 in steps of 50, skipping values the sensor can't take; an office-mouse list stays unchanged; an off-grid list is offered whole.
  • Config: a device with no list offers the defaults without writing them; an emptied list is kept as []; the never-set lookup returns the defaults.
  • Presets: displayed smallest first with their stored positions.
  • Stock levels: a G502 LIGHTSPEED with no list offers 400–6400; a set list or an emptied one wins.

Tested on real hardware (Linux, PRO X3 SUPERSTRIKE via c54f, MX Master 4 over Bluetooth), on the same changes before the split: the X3's slider spans 200–8000 and its label reads "200–8000 · step 50". By construction it moves in steps of 100 between 2000 and 5000, because the sensor takes only steps of 20 there; that and a value above 8000 typed into #1059's field weren't checked separately. Not re-tested on hardware on top of #1059's 0d0929da.

Not runtime-tested on macOS or Windows.

Notes

  • The slider span and the default presets apply to every mouse. A sensor reporting values above 8000 keeps them reachable through the field only.
  • One-time side effect of the defaults: before this change an emptied preset list wasn't saved at all, so a mouse whose list was emptied that way now shows the defaults.
  • The 50-DPI grid is exact: the slider shows only values the sensor takes, never a rounded neighbour such as 2040 for 2050.

@TheKas TheKas changed the title Feat/dpi slider stops feat(gui,core): span the DPI slider over 200-8000 and offer default presets Oct 27, 2026
@TheKas
TheKas force-pushed the feat/dpi-slider-stops branch from 623c310 to 599448d Compare October 27, 2026 01:25
@davidbudnick davidbudnick added area: config Configuration files, persistence, and settings area: gui Graphical user interface platform: all Cross-platform issue type: feature New feature request labels Oct 27, 2026
TheKas pushed a commit to TheKas/OpenLogi that referenced this pull request Nov 6, 2026
AprilNEA#1059 at 0d0929d, ported onto master's SliderRow layout so AprilNEA#2065 can
build on it.

Co-authored-by: David Budnick <david@budnick.ca>
Co-authored-by: AprilNEA <github@sku.moe>
@TheKas
TheKas force-pushed the feat/dpi-slider-stops branch from 599448d to 81e7b77 Compare November 6, 2026 08:44
TheKas pushed a commit to TheKas/OpenLogi that referenced this pull request Nov 10, 2026
AprilNEA#1059 at 0d0929d, ported onto master's SliderRow layout so AprilNEA#2065 can
build on it.

Co-authored-by: David Budnick <david@budnick.ca>
Co-authored-by: AprilNEA <github@sku.moe>
@TheKas
TheKas force-pushed the feat/dpi-slider-stops branch from 81e7b77 to 7eedd5e Compare November 10, 2026 23:52
4ni1ak and others added 5 commits November 21, 2026 09:52
AprilNEA#1059 at 0d0929d, ported onto master's SliderRow layout so AprilNEA#2065 can
build on it.

Co-authored-by: David Budnick <david@budnick.ca>
Co-authored-by: AprilNEA <github@sku.moe>
The preset chips now show in ascending order. Only the display is sorted:
the stored list is the DPI-button cycle order and stays as the user built
it, and removing a chip still addresses its stored position.
A gaming sensor such as the PRO X3 SUPERSTRIKE reports 977 values from
100 to 48000 in steps down to 1, so the slider moved tens of DPI per
pixel and squeezed the usual range into its left end. The slider now
stops at the supported values on the 50-DPI grid between 200 and 8000,
the list an office mouse like the MX Master 4 reports and keeps as is.
The field beside it still takes any value the device supports, and a
list with fewer than two values on the grid is offered whole.
A mouse without a saved preset list showed no presets, and its DPI
button cycled nothing. Config::dpi_presets now offers 800 and 1000 while
the device never set a list, for the GUI and the agent's DPI cycle alike.
The defaults are not written to config.toml; a list the user empties is
saved as `dpi_presets = []` and stays empty.
Beside a slider that ends at 8000, the PRO X3's whole list read as
"100-48000 · step 1", as if the slider still covered it. The label now
shows the slider's stops: 200-8000 in steps of 50.
@TheKas
TheKas force-pushed the feat/dpi-slider-stops branch 2 times, most recently from 38b424e to c551e6d Compare November 21, 2026 08:59
The agent fell back to a gaming layout's stock levels when a mouse had no
presets, but the GUI did not, and the new 800/1000 defaults would have
replaced them. Config::dpi_presets now decides the default for both:
the user's list, else the layout's stock levels, else 800/1000.
@TheKas
TheKas force-pushed the feat/dpi-slider-stops branch from c551e6d to 4944141 Compare November 22, 2026 10:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: config Configuration files, persistence, and settings area: gui Graphical user interface platform: all Cross-platform issue type: feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants