Solaar/lib/solaar/ui/perkey
Ken Sanislo 6c99d2f9d1 PerKey dialog: size window from measured natural size
The dialog used hardcoded offsets to compute its target size from the
canvas's size_request:

    target_w = canvas_w + 32  # 8 wrapper border * 2 + ~16 scrollbar slack
    target_h = canvas_h + 80  # 8 wrapper border * 2 + 50 toolbar + slack

Two problems with that:

1. The "+32" only covered the canvas's width plus borders, not the
   toolbar's width. Small layouts (e.g. an 8-LED mouse: canvas ~172px)
   produced a window narrower than the toolbar wanted (~261px with
   the icon buttons + palette + color picker + unset toggle), causing
   toolbar overflow / clipping.

2. The "+80" assumed a fixed toolbar height and scrollbar slack —
   wrong on themes with chunkier buttons or different scrollbar
   metrics, and brittle to any future toolbar additions.

Replace with `wrapper.get_preferred_size()`. GTK already aggregates
the canvas's size_request through ScrolledWindow + the editor VBox +
the wrapper's border into a natural size that accounts for every
contribution, including the toolbar's width. Drop the now-unused
`canvas_size()` shim from PerKeyEditor.
2026-05-12 12:51:36 -04:00
..
layouts Add regional keyboard layouts (ISO_QWERTY, QWERTZ, AZERTY, JIS) and fix copyright 2026-05-10 17:52:55 -04:00
__init__.py Add regional keyboard layouts (ISO_QWERTY, QWERTZ, AZERTY, JIS) and fix copyright 2026-05-10 17:52:55 -04:00
_icons.py PerKey icons: read theme fg from style-updated, not Settings notify 2026-05-12 12:51:36 -04:00
binding.py Add regional keyboard layouts (ISO_QWERTY, QWERTZ, AZERTY, JIS) and fix copyright 2026-05-10 17:52:55 -04:00
canvas.py PerKey canvas: symmetric hash stripes for unset cells 2026-05-12 12:51:36 -04:00
control.py Add regional keyboard layouts (ISO_QWERTY, QWERTZ, AZERTY, JIS) and fix copyright 2026-05-10 17:52:55 -04:00
dialog.py PerKey dialog: size window from measured natural size 2026-05-12 12:51:36 -04:00
editor.py PerKey dialog: size window from measured natural size 2026-05-12 12:51:36 -04:00
layout.py Add regional keyboard layouts (ISO_QWERTY, QWERTZ, AZERTY, JIS) and fix copyright 2026-05-10 17:52:55 -04:00
palette.py PerKey icons: read theme fg from style-updated, not Settings notify 2026-05-12 12:51:36 -04:00
protocol.py Add regional keyboard layouts (ISO_QWERTY, QWERTZ, AZERTY, JIS) and fix copyright 2026-05-10 17:52:55 -04:00
tools.py Add regional keyboard layouts (ISO_QWERTY, QWERTZ, AZERTY, JIS) and fix copyright 2026-05-10 17:52:55 -04:00