diff options
| author | Ingmar Steen <iksteen@gmail.com> | 2026-09-06 19:59:13 +0200 |
|---|---|---|
| committer | Ingmar Steen <iksteen@gmail.com> | 2026-09-06 19:59:13 +0200 |
| commit | af82aff3cac5370cc08b2e0d7358097bfb2d9e45 (patch) | |
| tree | f13ad9272e021d039a462a96ce49f9c6b1929d68 /include | |
| parent | graphics: state z=0 on a placement, so a mirror paints it over the text (diff) | |
| download | slosh-af82aff3cac5370cc08b2e0d7358097bfb2d9e45.tar.gz slosh-af82aff3cac5370cc08b2e0d7358097bfb2d9e45.tar.xz slosh-af82aff3cac5370cc08b2e0d7358097bfb2d9e45.zip | |
graphics: place what a float leaves of an image, not nothing
Occlusion for placements is clipping: the cell compositor gets it free
from paint order, but images are sent after the diff and drawn over it,
so what a float covers has to be taken out of the placement itself. A
clean edge came out as a smaller rectangle; anything else -- a float
across the middle, a float on a corner, a float wholly inside -- was
refused, on the grounds that the remainder is an L and a placement is a
rectangle. The image vanished, all of it, the moment a floating pane
crossed it, on the terminal and in the mirror alike, and came back when
the float moved off.
The remainder is not one rectangle, but it is always a few: the strips
above and below what is covered, and what is left beside it between
them. So rect_subtract() cuts the visible remainder into rectangles and
each is placed in its own right, with the source rectangle the same
arithmetic the pane edge already used -- generalised to a cut on any
side, and to a first piece that keeps the sub-cell offset while the
others start on a cell boundary. Eight pieces is the ceiling (two
floats' worth); past it the old refusal stands.
The pieces of one placement need an id each, and the program's own
placement id is one number that cannot be several, so the model now
hands out the placement ids the client is told and keeps the program's
as the identity it was. `graphics` reports the piece alongside it.
Checked against a float parked over an image: the picture is cut around
the float, the strips tile exactly the image minus what the float
covers, and their source rectangles land where their cells do (a float
inside a 40x10-cell natural-size image gives 320x32 above, 320x32
below, 56x96 left and 72x96 right).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CRz3zwZJvBvzsR9k4cj6dd
Diffstat (limited to 'include')
| -rw-r--r-- | include/graphics.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/graphics.h b/include/graphics.h index b84b574..cebb53c 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -26,10 +26,20 @@ typedef struct { bool sent; } gfx_image_t; -/* One placement on screen this frame. */ +/* One placement on screen this frame -- or one visible piece of it, when + * something on top has cut it into more than one rectangle. */ typedef struct { uint32_t out_id; - uint32_t place_id; + uint32_t place_id; /* the id the program chose */ + /* Which visible rectangle of that placement this is. A placement nothing + * covers has one piece; a float across the middle of an image leaves two, + * and a float in a corner leaves two or three -- each of them a placement + * of its own on the wire, which is the only shape the protocol has. */ + uint16_t piece; + /* The placement id the client is told, ours to hand out: the pieces of one + * placement need an id each, and the program's own id is one number that + * cannot be several. */ + uint32_t wire_id; uint16_t col, row; /* screen cells */ uint16_t cols, rows; /* Where the image starts *inside* its first cell, in pixels. This is what @@ -63,6 +73,7 @@ typedef struct { uint32_t src_id; /* the id the program chose */ uint64_t gen; /* image generation, so a changed image is re-sent */ uint32_t place_id; + uint16_t piece; /* which visible rectangle of it */ uint16_t col, row; /* screen cells */ uint16_t cols, rows; /* cells covered */ uint16_t scale_cols, scale_rows; /* cells to scale into, 0 for natural */ |
