Skip to content

A named surface beside the copies reads the copy on its monitor - #142

Open
natepayn3 wants to merge 1 commit into
k4ditano:mainfrom
natepayn3:fix/named-surface-screen
Open

natepayn3 wants to merge 1 commit into
k4ditano:mainfrom
natepayn3:fix/named-surface-screen

Conversation

@natepayn3

Copy link
Copy Markdown
Contributor

In a scene copied per monitor (screens: each), a named surface with its own screens: (a panel that follows the monitor it was opened on, screens: some_text) read the plain screen.index, screen.width and screen.height, which are copy 0's. On the second monitor it measured the first one, and every loose let it shared with the copies, like if(panel_on == screen.index, 1, 0), was false there.

That made it impossible to draw a big panel once, on a surface of its own, instead of in every copy. A shell with a settings panel (Vitreus) pays for that panel in each copy: three monitors went over the 65 536 properties a scene can hold, and the bar did not start at all. With this, its settings can move to one surface: about 22 000 properties per copy go down to about 15 400.

What changes

  • Compiler: such a surface (named, not a lock, not a window, in a scene with screens: each copies) gets screen.index, .width and .height aliased to facts of its own, NAME.screen.*. A loose let that reads per-copy values is read once more for it, stored as name#on.NAME, the same way it is read once per copy (name#screenK).
  • Render: each round it sets those facts from the copy whose screen.K.name is the monitor the surface is on. On a monitor with no copy, index -1 and the scene's screen.width/height. Where those names are is found once per scene load, not every round.
  • Docs: one paragraph in the reference, under One per monitor.

Tested

  • New unit test a_named_surface_beside_the_copies_reads_the_copy_on_its_monitor. It fails without the change (left: [0.0], right: [1.0]).
  • cargo test --release: 197 passed. ./run-tests.sh: 353 checks, all as expected.
  • Headless (pleamar-wm headless, 2 monitors), checked with --say describe: a named surface on HEADLESS-2 reads index 1, its monitor's width, and a shared let as copy 1 does. Sent to HEADLESS-1 by changing its text, it reads index 0.

Written with Claude Code.

🤖 Generated with Claude Code

In a scene copied per monitor (`screens: each`), a named surface with its
own `screens:` read the plain `screen.index`, `.width` and `.height`,
which are copy 0's. A panel sent to the second monitor (`screens:
some_text`) measured the first one, and every loose `let` it shared with
the copies ("the panel is on this copy") was false there. So a shell
could not draw a panel once, on its own surface, instead of in every
copy, where it costs properties per monitor until the scene no longer
fits in 65 536.

Now such a surface reads `NAME.screen.*`, which the render keeps as the
values of the copy on the monitor it is shown on (index -1 where there is
no copy), and a loose `let` that reads per-copy values is read once more
for it, as it is for each copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant